diff options
Diffstat (limited to 'cpp/src')
89 files changed, 457 insertions, 8420 deletions
diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index a8c201d802..65a8e66a98 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -195,6 +195,7 @@ endif (MSVC) include_directories( ${Boost_INCLUDE_DIR} ) include_directories( . ) +include_directories( ../include ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/gen) link_directories( ${Boost_LIBRARY_DIRS} ) @@ -511,7 +512,7 @@ set (libqpidclient_SOURCES qpid/client/QueueOptions.cpp qpid/client/Results.cpp qpid/client/SessionBase_0_10.cpp - qpid/client/SessionBase_0_10.h + ../include/qpid/client/SessionBase_0_10.h qpid/client/SessionBase_0_10Access.h qpid/client/ConnectionAccess.h qpid/client/SessionImpl.cpp @@ -615,7 +616,7 @@ target_link_libraries (qpidd qpidbroker qpidcommon ${Boost_PROGRAM_OPTIONS_LIBRA # qpid/agent/ManagementAgent.h \ # qpid/agent/ManagementAgentImpl.h set (qmfagent_SOURCES - qpid/agent/ManagementAgent.h + ../include/qpid/agent/ManagementAgent.h qpid/agent/ManagementAgentImpl.cpp qpid/agent/ManagementAgentImpl.h qmf/Agent.cpp @@ -656,29 +657,29 @@ set_target_properties (qmfcommon PROPERTIES # qpid/console/SessionManager.h \ # qpid/console/Value.h set (qmfconsole_SOURCES - qpid/console/Agent.h + ../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 qpid/console/Agent.cpp - qpid/console/Broker.h qpid/console/Broker.cpp - qpid/console/ClassKey.h qpid/console/ClassKey.cpp - qpid/console/ConsoleImportExport.h - qpid/console/ConsoleListener.h - qpid/console/Event.h qpid/console/Event.cpp - qpid/console/Object.h qpid/console/Object.cpp - qpid/console/ObjectId.h qpid/console/ObjectId.cpp - qpid/console/Package.h qpid/console/Package.cpp - qpid/console/Schema.h qpid/console/Schema.cpp - qpid/console/SequenceManager.h qpid/console/SequenceManager.cpp - qpid/console/SessionManager.h qpid/console/SessionManager.cpp - qpid/console/Value.h qpid/console/Value.cpp ) add_library (qmfconsole SHARED ${qmfconsole_SOURCES}) diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am index 541e81a7f6..e6038bbd43 100644 --- a/cpp/src/Makefile.am +++ b/cpp/src/Makefile.am @@ -61,6 +61,10 @@ windows_dist = \ EXTRA_DIST= $(platform_dist) $(rgen_srcs) $(windows_dist) +# Define variables that are be appended to by this file and included .mk files. +nobase_include_HEADERS = +libqpidcommon_la_SOURCES = + ## Generated code # Note: generated soure and makefiles included in distribution so a @@ -105,7 +109,7 @@ include $(srcdir)/managementgen.mk ## Compiler flags AM_CXXFLAGS = $(WARNING_CFLAGS) AM_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO_ARG) -INCLUDES = -Igen -I$(srcdir)/gen +INCLUDES = -Igen -I$(srcdir)/gen -I$(top_srcdir)/include # # Destination for intalled programs and tests defined here @@ -132,31 +136,34 @@ posix_qpidd_src = posix/QpiddBroker.cpp sbin_PROGRAMS = qpidd qpidd_SOURCES = qpidd.cpp qpidd.h $(posix_qpidd_src) -posix_plat_src = \ - qpid/log/posix/SinkOptions.cpp \ - qpid/sys/posix/IOHandle.cpp \ - qpid/sys/posix/Socket.cpp \ - qpid/sys/posix/AsynchIO.cpp \ - qpid/sys/posix/FileSysDir.cpp \ - qpid/sys/posix/LockFile.cpp \ - qpid/sys/posix/Time.cpp \ - qpid/sys/posix/Thread.cpp \ - qpid/sys/posix/Shlib.cpp \ - qpid/sys/posix/Mutex.cpp \ - qpid/sys/posix/Fork.cpp \ - qpid/sys/posix/StrError.cpp \ - qpid/sys/posix/PollableCondition.cpp \ - qpid/sys/posix/PipeHandle.cpp - -posix_plat_hdr = \ - qpid/log/posix/SinkOptions.h \ - qpid/sys/posix/check.h \ - qpid/sys/posix/Condition.h \ - qpid/sys/posix/PrivatePosix.h \ - qpid/sys/posix/Mutex.h \ - qpid/sys/posix/Fork.h \ - qpid/sys/posix/IntegerTypes.h \ - qpid/sys/posix/Time.h +## Platform specific code. + +# Posix-specific code +libqpidcommon_la_SOURCES += \ + qpid/log/posix/SinkOptions.cpp \ + qpid/sys/posix/IOHandle.cpp \ + qpid/sys/posix/Socket.cpp \ + qpid/sys/posix/AsynchIO.cpp \ + qpid/sys/posix/FileSysDir.cpp \ + qpid/sys/posix/LockFile.cpp \ + qpid/sys/posix/Time.cpp \ + qpid/sys/posix/Thread.cpp \ + qpid/sys/posix/Shlib.cpp \ + qpid/sys/posix/Mutex.cpp \ + qpid/sys/posix/Fork.cpp \ + qpid/sys/posix/StrError.cpp \ + qpid/sys/posix/PollableCondition.cpp \ + qpid/sys/posix/PipeHandle.cpp \ + qpid/log/posix/SinkOptions.h \ + qpid/sys/posix/Fork.h + +nobase_include_HEADERS += \ + ../include/qpid/sys/posix/Condition.h \ + ../include/qpid/sys/posix/IntegerTypes.h \ + ../include/qpid/sys/posix/Mutex.h \ + ../include/qpid/sys/posix/PrivatePosix.h \ + ../include/qpid/sys/posix/Time.h \ + ../include/qpid/sys/posix/check.h if HAVE_EPOLL poller = qpid/sys/epoll/EpollPoller.cpp @@ -172,8 +179,7 @@ else systeminfo = qpid/sys/posix/SystemInfo.cpp endif -platform_src = $(posix_plat_src) $(poller) $(systeminfo) -platform_hdr = $(posix_plat_hdr) +libqpidcommon_la_SOURCES += $(poller) $(systeminfo) posix_broker_src = \ qpid/broker/posix/BrokerDefaults.cpp @@ -187,7 +193,6 @@ dmoduledir=$(libdir)/qpid/daemon cmoduledir=$(libdir)/qpid/client dmodule_LTLIBRARIES = cmodule_LTLIBRARIES = -module_hdr = include cluster.mk include acl.mk @@ -301,66 +306,157 @@ libqpidcommon_la_LIBADD = \ $(LIB_DLOPEN) \ $(LIB_CLOCK_GETTIME) -libqpidcommon_la_SOURCES = \ - $(rgen_framing_srcs) \ - $(platform_src) \ - qpid/assert.cpp qpid/assert.h \ - qpid/pointer_to_other.h \ - qpid/Address.cpp \ - qpid/DataDir.cpp \ - qpid/Exception.cpp \ - qpid/Modules.cpp \ - qpid/Options.cpp \ - qpid/Plugin.cpp \ - qpid/RefCountedBuffer.h \ - qpid/RefCountedBuffer.cpp \ - qpid/Serializer.h \ - qpid/SessionState.h \ - qpid/SessionState.cpp \ - qpid/SessionId.cpp \ - qpid/StringUtils.cpp \ - qpid/Url.cpp \ - qpid/amqp_0_10/SessionHandler.h \ - qpid/amqp_0_10/SessionHandler.cpp \ - qpid/framing/AccumulatedAck.cpp \ - qpid/framing/AMQBody.cpp \ - qpid/framing/AMQMethodBody.cpp \ - qpid/framing/AMQContentBody.cpp \ - qpid/framing/AMQFrame.cpp \ - qpid/framing/AMQHeaderBody.cpp \ - qpid/framing/AMQHeartbeatBody.cpp \ - qpid/framing/Array.cpp \ - qpid/framing/BodyHandler.cpp \ - qpid/framing/Buffer.cpp \ - qpid/framing/Endian.cpp \ - qpid/framing/FieldTable.cpp \ - qpid/framing/FieldValue.cpp \ - qpid/framing/FrameSet.cpp \ - qpid/framing/FrameDecoder.cpp \ - qpid/framing/ProtocolInitiation.cpp \ - qpid/framing/ProtocolVersion.cpp \ - qpid/framing/SendContent.cpp \ - qpid/framing/SequenceNumber.cpp \ - qpid/framing/SequenceNumberSet.cpp \ - qpid/framing/SequenceSet.cpp \ - qpid/framing/Proxy.cpp \ - qpid/framing/Uuid.cpp \ - qpid/framing/AMQP_HighestVersion.h \ - qpid/framing/TransferContent.cpp \ - qpid/log/Logger.cpp \ - qpid/log/Options.cpp \ - qpid/log/OstreamOutput.cpp \ - qpid/log/Selector.cpp \ - qpid/log/Statement.cpp \ - qpid/management/Manageable.cpp \ - qpid/management/ManagementObject.cpp \ - qpid/sys/AggregateOutput.cpp \ - qpid/sys/AsynchIOHandler.cpp \ - qpid/sys/Dispatcher.cpp \ - qpid/sys/DispatchHandle.cpp \ - qpid/sys/Runnable.cpp \ - qpid/sys/Shlib.cpp \ - qpid/sys/Timer.cpp +libqpidcommon_la_SOURCES += \ + $(rgen_framing_srcs) \ + $(platform_src) \ + qpid/Address.cpp \ + qpid/DataDir.cpp \ + qpid/DataDir.h \ + qpid/Exception.cpp \ + qpid/Modules.cpp \ + qpid/Modules.h \ + qpid/Options.cpp \ + qpid/Plugin.cpp \ + qpid/Plugin.h \ + qpid/RefCounted.h \ + qpid/RefCountedBuffer.cpp \ + qpid/RefCountedBuffer.h \ + qpid/Serializer.h \ + qpid/SessionId.cpp \ + qpid/SessionState.cpp \ + qpid/SessionState.h \ + qpid/SessionState.h \ + qpid/SharedObject.h \ + qpid/StringUtils.cpp \ + qpid/StringUtils.h \ + qpid/Url.cpp \ + qpid/Version.h \ + qpid/amqp_0_10/Exception.h \ + qpid/amqp_0_10/SessionHandler.cpp \ + qpid/amqp_0_10/SessionHandler.h \ + qpid/amqp_0_10/apply.h \ + qpid/assert.cpp qpid/assert.h \ + qpid/assert.h \ + qpid/framing/AMQBody.cpp \ + qpid/framing/AMQBody.h \ + qpid/framing/AMQCommandControlBody.h \ + qpid/framing/AMQContentBody.cpp \ + qpid/framing/AMQContentBody.h \ + qpid/framing/AMQDataBlock.h \ + qpid/framing/AMQFrame.cpp \ + qpid/framing/AMQFrame.h \ + qpid/framing/AMQHeaderBody.cpp \ + qpid/framing/AMQHeaderBody.h \ + qpid/framing/AMQHeartbeatBody.cpp \ + qpid/framing/AMQHeartbeatBody.h \ + qpid/framing/AMQMethodBody.cpp \ + qpid/framing/AMQMethodBody.h \ + qpid/framing/AMQP_HighestVersion.h \ + qpid/framing/AMQP_HighestVersion.h \ + qpid/framing/AccumulatedAck.cpp \ + qpid/framing/AccumulatedAck.h \ + qpid/framing/Array.cpp \ + qpid/framing/BodyFactory.h \ + qpid/framing/BodyHandler.cpp \ + qpid/framing/BodyHandler.h \ + qpid/framing/Buffer.cpp \ + qpid/framing/ChannelHandler.h \ + qpid/framing/Endian.cpp \ + qpid/framing/Endian.h \ + qpid/framing/FieldTable.cpp \ + qpid/framing/FieldValue.cpp \ + qpid/framing/FrameDecoder.cpp \ + qpid/framing/FrameDecoder.h \ + qpid/framing/FrameDefaultVisitor.h \ + qpid/framing/FrameHandler.h \ + qpid/framing/FrameSet.cpp \ + qpid/framing/FrameSet.h \ + qpid/framing/Handler.h \ + qpid/framing/HeaderProperties.h \ + qpid/framing/InitiationHandler.h \ + qpid/framing/InputHandler.h \ + qpid/framing/Invoker.h \ + qpid/framing/MethodBodyFactory.h \ + qpid/framing/MethodContent.h \ + qpid/framing/ModelMethod.h \ + qpid/framing/OutputHandler.h \ + qpid/framing/ProtocolInitiation.cpp \ + qpid/framing/ProtocolInitiation.h \ + qpid/framing/ProtocolVersion.cpp \ + qpid/framing/Proxy.cpp \ + qpid/framing/Proxy.h \ + qpid/framing/SendContent.cpp \ + qpid/framing/SendContent.h \ + qpid/framing/SequenceNumber.cpp \ + qpid/framing/SequenceNumberSet.cpp \ + qpid/framing/SequenceNumberSet.h \ + qpid/framing/SequenceSet.cpp \ + qpid/framing/TransferContent.cpp \ + qpid/framing/TransferContent.h \ + qpid/framing/TypeFilter.h \ + qpid/framing/Uuid.cpp \ + qpid/framing/Visitor.h \ + qpid/framing/amqp_framing.h \ + qpid/framing/frame_functors.h \ + qpid/framing/variant.h \ + qpid/log/Helpers.h \ + qpid/log/Logger.cpp \ + qpid/log/Options.cpp \ + qpid/log/OstreamOutput.cpp \ + qpid/log/OstreamOutput.h \ + qpid/log/Selector.cpp \ + qpid/log/Statement.cpp \ + qpid/memory.h \ + qpid/pointer_to_other.h \ + qpid/ptr_map.h \ + qpid/sys/AggregateOutput.cpp \ + qpid/sys/AggregateOutput.h \ + qpid/sys/AsynchIO.h \ + qpid/sys/AsynchIOHandler.cpp \ + qpid/sys/AsynchIOHandler.h \ + qpid/sys/AtomicCount.h \ + qpid/sys/AtomicValue.h \ + qpid/sys/AtomicValue_gcc.h \ + qpid/sys/AtomicValue_mutex.h \ + qpid/sys/BlockingQueue.h \ + qpid/sys/Codec.h \ + qpid/sys/ConnectionCodec.h \ + qpid/sys/ConnectionInputHandler.h \ + qpid/sys/ConnectionInputHandlerFactory.h \ + qpid/sys/ConnectionOutputHandler.h \ + qpid/sys/ConnectionOutputHandlerPtr.h \ + qpid/sys/CopyOnWriteArray.h \ + qpid/sys/DeletionManager.h \ + qpid/sys/DispatchHandle.cpp \ + qpid/sys/DispatchHandle.h \ + qpid/sys/Dispatcher.cpp \ + qpid/sys/Dispatcher.h \ + qpid/sys/ExceptionHolder.h \ + qpid/sys/FileSysDir.h \ + qpid/sys/Fork.h \ + qpid/sys/LockFile.h \ + qpid/sys/LockPtr.h \ + qpid/sys/OutputControl.h \ + qpid/sys/OutputTask.h \ + qpid/sys/PipeHandle.h \ + qpid/sys/PollableCondition.h \ + qpid/sys/PollableQueue.h \ + qpid/sys/Poller.h \ + qpid/sys/ProtocolFactory.h \ + qpid/sys/Runnable.cpp \ + qpid/sys/ScopedIncrement.h \ + qpid/sys/SecurityLayer.h \ + qpid/sys/Semaphore.h \ + qpid/sys/Shlib.cpp \ + qpid/sys/Shlib.h \ + qpid/sys/ShutdownHandler.h \ + qpid/sys/Socket.h \ + qpid/sys/StateMonitor.h \ + qpid/sys/TimeoutHandler.h \ + qpid/sys/Timer.cpp \ + qpid/sys/Timer.h \ + qpid/sys/Waitable.h \ + qpid/sys/alloca.h if HAVE_SASL libqpidcommon_la_SOURCES += qpid/sys/cyrus/CyrusSecurityLayer.h @@ -373,74 +469,160 @@ libqpidbroker_la_LIBADD = libqpidcommon.la -luuid libqpidbroker_la_SOURCES = \ $(mgen_broker_cpp) \ $(posix_broker_src) \ - qpid/amqp_0_10/Connection.h \ qpid/amqp_0_10/Connection.cpp \ + qpid/amqp_0_10/Connection.h \ + qpid/broker/AclModule.h \ + qpid/broker/Bridge.cpp \ + qpid/broker/Bridge.h \ qpid/broker/Broker.cpp \ + qpid/broker/Broker.h \ + qpid/broker/BrokerImportExport.h \ qpid/broker/BrokerSingleton.cpp \ - qpid/broker/Exchange.cpp \ - qpid/broker/ExpiryPolicy.cpp \ - qpid/broker/Queue.cpp \ - qpid/broker/QueueCleaner.cpp \ - qpid/broker/QueueListeners.cpp \ - qpid/broker/PersistableMessage.cpp \ - qpid/broker/Bridge.cpp \ + qpid/broker/BrokerSingleton.h \ qpid/broker/Connection.cpp \ - qpid/broker/ConnectionHandler.cpp \ + qpid/broker/Connection.h \ qpid/broker/ConnectionFactory.cpp \ + qpid/broker/ConnectionFactory.h \ + qpid/broker/ConnectionHandler.cpp \ + qpid/broker/ConnectionHandler.h \ + qpid/broker/ConnectionState.h \ + qpid/broker/ConnectionToken.h \ + qpid/broker/Consumer.h \ qpid/broker/Daemon.cpp \ + qpid/broker/Daemon.h \ + qpid/broker/Deliverable.h \ qpid/broker/DeliverableMessage.cpp \ + qpid/broker/DeliverableMessage.h \ + qpid/broker/DeliveryAdapter.h \ + qpid/broker/DeliveryId.h \ qpid/broker/DeliveryRecord.cpp \ + qpid/broker/DeliveryRecord.h \ qpid/broker/DirectExchange.cpp \ + qpid/broker/DirectExchange.h \ qpid/broker/DtxAck.cpp \ + qpid/broker/DtxAck.h \ qpid/broker/DtxBuffer.cpp \ + qpid/broker/DtxBuffer.h \ qpid/broker/DtxManager.cpp \ + qpid/broker/DtxManager.h \ qpid/broker/DtxTimeout.cpp \ + qpid/broker/DtxTimeout.h \ qpid/broker/DtxWorkRecord.cpp \ + qpid/broker/DtxWorkRecord.h \ + qpid/broker/Exchange.cpp \ + qpid/broker/Exchange.h \ qpid/broker/ExchangeRegistry.cpp \ + qpid/broker/ExchangeRegistry.h \ + qpid/broker/ExpiryPolicy.cpp \ + qpid/broker/ExpiryPolicy.h \ qpid/broker/FanOutExchange.cpp \ + qpid/broker/FanOutExchange.h \ + qpid/broker/HandlerImpl.h \ qpid/broker/HeadersExchange.cpp \ + qpid/broker/HeadersExchange.h \ qpid/broker/IncompleteMessageList.cpp \ + qpid/broker/IncompleteMessageList.h \ qpid/broker/Link.cpp \ + qpid/broker/Link.h \ qpid/broker/LinkRegistry.cpp \ + qpid/broker/LinkRegistry.h \ qpid/broker/Message.cpp \ + qpid/broker/Message.h \ qpid/broker/MessageAdapter.cpp \ + qpid/broker/MessageAdapter.h \ qpid/broker/MessageBuilder.cpp \ + qpid/broker/MessageBuilder.h \ + qpid/broker/MessageStore.h \ qpid/broker/MessageStoreModule.cpp \ + qpid/broker/MessageStoreModule.h \ qpid/broker/NameGenerator.cpp \ + qpid/broker/NameGenerator.h \ qpid/broker/NullMessageStore.cpp \ + qpid/broker/NullMessageStore.h \ + qpid/broker/OwnershipToken.h \ + qpid/broker/Persistable.h \ + qpid/broker/PersistableConfig.h \ + qpid/broker/PersistableExchange.h \ + qpid/broker/PersistableMessage.cpp \ + qpid/broker/PersistableMessage.h \ + qpid/broker/PersistableQueue.h \ + qpid/broker/Queue.cpp \ + qpid/broker/Queue.h \ qpid/broker/QueueBindings.cpp \ + qpid/broker/QueueBindings.h \ + qpid/broker/QueueCleaner.cpp \ + qpid/broker/QueueCleaner.h \ qpid/broker/QueueEvents.cpp \ + qpid/broker/QueueEvents.h \ + qpid/broker/QueueListeners.cpp \ + qpid/broker/QueueListeners.h \ qpid/broker/QueuePolicy.cpp \ + qpid/broker/QueuePolicy.h \ qpid/broker/QueueRegistry.cpp \ + qpid/broker/QueueRegistry.h \ + qpid/broker/QueuedMessage.h \ + qpid/broker/RateFlowcontrol.h \ qpid/broker/RateTracker.cpp \ - qpid/broker/RecoveryManagerImpl.cpp \ - qpid/broker/RecoveredEnqueue.cpp \ + qpid/broker/RateTracker.h \ + qpid/broker/RecoverableConfig.h \ + qpid/broker/RecoverableExchange.h \ + qpid/broker/RecoverableMessage.h \ + qpid/broker/RecoverableQueue.h \ + qpid/broker/RecoverableTransaction.h \ qpid/broker/RecoveredDequeue.cpp \ + qpid/broker/RecoveredDequeue.h \ + qpid/broker/RecoveredEnqueue.cpp \ + qpid/broker/RecoveredEnqueue.h \ + qpid/broker/RecoveryManager.h \ + qpid/broker/RecoveryManagerImpl.cpp \ + qpid/broker/RecoveryManagerImpl.h \ qpid/broker/RetryList.cpp \ + qpid/broker/RetryList.h \ qpid/broker/SaslAuthenticator.cpp \ + qpid/broker/SaslAuthenticator.h \ qpid/broker/SecureConnection.cpp \ + qpid/broker/SecureConnection.h \ qpid/broker/SecureConnectionFactory.cpp \ - qpid/broker/SemanticState.h \ + qpid/broker/SecureConnectionFactory.h \ qpid/broker/SemanticState.cpp \ + qpid/broker/SemanticState.h \ qpid/broker/SessionAdapter.cpp \ - qpid/broker/SessionState.h \ - qpid/broker/SessionState.cpp \ - qpid/broker/SessionManager.h \ - qpid/broker/SessionManager.cpp \ + qpid/broker/SessionAdapter.h \ + qpid/broker/SessionAdapter.h \ qpid/broker/SessionContext.h \ - qpid/broker/SessionHandler.h \ qpid/broker/SessionHandler.cpp \ - qpid/broker/SignalHandler.h \ + qpid/broker/SessionHandler.h \ + qpid/broker/SessionManager.cpp \ + qpid/broker/SessionManager.h \ + qpid/broker/SessionManager.h \ + qpid/broker/SessionState.cpp \ + qpid/broker/SessionState.h \ qpid/broker/SignalHandler.cpp \ + qpid/broker/SignalHandler.h \ qpid/broker/System.cpp \ + qpid/broker/System.h \ qpid/broker/Timer.cpp \ + qpid/broker/Timer.h \ qpid/broker/TopicExchange.cpp \ + qpid/broker/TopicExchange.h \ + qpid/broker/TransactionalStore.h \ qpid/broker/TxAccept.cpp \ + qpid/broker/TxAccept.h \ qpid/broker/TxBuffer.cpp \ + qpid/broker/TxBuffer.h \ + qpid/broker/TxOp.h \ + qpid/broker/TxOpVisitor.h \ qpid/broker/TxPublish.cpp \ + qpid/broker/TxPublish.h \ qpid/broker/Vhost.cpp \ + qpid/broker/Vhost.h \ + qpid/management/IdAllocator.h \ + qpid/management/Manageable.cpp \ qpid/management/ManagementAgent.cpp \ + qpid/management/ManagementAgent.h \ qpid/management/ManagementExchange.cpp \ + qpid/management/ManagementExchange.h \ + qpid/management/ManagementObject.cpp \ qpid/sys/TCPIOPlugin.cpp @@ -449,20 +631,29 @@ libqpidclient_la_LIBADD = libqpidcommon.la -luuid libqpidclient_la_SOURCES = \ $(rgen_client_srcs) \ qpid/client/Bounds.cpp \ + qpid/client/Bounds.h \ + qpid/client/ChainableFrameHandler.h \ + qpid/client/Completion.cpp \ + qpid/client/CompletionImpl.h \ qpid/client/Connection.cpp \ + qpid/client/ConnectionAccess.h \ qpid/client/ConnectionHandler.cpp \ + qpid/client/ConnectionHandler.h \ qpid/client/ConnectionImpl.cpp \ + qpid/client/ConnectionImpl.h \ qpid/client/ConnectionSettings.cpp \ qpid/client/Connector.cpp \ + qpid/client/Connector.h \ qpid/client/Demux.cpp \ + qpid/client/Demux.h \ qpid/client/Dispatcher.cpp \ - qpid/client/FailoverManager.cpp \ - qpid/client/FailoverListener.h \ + qpid/client/Dispatcher.h \ + qpid/client/Execution.h \ qpid/client/FailoverListener.cpp \ + qpid/client/FailoverListener.h \ + qpid/client/FailoverManager.cpp \ qpid/client/Future.cpp \ qpid/client/FutureCompletion.cpp \ - qpid/client/Completion.cpp \ - qpid/client/CompletionImpl.h \ qpid/client/FutureResult.cpp \ qpid/client/LoadPlugins.cpp \ qpid/client/LocalQueue.cpp \ @@ -473,279 +664,94 @@ libqpidclient_la_SOURCES = \ qpid/client/MessageImpl.h \ qpid/client/MessageListener.cpp \ qpid/client/MessageReplayTracker.cpp \ + qpid/client/PrivateImplRef.h \ qpid/client/QueueOptions.cpp \ qpid/client/Results.cpp \ + qpid/client/Results.h \ + qpid/client/Sasl.h \ qpid/client/SaslFactory.cpp \ + qpid/client/SaslFactory.h \ qpid/client/SessionBase_0_10.cpp \ - qpid/client/SessionBase_0_10.h \ qpid/client/SessionBase_0_10Access.h \ - qpid/client/ConnectionAccess.h \ qpid/client/SessionImpl.cpp \ + qpid/client/SessionImpl.h \ qpid/client/StateManager.cpp \ + qpid/client/StateManager.h \ qpid/client/Subscription.cpp \ qpid/client/SubscriptionImpl.cpp \ - qpid/client/SubscriptionImpl.h \ + qpid/client/SubscriptionImpl.h \ qpid/client/SubscriptionManager.cpp \ qpid/client/SubscriptionManagerImpl.cpp \ qpid/client/SubscriptionManagerImpl.h -nobase_include_HEADERS = \ - $(platform_hdr) \ - $(module_hdr) \ - qpid/amqp_0_10/apply.h \ - qpid/assert.h \ - qpid/Address.h \ - qpid/DataDir.h \ - qpid/Exception.h \ - qpid/sys/ExceptionHolder.h \ - qpid/amqp_0_10/Exception.h \ - qpid/Modules.h \ - qpid/Msg.h \ - qpid/Options.h \ - qpid/Plugin.h \ - qpid/ptr_map.h \ - qpid/RangeSet.h \ - qpid/RefCounted.h \ - qpid/SessionId.h \ - qpid/SessionState.h \ - qpid/SharedObject.h \ - qpid/StringUtils.h \ - qpid/Url.h \ - qpid/InlineVector.h \ - qpid/InlineAllocator.h \ - qpid/memory.h \ - qpid/Version.h \ - qpid/broker/Broker.h \ - qpid/broker/AclModule.h \ - qpid/broker/SessionAdapter.h \ - qpid/broker/Exchange.h \ - qpid/broker/Queue.h \ - qpid/broker/QueueListeners.h \ - qpid/broker/QueueCleaner.h \ - qpid/broker/BrokerImportExport.h \ - qpid/broker/BrokerSingleton.h \ - qpid/broker/Bridge.h \ - qpid/broker/Connection.h \ - qpid/broker/ConnectionState.h \ - qpid/broker/ConnectionFactory.h \ - qpid/broker/ConnectionHandler.h \ - qpid/broker/ConnectionToken.h \ - qpid/broker/OwnershipToken.h \ - qpid/broker/Consumer.h \ - qpid/broker/Daemon.h \ - qpid/broker/Deliverable.h \ - qpid/broker/DeliverableMessage.h \ - qpid/broker/DeliveryAdapter.h \ - qpid/broker/DeliveryId.h \ - qpid/broker/DeliveryRecord.h \ - qpid/broker/DirectExchange.h \ - qpid/broker/DtxAck.h \ - qpid/broker/DtxBuffer.h \ - qpid/broker/DtxManager.h \ - qpid/broker/DtxTimeout.h \ - qpid/broker/DtxWorkRecord.h \ - qpid/broker/ExchangeRegistry.h \ - qpid/broker/ExpiryPolicy.h \ - qpid/broker/FanOutExchange.h \ - qpid/broker/HandlerImpl.h \ - qpid/broker/HeadersExchange.h \ - qpid/broker/IncompleteMessageList.h \ - qpid/broker/Link.h \ - qpid/broker/LinkRegistry.h \ - qpid/broker/Message.h \ - qpid/broker/MessageAdapter.h \ - qpid/broker/MessageBuilder.h \ - qpid/broker/MessageStore.h \ - qpid/broker/MessageStoreModule.h \ - qpid/broker/NameGenerator.h \ - qpid/broker/NullMessageStore.h \ - qpid/broker/Persistable.h \ - qpid/broker/PersistableConfig.h \ - qpid/broker/PersistableExchange.h \ - qpid/broker/PersistableMessage.h \ - qpid/broker/PersistableQueue.h \ - qpid/broker/QueueBindings.h \ - qpid/broker/QueueEvents.h \ - qpid/broker/QueuedMessage.h \ - qpid/broker/QueuePolicy.h \ - qpid/broker/QueueRegistry.h \ - qpid/broker/RateFlowcontrol.h \ - qpid/broker/RateTracker.h \ - qpid/broker/RecoverableConfig.h \ - qpid/broker/RecoverableExchange.h \ - qpid/broker/RecoverableMessage.h \ - qpid/broker/RecoverableQueue.h \ - qpid/broker/RecoverableTransaction.h \ - qpid/broker/RecoveredDequeue.h \ - qpid/broker/RecoveredEnqueue.h \ - qpid/broker/RecoveryManager.h \ - qpid/broker/RecoveryManagerImpl.h \ - qpid/broker/RetryList.h \ - qpid/broker/SaslAuthenticator.h \ - qpid/broker/SecureConnection.h \ - qpid/broker/SecureConnectionFactory.h \ - qpid/broker/SessionAdapter.h \ - qpid/broker/SessionManager.h \ - qpid/broker/System.h \ - qpid/broker/Timer.h \ - qpid/broker/TopicExchange.h \ - qpid/broker/TransactionalStore.h \ - qpid/broker/TxAccept.h \ - qpid/broker/TxBuffer.h \ - qpid/broker/TxOp.h \ - qpid/broker/TxOpVisitor.h \ - qpid/broker/TxPublish.h \ - qpid/broker/Vhost.h \ - qpid/client/Bounds.h \ - qpid/client/ChainableFrameHandler.h \ - qpid/client/ClientImportExport.h \ - qpid/client/Completion.h \ - qpid/client/Connection.h \ - qpid/client/ConnectionHandler.h \ - qpid/client/ConnectionImpl.h \ - qpid/client/ConnectionSettings.h \ - qpid/client/Connector.h \ - qpid/client/Demux.h \ - qpid/client/Dispatcher.h \ - qpid/client/Execution.h \ - qpid/client/FailoverManager.h \ - qpid/client/Subscription.h \ - qpid/client/SubscriptionSettings.h \ - qpid/client/FlowControl.h \ - qpid/client/Future.h \ - qpid/client/FutureCompletion.h \ - qpid/client/FutureResult.h \ - qpid/client/Handle.h \ - qpid/client/PrivateImplRef.h \ - qpid/client/LocalQueue.h \ - qpid/client/QueueOptions.h \ - qpid/client/Message.h \ - qpid/client/MessageListener.h \ - qpid/client/MessageReplayTracker.h \ - qpid/client/Results.h \ - qpid/client/Sasl.h \ - qpid/client/SaslFactory.h \ - qpid/client/SessionBase_0_10.h \ - qpid/client/Session.h \ - qpid/client/SessionImpl.h \ - qpid/client/AsyncSession.h \ - qpid/client/StateManager.h \ - qpid/client/SubscriptionManager.h \ - qpid/client/TypedResult.h \ - qpid/framing/AMQBody.h \ - qpid/framing/AMQCommandControlBody.h \ - qpid/framing/AMQContentBody.h \ - qpid/framing/AMQDataBlock.h \ - qpid/framing/AMQFrame.h \ - qpid/framing/AMQHeaderBody.h \ - qpid/framing/AMQHeartbeatBody.h \ - qpid/framing/AMQMethodBody.h \ - qpid/framing/AMQP_HighestVersion.h \ - qpid/framing/AccumulatedAck.h \ - qpid/framing/Array.h \ - qpid/framing/BodyHandler.h \ - qpid/framing/BodyFactory.h \ - qpid/framing/MethodBodyFactory.h \ - qpid/framing/Buffer.h \ - qpid/framing/ChannelHandler.h \ - qpid/framing/Endian.h \ - qpid/framing/FieldTable.h \ - qpid/framing/FieldValue.h \ - qpid/framing/FrameDefaultVisitor.h \ - qpid/framing/FrameDecoder.h \ - qpid/framing/FrameHandler.h \ - qpid/framing/FrameSet.h \ - qpid/framing/Handler.h \ - qpid/framing/HeaderProperties.h \ - qpid/framing/Invoker.h \ - qpid/framing/InputHandler.h \ - qpid/framing/InitiationHandler.h \ - qpid/framing/MethodContent.h \ - qpid/framing/ModelMethod.h \ - qpid/framing/OutputHandler.h \ - qpid/framing/ProtocolInitiation.h \ - qpid/framing/ProtocolVersion.h \ - qpid/framing/Proxy.h \ - qpid/framing/SendContent.h \ - qpid/framing/SequenceNumber.h \ - qpid/framing/SequenceSet.h \ - qpid/framing/SequenceNumberSet.h \ - qpid/framing/StructHelper.h \ - qpid/framing/TransferContent.h \ - qpid/framing/TypeFilter.h \ - qpid/framing/Uuid.h \ - qpid/framing/Visitor.h \ - qpid/framing/amqp_framing.h \ - qpid/framing/amqp_types.h \ - qpid/framing/amqp_types_full.h \ - qpid/framing/frame_functors.h \ - qpid/framing/variant.h \ - qpid/log/Helpers.h \ - qpid/log/Options.h \ - qpid/log/Logger.h \ - qpid/log/OstreamOutput.h \ - qpid/log/Selector.h \ - qpid/log/SinkOptions.h \ - qpid/log/Statement.h \ - qpid/management/Args.h \ - qpid/management/IdAllocator.h \ - qpid/management/Manageable.h \ - qpid/management/ManagementAgent.h \ - qpid/management/ManagementEvent.h \ - qpid/management/ManagementExchange.h \ - qpid/management/ManagementObject.h \ - qpid/sys/alloca.h \ - qpid/sys/AggregateOutput.h \ - qpid/sys/AsynchIO.h \ - qpid/sys/AsynchIOHandler.h \ - qpid/sys/AtomicCount.h \ - qpid/sys/AtomicValue.h \ - qpid/sys/AtomicValue_gcc.h \ - qpid/sys/AtomicValue_mutex.h \ - qpid/sys/BlockingQueue.h \ - qpid/sys/Codec.h \ - qpid/sys/CopyOnWriteArray.h \ - qpid/sys/Condition.h \ - qpid/sys/ConnectionCodec.h \ - qpid/sys/ConnectionInputHandler.h \ - qpid/sys/ConnectionInputHandlerFactory.h \ - qpid/sys/ConnectionOutputHandler.h \ - qpid/sys/ConnectionOutputHandlerPtr.h \ - qpid/sys/DeletionManager.h \ - qpid/sys/Dispatcher.h \ - qpid/sys/DispatchHandle.h \ - qpid/sys/FileSysDir.h \ - qpid/sys/IntegerTypes.h \ - qpid/sys/IOHandle.h \ - qpid/sys/LockFile.h \ - qpid/sys/LockPtr.h \ - qpid/sys/Monitor.h \ - qpid/sys/Mutex.h \ - qpid/sys/OutputControl.h \ - qpid/sys/OutputTask.h \ - qpid/sys/PipeHandle.h \ - qpid/sys/PollableCondition.h \ - qpid/sys/PollableQueue.h \ - qpid/sys/Poller.h \ - qpid/sys/ProtocolFactory.h \ - qpid/sys/Runnable.h \ - qpid/sys/Fork.h \ - qpid/sys/ScopedIncrement.h \ - qpid/sys/SecurityLayer.h \ - qpid/sys/Semaphore.h \ - qpid/sys/SystemInfo.h \ - qpid/sys/Shlib.h \ - qpid/sys/ShutdownHandler.h \ - qpid/sys/Socket.h \ - qpid/sys/StateMonitor.h \ - qpid/sys/StrError.h \ - qpid/sys/Waitable.h \ - qpid/sys/Thread.h \ - qpid/sys/Time.h \ - qpid/sys/Timer.h \ - qpid/sys/TimeoutHandler.h \ - qpid/sys/uuid.h \ - qpid/CommonImportExport.h +# NOTE: only public header files (which should be in ../include) +# should go in this list. Private headers should go in the SOURCES +# list for one of the libraries or executables that includes it. + +nobase_include_HEADERS += \ + ../include/qpid/Address.h \ + ../include/qpid/CommonImportExport.h \ + ../include/qpid/Exception.h \ + ../include/qpid/InlineAllocator.h \ + ../include/qpid/InlineVector.h \ + ../include/qpid/Msg.h \ + ../include/qpid/Options.h \ + ../include/qpid/RangeSet.h \ + ../include/qpid/SessionId.h \ + ../include/qpid/Url.h \ + ../include/qpid/client/AsyncSession.h \ + ../include/qpid/client/ClientImportExport.h \ + ../include/qpid/client/Completion.h \ + ../include/qpid/client/Connection.h \ + ../include/qpid/client/ConnectionSettings.h \ + ../include/qpid/client/FailoverManager.h \ + ../include/qpid/client/FlowControl.h \ + ../include/qpid/client/Future.h \ + ../include/qpid/client/FutureCompletion.h \ + ../include/qpid/client/FutureResult.h \ + ../include/qpid/client/Handle.h \ + ../include/qpid/client/LocalQueue.h \ + ../include/qpid/client/Message.h \ + ../include/qpid/client/MessageListener.h \ + ../include/qpid/client/MessageReplayTracker.h \ + ../include/qpid/client/QueueOptions.h \ + ../include/qpid/client/Session.h \ + ../include/qpid/client/SessionBase_0_10.h \ + ../include/qpid/client/Subscription.h \ + ../include/qpid/client/SubscriptionManager.h \ + ../include/qpid/client/SubscriptionSettings.h \ + ../include/qpid/client/TypedResult.h \ + ../include/qpid/framing/Array.h \ + ../include/qpid/framing/Buffer.h \ + ../include/qpid/framing/FieldTable.h \ + ../include/qpid/framing/FieldValue.h \ + ../include/qpid/framing/ProtocolVersion.h \ + ../include/qpid/framing/SequenceNumber.h \ + ../include/qpid/framing/SequenceSet.h \ + ../include/qpid/framing/StructHelper.h \ + ../include/qpid/framing/Uuid.h \ + ../include/qpid/framing/amqp_types.h \ + ../include/qpid/framing/amqp_types_full.h \ + ../include/qpid/log/Logger.h \ + ../include/qpid/log/Options.h \ + ../include/qpid/log/Selector.h \ + ../include/qpid/log/SinkOptions.h \ + ../include/qpid/log/Statement.h \ + ../include/qpid/management/Args.h \ + ../include/qpid/management/Manageable.h \ + ../include/qpid/management/ManagementEvent.h \ + ../include/qpid/management/ManagementObject.h \ + ../include/qpid/sys/Condition.h \ + ../include/qpid/sys/IOHandle.h \ + ../include/qpid/sys/IntegerTypes.h \ + ../include/qpid/sys/Monitor.h \ + ../include/qpid/sys/Mutex.h \ + ../include/qpid/sys/Runnable.h \ + ../include/qpid/sys/StrError.h \ + ../include/qpid/sys/SystemInfo.h \ + ../include/qpid/sys/Thread.h \ + ../include/qpid/sys/Time.h \ + ../include/qpid/sys/uuid.h # Force build of qpidd during dist phase so help2man will work. dist-hook: $(BUILT_SOURCES) diff --git a/cpp/src/qmf.mk b/cpp/src/qmf.mk index 44e30efd9b..62393cdcfb 100644 --- a/cpp/src/qmf.mk +++ b/cpp/src/qmf.mk @@ -20,46 +20,47 @@ # # qmf agent library makefile fragment, to be included in Makefile.am # -lib_LTLIBRARIES += \ - libqmfcommon.la \ +lib_LTLIBRARIES += \ + libqmfcommon.la \ libqmfagent.la -module_hdr += \ - qpid/agent/ManagementAgent.h \ - qpid/agent/ManagementAgentImpl.h \ - qpid/agent/QmfAgentImportExport.h \ - qmf/Agent.h \ - qmf/Console.h \ - qmf/Event.h \ - qmf/Message.h \ - qmf/MessageImpl.h \ - qmf/Object.h \ - qmf/ObjectId.h \ - qmf/ObjectIdImpl.h \ - qmf/ObjectImpl.h \ - qmf/Query.h \ - qmf/QueryImpl.h \ - qmf/ResilientConnection.h \ - qmf/Schema.h \ - qmf/SchemaImpl.h \ - qmf/Typecode.h \ - qmf/Value.h \ - qmf/ValueImpl.h +# Public header files +nobase_include_HEADERS += \ + ../include/qpid/agent/ManagementAgent.h \ + ../include/qpid/agent/QmfAgentImportExport.h + -libqmfcommon_la_SOURCES = \ - qmf/Agent.cpp \ - qmf/ResilientConnection.cpp \ - qmf/MessageImpl.cpp \ - qmf/SchemaImpl.cpp \ - qmf/ValueImpl.cpp \ - qmf/ObjectIdImpl.cpp \ - qmf/ObjectImpl.cpp \ - qmf/QueryImpl.cpp +libqmfcommon_la_SOURCES = \ + qmf/Agent.cpp \ + qmf/Agent.h \ + qmf/Console.h \ + qmf/Event.h \ + qmf/Message.h \ + qmf/MessageImpl.cpp \ + qmf/MessageImpl.h \ + qmf/Object.h \ + qmf/ObjectId.h \ + qmf/ObjectIdImpl.cpp \ + qmf/ObjectIdImpl.h \ + qmf/ObjectImpl.cpp \ + qmf/ObjectImpl.h \ + qmf/Query.h \ + qmf/QueryImpl.cpp \ + qmf/QueryImpl.h \ + qmf/ResilientConnection.cpp \ + qmf/ResilientConnection.h \ + qmf/Schema.h \ + qmf/SchemaImpl.cpp \ + qmf/SchemaImpl.h \ + qmf/Typecode.h \ + qmf/Value.h \ + qmf/ValueImpl.cpp \ + qmf/ValueImpl.h -libqmfagent_la_SOURCES = \ - qpid/agent/ManagementAgent.h \ - qpid/agent/ManagementAgentImpl.cpp \ - qpid/agent/ManagementAgentImpl.h \ +libqmfagent_la_SOURCES = \ + ../include/qpid/agent/ManagementAgent.h \ + qpid/agent/ManagementAgentImpl.cpp \ + qpid/agent/ManagementAgentImpl.h \ qmf/Agent.cpp libqmfagent_la_LIBADD = libqpidclient.la diff --git a/cpp/src/qmfc.mk b/cpp/src/qmfc.mk index a95028413d..f3e6dc259d 100644 --- a/cpp/src/qmfc.mk +++ b/cpp/src/qmfc.mk @@ -22,45 +22,33 @@ # lib_LTLIBRARIES += libqmfconsole.la -module_hdr += \ - qpid/console/Agent.h \ - qpid/console/Broker.h \ - qpid/console/ClassKey.h \ - qpid/console/ConsoleImportExport.h \ - qpid/console/ConsoleListener.h \ - qpid/console/Event.h \ - qpid/console/Object.h \ - qpid/console/ObjectId.h \ - qpid/console/Package.h \ - qpid/console/Schema.h \ - qpid/console/SequenceManager.h \ - qpid/console/SessionManager.h \ - qpid/console/Value.h +# Public header files. +nobase_include_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 -libqmfconsole_la_SOURCES = \ - qpid/console/Agent.h \ - qpid/console/Agent.cpp \ - qpid/console/Broker.h \ - qpid/console/Broker.cpp \ - qpid/console/ClassKey.h \ - qpid/console/ClassKey.cpp \ - qpid/console/ConsoleImportExport.h \ - qpid/console/ConsoleListener.h \ - qpid/console/Event.h \ - qpid/console/Event.cpp \ - qpid/console/Object.h \ - qpid/console/Object.cpp \ - qpid/console/ObjectId.h \ - qpid/console/ObjectId.cpp \ - qpid/console/Package.h \ - qpid/console/Package.cpp \ - qpid/console/Schema.h \ - qpid/console/Schema.cpp \ - qpid/console/SequenceManager.h \ - qpid/console/SequenceManager.cpp \ - qpid/console/SessionManager.h \ - qpid/console/SessionManager.cpp \ - qpid/console/Value.h \ +libqmfconsole_la_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 libqmfconsole_la_LIBADD = libqpidclient.la diff --git a/cpp/src/qpid/Address.h b/cpp/src/qpid/Address.h deleted file mode 100755 index a5a4345ba3..0000000000 --- a/cpp/src/qpid/Address.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef QPID_ADDRESS_H -#define QPID_ADDRESS_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/sys/IntegerTypes.h" -#include "qpid/CommonImportExport.h" -#include <boost/variant.hpp> -#include <iosfwd> -#include <string> -#include <vector> - -namespace qpid { - -/** TCP address of a broker - host:port */ -struct TcpAddress { - static const uint16_t DEFAULT_PORT=5672; - QPID_COMMON_EXTERN explicit TcpAddress(const std::string& host_=std::string(),uint16_t port_=DEFAULT_PORT); - std::string host; - uint16_t port; -}; -bool operator==(const TcpAddress& x, const TcpAddress& y); -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const TcpAddress& a); - -/**@internal Not a real address type, this is a placeholder to - * demonstrate and validate multi-protocol Urls for unit tests and - * developer education only. An example address holds just a char. - */ -struct ExampleAddress { - explicit ExampleAddress(char data); - char data; -}; -bool operator==(const ExampleAddress& x, const ExampleAddress& y); -std::ostream& operator<<(std::ostream& os, const ExampleAddress& a); - -/** - * Contains the address of an AMQP broker. Can any supported type of - * broker address. Currently only TcpAddress is supported. - */ -struct Address { -public: - Address(const Address& a) : value(a.value) {} - Address(const TcpAddress& tcp) : value(tcp) {} - Address(const ExampleAddress& eg) : value(eg) {} ///<@internal - - template <class AddressType> Address& operator=(const AddressType& t) { value=t; return *this; } - - /** Get the address of type AddressType. - *@return AddressType* pointing to the contained address or 0 if - *contained address is not of type AddressType. - */ - template <class AddressType> AddressType* get() { return boost::get<AddressType>(&value); } - - /** Get the address of type AddressType. - *@return AddressType* pointing to the contained address or 0 if - *contained address is not of type AddressType. - */ - template <class AddressType> const AddressType* get() const { return boost::get<AddressType>(&value); } - -private: - boost::variant<TcpAddress,ExampleAddress> value; - friend std::ostream& operator<<(std::ostream& os, const Address& addr); -}; - - - -} // namespace qpid - -#endif /*!QPID_ADDRESS_H*/ diff --git a/cpp/src/qpid/CommonImportExport.h b/cpp/src/qpid/CommonImportExport.h deleted file mode 100644 index 02c06ed7af..0000000000 --- a/cpp/src/qpid/CommonImportExport.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef QPID_COMMON_IMPORT_EXPORT_H -#define QPID_COMMON_IMPORT_EXPORT_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) -#if defined(COMMON_EXPORT) || defined (qpidcommon_EXPORTS) -#define QPID_COMMON_EXTERN __declspec(dllexport) -#else -#define QPID_COMMON_EXTERN __declspec(dllimport) -#endif -#else -#define QPID_COMMON_EXTERN -#endif - -#endif diff --git a/cpp/src/qpid/Exception.h b/cpp/src/qpid/Exception.h deleted file mode 100644 index 0b0bc33e93..0000000000 --- a/cpp/src/qpid/Exception.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef _Exception_ -#define _Exception_ - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/framing/amqp_types.h" -#include "qpid/framing/constants.h" -#include "qpid/framing/enum.h" -#include "qpid/sys/StrError.h" -#include "qpid/Msg.h" -#include "qpid/CommonImportExport.h" -#include <memory> -#include <string> -#include <errno.h> - -namespace qpid -{ - -/** - * Base class for Qpid runtime exceptions. - */ -class Exception : public std::exception -{ - public: - QPID_COMMON_EXTERN explicit Exception(const std::string& message=std::string()) throw(); - QPID_COMMON_EXTERN virtual ~Exception() throw(); - QPID_COMMON_EXTERN virtual const char* what() const throw(); // prefix: message - QPID_COMMON_EXTERN virtual std::string getMessage() const; // Unprefixed message - QPID_COMMON_EXTERN virtual std::string getPrefix() const; // Prefix - - private: - std::string message; - mutable std::string whatStr; -}; - -/** Exception that includes an errno message. */ -struct ErrnoException : public Exception { - ErrnoException(const std::string& msg, int err) : Exception(msg+": "+qpid::sys::strError(err)) {} - ErrnoException(const std::string& msg) : Exception(msg+": "+qpid::sys::strError(errno)) {} -}; - -struct SessionException : public Exception { - const framing::execution::ErrorCode code; - SessionException(framing::execution::ErrorCode code_, const std::string& message) - : Exception(message), code(code_) {} -}; - -struct ChannelException : public Exception { - const framing::session::DetachCode code; - ChannelException(framing::session::DetachCode _code, const std::string& message) - : Exception(message), code(_code) {} -}; - -struct ConnectionException : public Exception { - const framing::connection::CloseCode code; - ConnectionException(framing::connection::CloseCode _code, const std::string& message) - : Exception(message), code(_code) {} -}; - -struct ClosedException : public Exception { - QPID_COMMON_EXTERN ClosedException(const std::string& msg=std::string()); - QPID_COMMON_EXTERN std::string getPrefix() const; -}; - -/** - * Exception representing transport failure - */ -struct TransportFailure : public Exception { - TransportFailure(const std::string& msg=std::string()) : Exception(msg) {} -}; - -} // namespace qpid - -#endif /*!_Exception_*/ diff --git a/cpp/src/qpid/InlineAllocator.h b/cpp/src/qpid/InlineAllocator.h deleted file mode 100644 index 152c02a299..0000000000 --- a/cpp/src/qpid/InlineAllocator.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef QPID_INLINEALLOCATOR_H -#define QPID_INLINEALLOCATOR_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <memory> -#include <assert.h> -#include <boost/type_traits/type_with_alignment.hpp> -#include <boost/type_traits/alignment_of.hpp> - -namespace qpid { - -template <typename RequestedType, typename InlineType, typename BaseAllocator, size_t Max> -struct InlineRebind; - - -/** - * An allocator that has inline storage for up to Max objects - * of type BaseAllocator::value_type. - */ -template <class BaseAllocator, size_t Max> -class InlineAllocator : public BaseAllocator { - public: - typedef typename BaseAllocator::pointer pointer; - typedef typename BaseAllocator::size_type size_type; - typedef typename BaseAllocator::value_type value_type; - - InlineAllocator() : allocated(false) {} - InlineAllocator(const InlineAllocator& x) : BaseAllocator(x), allocated(false) {} - - pointer allocate(size_type n) { - if (n <= Max && !allocated) { - allocated=true; - return reinterpret_cast<value_type*>(address()); - } - else - return BaseAllocator::allocate(n, 0); - } - - void deallocate(pointer p, size_type n) { - if (p == address()) { - assert(allocated); - allocated=false; - } - else - BaseAllocator::deallocate(p, n); - } - - template<typename T1> - struct rebind { - typedef typename InlineRebind<T1, value_type, BaseAllocator, Max>::other other; - }; - - private: - // POD object with alignment and size to hold Max value_types. - static const size_t ALIGNMENT=boost::alignment_of<value_type>::value; - typedef typename boost::type_with_alignment<ALIGNMENT>::type Aligner; - union Store { - Aligner aligner_; - char sizer_[sizeof(value_type)*Max]; - } store; - value_type* address() { return reinterpret_cast<value_type*>(&store); } - bool allocated; -}; - - -// Rebind: if RequestedType == InlineType, use the InlineAllocator, -// otherwise, use the BaseAllocator without any inlining. - -template <typename RequestedType, typename InlineType, typename BaseAllocator, size_t Max> -struct InlineRebind { - typedef typename BaseAllocator::template rebind<RequestedType>::other other; -}; - -template <typename T, typename BaseAllocator, size_t Max> -struct InlineRebind<T, T, BaseAllocator, Max> { - typedef typename qpid::InlineAllocator<BaseAllocator, Max> other; -}; - -} // namespace qpid - -#endif /*!QPID_INLINEALLOCATOR_H*/ diff --git a/cpp/src/qpid/InlineVector.h b/cpp/src/qpid/InlineVector.h deleted file mode 100644 index c23841decd..0000000000 --- a/cpp/src/qpid/InlineVector.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef QPID_INLINEVECTOR_H -#define QPID_INLINEVECTOR_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/InlineAllocator.h" -#include <vector> - -namespace qpid { - -/** - * A vector that stores up to Max elements in inline storage, - * otherwise uses normal vector allocation. - * - * NOTE: depends on some non-standard but highly probably assumptions - * about how std::vector uses its allocator, they are true for g++. - * - default constructor does not allocate. - * - reserve(N) does not allocate more than N elements. - * - vector never re-allocates when size() < capacity() - */ -template <class T, size_t Max, class Alloc=std::allocator<T> > -class InlineVector : public std::vector<T, InlineAllocator<Alloc, Max> > -{ - typedef std::vector<T, InlineAllocator<Alloc, Max> > Base; - public: - typedef typename Base::allocator_type allocator_type; - typedef typename Base::value_type value_type; - typedef typename Base::size_type size_type; - - explicit InlineVector(const allocator_type& a=allocator_type()) : Base(a) { - this->reserve(Max); - } - - explicit InlineVector(size_type n, const value_type& x = value_type(), - const allocator_type& a=allocator_type()) : Base(a) - { - this->reserve(std::max(n, Max)); - this->insert(this->end(), n, x); - } - - InlineVector(const InlineVector& x) : Base() { - this->reserve(std::max(x.size(), Max)); - *this = x; - } -}; - -} // namespace qpid - -#endif /*!QPID_INLINEVECTOR_H*/ diff --git a/cpp/src/qpid/Msg.h b/cpp/src/qpid/Msg.h deleted file mode 100644 index 7214db611f..0000000000 --- a/cpp/src/qpid/Msg.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef QPID_MSG_H -#define QPID_MSG_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <sstream> -#include <iostream> - -namespace qpid { - -/** A simple wrapper for std::ostringstream that allows - * in place construction of a message and automatic conversion - * to string. - * E.g. - *@code - * void foo(const std::string&); - * foo(Msg() << "hello " << 32); - *@endcode - * Will construct the string "hello 32" and pass it to foo() - */ -struct Msg { - std::ostringstream os; - Msg() {} - Msg(const Msg& m) : os(m.str()) {} - std::string str() const { return os.str(); } - operator std::string() const { return str(); } -}; - -template <class T> const Msg& operator<<(const Msg& m, const T& t) { - const_cast<std::ostringstream&>(m.os)<<t; return m; -} - -inline std::ostream& operator<<(std::ostream& o, const Msg& m) { - return o<<m.str(); -} - -/** Construct a message using operator << and append (file:line) */ -#define QPID_MSG(message) ::qpid::Msg() << message << " (" << __FILE__ << ":" << __LINE__ << ")" - -} // namespace qpid - -#endif /*!QPID_MSG_H*/ diff --git a/cpp/src/qpid/Options.h b/cpp/src/qpid/Options.h deleted file mode 100644 index aeb7a79329..0000000000 --- a/cpp/src/qpid/Options.h +++ /dev/null @@ -1,265 +0,0 @@ -#ifndef QPID_COMMONOPTIONS_H -#define QPID_COMMONOPTIONS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/Exception.h" - -// Disable warnings triggered by boost. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable : 4251 4275) -#endif - -#include <boost/program_options.hpp> -#include <boost/format.hpp> - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#include <sstream> -#include <iterator> -#include <algorithm> -#include <string> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace po=boost::program_options; - - - -///@internal -QPID_COMMON_EXTERN std::string prettyArg(const std::string&, const std::string&); - -/** @internal Normally only constructed by optValue() */ -template <class T> -class OptionValue : public po::typed_value<T> { - public: - OptionValue(T& value, const std::string& arg) - : po::typed_value<T>(&value), argName(arg) {} - std::string name() const { return argName; } - - private: - std::string argName; -}; - - -/** Create an option value. - * name, value appear after the option name in help like this: - * <name> (=<value>) - * T must support operator <<. - *@see Options for example of use. - */ -template<class T> -po::value_semantic* optValue(T& value, const char* name) { - std::string valstr(boost::lexical_cast<std::string>(value)); - return new OptionValue<T>(value, prettyArg(name, valstr)); -} - -/** Create a vector value. Multiple occurences of the option are - * accumulated into the vector - */ -template <class T> -po::value_semantic* optValue(std::vector<T>& value, const char* name) { - using namespace std; - ostringstream os; - copy(value.begin(), value.end(), ostream_iterator<T>(os, " ")); - string val=os.str(); - if (!val.empty()) - val.erase(val.end()-1); // Remove trailing " " - return (new OptionValue<vector<T> >(value, prettyArg(name, val))); -} - -/** Create a boolean switch value. Presence of the option sets the value. */ -inline po::value_semantic* optValue(bool& value) { return po::bool_switch(&value); } - -/** - * Base class for options. - * Example of use: - @code - struct MySubOptions : public Options { - int x; - string y; - MySubOptions() : Options("Sub options") { - addOptions() - ("x", optValue(x,"XUNIT"), "Option X") - ("y", optValue(y, "YUNIT"), "Option Y"); - } - }; - - struct MyOptions : public Options { - bool z; - vector<string> foo; - MySubOptions subOptions; - MyOptions() : Options("My Options") { - addOptions() - ("z", boolSwitch(z), "Option Z") - ("foo", optValue(foo), "Multiple option foo"); - add(subOptions); - } - - main(int argc, char** argv) { - Options opts; - opts.parse(argc, char** argv); - // Use values - dosomething(opts.subOptions.x); - if (error) - cout << opts << end; // Help message. - } - - @endcode - */ - - - - -/* - * --------------------------------------------- - * Explanation for Boost 103200 conditional code - * --------------------------------------------- - * - * This boost version has an implementation of the program_options library - * that has no provision for allowing unregistered options to pass by. - * - * But that means that, if you have a program that loads optional modules - * after start-up, and those modules each have their own set of options, - * then if you parse the command line too soon, you will get spurious - * reports of unrecognized options -- and the program will exit! - * - * And we must process the command-line before module-loading, because we - * need to look at the "bootstrap" options. - * - * This conditional code: - * - * 1. implements it's own functor class, derived from the Boost - * "options_description_easy_init" class. This functor is used - * to process added options and do the functor chaining, so that - * I can snoop on the arguments before doing an explicit call - * to its parent. - * - * 2. It implements two static vectors, one to hold long names, and - * one for short names, so that options declared by modules are - * not forgotten when their options_description goes out of scope. - * - * I will be thrilled to personally delete this code if we ever decide - * that qpid doesn't really need to support this antique version of Boost. - * - */ - -#if ( BOOST_VERSION == 103200 ) -struct Options; - - -struct -options_description_less_easy_init - : public po::options_description_easy_init -{ - options_description_less_easy_init ( Options * my_owner, - po::options_description * my_parents_owner - ) - : po::options_description_easy_init(my_parents_owner) - { - owner = my_owner; - } - - - options_description_less_easy_init& - operator()(char const * name, - char const * description); - - - options_description_less_easy_init& - operator()(char const * name, - const po::value_semantic* s); - - - options_description_less_easy_init& - operator()(const char* name, - const po::value_semantic* s, - const char* description); - - - Options * owner; -}; -#endif - - -struct Options : public po::options_description { - - struct Exception : public qpid::Exception { - Exception(const std::string& msg) : qpid::Exception(msg) {} - }; - - QPID_COMMON_EXTERN Options(const std::string& name=std::string()); - - /** - * Parses options from argc/argv, environment variables and config file. - * Note the filename argument can reference an options variable that - * is updated by argc/argv or environment variable parsing. - */ - QPID_COMMON_EXTERN void parse(int argc, char const* const* argv, - const std::string& configfile=std::string(), - bool allowUnknown = false); - - - #if ( BOOST_VERSION == 103200 ) - options_description_less_easy_init m_less_easy; - - options_description_less_easy_init addOptions() { - return m_less_easy; - } - - bool - is_registered_option ( std::string s ); - - void - register_names ( std::string s ); - - static std::vector<std::string> long_names; - static std::vector<std::string> short_names; - #else - boost::program_options::options_description_easy_init addOptions() { - return add_options(); - } - #endif -}; - - - -/** - * Standard options for configuration - */ -struct CommonOptions : public Options { - QPID_COMMON_EXTERN CommonOptions(const std::string& name=std::string(), - const std::string& configfile=std::string()); - bool help; - bool version; - std::string config; -}; - - - - -} // namespace qpid - -#endif /*!QPID_COMMONOPTIONS_H*/ diff --git a/cpp/src/qpid/RangeSet.h b/cpp/src/qpid/RangeSet.h deleted file mode 100644 index 1ba4fbbcef..0000000000 --- a/cpp/src/qpid/RangeSet.h +++ /dev/null @@ -1,330 +0,0 @@ -#ifndef QPID_RANGESET_H -#define QPID_RANGESET_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/InlineVector.h" -#include <boost/iterator/iterator_facade.hpp> -#include <boost/operators.hpp> -#include <boost/bind.hpp> -#include <algorithm> -#include <numeric> - -namespace qpid { - -/** A range of values, used in RangeSet. - * Range(begin, end) includes begin but excludes end. - * Range::makeClosed(first,last) includes both first and last. - */ -template <class T> -class Range { - public: - static Range makeClosed(const T& first, T last) { return Range(first, ++last); } - - Range() : begin_(), end_() {} - explicit Range(const T& t) : begin_(t), end_(t) { ++end_; } - Range(const T& b, const T& e) : begin_(b), end_(e) { assert(b <= e); } - - T begin() const { return begin_; } - /** End of _open_ range, i.e. !contains(end()) */ - T end() const { return end_; } - - T first() const { assert(!empty()); return begin_; } - /** Last in closed range, i.e. contains(end()) */ - T last() const { assert(!empty()); T ret=end_; return --ret; } - - void begin(const T& t) { begin_ = t; } - void end(const T& t) { end_ = t; } - size_t size() const { return end_ - begin_; } - bool empty() const { return begin_ == end_; } - - bool contains(const T& x) const { return begin_ <= x && x < end_; } - bool contains(const Range& r) const { return begin_ <= r.begin_ && r.end_ <= end_; } - bool strictContains(const Range& r) const { return begin_ < r.begin_ && r.end_ < end_; } - - bool operator==(const Range& x) { return begin_ == x.begin_ && end_== x.end_; } - - bool operator<(const T& t) const { return end_ < t; } - bool operator<(const Range<T>& r) const { return end_ < r.begin_; } - - /** touching ranges can be merged into a single range. */ - bool touching(const Range& r) const { - return std::max(begin_, r.begin_) <= std::min(end_, r.end_); - } - - /** @pre touching */ - void merge(const Range& r) { - assert(touching(r)); - begin_ = std::min(begin_, r.begin_); - end_ = std::max(end_, r.end_); - } - - operator bool() const { return !empty(); } - - template <class S> void serialize(S& s) { s(begin_)(end_); } - - private: - T begin_, end_; -}; - - -/** - * A set implemented as a list of [begin, end) ranges. - * T must be LessThanComparable and Incrementable. - * RangeSet only provides const iterators. - */ -template <class T> -class RangeSet - : boost::additive1<RangeSet<T>, - boost::additive2<RangeSet<T>, Range<T>, - boost::additive2<RangeSet<T>, T> > > -{ - typedef InlineVector<Range<T>, 3> Ranges; // TODO aconway 2008-04-21: what's the optimial inlined value? - - public: - - class iterator : public boost::iterator_facade< - iterator, - const T, - boost::forward_traversal_tag> - { - public: - iterator() : ranges(), iter(), value() {} - - private: - typedef typename Ranges::const_iterator RangesIter; - iterator(const Ranges& r, const RangesIter& i, const T& t) - : ranges(&r), iter(i), value(t) {} - - void increment(); - bool equal(const iterator& i) const; - const T& dereference() const { return value; } - - const Ranges* ranges; - RangesIter iter; - T value; - - friend class RangeSet<T>; - friend class boost::iterator_core_access; - }; - - typedef iterator const_iterator; - - RangeSet() {} - explicit RangeSet(const Range<T>& r) { *this += r; } - RangeSet(const T& a, const T& b) { *this += Range<T>(a,b); } - - bool contiguous() const { return ranges.size() <= 1; } - - bool contains(const T& t) const; - bool contains(const Range<T>&) const; - - /**@pre contiguous() */ - Range<T> toRange() const; - - bool operator==(const RangeSet<T>&) const; - - void addRange (const Range<T>&); - void addSet (const RangeSet<T>&); - - RangeSet<T>& operator+=(const T& t) { return *this += Range<T>(t); } - RangeSet<T>& operator+=(const Range<T>& r) { addRange(r); return *this; } - RangeSet<T>& operator+=(const RangeSet<T>& s) { addSet(s); return *this; } - - void removeRange (const Range<T>&); - void removeSet (const RangeSet<T>&); - - RangeSet<T>& operator-=(const T& t) { return *this -= Range<T>(t); } - RangeSet<T>& operator-=(const Range<T>& r) { removeRange(r); return *this; } - RangeSet<T>& operator-=(const RangeSet<T>& s) { removeSet(s); return *this; } - - T front() const { return ranges.front().begin(); } - T back() const { return ranges.back().end(); } - - // Iterate over elements in the set. - iterator begin() const; - iterator end() const; - - // Iterate over ranges in the set. - typedef typename Ranges::const_iterator RangeIterator; - RangeIterator rangesBegin() const { return ranges.begin(); } - RangeIterator rangesEnd() const { return ranges.end(); } - size_t rangesSize() const { return ranges.size(); } - - // The difference between the start and end of this range set - uint32_t span() const; - - size_t size() const; - bool empty() const { return ranges.empty(); } - void clear() { ranges.clear(); } - - /** Return the largest contiguous range containing x. - * Returns the empty range [x,x) if x is not in the set. - */ - Range<T> rangeContaining(const T&) const; - - template <class S> void serialize(S& s) { s.split(*this); s(ranges.begin(), ranges.end()); } - template <class S> void encode(S& s) const { s(uint16_t(ranges.size()*sizeof(Range<T>))); } - template <class S> void decode(S& s) { uint16_t sz; s(sz); ranges.resize(sz/sizeof(Range<T>)); } - - private: - static size_t accumulateSize(size_t s, const Range<T>& r) { return s+r.size(); } - Ranges ranges; - - template <class U> friend std::ostream& operator<<(std::ostream& o, const RangeSet<U>& r); - - friend class iterator; -}; - -template <class T> -std::ostream& operator<<(std::ostream& o, const Range<T>& r) { - return o << "[" << r.begin() << "," << r.end() << ")"; -} - -template <class T> -std::ostream& operator<<(std::ostream& o, const RangeSet<T>& rs) { - std::ostream_iterator<Range<T> > i(o, " "); - o << "{ "; - std::copy(rs.ranges.begin(), rs.ranges.end(), i); - return o << "}"; -} - -template <class T> -bool RangeSet<T>::contains(const T& t) const { - typename Ranges::const_iterator i = - std::lower_bound(ranges.begin(), ranges.end(), Range<T>(t)); - return i != ranges.end() && i->contains(t); -} - -template <class T> -bool RangeSet<T>::contains(const Range<T>& r) const { - typename Ranges::const_iterator i = - std::lower_bound(ranges.begin(), ranges.end(), r); - return i != ranges.end() && i->contains(r); -} - -template <class T> void RangeSet<T>::addRange(const Range<T>& r) { - if (r.empty()) return; - typename Ranges::iterator i = - std::lower_bound(ranges.begin(), ranges.end(), r); - if (i == ranges.end() || !i->touching(r)) - ranges.insert(i, r); - else { - i->merge(r); - typename Ranges::iterator j = i; - if (++j != ranges.end() && i->touching(*j)) { - i->merge(*j); - ranges.erase(j); - } - } -} - - -template <class T> void RangeSet<T>::addSet(const RangeSet<T>& s) { - typedef RangeSet<T>& (RangeSet<T>::*RangeSetRangeOp)(const Range<T>&); - std::for_each(s.ranges.begin(), s.ranges.end(), - boost::bind((RangeSetRangeOp)&RangeSet<T>::operator+=, this, _1)); -} - -template <class T> void RangeSet<T>::removeRange(const Range<T>& r) { - if (r.empty()) return; - typename Ranges::iterator i,j; - i = std::lower_bound(ranges.begin(), ranges.end(), r); - if (i == ranges.end() || i->begin() >= r.end()) - return; // Outside of set - if (*i == r) // Erase i - ranges.erase(i); - else if (i->strictContains(r)) { // Split i - Range<T> i1(i->begin(), r.begin()); - Range<T> i2(r.end(), i->end()); - *i = i2; - ranges.insert(i, i1); - } else { - if (i->begin() < r.begin()) { // Truncate i - i->end(r.begin()); - ++i; - } - for (j = i; j != ranges.end() && r.contains(*j); ++j) - ; // Ranges to erase. - if (j != ranges.end() && j->end() > r.end()) - j->begin(r.end()); // Truncate j - ranges.erase(i,j); - } -} - -template <class T> void RangeSet<T>::removeSet(const RangeSet<T>& r) { - std::for_each( - r.ranges.begin(), r.ranges.end(), - boost::bind(&RangeSet<T>::removeRange, this, _1)); -} - -template <class T> Range<T> RangeSet<T>::toRange() const { - assert(contiguous()); - return empty() ? Range<T>() : ranges.front(); -} - -template <class T> void RangeSet<T>::iterator::increment() { - assert(ranges && iter != ranges->end()); - if (!iter->contains(++value)) { - ++iter; - if (iter == ranges->end()) - *this=iterator(); // end() iterator - else - value=iter->begin(); - } -} - -template <class T> bool RangeSet<T>::operator==(const RangeSet<T>& r) const { - return ranges.size() == r.ranges.size() && std::equal(ranges.begin(), ranges.end(), r.ranges.begin()); -} - -template <class T> typename RangeSet<T>::iterator RangeSet<T>::begin() const { - return empty() ? end() : iterator(ranges, ranges.begin(), front()); -} - -template <class T> typename RangeSet<T>::iterator RangeSet<T>::end() const { - return iterator(); -} - -template <class T> bool RangeSet<T>::iterator::equal(const iterator& i) const { - return ranges==i.ranges && (ranges==0 || value==i.value); -} - -template <class T> Range<T> RangeSet<T>::rangeContaining(const T& t) const { - typename Ranges::const_iterator i = - std::lower_bound(ranges.begin(), ranges.end(), Range<T>(t)); - return (i != ranges.end() && i->contains(t)) ? *i : Range<T>(t,t); -} - -template <class T> uint32_t RangeSet<T>::span() const { - if (ranges.empty()) return 0; - return ranges.back().last() - ranges.front().first(); -} - -template <class T> size_t RangeSet<T>::size() const { - return std::accumulate(rangesBegin(), rangesEnd(), 0, &RangeSet<T>::accumulateSize); -} - -} // namespace qpid - - -#endif /*!QPID_RANGESET_H*/ diff --git a/cpp/src/qpid/SessionId.h b/cpp/src/qpid/SessionId.h deleted file mode 100644 index bf52f9856b..0000000000 --- a/cpp/src/qpid/SessionId.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef QPID_SESSIONID_H -#define QPID_SESSIONID_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <boost/operators.hpp> -#include <string> -#include <qpid/CommonImportExport.h> - -namespace qpid { - -/** Identifier for a session. - * There are two parts to a session identifier: - * - * getUserId() returns the authentication principal associated with - * the session's connection. - * - * getName() returns the session name. - * - * The name must be unique among sessions with the same authentication - * principal. - */ -class SessionId : boost::totally_ordered1<SessionId> { - std::string userId; - std::string name; - public: - QPID_COMMON_EXTERN SessionId(const std::string& userId=std::string(), const std::string& name=std::string()); - std::string getUserId() const { return userId; } - std::string getName() const { return name; } - QPID_COMMON_EXTERN bool operator<(const SessionId&) const ; - QPID_COMMON_EXTERN bool operator==(const SessionId& id) const; - // Convert to a string - QPID_COMMON_EXTERN std::string str() const; -}; - -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SessionId&); - - -} // namespace qpid - -#endif /*!QPID_SESSIONID_H*/ diff --git a/cpp/src/qpid/Url.h b/cpp/src/qpid/Url.h deleted file mode 100644 index 353eac28f3..0000000000 --- a/cpp/src/qpid/Url.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef QPID_URL_H -#define QPID_URL_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/Address.h" -#include "qpid/Exception.h" -#include <string> -#include <vector> -#include <new> -#include <ostream> -#include "qpid/CommonImportExport.h" - -namespace qpid { - -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const TcpAddress& a); - -/** An AMQP URL contains a list of addresses */ -struct Url : public std::vector<Address> { - - /** Url with the hostname as returned by gethostname(2) */ - static Url getHostNameUrl(uint16_t port); - - /** Url with local IP address(es), may be more than one address - * on a multi-homed host. */ - QPID_COMMON_EXTERN static Url getIpAddressesUrl(uint16_t port); - - struct Invalid : public Exception { Invalid(const std::string& s); }; - - /** Convert to string form. */ - QPID_COMMON_EXTERN std::string str() const; - - /** Empty URL. */ - Url() {} - - /** URL containing a single address */ - explicit Url(const Address& addr) { push_back(addr); } - - /** Parse url, throw Invalid if invalid. */ - explicit Url(const std::string& url) { parse(url.c_str()); } - - /** Parse url, throw Invalid if invalid. */ - explicit Url(const char* url) { parse(url); } - - Url& operator=(const Url& u) { this->std::vector<Address>::operator=(u); cache=u.cache; return *this; } - Url& operator=(const char* s) { parse(s); return *this; } - Url& operator=(const std::string& s) { parse(s); return *this; } - - /** Throw Invalid if the URL does not contain any addresses. */ - QPID_COMMON_EXTERN void throwIfEmpty() const; - - /** Replace contents with parsed URL as defined in - * https://wiki.108.redhat.com/jira/browse/AMQP-95 - *@exception Invalid if the url is invalid. - */ - QPID_COMMON_EXTERN void parse(const char* url); - QPID_COMMON_EXTERN void parse(const std::string& url) { parse(url.c_str()); } - - /** Replace contesnts with parsed URL as defined in - * https://wiki.108.redhat.com/jira/browse/AMQP-95 - * url.empty() will be true if url is invalid. - */ - void parseNoThrow(const char* url); - - private: - mutable std::string cache; // cache string form for efficiency. -}; - -inline bool operator==(const Url& a, const Url& b) { return a.str()==b.str(); } -inline bool operator!=(const Url& a, const Url& b) { return a.str()!=b.str(); } - -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const Url& url); -QPID_COMMON_EXTERN std::istream& operator>>(std::istream& is, Url& url); - -} // namespace qpid - -#endif /*!QPID_URL_H*/ diff --git a/cpp/src/qpid/agent/ManagementAgent.h b/cpp/src/qpid/agent/ManagementAgent.h deleted file mode 100644 index 4dc4f0e895..0000000000 --- a/cpp/src/qpid/agent/ManagementAgent.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef _qpid_agent_ManagementAgent_ -#define _qpid_agent_ManagementAgent_ - -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 "qpid/agent/QmfAgentImportExport.h" -#include "qpid/management/ManagementObject.h" -#include "qpid/management/ManagementEvent.h" -#include "qpid/management/Manageable.h" -#include "qpid/sys/Mutex.h" -#include "qpid/client/ConnectionSettings.h" - -namespace qpid { -namespace management { - -class ManagementAgent -{ - public: - - class Singleton { - public: - QMF_AGENT_EXTERN Singleton(bool disableManagement = false); - QMF_AGENT_EXTERN ~Singleton(); - QMF_AGENT_EXTERN static ManagementAgent* getInstance(); - private: - static sys::Mutex lock; - static bool disabled; - static int refCount; - static ManagementAgent* agent; - }; - - typedef enum { - SEV_EMERG = 0, - SEV_ALERT = 1, - SEV_CRIT = 2, - SEV_ERROR = 3, - SEV_WARN = 4, - SEV_NOTE = 5, - SEV_INFO = 6, - SEV_DEBUG = 7, - SEV_DEFAULT = 8 - } severity_t; - - ManagementAgent() {} - virtual ~ManagementAgent() {} - - virtual int getMaxThreads() = 0; - - // Connect to a management broker - // - // brokerHost - Hostname or IP address (dotted-quad) of broker. - // - // brokerPort - TCP port of broker. - // - // intervalSeconds - The interval (in seconds) that this agent shall use - // between broadcast updates to the broker. - // - // useExternalThread - If true, the thread of control used for callbacks - // must be supplied by the user of the object (via the - // pollCallbacks method). - // - // If false, callbacks shall be invoked on the management - // agent's thread. In this case, the callback implementations - // MUST be thread safe. - // - // storeFile - File where this process has read and write access. This - // file shall be used to store persistent state. - // - virtual void init(const std::string& brokerHost = "localhost", - uint16_t brokerPort = 5672, - uint16_t intervalSeconds = 10, - bool useExternalThread = false, - const std::string& storeFile = "", - const std::string& uid = "guest", - const std::string& pwd = "guest", - const std::string& mech = "PLAIN", - const std::string& proto = "tcp") = 0; - - virtual void init(const client::ConnectionSettings& settings, - uint16_t intervalSeconds = 10, - bool useExternalThread = false, - const std::string& storeFile = "") = 0; - - // Register a schema with the management agent. This is normally called by the - // package initializer generated by the management code generator. - // - virtual void - registerClass(const std::string& packageName, - const std::string& className, - uint8_t* md5Sum, - management::ManagementObject::writeSchemaCall_t schemaCall) = 0; - - virtual void - registerEvent(const std::string& packageName, - const std::string& eventName, - uint8_t* md5Sum, - management::ManagementEvent::writeSchemaCall_t schemaCall) = 0; - - // Add a management object to the agent. Once added, this object shall be visible - // in the greater management context. - // - // Please note that ManagementObject instances are not explicitly deleted from - // the management agent. When the core object represented by a management object - // is deleted, the "resourceDestroy" method on the management object must be called. - // It will then be reclaimed in due course by the management agent. - // - // Once a ManagementObject instance is added to the agent, the agent then owns the - // instance. The caller MUST NOT free the resources of the instance at any time. - // When it is no longer needed, invoke its "resourceDestroy" method and discard the - // pointer. This allows the management agent to report the deletion of the object - // in an orderly way. - // - virtual ObjectId addObject(ManagementObject* objectPtr, uint64_t persistId = 0) = 0; - - // - // - virtual void raiseEvent(const ManagementEvent& event, - severity_t severity = SEV_DEFAULT) = 0; - - // If "useExternalThread" was set to true in init, this method must - // be called to provide a thread for any pending method calls that have arrived. - // The method calls for ManagementObject instances shall be invoked synchronously - // during the execution of this method. - // - // callLimit may optionally be used to limit the number of callbacks invoked. - // if 0, no limit is imposed. - // - // The return value is the number of callbacks that remain queued after this - // call is complete. It can be used to determine whether or not further calls - // to pollCallbacks are necessary to clear the backlog. If callLimit is zero, - // the return value will also be zero. - // - virtual uint32_t pollCallbacks(uint32_t callLimit = 0) = 0; - - // If "useExternalThread" was set to true in the constructor, this method provides - // a standard file descriptor that can be used in a select statement to signal that - // there are method callbacks ready (i.e. that "pollCallbacks" will result in at - // least one method call). When this fd is ready-for-read, pollCallbacks may be - // invoked. Calling pollCallbacks shall reset the ready-to-read state of the fd. - // - virtual int getSignalFd() = 0; -}; - -}} - -#endif /*!_qpid_agent_ManagementAgent_*/ diff --git a/cpp/src/qpid/agent/QmfAgentImportExport.h b/cpp/src/qpid/agent/QmfAgentImportExport.h deleted file mode 100644 index 9eee4a18fd..0000000000 --- a/cpp/src/qpid/agent/QmfAgentImportExport.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef QMF_AGENT_IMPORT_EXPORT_H -#define QMF_AGENT_IMPORT_EXPORT_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) -#if defined(QMF_AGENT_EXPORT) || defined (qmfagent_EXPORTS) -#define QMF_AGENT_EXTERN __declspec(dllexport) -#else -#define QMF_AGENT_EXTERN __declspec(dllimport) -#endif -#else -#define QMF_AGENT_EXTERN -#endif - -#endif diff --git a/cpp/src/qpid/client/AsyncSession.h b/cpp/src/qpid/client/AsyncSession.h deleted file mode 100644 index 150aabe191..0000000000 --- a/cpp/src/qpid/client/AsyncSession.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef QPID_CLIENT_ASYNCSESSION_H -#define QPID_CLIENT_ASYNCSESSION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/AsyncSession_0_10.h" - -namespace qpid { -namespace client { - -/** - * AsyncSession is an alias for Session_0_10 - * - * \ingroup clientapi - */ -typedef AsyncSession_0_10 AsyncSession; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_ASYNCSESSION_H*/ diff --git a/cpp/src/qpid/client/ClientImportExport.h b/cpp/src/qpid/client/ClientImportExport.h deleted file mode 100644 index 3b311655ab..0000000000 --- a/cpp/src/qpid/client/ClientImportExport.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef QPID_CLIENT_IMPORT_EXPORT_H -#define QPID_CLIENT_IMPORT_EXPORT_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) -#if defined(CLIENT_EXPORT) || defined (qpidclient_EXPORTS) -#define QPID_CLIENT_EXTERN __declspec(dllexport) -#else -#define QPID_CLIENT_EXTERN __declspec(dllimport) -#endif -#else -#define QPID_CLIENT_EXTERN -#endif - -#endif diff --git a/cpp/src/qpid/client/Completion.h b/cpp/src/qpid/client/Completion.h deleted file mode 100644 index 73b22119fd..0000000000 --- a/cpp/src/qpid/client/Completion.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef QPID_CLIENT_COMPLETION_H -#define QPID_CLIENT_COMPLETION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/Handle.h" -#include "qpid/client/ClientImportExport.h" -#include <string> - -namespace qpid { -namespace client { - -class CompletionImpl; -template <class T> class PrivateImplRef; - -/** - * Asynchronous commands that do not return a result will return a - * Completion. You can use the completion to wait for that specific - * command to complete. - * - *@see TypedResult - * - *\ingroup clientapi - */ -class Completion : public Handle<CompletionImpl> -{ -public: - QPID_CLIENT_EXTERN Completion(CompletionImpl* = 0); - QPID_CLIENT_EXTERN Completion(const Completion&); - QPID_CLIENT_EXTERN ~Completion(); - QPID_CLIENT_EXTERN Completion& operator=(const Completion&); - - /** Wait for the asynchronous command that returned this - *Completion to complete. - * - *@exception If the command returns an error. - */ - QPID_CLIENT_EXTERN void wait(); - QPID_CLIENT_EXTERN bool isComplete(); - - protected: - QPID_CLIENT_EXTERN std::string getResult(); - - private: - typedef CompletionImpl Impl; - friend class PrivateImplRef<Completion>; -}; - -}} - - -#endif /*!QPID_CLIENT_COMPLETION_H*/ diff --git a/cpp/src/qpid/client/Connection.h b/cpp/src/qpid/client/Connection.h deleted file mode 100644 index 1671462c58..0000000000 --- a/cpp/src/qpid/client/Connection.h +++ /dev/null @@ -1,204 +0,0 @@ -#ifndef QPID_CLIENT_CONNECTION_H -#define QPID_CLIENT_CONNECTION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <map> -#include <string> -#include "qpid/client/Session.h" -#include "qpid/client/ClientImportExport.h" -#include "qpid/client/ConnectionSettings.h" -#include "qpid/framing/ProtocolVersion.h" - -namespace qpid { - -struct Url; - -namespace client { - -class ConnectionImpl; - -/** - * Represents a connection to an AMQP broker. All communication is - * initiated by establishing a connection, then creating one or more - * Session objects using the connection. @see newSession() - * - * \ingroup clientapi - * - */ -class Connection -{ - framing::ProtocolVersion version; - - boost::function<void ()> failureCallback; - - - protected: - boost::shared_ptr<ConnectionImpl> impl; - - - public: - /** - * Creates a connection object, but does not open the connection. - * @see open() - */ - QPID_CLIENT_EXTERN Connection(); - - QPID_CLIENT_EXTERN ~Connection(); - - /** - * Opens a connection to a broker. - * - * @param host the host on which the broker is running. - * - * @param port the port on the which the broker is listening. - * - * @param uid the userid to connect with. - * - * @param pwd the password to connect with (currently SASL - * PLAIN is the only authentication method supported so this - * is sent in clear text). - * - * @param virtualhost the AMQP virtual host to use (virtual - * hosts, where implemented(!), provide namespace partitioning - * within a single broker). - */ - QPID_CLIENT_EXTERN void open(const std::string& host, int port = 5672, - const std::string& uid = "guest", - const std::string& pwd = "guest", - const std::string& virtualhost = "/", uint16_t maxFrameSize=65535); - - /** - * Opens a connection to a broker using a URL. - * If the URL contains multiple addresses, try each in turn - * till connection is successful. - * - * @url address of the broker to connect to. - * - * @param uid the userid to connect with. - * - * @param pwd the password to connect with (currently SASL - * PLAIN is the only authentication method supported so this - * is sent in clear text). - * - * @param virtualhost the AMQP virtual host to use (virtual - * hosts, where implemented(!), provide namespace partitioning - * within a single broker). - */ - QPID_CLIENT_EXTERN void open(const Url& url, - const std::string& uid = "guest", - const std::string& pwd = "guest", - const std::string& virtualhost = "/", uint16_t maxFrameSize=65535); - - /** - * Opens a connection to a broker using a URL. - * If the URL contains multiple addresses, try each in turn - * till connection is successful. - * - * @url address of the broker to connect to. - * - * @param settings used for any settings not provided by the URL. - * Settings provided by the url (e.g. host, port) are ignored. - */ - QPID_CLIENT_EXTERN void open(const Url& url, const ConnectionSettings& settings); - - /** - * Opens a connection to a broker. - * - * @param the settings to use (host, port etc). @see ConnectionSettings. - */ - QPID_CLIENT_EXTERN void open(const ConnectionSettings& settings); - - /** - * Close the connection. - * - * Any further use of this connection (without reopening it) will - * not succeed. - */ - QPID_CLIENT_EXTERN void close(); - - /** - * Create a new session on this connection. Sessions allow - * multiple streams of work to be multiplexed over the same - * connection. The returned Session provides functions to send - * commands to the broker. - * - * Session functions are synchronous. In other words, a Session - * function will send a command to the broker and does not return - * until it receives the broker's response confirming the command - * was executed. - * - * AsyncSession provides asynchronous versions of the same - * functions. These functions send a command to the broker but do - * not wait for a response. - * - * You can convert a Session s into an AsyncSession as follows: - * @code - * #include <qpid/client/AsyncSession.h> - * AsyncSession as = async(s); - * @endcode - * - * You can execute a single command asynchronously will a Session s - * like ths: - * @code - * async(s).messageTransfer(...); - * @endcode - * - * Using an AsyncSession is faster for sending large numbers of - * commands, since each command is sent as soon as possible - * without waiting for the previous command to be confirmed. - * - * However with AsyncSession you cannot assume that a command has - * completed until you explicitly synchronize. The simplest way to - * do this is to call Session::sync() or AsyncSession::sync(). - * Both of these functions wait for the broker to confirm all - * commands issued so far on the session. - * - *@param name: A name to identify the session. @see qpid::SessionId - * If the name is empty (the default) then a unique name will be - * chosen using a Universally-unique identifier (UUID) algorithm. - */ - QPID_CLIENT_EXTERN Session newSession(const std::string& name=std::string(), uint32_t timeoutSeconds = 0); - - /** - * Resume a suspended session. A session may be resumed - * on a different connection to the one that created it. - */ - QPID_CLIENT_EXTERN void resume(Session& session); - - QPID_CLIENT_EXTERN bool isOpen() const; - - QPID_CLIENT_EXTERN std::vector<Url> getKnownBrokers(); - QPID_CLIENT_EXTERN void registerFailureCallback ( boost::function<void ()> fn ); - - /** - * Return the set of client negotiated settings - */ - QPID_CLIENT_EXTERN const ConnectionSettings& getNegotiatedSettings(); - - friend class ConnectionAccess; ///<@internal - friend class SessionBase_0_10; ///<@internal -}; - -}} // namespace qpid::client - - -#endif /*!QPID_CLIENT_CONNECTION_H*/ diff --git a/cpp/src/qpid/client/ConnectionSettings.h b/cpp/src/qpid/client/ConnectionSettings.h deleted file mode 100644 index 71fef219b4..0000000000 --- a/cpp/src/qpid/client/ConnectionSettings.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef QPID_CLIENT_CONNECTIONSETTINGS_H -#define QPID_CLIENT_CONNECTIONSETTINGS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/Options.h" -#include "qpid/log/Options.h" -#include "qpid/Url.h" -#include "qpid/client/ClientImportExport.h" - -#include <iostream> -#include <exception> - -namespace qpid { - -namespace sys { -class Socket; -} - -namespace client { - -/** - * Settings for a Connection. - */ -struct ConnectionSettings { - - QPID_CLIENT_EXTERN ConnectionSettings(); - QPID_CLIENT_EXTERN virtual ~ConnectionSettings(); - - /** - * Allows socket to be configured; default only sets tcp-nodelay - * based on the flag set. Can be overridden. - */ - QPID_CLIENT_EXTERN virtual void configureSocket(qpid::sys::Socket&) const; - - /** - * The protocol used for the connection (defaults to 'tcp') - */ - std::string protocol; - - /** - * The host (or ip address) to connect to (defaults to 'localhost'). - */ - std::string host; - /** - * The port to connect to (defaults to 5672). - */ - uint16_t port; - /** - * Allows an AMQP 'virtual host' to be specified for the - * connection. - */ - std::string virtualhost; - - /** - * The username to use when authenticating the connection. If not - * specified the current users login is used if available. - */ - std::string username; - /** - * The password to use when authenticating the connection. - */ - std::string password; - /** - * The SASL mechanism to use when authenticating the connection; - * the options are currently PLAIN or ANONYMOUS. - */ - std::string mechanism; - /** - * Allows a locale to be specified for the connection. - */ - std::string locale; - /** - * Allows a heartbeat frequency to be specified - */ - uint16_t heartbeat; - /** - * The maximum number of channels that the client will request for - * use on this connection. - */ - uint16_t maxChannels; - /** - * The maximum frame size that the client will request for this - * connection. - */ - uint16_t maxFrameSize; - /** - * Limit the size of the connections send buffer . The buffer - * is limited to bounds * maxFrameSize. - */ - uint bounds; - /** - * If true, TCP_NODELAY will be set for the connection. - */ - bool tcpNoDelay; - /** - * SASL service name - */ - std::string service; - /** - * Minimum acceptable strength of any SASL negotiated security - * layer. 0 means no security layer required. - */ - uint minSsf; - /** - * Maximum acceptable strength of any SASL negotiated security - * layer. 0 means no security layer allowed. - */ - uint maxSsf; -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_CONNECTIONSETTINGS_H*/ diff --git a/cpp/src/qpid/client/FailoverManager.h b/cpp/src/qpid/client/FailoverManager.h deleted file mode 100644 index 581989c46a..0000000000 --- a/cpp/src/qpid/client/FailoverManager.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef QPID_CLIENT_FAILOVERMANAGER_H -#define QPID_CLIENT_FAILOVERMANAGER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/Connection.h" -#include "qpid/client/ConnectionSettings.h" -#include "qpid/Exception.h" -#include "qpid/client/AsyncSession.h" -#include "qpid/sys/Monitor.h" -#include "qpid/client/ClientImportExport.h" -#include <vector> - -namespace qpid { -namespace client { - -struct CannotConnectException : qpid::Exception -{ - CannotConnectException(const std::string& m) : qpid::Exception(m) {} -}; - -/** - * Utility to manage failover. - */ -class FailoverManager -{ - public: - /** - * Interface to implement for doing work that can be resumed on - * failover - */ - struct Command - { - /** - * This method will be called with isRetry=false when the - * command is first executed. The session to use for the work - * will be passed to the implementing class. If the connection - * fails while the execute call is in progress, the - * FailoverManager controlling the execution will re-establish - * a connection, open a new session and call back to the - * Command implementations execute method with the new session - * and isRetry=true. - */ - virtual void execute(AsyncSession& session, bool isRetry) = 0; - virtual ~Command() {} - }; - - struct ReconnectionStrategy - { - /** - * This method is called by the FailoverManager prior to - * establishing a connection (or re-connection) and can be - * used if the application wishes to edit or re-order the list - * which will default to the list of known brokers for the - * last connection. - */ - virtual void editUrlList(std::vector<Url>& urls) = 0; - virtual ~ReconnectionStrategy() {} - }; - - /** - * Create a manager to control failover for a logical connection. - * - * @param settings the initial connection settings - * @param strategy optional stratgey callback allowing application - * to edit or reorder the list of urls to which reconnection is - * attempted - */ - QPID_CLIENT_EXTERN FailoverManager(const ConnectionSettings& settings, ReconnectionStrategy* strategy = 0); - /** - * Return the current connection if open or attept to reconnect to - * the specified list of urls. If no list is specified the list of - * known brokers from the last connection will be used. If no list - * is specified and this is the first connect attempt, the host - * and port from the initial settings will be used. - * - * If the full list is tried and all attempts fail, - * CannotConnectException is thrown. - */ - QPID_CLIENT_EXTERN Connection& connect(std::vector<Url> brokers = std::vector<Url>()); - /** - * Return the current connection whether open or not - */ - QPID_CLIENT_EXTERN Connection& getConnection(); - /** - * Close the current connection - */ - QPID_CLIENT_EXTERN void close(); - /** - * Reliably execute the specified command. This involves creating - * a session on which to carry out the work of the command, - * handling failover occuring while exeuting that command and - * re-starting the work. - * - * Multiple concurrent threads can call execute with different - * commands; each thread will be allocated its own - * session. FailoverManager will coordinate the different threads - * on failover to ensure they continue to use the same logical - * connection. - */ - QPID_CLIENT_EXTERN void execute(Command&); - private: - enum State {IDLE, CONNECTING, CANT_CONNECT}; - - qpid::sys::Monitor lock; - Connection connection; - ConnectionSettings settings; - ReconnectionStrategy* strategy; - State state; - - void attempt(Connection&, ConnectionSettings settings, std::vector<Url> urls); - void attempt(Connection&, ConnectionSettings settings); -}; -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_FAILOVERMANAGER_H*/ diff --git a/cpp/src/qpid/client/FlowControl.h b/cpp/src/qpid/client/FlowControl.h deleted file mode 100644 index d2205aaa78..0000000000 --- a/cpp/src/qpid/client/FlowControl.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef QPID_CLIENT_FLOWCONTROL_H -#define QPID_CLIENT_FLOWCONTROL_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <qpid/sys/IntegerTypes.h> - -namespace qpid { -namespace client { - -/** - * Flow control works by associating a finite amount of "credit" - * with a subscription. - * - * Credit includes a message count and a byte count. Each message - * received decreases the message count by one, and the byte count by - * the size of the message. Either count can have the special value - * UNLIMITED which is never decreased. - * - * A subscription's credit is exhausted when the message count is 0 or - * the byte count is too small for the next available message. The - * subscription will not receive any further messages until is credit - * is renewed. - * - * In "window mode" credit is automatically renewed when a message is - * completed (which by default happens when it is accepted). In - * non-window mode credit is not automatically renewed, it must be - * explicitly re-set (@see Subscription) - */ -struct FlowControl { - static const uint32_t UNLIMITED=0xFFFFFFFF; - FlowControl(uint32_t messages_=0, uint32_t bytes_=0, bool window_=false) - : messages(messages_), bytes(bytes_), window(window_) {} - - static FlowControl messageCredit(uint32_t messages_) { return FlowControl(messages_,UNLIMITED,false); } - static FlowControl messageWindow(uint32_t messages_) { return FlowControl(messages_,UNLIMITED,true); } - static FlowControl byteCredit(uint32_t bytes_) { return FlowControl(UNLIMITED,bytes_,false); } - static FlowControl byteWindow(uint32_t bytes_) { return FlowControl(UNLIMITED,bytes_,true); } - static FlowControl unlimited() { return FlowControl(UNLIMITED, UNLIMITED, false); } - static FlowControl zero() { return FlowControl(0, 0, false); } - - /** Message credit: subscription can accept up to this many messages. */ - uint32_t messages; - /** Byte credit: subscription can accept up to this many bytes of message content. */ - uint32_t bytes; - /** Window mode. If true credit is automatically renewed as messages are acknowledged. */ - bool window; - - bool operator==(const FlowControl& x) { - return messages == x.messages && bytes == x.bytes && window == x.window; - }; -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_FLOWCONTROL_H*/ diff --git a/cpp/src/qpid/client/Future.h b/cpp/src/qpid/client/Future.h deleted file mode 100644 index 29d9044894..0000000000 --- a/cpp/src/qpid/client/Future.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _Future_ -#define _Future_ - -#include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include "qpid/Exception.h" -#include "qpid/framing/SequenceNumber.h" -#include "qpid/client/FutureCompletion.h" -#include "qpid/client/FutureResult.h" -#include "qpid/client/ClientImportExport.h" - -namespace qpid { -namespace client { - -/**@internal */ -class Future -{ - framing::SequenceNumber command; - boost::shared_ptr<FutureResult> result; - bool complete; - -public: - Future() : complete(false) {} - Future(const framing::SequenceNumber& id) : command(id), complete(false) {} - - std::string getResult(SessionImpl& session) { - if (result) return result->getResult(session); - else throw Exception("Result not expected"); - } - - QPID_CLIENT_EXTERN void wait(SessionImpl& session); - QPID_CLIENT_EXTERN bool isComplete(SessionImpl& session); - QPID_CLIENT_EXTERN void setFutureResult(boost::shared_ptr<FutureResult> r); -}; - -}} - -#endif diff --git a/cpp/src/qpid/client/FutureCompletion.h b/cpp/src/qpid/client/FutureCompletion.h deleted file mode 100644 index 4248ddeab8..0000000000 --- a/cpp/src/qpid/client/FutureCompletion.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _FutureCompletion_ -#define _FutureCompletion_ - -#include "qpid/framing/amqp_framing.h" -#include "qpid/sys/Monitor.h" - -namespace qpid { -namespace client { - -///@internal -class FutureCompletion -{ -protected: - mutable sys::Monitor lock; - bool complete; - -public: - FutureCompletion(); - virtual ~FutureCompletion(){} - bool isComplete() const; - void waitForCompletion() const; - void completed(); -}; - -}} - - -#endif diff --git a/cpp/src/qpid/client/FutureResult.h b/cpp/src/qpid/client/FutureResult.h deleted file mode 100644 index 1466378711..0000000000 --- a/cpp/src/qpid/client/FutureResult.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _FutureResult_ -#define _FutureResult_ - -#include <string> - -#include "qpid/client/ClientImportExport.h" -#include "qpid/framing/amqp_framing.h" -#include "qpid/client/FutureCompletion.h" - -namespace qpid { -namespace client { - -class SessionImpl; - -///@internal -class FutureResult : public FutureCompletion -{ - std::string result; -public: - QPID_CLIENT_EXTERN const std::string& getResult(SessionImpl& session) const; - void received(const std::string& result); -}; - -}} - - - -#endif diff --git a/cpp/src/qpid/client/Handle.h b/cpp/src/qpid/client/Handle.h deleted file mode 100644 index 41ead78eb7..0000000000 --- a/cpp/src/qpid/client/Handle.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef QPID_CLIENT_HANDLE_H -#define QPID_CLIENT_HANDLE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/ClientImportExport.h" - -namespace qpid { -namespace client { - -template <class> class PrivateImplRef; - -/** - * A handle is like a pointer: refers to an underlying implementation object. - * Copying the handle does not copy the object. - * - * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the - * conversion to bool to test for a null handle. - */ -template <class T> class Handle { - public: - - /**@return true if handle is valid, i.e. not null. */ - QPID_CLIENT_EXTERN bool isValid() const { return impl; } - - /**@return true if handle is null. It is an error to call any function on a null handle. */ - QPID_CLIENT_EXTERN bool isNull() const { return !impl; } - - /** Conversion to bool supports idiom if (handle) { handle->... } */ - QPID_CLIENT_EXTERN operator bool() const { return impl; } - - /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ - QPID_CLIENT_EXTERN bool operator !() const { return !impl; } - - void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; } - - protected: - typedef T Impl; - QPID_CLIENT_EXTERN Handle() :impl() {} - - // Not implemented,subclasses must implement. - QPID_CLIENT_EXTERN Handle(const Handle&); - QPID_CLIENT_EXTERN Handle& operator=(const Handle&); - - Impl* impl; - - friend class PrivateImplRef<T>; // FIXME aconway 2009-04-30: Specify -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_HANDLE_H*/ diff --git a/cpp/src/qpid/client/LocalQueue.h b/cpp/src/qpid/client/LocalQueue.h deleted file mode 100644 index a584f74f05..0000000000 --- a/cpp/src/qpid/client/LocalQueue.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef QPID_CLIENT_LOCALQUEUE_H -#define QPID_CLIENT_LOCALQUEUE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/ClientImportExport.h" -#include "qpid/client/Handle.h" -#include "qpid/client/Message.h" -#include "qpid/sys/Time.h" - -namespace qpid { -namespace client { - -class LocalQueueImpl; -template <class T> class PrivateImplRef; - -/** - * A local queue to collect messages retrieved from a remote broker - * queue. Create a queue and subscribe it using the SubscriptionManager. - * Messages from the remote queue on the broker will be stored in the - * local queue until you retrieve them. - * - * \ingroup clientapi - * - * \details Using a Local Queue - * - * <pre> - * LocalQueue local_queue; - * subscriptions.subscribe(local_queue, string("message_queue")); - * for (int i=0; i<10; i++) { - * Message message = local_queue.get(); - * std::cout << message.getData() << std::endl; - * } - * </pre> - * - * <h2>Getting Messages</h2> - * - * <ul><li> - * <p>get()</p> - * <pre>Message message = local_queue.get();</pre> - * <pre>// Specifying timeouts (TIME_SEC, TIME_MSEC, TIME_USEC, TIME_NSEC) - *#include <qpid/sys/Time.h> - *Message message; - *local_queue.get(message, 5*sys::TIME_SEC);</pre></li></ul> - * - * <h2>Checking size</h2> - * <ul><li> - * <p>empty()</p> - * <pre>if (local_queue.empty()) { ... }</pre></li> - * <li><p>size()</p> - * <pre>std::cout << local_queue.size();</pre></li> - * </ul> - */ - -class LocalQueue : public Handle<LocalQueueImpl> { - public: - /** Create a local queue. Subscribe the local queue to a remote broker - * queue with a SubscriptionManager. - * - * LocalQueue is an alternative to implementing a MessageListener. - */ - QPID_CLIENT_EXTERN LocalQueue(); - QPID_CLIENT_EXTERN LocalQueue(const LocalQueue&); - QPID_CLIENT_EXTERN ~LocalQueue(); - QPID_CLIENT_EXTERN LocalQueue& operator=(const LocalQueue&); - - /** Wait up to timeout for the next message from the local queue. - *@param result Set to the message from the queue. - *@param timeout wait up this timeout for a message to appear. - *@return true if result was set, false if queue was empty after timeout. - */ - QPID_CLIENT_EXTERN bool get(Message& result, sys::Duration timeout=0); - - /** Get the next message off the local queue, or wait up to the timeout - * for message from the broker queue. - *@param timeout wait up this timeout for a message to appear. - *@return message from the queue. - *@throw ClosedException if subscription is closed or timeout exceeded. - */ - QPID_CLIENT_EXTERN Message get(sys::Duration timeout=sys::TIME_INFINITE); - - /** Synonym for get() */ - QPID_CLIENT_EXTERN Message pop(sys::Duration timeout=sys::TIME_INFINITE); - - /** Return true if local queue is empty. */ - QPID_CLIENT_EXTERN bool empty() const; - - /** Number of messages on the local queue */ - QPID_CLIENT_EXTERN size_t size() const; - - LocalQueue(LocalQueueImpl*); ///<@internal - - - private: - typedef LocalQueueImpl Impl; - friend class PrivateImplRef<LocalQueue>; -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_LOCALQUEUE_H*/ diff --git a/cpp/src/qpid/client/Message.h b/cpp/src/qpid/client/Message.h deleted file mode 100644 index 3a6f1814cd..0000000000 --- a/cpp/src/qpid/client/Message.h +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef QPID_CLIENT_MESSAGE_H -#define QPID_CLIENT_MESSAGE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/ClientImportExport.h" -#include "qpid/framing/MessageProperties.h" -#include "qpid/framing/DeliveryProperties.h" -#include <string> - -namespace qpid { - -namespace framing { -class FieldTable; -class SequenceNumber; // FIXME aconway 2009-04-17: remove with getID? -} - -namespace client { - -class MessageImpl; - -/** - * A message sent to or received from the broker. - * - * \ingroup clientapi - * \details - * - * <h2>Getting and setting message contents</h2> - * - * <ul> - * <li> - * <p>getData()</p> - * <pre>std::cout << "Response: " << message.getData() << std::endl;</pre> - * </li> - * <li> - * <p>setData()</p> - * <pre>message.setData("That's all, folks!");</pre></li> - * <li> - * <p>appendData()</p> - * <pre>message.appendData(" ... let's add a bit more ...");</pre></li> - * </ul> - * - * <h2>Getting and Setting Delivery Properties</h2> - * - * <ul> - * <li> - * <p>getDeliveryProperties()</p> - * <pre>message.getDeliveryProperties().setRoutingKey("control");</pre> - * <pre>message.getDeliveryProperties().setDeliveryMode(PERSISTENT);</pre> - * <pre>message.getDeliveryProperties().setPriority(9);</pre> - * <pre>message.getDeliveryProperties().setTtl(100);</pre></li> - * - * <li> - * <p>hasDeliveryProperties()</p> - * <pre>if (! message.hasDeliveryProperties()) { - * ... - *}</pre></li> - * </ul> - * - * <h2>Getting and Setting Message Properties</h2> - * - * <ul> - * <li> - * <p>getMessageProperties()</p> - * <pre> - *request.getMessageProperties().setReplyTo(ReplyTo("amq.direct", response_queue.str())); - * </pre> - * <pre> - *routingKey = request.getMessageProperties().getReplyTo().getRoutingKey(); - *exchange = request.getMessageProperties().getReplyTo().getExchange(); - * </pre> - * <pre>message.getMessageProperties().setContentType("text/plain");</pre> - * <pre>message.getMessageProperties().setContentEncoding("text/plain");</pre> - * </li> - * <li> - * <p>hasMessageProperties()</p> - * <pre>request.getMessageProperties().hasReplyTo();</pre> - * </li> - * </ul> - * - * <h2>Getting and Setting Application Headers</h2> - * - * <ul> - * <li> - * <p>getHeaders()</p> - * <pre> - *message.getHeaders().getString("control"); - * </pre> - * <pre> - *message.getHeaders().setString("control","continue"); - * </pre></li> - * </ul> - * - * - */ -class Message -{ -public: - /** Create a Message. - *@param data Data for the message body. - *@param routingKey Passed to the exchange that routes the message. - */ - QPID_CLIENT_EXTERN Message( - const std::string& data=std::string(), - const std::string& routingKey=std::string()); - Message(MessageImpl*); ///< @internal - QPID_CLIENT_EXTERN Message(const Message&); - QPID_CLIENT_EXTERN ~Message(); - QPID_CLIENT_EXTERN Message& operator=(const Message&); - QPID_CLIENT_EXTERN void swap(Message&); - - QPID_CLIENT_EXTERN void setData(const std::string&); - QPID_CLIENT_EXTERN const std::string& getData() const; - QPID_CLIENT_EXTERN std::string& getData(); - - QPID_CLIENT_EXTERN void appendData(const std::string&); - - QPID_CLIENT_EXTERN bool hasMessageProperties() const; - QPID_CLIENT_EXTERN framing::MessageProperties& getMessageProperties(); - QPID_CLIENT_EXTERN const framing::MessageProperties& getMessageProperties() const; - - QPID_CLIENT_EXTERN bool hasDeliveryProperties() const; - QPID_CLIENT_EXTERN framing::DeliveryProperties& getDeliveryProperties(); - QPID_CLIENT_EXTERN const framing::DeliveryProperties& getDeliveryProperties() const; - - - /** The destination of messages sent to the broker is the exchange - * name. The destination of messages received from the broker is - * the delivery tag identifyig the local subscription (often this - * is the name of the subscribed queue.) - */ - QPID_CLIENT_EXTERN std::string getDestination() const; - - /** Check the redelivered flag. */ - QPID_CLIENT_EXTERN bool isRedelivered() const; - /** Set the redelivered flag. */ - QPID_CLIENT_EXTERN void setRedelivered(bool redelivered); - - /** Get a modifyable reference to the message headers. */ - QPID_CLIENT_EXTERN framing::FieldTable& getHeaders(); - - /** Get a non-modifyable reference to the message headers. */ - QPID_CLIENT_EXTERN const framing::FieldTable& getHeaders() const; - - // FIXME aconway 2009-04-17: does this need to be in public API? - ///@internal - QPID_CLIENT_EXTERN const framing::SequenceNumber& getId() const; - - private: - MessageImpl* impl; - friend class MessageImpl; // Helper template for implementation -}; - -}} - -#endif /*!QPID_CLIENT_MESSAGE_H*/ diff --git a/cpp/src/qpid/client/MessageListener.h b/cpp/src/qpid/client/MessageListener.h deleted file mode 100644 index c8e34eebb8..0000000000 --- a/cpp/src/qpid/client/MessageListener.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <string> -#include "qpid/client/ClientImportExport.h" - -#ifndef _MessageListener_ -#define _MessageListener_ - -#include "qpid/client/Message.h" - -namespace qpid { -namespace client { - - /** - * Implement a subclass of MessageListener and subscribe it using - * the SubscriptionManager to receive messages. - * - * Another way to receive messages is by using a LocalQueue. - * - * \ingroup clientapi - * \details - * - * <h2>Using a MessageListener</h2> - * - * <ul> - * <li> - * <p>The received() function is called when a message arrives:</p> - * <pre>virtual void received(Message& message)=0;</pre> - * </li> - * <li> - * <p>Derive your own listener, implement the received() function:</p> - * <pre> - * class Listener : public MessageListener { - * private: - * SubscriptionManager& subscriptions; - * public: - * Listener(SubscriptionManager& subscriptions); - * virtual void received(Message& message); - * }; - * - * Listener::Listener(SubscriptionManager& subs) : subscriptions(subs) - * {} - * - * void Listener::received(Message& message) { - * std::cout << "Message: " << message.getData() << std::endl; - * if (message.getData() == "That's all, folks!") { - * std::cout << "Shutting down listener for " << message.getDestination() - * << std::endl; - * subscriptions.cancel(message.getDestination()); - * } - * } - *</pre> - * <pre> - * SubscriptionManager subscriptions(session); - * - * // Create a listener and subscribe it to the queue named "message_queue" - * Listener listener(subscriptions); - * subscriptions.subscribe(listener, "message_queue"); - * - * // Receive messages until the subscription is cancelled - * // by Listener::received() - * subscriptions.run(); - * </pre> - * </li> - * </ul> - * - */ - - class MessageListener{ - public: - QPID_CLIENT_EXTERN virtual ~MessageListener(); - - /** Called for each message arriving from the broker. Override - * in your own subclass to process messages. - */ - virtual void received(Message& msg) = 0; - }; - -} -} - - -#endif diff --git a/cpp/src/qpid/client/MessageReplayTracker.h b/cpp/src/qpid/client/MessageReplayTracker.h deleted file mode 100644 index 657ea07193..0000000000 --- a/cpp/src/qpid/client/MessageReplayTracker.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef QPID_CLIENT_MESSAGEREPLAYTRACKER_H -#define QPID_CLIENT_MESSAGEREPLAYTRACKER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/AsyncSession.h" -#include "qpid/client/Message.h" -#include "qpid/client/ClientImportExport.h" -#include <list> -#include <string> - -namespace qpid { -namespace client { - -/** - * Utility to track messages sent asynchronously, allowing those that - * are indoubt to be replayed over a new session. - */ -class MessageReplayTracker -{ - public: - QPID_CLIENT_EXTERN MessageReplayTracker(uint flushInterval); - QPID_CLIENT_EXTERN void send(const Message& message, const std::string& destination = ""); - QPID_CLIENT_EXTERN void init(AsyncSession session); - QPID_CLIENT_EXTERN void replay(AsyncSession session); - QPID_CLIENT_EXTERN void setFlushInterval(uint interval); - QPID_CLIENT_EXTERN uint getFlushInterval(); - QPID_CLIENT_EXTERN void checkCompletion(); - - template <class F> void foreach(F& f) { - for (std::list<ReplayRecord>::const_iterator i = buffer.begin(); i != buffer.end(); i++) { - f(i->message); - } - } - - private: - struct ReplayRecord - { - Completion status; - Message message; - std::string destination; - - ReplayRecord(const Message& message, const std::string& destination); - void send(MessageReplayTracker&); - bool isComplete(); - }; - - AsyncSession session; - uint flushInterval; - uint count; - std::list<ReplayRecord> buffer; -}; -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_MESSAGEREPLAYTRACKER_H*/ diff --git a/cpp/src/qpid/client/QueueOptions.h b/cpp/src/qpid/client/QueueOptions.h deleted file mode 100644 index 702fc80656..0000000000 --- a/cpp/src/qpid/client/QueueOptions.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/ClientImportExport.h" -#include "qpid/framing/FieldTable.h" - -#ifndef _QueueOptions_ -#define _QueueOptions_ - -namespace qpid { -namespace client { - -enum QueueSizePolicy {NONE, REJECT, FLOW_TO_DISK, RING, RING_STRICT}; -enum QueueOrderingPolicy {FIFO, LVQ, LVQ_NO_BROWSE}; - -/** - * A help class to set options on the Queue. Create a configured args while - * still allowing any custom configuration via the FieldTable base class - */ -class QueueOptions: public framing::FieldTable -{ - public: - QPID_CLIENT_EXTERN QueueOptions(); - QPID_CLIENT_EXTERN virtual ~QueueOptions(); - - /** - * Sets the queue sizing policy - * - * @param sp SizePolicy - * REJECT - reject if queue greater than size/count - * FLOW_TO_DISK - page messages to disk from this point is greater than size/count - * RING - limit the queue to size/count and over-write old messages round a ring - * RING_STRICT - limit the queue to size/count and reject is head == tail - * NONE - Use default broker sizing policy - * @param maxSize Set the max number of bytes for the sizing policies - * @param setMaxCount Set the max number of messages for the sizing policies - */ - QPID_CLIENT_EXTERN void setSizePolicy(QueueSizePolicy sp, uint64_t maxSize, uint32_t maxCount ); - - /** - * Enables the persisting of a queue to the store module when a cluster fails down to it's last - * node. Does so optimistically. Will start persisting when cluster count >1 again. - */ - QPID_CLIENT_EXTERN void setPersistLastNode(); - - /** - * Sets the odering policy on the Queue, default ordering is FIFO. - */ - QPID_CLIENT_EXTERN void setOrdering(QueueOrderingPolicy op); - - /** - * Use broker defualt sizing ploicy - */ - QPID_CLIENT_EXTERN void clearSizePolicy(); - - /** - * Clear Persist Last Node Policy - */ - QPID_CLIENT_EXTERN void clearPersistLastNode(); - - /** - * get the key used match LVQ in args for message transfer - */ - QPID_CLIENT_EXTERN void getLVQKey(std::string& key); - - /** - * Use default odering policy - */ - QPID_CLIENT_EXTERN void clearOrdering(); - - /** - * Turns on event generation for this queue (either enqueue only - * or for enqueue and dequeue events); the events can then be - * processed by a regsitered broker plugin. - */ - QPID_CLIENT_EXTERN void enableQueueEvents(bool enqueueOnly); - - static QPID_CLIENT_EXTERN const std::string strMaxCountKey; - static QPID_CLIENT_EXTERN const std::string strMaxSizeKey; - static QPID_CLIENT_EXTERN const std::string strTypeKey; - static QPID_CLIENT_EXTERN const std::string strREJECT; - static QPID_CLIENT_EXTERN const std::string strFLOW_TO_DISK; - static QPID_CLIENT_EXTERN const std::string strRING; - static QPID_CLIENT_EXTERN const std::string strRING_STRICT; - static QPID_CLIENT_EXTERN const std::string strLastValueQueue; - static QPID_CLIENT_EXTERN const std::string strPersistLastNode; - static QPID_CLIENT_EXTERN const std::string strLVQMatchProperty; - static QPID_CLIENT_EXTERN const std::string strLastValueQueueNoBrowse; - static QPID_CLIENT_EXTERN const std::string strQueueEventMode; -}; - -} -} - - -#endif diff --git a/cpp/src/qpid/client/Session.h b/cpp/src/qpid/client/Session.h deleted file mode 100644 index bdabd26c82..0000000000 --- a/cpp/src/qpid/client/Session.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef QPID_CLIENT_SESSION_H -#define QPID_CLIENT_SESSION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/Session_0_10.h" - -namespace qpid { -namespace client { - -/** - * Session is an alias for Session_0_10 - * - * \ingroup clientapi - */ -typedef Session_0_10 Session; - - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_SESSION_H*/ diff --git a/cpp/src/qpid/client/SessionBase_0_10.h b/cpp/src/qpid/client/SessionBase_0_10.h deleted file mode 100644 index 8438977e45..0000000000 --- a/cpp/src/qpid/client/SessionBase_0_10.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef QPID_CLIENT_SESSIONBASE_H -#define QPID_CLIENT_SESSIONBASE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/SessionId.h" -#include "qpid/framing/amqp_structs.h" -#include "qpid/client/Message.h" -#include "qpid/client/Completion.h" -#include "qpid/client/TypedResult.h" -#include "qpid/client/ClientImportExport.h" -#include <string> - -namespace qpid { -namespace client { - -class Connection; -class SessionImpl; - -using std::string; -using framing::Content; -using framing::FieldTable; -using framing::SequenceNumber; -using framing::SequenceSet; -using framing::SequenceNumberSet; -using qpid::SessionId; -using framing::Xid; - -/** Unit of message credit: messages or bytes */ -enum CreditUnit { MESSAGE_CREDIT=0, BYTE_CREDIT=1, UNLIMITED_CREDIT=0xFFFFFFFF }; - -/** - * Base class for handles to an AMQP session. - * - * Subclasses provide the AMQP commands for a given - * version of the protocol. - */ -class SessionBase_0_10 { - public: - - ///@internal - QPID_CLIENT_EXTERN SessionBase_0_10(); - QPID_CLIENT_EXTERN ~SessionBase_0_10(); - - /** Get the session ID */ - QPID_CLIENT_EXTERN SessionId getId() const; - - /** Close the session. - * A session is automatically closed when all handles to it are destroyed. - */ - QPID_CLIENT_EXTERN void close(); - - /** - * Synchronize the session: sync() waits until all commands issued - * on this session so far have been completed by the broker. - * - * Note sync() is always synchronous, even on an AsyncSession object - * because that's almost always what you want. You can call - * AsyncSession::executionSync() directly in the unusual event - * that you want to do an asynchronous sync. - */ - QPID_CLIENT_EXTERN void sync(); - - /** Set the timeout for this session. */ - QPID_CLIENT_EXTERN uint32_t timeout(uint32_t seconds); - - /** Suspend the session - detach it from its connection */ - QPID_CLIENT_EXTERN void suspend(); - - /** Resume a suspended session with a new connection */ - QPID_CLIENT_EXTERN void resume(Connection); - - /** Get the channel associated with this session */ - QPID_CLIENT_EXTERN uint16_t getChannel() const; - - QPID_CLIENT_EXTERN void flush(); - QPID_CLIENT_EXTERN void markCompleted(const framing::SequenceSet& ids, bool notifyPeer); - QPID_CLIENT_EXTERN void markCompleted(const framing::SequenceNumber& id, bool cumulative, bool notifyPeer); - QPID_CLIENT_EXTERN void sendCompletion(); - - QPID_CLIENT_EXTERN bool isValid() const; - - protected: - boost::shared_ptr<SessionImpl> impl; - friend class SessionBase_0_10Access; -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_SESSIONBASE_H*/ diff --git a/cpp/src/qpid/client/Subscription.h b/cpp/src/qpid/client/Subscription.h deleted file mode 100644 index 83a9be5e14..0000000000 --- a/cpp/src/qpid/client/Subscription.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef QPID_CLIENT_SUBSCRIPTION_H -#define QPID_CLIENT_SUBSCRIPTION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/Handle.h" -#include "qpid/client/Session.h" -#include "qpid/client/SubscriptionSettings.h" -#include "qpid/client/Message.h" -#include "qpid/client/ClientImportExport.h" - -namespace qpid { -namespace client { - -template <class> class PrivateImplRef; -class SubscriptionImpl; -class SubscriptionManager; - -/** - * A handle to an active subscription. Provides methods to query the subscription status - * and control acknowledgement (acquire and accept) of messages. - */ -class Subscription : public Handle<SubscriptionImpl> { - public: - QPID_CLIENT_EXTERN Subscription(SubscriptionImpl* = 0); - QPID_CLIENT_EXTERN Subscription(const Subscription&); - QPID_CLIENT_EXTERN ~Subscription(); - QPID_CLIENT_EXTERN Subscription& operator=(const Subscription&); - - - /** The name of the subscription, used as the "destination" for messages from the broker. - * Usually the same as the queue name but can be set differently. - */ - QPID_CLIENT_EXTERN std::string getName() const; - - /** Name of the queue this subscription subscribes to */ - QPID_CLIENT_EXTERN std::string getQueue() const; - - /** Get the flow control and acknowledgement settings for this subscription */ - QPID_CLIENT_EXTERN const SubscriptionSettings& getSettings() const; - - /** Set the flow control parameters */ - QPID_CLIENT_EXTERN void setFlowControl(const FlowControl&); - - /** Automatically acknowledge (acquire and accept) batches of n messages. - * You can disable auto-acknowledgement by setting n=0, and use acquire() and accept() - * to manually acquire and accept messages. - */ - QPID_CLIENT_EXTERN void setAutoAck(unsigned int n); - - /** Get the set of ID's for messages received by this subscription but not yet acquired. - * This will always be empty if getSettings().acquireMode=ACQUIRE_MODE_PRE_ACQUIRED - */ - QPID_CLIENT_EXTERN SequenceSet getUnacquired() const; - - /** Get the set of ID's for messages received by this subscription but not yet accepted. */ - QPID_CLIENT_EXTERN SequenceSet getUnaccepted() const; - - /** Acquire messageIds and remove them from the unacquired set. - * oAdd them to the unaccepted set if getSettings().acceptMode == ACCEPT_MODE_EXPLICIT. - */ - QPID_CLIENT_EXTERN void acquire(const SequenceSet& messageIds); - - /** Accept messageIds and remove them from the unaccepted set. - *@pre messageIds is a subset of getUnaccepted() - */ - QPID_CLIENT_EXTERN void accept(const SequenceSet& messageIds); - - /** Release messageIds and remove them from the unaccepted set. - *@pre messageIds is a subset of getUnaccepted() - */ - QPID_CLIENT_EXTERN void release(const SequenceSet& messageIds); - - /* Acquire a single message */ - QPID_CLIENT_EXTERN void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } - - /* Accept a single message */ - QPID_CLIENT_EXTERN void accept(const Message& m) { accept(SequenceSet(m.getId())); } - - /* Release a single message */ - QPID_CLIENT_EXTERN void release(const Message& m) { release(SequenceSet(m.getId())); } - - /** Get the session associated with this subscription */ - QPID_CLIENT_EXTERN Session getSession() const; - - /** Get the subscription manager associated with this subscription */ - QPID_CLIENT_EXTERN SubscriptionManager getSubscriptionManager(); - - /** Cancel the subscription. */ - QPID_CLIENT_EXTERN void cancel(); - - /** Grant the specified amount of message credit */ - QPID_CLIENT_EXTERN void grantMessageCredit(uint32_t); - - /** Grant the specified amount of byte credit */ - QPID_CLIENT_EXTERN void grantByteCredit(uint32_t); - - private: - friend class PrivateImplRef<Subscription>; - friend class SubscriptionManager; -}; -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_SUBSCRIPTION_H*/ diff --git a/cpp/src/qpid/client/SubscriptionManager.h b/cpp/src/qpid/client/SubscriptionManager.h deleted file mode 100644 index 2df8a8d0ca..0000000000 --- a/cpp/src/qpid/client/SubscriptionManager.h +++ /dev/null @@ -1,286 +0,0 @@ -#ifndef QPID_CLIENT_SUBSCRIPTIONMANAGER_H -#define QPID_CLIENT_SUBSCRIPTIONMANAGER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/Session.h" -#include "qpid/client/Subscription.h" -#include "qpid/sys/Runnable.h" -#include "qpid/sys/Thread.h" -#include "qpid/client/ClientImportExport.h" -#include "qpid/client/MessageListener.h" -#include "qpid/client/LocalQueue.h" -#include "qpid/client/Handle.h" -#include <string> - -namespace qpid { -namespace client { - -class SubscriptionManagerImpl; - -/** - * A class to help create and manage subscriptions. - * - * Set up your subscriptions, then call run() to have messages - * delivered. - * - * \ingroup clientapi - * - * \details - * - * <h2>Subscribing and canceling subscriptions</h2> - * - * <ul> - * <li> - * <p>subscribe()</p> - * <pre> SubscriptionManager subscriptions(session); - * Listener listener(subscriptions); - * subscriptions.subscribe(listener, myQueue);</pre> - * <pre> SubscriptionManager subscriptions(session); - * LocalQueue local_queue; - * subscriptions.subscribe(local_queue, string("message_queue"));</pre></li> - * <li> - * <p>cancel()</p> - * <pre>subscriptions.cancel();</pre></li> - * </ul> - * - * <h2>Waiting for messages (and returning)</h2> - * - * <ul> - * <li> - * <p>run()</p> - * <pre> // Give up control to receive messages - * subscriptions.run();</pre></li> - * <li> - * <p>stop()</p> - * <pre>.// Use this code in a listener to return from run() - * subscriptions.stop();</pre></li> - * <li> - * <p>setAutoStop()</p> - * <pre>.// Return from subscriptions.run() when last subscription is cancelled - *.subscriptions.setAutoStop(true); - *.subscriptons.run(); - * </pre></li> - * <li> - * <p>Ending a subscription in a listener</p> - * <pre> - * void Listener::received(Message& message) { - * - * if (message.getData() == "That's all, folks!") { - * subscriptions.cancel(message.getDestination()); - * } - * } - * </pre> - * </li> - * </ul> - * - */ -class SubscriptionManager : public sys::Runnable, public Handle<SubscriptionManagerImpl> -{ - public: - /** Create a new SubscriptionManager associated with a session */ - QPID_CLIENT_EXTERN SubscriptionManager(const Session& session); - QPID_CLIENT_EXTERN SubscriptionManager(const SubscriptionManager&); - QPID_CLIENT_EXTERN ~SubscriptionManager(); - QPID_CLIENT_EXTERN SubscriptionManager& operator=(const SubscriptionManager&); - - /** - * Subscribe a MessagesListener to receive messages from queue. - * - * Provide your own subclass of MessagesListener to process - * incoming messages. It will be called for each message received. - * - *@param listener Listener object to receive messages. - *@param queue Name of the queue to subscribe to. - *@param settings settings for the subscription. - *@param name unique destination name for the subscription, defaults to queue name. - */ - QPID_CLIENT_EXTERN Subscription subscribe(MessageListener& listener, - const std::string& queue, - const SubscriptionSettings& settings, - const std::string& name=std::string()); - - /** - * Subscribe a LocalQueue to receive messages from queue. - * - * Incoming messages are stored in the queue for you to retrieve. - * - *@param queue Name of the queue to subscribe to. - *@param flow initial FlowControl for the subscription. - *@param name unique destination name for the subscription, defaults to queue name. - * If not specified, the queue name is used. - */ - QPID_CLIENT_EXTERN Subscription subscribe(LocalQueue& localQueue, - const std::string& queue, - const SubscriptionSettings& settings, - const std::string& name=std::string()); - - /** - * Subscribe a MessagesListener to receive messages from queue. - * - * Provide your own subclass of MessagesListener to process - * incoming messages. It will be called for each message received. - * - *@param listener Listener object to receive messages. - *@param queue Name of the queue to subscribe to. - *@param name unique destination name for the subscription, defaults to queue name. - * If not specified, the queue name is used. - */ - QPID_CLIENT_EXTERN Subscription subscribe(MessageListener& listener, - const std::string& queue, - const std::string& name=std::string()); - - /** - * Subscribe a LocalQueue to receive messages from queue. - * - * Incoming messages are stored in the queue for you to retrieve. - * - *@param queue Name of the queue to subscribe to. - *@param name unique destination name for the subscription, defaults to queue name. - * If not specified, the queue name is used. - */ - QPID_CLIENT_EXTERN Subscription subscribe(LocalQueue& localQueue, - const std::string& queue, - const std::string& name=std::string()); - - - /** Get a single message from a queue. - *@param result is set to the message from the queue. - *@param timeout wait up this timeout for a message to appear. - *@return true if result was set, false if no message available after timeout. - */ - QPID_CLIENT_EXTERN bool get(Message& result, const std::string& queue, sys::Duration timeout=0); - - /** Get a single message from a queue. - *@param timeout wait up this timeout for a message to appear. - *@return message from the queue. - *@throw Exception if the timeout is exceeded. - */ - QPID_CLIENT_EXTERN Message get(const std::string& queue, sys::Duration timeout=sys::TIME_INFINITE); - - /** Get a subscription by name. - *@throw Exception if not found. - */ - QPID_CLIENT_EXTERN Subscription getSubscription(const std::string& name) const; - - /** Cancel a subscription. See also: Subscription.cancel() */ - QPID_CLIENT_EXTERN void cancel(const std::string& name); - - /** Deliver messages in the current thread until stop() is called. - * Only one thread may be running in a SubscriptionManager at a time. - * @see run - */ - QPID_CLIENT_EXTERN void run(); - - /** Start a new thread to deliver messages. - * Only one thread may be running in a SubscriptionManager at a time. - * @see start - */ - QPID_CLIENT_EXTERN void start(); - - /** - * Wait for the thread started by a call to start() to complete. - */ - QPID_CLIENT_EXTERN void wait(); - - /** If set true, run() will stop when all subscriptions - * are cancelled. If false, run will only stop when stop() - * is called. True by default. - */ - QPID_CLIENT_EXTERN void setAutoStop(bool set=true); - - /** Stop delivery. Causes run() to return, or the thread started with start() to exit. */ - QPID_CLIENT_EXTERN void stop(); - - static const uint32_t UNLIMITED=0xFFFFFFFF; - - /** Set the flow control for a subscription. */ - QPID_CLIENT_EXTERN void setFlowControl(const std::string& name, const FlowControl& flow); - - /** Set the flow control for a subscription. - *@param name: name of the subscription. - *@param messages: message credit. - *@param bytes: byte credit. - *@param window: if true use window-based flow control. - */ - QPID_CLIENT_EXTERN void setFlowControl(const std::string& name, uint32_t messages, uint32_t bytes, bool window=true); - - /** Set the default settings for subscribe() calls that don't - * include a SubscriptionSettings parameter. - */ - QPID_CLIENT_EXTERN void setDefaultSettings(const SubscriptionSettings& s); - - /** Get the default settings for subscribe() calls that don't - * include a SubscriptionSettings parameter. - */ - QPID_CLIENT_EXTERN const SubscriptionSettings& getDefaultSettings() const; - - /** Get the default settings for subscribe() calls that don't - * include a SubscriptionSettings parameter. - */ - QPID_CLIENT_EXTERN SubscriptionSettings& getDefaultSettings(); - - /** - * Set the default flow control settings for subscribe() calls - * that don't include a SubscriptionSettings parameter. - * - *@param messages: message credit. - *@param bytes: byte credit. - *@param window: if true use window-based flow control. - */ - QPID_CLIENT_EXTERN void setFlowControl(uint32_t messages, uint32_t bytes, bool window=true); - - /** - *Set the default accept-mode for subscribe() calls that don't - *include a SubscriptionSettings parameter. - */ - QPID_CLIENT_EXTERN void setAcceptMode(AcceptMode mode); - - /** - * Set the default acquire-mode subscribe()s that don't specify SubscriptionSettings. - */ - QPID_CLIENT_EXTERN void setAcquireMode(AcquireMode mode); - - QPID_CLIENT_EXTERN void registerFailoverHandler ( boost::function<void ()> fh ); - - QPID_CLIENT_EXTERN Session getSession() const; - - SubscriptionManager(SubscriptionManagerImpl*); ///<@internal - - private: - typedef SubscriptionManagerImpl Impl; - friend class PrivateImplRef<SubscriptionManager>; -}; - -/** AutoCancel cancels a subscription in its destructor */ -class AutoCancel { - public: - AutoCancel(SubscriptionManager& sm_, const std::string& tag_) : sm(sm_), tag(tag_) {} - ~AutoCancel() { sm.cancel(tag); } - private: - SubscriptionManager& sm; - std::string tag; -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_SUBSCRIPTIONMANAGER_H*/ diff --git a/cpp/src/qpid/client/SubscriptionSettings.h b/cpp/src/qpid/client/SubscriptionSettings.h deleted file mode 100644 index ade539b376..0000000000 --- a/cpp/src/qpid/client/SubscriptionSettings.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef QPID_CLIENT_SUBSCRIPTIONSETTINGS_H -#define QPID_CLIENT_SUBSCRIPTIONSETTINGS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/client/FlowControl.h" -#include "qpid/framing/enum.h" - -namespace qpid { -namespace client { - -/** Bring AMQP enum definitions for message class into this namespace. */ -using namespace qpid::framing::message; - -enum CompletionMode { - MANUAL_COMPLETION = 0, - COMPLETE_ON_DELIVERY = 1, - COMPLETE_ON_ACCEPT = 2 -}; -/** - * Settings for a subscription. - */ -struct SubscriptionSettings -{ - SubscriptionSettings( - FlowControl flow=FlowControl::unlimited(), - AcceptMode accept=ACCEPT_MODE_EXPLICIT, - AcquireMode acquire=ACQUIRE_MODE_PRE_ACQUIRED, - unsigned int autoAck_=1, - CompletionMode completion=COMPLETE_ON_DELIVERY - ) : flowControl(flow), acceptMode(accept), acquireMode(acquire), autoAck(autoAck_), completionMode(completion), exclusive(false) {} - - FlowControl flowControl; ///@< Flow control settings. @see FlowControl - AcceptMode acceptMode; ///@< ACCEPT_MODE_EXPLICIT or ACCEPT_MODE_NONE - AcquireMode acquireMode; ///@< ACQUIRE_MODE_PRE_ACQUIRED or ACQUIRE_MODE_NOT_ACQUIRED - - /** Automatically acknowledge (accept) batches of autoAck - * messages. 0 means no automatic acknowledgement. This has no - * effect for messsages received for a subscription with - * ACCEPT_MODE_NODE.*/ - unsigned int autoAck; - /** - * In windowing mode, completion of a message will cause the - * credit used up by that message to be reallocated. The - * subscriptions completion mode controls how completion is - * managed. - * - * If set to COMPLETE_ON_DELIVERY (which is the default), messages - * will be marked as completed once they have been received. The - * server will be explicitly notified of all completed messages - * for the session when the next accept is sent through the - * subscription (either explictly or through autAck). However the - * server may also periodically request information on the - * completed messages. - * - * If set to COMPLETE_ON_ACCEPT, messages will be marked as - * completed once they are accepted (via the Subscription class) - * and the server will also be notified of all completed messages - * for the session. - * - * If set to MANUAL_COMPLETION the application is responsible for - * completing messages (@see Session::markCompleted()). - */ - CompletionMode completionMode; - /** - * If set, requests that no other subscriber be allowed to access - * the queue while this subscription is active. - */ - bool exclusive; -}; - -}} // namespace qpid::client - -#endif /*!QPID_CLIENT_SUBSCRIPTIONSETTINGS_H*/ diff --git a/cpp/src/qpid/client/TypedResult.h b/cpp/src/qpid/client/TypedResult.h deleted file mode 100644 index 0eac96c9c3..0000000000 --- a/cpp/src/qpid/client/TypedResult.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _TypedResult_ -#define _TypedResult_ - -#include "qpid/client/Completion.h" -#include "qpid/framing/StructHelper.h" - -namespace qpid { -namespace client { - -/** - * Returned by asynchronous commands that return a result. - * You can use get() to wait for completion and get the result value. - * \ingroup clientapi - */ -template <class T> class TypedResult : public Completion -{ - T result; - bool decoded; - -public: - ///@internal - TypedResult(const Completion& c) : Completion(c), decoded(false) {} - - /** - * Wait for the asynchronous command that returned this TypedResult to complete - * and return its result. - * - *@return The result returned by the command. - *@exception If the command returns an error, get() throws an exception. - * - */ - T& get() { - if (!decoded) { - framing::StructHelper helper; - helper.decode(result, getResult()); - decoded = true; - } - return result; - } -}; - -}} - -#endif diff --git a/cpp/src/qpid/console/Agent.h b/cpp/src/qpid/console/Agent.h deleted file mode 100644 index e9cd2abc22..0000000000 --- a/cpp/src/qpid/console/Agent.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_AGENT_H_ -#define _QPID_CONSOLE_AGENT_H_ - -#include "qpid/console/Broker.h" -#include "qpid/console/ConsoleImportExport.h" - -namespace qpid { -namespace console { - - /** - * - * \ingroup qmfconsoleapi - */ - class QPID_CONSOLE_EXTERN Agent { - public: - typedef std::vector<Agent*> Vector; - - Agent(Broker* _broker, uint32_t _bank, const std::string& _label) : - broker(_broker), brokerBank(broker->getBrokerBank()), - agentBank(_bank), label(_label) {} - Broker* getBroker() const { return broker; } - uint32_t getBrokerBank() const { return brokerBank; } - uint32_t getAgentBank() const { return agentBank; } - const std::string& getLabel() const { return label; } - - private: - Broker* broker; - const uint32_t brokerBank; - const uint32_t agentBank; - const std::string label; - }; - - QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Agent& agent); -} -} - - -#endif diff --git a/cpp/src/qpid/console/Broker.h b/cpp/src/qpid/console/Broker.h deleted file mode 100644 index 6aebdf0493..0000000000 --- a/cpp/src/qpid/console/Broker.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_BROKER_H_ -#define _QPID_CONSOLE_BROKER_H_ - -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/client/Connection.h" -#include "qpid/client/ConnectionSettings.h" -#include "qpid/client/SubscriptionManager.h" -#include "qpid/client/Session.h" -#include "qpid/client/AsyncSession.h" -#include "qpid/client/Message.h" -#include "qpid/client/MessageListener.h" -#include "qpid/sys/Thread.h" -#include "qpid/sys/Runnable.h" -#include "qpid/sys/Mutex.h" -#include "qpid/sys/Condition.h" -#include "qpid/Url.h" -#include "qpid/framing/Buffer.h" -#include "qpid/framing/Uuid.h" -#include <string> -#include <iostream> - -namespace qpid { -namespace console { - class SessionManager; - class Agent; - class Object; - - /** - * - * \ingroup qpidconsoleapi - */ - class Broker : public client::MessageListener { - public: - QPID_CONSOLE_EXTERN Broker(SessionManager& sm, - client::ConnectionSettings& settings); - QPID_CONSOLE_EXTERN ~Broker(); - - bool isConnected() const { return connected; } - const std::string& getError() const { return error; } - const std::string& getSessionId() const { return amqpSessionId; } - const framing::Uuid& getBrokerId() const { return brokerId; } - uint32_t getBrokerBank() const { return 1; } - void addBinding(const std::string& key) { - connThreadBody.bindExchange("qpid.management", key); - } - QPID_CONSOLE_EXTERN std::string getUrl() const; - - private: - friend class SessionManager; - friend class Object; - typedef std::map<uint64_t,Agent*> AgentMap; - static const int SYNC_TIME = 60; - - SessionManager& sessionManager; - AgentMap agents; - bool connected; - std::string error; - std::string amqpSessionId; - client::ConnectionSettings connectionSettings; - sys::Mutex lock; - sys::Condition cond; - framing::Uuid brokerId; - uint32_t reqsOutstanding; - bool syncInFlight; - bool topicBound; - Object* methodObject; - - friend class ConnectionThread; - class ConnectionThread : public sys::Runnable { - bool operational; - bool shuttingDown; - Broker& broker; - framing::Uuid sessionId; - client::Connection connection; - client::Session session; - client::SubscriptionManager* subscriptions; - std::stringstream queueName; - sys::Mutex connLock; - void run(); - public: - ConnectionThread(Broker& _broker) : - operational(false), shuttingDown(false), broker(_broker), subscriptions(0) {} - ~ConnectionThread(); - void sendBuffer(qpid::framing::Buffer& buf, - uint32_t length, - const std::string& exchange = "qpid.management", - const std::string& routingKey = "broker"); - void bindExchange(const std::string& exchange, const std::string& key); - void shutdown(); - }; - - ConnectionThread connThreadBody; - sys::Thread connThread; - - void encodeHeader(framing::Buffer& buf, uint8_t opcode, uint32_t seq = 0) const; - bool checkHeader(framing::Buffer& buf, uint8_t *opcode, uint32_t *seq) const; - void received(client::Message& msg); - void resetAgents(); - void updateAgent(const Object& object); - void waitForStable(); - void incOutstanding(); - void decOutstanding(); - void setBrokerId(const framing::Uuid& id) { brokerId = id; } - void appendAgents(std::vector<Agent*>& agents) const; - - friend QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Broker& k); - }; - - QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Broker& k); -} -} - -#endif diff --git a/cpp/src/qpid/console/ClassKey.h b/cpp/src/qpid/console/ClassKey.h deleted file mode 100644 index bfbcb6a059..0000000000 --- a/cpp/src/qpid/console/ClassKey.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_CLASSKEY_H_ -#define _QPID_CONSOLE_CLASSKEY_H_ - -#include <string> -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/console/Package.h" -#include "qpid/framing/Buffer.h" - -namespace qpid { -namespace console { - - /** - * - * \ingroup qmfconsoleapi - */ - class QPID_CONSOLE_EXTERN ClassKey { - public: - static const int HASH_SIZE = 16; - - ClassKey(const std::string& package, const std::string& name, const uint8_t* hash); - - const std::string& getPackageName() const { return package; } - const std::string& getClassName() const { return name; } - const uint8_t* getHash() const { return hash; } - std::string getHashString() const; - std::string str() const; - bool operator==(const ClassKey& other) const; - bool operator!=(const ClassKey& other) const; - bool operator<(const ClassKey& other) const; - bool operator>(const ClassKey& other) const; - bool operator<=(const ClassKey& other) const; - bool operator>=(const ClassKey& other) const; - void encode(framing::Buffer& buffer) const; - - private: - std::string package; - std::string name; - uint8_t hash[HASH_SIZE]; - }; - - QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const ClassKey& k); -} -} - - -#endif diff --git a/cpp/src/qpid/console/ConsoleImportExport.h b/cpp/src/qpid/console/ConsoleImportExport.h deleted file mode 100644 index 5ef8a892b1..0000000000 --- a/cpp/src/qpid/console/ConsoleImportExport.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef QPID_CONSOLE_IMPORT_EXPORT_H -#define QPID_CONSOLE_IMPORT_EXPORT_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) -#if defined(CONSOLE_EXPORT) || defined (qmfconsole_EXPORTS) -#define QPID_CONSOLE_EXTERN __declspec(dllexport) -#else -#define QPID_CONSOLE_EXTERN __declspec(dllimport) -#endif -#else -#define QPID_CONSOLE_EXTERN -#endif - -#endif diff --git a/cpp/src/qpid/console/ConsoleListener.h b/cpp/src/qpid/console/ConsoleListener.h deleted file mode 100644 index bd87390e99..0000000000 --- a/cpp/src/qpid/console/ConsoleListener.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_CONSOLE_LISTENER_H_ -#define _QPID_CONSOLE_CONSOLE_LISTENER_H_ - -#include <string> -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/console/Broker.h" -#include "qpid/console/ClassKey.h" -#include "qpid/console/Object.h" -#include "qpid/console/Event.h" - -namespace qpid { -namespace console { - - /** - * Implement a subclass of ConsoleListener and subscribe it using - * the SessionManager to receive indications. - * - * \ingroup qmfconsoleapi - */ - class QPID_CONSOLE_EXTERN ConsoleListener{ - public: - virtual ~ConsoleListener() {}; - - /** Invoked when a connection is established to a broker - */ - virtual void brokerConnected(const Broker&) {} - - /** Invoked when the connection to a broker is lost - */ - virtual void brokerDisconnected(const Broker&) {} - - /** Invoked when a QMF package is discovered. - */ - virtual void newPackage(const std::string&) {} - - /** Invoked when a new class is discovered. Session.getSchema can be - * used to obtain details about the class. - */ - virtual void newClass(const ClassKey&) {} - - /** Invoked when a QMF agent is discovered. - */ - virtual void newAgent(const Agent&) {} - - /** Invoked when a QMF agent disconects. - */ - virtual void delAgent(const Agent&) {} - - /** Invoked when an object is updated. - */ - virtual void objectProps(Broker&, Object&) {} - - /** Invoked when an object is updated. - */ - virtual void objectStats(Broker&, Object&) {} - - /** Invoked when an event is raised. - */ - virtual void event(Event&) {} - - /** - */ - //virtual void heartbeat(Agent&, uint64_t) {} - - /** - */ - virtual void brokerInfo(Broker&) {} - - /** - */ - //virtual void methodResponse(Broker&, uint32_t seq, MethodResponse&) {} - }; -} -} - - -#endif diff --git a/cpp/src/qpid/console/Event.h b/cpp/src/qpid/console/Event.h deleted file mode 100644 index 475898a1bc..0000000000 --- a/cpp/src/qpid/console/Event.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_EVENT_H_ -#define _QPID_CONSOLE_EVENT_H_ - -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/console/Object.h" -#include "qpid/framing/Uuid.h" -#include "qpid/framing/FieldTable.h" - -namespace qpid { -namespace framing { - class Buffer; -} -namespace console { - - class Broker; - struct SchemaClass; - class ClassKey; - - /** - * - * \ingroup qmfconsoleapi - */ - class Event { - public: - typedef enum { - SEV_EMERGENCY = 0, SEV_ALERT = 1, SEV_CRITICAL = 2, SEV_ERROR = 3, - SEV_WARNING = 4, SEV_NOTICE = 5, SEV_INFO = 6, SEV_DEBUG = 7 - } Severity; - - QPID_CONSOLE_EXTERN Event(Broker* broker, - SchemaClass* schemaClass, - framing::Buffer& buffer); - Broker* getBroker() const { return broker; } - QPID_CONSOLE_EXTERN const ClassKey& getClassKey() const; - SchemaClass* getSchema() const { return schema; } - const Object::AttributeMap& getAttributes() const { return attributes; } - uint64_t getTimestamp() const { return timestamp; } - uint8_t getSeverity() const { return severity; } - QPID_CONSOLE_EXTERN std::string getSeverityString() const; - - QPID_CONSOLE_EXTERN ObjectId attrRef(const std::string& key) const; - QPID_CONSOLE_EXTERN uint32_t attrUint(const std::string& key) const; - QPID_CONSOLE_EXTERN int32_t attrInt(const std::string& key) const; - QPID_CONSOLE_EXTERN uint64_t attrUint64(const std::string& key) const; - QPID_CONSOLE_EXTERN int64_t attrInt64(const std::string& key) const; - QPID_CONSOLE_EXTERN std::string attrString(const std::string& key) const; - QPID_CONSOLE_EXTERN bool attrBool(const std::string& key) const; - QPID_CONSOLE_EXTERN float attrFloat(const std::string& key) const; - QPID_CONSOLE_EXTERN double attrDouble(const std::string& key) const; - QPID_CONSOLE_EXTERN framing::Uuid attrUuid(const std::string& key) const; - QPID_CONSOLE_EXTERN framing::FieldTable attrMap(const std::string& key) const; - - private: - Broker* broker; - SchemaClass* schema; - uint64_t timestamp; - Severity severity; - Object::AttributeMap attributes; - }; - - QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Event& event); -} -} - - -#endif diff --git a/cpp/src/qpid/console/Object.h b/cpp/src/qpid/console/Object.h deleted file mode 100644 index 38f4f0fc5e..0000000000 --- a/cpp/src/qpid/console/Object.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_OBJECT_H_ -#define _QPID_CONSOLE_OBJECT_H_ - -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/console/ObjectId.h" -#include "qpid/framing/Uuid.h" -#include "qpid/framing/FieldTable.h" -#include <boost/shared_ptr.hpp> -#include <map> -#include <set> -#include <vector> - -namespace qpid { -namespace framing { - class Buffer; -} -namespace console { - - class Broker; - struct SchemaClass; - struct SchemaMethod; - class ObjectId; - class ClassKey; - class Value; - - /** - * \ingroup qmfconsoleapi - */ - struct MethodResponse { - uint32_t code; - std::string text; - std::map<std::string, boost::shared_ptr<Value> > arguments; - }; - - class Object { - public: - typedef std::vector<Object> Vector; - struct AttributeMap : public std::map<std::string, boost::shared_ptr<Value> > { - QPID_CONSOLE_EXTERN void addRef(const std::string& key, const ObjectId& val); - QPID_CONSOLE_EXTERN void addUint(const std::string& key, uint32_t val); - QPID_CONSOLE_EXTERN void addInt(const std::string& key, int32_t val); - QPID_CONSOLE_EXTERN void addUint64(const std::string& key, uint64_t val); - QPID_CONSOLE_EXTERN void addInt64(const std::string& key, int64_t val); - QPID_CONSOLE_EXTERN void addString(const std::string& key, const std::string& val); - QPID_CONSOLE_EXTERN void addBool(const std::string& key, bool val); - QPID_CONSOLE_EXTERN void addFloat(const std::string& key, float val); - QPID_CONSOLE_EXTERN void addDouble(const std::string& key, double val); - QPID_CONSOLE_EXTERN void addUuid(const std::string& key, const framing::Uuid& val); - QPID_CONSOLE_EXTERN void addMap(const std::string& key, const framing::FieldTable& val); - }; - - QPID_CONSOLE_EXTERN Object(Broker* broker, SchemaClass* schemaClass, framing::Buffer& buffer, bool prop, bool stat); - QPID_CONSOLE_EXTERN ~Object(); - - Broker* getBroker() const { return broker; } - const ObjectId& getObjectId() const { return objectId; } - QPID_CONSOLE_EXTERN const ClassKey& getClassKey() const; - SchemaClass* getSchema() const { return schema; } - uint64_t getCurrentTime() const { return currentTime; } - uint64_t getCreateTime() const { return createTime; } - uint64_t getDeleteTime() const { return deleteTime; } - bool isDeleted() const { return deleteTime != 0; } - QPID_CONSOLE_EXTERN std::string getIndex() const; - QPID_CONSOLE_EXTERN void mergeUpdate(const Object& updated); - const AttributeMap& getAttributes() const { return attributes; } - QPID_CONSOLE_EXTERN void invokeMethod(const std::string name, - const AttributeMap& args, - MethodResponse& result); - QPID_CONSOLE_EXTERN void handleMethodResp(framing::Buffer& buffer, - uint32_t sequence); - - QPID_CONSOLE_EXTERN ObjectId attrRef(const std::string& key) const; - QPID_CONSOLE_EXTERN uint32_t attrUint(const std::string& key) const; - QPID_CONSOLE_EXTERN int32_t attrInt(const std::string& key) const; - QPID_CONSOLE_EXTERN uint64_t attrUint64(const std::string& key) const; - QPID_CONSOLE_EXTERN int64_t attrInt64(const std::string& key) const; - QPID_CONSOLE_EXTERN std::string attrString(const std::string& key) const; - QPID_CONSOLE_EXTERN bool attrBool(const std::string& key) const; - QPID_CONSOLE_EXTERN float attrFloat(const std::string& key) const; - QPID_CONSOLE_EXTERN double attrDouble(const std::string& key) const; - QPID_CONSOLE_EXTERN framing::Uuid attrUuid(const std::string& key) const; - QPID_CONSOLE_EXTERN framing::FieldTable attrMap(const std::string& key) const; - - private: - Broker* broker; - SchemaClass* schema; - ObjectId objectId; - uint64_t currentTime; - uint64_t createTime; - uint64_t deleteTime; - AttributeMap attributes; - SchemaMethod* pendingMethod; - MethodResponse methodResponse; - - void parsePresenceMasks(framing::Buffer& buffer, std::set<std::string>& excludeList); - }; - - QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Object& object); -} -} - - -#endif diff --git a/cpp/src/qpid/console/ObjectId.h b/cpp/src/qpid/console/ObjectId.h deleted file mode 100644 index df5098288d..0000000000 --- a/cpp/src/qpid/console/ObjectId.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_OBJECTID_H -#define _QPID_CONSOLE_OBJECTID_H - -#include <iostream> -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/sys/IntegerTypes.h" - -namespace qpid { -namespace framing { - class Buffer; -} -namespace console { - - /** - * - * \ingroup qmfconsoleapi - */ - class QPID_CONSOLE_EXTERN ObjectId { - public: - ObjectId() : first(0), second(0) {} - ObjectId(framing::Buffer& buffer); - - uint8_t getFlags() const { return (first & 0xF000000000000000LL) >> 60; } - uint16_t getSequence() const { return (first & 0x0FFF000000000000LL) >> 48; } - uint32_t getBrokerBank() const { return (first & 0x0000FFFFF0000000LL) >> 28; } - uint32_t getAgentBank() const { return first & 0x000000000FFFFFFFLL; } - uint64_t getObject() const { return second; } - bool isDurable() const { return getSequence() == 0; } - void decode(framing::Buffer& buffer); - void encode(framing::Buffer& buffer); - void setValue(uint64_t f, uint64_t s) { first = f; second = s; } - - bool operator==(const ObjectId& other) const; - bool operator!=(const ObjectId& other) const; - bool operator<(const ObjectId& other) const; - bool operator>(const ObjectId& other) const; - bool operator<=(const ObjectId& other) const; - bool operator>=(const ObjectId& other) const; - - private: - uint64_t first; - uint64_t second; - }; - - QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const ObjectId& id); -} -} - -#endif diff --git a/cpp/src/qpid/console/Package.h b/cpp/src/qpid/console/Package.h deleted file mode 100644 index 62356a71da..0000000000 --- a/cpp/src/qpid/console/Package.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_PACKAGE_H_ -#define _QPID_CONSOLE_PACKAGE_H_ - -#include <string> -#include <map> -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/sys/IntegerTypes.h" - -namespace qpid { -namespace console { - struct SchemaClass; - - /** - * - * \ingroup qmfconsoleapi - */ - class Package { - public: - Package(const std::string& n) : name(n) {} - const std::string& getName() const { return name; } - - private: - friend class SessionManager; - struct NameHash { - std::string name; - uint8_t hash[16]; - NameHash(const std::string& n, const uint8_t* h) : name(n) { - for (int i = 0; i < 16; i++) - hash[i] = h[i]; - } - }; - - struct NameHashComp { - bool operator() (const NameHash& lhs, const NameHash& rhs) const - { - if (lhs.name != rhs.name) - return lhs.name < rhs.name; - else - for (int i = 0; i < 16; i++) - if (lhs.hash[i] != rhs.hash[i]) - return lhs.hash[i] < rhs.hash[i]; - return false; - } - }; - - typedef std::map<NameHash, SchemaClass*, NameHashComp> ClassMap; - - const std::string name; - ClassMap classes; - - SchemaClass* getClass(const std::string& className, uint8_t* hash); - void addClass(const std::string& className, uint8_t* hash, - SchemaClass* schemaClass); - }; -} -} - -#endif diff --git a/cpp/src/qpid/console/Schema.h b/cpp/src/qpid/console/Schema.h deleted file mode 100644 index b167de1f45..0000000000 --- a/cpp/src/qpid/console/Schema.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_SCHEMA_H_ -#define _QPID_CONSOLE_SCHEMA_H_ - -#include "qpid/console/ClassKey.h" -#include <boost/shared_ptr.hpp> -#include <vector> - -namespace qpid { -namespace framing { - class Buffer; -} -namespace console { - class Value; - - struct SchemaArgument { - SchemaArgument(framing::Buffer& buffer, bool forMethod = false); - boost::shared_ptr<Value> decodeValue(framing::Buffer& buffer); - - std::string name; - uint8_t typeCode; - bool dirInput; - bool dirOutput; - std::string unit; - int min; - int max; - int maxLen; - std::string desc; - std::string defaultVal; - }; - - struct SchemaProperty { - SchemaProperty(framing::Buffer& buffer); - boost::shared_ptr<Value> decodeValue(framing::Buffer& buffer); - - std::string name; - uint8_t typeCode; - uint8_t accessCode; - bool isIndex; - bool isOptional; - std::string unit; - int min; - int max; - int maxLen; - std::string desc; - }; - - struct SchemaStatistic { - SchemaStatistic(framing::Buffer& buffer); - boost::shared_ptr<Value> decodeValue(framing::Buffer& buffer); - - std::string name; - uint8_t typeCode; - std::string unit; - std::string desc; - }; - - struct SchemaMethod { - SchemaMethod(framing::Buffer& buffer); - ~SchemaMethod(); - - std::string name; - std::string desc; - std::vector<SchemaArgument*> arguments; - }; - - struct SchemaClass { - static const uint8_t KIND_TABLE = 1; - static const uint8_t KIND_EVENT = 2; - - SchemaClass(const uint8_t kind, const ClassKey& key, framing::Buffer& buffer); - ~SchemaClass(); - const ClassKey& getClassKey() const { return key; } - - const uint8_t kind; - const ClassKey key; - std::vector<SchemaProperty*> properties; - std::vector<SchemaStatistic*> statistics; - std::vector<SchemaMethod*> methods; - std::vector<SchemaArgument*> arguments; - }; -} -} - - -#endif diff --git a/cpp/src/qpid/console/SequenceManager.h b/cpp/src/qpid/console/SequenceManager.h deleted file mode 100644 index 181120dd7b..0000000000 --- a/cpp/src/qpid/console/SequenceManager.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_SEQUENCEMANAGER_H_ -#define _QPID_CONSOLE_SEQUENCEMANAGER_H_ - -#include "qpid/console/ConsoleImportExport.h" -#include "qpid/sys/Mutex.h" -#include <map> -#include <string> -#include <set> - -namespace qpid { -namespace console { - - /** - * - * \ingroup qpidconsoleapi - */ - class SequenceManager { - public: - typedef std::set<uint32_t> set; - - SequenceManager() : sequence(0) {} - QPID_CONSOLE_EXTERN uint32_t reserve(const std::string& context = ""); - QPID_CONSOLE_EXTERN std::string release(uint32_t seq); - - private: - sys::Mutex lock; - uint32_t sequence; - std::map<uint32_t, std::string> pending; - }; -} -} - - -#endif diff --git a/cpp/src/qpid/console/SessionManager.h b/cpp/src/qpid/console/SessionManager.h deleted file mode 100644 index 51b6aa69d1..0000000000 --- a/cpp/src/qpid/console/SessionManager.h +++ /dev/null @@ -1,205 +0,0 @@ -#ifndef _QPID_CONSOLE_SESSION_MANAGER_H -#define _QPID_CONSOLE_SESSION_MANAGER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/console/ConsoleImportExport.h" -#include "qpid/console/Broker.h" -#include "qpid/console/Package.h" -#include "qpid/console/SequenceManager.h" -#include "qpid/console/ClassKey.h" -#include "qpid/console/Schema.h" -#include "qpid/console/Agent.h" -#include "qpid/console/Object.h" -#include "qpid/console/ObjectId.h" -#include "qpid/console/Value.h" -#include "qpid/sys/Mutex.h" -#include "qpid/sys/Condition.h" -#include "qpid/client/ConnectionSettings.h" -#include <string> -#include <vector> - -namespace qpid { -namespace console { - -class ConsoleListener; - -/** - * - * \ingroup qmfconsoleapi - */ -class SessionManager -{ - public: - typedef std::vector<std::string> NameVector; - typedef std::vector<ClassKey> KeyVector; - QPID_CONSOLE_EXTERN ~SessionManager(); - - struct Settings { - bool rcvObjects; - bool rcvEvents; - bool rcvHeartbeats; - bool userBindings; - uint32_t methodTimeout; - uint32_t getTimeout; - - Settings() : rcvObjects(true), rcvEvents(true), rcvHeartbeats(true), - userBindings(false), methodTimeout(20), getTimeout(20) - {} - }; - - /** Create a new SessionManager - * - * Provide your own subclass of ConsoleListener to receive updates and indications - * asynchronously or leave it as its default and use only synchronous methods. - * - *@param listener Listener object to receive asynchronous indications. - *@param settings.rcvObjects Listener wishes to receive managed object data. - *@param settings.rcvEvents Listener wishes to receive events. - *@param settings.rcvHeartbeats Listener wishes to receive agent heartbeats. - *@param settings.userBindings If rcvObjects is true, userBindings allows the - * console client to control which object classes are received. See the bindPackage - * and bindClass methods. If userBindings is false, the listener will receive - * updates for all object classes. - */ - QPID_CONSOLE_EXTERN SessionManager(ConsoleListener* listener = 0, - Settings settings = Settings()); - - /** Connect a broker to the console session - * - *@param settings Connection settings for client access - *@return broker object if operation is successful - * an exception shall be thrown. - */ - QPID_CONSOLE_EXTERN Broker* addBroker(client::ConnectionSettings& settings); - - /** Disconnect a broker from the console session - * - *@param broker The broker object returned from an earlier call to addBroker. - */ - QPID_CONSOLE_EXTERN void delBroker(Broker* broker); - - /** Get a list of known management packages - * - *@param packages Vector of package names returned by the session manager. - */ - QPID_CONSOLE_EXTERN void getPackages(NameVector& packages); - - /** Get a list of class keys associated with a package - * - *@param classKeys List of class keys returned by the session manager. - *@param packageName Name of package being queried. - */ - QPID_CONSOLE_EXTERN void getClasses(KeyVector& classKeys, - const std::string& packageName); - - /** Get the schema of a class given its class key - * - *@param classKey Class key of the desired schema. - */ - QPID_CONSOLE_EXTERN SchemaClass& getSchema(const ClassKey& classKey); - - /** Request that updates be received for all classes within a package - * - * Note that this method is only meaningful if a ConsoleListener was provided at session - * creation and if the 'userBindings' flag was set to true. - * - *@param packageName Name of the package to which to bind. - */ - QPID_CONSOLE_EXTERN void bindPackage(const std::string& packageName); - - /** Request update to be received for a particular class - * - * Note that this method is only meaningful if a ConsoleListener was provided at session - * creation and if the 'userBindings' flag was set to true. - * - *@param classKey Class key of class to which to bind. - */ - QPID_CONSOLE_EXTERN void bindClass(const ClassKey& classKey); - QPID_CONSOLE_EXTERN void bindClass(const std::string& packageName, - const std::string& className); - - /** Get a list of qmf agents known to the session manager. - * - *@param agents Vector of Agent objects returned by the session manager. - *@param broker Return agents registered with this broker only. If NULL, return agents - * from all connected brokers. - */ - QPID_CONSOLE_EXTERN void getAgents(Agent::Vector& agents, - Broker* broker = 0); - - /** Get objects from agents. There are four variants of this method with different ways of - * specifying from which class objects are being queried. - * - *@param objects List of objects received. - *@param classKey ClassKey object identifying class to be queried. - *@param className Class name identifying class to be queried. - *@param objectId Object Id of the single object to be queried. - *@param broker Restrict the query to this broker, or all brokers if NULL. - *@param agent Restrict the query to this agent, or all agents if NULL. - */ - QPID_CONSOLE_EXTERN void getObjects(Object::Vector& objects, - const std::string& className, - Broker* broker = 0, - Agent* agent = 0); - //void getObjects(Object::Vector& objects, const ClassKey& classKey, - // Broker* broker = 0, Agent* agent = 0); - //void getObjects(Object::Vector& objects, const ObjectId& objectId, - // Broker* broker = 0, Agent* agent = 0); - -private: - friend class Broker; - friend class Broker::ConnectionThread; - friend class Object; - sys::Mutex lock; - sys::Mutex brokerListLock; - ConsoleListener* listener; - std::vector<Broker*> brokers; - std::map<std::string, Package*> packages; - SequenceManager sequenceManager; - sys::Condition cv; - SequenceManager::set syncSequenceList; - Object::Vector getResult; - std::string error; - Settings settings; - NameVector bindingKeyList; - - void bindingKeys(); - void allBrokersStable(); - void startProtocol(Broker* broker); - void handleBrokerResp(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handlePackageInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleCommandComplete(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleClassInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleMethodResp(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleHeartbeatInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleEventInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleSchemaResp(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence); - void handleContentInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence, bool prop, bool stat); - void handleBrokerConnect(Broker* broker); - void handleBrokerDisconnect(Broker* broker); - -}; - -}} // namespace qpid::console - -#endif /*!_QPID_CONSOLE_SESSION_MANAGER_H*/ diff --git a/cpp/src/qpid/console/Value.h b/cpp/src/qpid/console/Value.h deleted file mode 100644 index 8769ae3d77..0000000000 --- a/cpp/src/qpid/console/Value.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _QPID_CONSOLE_VALUE_H_ -#define _QPID_CONSOLE_VALUE_H_ - -#include "qpid/Exception.h" -#include "qpid/framing/Uuid.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/console/ObjectId.h" -#include <boost/shared_ptr.hpp> - -namespace qpid { -namespace framing { - class Buffer; -} -namespace console { - - /** - * \ingroup qmfconsoleapi - */ - class Value { - - public: - typedef boost::shared_ptr<Value> Ptr; - virtual ~Value() {} - virtual std::string str() const = 0; - - virtual bool isNull() const { return false; } - virtual bool isObjectId() const { return false; } - virtual bool isUint() const { return false; } - virtual bool isInt() const { return false; } - virtual bool isUint64() const { return false; } - virtual bool isInt64() const { return false; } - virtual bool isString() const { return false; } - virtual bool isBool() const { return false; } - virtual bool isFloat() const { return false; } - virtual bool isDouble() const { return false; } - virtual bool isUuid() const { return false; } - virtual bool isMap() const { return false; } - - virtual ObjectId asObjectId() const { incompatible(); return ObjectId(); } - virtual uint32_t asUint() const { incompatible(); return 0; } - virtual int32_t asInt() const { incompatible(); return 0; } - virtual uint64_t asUint64() const { incompatible(); return 0; } - virtual int64_t asInt64() const { incompatible(); return 0; } - virtual std::string asString() const { incompatible(); return std::string(); } - virtual bool asBool() const { incompatible(); return false; } - virtual float asFloat() const { incompatible(); return 0.0; } - virtual double asDouble() const { incompatible(); return 0.0; } - virtual framing::Uuid asUuid() const { incompatible(); return framing::Uuid(); } - virtual framing::FieldTable asMap() const { incompatible(); return framing::FieldTable(); } - - private: - void incompatible() const { - throw Exception("Incompatible Type"); - } - }; - - class NullValue : public Value { - public: - NullValue() {} - std::string str() const; - bool isNull() const { return true; } - }; - - class RefValue : public Value { - public: - RefValue(ObjectId v) : value(v) {} - RefValue(framing::Buffer& buffer); - std::string str() const; - bool isObjectId() const { return true; } - ObjectId asObjectId() const { return value; } - private: - ObjectId value; - }; - - class UintValue : public Value { - public: - UintValue(uint32_t v) : value(v) {} - std::string str() const; - bool isUint() const { return true; } - uint32_t asUint() const { return value; } - bool isUint64() const { return true; } - uint64_t asUint64() const { return (uint64_t) value; } - private: - uint32_t value; - }; - - class IntValue : public Value { - public: - IntValue(int32_t v) : value(v) {} - std::string str() const; - bool isInt() const { return true; } - int32_t asInt() const { return value; } - bool isInt64() const { return true; } - int64_t asInt64() const { return (int64_t) value; } - private: - int32_t value; - }; - - class Uint64Value : public Value { - public: - Uint64Value(uint64_t v) : value(v) {} - std::string str() const; - bool isUint64() const { return true; } - uint64_t asUint64() const { return value; } - private: - uint64_t value; - }; - - class Int64Value : public Value { - public: - Int64Value(int64_t v) : value(v) {} - std::string str() const; - bool isInt64() const { return true; } - int64_t asInt64() const { return value; } - private: - int64_t value; - }; - - class StringValue : public Value { - public: - StringValue(const std::string& v) : value(v) {} - StringValue(framing::Buffer& buffer, int tc); - std::string str() const { return value; } - bool isString() const { return true; } - std::string asString() const { return value; } - private: - std::string value; - }; - - class BoolValue : public Value { - public: - BoolValue(bool v) : value(v) {} - BoolValue(uint8_t v) : value(v != 0) {} - std::string str() const; - bool isBool() const { return true; } - bool asBool() const { return value; } - private: - bool value; - }; - - class FloatValue : public Value { - public: - FloatValue(float v) : value(v) {} - std::string str() const; - bool isFloat() const { return true; } - float asFloat() const { return value; } - bool isDouble() const { return true; } - double asDouble() const { return (double) value; } - private: - float value; - }; - - class DoubleValue : public Value { - public: - DoubleValue(double v) : value(v) {} - std::string str() const; - bool isDouble() const { return true; } - double asDouble() const { return value; } - private: - double value; - }; - - class UuidValue : public Value { - public: - UuidValue(const framing::Uuid& v) : value(v) {} - UuidValue(framing::Buffer& buffer); - std::string str() const { return value.str(); } - bool isUuid() const { return true; } - framing::Uuid asUuid() const { return value; } - private: - framing::Uuid value; - }; - - class MapValue : public Value { - public: - MapValue(const framing::FieldTable& v) : value(v) {} - MapValue(framing::Buffer& buffer); - std::string str() const; - bool isMap() const { return true; } - framing::FieldTable asMap() const { return value; } - private: - framing::FieldTable value; - }; - - class ValueFactory { - public: - static Value::Ptr newValue(int typeCode, framing::Buffer& buffer); - static void encodeValue(int typeCode, Value::Ptr value, framing::Buffer& buffer); - }; -} -} - -#endif diff --git a/cpp/src/qpid/framing/Array.h b/cpp/src/qpid/framing/Array.h deleted file mode 100644 index f243307084..0000000000 --- a/cpp/src/qpid/framing/Array.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/framing/amqp_types.h" -#include "qpid/framing/FieldValue.h" -#include "qpid/framing/TypeCode.h" -#include <boost/shared_ptr.hpp> -#include <iostream> -#include <vector> -#include "qpid/CommonImportExport.h" - -#ifndef _Array_ -#define _Array_ - -namespace qpid { -namespace framing { - -class Buffer; - -class Array -{ - public: - typedef boost::shared_ptr<FieldValue> ValuePtr; - typedef std::vector<ValuePtr> ValueVector; - typedef ValueVector::const_iterator const_iterator; - typedef ValueVector::iterator iterator; - - QPID_COMMON_EXTERN uint32_t encodedSize() const; - QPID_COMMON_EXTERN void encode(Buffer& buffer) const; - QPID_COMMON_EXTERN void decode(Buffer& buffer); - - QPID_COMMON_EXTERN int count() const; - QPID_COMMON_EXTERN bool operator==(const Array& other) const; - - QPID_COMMON_EXTERN Array(); - QPID_COMMON_EXTERN Array(TypeCode type); - QPID_COMMON_EXTERN Array(uint8_t type); - //creates a longstr array - QPID_COMMON_EXTERN Array(const std::vector<std::string>& in); - - QPID_COMMON_EXTERN TypeCode getType() const { return type; } - - // std collection interface. - QPID_COMMON_EXTERN const_iterator begin() const { return values.begin(); } - QPID_COMMON_EXTERN const_iterator end() const { return values.end(); } - QPID_COMMON_EXTERN iterator begin() { return values.begin(); } - QPID_COMMON_EXTERN iterator end(){ return values.end(); } - - QPID_COMMON_EXTERN ValuePtr front() const { return values.front(); } - QPID_COMMON_EXTERN ValuePtr back() const { return values.back(); } - QPID_COMMON_EXTERN size_t size() const { return values.size(); } - - QPID_COMMON_EXTERN void insert(iterator i, ValuePtr value); - QPID_COMMON_EXTERN void erase(iterator i) { values.erase(i); } - QPID_COMMON_EXTERN void push_back(ValuePtr value) { values.insert(end(), value); } - QPID_COMMON_EXTERN void pop_back() { values.pop_back(); } - - // Non-std interface - QPID_COMMON_EXTERN void add(ValuePtr value) { push_back(value); } - - template <class T> - void collect(std::vector<T>& out) const - { - for (ValueVector::const_iterator i = values.begin(); i != values.end(); ++i) { - out.push_back((*i)->get<T>()); - } - } - - private: - TypeCode type; - ValueVector values; - - friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const Array& body); -}; - -} -} - - -#endif diff --git a/cpp/src/qpid/framing/Buffer.h b/cpp/src/qpid/framing/Buffer.h deleted file mode 100644 index cacca7806e..0000000000 --- a/cpp/src/qpid/framing/Buffer.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/framing/amqp_types.h" -#include "qpid/Exception.h" -#include "qpid/CommonImportExport.h" -#include <boost/iterator/iterator_facade.hpp> - -#ifndef _Buffer_ -#define _Buffer_ - -namespace qpid { -namespace framing { - -struct OutOfBounds : qpid::Exception { - OutOfBounds() : qpid::Exception(std::string("Out of Bounds")) {} -}; - -class Content; -class FieldTable; - -class Buffer -{ - uint32_t size; - char* data; - uint32_t position; - uint32_t r_position; - - void checkAvailable(uint32_t count) { if (position + count > size) throw OutOfBounds(); } - - public: - - /** Buffer input/output iterator. - * Supports using an amqp_0_10::Codec with a framing::Buffer. - */ - class Iterator : public boost::iterator_facade< - Iterator, char, boost::random_access_traversal_tag> - { - public: - Iterator(Buffer& b) : buffer(&b) {} - - private: - friend class boost::iterator_core_access; - char& dereference() const { return buffer->data[buffer->position]; } - void increment() { ++buffer->position; } - bool equal(const Iterator& x) const { return buffer == x.buffer; } - - Buffer* buffer; - }; - - friend class Iterator; - - QPID_COMMON_EXTERN Buffer(char* data=0, uint32_t size=0); - - QPID_COMMON_EXTERN void record(); - QPID_COMMON_EXTERN void restore(bool reRecord = false); - QPID_COMMON_EXTERN void reset(); - - QPID_COMMON_EXTERN uint32_t available() { return size - position; } - QPID_COMMON_EXTERN uint32_t getSize() { return size; } - QPID_COMMON_EXTERN uint32_t getPosition() { return position; } - QPID_COMMON_EXTERN Iterator getIterator() { return Iterator(*this); } - QPID_COMMON_EXTERN char* getPointer() { return data; } - - QPID_COMMON_EXTERN void putOctet(uint8_t i); - QPID_COMMON_EXTERN void putShort(uint16_t i); - QPID_COMMON_EXTERN void putLong(uint32_t i); - QPID_COMMON_EXTERN void putLongLong(uint64_t i); - QPID_COMMON_EXTERN void putInt8(int8_t i); - QPID_COMMON_EXTERN void putInt16(int16_t i); - QPID_COMMON_EXTERN void putInt32(int32_t i); - QPID_COMMON_EXTERN void putInt64(int64_t i); - QPID_COMMON_EXTERN void putFloat(float f); - QPID_COMMON_EXTERN void putDouble(double f); - QPID_COMMON_EXTERN void putBin128(const uint8_t* b); - - QPID_COMMON_EXTERN uint8_t getOctet(); - QPID_COMMON_EXTERN uint16_t getShort(); - QPID_COMMON_EXTERN uint32_t getLong(); - QPID_COMMON_EXTERN uint64_t getLongLong(); - QPID_COMMON_EXTERN int8_t getInt8(); - QPID_COMMON_EXTERN int16_t getInt16(); - QPID_COMMON_EXTERN int32_t getInt32(); - QPID_COMMON_EXTERN int64_t getInt64(); - QPID_COMMON_EXTERN float getFloat(); - QPID_COMMON_EXTERN double getDouble(); - - template <int n> - QPID_COMMON_EXTERN uint64_t getUInt(); - - template <int n> - QPID_COMMON_EXTERN void putUInt(uint64_t); - - QPID_COMMON_EXTERN void putShortString(const string& s); - QPID_COMMON_EXTERN void putMediumString(const string& s); - QPID_COMMON_EXTERN void putLongString(const string& s); - QPID_COMMON_EXTERN void getShortString(string& s); - QPID_COMMON_EXTERN void getMediumString(string& s); - QPID_COMMON_EXTERN void getLongString(string& s); - QPID_COMMON_EXTERN void getBin128(uint8_t* b); - - QPID_COMMON_EXTERN void putRawData(const string& s); - QPID_COMMON_EXTERN void getRawData(string& s, uint32_t size); - - QPID_COMMON_EXTERN void putRawData(const uint8_t* data, size_t size); - QPID_COMMON_EXTERN void getRawData(uint8_t* data, size_t size); - - template <class T> void put(const T& data) { data.encode(*this); } - template <class T> void get(T& data) { data.decode(*this); } - - QPID_COMMON_EXTERN void dump(std::ostream&) const; -}; - -std::ostream& operator<<(std::ostream&, const Buffer&); - -}} // namespace qpid::framing - - -#endif diff --git a/cpp/src/qpid/framing/FieldTable.h b/cpp/src/qpid/framing/FieldTable.h deleted file mode 100644 index 72a00493af..0000000000 --- a/cpp/src/qpid/framing/FieldTable.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <iostream> -#include <vector> -#include <boost/shared_ptr.hpp> -#include <map> -#include "qpid/framing/amqp_types.h" -#include "qpid/CommonImportExport.h" - -#ifndef _FieldTable_ -#define _FieldTable_ - -namespace qpid { - /** - * The framing namespace contains classes that are used to create, - * send and receive the basic packets from which AMQP is built. - */ -namespace framing { - -class Array; -class FieldValue; -class Buffer; - -/** - * A set of name-value pairs. (See the AMQP spec for more details on - * AMQP field tables). - * - * \ingroup clientapi - */ -class FieldTable -{ - public: - typedef boost::shared_ptr<FieldValue> ValuePtr; - typedef std::map<std::string, ValuePtr> ValueMap; - typedef ValueMap::iterator iterator; - - QPID_COMMON_EXTERN FieldTable() {}; - QPID_COMMON_EXTERN FieldTable(const FieldTable& ft); - QPID_COMMON_EXTERN ~FieldTable(); - QPID_COMMON_EXTERN FieldTable& operator=(const FieldTable& ft); - QPID_COMMON_EXTERN uint32_t encodedSize() const; - QPID_COMMON_EXTERN void encode(Buffer& buffer) const; - QPID_COMMON_EXTERN void decode(Buffer& buffer); - - QPID_COMMON_EXTERN uint32_t qmfEncodedSize() const; - QPID_COMMON_EXTERN void qmfEncode(Buffer& buffer) const; - QPID_COMMON_EXTERN void qmfDecode(Buffer& buffer); - - QPID_COMMON_EXTERN int count() const; - QPID_COMMON_EXTERN void set(const std::string& name, const ValuePtr& value); - QPID_COMMON_EXTERN ValuePtr get(const std::string& name) const; - QPID_COMMON_EXTERN bool isSet(const std::string& name) const { return get(name).get() != 0; } - - QPID_COMMON_EXTERN void setString(const std::string& name, const std::string& value); - QPID_COMMON_EXTERN void setInt(const std::string& name, const int value); - QPID_COMMON_EXTERN void setInt64(const std::string& name, const int64_t value); - QPID_COMMON_EXTERN void setTimestamp(const std::string& name, const uint64_t value); - QPID_COMMON_EXTERN void setUInt64(const std::string& name, const uint64_t value); - QPID_COMMON_EXTERN void setTable(const std::string& name, const FieldTable& value); - QPID_COMMON_EXTERN void setArray(const std::string& name, const Array& value); - QPID_COMMON_EXTERN void setFloat(const std::string& name, const float value); - QPID_COMMON_EXTERN void setDouble(const std::string& name, const double value); - //void setDecimal(string& name, xxx& value); - - QPID_COMMON_EXTERN int getAsInt(const std::string& name) const; - QPID_COMMON_EXTERN uint64_t getAsUInt64(const std::string& name) const; - QPID_COMMON_EXTERN int64_t getAsInt64(const std::string& name) const; - QPID_COMMON_EXTERN std::string getAsString(const std::string& name) const; - - QPID_COMMON_EXTERN bool getTable(const std::string& name, FieldTable& value) const; - QPID_COMMON_EXTERN bool getArray(const std::string& name, Array& value) const; - QPID_COMMON_EXTERN bool getFloat(const std::string& name, float& value) const; - QPID_COMMON_EXTERN bool getDouble(const std::string& name, double& value) const; - //bool getTimestamp(const std::string& name, uint64_t& value) const; - //bool getDecimal(string& name, xxx& value); - QPID_COMMON_EXTERN void erase(const std::string& name); - - - QPID_COMMON_EXTERN bool operator==(const FieldTable& other) const; - - // Map-like interface. - // TODO: may need to duplicate into versions that return mutable iterator - ValueMap::const_iterator begin() const { return values.begin(); } - ValueMap::const_iterator end() const { return values.end(); } - ValueMap::const_iterator find(const std::string& s) const { return values.find(s); } - - std::pair <ValueMap::iterator, bool> insert(const ValueMap::value_type&); - void clear() { values.clear(); } - - // ### Hack Alert - - ValueMap::iterator getValues() { return values.begin(); } - - private: - ValueMap values; - - QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream& out, const FieldTable& body); -}; - -//class FieldNotFoundException{}; -//class UnknownFieldName : public FieldNotFoundException{}; -//class IncorrectFieldType : public FieldNotFoundException{}; -} -} - - -#endif diff --git a/cpp/src/qpid/framing/FieldValue.h b/cpp/src/qpid/framing/FieldValue.h deleted file mode 100644 index a648289844..0000000000 --- a/cpp/src/qpid/framing/FieldValue.h +++ /dev/null @@ -1,321 +0,0 @@ -#ifndef _framing_FieldValue_h -#define _framing_FieldValue_h -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/Exception.h" -#include "qpid/framing/amqp_types.h" -#include "qpid/framing/Buffer.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/CommonImportExport.h" - -#include <iostream> -#include <memory> -#include <vector> - -#include <assert.h> - -namespace qpid { -namespace framing { - -//class Array; -/** - * Exception that is the base exception for all field table errors. - * - * \ingroup clientapi - */ -class FieldValueException : public qpid::Exception {}; - -/** - * Exception thrown when we can't perform requested conversion - * - * \ingroup clientapi - */ -struct InvalidConversionException : public FieldValueException { - InvalidConversionException() {} -}; - -/** - * Value that can appear in an AMQP field table - * - * \ingroup clientapi - */ -class FieldValue { - public: - /* - * Abstract type for content of different types - */ - class Data { - public: - virtual ~Data() {}; - virtual uint32_t encodedSize() const = 0; - virtual void encode(Buffer& buffer) = 0; - virtual void decode(Buffer& buffer) = 0; - virtual bool operator==(const Data&) const = 0; - - virtual bool convertsToInt() const { return false; } - virtual bool convertsToString() const { return false; } - virtual int64_t getInt() const { throw InvalidConversionException();} - virtual std::string getString() const { throw InvalidConversionException(); } - - virtual void print(std::ostream& out) const = 0; - }; - - FieldValue(): data(0) {}; - // Default assignment operator is fine - void setType(uint8_t type); - uint8_t getType(); - Data& getData() { return *data; } - uint32_t encodedSize() const { return 1 + data->encodedSize(); }; - bool empty() const { return data.get() == 0; } - void encode(Buffer& buffer); - void decode(Buffer& buffer); - QPID_COMMON_EXTERN bool operator==(const FieldValue&) const; - QPID_COMMON_EXTERN bool operator!=(const FieldValue& v) const { return !(*this == v); } - - void print(std::ostream& out) const; - - template <typename T> bool convertsTo() const { return false; } - template <typename T> T get() const { throw InvalidConversionException(); } - - protected: - FieldValue(uint8_t t, Data* d): typeOctet(t), data(d) {} - - private: - uint8_t typeOctet; - std::auto_ptr<Data> data; -}; - -template <> -inline bool FieldValue::convertsTo<int>() const { return data->convertsToInt(); } - -template <> -inline bool FieldValue::convertsTo<int64_t>() const { return data->convertsToInt(); } - -template <> -inline bool FieldValue::convertsTo<std::string>() const { return data->convertsToString(); } - -template <> -inline int FieldValue::get<int>() const { return data->getInt(); } - -template <> -inline int64_t FieldValue::get<int64_t>() const { return data->getInt(); } - -template <> -inline std::string FieldValue::get<std::string>() const { return data->getString(); } - -inline std::ostream& operator<<(std::ostream& out, const FieldValue& v) { - v.print(out); - return out; -} - -template <int width> -class FixedWidthValue : public FieldValue::Data { - uint8_t octets[width]; - - public: - FixedWidthValue() {} - FixedWidthValue(const uint8_t (&data)[width]) : octets(data) {} - FixedWidthValue(const uint8_t* const data) - { - for (int i = 0; i < width; i++) octets[i] = data[i]; - } - FixedWidthValue(uint64_t v) - { - for (int i = width; i > 1; --i) { - octets[i-1] = (uint8_t) (0xFF & v); v >>= 8; - } - octets[0] = (uint8_t) (0xFF & v); - } - uint32_t encodedSize() const { return width; } - void encode(Buffer& buffer) { buffer.putRawData(octets, width); } - void decode(Buffer& buffer) { buffer.getRawData(octets, width); } - bool operator==(const Data& d) const { - const FixedWidthValue<width>* rhs = dynamic_cast< const FixedWidthValue<width>* >(&d); - if (rhs == 0) return false; - else return std::equal(&octets[0], &octets[width], &rhs->octets[0]); - } - - bool convertsToInt() const { return true; } - int64_t getInt() const - { - int64_t v = 0; - for (int i = 0; i < width-1; ++i) { - v |= octets[i]; v <<= 8; - } - v |= octets[width-1]; - return v; - } - uint8_t* rawOctets() { return octets; } - - void print(std::ostream& o) const { o << "F" << width << ":"; }; -}; - -template <> -class FixedWidthValue<0> : public FieldValue::Data { - public: - // Implicit default constructor is fine - uint32_t encodedSize() const { return 0; } - void encode(Buffer&) {}; - void decode(Buffer&) {}; - bool operator==(const Data& d) const { - const FixedWidthValue<0>* rhs = dynamic_cast< const FixedWidthValue<0>* >(&d); - return rhs != 0; - } - void print(std::ostream& o) const { o << "F0"; }; -}; - -template <int lenwidth> -class VariableWidthValue : public FieldValue::Data { - std::vector<uint8_t> octets; - - public: - VariableWidthValue() {} - VariableWidthValue(const std::vector<uint8_t>& data) : octets(data) {} - VariableWidthValue(const uint8_t* start, const uint8_t* end) : octets(start, end) {} - uint32_t encodedSize() const { return lenwidth + octets.size(); } - void encode(Buffer& buffer) { - buffer.putUInt<lenwidth>(octets.size()); - if (octets.size() > 0) - buffer.putRawData(&octets[0], octets.size()); - }; - void decode(Buffer& buffer) { - uint32_t len = buffer.getUInt<lenwidth>(); - octets.resize(len); - if (len > 0) - buffer.getRawData(&octets[0], len); - } - bool operator==(const Data& d) const { - const VariableWidthValue<lenwidth>* rhs = dynamic_cast< const VariableWidthValue<lenwidth>* >(&d); - if (rhs == 0) return false; - else return octets==rhs->octets; - } - - bool convertsToString() const { return true; } - std::string getString() const { return std::string(octets.begin(), octets.end()); } - - void print(std::ostream& o) const { o << "V" << lenwidth << ":" << octets.size() << ":"; }; -}; - -template <class T> -class EncodedValue : public FieldValue::Data { - T value; - public: - - EncodedValue() {} - EncodedValue(const T& v) : value(v) {} - - T& getValue() { return value; } - const T& getValue() const { return value; } - - uint32_t encodedSize() const { return value.encodedSize(); } - - void encode(Buffer& buffer) { - value.encode(buffer); - }; - void decode(Buffer& buffer) { - value.decode(buffer); - } - bool operator==(const Data& d) const { - const EncodedValue<T>* rhs = dynamic_cast< const EncodedValue<T>* >(&d); - if (rhs == 0) return false; - else return value==rhs->value; - } - - void print(std::ostream& o) const { o << "[" << value << "]"; }; -}; - -class Str8Value : public FieldValue { - public: - QPID_COMMON_EXTERN Str8Value(const std::string& v); -}; - -class Str16Value : public FieldValue { - public: - QPID_COMMON_EXTERN Str16Value(const std::string& v); -}; - -class Struct32Value : public FieldValue { - public: - QPID_COMMON_EXTERN Struct32Value(const std::string& v); -}; - -class FloatValue : public FieldValue -{ - public: - QPID_COMMON_EXTERN FloatValue(float f); -}; -class DoubleValue : public FieldValue -{ - public: - QPID_COMMON_EXTERN DoubleValue(double f); -}; - -/* - * Basic integer value encodes as signed 32 bit - */ -class IntegerValue : public FieldValue { - public: - QPID_COMMON_EXTERN IntegerValue(int v); -}; - -class TimeValue : public FieldValue { - public: - QPID_COMMON_EXTERN TimeValue(uint64_t v); -}; - -class Integer64Value : public FieldValue { - public: - QPID_COMMON_EXTERN Integer64Value(int64_t v); -}; - -class Unsigned64Value : public FieldValue { - public: - QPID_COMMON_EXTERN Unsigned64Value(uint64_t v); -}; - -class FieldTableValue : public FieldValue { - public: - QPID_COMMON_EXTERN FieldTableValue(const FieldTable&); -}; - -class ArrayValue : public FieldValue { - public: - QPID_COMMON_EXTERN ArrayValue(const Array&); -}; - -template <class T> -bool getEncodedValue(FieldTable::ValuePtr vptr, T& value) -{ - if (vptr) { - const EncodedValue<T>* ev = dynamic_cast< EncodedValue<T>* >(&(vptr->getData())); - if (ev != 0) { - value = ev->getValue(); - return true; - } - } - return false; -} - - -}} // qpid::framing - -#endif diff --git a/cpp/src/qpid/framing/ProtocolVersion.h b/cpp/src/qpid/framing/ProtocolVersion.h deleted file mode 100644 index f10b1bf21e..0000000000 --- a/cpp/src/qpid/framing/ProtocolVersion.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _ProtocolVersion_ -#define _ProtocolVersion_ - -#include "qpid/framing/amqp_types.h" -#include "qpid/CommonImportExport.h" - -namespace qpid -{ -namespace framing -{ - -class ProtocolVersion -{ -private: - uint8_t major_; - uint8_t minor_; - -public: - explicit ProtocolVersion(uint8_t _major=0, uint8_t _minor=0) - : major_(_major), minor_(_minor) {} - - QPID_COMMON_EXTERN uint8_t getMajor() const { return major_; } - QPID_COMMON_EXTERN void setMajor(uint8_t major) { major_ = major; } - QPID_COMMON_EXTERN uint8_t getMinor() const { return minor_; } - QPID_COMMON_EXTERN void setMinor(uint8_t minor) { minor_ = minor; } - QPID_COMMON_EXTERN const std::string toString() const; - - QPID_COMMON_EXTERN ProtocolVersion& operator=(ProtocolVersion p); - - QPID_COMMON_EXTERN bool operator==(ProtocolVersion p) const; - QPID_COMMON_EXTERN bool operator!=(ProtocolVersion p) const { return ! (*this == p); } -}; - -} // namespace framing -} // namespace qpid - - -#endif // ifndef _ProtocolVersion_ diff --git a/cpp/src/qpid/framing/SequenceNumber.h b/cpp/src/qpid/framing/SequenceNumber.h deleted file mode 100644 index 6058367593..0000000000 --- a/cpp/src/qpid/framing/SequenceNumber.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _framing_SequenceNumber_h -#define _framing_SequenceNumber_h - -#include "qpid/framing/amqp_types.h" -#include <boost/operators.hpp> -#include <iosfwd> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace framing { - -class Buffer; - -/** - * 4-byte sequence number that 'wraps around'. - */ -class SequenceNumber : public -boost::equality_comparable< - SequenceNumber, boost::less_than_comparable< - SequenceNumber, boost::incrementable< - SequenceNumber, boost::decrementable<SequenceNumber> > > > -{ - int32_t value; - - public: - SequenceNumber(uint32_t v=0) : value(v) {} - - SequenceNumber& operator++() { ++value; return *this; } - SequenceNumber& operator--() { --value; return *this; } - bool operator==(const SequenceNumber& other) const { return value == other.value; } - bool operator<(const SequenceNumber& other) const { return (value - other.value) < 0; } - uint32_t getValue() const { return uint32_t(value); } - operator uint32_t() const { return uint32_t(value); } - - void encode(Buffer& buffer) const; - void decode(Buffer& buffer); - uint32_t encodedSize() const; - - template <class S> void serialize(S& s) { s(value); } - - friend inline int32_t operator-(const SequenceNumber& a, const SequenceNumber& b); -}; - -inline int32_t operator-(const SequenceNumber& a, const SequenceNumber& b) { - return int32_t(a.value - b.value); -} - -struct Window -{ - SequenceNumber hwm; - SequenceNumber lwm; -}; - -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& o, const SequenceNumber& n); - -}} // namespace qpid::framing - - -#endif diff --git a/cpp/src/qpid/framing/SequenceSet.h b/cpp/src/qpid/framing/SequenceSet.h deleted file mode 100644 index f1da828afc..0000000000 --- a/cpp/src/qpid/framing/SequenceSet.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _framing_SequenceSet_h -#define _framing_SequenceSet_h - -#include "qpid/framing/SequenceNumber.h" -#include "qpid/RangeSet.h" -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace framing { -class Buffer; - -class SequenceSet : public RangeSet<SequenceNumber> { - public: - SequenceSet() {} - SequenceSet(const RangeSet<SequenceNumber>& r) - : RangeSet<SequenceNumber>(r) {} - SequenceSet(const SequenceNumber& s) { add(s); } - SequenceSet(const SequenceNumber& start, const SequenceNumber finish) { add(start,finish); } - - - void encode(Buffer& buffer) const; - void decode(Buffer& buffer); - uint32_t encodedSize() const; - - QPID_COMMON_EXTERN bool contains(const SequenceNumber& s) const; - QPID_COMMON_EXTERN void add(const SequenceNumber& s); - QPID_COMMON_EXTERN void add(const SequenceNumber& start, const SequenceNumber& finish); // Closed range - QPID_COMMON_EXTERN void add(const SequenceSet& set); - QPID_COMMON_EXTERN void remove(const SequenceNumber& s); - QPID_COMMON_EXTERN void remove(const SequenceNumber& start, const SequenceNumber& finish); // Closed range - QPID_COMMON_EXTERN void remove(const SequenceSet& set); - - template <class T> void for_each(T& t) const { - for (RangeIterator i = rangesBegin(); i != rangesEnd(); i++) - t(i->first(), i->last()); - } - - template <class T> void for_each(const T& t) const { - for (RangeIterator i = rangesBegin(); i != rangesEnd(); i++) - t(i->first(), i->last()); - } - - friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SequenceSet&); -}; - -}} // namespace qpid::framing - - -#endif diff --git a/cpp/src/qpid/framing/StructHelper.h b/cpp/src/qpid/framing/StructHelper.h deleted file mode 100644 index 00b15be78d..0000000000 --- a/cpp/src/qpid/framing/StructHelper.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 _StructHelper_ -#define _StructHelper_ - -#include "qpid/Exception.h" -#include "qpid/CommonImportExport.h" -#include "qpid/framing/Buffer.h" - -#include <stdlib.h> // For alloca - -namespace qpid { -namespace framing { - -class StructHelper -{ -public: - - template <class T> void encode(const T t, std::string& data) { - uint32_t size = t.bodySize() + 2/*type*/; - data.resize(size); - Buffer wbuffer(const_cast<char*>(data.data()), size); - wbuffer.putShort(T::TYPE); - t.encodeStructBody(wbuffer); - } - - template <class T> void decode(T& t, const std::string& data) { - Buffer rbuffer(const_cast<char*>(data.data()), data.length()); - uint16_t type = rbuffer.getShort(); - if (type == T::TYPE) { - t.decodeStructBody(rbuffer); - } else { - throw Exception("Type code does not match"); - } - } -}; - -}} -#endif diff --git a/cpp/src/qpid/framing/Uuid.h b/cpp/src/qpid/framing/Uuid.h deleted file mode 100644 index 33be497c64..0000000000 --- a/cpp/src/qpid/framing/Uuid.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef QPID_FRAMING_UUID_H -#define QPID_FRAMING_UUID_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/CommonImportExport.h" -#include "qpid/sys/uuid.h" -#include "qpid/sys/IntegerTypes.h" - -#include <boost/array.hpp> - -#include <ostream> -#include <istream> - -namespace qpid { -namespace framing { - -class Buffer; - -/** - * A UUID is represented as a boost::array of 16 bytes. - * - * Full value semantics, operators ==, < etc. are provided by - * boost::array so Uuid can be the key type in a map etc. - */ -struct Uuid : public boost::array<uint8_t, 16> { - /** If unique is true, generate a unique ID else a null ID. */ - Uuid(bool unique=false) { if (unique) generate(); else clear(); } - - /** Copy from 16 bytes of data. */ - Uuid(const uint8_t* data) { assign(data); } - - /** Copy from 16 bytes of data. */ - void assign(const uint8_t* data) { - uuid_copy(c_array(), data); - } - - /** Set to a new unique identifier. */ - void generate() { uuid_generate(c_array()); } - - /** Set to all zeros. */ - void clear() { uuid_clear(c_array()); } - - /** Test for null (all zeros). */ - // Force int 0/!0 to false/true; avoids compile warnings. - bool isNull() { - return !!uuid_is_null(data()); - } - - // Default op= and copy ctor are fine. - // boost::array gives us ==, < etc. - - QPID_COMMON_EXTERN void encode(framing::Buffer& buf) const; - QPID_COMMON_EXTERN void decode(framing::Buffer& buf); - QPID_COMMON_EXTERN uint32_t encodedSize() const { return size(); } - - /** String value in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ - QPID_COMMON_EXTERN std::string str() const; - - template <class S> void serialize(S& s) { - s.raw(begin(), size()); - } -}; - -/** Print in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, Uuid); - -/** Read from format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ -QPID_COMMON_EXTERN std::istream& operator>>(std::istream&, Uuid&); - -}} // namespace qpid::framing - - - -#endif /*!QPID_FRAMING_UUID_H*/ diff --git a/cpp/src/qpid/framing/amqp_types.h b/cpp/src/qpid/framing/amqp_types.h deleted file mode 100644 index 0cc2e80dce..0000000000 --- a/cpp/src/qpid/framing/amqp_types.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef AMQP_TYPES_H -#define AMQP_TYPES_H -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ - -/** \file - * Definitions and forward declarations of all types used - * in AMQP messages. - */ - -#include "qpid/sys/IntegerTypes.h" -#include <string> - -namespace qpid { -namespace framing { - -using std::string; -typedef uint8_t FrameType; -typedef uint16_t ChannelId; -typedef uint32_t BatchOffset; -typedef uint8_t ClassId; -typedef uint8_t MethodId; -typedef uint16_t ReplyCode; - -// Types represented by classes. -class Content; -class FieldTable; -class SequenceNumberSet; -struct Uuid; - -// Useful constants - -/** Maximum channel ID used by broker. Reserve high bit for internal use.*/ -const ChannelId CHANNEL_MAX=(ChannelId(~1))>>1; -const ChannelId CHANNEL_HIGH_BIT= ChannelId(~CHANNEL_MAX); - -// Forward declare class types -class FramingContent; -class FieldTable; -class SequenceNumberSet; -class SequenceSet; -struct Uuid; - -// Enum types -enum DeliveryMode { TRANSIENT = 1, PERSISTENT = 2}; - -}} // namespace qpid::framing -#endif diff --git a/cpp/src/qpid/framing/amqp_types_full.h b/cpp/src/qpid/framing/amqp_types_full.h deleted file mode 100644 index c5d84dedea..0000000000 --- a/cpp/src/qpid/framing/amqp_types_full.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _framing_amqp_types_decl_h -#define _framing_amqp_types_decl_h - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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. - * - */ - -/** \file - * Definitions and full declarations of all types used - * in AMQP messages. - * - * It's better to include amqp_types.h in another header instead of this file - * unless the header actually needs the full declarations. Including - * full declarations when forward declarations would increase compile - * times. - */ - -#include "qpid/framing/amqp_types.h" -#include "qpid/framing/Array.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/framing/SequenceSet.h" -#include "qpid/framing/Uuid.h" - -#endif /*!_framing_amqp_types_decl_h*/ diff --git a/cpp/src/qpid/log/Logger.h b/cpp/src/qpid/log/Logger.h deleted file mode 100644 index 35aa13f7ef..0000000000 --- a/cpp/src/qpid/log/Logger.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef QPID_LOG_LOGGER_H -#define QPID_LOG_LOGGER_H - -/* - * 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 "qpid/log/Selector.h" -#include "qpid/log/Options.h" -#include "qpid/sys/Mutex.h" -#include <boost/ptr_container/ptr_vector.hpp> -#include <boost/noncopyable.hpp> -#include <set> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace log { - -/** - * Central logging agent. - * - * Thread safe, singleton. - * - * The Logger provides all needed functionality for selecting and - * formatting logging output. The actual outputting of log records - * is handled by Logger::Output-derived classes instantiated by the - * platform's sink-related options. - */ -class Logger : private boost::noncopyable { - public: - /** Flags indicating what to include in the log output */ - enum FormatFlag { FILE=1, LINE=2, FUNCTION=4, LEVEL=8, TIME=16, THREAD=32}; - - /** - * Logging output sink. - * - * The Output sink provides an interface to direct logging output to. - * Logging sinks are primarily platform-specific as provided for on - * each platform. - * - * Implementations of Output must be thread safe. - */ - class Output { - public: - QPID_COMMON_EXTERN Output(); - QPID_COMMON_EXTERN virtual ~Output(); - /** Receives the statemnt of origin and formatted message to log. */ - virtual void log(const Statement&, const std::string&) =0; - }; - - QPID_COMMON_EXTERN static Logger& instance(); - - QPID_COMMON_EXTERN Logger(); - QPID_COMMON_EXTERN ~Logger(); - - /** Select the messages to be logged. */ - QPID_COMMON_EXTERN void select(const Selector& s); - - /** Set the formatting flags, bitwise OR of FormatFlag values. */ - QPID_COMMON_EXTERN void format(int formatFlags); - - /** Set format flags from options object. - *@returns computed flags. - */ - QPID_COMMON_EXTERN int format(const Options&); - - /** Configure logger from Options */ - QPID_COMMON_EXTERN void configure(const Options& o); - - /** Add a statement. */ - QPID_COMMON_EXTERN void add(Statement& s); - - /** Log a message. */ - QPID_COMMON_EXTERN void log(const Statement&, const std::string&); - - /** Add an output destination for messages */ - QPID_COMMON_EXTERN void output(std::auto_ptr<Output> out); - - /** Set a prefix for all messages */ - QPID_COMMON_EXTERN void setPrefix(const std::string& prefix); - - /** Reset the logger. */ - QPID_COMMON_EXTERN void clear(); - - /** Get the options used to configure the logger. */ - QPID_COMMON_EXTERN const Options& getOptions() const { return options; } - - - private: - typedef boost::ptr_vector<Output> Outputs; - typedef std::set<Statement*> Statements; - - sys::Mutex lock; - inline void enable_unlocked(Statement* s); - - Statements statements; - Outputs outputs; - Selector selector; - int flags; - std::string prefix; - Options options; -}; - -}} // namespace qpid::log - - -#endif /*!QPID_LOG_LOGGER_H*/ diff --git a/cpp/src/qpid/log/Options.h b/cpp/src/qpid/log/Options.h deleted file mode 100644 index bbc47b47d3..0000000000 --- a/cpp/src/qpid/log/Options.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef QPID_LOG_OPTIONS_H -#define QPID_LOG_OPTIONS_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/Options.h" -#include "qpid/CommonImportExport.h" -#include "qpid/log/SinkOptions.h" -#include <iosfwd> -#include <memory> - -namespace qpid { -namespace log { - -/** Logging options for config parser. */ -struct Options : public qpid::Options { - /** Pass argv[0] for use in syslog output */ - QPID_COMMON_EXTERN Options(const std::string& argv0_=std::string(), - const std::string& name_="Logging options"); - QPID_COMMON_EXTERN Options(const Options &); - - QPID_COMMON_EXTERN Options& operator=(const Options&); - - std::string argv0; - std::string name; - std::vector<std::string> selectors; - bool time, level, thread, source, function; - bool trace; - std::string prefix; - std::auto_ptr<SinkOptions> sinkOptions; -}; - -}} // namespace qpid::log - -#endif /*!QPID_LOG_OPTIONS_H*/ diff --git a/cpp/src/qpid/log/Selector.h b/cpp/src/qpid/log/Selector.h deleted file mode 100644 index 3c18fb6ba2..0000000000 --- a/cpp/src/qpid/log/Selector.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef SELECTOR_H -#define SELECTOR_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/log/Statement.h" -#include "qpid/CommonImportExport.h" -#include <vector> - -namespace qpid { -namespace log { -struct Options; - -/** - * A selector identifies the set of log messages to enable. - * - * Thread object unsafe, pass-by-value type. - */ -class Selector { - public: - /** Empty selector selects nothing */ - Selector() {} - - /** Set selector from Options */ - QPID_COMMON_EXTERN Selector(const Options&); - - /** Equavlient to: Selector s; s.enable(l, s) */ - Selector(Level l, const std::string& s=std::string()) { - enable(l,s); - } - - Selector(const std::string& enableStr) { enable(enableStr); } - /** - * Enable messages with level in levels where the file - * name contains substring. Empty string matches all. - */ - void enable(Level level, const std::string& substring=std::string()) { - substrings[level].push_back(substring); - } - - /** Enable based on a 'level[+]:file' string */ - QPID_COMMON_EXTERN void enable(const std::string& enableStr); - - /** True if level is enabled for file. */ - QPID_COMMON_EXTERN bool isEnabled(Level level, const char* function); - - private: - std::vector<std::string> substrings[LevelTraits::COUNT]; -}; - - -}} // namespace qpid::log - - -#endif /*!SELECTOR_H*/ diff --git a/cpp/src/qpid/log/SinkOptions.h b/cpp/src/qpid/log/SinkOptions.h deleted file mode 100644 index 7ec2cfbc17..0000000000 --- a/cpp/src/qpid/log/SinkOptions.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef QPID_LOG_SINKOPTIONS_H -#define QPID_LOG_SINKOPTIONS_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/Options.h" -#include <string> - -namespace qpid { -namespace log { - -class Logger; - -/** - * Logging sink options. - * - * Most logging sink options will be platform-specific, even if some are - * duplicated. The range of platforms to which this code may be ported - * can't be assumed to all have C++ iostreams or files. Thus, this class - * is primarily for implementing in a platform-specific way. - */ -struct SinkOptions : public qpid::Options { - - // Create a platform's SinkOptions. Pass argv0 as the program name, - // useful for syslog-type logging. - static SinkOptions *create(const std::string& argv0=std::string()); - - SinkOptions(const std::string& name="Logging sink options") - : qpid::Options(name) - {} - virtual ~SinkOptions() {} - - virtual SinkOptions& operator=(const SinkOptions&) = 0; - - // This allows the caller to indicate that there's no normal outputs - // available. For example, when running as a daemon. In these cases, the - // platform's "syslog"-type output should replace the default stderr - // unless some other sink has been selected. - virtual void detached(void) = 0; - - // The Logger acting on these options calls setup() to request any - // Sinks be set up and fed back to the logger. - virtual void setup(Logger *logger) = 0; -}; - -}} // namespace qpid::log - -#endif /*!QPID_LOG_OPTIONS_H*/ diff --git a/cpp/src/qpid/log/Statement.h b/cpp/src/qpid/log/Statement.h deleted file mode 100644 index 445f635cdd..0000000000 --- a/cpp/src/qpid/log/Statement.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef STATEMENT_H -#define STATEMENT_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/Msg.h" -#include "qpid/CommonImportExport.h" -#include <boost/current_function.hpp> - -namespace qpid { -namespace log { - -/** Debugging severity levels - * - trace: High-volume debugging messages. - * - debug: Debugging messages. - * - info: Informational messages. - * - notice: Normal but significant condition. - * - warning: Warn of a possible problem. - * - error: A definite error has occured. - * - critical: System in danger of severe failure. - */ -enum Level { trace, debug, info, notice, warning, error, critical }; -struct LevelTraits { - static const int COUNT=critical+1; - - /** Get level from string name. - *@exception if name invalid. - */ - static Level level(const char* name); - - /** Get level from string name. - *@exception if name invalid. - */ - static Level level(const std::string& name) { - return level(name.c_str()); - } - - /** String name of level */ - static const char* name(Level); -}; - -/** POD struct representing a logging statement in source code. */ -struct Statement { - bool enabled; - const char* file; - int line; - const char* function; - Level level; - - QPID_COMMON_EXTERN void log(const std::string& message); - - struct Initializer { - QPID_COMMON_EXTERN Initializer(Statement& s); - Statement& statement; - }; -}; - -///@internal static initializer for a Statement. -#define QPID_LOG_STATEMENT_INIT(level) \ - { 0, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (::qpid::log::level) } - -/** - * Like QPID_LOG but computes an additional boolean test expression - * to determine if the message should be logged. Evaluation of both - * the test and message expressions occurs only if the requested log level - * is enabled. - *@param LEVEL severity Level for message, should be one of: - * debug, info, notice, warning, error, critical. NB no qpid::log:: prefix. - *@param TEST message is logged only if expression TEST evaluates to true. - *@param MESSAGE any object with an @eostream operator<<, or a sequence - * like of ostreamable objects separated by @e<<. - */ -#define QPID_LOG_IF(LEVEL, TEST, MESSAGE) \ - do { \ - using ::qpid::log::Statement; \ - static Statement stmt_= QPID_LOG_STATEMENT_INIT(LEVEL); \ - static Statement::Initializer init_(stmt_); \ - if (stmt_.enabled && (TEST)) \ - stmt_.log(::qpid::Msg() << MESSAGE); \ - } while(0) - -/** - * Macro for log statements. Example of use: - * @code - * QPID_LOG(debug, "There are " << foocount << " foos in the bar."); - * QPID_LOG(error, boost::format("Dohickey %s exploded") % dohicky.name()); - * @endcode - * - * You can subscribe to log messages by level, by component, by filename - * or a combination @see Configuration. - - *@param LEVEL severity Level for message, should be one of: - * debug, info, notice, warning, error, critical. NB no qpid::log:: prefix. - *@param MESSAGE any object with an @eostream operator<<, or a sequence - * like of ostreamable objects separated by @e<<. - */ -#define QPID_LOG(LEVEL, MESSAGE) QPID_LOG_IF(LEVEL, true, MESSAGE); - -}} // namespace qpid::log - - - - -#endif /*!STATEMENT_H*/ - diff --git a/cpp/src/qpid/management/Args.h b/cpp/src/qpid/management/Args.h deleted file mode 100644 index da1fb033b9..0000000000 --- a/cpp/src/qpid/management/Args.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _Args_ -#define _Args_ - -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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. -// - - -namespace qpid { -namespace management { - -class Args -{ - public: - - virtual ~Args (void) = 0; - -}; - -inline Args::~Args (void) {} - -class ArgsNone : public Args -{ -}; - -}} - - -#endif /*!_Args_*/ diff --git a/cpp/src/qpid/management/Manageable.h b/cpp/src/qpid/management/Manageable.h deleted file mode 100644 index dd4e06b018..0000000000 --- a/cpp/src/qpid/management/Manageable.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _Manageable_ -#define _Manageable_ - -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 "qpid/management/ManagementObject.h" -#include "qpid/management/Args.h" -#include <string> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace management { - -class QPID_COMMON_EXTERN Manageable -{ - public: - - virtual ~Manageable(void) = 0; - - // status_t is a type used to pass completion status from the method handler. - // - typedef uint32_t status_t; - static std::string StatusText(status_t status, std::string text = std::string()); - - static const status_t STATUS_OK = 0; - static const status_t STATUS_UNKNOWN_OBJECT = 1; - static const status_t STATUS_UNKNOWN_METHOD = 2; - static const status_t STATUS_NOT_IMPLEMENTED = 3; - static const status_t STATUS_INVALID_PARAMETER = 4; - static const status_t STATUS_FEATURE_NOT_IMPLEMENTED = 5; - static const status_t STATUS_FORBIDDEN = 6; - static const status_t STATUS_EXCEPTION = 7; - static const status_t STATUS_USER = 0x00010000; - - // Every "Manageable" object must hold a reference to exactly one - // management object. This object is always of a class derived from - // the pure-virtual "ManagementObject". - // - // This accessor function returns a pointer to the management object. - // - virtual ManagementObject* GetManagementObject(void) const = 0; - - // Every "Manageable" object must implement ManagementMethod. This - // function is called when a remote management client invokes a method - // on this object. The input and output arguments are specific to the - // method being called and must be down-cast to the appropriate sub class - // before use. - virtual status_t ManagementMethod(uint32_t methodId, Args& args, std::string& text); -}; - -inline Manageable::~Manageable(void) {} - -}} - -#endif /*!_Manageable_*/ diff --git a/cpp/src/qpid/management/ManagementEvent.h b/cpp/src/qpid/management/ManagementEvent.h deleted file mode 100644 index 6eeea32b70..0000000000 --- a/cpp/src/qpid/management/ManagementEvent.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _ManagementEvent_ -#define _ManagementEvent_ - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/management/ManagementObject.h" -#include <qpid/framing/Buffer.h> -#include <string> - -namespace qpid { -namespace management { - -class ManagementAgent; - -class ManagementEvent : public ManagementItem { -public: - typedef void (*writeSchemaCall_t)(qpid::framing::Buffer&); - virtual ~ManagementEvent() {} - - virtual writeSchemaCall_t getWriteSchemaCall(void) = 0; - virtual std::string& getEventName() const = 0; - virtual std::string& getPackageName() const = 0; - virtual uint8_t* getMd5Sum() const = 0; - virtual uint8_t getSeverity() const = 0; - virtual void encode(qpid::framing::Buffer&) const = 0; -}; - -}} - -#endif /*!_ManagementEvent_*/ diff --git a/cpp/src/qpid/management/ManagementObject.h b/cpp/src/qpid/management/ManagementObject.h deleted file mode 100644 index a6ef8fb392..0000000000 --- a/cpp/src/qpid/management/ManagementObject.h +++ /dev/null @@ -1,187 +0,0 @@ -#ifndef _ManagementObject_ -#define _ManagementObject_ - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/sys/Time.h" -#include "qpid/sys/Mutex.h" -#include <qpid/framing/Buffer.h> -#include "qpid/CommonImportExport.h" -#include <map> - -namespace qpid { -namespace management { - -class Manageable; -class ObjectId; - - -class AgentAttachment { - friend class ObjectId; -private: - uint64_t first; -public: - AgentAttachment() : first(0) {} - QPID_COMMON_EXTERN void setBanks(uint32_t broker, uint32_t bank); - uint64_t getFirst() const { return first; } -}; - - -class ObjectId { -protected: - const AgentAttachment* agent; - uint64_t first; - uint64_t second; - void fromString(const std::string&); -public: - QPID_COMMON_EXTERN ObjectId() : agent(0), first(0), second(0) {} - QPID_COMMON_EXTERN ObjectId(framing::Buffer& buf) : agent(0) { decode(buf); } - QPID_COMMON_EXTERN ObjectId(uint8_t flags, uint16_t seq, uint32_t broker, uint32_t bank, uint64_t object); - QPID_COMMON_EXTERN ObjectId(AgentAttachment* _agent, uint8_t flags, uint16_t seq, uint64_t object); - QPID_COMMON_EXTERN ObjectId(std::istream&); - QPID_COMMON_EXTERN ObjectId(const std::string&); - QPID_COMMON_EXTERN bool operator==(const ObjectId &other) const; - QPID_COMMON_EXTERN bool operator<(const ObjectId &other) const; - QPID_COMMON_EXTERN void encode(framing::Buffer& buffer); - QPID_COMMON_EXTERN void decode(framing::Buffer& buffer); - friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const ObjectId&); -}; - -class ManagementItem { -public: - static const uint8_t TYPE_U8 = 1; - static const uint8_t TYPE_U16 = 2; - static const uint8_t TYPE_U32 = 3; - static const uint8_t TYPE_U64 = 4; - static const uint8_t TYPE_SSTR = 6; - static const uint8_t TYPE_LSTR = 7; - static const uint8_t TYPE_ABSTIME = 8; - static const uint8_t TYPE_DELTATIME = 9; - static const uint8_t TYPE_REF = 10; - static const uint8_t TYPE_BOOL = 11; - static const uint8_t TYPE_FLOAT = 12; - static const uint8_t TYPE_DOUBLE = 13; - static const uint8_t TYPE_UUID = 14; - static const uint8_t TYPE_FTABLE = 15; - static const uint8_t TYPE_S8 = 16; - static const uint8_t TYPE_S16 = 17; - static const uint8_t TYPE_S32 = 18; - static const uint8_t TYPE_S64 = 19; - - static const uint8_t ACCESS_RC = 1; - static const uint8_t ACCESS_RW = 2; - static const uint8_t ACCESS_RO = 3; - - static const uint8_t DIR_I = 1; - static const uint8_t DIR_O = 2; - static const uint8_t DIR_IO = 3; - - static const uint8_t FLAG_CONFIG = 0x01; - static const uint8_t FLAG_INDEX = 0x02; - static const uint8_t FLAG_END = 0x80; - - const static uint8_t CLASS_KIND_TABLE = 1; - const static uint8_t CLASS_KIND_EVENT = 2; - - - -public: - virtual ~ManagementItem() {} -}; - -class ManagementObject : public ManagementItem -{ -protected: - - uint64_t createTime; - uint64_t destroyTime; - uint64_t updateTime; - ObjectId objectId; - bool configChanged; - bool instChanged; - bool deleted; - Manageable* coreObject; - sys::Mutex accessLock; - uint32_t flags; - - static int nextThreadIndex; - bool forcePublish; - - QPID_COMMON_EXTERN int getThreadIndex(); - QPID_COMMON_EXTERN void writeTimestamps(qpid::framing::Buffer& buf); - - public: - QPID_COMMON_EXTERN static int maxThreads; - typedef void (*writeSchemaCall_t) (qpid::framing::Buffer&); - - ManagementObject(Manageable* _core) : - createTime(uint64_t(qpid::sys::Duration(qpid::sys::now()))), - destroyTime(0), updateTime(createTime), configChanged(true), - instChanged(true), deleted(false), - coreObject(_core), forcePublish(false) {} - virtual ~ManagementObject() {} - - virtual writeSchemaCall_t getWriteSchemaCall() = 0; - virtual void writeProperties(qpid::framing::Buffer& buf) = 0; - virtual void writeStatistics(qpid::framing::Buffer& buf, - bool skipHeaders = false) = 0; - virtual void doMethod(std::string& methodName, - qpid::framing::Buffer& inBuf, - qpid::framing::Buffer& outBuf) = 0; - QPID_COMMON_EXTERN virtual void setReference(ObjectId objectId); - - virtual std::string& getClassName() const = 0; - virtual std::string& getPackageName() const = 0; - virtual uint8_t* getMd5Sum() const = 0; - - void setObjectId(ObjectId oid) { objectId = oid; } - ObjectId getObjectId() { return objectId; } - inline bool getConfigChanged() { return configChanged; } - virtual bool getInstChanged() { return instChanged; } - virtual bool hasInst() { return true; } - inline void setForcePublish(bool f) { forcePublish = f; } - inline bool getForcePublish() { return forcePublish; } - inline void setUpdateTime() { updateTime = (uint64_t(sys::Duration(sys::now()))); } - - inline void resourceDestroy() { - destroyTime = uint64_t (qpid::sys::Duration(qpid::sys::now())); - deleted = true; - } - inline bool isDeleted() { return deleted; } - inline void setFlags(uint32_t f) { flags = f; } - inline uint32_t getFlags() { return flags; } - bool isSameClass(ManagementObject& other) { - for (int idx = 0; idx < 16; idx++) - if (other.getMd5Sum()[idx] != getMd5Sum()[idx]) - return false; - return other.getClassName() == getClassName() && - other.getPackageName() == getPackageName(); - } -}; - -typedef std::map<ObjectId, ManagementObject*> ManagementObjectMap; - -}} - - - -#endif /*!_ManagementObject_*/ diff --git a/cpp/src/qpid/sys/Condition.h b/cpp/src/qpid/sys/Condition.h deleted file mode 100644 index fe0e3a1c71..0000000000 --- a/cpp/src/qpid/sys/Condition.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _sys_Condition_h -#define _sys_Condition_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 USE_APR_PLATFORM -#include "apr/Condition.h" -#elif defined (_WIN32) -#include "windows/Condition.h" -#else -#include "posix/Condition.h" -#endif - -#endif /*!_sys_Condition_h*/ diff --git a/cpp/src/qpid/sys/IOHandle.h b/cpp/src/qpid/sys/IOHandle.h deleted file mode 100644 index 656e5e1efd..0000000000 --- a/cpp/src/qpid/sys/IOHandle.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _sys_IOHandle_h -#define _sys_IOHandle_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** - * This is a class intended to abstract the Unix concept of file descriptor - * or the Windows concept of HANDLE - */ -// Windows-related classes -class AsynchAcceptorPrivate; -class AsynchAcceptResult; -namespace windows { - class AsynchIO; -} - -// General classes -class PollerHandle; -class IOHandlePrivate; -class IOHandle { - - friend class AsynchAcceptorPrivate; - friend class AsynchAcceptResult; - friend class windows::AsynchIO; - - friend class PollerHandle; - -protected: - IOHandlePrivate* const impl; - - IOHandle(IOHandlePrivate*); - QPID_COMMON_EXTERN virtual ~IOHandle(); -}; - -}} - -#endif // _sys_IOHandle_h diff --git a/cpp/src/qpid/sys/IntegerTypes.h b/cpp/src/qpid/sys/IntegerTypes.h deleted file mode 100755 index 89635f033e..0000000000 --- a/cpp/src/qpid/sys/IntegerTypes.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef QPID_SYS_INTEGERTYPES_H -#define QPID_SYS_INTEGERTYPES_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ - -#if (defined(_WINDOWS) || defined (WIN32)) && defined(_MSC_VER) -#include "qpid/sys/windows/IntegerTypes.h" -#endif -#if !defined _WINDOWS && !defined WIN32 -#include "qpid/sys/posix/IntegerTypes.h" -#endif - -#endif /*!QPID_SYS_INTEGERTYPES_H*/ diff --git a/cpp/src/qpid/sys/Monitor.h b/cpp/src/qpid/sys/Monitor.h deleted file mode 100644 index 76c7118928..0000000000 --- a/cpp/src/qpid/sys/Monitor.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _sys_Monitor_h -#define _sys_Monitor_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/sys/Condition.h" - -namespace qpid { -namespace sys { - -/** - * A monitor is a condition variable and a mutex - */ -class Monitor : public Mutex, public Condition { - public: - inline void wait(); - inline bool wait(const AbsTime& absoluteTime); -}; - - -void Monitor::wait() { - Condition::wait(*this); -} - -bool Monitor::wait(const AbsTime& absoluteTime) { - return Condition::wait(*this, absoluteTime); -} - -}} -#endif /*!_sys_Monitor_h*/ diff --git a/cpp/src/qpid/sys/Mutex.h b/cpp/src/qpid/sys/Mutex.h deleted file mode 100644 index 00bf392604..0000000000 --- a/cpp/src/qpid/sys/Mutex.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _sys_Mutex_h -#define _sys_Mutex_h - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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. - * - */ - -namespace qpid { -namespace sys { - -/** - * Scoped lock template: calls lock() in ctor, unlock() in dtor. - * L can be any class with lock() and unlock() functions. - */ -template <class L> -class ScopedLock -{ - public: - ScopedLock(L& l) : mutex(l) { l.lock(); } - ~ScopedLock() { mutex.unlock(); } - private: - L& mutex; -}; - -template <class L> -class ScopedUnlock -{ - public: - ScopedUnlock(L& l) : mutex(l) { l.unlock(); } - ~ScopedUnlock() { mutex.lock(); } - private: - L& mutex; -}; - -template <class L> -class ScopedRlock -{ - public: - ScopedRlock(L& l) : mutex(l) { l.rlock(); } - ~ScopedRlock() { mutex.unlock(); } - private: - L& mutex; -}; - -template <class L> -class ScopedWlock -{ - public: - ScopedWlock(L& l) : mutex(l) { l.wlock(); } - ~ScopedWlock() { mutex.unlock(); } - private: - L& mutex; -}; - -template <class L> -class ConditionalScopedLock -{ - public: - ConditionalScopedLock(L& l) : mutex(l) { acquired = l.trylock(); } - ~ConditionalScopedLock() { if (acquired) mutex.unlock(); } - bool lockAcquired() { return acquired; } - private: - L& mutex; - bool acquired; -}; - -}} - -#ifdef USE_APR_PLATFORM -#include "apr/Mutex.h" -#elif defined (_WIN32) -#include "windows/Mutex.h" -#else -#include "posix/Mutex.h" -#endif - -#endif /*!_sys_Mutex_h*/ diff --git a/cpp/src/qpid/sys/Runnable.h b/cpp/src/qpid/sys/Runnable.h deleted file mode 100644 index 4bf43c93d1..0000000000 --- a/cpp/src/qpid/sys/Runnable.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _Runnable_ -#define _Runnable_ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <boost/function.hpp> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** - * Interface for objects that can be run, e.g. in a thread. - */ -class Runnable -{ - public: - /** Type to represent a runnable as a Functor */ - typedef boost::function0<void> Functor; - - QPID_COMMON_EXTERN virtual ~Runnable(); - - /** Derived classes override run(). */ - virtual void run() = 0; - - /** Create a functor object that will call this->run(). */ - Functor functor(); -}; - -}} - - -#endif diff --git a/cpp/src/qpid/sys/StrError.h b/cpp/src/qpid/sys/StrError.h deleted file mode 100644 index 69cc7e714c..0000000000 --- a/cpp/src/qpid/sys/StrError.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _sys_StrError_h -#define _sys_StrError_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <string> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** Get the error message for a system number err, e.g. errno. */ -QPID_COMMON_EXTERN std::string strError(int err); - -}} // namespace qpid - -#endif // _sys_StrError_h diff --git a/cpp/src/qpid/sys/SystemInfo.h b/cpp/src/qpid/sys/SystemInfo.h deleted file mode 100644 index 6e97022b36..0000000000 --- a/cpp/src/qpid/sys/SystemInfo.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef QPID_SYS_SYSTEMINFO_H -#define QPID_SYS_SYSTEMINFO_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/sys/IntegerTypes.h" -#include "qpid/Address.h" -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** - * Retrieve information about the system we are running on. - * Results may be dependent on OS/hardware. - */ -namespace SystemInfo { - /** - * Estimate available concurrency, e.g. number of CPU cores. - * -1 means estimate not available on this platform. - */ - QPID_COMMON_EXTERN long concurrency(); - - /** - * Get the local host name and set it in the specified TcpAddress. - * Returns false if it can't be obtained and sets errno to any error value. - */ - QPID_COMMON_EXTERN bool getLocalHostname (TcpAddress &address); - - QPID_COMMON_EXTERN void getLocalIpAddresses (uint16_t port, std::vector<Address> &addrList); - - /** - * Retrieve system identifiers and versions. This is information that can - * generally be retrieved via POSIX uname(). - * - * @param osName Receives the OS name; e.g., GNU/Linux or Windows - * @param nodeName Receives the nodename. This may or may not match the - * set hostname from getLocalHostname(). - * @param release Receives the OS release identifier. - * @param version Receives the OS release version (kernel, build, sp, etc.) - * @param machine Receives the hardware type. - */ - QPID_COMMON_EXTERN void getSystemId (std::string &osName, - std::string &nodeName, - std::string &release, - std::string &version, - std::string &machine); - - /** - * Get the process ID of the current process. - */ - QPID_COMMON_EXTERN uint32_t getProcessId(); - - /** - * Get the process ID of the parent of the current process. - */ - QPID_COMMON_EXTERN uint32_t getParentProcessId(); - - /** - * Get the name of the current process (i.e. the name of the executable) - */ - QPID_COMMON_EXTERN std::string getProcessName(); - - -}}} // namespace qpid::sys::SystemInfo - -#endif /*!QPID_SYS_SYSTEMINFO_H*/ diff --git a/cpp/src/qpid/sys/Thread.h b/cpp/src/qpid/sys/Thread.h deleted file mode 100644 index b532d4d80a..0000000000 --- a/cpp/src/qpid/sys/Thread.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _sys_Thread_h -#define _sys_Thread_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <boost/shared_ptr.hpp> -#include "qpid/CommonImportExport.h" - -#ifdef _WIN32 -# define QPID_TSS __declspec(thread) -#elif defined (__GNUC__) -# define QPID_TSS __thread -#elif defined (__SUNPRO_CC) -# define QPID_TSS __thread -#else -# error "Dont know how to define QPID_TSS for this platform" -#endif - -namespace qpid { -namespace sys { - -class Runnable; -class ThreadPrivate; - -class Thread -{ - boost::shared_ptr<ThreadPrivate> impl; - - public: - QPID_COMMON_EXTERN Thread(); - QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable*); - QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable&); - - QPID_COMMON_EXTERN void join(); - - QPID_COMMON_EXTERN unsigned long id(); - - QPID_COMMON_EXTERN static Thread current(); - - /** ID of current thread for logging. - * Workaround for broken Thread::current() in APR - */ - static unsigned long logId() { return current().id(); } -}; - -}} -#endif /*!_sys_Thread_h*/ diff --git a/cpp/src/qpid/sys/Time.h b/cpp/src/qpid/sys/Time.h deleted file mode 100644 index ca229c2f27..0000000000 --- a/cpp/src/qpid/sys/Time.h +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef _sys_Time_h -#define _sys_Time_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/sys/IntegerTypes.h" -/* - * The platform defines its notion of time as a TimePrivate type. The - * platform's implementation knows how to handle this type. - */ -#if defined (_WIN32) -# include "windows/Time.h" -#else -# include "posix/Time.h" -#endif - -#include "qpid/CommonImportExport.h" - -#include <limits> -#include <iosfwd> - -namespace qpid { -namespace sys { - -class Duration; - -/** - * @class AbsTime - * - * Class to represent an instant in time. - * - * The time resolution is in nanosecs, and this is held with 64 bits - * giving a total time span from about 25 million years ago to 25 million - * years hence. As an aside the internal time can sensibly be negative - * meaning before the epoch (probably 1/1/1970 although this class doesn't - * care). - * - * The AbsTime class is a value class and so you don't need to add any - * accessors to its internal state. If you think you want to replace its value, - * you need to construct a new AbsTime and assign it, viz: - * - * AbsTime when = AbsTime::now(); - * ... - * when = AbsTime(when, 2*TIME_SEC); // Advance timer 2 secs - * - * If for some reason you need access to the internal nanosec value you need - * to convert the AbsTime to a Duration and use its conversion to int64_t, viz: - * - * AbsTime now = AbsTime::now(); - * - * int64_t ns = Duration(now); - * - * However note that the nanosecond value that is returned here is not - * defined to be anything in particular and could vary from platform to - * platform. - * - * There are some sensible operations that are currently missing from - * AbsTime, but nearly all that's needed can be done with a mixture of - * AbsTimes and Durations. - * - * For example, convenience operators to add a Duration and AbsTime returning - * an AbsTime would fit here (although you can already perform the operation - * with one of the AbsTime constructors). However trying to add 2 AbsTimes - * doesn't make sense. - */ -class AbsTime { - friend class Duration; - - TimePrivate timepoint; - -public: - QPID_COMMON_EXTERN inline AbsTime() {} - QPID_COMMON_EXTERN AbsTime(const AbsTime& time0, const Duration& duration); - // Default assignment operation fine - // Default copy constructor fine - - QPID_COMMON_EXTERN static AbsTime now(); - QPID_COMMON_EXTERN static AbsTime FarFuture(); - const TimePrivate& getPrivate(void) const { return timepoint; } - bool operator==(const AbsTime& t) const { return t.timepoint == timepoint; } - template <class S> void serialize(S& s) { s(timepoint); } - - friend bool operator<(const AbsTime& a, const AbsTime& b); - friend bool operator>(const AbsTime& a, const AbsTime& b); - QPID_COMMON_EXTERN friend std::ostream& operator << (std::ostream&, const AbsTime&); -}; - -QPID_COMMON_EXTERN std::ostream& operator << (std::ostream&, const AbsTime&); - -/** - * @class Duration - * Class to represent the duration between instants of time. - * - * As AbsTime, this class also uses nanosecs for its time - * resolution where possible. For the most part a duration can be dealt - * with like a 64 bit integer, and indeed there is an implicit conversion which - * makes this quite convenient. - */ -class Duration { - static int64_t max() { return std::numeric_limits<int64_t>::max(); } - int64_t nanosecs; - - friend class AbsTime; - -public: - QPID_COMMON_EXTERN inline Duration(int64_t time0); - QPID_COMMON_EXTERN explicit Duration(const AbsTime& time0); - QPID_COMMON_EXTERN explicit Duration(const AbsTime& start, const AbsTime& finish); - inline operator int64_t() const; -}; - -std::ostream& operator << (std::ostream&, const Duration&); - -inline AbsTime now() { return AbsTime::now(); } - -inline bool operator<(const AbsTime& a, const AbsTime& b) -{ return a.timepoint < b.timepoint; } -inline bool operator>(const AbsTime& a, const AbsTime& b) -{ return a.timepoint > b.timepoint; } - -Duration::Duration(int64_t time0) : - nanosecs(time0) -{} - -Duration::operator int64_t() const -{ return nanosecs; } - -/** Nanoseconds per second. */ -const Duration TIME_SEC = 1000*1000*1000; -/** Nanoseconds per millisecond */ -const Duration TIME_MSEC = 1000*1000; -/** Nanoseconds per microseconds. */ -const Duration TIME_USEC = 1000; -/** Nanoseconds per nanosecond. */ -const Duration TIME_NSEC = 1; - -/** Value to represent an infinite timeout */ -const Duration TIME_INFINITE = std::numeric_limits<int64_t>::max(); - -/** Time greater than any other time */ -const AbsTime FAR_FUTURE = AbsTime::FarFuture(); - -/** Portable sleep for a number of seconds */ -QPID_COMMON_EXTERN void sleep(int secs); - -/** Portable sleep for a number of microseconds */ -QPID_COMMON_EXTERN void usleep(uint64_t usecs); - -/** Output formatted date/time for now*/ -void outputFormattedNow(std::ostream&); - -}} - -#endif /*!_sys_Time_h*/ diff --git a/cpp/src/qpid/sys/posix/Condition.h b/cpp/src/qpid/sys/posix/Condition.h deleted file mode 100644 index 93aae3ffce..0000000000 --- a/cpp/src/qpid/sys/posix/Condition.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _sys_posix_Condition_h -#define _sys_posix_Condition_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/sys/posix/PrivatePosix.h" - -#include "qpid/sys/Mutex.h" -#include "qpid/sys/Time.h" - -#include <time.h> -#include <sys/errno.h> -#include <boost/noncopyable.hpp> - -namespace qpid { -namespace sys { - -/** - * A condition variable for thread synchronization. - */ -class Condition -{ - public: - inline Condition(); - inline ~Condition(); - inline void wait(Mutex&); - inline bool wait(Mutex&, const AbsTime& absoluteTime); - inline void notify(); - inline void notifyAll(); - - private: - pthread_cond_t condition; -}; - -Condition::Condition() { - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_init(&condition, 0)); -} - -Condition::~Condition() { - QPID_POSIX_ABORT_IF(pthread_cond_destroy(&condition)); -} - -void Condition::wait(Mutex& mutex) { - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_wait(&condition, &mutex.mutex)); -} - -bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){ - struct timespec ts; - toTimespec(ts, Duration(absoluteTime)); - int status = pthread_cond_timedwait(&condition, &mutex.mutex, &ts); - if (status != 0) { - if (status == ETIMEDOUT) return false; - throw QPID_POSIX_ERROR(status); - } - return true; -} - -void Condition::notify(){ - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_signal(&condition)); -} - -void Condition::notifyAll(){ - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_broadcast(&condition)); -} - -}} -#endif /*!_sys_posix_Condition_h*/ diff --git a/cpp/src/qpid/sys/posix/IntegerTypes.h b/cpp/src/qpid/sys/posix/IntegerTypes.h deleted file mode 100755 index ce97f7bde8..0000000000 --- a/cpp/src/qpid/sys/posix/IntegerTypes.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef QPID_SYS_POSIX_INTEGERTYPES_H -#define QPID_SYS_POSIX_INTEGERTYPES_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 <stdint.h> - -#endif /*!QPID_SYS_INTEGERTYPES_H*/ diff --git a/cpp/src/qpid/sys/posix/Mutex.h b/cpp/src/qpid/sys/posix/Mutex.h deleted file mode 100644 index fb8491dec0..0000000000 --- a/cpp/src/qpid/sys/posix/Mutex.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef _sys_posix_Mutex_h -#define _sys_posix_Mutex_h - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/sys/posix/check.h" - -#include <pthread.h> -#include <boost/noncopyable.hpp> - -namespace qpid { -namespace sys { - -class Condition; - -/** - * Mutex lock. - */ -class Mutex : private boost::noncopyable { - friend class Condition; - static const pthread_mutexattr_t* getAttribute(); - -public: - typedef ::qpid::sys::ScopedLock<Mutex> ScopedLock; - typedef ::qpid::sys::ScopedUnlock<Mutex> ScopedUnlock; - - inline Mutex(); - inline ~Mutex(); - inline void lock(); - inline void unlock(); - inline bool trylock(); - - -protected: - pthread_mutex_t mutex; -}; - -/** - * RW lock. - */ -class RWlock : private boost::noncopyable { - friend class Condition; - -public: - typedef ::qpid::sys::ScopedRlock<RWlock> ScopedRlock; - typedef ::qpid::sys::ScopedWlock<RWlock> ScopedWlock; - - inline RWlock(); - inline ~RWlock(); - inline void wlock(); // will write-lock - inline void rlock(); // will read-lock - inline void unlock(); - inline void trywlock(); // will write-try - inline void tryrlock(); // will read-try - -protected: - pthread_rwlock_t rwlock; -}; - - -/** - * PODMutex is a POD, can be static-initialized with - * PODMutex m = QPID_PODMUTEX_INITIALIZER - */ -struct PODMutex -{ - typedef ::qpid::sys::ScopedLock<PODMutex> ScopedLock; - - inline void lock(); - inline void unlock(); - inline bool trylock(); - - // Must be public to be a POD: - pthread_mutex_t mutex; -}; - -#define QPID_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER } - -void PODMutex::lock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_lock(&mutex)); -} - -void PODMutex::unlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_unlock(&mutex)); -} - -bool PODMutex::trylock() { - return pthread_mutex_trylock(&mutex) == 0; -} - -Mutex::Mutex() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_init(&mutex, getAttribute())); -} - -Mutex::~Mutex(){ - QPID_POSIX_ABORT_IF(pthread_mutex_destroy(&mutex)); -} - -void Mutex::lock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_lock(&mutex)); -} - -void Mutex::unlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_unlock(&mutex)); -} - -bool Mutex::trylock() { - return pthread_mutex_trylock(&mutex) == 0; -} - - -RWlock::RWlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_init(&rwlock, NULL)); -} - -RWlock::~RWlock(){ - QPID_POSIX_ABORT_IF(pthread_rwlock_destroy(&rwlock)); -} - -void RWlock::wlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_wrlock(&rwlock)); -} - -void RWlock::rlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_rdlock(&rwlock)); -} - -void RWlock::unlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_unlock(&rwlock)); -} - -void RWlock::trywlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_trywrlock(&rwlock)); -} - -void RWlock::tryrlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_tryrdlock(&rwlock)); -} - - -}} -#endif /*!_sys_posix_Mutex_h*/ diff --git a/cpp/src/qpid/sys/posix/PrivatePosix.h b/cpp/src/qpid/sys/posix/PrivatePosix.h deleted file mode 100644 index 0fefa50ab6..0000000000 --- a/cpp/src/qpid/sys/posix/PrivatePosix.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _sys_posix_PrivatePosix_h -#define _sys_posix_PrivatePosix_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/sys/Time.h" -#include "qpid/sys/IOHandle.h" - -struct timespec; -struct timeval; - -namespace qpid { -namespace sys { - -// Private Time related implementation details -struct timespec& toTimespec(struct timespec& ts, const Duration& t); -struct timeval& toTimeval(struct timeval& tv, const Duration& t); -Duration toTime(const struct timespec& ts); - -// Private fd related implementation details -class IOHandlePrivate { -public: - IOHandlePrivate(int f = -1) : - fd(f) - {} - - int fd; -}; - -int toFd(const IOHandlePrivate* h); - -// Posix fd as an IOHandle -class PosixIOHandle : public IOHandle { -public: - PosixIOHandle(int fd) : - IOHandle(new IOHandlePrivate(fd)) - {} -}; - -// Dummy IOHandle for places it's required in the API -// but we promise not to actually try to do any operations on the IOHandle -class NullIOHandle : public IOHandle { -public: - NullIOHandle() : - IOHandle(new IOHandlePrivate) - {} -}; - -extern NullIOHandle DummyIOHandle; - -}} - -#endif /*!_sys_posix_PrivatePosix_h*/ diff --git a/cpp/src/qpid/sys/posix/Time.h b/cpp/src/qpid/sys/posix/Time.h deleted file mode 100755 index 62d734c816..0000000000 --- a/cpp/src/qpid/sys/posix/Time.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef QPID_SYS_POSIX_TIME_H -#define QPID_SYS_POSIX_TIME_H - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 "qpid/sys/IntegerTypes.h" - -namespace qpid { -namespace sys { - -/** - * Class to represent an instant in time. - */ -typedef int64_t TimePrivate; - -}} // namespace qpid::sys - -#endif /*!QPID_SYS_POSIX_TIME_H*/ diff --git a/cpp/src/qpid/sys/posix/check.h b/cpp/src/qpid/sys/posix/check.h deleted file mode 100644 index 03eee54196..0000000000 --- a/cpp/src/qpid/sys/posix/check.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _posix_check_h -#define _posix_check_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 "qpid/Exception.h" - -#include <cerrno> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#define QPID_POSIX_ERROR(ERRNO) qpid::Exception(QPID_MSG(qpid::sys::strError(ERRNO))) - -/** THROW QPID_POSIX_ERROR(errno) if RESULT is less than zero */ -#define QPID_POSIX_CHECK(RESULT) \ - if ((RESULT) < 0) throw QPID_POSIX_ERROR((errno)) - -/** Throw a posix error if ERRNO is non-zero */ -#define QPID_POSIX_THROW_IF(ERRNO) \ - do { int e=(ERRNO); if (e) throw QPID_POSIX_ERROR(e); } while(0) - -/** Same as _THROW_IF in a release build, but abort a debug build */ -#ifdef NDEBUG -#define QPID_POSIX_ASSERT_THROW_IF(ERRNO) QPID_POSIX_THROW_IF(ERRNO) -#else -#define QPID_POSIX_ASSERT_THROW_IF(ERRNO) \ - do { int e=(ERRNO); if (e) { errno=e; ::perror(0); assert(0); } } while(0) -#endif - -#define QPID_POSIX_ABORT_IF(ERRNO) if ((int) ERRNO) { errno=ERRNO; ::perror(0); abort(); } - -#endif /*!_posix_check_h*/ diff --git a/cpp/src/qpid/sys/uuid.h b/cpp/src/qpid/sys/uuid.h deleted file mode 100644 index 804ab34463..0000000000 --- a/cpp/src/qpid/sys/uuid.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _sys_uuid_h -#define _sys_uuid_h - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * 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 -# include "qpid/sys/windows/uuid.h" -#else -# include <uuid/uuid.h> -#endif /* _WIN32 */ - -#endif /* _sys_uuid_h */ diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index e318942cbf..3700ab4b4b 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -18,7 +18,7 @@ # AM_CXXFLAGS = $(WARNING_CFLAGS) -DBOOST_TEST_DYN_LINK -INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../gen -I$(top_builddir)/src/gen +INCLUDES = -I$(top_srcdir)/include -I$(srcdir)/.. -I$(srcdir)/../gen -I$(top_builddir)/src/gen abs_builddir=@abs_builddir@ extra_libs = |