You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2013/09/20 20:59:50 UTC
svn commit: r1525101 [3/21] - in /qpid/branches/linearstore/qpid: ./ bin/
cpp/ cpp/bindings/ cpp/bindings/qmf/ cpp/bindings/qmf/python/
cpp/bindings/qmf/ruby/ cpp/bindings/qmf/tests/ cpp/bindings/qmf2/
cpp/bindings/qmf2/examples/cpp/ cpp/bindings/qmf2/...
Modified: qpid/branches/linearstore/qpid/cpp/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/CMakeLists.txt?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/CMakeLists.txt (original)
+++ qpid/branches/linearstore/qpid/cpp/src/CMakeLists.txt Fri Sep 20 18:59:30 2013
@@ -26,6 +26,16 @@ foreach (r ${REQUIRE})
message(STATUS "Forcing ${r} to ${${r}_force}")
endforeach(r)
+# Capture specified C++ compiler (if any)
+if (NOT ENV_CXX)
+ if (NOT "$ENV{CXX}" STREQUAL "")
+ set(CXX $ENV{CXX})
+ else(NOT "$ENV{CXX}" STREQUAL "")
+ set(CXX ${CMAKE_CXX_COMPILER})
+ endif(NOT "$ENV{CXX}" STREQUAL "")
+ set(ENV_CXX ${CXX} CACHE INTERNAL "C++ compiler specified in cmake environment")
+endif (NOT ENV_CXX)
+
include(CheckFunctionExists)
include(CheckIncludeFileCXX)
include(CheckIncludeFiles)
@@ -145,6 +155,13 @@ MACRO (add_msvc_version verProject verPr
endif (MSVC)
ENDMACRO (add_msvc_version)
+# Add a test to check the exported library API against expected API symbols
+MACRO (add_api_test libname)
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+ add_test(api_check_${libname} ${CMAKE_CURRENT_SOURCE_DIR}/check-abi "${ENV_CXX}" ${CMAKE_CURRENT_BINARY_DIR}/lib${libname}.so ${CMAKE_CURRENT_SOURCE_DIR}/lib${libname}-api-symbols.txt)
+ endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+ENDMACRO (add_api_test libname)
+
#
# Install optional windows version settings. Override variables are specified in a file.
@@ -263,6 +280,9 @@ if (ENABLE_VALGRIND AND NOT VALGRIND)
message(STATUS "Can't locate the valgrind command; no run-time error detection")
endif (ENABLE_VALGRIND AND NOT VALGRIND)
+# Do not keep on linking against transitive library dependencies
+set (CMAKE_LINK_INTERFACE_LIBRARIES "")
+
if (CMAKE_COMPILER_IS_GNUCXX)
# Warnings: Enable as many as possible, keep the code clean. Please
# do not disable warnings or remove -Werror without discussing on
@@ -279,18 +299,24 @@ if (CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_SYSTEM_NAME STREQUAL SunOS)
set (CATCH_UNDEFINED "")
endif (CMAKE_SYSTEM_NAME STREQUAL SunOS)
- set (COMPILER_FLAGS "-fvisibility-inlines-hidden")
+ set (COMPILER_FLAGS "-fvisibility-inlines-hidden -Wl,--as-needed")
# gcc 4.1.2 on RHEL 5 needs -Wno-attributes to avoid an error that's fixed
# in later gcc versions.
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_EQUAL 4.1.2)
+ set (COMPILER_FLAGS "-Wl,--as-needed")
message (STATUS "Cannot use -fvisibility=hidden on gcc 4.1.2")
else (GCC_VERSION VERSION_EQUAL 4.1.2)
- set (HIDE_SYMBOL_FLAGS "-fvisibility=hidden")
+ set (HIDE_SYMBOL_FLAGS "-fno-visibility-inlines-hidden -fvisibility=hidden")
endif (GCC_VERSION VERSION_EQUAL 4.1.2)
endif (CMAKE_COMPILER_IS_GNUCXX)
+if (CMAKE_SYSTEM_NAME STREQUAL Linux)
+ set (QPID_LINKMAP ${CMAKE_CURRENT_SOURCE_DIR}/qpid.linkmap)
+ set (LINK_VERSION_SCRIPT_FLAG "-Wl,--version-script=${QPID_LINKMAP}")
+endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
+
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
set (COMPILER_FLAGS "-library=stlport4 -mt")
set (WARNING_FLAGS "+w")
@@ -301,9 +327,9 @@ endif (CMAKE_CXX_COMPILER_ID STREQUAL Su
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
# Allow MSVC user to select 'WinXP-SP3/Windows Server 2003' as build target version
set (win32_winnt_default OFF)
- if (MSVC)
- set (win32_winnt_default ON)
- endif (MSVC)
+ if (MSVC)
+ set (win32_winnt_default ON)
+ endif (MSVC)
option(SET_WIN32_WINNT "In Windows-MSVC build: define _WIN32_WINNT=0x0502 to select target version: Windows XP with SP3" ${win32_winnt_default})
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
@@ -356,7 +382,7 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Window
# where Boost 1.45 is supported, or we can just accept some versions using
# the Additional_versions variable.
if (NOT DEFINED Boost_ADDITIONAL_VERSIONS)
- set (Boost_ADDITIONAL_VERSIONS
+ set (Boost_ADDITIONAL_VERSIONS
"1.45" "1.45.0" "1.46" "1.46.0" "1.47" "1.47.0"
"1.48" "1.48.0" "1.49" "1.49.0" "1.50" "1.50.0"
"1.51" "1.51.0" "1.52" "1.52.0" "1.53" "1.53.0")
@@ -513,44 +539,49 @@ include_directories( ${CMAKE_CURRENT_BIN
link_directories( ${Boost_LIBRARY_DIRS} )
-CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_RT)
-if (NOT CLOCK_GETTIME_IN_RT)
- CHECK_FUNCTION_EXISTS (clock_gettime QPID_HAS_CLOCK_GETTIME)
-else (NOT CLOCK_GETTIME_IN_RT)
- set(CMAKE_REQUIRED_LIBS ${CMAKE_REQUIRED_LIBS} rt)
- set(QPID_HAS_CLOCK_GETTIME YES CACHE BOOL "Platform has clock_gettime")
-endif (NOT CLOCK_GETTIME_IN_RT)
-
-# Check for header file for dtrace static probes
-check_include_files(sys/sdt.h HAVE_SYS_SDT_H)
-if (HAVE_SYS_SDT_H)
- set(probes_default ON)
-endif (HAVE_SYS_SDT_H)
-option(BUILD_PROBES "Build with DTrace/systemtap static probes" ${probes_default})
-if (NOT BUILD_PROBES)
- set (HAVE_SYS_SDT_H 0)
-endif (NOT BUILD_PROBES)
-
-# Check for poll/epoll header files
-check_include_files(sys/poll.h HAVE_POLL)
-check_include_files(sys/epoll.h HAVE_EPOLL)
-
-# Set default poller implementation (check from general to specific to allow overriding)
-if (HAVE_POLL)
- set(poller_default poll)
-endif (HAVE_POLL)
-if (HAVE_EPOLL)
- set(poller_default epoll)
-endif (HAVE_EPOLL)
-set(POLLER ${poller_default} CACHE STRING "Poller implementation (poll/epoll)")
-
-# If not windows ensure that we have uuid library
+# These dependencies aren't found on windows
if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+ # Ensure we have clock_gettime
+ CHECK_FUNCTION_EXISTS (clock_gettime CLOCK_GETTIME_IN_LIBC)
+ if (NOT CLOCK_GETTIME_IN_LIBC)
+ CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_RT)
+ if (CLOCK_GETTIME_IN_RT)
+ set(clock_gettime_LIB "rt")
+ else ()
+ message(FATAL_ERROR "Cannot find clock_gettime()")
+ endif (CLOCK_GETTIME_IN_RT)
+ endif (NOT CLOCK_GETTIME_IN_LIBC)
+
+ # Ensure we have uuid library
CHECK_LIBRARY_EXISTS (uuid uuid_compare "" HAVE_UUID)
CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
if (NOT HAVE_UUID AND NOT HAVE_UUID_H)
message(FATAL_ERROR "Uuid library and/or header file not found")
endif (NOT HAVE_UUID AND NOT HAVE_UUID_H)
+ set (uuid_LIB "uuid")
+
+ # Check for header file for dtrace static probes
+ check_include_files(sys/sdt.h HAVE_SYS_SDT_H)
+ if (HAVE_SYS_SDT_H)
+ set(probes_default ON)
+ endif (HAVE_SYS_SDT_H)
+ option(BUILD_PROBES "Build with DTrace/systemtap static probes" ${probes_default})
+ if (NOT BUILD_PROBES)
+ set (HAVE_SYS_SDT_H 0)
+ endif (NOT BUILD_PROBES)
+
+ # Check for poll/epoll header files
+ check_include_files(sys/poll.h HAVE_POLL)
+ check_include_files(sys/epoll.h HAVE_EPOLL)
+
+ # Set default poller implementation (check from general to specific to allow overriding)
+ if (HAVE_POLL)
+ set(poller_default poll)
+ endif (HAVE_POLL)
+ if (HAVE_EPOLL)
+ set(poller_default epoll)
+ endif (HAVE_EPOLL)
+ set(POLLER ${poller_default} CACHE STRING "Poller implementation (poll/epoll)")
endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
# See if Cyrus SASL is desired and available
@@ -578,7 +609,10 @@ if (BUILD_SASL)
qpid/sys/cyrus/CyrusSecurityLayer.h
qpid/sys/cyrus/CyrusSecurityLayer.cpp
)
- set(qpidcommon_sasl_lib sasl2)
+ set(sasl_LIB sasl2)
+else (BUILD_SASL)
+ set(HAVE_SASL OFF)
+ set(BROKER_SASL_NAME "qpidd" CACHE STRING "SASL app name for the qpid broker")
endif (BUILD_SASL)
# Optional SSL/TLS support. Requires Netscape Portable Runtime on Linux.
@@ -604,27 +638,23 @@ if (BUILD_SSL)
set (sslcommon_SOURCES
qpid/sys/windows/SslAsynchIO.cpp
)
+
set (ssl_SOURCES
qpid/broker/windows/SslProtocolFactory.cpp
)
+
set (sslconnector_SOURCES
qpid/client/windows/SslConnector.cpp
)
- set (windows_ssl_libs Secur32.lib)
- set (windows_ssl_server_libs Crypt32.lib)
+ set (ssl_INCLUDES "")
+ set (ssl_LIBDIRS "")
+ set (ssl_LIBS Secur32.lib)
+ set (ssl_server_LIBS Crypt32.lib Secur32.lib)
else (CMAKE_SYSTEM_NAME STREQUAL Windows)
if (NOT NSS_FOUND)
message(FATAL_ERROR "nss/nspr not found, required for ssl support")
endif (NOT NSS_FOUND)
- foreach(f ${NSS_CFLAGS})
- set (NSS_COMPILE_FLAGS "${NSS_COMPILE_FLAGS} ${f}")
- endforeach(f)
-
- foreach(f ${NSS_LDFLAGS})
- set (NSS_LINK_FLAGS "${NSS_LINK_FLAGS} ${f}")
- endforeach(f)
-
set (sslcommon_SOURCES
qpid/sys/ssl/check.h
qpid/sys/ssl/check.cpp
@@ -643,14 +673,17 @@ if (BUILD_SSL)
qpid/messaging/amqp/SslTransport.cpp
)
- set_source_files_properties (
- ${sslcommon_SOURCES}
- ${ssl_SOURCES}
- ${sslconnector_SOURCES}
- PROPERTIES
- COMPILE_FLAGS "${NSS_COMPILE_FLAGS}"
- )
+ set (ssl_INCLUDES "${NSS_INCLUDE_DIRS}")
+ set (ssl_LIBDIRS "${NSS_LIBRARY_DIRS}")
+ set (ssl_LIBS "${NSS_LIBRARIES}")
+ set (ssl_server_LIBS "${NSS_LIBRARIES}")
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
+
+ # Add include directories and link directories for NSS
+ # unfortunately this doesn't get done automatically for
+ # libraries detected by FindPkgConfig
+ include_directories(${ssl_INCLUDES})
+ link_directories(${ssl_LIBDIRS})
endif (BUILD_SSL)
# See if XML Exchange is desired and prerequisites are available
@@ -690,7 +723,7 @@ if (BUILD_XML)
qpid/xml/XmlExchange.cpp
qpid/xml/XmlExchange.h
qpid/xml/XmlExchangePlugin.cpp)
- target_link_libraries (xml xerces-c xqilla qpidbroker pthread)
+ target_link_libraries (xml xerces-c xqilla qpidbroker qpidcommon)
set_target_properties (xml PROPERTIES
PREFIX ""
COMPILE_DEFINITIONS _IN_QPID_BROKER
@@ -744,16 +777,15 @@ if (BUILD_HA)
qpid/ha/BrokerReplicator.h
qpid/ha/ConnectionObserver.cpp
qpid/ha/ConnectionObserver.h
+ qpid/ha/Event.cpp
+ qpid/ha/Event.h
qpid/ha/FailoverExchange.cpp
qpid/ha/FailoverExchange.h
qpid/ha/HaBroker.cpp
qpid/ha/HaBroker.h
qpid/ha/HaPlugin.cpp
- qpid/ha/hash.h
qpid/ha/IdSetter.h
qpid/ha/QueueSnapshot.h
- qpid/ha/makeMessage.cpp
- qpid/ha/makeMessage.h
qpid/ha/Membership.cpp
qpid/ha/Membership.h
qpid/ha/Primary.cpp
@@ -773,18 +805,22 @@ if (BUILD_HA)
qpid/ha/StandAlone.h
qpid/ha/StatusCheck.cpp
qpid/ha/StatusCheck.h
+ qpid/ha/PrimaryTxObserver.cpp
+ qpid/ha/PrimaryTxObserver.h
qpid/ha/types.cpp
+ qpid/ha/TxReplicator.cpp
+ qpid/ha/TxReplicator.h
qpid/ha/types.h
)
add_library (ha MODULE ${ha_SOURCES})
- set_target_properties (ha PROPERTIES PREFIX "" COMPILE_DEFINITIONS _IN_QPID_BROKER)
- target_link_libraries (ha qpidtypes qpidcommon qpidbroker qpidmessaging)
- if (CMAKE_COMPILER_IS_GNUCXX)
- set_target_properties (ha PROPERTIES
- PREFIX ""
- LINK_FLAGS -Wl,--no-undefined)
- endif (CMAKE_COMPILER_IS_GNUCXX)
+ target_link_libraries (ha
+ qpidtypes qpidcommon qpidbroker qpidmessaging
+ "${Boost_PROGRAM_OPTIONS_LIBRARY}")
+ set_target_properties (ha PROPERTIES
+ PREFIX ""
+ COMPILE_DEFINITIONS _IN_QPID_BROKER
+ LINK_FLAGS "${CATCH_UNDEFINED}")
install (TARGETS ha
DESTINATION ${QPIDD_MODULE_DIR}
COMPONENT ${QPID_COMPONENT_BROKER})
@@ -799,7 +835,7 @@ include (amqp.cmake)
# Check for syslog capabilities not present on all systems
check_symbol_exists (LOG_AUTHPRIV "sys/syslog.h" HAVE_LOG_AUTHPRIV)
check_symbol_exists (LOG_FTP "sys/syslog.h" HAVE_LOG_FTP)
-
+
# Set default Memory Status module (Null implementation)
set (qpid_memstat_module
qpid/sys/MemStat.cpp
@@ -834,20 +870,20 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
)
set (qpidcommon_platform_LIBS
- ${Boost_THREAD_LIBRARY} ${windows_ssl_libs} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ws2_32 )
+ ${Boost_THREAD_LIBRARY}
+ ${Boost_DATE_TIME_LIBRARY}
+ ${Boost_SYSTEM_LIBRARY}
+ ws2_32
+ )
+
set (qpidbroker_platform_SOURCES
qpid/broker/windows/BrokerDefaults.cpp
qpid/broker/windows/SaslAuthenticator.cpp
)
- set (qpidbroker_platform_LIBS
- ${windows_ssl_libs} ${windows_ssl_server_libs}
- )
+
set (qpidclient_platform_SOURCES
qpid/client/windows/ClientDllMain.cpp
)
- set (qpidclient_platform_LIBS
- ${windows_ssl_libs}
- )
set (qpidd_platform_SOURCES
windows/QpiddBroker.cpp
@@ -885,7 +921,7 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows
# On Linux override memory status module
set (qpid_memstat_module
qpid/sys/posix/MemStat.cpp
- )
+ )
endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
if (CMAKE_SYSTEM_NAME STREQUAL SunOS)
@@ -908,8 +944,7 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows
set (qpidtypes_platform_SOURCES)
set (qpidtypes_platform_LIBS
- uuid
- ${Boost_SYSTEM_LIBRARY}
+ "${uuid_LIB}"
)
set (qpidcommon_platform_SOURCES
@@ -934,9 +969,11 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows
${qpid_system_module}
${qpid_poller_module}
)
+
set (qpidcommon_platform_LIBS
- ${Boost_PROGRAM_OPTIONS_LIBRARY}
- ${CMAKE_DL_LIBS}
+ "${CMAKE_DL_LIBS}"
+ "${clock_gettime_LIB}"
+ "${uuid_LIB}"
)
set (qpidbroker_platform_SOURCES
@@ -977,6 +1014,7 @@ set (qpidcommon_SOURCES
qpid/StringUtils.cpp
qpid/Url.cpp
qpid/UrlArray.cpp
+ qpid/NullSaslClient.cpp
qpid/NullSaslServer.cpp
qpid/amqp_0_10/SessionHandler.cpp
qpid/framing/AccumulatedAck.cpp
@@ -1024,12 +1062,16 @@ set (qpidcommon_SOURCES
qpid/amqp_0_10/Codecs.cpp
qpid/amqp/CharSequence.h
qpid/amqp/CharSequence.cpp
+ qpid/amqp/DataBuilder.h
+ qpid/amqp/DataBuilder.cpp
qpid/amqp/Decoder.h
qpid/amqp/Decoder.cpp
qpid/amqp/Descriptor.h
qpid/amqp/Descriptor.cpp
qpid/amqp/Encoder.h
qpid/amqp/Encoder.cpp
+ qpid/amqp/ListBuilder.h
+ qpid/amqp/ListBuilder.cpp
qpid/amqp/MapHandler.h
qpid/amqp/MapEncoder.h
qpid/amqp/MapEncoder.cpp
@@ -1060,20 +1102,17 @@ set (qpidcommon_SOURCES
add_msvc_version (qpidcommon library dll)
add_library (qpidcommon SHARED ${qpidcommon_SOURCES})
-if (CLOCK_GETTIME_IN_RT)
- set (qpidcommon_platform_LIBS ${qpidcommon_platform_LIBS} rt)
-endif (CLOCK_GETTIME_IN_RT)
-# Not all platforms have NSS_LINK_FLAGS
-if (NSS_LINK_FLAGS)
- set (qpidcommon_LINK_FLAGS LINK_FLAGS ${NSS_LINK_FLAGS})
-endif (NSS_LINK_FLAGS)
+
target_link_libraries (qpidcommon qpidtypes
${qpidcommon_platform_LIBS}
- ${qpidcommon_sasl_lib})
+ ${Boost_PROGRAM_OPTIONS_LIBRARY}
+ "${sasl_LIB}"
+ ${ssl_LIBS})
+
set_target_properties (qpidcommon PROPERTIES
- VERSION ${qpidcommon_version}
- SOVERSION ${qpidcommon_version_major}
- ${qpidcommon_LINK_FLAGS})
+ VERSION ${qpidcommon_version}
+ SOVERSION ${qpidcommon_version_major})
+
install (TARGETS qpidcommon
DESTINATION ${QPID_INSTALL_LIBDIR}
COMPONENT ${QPID_COMPONENT_COMMON})
@@ -1085,17 +1124,26 @@ set(qpidtypes_SOURCES
qpid/types/Variant.cpp
${qpidtypes_platform_SOURCES}
)
+set_source_files_properties(
+ ${qpidtypes_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "${HIDE_SYMBOL_FLAGS}")
+
add_msvc_version (qpidtypes library dll)
add_library(qpidtypes SHARED ${qpidtypes_SOURCES})
target_link_libraries(qpidtypes ${qpidtypes_platform_LIBS})
-set_target_properties (qpidtypes PROPERTIES
+set_target_properties (qpidtypes PROPERTIES
+ LINK_FLAGS "${HIDE_SYMBOL_FLAGS} ${LINK_VERSION_SCRIPT_FLAG}"
VERSION ${qpidtypes_version}
SOVERSION ${qpidtypes_version_major})
+
install(TARGETS qpidtypes
DESTINATION ${QPID_INSTALL_LIBDIR}
COMPONENT ${QPID_COMPONENT_COMMON})
install_pdb (qpidtypes ${QPID_COMPONENT_COMMON})
+add_api_test(qpidtypes)
+
set (qpidclient_SOURCES
${rgen_client_srcs}
${qpidclient_platform_SOURCES}
@@ -1137,9 +1185,15 @@ set (qpidclient_SOURCES
add_msvc_version (qpidclient library dll)
add_library (qpidclient SHARED ${qpidclient_SOURCES})
-target_link_libraries (qpidclient qpidcommon ${qpidclient_platform_LIBS})
-set_target_properties (qpidclient PROPERTIES VERSION ${qpidclient_version}
-SOVERSION ${qpidclient_version_major})
+
+target_link_libraries (qpidclient qpidcommon
+ ${Boost_PROGRAM_OPTIONS_LIBRARY}
+ ${ssl_LIBS})
+
+set_target_properties (qpidclient PROPERTIES
+ VERSION ${qpidclient_version}
+ SOVERSION ${qpidclient_version_major})
+
install (TARGETS qpidclient
DESTINATION ${QPID_INSTALL_LIBDIR}
COMPONENT ${QPID_COMPONENT_CLIENT})
@@ -1202,27 +1256,25 @@ set (qpidmessaging_SOURCES
qpid/messaging/amqp/EncodedMessage.h
qpid/messaging/amqp/EncodedMessage.cpp
)
+set_source_files_properties(
+ ${qpidmessaging_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "${HIDE_SYMBOL_FLAGS}")
+
add_msvc_version (qpidmessaging library dll)
add_library (qpidmessaging SHARED ${qpidmessaging_SOURCES})
-target_link_libraries (qpidmessaging qpidclient)
-set_target_properties (qpidmessaging PROPERTIES
- VERSION ${qpidmessaging_version}
+target_link_libraries (qpidmessaging qpidtypes qpidclient qpidcommon)
+set_target_properties (qpidmessaging PROPERTIES
+ LINK_FLAGS "${HIDE_SYMBOL_FLAGS} ${LINK_VERSION_SCRIPT_FLAG}"
+ VERSION ${qpidmessaging_version}
SOVERSION ${qpidmessaging_version_major})
install (TARGETS qpidmessaging
DESTINATION ${QPID_INSTALL_LIBDIR}
COMPONENT ${QPID_COMPONENT_CLIENT})
install_pdb (qpidmessaging ${QPID_COMPONENT_CLIENT})
-# Released source artifacts from Apache have the generated headers included in
-# the source tree, not the binary tree. So don't attempt to grab them when
-# they're not supposed to be there.
-if (NOT QPID_GENERATED_HEADERS_IN_SOURCE)
- install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../include/qpid
- DESTINATION ${QPID_INSTALL_INCLUDEDIR}
- COMPONENT ${QPID_COMPONENT_CLIENT_INCLUDE})
-endif (NOT QPID_GENERATED_HEADERS_IN_SOURCE)
-
+add_api_test(qpidmessaging)
if (MSVC)
# Install the DtcPlugin project and call it qpidxarm.
@@ -1312,6 +1364,7 @@ set (qpidbroker_SOURCES
qpid/broker/SelectorToken.cpp
qpid/broker/SelectorValue.h
qpid/broker/SelectorValue.cpp
+ qpid/broker/SelfDestructQueue.cpp
qpid/broker/SemanticState.h
qpid/broker/SemanticState.cpp
qpid/broker/SessionAdapter.cpp
@@ -1337,11 +1390,17 @@ set (qpidbroker_SOURCES
)
add_msvc_version (qpidbroker library dll)
add_library (qpidbroker SHARED ${qpidbroker_SOURCES})
-target_link_libraries (qpidbroker qpidcommon ${qpidbroker_platform_LIBS})
-set_target_properties (qpidbroker PROPERTIES
+
+target_link_libraries (qpidbroker qpidcommon qpidtypes
+ "${Boost_PROGRAM_OPTIONS_LIBRARY}"
+ "${sasl_LIB}"
+ ${ssl_server_LIBS})
+
+set_target_properties (qpidbroker PROPERTIES
VERSION ${qpidbroker_version}
- SOVERSION ${qpidbroker_version_major}
+ SOVERSION ${qpidbroker_version_major}
COMPILE_DEFINITIONS _IN_QPID_BROKER)
+
if (MSVC)
set_target_properties (qpidbroker PROPERTIES COMPILE_FLAGS /wd4290)
endif (MSVC)
@@ -1373,30 +1432,6 @@ if (UNIX)
install (CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/${QPID_LOCALSTATE_DIR}/spool/qpidd)")
endif (UNIX)
-set (qmf_SOURCES
- qpid/agent/ManagementAgentImpl.cpp
- qpid/agent/ManagementAgentImpl.h
- )
-set (qmf_HEADERS
- ../include/qpid/agent/ManagementAgent.h
- ../include/qpid/agent/QmfAgentImportExport.h
- ../include/qmf/BrokerImportExport.h
- )
-
-add_msvc_version (qmf library dll)
-add_library (qmf SHARED ${qmf_SOURCES})
-target_link_libraries (qmf qmfengine)
-set_target_properties (qmf PROPERTIES
- VERSION ${qmf_version}
- SOVERSION ${qmf_version_major})
-install (TARGETS qmf OPTIONAL
- DESTINATION ${QPID_INSTALL_LIBDIR}
- COMPONENT ${QPID_COMPONENT_QMF})
-install (FILES ${qmf_HEADERS}
- DESTINATION ${QPID_INSTALL_INCLUDEDIR}/qpid/agent
- COMPONENT ${QPID_COMPONENT_QMF})
-install_pdb (qmf ${QPID_COMPONENT_QMF})
-
if (NOT WIN32)
set (qmf2_platform_headers
../include/qmf/posix/EventNotifier.h
@@ -1477,7 +1512,7 @@ endif (NOT WIN32)
add_library (qmf2 SHARED ${qmf2_SOURCES})
target_link_libraries (qmf2 qpidmessaging qpidtypes qpidclient qpidcommon)
set_target_properties (qmf2 PROPERTIES
- VERSION ${qmf2_version}
+ VERSION ${qmf2_version}
SOVERSION ${qmf2_version_major})
install (TARGETS qmf2 OPTIONAL
DESTINATION ${QPID_INSTALL_LIBDIR}
@@ -1487,111 +1522,6 @@ endif (NOT WIN32)
COMPONENT ${QPID_COMPONENT_QMF})
install_pdb (qmf2 ${QPID_COMPONENT_QMF})
-set (qmfengine_SOURCES
- qmf/engine/Agent.cpp
- qmf/engine/BrokerProxyImpl.cpp
- qmf/engine/BrokerProxyImpl.h
- qmf/engine/ConnectionSettingsImpl.cpp
- qmf/engine/ConnectionSettingsImpl.h
- qmf/engine/ConsoleImpl.cpp
- qmf/engine/ConsoleImpl.h
- qmf/engine/EventImpl.cpp
- qmf/engine/EventImpl.h
- qmf/engine/MessageImpl.cpp
- qmf/engine/MessageImpl.h
- qmf/engine/ObjectIdImpl.cpp
- qmf/engine/ObjectIdImpl.h
- qmf/engine/ObjectImpl.cpp
- qmf/engine/ObjectImpl.h
- qmf/engine/Protocol.cpp
- qmf/engine/Protocol.h
- qmf/engine/QueryImpl.cpp
- qmf/engine/QueryImpl.h
- qmf/engine/SequenceManager.cpp
- qmf/engine/SequenceManager.h
- qmf/engine/SchemaImpl.cpp
- qmf/engine/SchemaImpl.h
- qmf/engine/ValueImpl.cpp
- qmf/engine/ValueImpl.h
- )
-
-set (qmfengine_HEADERS
- ../include/qmf/engine/Agent.h
- ../include/qmf/engine/ConnectionSettings.h
- ../include/qmf/engine/Console.h
- ../include/qmf/engine/Event.h
- ../include/qmf/engine/Message.h
- ../include/qmf/engine/Object.h
- ../include/qmf/engine/ObjectId.h
- ../include/qmf/engine/QmfEngineImportExport.h
- ../include/qmf/engine/Query.h
- ../include/qmf/engine/ResilientConnection.h
- ../include/qmf/engine/Schema.h
- ../include/qmf/engine/Typecode.h
- ../include/qmf/engine/Value.h
- )
-install (FILES ${qmfengine_HEADERS}
- DESTINATION ${QPID_INSTALL_INCLUDEDIR}/qmf/engine
- COMPONENT ${QPID_COMPONENT_QMF})
-
-if (NOT WIN32)
- list(APPEND qmfengine_SOURCES qmf/engine/ResilientConnection.cpp)
-endif (NOT WIN32)
-add_msvc_version (qmfengine library dll)
-
-add_library (qmfengine SHARED ${qmfengine_SOURCES})
-target_link_libraries (qmfengine qpidclient)
-set_target_properties (qmfengine PROPERTIES
- VERSION ${qmfengine_version}
- SOVERSION ${qmfengine_version_major})
-install (TARGETS qmfengine OPTIONAL
- DESTINATION ${QPID_INSTALL_LIBDIR}
- COMPONENT ${QPID_COMPONENT_QMF})
-install_pdb (qmfengine ${QPID_COMPONENT_QMF})
-
-set (qmfconsole_SOURCES
- qpid/console/Agent.cpp
- qpid/console/Broker.cpp
- qpid/console/ClassKey.cpp
- qpid/console/Event.cpp
- qpid/console/Object.cpp
- qpid/console/ObjectId.cpp
- qpid/console/Package.cpp
- qpid/console/Schema.cpp
- qpid/console/SequenceManager.cpp
- qpid/console/SessionManager.cpp
- qpid/console/Value.cpp
- )
-set (qmfconsole_HEADERS
- ../include/qpid/console/Agent.h
- ../include/qpid/console/Broker.h
- ../include/qpid/console/ClassKey.h
- ../include/qpid/console/ConsoleImportExport.h
- ../include/qpid/console/ConsoleListener.h
- ../include/qpid/console/Event.h
- ../include/qpid/console/Object.h
- ../include/qpid/console/ObjectId.h
- ../include/qpid/console/Package.h
- ../include/qpid/console/Schema.h
- ../include/qpid/console/SequenceManager.h
- ../include/qpid/console/SessionManager.h
- ../include/qpid/console/Value.h
- )
-add_msvc_version (qmfconsole library dll)
-add_library (qmfconsole SHARED ${qmfconsole_SOURCES})
-target_link_libraries (qmfconsole qpidclient)
-set_target_properties (qmfconsole PROPERTIES
- VERSION ${qmfconsole_version}
- SOVERSION ${qmfconsole_version_major})
-install (TARGETS qmfconsole
- DESTINATION ${QPID_INSTALL_LIBDIR}
- COMPONENT ${QPID_COMPONENT_QMF})
-install (FILES ${qmfconsole_HEADERS}
- DESTINATION ${QPID_INSTALL_INCLUDEDIR}/qpid/console
- COMPONENT ${QPID_COMPONENT_QMF})
-install_pdb (qmfconsole ${QPID_COMPONENT_QMF})
-
-
#
# Legacy store
#
Propchange: qpid/branches/linearstore/qpid/cpp/src/CMakeLists.txt
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/cpp/src/CMakeLists.txt:r1501885-1525056
Modified: qpid/branches/linearstore/qpid/cpp/src/amqp.cmake
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/amqp.cmake?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/amqp.cmake (original)
+++ qpid/branches/linearstore/qpid/cpp/src/amqp.cmake Fri Sep 20 18:59:30 2013
@@ -23,15 +23,43 @@ include(FindPkgConfig)
pkg_check_modules(PROTON libqpid-proton)
+if (NOT PROTON_FOUND)
+ # if pkg-config is absent or fails to find proton then use
+ # PROTON_ROOT command line option or environment variable to locate
+ # local installed proton build.
+ if (NOT PROTON_ROOT)
+ set (PROTON_ROOT "$ENV{PROTON_ROOT}")
+ endif()
+ if (PROTON_ROOT)
+ find_package(proton PATHS ${PROTON_ROOT} NO_DEFAULT_PATH)
+
+ if (proton_FOUND EQUAL 1)
+ set(iFile "${PROTON_ROOT}/lib/proton.cmake/libqpid-proton.cmake")
+ if(EXISTS ${iFile})
+ include("${iFile}")
+ else()
+ message(FATAL_ERROR "PROTON_ROOT defined but file ${iFile} is missing")
+ endif()
+ else()
+ message(FATAL_ERROR "Proton package files not found in ${PROTON_ROOT}")
+ endif()
+ endif()
+endif()
+
set (amqp_default ${amqp_force})
-set (required_version 0.3)
+set (minimum_version 0.5)
+set (maximum_version 0.5)
if (PROTON_FOUND)
- if (PROTON_VERSION LESS ${required_version})
- message(STATUS "Qpid proton is too old, amqp 1.0 support not enabled")
- else (PROTON_VERSION LESS ${required_version})
- message(STATUS "Qpid proton found, amqp 1.0 support enabled")
- set (amqp_default ON)
- endif (PROTON_VERSION LESS ${required_version})
+ if (PROTON_VERSION LESS ${minimum_version})
+ message(STATUS "Qpid proton ${PROTON_VERSION} is too old, require ${minimum_version} - ${maximum_version}; amqp 1.0 support not enabled")
+ else (PROTON_VERSION LESS ${minimum_version})
+ if (PROTON_VERSION GREATER ${maximum_version})
+ message(STATUS "Qpid proton ${PROTON_VERSION} is too new, require ${minimum_version} - ${maximum_version}; amqp 1.0 support not enabled")
+ else (PROTON_VERSION GREATER ${maximum_version})
+ message(STATUS "Qpid proton found, amqp 1.0 support enabled")
+ set (amqp_default ON)
+ endif (PROTON_VERSION GREATER ${maximum_version})
+ endif (PROTON_VERSION LESS ${minimum_version})
else (PROTON_FOUND)
message(STATUS "Qpid proton not found, amqp 1.0 support not enabled")
endif (PROTON_FOUND)
@@ -43,15 +71,6 @@ if (BUILD_AMQP)
message(FATAL_ERROR "Qpid proton not found, required for amqp 1.0 support")
endif (NOT PROTON_FOUND)
- foreach(f ${PROTON_CFLAGS})
- set (PROTON_COMPILE_FLAGS "${PROTON_COMPILE_FLAGS} ${f}")
- endforeach(f)
-
- foreach(f ${PROTON_LDFLAGS})
- set (PROTON_LINK_FLAGS "${PROTON_LINK_FLAGS} ${f}")
- endforeach(f)
-
-
set (amqp_SOURCES
qpid/broker/amqp/Authorise.h
qpid/broker/amqp/Authorise.cpp
@@ -103,18 +122,21 @@ if (BUILD_AMQP)
qpid/broker/amqp/Translation.h
qpid/broker/amqp/Translation.cpp
)
+
+ include_directories(${PROTON_INCLUDE_DIRS})
+ link_directories(${PROTON_LIBRARY_DIRS})
+
add_library (amqp MODULE ${amqp_SOURCES})
- target_link_libraries (amqp qpidbroker qpidcommon)
+ target_link_libraries (amqp qpidtypes qpidbroker qpidcommon ${PROTON_LIBRARIES} ${Boost_PROGRAM_OPTIONS_LIBRARY})
set_target_properties (amqp PROPERTIES
PREFIX ""
- COMPILE_FLAGS "${PROTON_COMPILE_FLAGS}"
- LINK_FLAGS "${PROTON_LINK_FLAGS}")
- set_target_properties (amqp PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
+ LINK_FLAGS "${CATCH_UNDEFINED}"
+ COMPILE_DEFINITIONS _IN_QPID_BROKER)
+
install (TARGETS amqp
DESTINATION ${QPIDD_MODULE_DIR}
COMPONENT ${QPID_COMPONENT_BROKER})
-
set (amqpc_SOURCES
qpid/messaging/amqp/AddressHelper.h
qpid/messaging/amqp/AddressHelper.cpp
@@ -142,11 +164,11 @@ if (BUILD_AMQP)
qpid/messaging/amqp/TcpTransport.cpp
)
add_library (amqpc MODULE ${amqpc_SOURCES})
- target_link_libraries (amqpc qpidclient qpidcommon)
+ target_link_libraries (amqpc qpidmessaging qpidtypes qpidclient qpidcommon ${PROTON_LIBRARIES})
set_target_properties (amqpc PROPERTIES
PREFIX ""
- COMPILE_FLAGS "${PROTON_COMPILE_FLAGS}"
- LINK_FLAGS "${PROTON_LINK_FLAGS}")
+ LINK_FLAGS "${CATCH_UNDEFINED}")
+
install (TARGETS amqpc
DESTINATION ${QPIDC_MODULE_DIR}
COMPONENT ${QPID_COMPONENT_CLIENT})
Modified: qpid/branches/linearstore/qpid/cpp/src/finddb.cmake
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/finddb.cmake?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/finddb.cmake (original)
+++ qpid/branches/linearstore/qpid/cpp/src/finddb.cmake Fri Sep 20 18:59:30 2013
@@ -22,31 +22,33 @@ if(UNIX)
# - Find BerkeleyDB
# Find the BerkeleyDB includes and library
# This module defines
-# DB_INCLUDE_DIR, where to find db.h, etc.
+# DB_CXX_INCLUDE_DIR, where to find db_cxx.h, etc.
# DB_LIBRARIES, the libraries needed to use BerkeleyDB.
# DB_FOUND, If false, do not try to use BerkeleyDB.
# also defined, but not for general use are
# DB_LIBRARY, where to find the BerkeleyDB library.
-FIND_PATH(DB_INCLUDE_DIR db.h
+FIND_PATH(DB_CXX_INCLUDE_DIR db_cxx.h
/usr/local/include/db4
+ /usr/local/include/libdb4
/usr/local/include
/usr/include/db4
+ /usr/include/libdb4
/usr/include
)
-SET(DB_NAMES ${DB_NAMES} db_cxx)
+SET(DB_NAMES ${DB_NAMES} db_cxx db_cxx-4)
FIND_LIBRARY(DB_LIBRARY
NAMES ${DB_NAMES}
PATHS /usr/lib /usr/local/lib
)
-IF (DB_LIBRARY AND DB_INCLUDE_DIR)
+IF (DB_LIBRARY AND DB_CXX_INCLUDE_DIR)
SET(DB_LIBRARIES ${DB_LIBRARY})
SET(DB_FOUND "YES")
-ELSE (DB_LIBRARY AND DB_INCLUDE_DIR)
+ELSE (DB_LIBRARY AND DB_CXX_INCLUDE_DIR)
UNSET( DB_FOUND )
-ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR)
+ENDIF (DB_LIBRARY AND DB_CXX_INCLUDE_DIR)
IF (DB_FOUND)
@@ -60,15 +62,15 @@ ELSE (DB_FOUND)
ENDIF (DB_FOUND)
# Deprecated declarations.
-SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} )
+SET (NATIVE_DB_INCLUDE_PATH ${DB_CXX_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH)
MARK_AS_ADVANCED(
DB_LIBRARY
- DB_INCLUDE_DIR
+ DB_CXX_INCLUDE_DIR
)
else(UNIX)
MESSAGE(STATUS "BerkeleyDB is ignored on non-Unix platforms")
UNSET( DB_FOUND )
-endif(UNIX)
\ No newline at end of file
+endif(UNIX)
Modified: qpid/branches/linearstore/qpid/cpp/src/legacystore.cmake
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/legacystore.cmake?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/legacystore.cmake (original)
+++ qpid/branches/linearstore/qpid/cpp/src/legacystore.cmake Fri Sep 20 18:59:30 2013
@@ -126,10 +126,10 @@ if (BUILD_LEGACYSTORE)
)
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/db-inc.h)
- message(STATUS "Including BDB from ${DB_INCLUDE_DIR}/db_cxx.h")
+ message(STATUS "Including BDB from ${DB_CXX_INCLUDE_DIR}/db_cxx.h")
file(WRITE
${CMAKE_CURRENT_BINARY_DIR}/db-inc.h
- "#include <${DB_INCLUDE_DIR}/db_cxx.h>\n")
+ "#include <${DB_CXX_INCLUDE_DIR}/db_cxx.h>\n")
endif()
add_library (legacystore MODULE
Modified: qpid/branches/linearstore/qpid/cpp/src/prof
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/prof?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/prof (original)
+++ qpid/branches/linearstore/qpid/cpp/src/prof Fri Sep 20 18:59:30 2013
@@ -32,8 +32,8 @@ opcontrol --start
opcontrol --stop
opcontrol --dump
opcontrol --shutdown
-opreport -l ./.libs/lt-qpidd > stats.txt
-opannotate --source --output-dir=qpidd-prof ./.libs/lt-qpidd
+opreport -l ./qpidd > stats.txt
+opannotate --source --output-dir=qpidd-prof ./qpidd
# clear the relusts
#opcontrol --reset
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/NullSaslServer.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/NullSaslServer.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/NullSaslServer.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/NullSaslServer.h Fri Sep 20 18:59:30 2013
@@ -21,6 +21,7 @@
* under the License.
*
*/
+#include "qpid/CommonImportExport.h"
#include "qpid/SaslServer.h"
namespace qpid {
@@ -34,7 +35,7 @@ namespace qpid {
class NullSaslServer : public SaslServer
{
public:
- NullSaslServer(const std::string& realm);
+ QPID_COMMON_EXTERN NullSaslServer(const std::string& realm);
Status start(const std::string& mechanism, const std::string* response, std::string& challenge);
Status step(const std::string* response, std::string& challenge);
std::string getMechanisms();
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/Sasl.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/Sasl.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/Sasl.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/Sasl.h Fri Sep 20 18:59:30 2013
@@ -24,6 +24,7 @@
#include <memory>
#include <string>
+#include "qpid/CommonImportExport.h"
#include "qpid/sys/IntegerTypes.h"
namespace qpid {
@@ -53,7 +54,7 @@ class Sasl
virtual std::string getMechanism() = 0;
virtual std::string getUserId() = 0;
virtual std::auto_ptr<qpid::sys::SecurityLayer> getSecurityLayer(uint16_t maxFrameSize) = 0;
- virtual ~Sasl() {}
+ QPID_COMMON_EXTERN virtual ~Sasl() {}
};
} // namespace qpid
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.cpp Fri Sep 20 18:59:30 2013
@@ -20,6 +20,7 @@
*/
#include "qpid/SaslFactory.h"
#include "qpid/SaslServer.h"
+#include "qpid/NullSaslClient.h"
#include "qpid/NullSaslServer.h"
#include <map>
#include <string.h>
@@ -48,7 +49,8 @@ SaslFactory& SaslFactory::getInstance()
std::auto_ptr<Sasl> SaslFactory::create( const std::string &, const std::string &, const std::string &, const std::string &, int, int, bool )
{
- return std::auto_ptr<Sasl>();
+ std::auto_ptr<Sasl> client(new NullSaslClient);
+ return client;
}
std::auto_ptr<SaslServer> SaslFactory::createServer(const std::string& realm, bool /*encryptionRequired*/, const qpid::sys::SecuritySettings&)
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/SaslFactory.h Fri Sep 20 18:59:30 2013
@@ -21,6 +21,7 @@
* under the License.
*
*/
+#include "qpid/CommonImportExport.h"
#include "qpid/Sasl.h"
#include "qpid/sys/Mutex.h"
#include <memory>
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/SaslServer.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/SaslServer.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/SaslServer.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/SaslServer.h Fri Sep 20 18:59:30 2013
@@ -35,7 +35,7 @@ class SaslServer
{
public:
typedef enum {OK, FAIL, CHALLENGE} Status;
- virtual ~SaslServer() {}
+ QPID_COMMON_EXTERN virtual ~SaslServer() {}
virtual Status start(const std::string& mechanism, const std::string* response, std::string& challenge) = 0;
virtual Status step(const std::string* response, std::string& challenge) = 0;
virtual std::string getMechanisms() = 0;
Propchange: qpid/branches/linearstore/qpid/cpp/src/qpid/acl/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/cpp/src/qpid/acl:r1501885-1525056
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp Fri Sep 20 18:59:30 2013
@@ -102,10 +102,12 @@ bool ConnectionCounter::countConnectionL
if (eRef != theMap.end()) {
count = (uint16_t)(*eRef).second + 1;
(*eRef).second = count;
- result = (enforceLimit ? count <= theLimit : true);
} else {
theMap[theName] = count = 1;
}
+ if (enforceLimit) {
+ result = count <= theLimit;
+ }
if (emitLog) {
QPID_LOG(trace, "ACL ConnectionApprover user=" << theName
<< " limit=" << theLimit
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.cpp Fri Sep 20 18:59:30 2013
@@ -22,6 +22,7 @@
#include "qpid/amqp/CharSequence.h"
#include "qpid/amqp/Constructor.h"
#include "qpid/amqp/Descriptor.h"
+#include "qpid/amqp/MapBuilder.h"
#include "qpid/amqp/Reader.h"
#include "qpid/amqp/typecodes.h"
#include "qpid/types/Uuid.h"
@@ -34,121 +35,13 @@ namespace amqp {
using namespace qpid::amqp::typecodes;
-Decoder::Decoder(const char* d, size_t s) : start(d), size(s), position(0) {}
+Decoder::Decoder(const char* d, size_t s) : start(d), size(s), position(0), current(0) {}
-namespace {
-class MapBuilder : public Reader
-{
- public:
- void onNull(const Descriptor*)
- {
- qpid::types::Variant v;
- handle(v, NULL_NAME);
- }
- void onBoolean(bool v, const Descriptor*)
- {
- handle(v, BOOLEAN_NAME);
- }
- void onUByte(uint8_t v, const Descriptor*)
- {
- handle(v, UBYTE_NAME);
- }
- void onUShort(uint16_t v, const Descriptor*)
- {
- handle(v, USHORT_NAME);
- }
- void onUInt(uint32_t v, const Descriptor*)
- {
- handle(v, UINT_NAME);
- }
- void onULong(uint64_t v, const Descriptor*)
- {
- handle(v, ULONG_NAME);
- }
- void onByte(int8_t v, const Descriptor*)
- {
- handle(v, BYTE_NAME);
- }
- void onShort(int16_t v, const Descriptor*)
- {
- handle(v, SHORT_NAME);
- }
- void onInt(int32_t v, const Descriptor*)
- {
- handle(v, INT_NAME);
- }
- void onLong(int64_t v, const Descriptor*)
- {
- handle(v, LONG_NAME);
- }
- void onFloat(float v, const Descriptor*)
- {
- handle(v, FLOAT_NAME);
- }
- void onDouble(double v, const Descriptor*)
- {
- handle(v, DOUBLE_NAME);
- }
- void onUuid(const CharSequence& v, const Descriptor*)
- {
- handle(v, UUID_NAME);
- }
- void onTimestamp(int64_t v, const Descriptor*)
- {
- handle(v, TIMESTAMP_NAME);
- }
- void onBinary(const CharSequence& v, const Descriptor*)
- {
- handle(v);
- }
- void onString(const CharSequence& v, const Descriptor*)
- {
- handle(v);
- }
- void onSymbol(const CharSequence& v, const Descriptor*)
- {
- handle(v);
- }
- MapBuilder(qpid::types::Variant::Map& m) : map(m), state(KEY) {}
- private:
- qpid::types::Variant::Map& map;
- enum {KEY, SKIP, VALUE} state;
- std::string key;
-
- template <typename T> void handle(T value, const std::string& name)
- {
- switch (state) {
- case KEY:
- QPID_LOG(warning, "Ignoring key of type " << name);
- state = SKIP;
- break;
- case VALUE:
- map[key] = value;
- case SKIP:
- state = KEY;
- break;
- }
- }
- void handle(const CharSequence& value)
- {
- switch (state) {
- case KEY:
- key = value.str();
- state = VALUE;
- break;
- case VALUE:
- map[key] = value.str();
- case SKIP:
- state = KEY;
- break;
- }
- }
-};
-}
void Decoder::readMap(qpid::types::Variant::Map& map)
{
- MapBuilder builder(map);
+ MapBuilder builder;
read(builder);
+ map = builder.getMap();
}
qpid::types::Variant::Map Decoder::readMap()
@@ -168,6 +61,7 @@ void Decoder::read(Reader& reader)
void Decoder::readOne(Reader& reader)
{
const char* temp = start + position;
+ current = position;
Constructor c = readConstructor();
if (c.isDescribed) reader.onDescriptor(c.descriptor, temp);
readValue(reader, c.code, c.isDescribed ? &c.descriptor : 0);
@@ -263,7 +157,7 @@ void Decoder::readValue(Reader& reader,
break;
case LIST0:
- reader.onStartList(0, CharSequence::create(), descriptor);
+ reader.onStartList(0, CharSequence::create(), getCurrent(0), descriptor);
reader.onEndList(0, descriptor);
break;
case LIST8:
@@ -333,7 +227,7 @@ void Decoder::readArray32(Reader& reader
void Decoder::readList(Reader& reader, uint32_t size, uint32_t count, const Descriptor* descriptor)
{
- if (reader.onStartList(count, CharSequence::create(data(), size), descriptor)) {
+ if (reader.onStartList(count, CharSequence::create(data(), size), getCurrent(size), descriptor)) {
for (uint32_t i = 0; i < count; ++i) {
readOne(reader);
}
@@ -345,7 +239,7 @@ void Decoder::readList(Reader& reader, u
}
void Decoder::readMap(Reader& reader, uint32_t size, uint32_t count, const Descriptor* descriptor)
{
- if (reader.onStartMap(count, CharSequence::create(data(), size), descriptor)) {
+ if (reader.onStartMap(count, CharSequence::create(data(), size), getCurrent(size), descriptor)) {
for (uint32_t i = 0; i < count; ++i) {
readOne(reader);
}
@@ -401,7 +295,7 @@ Descriptor Decoder::readDescriptor()
case ULONG_ZERO:
return Descriptor((uint64_t) 0);
default:
- throw qpid::Exception(QPID_MSG("Expected descriptor of type ulong or symbol; found " << code));
+ throw qpid::Exception(QPID_MSG("Expected descriptor of type ulong or symbol; found " << (int)code));
}
}
@@ -542,4 +436,10 @@ CharSequence Decoder::readRawUuid()
size_t Decoder::getPosition() const { return position; }
size_t Decoder::getSize() const { return size; }
void Decoder::resetSize(size_t s) { size = s; }
+
+CharSequence Decoder::getCurrent(size_t remaining) const
+{
+ return CharSequence::create(start + current, (position-current)+remaining);
+}
+
}} // namespace qpid::amqp
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Decoder.h Fri Sep 20 18:59:30 2013
@@ -77,6 +77,7 @@ class Decoder
const char* const start;
size_t size;
size_t position;
+ size_t current;
void readOne(Reader& reader);
void readValue(Reader& reader, uint8_t code, const Descriptor* descriptor);
@@ -92,7 +93,7 @@ class Decoder
CharSequence readRawUuid();
Constructor readConstructor();
const char* data();
-
+ CharSequence getCurrent(size_t remaining) const;
};
}} // namespace qpid::amqp
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.cpp Fri Sep 20 18:59:30 2013
@@ -59,7 +59,7 @@ std::ostream& operator<<(std::ostream& o
else os << "null";
break;
case Descriptor::NUMERIC:
- os << d.value.code;
+ os << "0x" << std::hex << d.value.code;
break;
}
return os;
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Descriptor.h Fri Sep 20 18:59:30 2013
@@ -42,13 +42,13 @@ struct Descriptor
SYMBOLIC
} type;
- Descriptor(uint64_t code);
- Descriptor(const CharSequence& symbol);
- bool match(const std::string&, uint64_t) const;
- size_t getSize() const;
+ QPID_COMMON_EXTERN Descriptor(uint64_t code);
+ QPID_COMMON_EXTERN Descriptor(const CharSequence& symbol);
+ QPID_COMMON_EXTERN bool match(const std::string&, uint64_t) const;
+ QPID_COMMON_EXTERN size_t getSize() const;
};
-std::ostream& operator<<(std::ostream& os, const Descriptor& d);
+QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const Descriptor& d);
}} // namespace qpid::amqp
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.cpp Fri Sep 20 18:59:30 2013
@@ -23,11 +23,15 @@
#include "qpid/amqp/Descriptor.h"
#include "qpid/amqp/typecodes.h"
#include "qpid/types/Uuid.h"
+#include "qpid/types/Variant.h"
+#include "qpid/types/encodings.h"
#include "qpid/log/Statement.h"
#include "qpid/Exception.h"
#include <assert.h>
#include <string.h>
+using namespace qpid::types::encodings;
+
namespace qpid {
namespace amqp {
@@ -373,6 +377,87 @@ void Encoder::endArray32(size_t count, v
end<uint32_t>(count, token, data+position);
}
+void Encoder::writeMap(const std::map<std::string, qpid::types::Variant>& value, const Descriptor* d, bool large)
+{
+ void* token = large ? startMap32(d) : startMap8(d);
+ for (qpid::types::Variant::Map::const_iterator i = value.begin(); i != value.end(); ++i) {
+ writeString(i->first);
+ writeValue(i->second);
+ }
+ if (large) endMap32(value.size()*2, token);
+ else endMap8(value.size()*2, token);
+}
+
+void Encoder::writeList(const std::list<qpid::types::Variant>& value, const Descriptor* d, bool large)
+{
+ void* token = large ? startList32(d) : startList8(d);
+ for (qpid::types::Variant::List::const_iterator i = value.begin(); i != value.end(); ++i) {
+ writeValue(*i);
+ }
+ if (large) endList32(value.size(), token);
+ else endList8(value.size(), token);
+}
+
+void Encoder::writeValue(const qpid::types::Variant& value, const Descriptor* d)
+{
+ switch (value.getType()) {
+ case qpid::types::VAR_VOID:
+ writeNull(d);
+ break;
+ case qpid::types::VAR_BOOL:
+ writeBoolean(value.asBool(), d);
+ break;
+ case qpid::types::VAR_UINT8:
+ writeUByte(value.asUint8(), d);
+ break;
+ case qpid::types::VAR_UINT16:
+ writeUShort(value.asUint16(), d);
+ break;
+ case qpid::types::VAR_UINT32:
+ writeUInt(value.asUint32(), d);
+ break;
+ case qpid::types::VAR_UINT64:
+ writeULong(value.asUint64(), d);
+ break;
+ case qpid::types::VAR_INT8:
+ writeByte(value.asInt8(), d);
+ break;
+ case qpid::types::VAR_INT16:
+ writeShort(value.asInt16(), d);
+ break;
+ case qpid::types::VAR_INT32:
+ writeInt(value.asInt32(), d);
+ break;
+ case qpid::types::VAR_INT64:
+ writeLong(value.asInt64(), d);
+ break;
+ case qpid::types::VAR_FLOAT:
+ writeFloat(value.asFloat(), d);
+ break;
+ case qpid::types::VAR_DOUBLE:
+ writeDouble(value.asDouble(), d);
+ break;
+ case qpid::types::VAR_STRING:
+ if (value.getEncoding() == UTF8) {
+ writeString(value.getString(), d);
+ } else if (value.getEncoding() == ASCII) {
+ writeSymbol(value.getString(), d);
+ } else {
+ writeBinary(value.getString(), d);
+ }
+ break;
+ case qpid::types::VAR_MAP:
+ writeMap(value.asMap(), d);
+ break;
+ case qpid::types::VAR_LIST:
+ writeList(value.asList(), d);
+ break;
+ case qpid::types::VAR_UUID:
+ writeUuid(value.asUuid(), d);
+ break;
+ }
+
+}
void Encoder::writeDescriptor(const Descriptor& d)
{
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/Encoder.h Fri Sep 20 18:59:30 2013
@@ -23,12 +23,15 @@
*/
#include "qpid/sys/IntegerTypes.h"
#include "qpid/amqp/Constructor.h"
+#include <list>
+#include <map>
#include <stddef.h>
#include <string>
namespace qpid {
namespace types {
class Uuid;
+class Variant;
}
namespace amqp {
struct CharSequence;
@@ -74,7 +77,7 @@ class Encoder
void writeString(const CharSequence&, const Descriptor* d=0);
void writeString(const std::string&, const Descriptor* d=0);
void writeBinary(const CharSequence&, const Descriptor* d=0);
- void writeBinary(const std::string&, const Descriptor* d=0);
+ QPID_COMMON_EXTERN void writeBinary(const std::string&, const Descriptor* d=0);
void* startList8(const Descriptor* d=0);
void* startList32(const Descriptor* d=0);
@@ -91,9 +94,13 @@ class Encoder
void endArray8(size_t count, void*);
void endArray32(size_t count, void*);
+ QPID_COMMON_EXTERN void writeValue(const qpid::types::Variant&, const Descriptor* d=0);
+ QPID_COMMON_EXTERN void writeMap(const std::map<std::string, qpid::types::Variant>& value, const Descriptor* d=0, bool large=true);
+ QPID_COMMON_EXTERN void writeList(const std::list<qpid::types::Variant>& value, const Descriptor* d=0, bool large=true);
+
void writeDescriptor(const Descriptor&);
- Encoder(char* data, size_t size);
- size_t getPosition();
+ QPID_COMMON_EXTERN Encoder(char* data, size_t size);
+ QPID_COMMON_EXTERN size_t getPosition();
void resetPosition(size_t p);
char* skip(size_t);
void writeBytes(const char* bytes, size_t count);
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/ListReader.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/ListReader.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/ListReader.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/ListReader.h Fri Sep 20 18:59:30 2013
@@ -53,10 +53,10 @@ class ListReader : public Reader
virtual void onString(const CharSequence& v, const Descriptor* descriptor) { getReader().onString(v, descriptor); }
virtual void onSymbol(const CharSequence& v, const Descriptor* descriptor) { getReader().onSymbol(v, descriptor); }
- virtual bool onStartList(uint32_t count, const CharSequence& v, const Descriptor* descriptor)
+ virtual bool onStartList(uint32_t count, const CharSequence& elements, const CharSequence& all, const Descriptor* descriptor)
{
++level;
- getReader().onStartList(count, v, descriptor);
+ getReader().onStartList(count, elements, all, descriptor);
return false;
}
virtual void onEndList(uint32_t count, const Descriptor* descriptor)
@@ -64,10 +64,10 @@ class ListReader : public Reader
--level;
getReader().onEndList(count, descriptor);
}
- virtual bool onStartMap(uint32_t count, const CharSequence& v, const Descriptor* descriptor)
+ virtual bool onStartMap(uint32_t count, const CharSequence& elements, const CharSequence& all, const Descriptor* descriptor)
{
++level;
- getReader().onStartMap(count, v, descriptor);
+ getReader().onStartMap(count, elements, all, descriptor);
return false;
}
virtual void onEndMap(uint32_t count, const Descriptor* descriptor)
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.cpp Fri Sep 20 18:59:30 2013
@@ -19,112 +19,12 @@
*
*/
#include "MapBuilder.h"
-#include <assert.h>
namespace qpid {
namespace amqp {
-namespace {
-const std::string BINARY("binary");
-const std::string UTF8("utf8");
-const std::string ASCII("ascii");
-}
-
+MapBuilder::MapBuilder() : DataBuilder(qpid::types::Variant::Map()) {}
qpid::types::Variant::Map MapBuilder::getMap()
{
- return map;
-}
-const qpid::types::Variant::Map MapBuilder::getMap() const
-{
- return map;
-}
-
-void MapBuilder::onNullValue(const CharSequence& key, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = qpid::types::Variant();
-}
-void MapBuilder::onBooleanValue(const CharSequence& key, bool value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-void MapBuilder::onUByteValue(const CharSequence& key, uint8_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onUShortValue(const CharSequence& key, uint16_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onUIntValue(const CharSequence& key, uint32_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onULongValue(const CharSequence& key, uint64_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onByteValue(const CharSequence& key, int8_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onShortValue(const CharSequence& key, int16_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onIntValue(const CharSequence& key, int32_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onLongValue(const CharSequence& key, int64_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onFloatValue(const CharSequence& key, float value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onDoubleValue(const CharSequence& key, double value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onUuidValue(const CharSequence& key, const CharSequence& value, const Descriptor*)
-{
- assert(value.size == 16);
- map[std::string(key.data, key.size)] = qpid::types::Uuid(value.data);
-}
-
-void MapBuilder::onTimestampValue(const CharSequence& key, int64_t value, const Descriptor*)
-{
- map[std::string(key.data, key.size)] = value;
-}
-
-void MapBuilder::onBinaryValue(const CharSequence& key, const CharSequence& value, const Descriptor*)
-{
- qpid::types::Variant& v = map[std::string(key.data, key.size)];
- v = std::string(value.data, value.size);
- v.setEncoding(BINARY);
-}
-
-void MapBuilder::onStringValue(const CharSequence& key, const CharSequence& value, const Descriptor*)
-{
- qpid::types::Variant& v = map[std::string(key.data, key.size)];
- v = std::string(value.data, value.size);
- v.setEncoding(UTF8);
-}
-
-void MapBuilder::onSymbolValue(const CharSequence& key, const CharSequence& value, const Descriptor*)
-{
- qpid::types::Variant& v = map[std::string(key.data, key.size)];
- v = std::string(value.data, value.size);
- v.setEncoding(ASCII);
+ return getValue().asMap();
}
}} // namespace qpid::amqp
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapBuilder.h Fri Sep 20 18:59:30 2013
@@ -21,42 +21,20 @@
* under the License.
*
*/
-#include "MapReader.h"
-#include "qpid/types/Variant.h"
+#include "DataBuilder.h"
+#include "qpid/CommonImportExport.h"
namespace qpid {
namespace amqp {
/**
- * Utility to build a Variant::Map from a data stream (doesn't handle
- * nested maps or lists yet)
+ * Utility to build a Variant::Map from a data stream
*/
-class MapBuilder : public MapReader
+class MapBuilder : public DataBuilder
{
public:
- void onNullValue(const CharSequence& /*key*/, const Descriptor*);
- void onBooleanValue(const CharSequence& /*key*/, bool, const Descriptor*);
- void onUByteValue(const CharSequence& /*key*/, uint8_t, const Descriptor*);
- void onUShortValue(const CharSequence& /*key*/, uint16_t, const Descriptor*);
- void onUIntValue(const CharSequence& /*key*/, uint32_t, const Descriptor*);
- void onULongValue(const CharSequence& /*key*/, uint64_t, const Descriptor*);
- void onByteValue(const CharSequence& /*key*/, int8_t, const Descriptor*);
- void onShortValue(const CharSequence& /*key*/, int16_t, const Descriptor*);
- void onIntValue(const CharSequence& /*key*/, int32_t, const Descriptor*);
- void onLongValue(const CharSequence& /*key*/, int64_t, const Descriptor*);
- void onFloatValue(const CharSequence& /*key*/, float, const Descriptor*);
- void onDoubleValue(const CharSequence& /*key*/, double, const Descriptor*);
- void onUuidValue(const CharSequence& /*key*/, const CharSequence&, const Descriptor*);
- void onTimestampValue(const CharSequence& /*key*/, int64_t, const Descriptor*);
-
- void onBinaryValue(const CharSequence& /*key*/, const CharSequence&, const Descriptor*);
- void onStringValue(const CharSequence& /*key*/, const CharSequence&, const Descriptor*);
- void onSymbolValue(const CharSequence& /*key*/, const CharSequence&, const Descriptor*);
-
- qpid::types::Variant::Map getMap();
- const qpid::types::Variant::Map getMap() const;
- private:
- qpid::types::Variant::Map map;
+ QPID_COMMON_EXTERN MapBuilder();
+ QPID_COMMON_EXTERN qpid::types::Variant::Map getMap();
};
}} // namespace qpid::amqp
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.cpp Fri Sep 20 18:59:30 2013
@@ -219,7 +219,7 @@ void MapReader::onSymbol(const CharSeque
}
}
-bool MapReader::onStartList(uint32_t count, const CharSequence&, const Descriptor* d)
+bool MapReader::onStartList(uint32_t count, const CharSequence&, const CharSequence&, const Descriptor* d)
{
if (!level) throw qpid::Exception(QPID_MSG("Expecting map as top level datum"));
if (key) {
@@ -232,7 +232,7 @@ bool MapReader::onStartList(uint32_t cou
return true;
}
-bool MapReader::onStartMap(uint32_t count, const CharSequence&, const Descriptor* d)
+bool MapReader::onStartMap(uint32_t count, const CharSequence&, const CharSequence&, const Descriptor* d)
{
if (level++) {
if (key) {
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MapReader.h Fri Sep 20 18:59:30 2013
@@ -68,36 +68,36 @@ class MapReader : public Reader
//this class implements the Reader interface, thus acting as a transformer into a more map oriented scheme
- void onNull(const Descriptor*);
- void onBoolean(bool, const Descriptor*);
- void onUByte(uint8_t, const Descriptor*);
- void onUShort(uint16_t, const Descriptor*);
- void onUInt(uint32_t, const Descriptor*);
- void onULong(uint64_t, const Descriptor*);
- void onByte(int8_t, const Descriptor*);
- void onShort(int16_t, const Descriptor*);
- void onInt(int32_t, const Descriptor*);
- void onLong(int64_t, const Descriptor*);
- void onFloat(float, const Descriptor*);
- void onDouble(double, const Descriptor*);
- void onUuid(const CharSequence&, const Descriptor*);
- void onTimestamp(int64_t, const Descriptor*);
-
- void onBinary(const CharSequence&, const Descriptor*);
- void onString(const CharSequence&, const Descriptor*);
- void onSymbol(const CharSequence&, const Descriptor*);
-
- bool onStartList(uint32_t /*count*/, const CharSequence&, const Descriptor*);
- bool onStartMap(uint32_t /*count*/, const CharSequence&, const Descriptor*);
- bool onStartArray(uint32_t /*count*/, const CharSequence&, const Constructor&, const Descriptor*);
- void onEndList(uint32_t /*count*/, const Descriptor*);
- void onEndMap(uint32_t /*count*/, const Descriptor*);
- void onEndArray(uint32_t /*count*/, const Descriptor*);
-
- MapReader();
- static const int SYMBOL_KEY;
- static const int STRING_KEY;
- void setAllowedKeyType(int);
+ QPID_COMMON_EXTERN void onNull(const Descriptor*);
+ QPID_COMMON_EXTERN void onBoolean(bool, const Descriptor*);
+ QPID_COMMON_EXTERN void onUByte(uint8_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onUShort(uint16_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onUInt(uint32_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onULong(uint64_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onByte(int8_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onShort(int16_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onInt(int32_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onLong(int64_t, const Descriptor*);
+ QPID_COMMON_EXTERN void onFloat(float, const Descriptor*);
+ QPID_COMMON_EXTERN void onDouble(double, const Descriptor*);
+ QPID_COMMON_EXTERN void onUuid(const CharSequence&, const Descriptor*);
+ QPID_COMMON_EXTERN void onTimestamp(int64_t, const Descriptor*);
+
+ QPID_COMMON_EXTERN void onBinary(const CharSequence&, const Descriptor*);
+ QPID_COMMON_EXTERN void onString(const CharSequence&, const Descriptor*);
+ QPID_COMMON_EXTERN void onSymbol(const CharSequence&, const Descriptor*);
+
+ QPID_COMMON_EXTERN bool onStartList(uint32_t /*count*/, const CharSequence&, const CharSequence&, const Descriptor*);
+ QPID_COMMON_EXTERN bool onStartMap(uint32_t /*count*/, const CharSequence&, const CharSequence&, const Descriptor*);
+ QPID_COMMON_EXTERN bool onStartArray(uint32_t /*count*/, const CharSequence&, const Constructor&, const Descriptor*);
+ QPID_COMMON_EXTERN void onEndList(uint32_t /*count*/, const Descriptor*);
+ QPID_COMMON_EXTERN void onEndMap(uint32_t /*count*/, const Descriptor*);
+ QPID_COMMON_EXTERN void onEndArray(uint32_t /*count*/, const Descriptor*);
+
+ QPID_COMMON_EXTERN MapReader();
+ QPID_COMMON_EXTERN static const int SYMBOL_KEY;
+ QPID_COMMON_EXTERN static const int STRING_KEY;
+ QPID_COMMON_EXTERN void setAllowedKeyType(int);
private:
CharSequence key;
size_t level;
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.cpp?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.cpp Fri Sep 20 18:59:30 2013
@@ -156,68 +156,6 @@ void MessageEncoder::writeApplicationPro
writeMap(properties, &qpid::amqp::message::APPLICATION_PROPERTIES, large);
}
-void MessageEncoder::writeMap(const qpid::types::Variant::Map& properties, const Descriptor* d, bool large)
-{
- void* token = large ? startMap32(d) : startMap8(d);
- for (qpid::types::Variant::Map::const_iterator i = properties.begin(); i != properties.end(); ++i) {
- writeString(i->first);
- switch (i->second.getType()) {
- case qpid::types::VAR_MAP:
- case qpid::types::VAR_LIST:
- //not allowed (TODO: revise, only strictly true for application-properties) whereas this is now a more general method)
- QPID_LOG(warning, "Ignoring nested map/list; not allowed in application-properties for AMQP 1.0");
- case qpid::types::VAR_VOID:
- writeNull();
- break;
- case qpid::types::VAR_BOOL:
- writeBoolean(i->second);
- break;
- case qpid::types::VAR_UINT8:
- writeUByte(i->second);
- break;
- case qpid::types::VAR_UINT16:
- writeUShort(i->second);
- break;
- case qpid::types::VAR_UINT32:
- writeUInt(i->second);
- break;
- case qpid::types::VAR_UINT64:
- writeULong(i->second);
- break;
- case qpid::types::VAR_INT8:
- writeByte(i->second);
- break;
- case qpid::types::VAR_INT16:
- writeShort(i->second);
- break;
- case qpid::types::VAR_INT32:
- writeInt(i->second);
- break;
- case qpid::types::VAR_INT64:
- writeULong(i->second);
- break;
- case qpid::types::VAR_FLOAT:
- writeFloat(i->second);
- break;
- case qpid::types::VAR_DOUBLE:
- writeDouble(i->second);
- break;
- case qpid::types::VAR_STRING:
- if (i->second.getEncoding() == BINARY) {
- writeBinary(i->second);
- } else {
- writeString(i->second);
- }
- break;
- case qpid::types::VAR_UUID:
- writeUuid(i->second);
- break;
- }
- }
- if (large) endMap32(properties.size()*2, token);
- else endMap8(properties.size()*2, token);
-}
-
size_t MessageEncoder::getEncodedSize(const Header& h, const Properties& p, const qpid::types::Variant::Map& ap, const std::string& d)
{
return getEncodedSize(h) + getEncodedSize(p, ap, d);
@@ -288,46 +226,56 @@ size_t MessageEncoder::getEncodedSizeFor
{
size_t total = 0;
for (qpid::types::Variant::Map::const_iterator i = map.begin(); i != map.end(); ++i) {
- total += 1/*code*/ + encodedSize(i->first);
+ total += 1/*code*/ + encodedSize(i->first) + getEncodedSizeForValue(i->second);
+ }
+ return total;
+}
- switch (i->second.getType()) {
- case qpid::types::VAR_MAP:
- case qpid::types::VAR_LIST:
- case qpid::types::VAR_VOID:
- case qpid::types::VAR_BOOL:
- total += 1;
- break;
-
- case qpid::types::VAR_UINT8:
- case qpid::types::VAR_INT8:
- total += 2;
- break;
-
- case qpid::types::VAR_UINT16:
- case qpid::types::VAR_INT16:
- total += 3;
- break;
-
- case qpid::types::VAR_UINT32:
- case qpid::types::VAR_INT32:
- case qpid::types::VAR_FLOAT:
- total += 5;
- break;
-
- case qpid::types::VAR_UINT64:
- case qpid::types::VAR_INT64:
- case qpid::types::VAR_DOUBLE:
- total += 9;
- break;
-
- case qpid::types::VAR_UUID:
- total += 17;
- break;
-
- case qpid::types::VAR_STRING:
- total += 1/*code*/ + encodedSize(i->second);
- break;
- }
+size_t MessageEncoder::getEncodedSizeForValue(const qpid::types::Variant& value)
+{
+ size_t total = 0;
+ switch (value.getType()) {
+ case qpid::types::VAR_MAP:
+ total += getEncodedSize(value.asMap(), true);
+ break;
+ case qpid::types::VAR_LIST:
+ total += getEncodedSize(value.asList(), true);
+ break;
+
+ case qpid::types::VAR_VOID:
+ case qpid::types::VAR_BOOL:
+ total += 1;
+ break;
+
+ case qpid::types::VAR_UINT8:
+ case qpid::types::VAR_INT8:
+ total += 2;
+ break;
+
+ case qpid::types::VAR_UINT16:
+ case qpid::types::VAR_INT16:
+ total += 3;
+ break;
+
+ case qpid::types::VAR_UINT32:
+ case qpid::types::VAR_INT32:
+ case qpid::types::VAR_FLOAT:
+ total += 5;
+ break;
+
+ case qpid::types::VAR_UINT64:
+ case qpid::types::VAR_INT64:
+ case qpid::types::VAR_DOUBLE:
+ total += 9;
+ break;
+
+ case qpid::types::VAR_UUID:
+ total += 17;
+ break;
+
+ case qpid::types::VAR_STRING:
+ total += 1/*code*/ + encodedSize(value.getString());
+ break;
}
return total;
}
@@ -345,4 +293,20 @@ size_t MessageEncoder::getEncodedSize(co
return total;
}
+
+size_t MessageEncoder::getEncodedSize(const qpid::types::Variant::List& list, bool alwaysUseLargeList)
+{
+ size_t total(0);
+ for (qpid::types::Variant::List::const_iterator i = list.begin(); i != list.end(); ++i) {
+ total += getEncodedSizeForValue(*i);
+ }
+
+ //its not just the count that determines whether we can use a small list, but the aggregate size:
+ if (alwaysUseLargeList || list.size()*2 > 255 || total > 255) total += 4/*size*/ + 4/*count*/;
+ else total += 1/*size*/ + 1/*count*/;
+
+ total += 1 /*code for list itself*/;
+
+ return total;
+}
}} // namespace qpid::amqp
Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/amqp/MessageEncoder.h Fri Sep 20 18:59:30 2013
@@ -39,7 +39,7 @@ class MessageEncoder : public Encoder
virtual ~Header() {}
virtual bool isDurable() const = 0;
virtual uint8_t getPriority() const = 0;
- virtual bool hasTtl() const = 0;
+ QPID_COMMON_EXTERN virtual bool hasTtl() const = 0;
virtual uint32_t getTtl() const = 0;
virtual bool isFirstAcquirer() const = 0;
virtual uint32_t getDeliveryCount() const = 0;
@@ -84,29 +84,33 @@ class MessageEncoder : public Encoder
virtual void handle(MapHandler&) const = 0;
};
- MessageEncoder(char* d, size_t s, bool o=false) : Encoder(d, s), optimise(o) {}
- void writeHeader(const Header&);
- void writeProperties(const Properties&);
- void writeApplicationProperties(const ApplicationProperties&);
- void writeApplicationProperties(const qpid::types::Variant::Map& properties);
- void writeApplicationProperties(const qpid::types::Variant::Map& properties, bool useLargeMap);
-
- void writeMap(const qpid::types::Variant::Map& map, const Descriptor*, bool useLargeMap);
-
- static size_t getEncodedSize(const Header&);
- static size_t getEncodedSize(const Properties&);
- static size_t getEncodedSize(const ApplicationProperties&);
- static size_t getEncodedSize(const Header&, const Properties&, const ApplicationProperties&, const std::string&);
+ QPID_COMMON_EXTERN MessageEncoder(char* d, size_t s) : Encoder(d, s), optimise(true) {}
+ QPID_COMMON_EXTERN void writeHeader(const Header&);
+ QPID_COMMON_EXTERN void writeProperties(const Properties&);
+ QPID_COMMON_EXTERN void writeApplicationProperties(const ApplicationProperties&);
+ QPID_COMMON_EXTERN void writeApplicationProperties(const qpid::types::Variant::Map& properties);
+ QPID_COMMON_EXTERN void writeApplicationProperties(const qpid::types::Variant::Map& properties, bool useLargeMap);
+
+ QPID_COMMON_EXTERN static size_t getEncodedSize(const Header&);
+ QPID_COMMON_EXTERN static size_t getEncodedSize(const Properties&);
+ QPID_COMMON_EXTERN static size_t getEncodedSize(const ApplicationProperties&);
+
+ QPID_COMMON_EXTERN static size_t getEncodedSize(const qpid::types::Variant::List&, bool useLargeList);
+ QPID_COMMON_EXTERN static size_t getEncodedSize(const qpid::types::Variant::Map&, bool useLargeMap);
+
+ QPID_COMMON_EXTERN static size_t getEncodedSizeForValue(const qpid::types::Variant& value);
+ QPID_COMMON_EXTERN static size_t getEncodedSizeForContent(const std::string&);
+
+ //used in translating 0-10 content to 1.0, to determine buffer space needed
+ QPID_COMMON_EXTERN static size_t getEncodedSize(const Properties&, const qpid::types::Variant::Map&, const std::string&);
- static size_t getEncodedSize(const qpid::types::Variant::Map&, bool useLargeMap);
- static size_t getEncodedSize(const qpid::types::Variant::Map&);
- static size_t getEncodedSize(const Header&, const Properties&, const qpid::types::Variant::Map&, const std::string&);
- static size_t getEncodedSize(const Properties&, const qpid::types::Variant::Map&, const std::string&);
private:
bool optimise;
+ static size_t getEncodedSize(const Header&, const Properties&, const ApplicationProperties&, const std::string&);
+ static size_t getEncodedSize(const Header&, const Properties&, const qpid::types::Variant::Map&, const std::string&);
+
static size_t getEncodedSizeForElements(const qpid::types::Variant::Map&);
- static size_t getEncodedSizeForContent(const std::string&);
};
}} // namespace qpid::amqp
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org