diff options
Diffstat (limited to 'cpp/src/qpid')
117 files changed, 1314 insertions, 957 deletions
diff --git a/cpp/src/qpid/Address.h b/cpp/src/qpid/Address.h index 9669985165..a5a4345ba3 100755 --- a/cpp/src/qpid/Address.h +++ b/cpp/src/qpid/Address.h @@ -20,7 +20,7 @@ */ #include "qpid/sys/IntegerTypes.h" - +#include "qpid/CommonImportExport.h" #include <boost/variant.hpp> #include <iosfwd> #include <string> @@ -31,12 +31,12 @@ namespace qpid { /** TCP address of a broker - host:port */ struct TcpAddress { static const uint16_t DEFAULT_PORT=5672; - explicit TcpAddress(const std::string& host_=std::string(),uint16_t port_=DEFAULT_PORT); + 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); -std::ostream& operator<<(std::ostream& os, const TcpAddress& a); +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 diff --git a/cpp/src/qpid/CommonImportExport.h b/cpp/src/qpid/CommonImportExport.h new file mode 100644 index 0000000000..47872646d9 --- /dev/null +++ b/cpp/src/qpid/CommonImportExport.h @@ -0,0 +1,33 @@ +#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) +#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/DataDir.h b/cpp/src/qpid/DataDir.h index 6b45d8747b..dfdd498cbc 100644 --- a/cpp/src/qpid/DataDir.h +++ b/cpp/src/qpid/DataDir.h @@ -24,6 +24,7 @@ #include <string> #include <memory> #include "qpid/sys/LockFile.h" +#include "qpid/CommonImportExport.h" namespace qpid { @@ -38,8 +39,8 @@ class DataDir public: - DataDir (std::string path); - ~DataDir (); + QPID_COMMON_EXTERN DataDir (std::string path); + QPID_COMMON_EXTERN ~DataDir (); bool isEnabled() { return enabled; } const std::string& getPath() { return dirPath; } diff --git a/cpp/src/qpid/Exception.h b/cpp/src/qpid/Exception.h index 86bf8fbc4a..0b0bc33e93 100644 --- a/cpp/src/qpid/Exception.h +++ b/cpp/src/qpid/Exception.h @@ -27,7 +27,7 @@ #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> @@ -41,11 +41,11 @@ namespace qpid class Exception : public std::exception { public: - explicit Exception(const std::string& message=std::string()) throw(); - virtual ~Exception() throw(); - virtual const char* what() const throw(); // prefix: message - virtual std::string getMessage() const; // Unprefixed message - virtual std::string getPrefix() const; // Prefix + 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; @@ -77,8 +77,8 @@ struct ConnectionException : public Exception { }; struct ClosedException : public Exception { - ClosedException(const std::string& msg=std::string()); - std::string getPrefix() const; + QPID_COMMON_EXTERN ClosedException(const std::string& msg=std::string()); + QPID_COMMON_EXTERN std::string getPrefix() const; }; /** diff --git a/cpp/src/qpid/Modules.h b/cpp/src/qpid/Modules.h index 2a3b24f359..ce06dd0ef6 100644 --- a/cpp/src/qpid/Modules.h +++ b/cpp/src/qpid/Modules.h @@ -25,6 +25,7 @@ #include "Options.h" #include <string> #include <vector> +#include "qpid/CommonImportExport.h" namespace qpid { @@ -32,11 +33,11 @@ struct ModuleOptions : public qpid::Options { std::string loadDir; std::vector<std::string> load; bool noLoad; - ModuleOptions(const std::string& defaultModuleDir); + QPID_COMMON_EXTERN ModuleOptions(const std::string& defaultModuleDir); }; -void tryShlib(const char* libname, bool noThrow); -void loadModuleDir (std::string dirname, bool isDefault); +QPID_COMMON_EXTERN void tryShlib(const char* libname, bool noThrow); +QPID_COMMON_EXTERN void loadModuleDir (std::string dirname, bool isDefault); } // namespace qpid diff --git a/cpp/src/qpid/Options.h b/cpp/src/qpid/Options.h index cb86d27241..aeb7a79329 100644 --- a/cpp/src/qpid/Options.h +++ b/cpp/src/qpid/Options.h @@ -23,13 +23,25 @@ */ #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; @@ -37,7 +49,7 @@ namespace po=boost::program_options; ///@internal -std::string prettyArg(const std::string&, const std::string&); +QPID_COMMON_EXTERN std::string prettyArg(const std::string&, const std::string&); /** @internal Normally only constructed by optValue() */ template <class T> @@ -192,24 +204,20 @@ options_description_less_easy_init #endif - - - - struct Options : public po::options_description { struct Exception : public qpid::Exception { Exception(const std::string& msg) : qpid::Exception(msg) {} }; - Options(const std::string& name=std::string()); + 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. */ - void parse(int argc, char const* const* argv, + QPID_COMMON_EXTERN void parse(int argc, char const* const* argv, const std::string& configfile=std::string(), bool allowUnknown = false); @@ -242,7 +250,7 @@ struct Options : public po::options_description { * Standard options for configuration */ struct CommonOptions : public Options { - CommonOptions(const std::string& name=std::string(), + QPID_COMMON_EXTERN CommonOptions(const std::string& name=std::string(), const std::string& configfile=std::string()); bool help; bool version; diff --git a/cpp/src/qpid/Plugin.h b/cpp/src/qpid/Plugin.h index 50d8e01227..913152f9e1 100644 --- a/cpp/src/qpid/Plugin.h +++ b/cpp/src/qpid/Plugin.h @@ -24,6 +24,7 @@ #include <boost/noncopyable.hpp> #include <boost/function.hpp> #include <vector> +#include "qpid/CommonImportExport.h" /**@file Generic plug-in framework. */ @@ -46,10 +47,10 @@ class Plugin : private boost::noncopyable { { public: /** Calls finalize() if not already called. */ - virtual ~Target(); + QPID_COMMON_EXTERN virtual ~Target(); /** Run all the finalizers */ - void finalize(); + QPID_COMMON_EXTERN void finalize(); /** Add a function to run when finalize() is called */ void addFinalizer(const boost::function<void()>&); @@ -65,9 +66,9 @@ class Plugin : private boost::noncopyable { * member variable in a library so it is registered during * initialization when the library is loaded. */ - Plugin(); + QPID_COMMON_EXTERN Plugin(); - virtual ~Plugin(); + QPID_COMMON_EXTERN virtual ~Plugin(); /** * Configuration options for the plugin. @@ -76,7 +77,7 @@ class Plugin : private boost::noncopyable { * @return An options group or 0 for no options. Default returns 0. * Plugin retains ownership of return value. */ - virtual Options* getOptions(); + QPID_COMMON_EXTERN virtual Options* getOptions(); /** * Initialize Plugin functionality on a Target, called before @@ -101,16 +102,16 @@ class Plugin : private boost::noncopyable { /** List of registered Plugin objects. * Caller must not delete plugin pointers. */ - static const Plugins& getPlugins(); + QPID_COMMON_EXTERN static const Plugins& getPlugins(); /** Call earlyInitialize() on all registered plugins */ - static void earlyInitAll(Target&); + QPID_COMMON_EXTERN static void earlyInitAll(Target&); /** Call initialize() on all registered plugins */ - static void initializeAll(Target&); + QPID_COMMON_EXTERN static void initializeAll(Target&); /** For each registered plugin, add plugin.getOptions() to opts. */ - static void addOptions(Options& opts); + QPID_COMMON_EXTERN static void addOptions(Options& opts); }; } // namespace qpid diff --git a/cpp/src/qpid/SessionId.h b/cpp/src/qpid/SessionId.h index 291c42a2bb..bf52f9856b 100644 --- a/cpp/src/qpid/SessionId.h +++ b/cpp/src/qpid/SessionId.h @@ -24,6 +24,7 @@ #include <boost/operators.hpp> #include <string> +#include <qpid/CommonImportExport.h> namespace qpid { @@ -42,16 +43,16 @@ class SessionId : boost::totally_ordered1<SessionId> { std::string userId; std::string name; public: - SessionId(const std::string& userId=std::string(), const std::string& name=std::string()); + 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; } - bool operator<(const SessionId&) const ; - bool operator==(const SessionId& id) const; + QPID_COMMON_EXTERN bool operator<(const SessionId&) const ; + QPID_COMMON_EXTERN bool operator==(const SessionId& id) const; // Convert to a string - std::string str() const; + QPID_COMMON_EXTERN std::string str() const; }; -std::ostream& operator<<(std::ostream&, const SessionId&); +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SessionId&); } // namespace qpid diff --git a/cpp/src/qpid/SessionState.h b/cpp/src/qpid/SessionState.h index e99875c489..da28738546 100644 --- a/cpp/src/qpid/SessionState.h +++ b/cpp/src/qpid/SessionState.h @@ -31,6 +31,7 @@ #include <boost/range/iterator_range.hpp> #include <vector> #include <iosfwd> +#include <qpid/CommonImportExport.h> namespace qpid { using framing::SequenceNumber; @@ -38,19 +39,19 @@ using framing::SequenceSet; /** A point in the session. Points to command id + offset */ struct SessionPoint : boost::totally_ordered1<SessionPoint> { - SessionPoint(SequenceNumber command = 0, uint64_t offset = 0); + QPID_COMMON_EXTERN SessionPoint(SequenceNumber command = 0, uint64_t offset = 0); SequenceNumber command; uint64_t offset; /** Advance past frame f */ - void advance(const framing::AMQFrame& f); + QPID_COMMON_EXTERN void advance(const framing::AMQFrame& f); - bool operator<(const SessionPoint&) const; - bool operator==(const SessionPoint&) const; + QPID_COMMON_EXTERN bool operator<(const SessionPoint&) const; + QPID_COMMON_EXTERN bool operator==(const SessionPoint&) const; }; -std::ostream& operator<<(std::ostream&, const SessionPoint&); +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SessionPoint&); /** * Support for session idempotence barrier and resume as defined in @@ -78,14 +79,14 @@ class SessionState { typedef boost::iterator_range<ReplayList::iterator> ReplayRange; struct Configuration { - Configuration(size_t flush=1024*1024, size_t hard=0); + QPID_COMMON_EXTERN Configuration(size_t flush=1024*1024, size_t hard=0); size_t replayFlushLimit; // Flush when the replay list >= N bytes. 0 disables. size_t replayHardLimit; // Kill session if replay list > N bytes. 0 disables. }; - SessionState(const SessionId& =SessionId(), const Configuration& =Configuration()); + QPID_COMMON_EXTERN SessionState(const SessionId& =SessionId(), const Configuration& =Configuration()); - virtual ~SessionState(); + QPID_COMMON_EXTERN virtual ~SessionState(); bool hasState() const; @@ -100,78 +101,78 @@ class SessionState { // ==== Functions for sender state. /** Record frame f for replay. Should not be called during replay. */ - virtual void senderRecord(const framing::AMQFrame& f); + QPID_COMMON_EXTERN virtual void senderRecord(const framing::AMQFrame& f); /** @return true if we should send flush for confirmed and completed commands. */ - virtual bool senderNeedFlush() const; + QPID_COMMON_EXTERN virtual bool senderNeedFlush() const; /** Called when flush for confirmed and completed commands is sent to peer. */ - virtual void senderRecordFlush(); + QPID_COMMON_EXTERN virtual void senderRecordFlush(); /** True if we should reply to the next incoming completed command */ - virtual bool senderNeedKnownCompleted() const; + QPID_COMMON_EXTERN virtual bool senderNeedKnownCompleted() const; /** Called when knownCompleted is sent to peer. */ - virtual void senderRecordKnownCompleted(); + QPID_COMMON_EXTERN virtual void senderRecordKnownCompleted(); /** Called when the peer confirms up to comfirmed. */ - virtual void senderConfirmed(const SessionPoint& confirmed); + QPID_COMMON_EXTERN virtual void senderConfirmed(const SessionPoint& confirmed); /** Called when the peer indicates commands completed */ - virtual void senderCompleted(const SequenceSet& commands); + QPID_COMMON_EXTERN virtual void senderCompleted(const SequenceSet& commands); /** Point from which the next new (not replayed) data will be sent. */ - virtual SessionPoint senderGetCommandPoint(); + QPID_COMMON_EXTERN virtual SessionPoint senderGetCommandPoint(); /** Set of outstanding incomplete commands */ - virtual SequenceSet senderGetIncomplete() const; + QPID_COMMON_EXTERN virtual SequenceSet senderGetIncomplete() const; /** Point from which we can replay. */ - virtual SessionPoint senderGetReplayPoint() const; + QPID_COMMON_EXTERN virtual SessionPoint senderGetReplayPoint() const; /** Peer expecting commands from this point. *@return Range of frames to be replayed. */ - virtual ReplayRange senderExpected(const SessionPoint& expected); + QPID_COMMON_EXTERN virtual ReplayRange senderExpected(const SessionPoint& expected); // ==== Functions for receiver state /** Set the command point. */ - virtual void receiverSetCommandPoint(const SessionPoint& point); + QPID_COMMON_EXTERN virtual void receiverSetCommandPoint(const SessionPoint& point); /** Returns true if frame should be be processed, false if it is a duplicate. */ - virtual bool receiverRecord(const framing::AMQFrame& f); + QPID_COMMON_EXTERN virtual bool receiverRecord(const framing::AMQFrame& f); /** Command completed locally */ - virtual void receiverCompleted(SequenceNumber command, bool cumulative=false); + QPID_COMMON_EXTERN virtual void receiverCompleted(SequenceNumber command, bool cumulative=false); /** Peer has indicated commands are known completed */ - virtual void receiverKnownCompleted(const SequenceSet& commands); + QPID_COMMON_EXTERN virtual void receiverKnownCompleted(const SequenceSet& commands); /** True if the next completed control should set the timely-reply argument * to request a knonw-completed response. */ - virtual bool receiverNeedKnownCompleted() const; + QPID_COMMON_EXTERN virtual bool receiverNeedKnownCompleted() const; /** Get the incoming command point */ - virtual const SessionPoint& receiverGetExpected() const; + QPID_COMMON_EXTERN virtual const SessionPoint& receiverGetExpected() const; /** Get the received high-water-mark, may be > getExpected() during replay */ - virtual const SessionPoint& receiverGetReceived() const; + QPID_COMMON_EXTERN virtual const SessionPoint& receiverGetReceived() const; /** Completed received commands that the peer may not know about. */ - virtual const SequenceSet& receiverGetUnknownComplete() const; + QPID_COMMON_EXTERN virtual const SequenceSet& receiverGetUnknownComplete() const; /** Incomplete received commands. */ - virtual const SequenceSet& receiverGetIncomplete() const; + QPID_COMMON_EXTERN virtual const SequenceSet& receiverGetIncomplete() const; /** ID of the command currently being handled. */ - virtual SequenceNumber receiverGetCurrent() const; + QPID_COMMON_EXTERN virtual SequenceNumber receiverGetCurrent() const; /** Set the state variables, used to create a session that will resume * from some previously established point. */ - virtual void setState( + QPID_COMMON_EXTERN virtual void setState( const SequenceNumber& replayStart, const SequenceNumber& sendCommandPoint, const SequenceSet& sentIncomplete, @@ -183,7 +184,7 @@ class SessionState { /** * So called 'push' bridges work by faking a subscribe request - * (and the accompanyingflows etc) to the local broker to initiate + * (and the accompanying flows etc) to the local broker to initiate * the outflow of messages for the bridge. * * As the peer doesn't send these it cannot include them in its @@ -192,8 +193,8 @@ class SessionState { * received messages to be disabled for the faked commands and * subsequently re-enabled. */ - void disableReceiverTracking(); - void enableReceiverTracking(); + QPID_COMMON_EXTERN void disableReceiverTracking(); + QPID_COMMON_EXTERN void enableReceiverTracking(); private: diff --git a/cpp/src/qpid/StringUtils.h b/cpp/src/qpid/StringUtils.h index 3120e43334..4130fae017 100644 --- a/cpp/src/qpid/StringUtils.h +++ b/cpp/src/qpid/StringUtils.h @@ -22,6 +22,8 @@ * */ +#include "qpid/CommonImportExport.h" + #include <string> #include <vector> @@ -31,12 +33,12 @@ namespace qpid { * Split 'in' into words using delimiters in 'delims' and put * resulting strings into 'out' vector. */ -void split(std::vector<std::string>& out, const std::string& in, const std::string& delims); +QPID_COMMON_EXTERN void split(std::vector<std::string>& out, const std::string& in, const std::string& delims); /** * Split 'in' into words using delimiters in 'delims' and return the * resulting strings in a vector. */ -std::vector<std::string> split(const std::string& in, const std::string& delims); +QPID_COMMON_EXTERN std::vector<std::string> split(const std::string& in, const std::string& delims); } // namespace qpid diff --git a/cpp/src/qpid/Url.h b/cpp/src/qpid/Url.h index 07ca46e70c..353eac28f3 100644 --- a/cpp/src/qpid/Url.h +++ b/cpp/src/qpid/Url.h @@ -25,10 +25,11 @@ #include <vector> #include <new> #include <ostream> +#include "qpid/CommonImportExport.h" namespace qpid { -std::ostream& operator<<(std::ostream& os, const TcpAddress& a); +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> { @@ -38,12 +39,12 @@ struct Url : public std::vector<Address> { /** Url with local IP address(es), may be more than one address * on a multi-homed host. */ - static Url getIpAddressesUrl(uint16_t port); + QPID_COMMON_EXTERN static Url getIpAddressesUrl(uint16_t port); struct Invalid : public Exception { Invalid(const std::string& s); }; /** Convert to string form. */ - std::string str() const; + QPID_COMMON_EXTERN std::string str() const; /** Empty URL. */ Url() {} @@ -62,14 +63,14 @@ struct Url : public std::vector<Address> { Url& operator=(const std::string& s) { parse(s); return *this; } /** Throw Invalid if the URL does not contain any addresses. */ - void throwIfEmpty() const; + 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. */ - void parse(const char* url); - void parse(const std::string& url) { parse(url.c_str()); } + 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 @@ -84,8 +85,8 @@ struct Url : public std::vector<Address> { 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(); } -std::ostream& operator<<(std::ostream& os, const Url& url); -std::istream& operator>>(std::istream& is, Url& url); +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 diff --git a/cpp/src/qpid/amqp_0_10/Connection.h b/cpp/src/qpid/amqp_0_10/Connection.h index 743a7de3aa..3e0a5d1ee8 100644 --- a/cpp/src/qpid/amqp_0_10/Connection.h +++ b/cpp/src/qpid/amqp_0_10/Connection.h @@ -27,6 +27,7 @@ #include "qpid/sys/ConnectionInputHandler.h" #include "qpid/sys/ConnectionOutputHandler.h" #include "qpid/sys/Mutex.h" +#include "qpid/broker/BrokerImportExport.h" #include <boost/intrusive_ptr.hpp> #include <memory> #include <deque> @@ -56,8 +57,8 @@ class Connection : public sys::ConnectionCodec, size_t buffered; public: - Connection(sys::OutputControl&, const std::string& id, bool isClient); - void setInputHandler(std::auto_ptr<sys::ConnectionInputHandler> c); + QPID_BROKER_EXTERN Connection(sys::OutputControl&, const std::string& id, bool isClient); + QPID_BROKER_EXTERN void setInputHandler(std::auto_ptr<sys::ConnectionInputHandler> c); size_t decode(const char* buffer, size_t size); size_t encode(const char* buffer, size_t size); bool isClosed() const; diff --git a/cpp/src/qpid/amqp_0_10/SessionHandler.h b/cpp/src/qpid/amqp_0_10/SessionHandler.h index d7af7dd6c7..0b158ec2b4 100644 --- a/cpp/src/qpid/amqp_0_10/SessionHandler.h +++ b/cpp/src/qpid/amqp_0_10/SessionHandler.h @@ -26,6 +26,7 @@ #include "qpid/framing/AMQP_AllProxy.h" #include "qpid/framing/AMQP_AllOperations.h" #include "qpid/SessionState.h" +#include "qpid/CommonImportExport.h" namespace qpid { @@ -43,8 +44,8 @@ class SessionHandler : public framing::AMQP_AllOperations::SessionHandler, public framing::FrameHandler::InOutHandler { public: - SessionHandler(framing::FrameHandler* out=0, uint16_t channel=0); - ~SessionHandler(); + QPID_COMMON_EXTERN SessionHandler(framing::FrameHandler* out=0, uint16_t channel=0); + QPID_COMMON_EXTERN ~SessionHandler(); void setChannel(uint16_t ch) { channel = ch; } uint16_t getChannel() const { return channel.get(); } @@ -55,35 +56,35 @@ class SessionHandler : public framing::AMQP_AllOperations::SessionHandler, virtual framing::FrameHandler* getInHandler() = 0; // Non-protocol methods, called locally to initiate some action. - void sendDetach(); - void sendCompletion(); - void sendAttach(bool force); - void sendTimeout(uint32_t t); - void sendFlush(); - void markReadyToSend();//TODO: only needed for inter-broker bridge; cleanup + QPID_COMMON_EXTERN void sendDetach(); + QPID_COMMON_EXTERN void sendCompletion(); + QPID_COMMON_EXTERN void sendAttach(bool force); + QPID_COMMON_EXTERN void sendTimeout(uint32_t t); + QPID_COMMON_EXTERN void sendFlush(); + QPID_COMMON_EXTERN void markReadyToSend();//TODO: only needed for inter-broker bridge; cleanup /** True if the handler is ready to send and receive */ bool ready() const; // Protocol methods - void attach(const std::string& name, bool force); - void attached(const std::string& name); - void detach(const std::string& name); - void detached(const std::string& name, uint8_t code); - - void requestTimeout(uint32_t t); - void timeout(uint32_t t); - - void commandPoint(const framing::SequenceNumber& id, uint64_t offset); - void expected(const framing::SequenceSet& commands, const framing::Array& fragments); - void confirmed(const framing::SequenceSet& commands,const framing::Array& fragments); - void completed(const framing::SequenceSet& commands, bool timelyReply); - void knownCompleted(const framing::SequenceSet& commands); - void flush(bool expected, bool confirmed, bool completed); - void gap(const framing::SequenceSet& commands); + QPID_COMMON_EXTERN void attach(const std::string& name, bool force); + QPID_COMMON_EXTERN void attached(const std::string& name); + QPID_COMMON_EXTERN void detach(const std::string& name); + QPID_COMMON_EXTERN void detached(const std::string& name, uint8_t code); + + QPID_COMMON_EXTERN void requestTimeout(uint32_t t); + QPID_COMMON_EXTERN void timeout(uint32_t t); + + QPID_COMMON_EXTERN void commandPoint(const framing::SequenceNumber& id, uint64_t offset); + QPID_COMMON_EXTERN void expected(const framing::SequenceSet& commands, const framing::Array& fragments); + QPID_COMMON_EXTERN void confirmed(const framing::SequenceSet& commands,const framing::Array& fragments); + QPID_COMMON_EXTERN void completed(const framing::SequenceSet& commands, bool timelyReply); + QPID_COMMON_EXTERN void knownCompleted(const framing::SequenceSet& commands); + QPID_COMMON_EXTERN void flush(bool expected, bool confirmed, bool completed); + QPID_COMMON_EXTERN void gap(const framing::SequenceSet& commands); protected: - virtual void invoke(const framing::AMQMethodBody& m); + QPID_COMMON_EXTERN virtual void invoke(const framing::AMQMethodBody& m); virtual void setState(const std::string& sessionName, bool force) = 0; virtual void channelException(framing::session::DetachCode code, const std::string& msg) = 0; @@ -94,9 +95,9 @@ class SessionHandler : public framing::AMQP_AllOperations::SessionHandler, virtual void readyToSend() {} virtual void readyToReceive() {} - virtual void handleDetach(); - virtual void handleIn(framing::AMQFrame&); - virtual void handleOut(framing::AMQFrame&); + QPID_COMMON_EXTERN virtual void handleDetach(); + QPID_COMMON_EXTERN virtual void handleIn(framing::AMQFrame&); + QPID_COMMON_EXTERN virtual void handleOut(framing::AMQFrame&); framing::ChannelHandler channel; framing::AMQP_AllProxy::Session peer; diff --git a/cpp/src/qpid/broker/Broker.h b/cpp/src/qpid/broker/Broker.h index a52a0f67e0..5a1529a3ba 100644 --- a/cpp/src/qpid/broker/Broker.h +++ b/cpp/src/qpid/broker/Broker.h @@ -22,6 +22,7 @@ * */ +#include "BrokerImportExport.h" #include "ConnectionFactory.h" #include "ConnectionToken.h" #include "DirectExchange.h" @@ -80,15 +81,16 @@ struct NoSuchTransportException : qpid::Exception * A broker instance. */ class Broker : public sys::Runnable, public Plugin::Target, - public management::Manageable, public RefCounted + public management::Manageable, + public RefCounted { - public: +public: struct Options : public qpid::Options { static const std::string DEFAULT_DATA_DIR_LOCATION; static const std::string DEFAULT_DATA_DIR_NAME; - Options(const std::string& name="Broker Options"); + QPID_BROKER_EXTERN Options(const std::string& name="Broker Options"); bool noDataDir; std::string dataDir; @@ -148,9 +150,9 @@ class Broker : public sys::Runnable, public Plugin::Target, virtual ~Broker(); - Broker(const Options& configuration); - static boost::intrusive_ptr<Broker> create(const Options& configuration); - static boost::intrusive_ptr<Broker> create(int16_t port = DEFAULT_PORT); + QPID_BROKER_EXTERN Broker(const Options& configuration); + static QPID_BROKER_EXTERN boost::intrusive_ptr<Broker> create(const Options& configuration); + static QPID_BROKER_EXTERN boost::intrusive_ptr<Broker> create(int16_t port = DEFAULT_PORT); /** * Return listening port. If called before bind this is @@ -169,7 +171,7 @@ class Broker : public sys::Runnable, public Plugin::Target, /** Shut down the broker */ virtual void shutdown(); - void setStore (MessageStore*); + QPID_BROKER_EXTERN void setStore (MessageStore*); MessageStore& getStore() { return *store; } void setAcl (AclModule* _acl) {acl = _acl;} AclModule* getAcl() { return acl; } @@ -229,7 +231,7 @@ class Broker : public sys::Runnable, public Plugin::Target, boost::function<std::vector<Url> ()> getKnownBrokers; - static const std::string TCP_TRANSPORT; + static QPID_BROKER_EXTERN const std::string TCP_TRANSPORT; void setRecovery(bool set) { recovery = set; } bool getRecovery() const { return recovery; } diff --git a/cpp/src/qpid/broker/BrokerImportExport.h b/cpp/src/qpid/broker/BrokerImportExport.h new file mode 100644 index 0000000000..2edc90993e --- /dev/null +++ b/cpp/src/qpid/broker/BrokerImportExport.h @@ -0,0 +1,33 @@ +#ifndef QPID_BROKER_IMPORT_EXPORT_H +#define QPID_BROKER_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_BROKER_STATIC) +#if defined(BROKER_EXPORT) +#define QPID_BROKER_EXTERN __declspec(dllexport) +#else +#define QPID_BROKER_EXTERN __declspec(dllimport) +#endif +#else +#define QPID_BROKER_EXTERN +#endif + +#endif diff --git a/cpp/src/qpid/broker/BrokerSingleton.h b/cpp/src/qpid/broker/BrokerSingleton.h index 22b707506b..3a842ee05a 100644 --- a/cpp/src/qpid/broker/BrokerSingleton.h +++ b/cpp/src/qpid/broker/BrokerSingleton.h @@ -20,6 +20,7 @@ */ #include "Broker.h" +#include "BrokerImportExport.h" namespace qpid { namespace broker { @@ -36,7 +37,7 @@ namespace broker { * * THREAD UNSAFE. */ -class BrokerSingleton : public boost::intrusive_ptr<Broker> +class QPID_BROKER_EXTERN BrokerSingleton : public boost::intrusive_ptr<Broker> { public: BrokerSingleton(); diff --git a/cpp/src/qpid/broker/DeliverableMessage.h b/cpp/src/qpid/broker/DeliverableMessage.h index f5db473c22..ad944c746b 100644 --- a/cpp/src/qpid/broker/DeliverableMessage.h +++ b/cpp/src/qpid/broker/DeliverableMessage.h @@ -21,6 +21,7 @@ #ifndef _DeliverableMessage_ #define _DeliverableMessage_ +#include "BrokerImportExport.h" #include "Deliverable.h" #include "Queue.h" #include "Message.h" @@ -32,10 +33,10 @@ namespace qpid { class DeliverableMessage : public Deliverable{ boost::intrusive_ptr<Message> msg; public: - DeliverableMessage(const boost::intrusive_ptr<Message>& msg); - virtual void deliverTo(const boost::shared_ptr<Queue>& queue); - Message& getMessage(); - uint64_t contentSize(); + QPID_BROKER_EXTERN DeliverableMessage(const boost::intrusive_ptr<Message>& msg); + QPID_BROKER_EXTERN virtual void deliverTo(const boost::shared_ptr<Queue>& queue); + QPID_BROKER_EXTERN Message& getMessage(); + QPID_BROKER_EXTERN uint64_t contentSize(); virtual ~DeliverableMessage(){} }; } diff --git a/cpp/src/qpid/broker/DeliveryRecord.h b/cpp/src/qpid/broker/DeliveryRecord.h index d7ccab0726..2b2d4d0515 100644 --- a/cpp/src/qpid/broker/DeliveryRecord.h +++ b/cpp/src/qpid/broker/DeliveryRecord.h @@ -26,6 +26,7 @@ #include <vector> #include <ostream> #include "qpid/framing/SequenceSet.h" +#include "BrokerImportExport.h" #include "Queue.h" #include "QueuedMessage.h" #include "DeliveryId.h" @@ -74,17 +75,16 @@ class DeliveryRecord const uint32_t credit; public: - DeliveryRecord( - const QueuedMessage& msg, - const Queue::shared_ptr& queue, - const std::string& tag, - bool acquired, - bool accepted, - bool windowing, - uint32_t credit=0 // Only used if msg is empty. + QPID_BROKER_EXTERN DeliveryRecord(const QueuedMessage& msg, + const Queue::shared_ptr& queue, + const std::string& tag, + bool acquired, + bool accepted, + bool windowing, + uint32_t credit=0 // Only used if msg is empty. ); - bool matches(DeliveryId tag) const; + QPID_BROKER_EXTERN bool matches(DeliveryId tag) const; bool matchOrAfter(DeliveryId tag) const; bool after(DeliveryId tag) const; bool coveredBy(const framing::SequenceSet* const range) const; @@ -119,7 +119,7 @@ class DeliveryRecord const QueuedMessage& getMessage() const { return msg; } framing::SequenceNumber getId() const { return id; } Queue::shared_ptr getQueue() const { return queue; } - friend bool operator<(const DeliveryRecord&, const DeliveryRecord&); + friend QPID_BROKER_EXTERN bool operator<(const DeliveryRecord&, const DeliveryRecord&); friend std::ostream& operator<<(std::ostream&, const DeliveryRecord&); }; diff --git a/cpp/src/qpid/broker/DirectExchange.h b/cpp/src/qpid/broker/DirectExchange.h index ba60469df8..27d101c4fe 100644 --- a/cpp/src/qpid/broker/DirectExchange.h +++ b/cpp/src/qpid/broker/DirectExchange.h @@ -23,6 +23,7 @@ #include <map> #include <vector> +#include "BrokerImportExport.h" #include "Exchange.h" #include "qpid/framing/FieldTable.h" #include "qpid/sys/CopyOnWriteArray.h" @@ -44,18 +45,27 @@ class DirectExchange : public virtual Exchange { public: static const std::string typeName; - DirectExchange(const std::string& name, management::Manageable* parent = 0); - DirectExchange(const string& _name, bool _durable, - const qpid::framing::FieldTable& _args, management::Manageable* parent = 0); + QPID_BROKER_EXTERN DirectExchange(const std::string& name, + management::Manageable* parent = 0); + QPID_BROKER_EXTERN DirectExchange(const string& _name, + bool _durable, + const qpid::framing::FieldTable& _args, + management::Manageable* parent = 0); virtual std::string getType() const { return typeName; } - virtual bool bind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual bool bind(Queue::shared_ptr queue, + const std::string& routingKey, + const qpid::framing::FieldTable* args); virtual bool unbind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args); - virtual void route(Deliverable& msg, const std::string& routingKey, const qpid::framing::FieldTable* args); - virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args); + QPID_BROKER_EXTERN virtual void route(Deliverable& msg, + const std::string& routingKey, + const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual bool isBound(Queue::shared_ptr queue, + const string* const routingKey, + const qpid::framing::FieldTable* const args); - virtual ~DirectExchange(); + QPID_BROKER_EXTERN virtual ~DirectExchange(); virtual bool supportsDynamicBinding() { return true; } }; diff --git a/cpp/src/qpid/broker/DtxBuffer.h b/cpp/src/qpid/broker/DtxBuffer.h index b302632037..ce37d09b7a 100644 --- a/cpp/src/qpid/broker/DtxBuffer.h +++ b/cpp/src/qpid/broker/DtxBuffer.h @@ -21,6 +21,7 @@ #ifndef _DtxBuffer_ #define _DtxBuffer_ +#include "BrokerImportExport.h" #include "TxBuffer.h" #include "qpid/sys/Mutex.h" @@ -37,9 +38,9 @@ namespace qpid { public: typedef boost::shared_ptr<DtxBuffer> shared_ptr; - DtxBuffer(const std::string& xid = ""); - ~DtxBuffer(); - void markEnded(); + QPID_BROKER_EXTERN DtxBuffer(const std::string& xid = ""); + QPID_BROKER_EXTERN ~DtxBuffer(); + QPID_BROKER_EXTERN void markEnded(); bool isEnded(); void setSuspended(bool suspended); bool isSuspended(); diff --git a/cpp/src/qpid/broker/DtxWorkRecord.h b/cpp/src/qpid/broker/DtxWorkRecord.h index 6677784c32..21fc759d66 100644 --- a/cpp/src/qpid/broker/DtxWorkRecord.h +++ b/cpp/src/qpid/broker/DtxWorkRecord.h @@ -21,6 +21,7 @@ #ifndef _DtxWorkRecord_ #define _DtxWorkRecord_ +#include "BrokerImportExport.h" #include "DtxBuffer.h" #include "DtxTimeout.h" #include "TransactionalStore.h" @@ -61,12 +62,13 @@ class DtxWorkRecord void abort(); bool prepare(TransactionContext* txn); public: - DtxWorkRecord(const std::string& xid, TransactionalStore* const store); - ~DtxWorkRecord(); - bool prepare(); - bool commit(bool onePhase); - void rollback(); - void add(DtxBuffer::shared_ptr ops); + QPID_BROKER_EXTERN DtxWorkRecord(const std::string& xid, + TransactionalStore* const store); + QPID_BROKER_EXTERN ~DtxWorkRecord(); + QPID_BROKER_EXTERN bool prepare(); + QPID_BROKER_EXTERN bool commit(bool onePhase); + QPID_BROKER_EXTERN void rollback(); + QPID_BROKER_EXTERN void add(DtxBuffer::shared_ptr ops); void recover(std::auto_ptr<TPCTransactionContext> txn, DtxBuffer::shared_ptr ops); void timedout(); void setTimeout(boost::intrusive_ptr<DtxTimeout> t) { timeout = t; } diff --git a/cpp/src/qpid/broker/Exchange.h b/cpp/src/qpid/broker/Exchange.h index 3f9cc4c800..9260222342 100644 --- a/cpp/src/qpid/broker/Exchange.h +++ b/cpp/src/qpid/broker/Exchange.h @@ -23,6 +23,7 @@ */ #include <boost/shared_ptr.hpp> +#include "BrokerImportExport.h" #include "Deliverable.h" #include "Queue.h" #include "MessageStore.h" @@ -123,7 +124,7 @@ public: explicit Exchange(const std::string& name, management::Manageable* parent = 0); Exchange(const std::string& _name, bool _durable, const qpid::framing::FieldTable& _args, management::Manageable* parent = 0); - virtual ~Exchange(); + QPID_BROKER_EXTERN virtual ~Exchange(); const std::string& getName() const { return name; } bool isDurable() { return durable; } @@ -146,9 +147,9 @@ public: void setPersistenceId(uint64_t id) const; uint64_t getPersistenceId() const { return persistenceId; } uint32_t encodedSize() const; - virtual void encode(framing::Buffer& buffer) const; + QPID_BROKER_EXTERN virtual void encode(framing::Buffer& buffer) const; - static Exchange::shared_ptr decode(ExchangeRegistry& exchanges, framing::Buffer& buffer); + static QPID_BROKER_EXTERN Exchange::shared_ptr decode(ExchangeRegistry& exchanges, framing::Buffer& buffer); // Manageable entry points management::ManagementObject* GetManagementObject(void) const; diff --git a/cpp/src/qpid/broker/ExchangeRegistry.h b/cpp/src/qpid/broker/ExchangeRegistry.h index 787b7896f0..9ca432e41c 100644 --- a/cpp/src/qpid/broker/ExchangeRegistry.h +++ b/cpp/src/qpid/broker/ExchangeRegistry.h @@ -22,6 +22,7 @@ * */ +#include "BrokerImportExport.h" #include "Exchange.h" #include "MessageStore.h" #include "qpid/framing/FieldTable.h" @@ -45,13 +46,17 @@ class ExchangeRegistry{ bool, const qpid::framing::FieldTable&, qpid::management::Manageable*> FactoryFunction; ExchangeRegistry () : parent(0) {} - std::pair<Exchange::shared_ptr, bool> declare(const std::string& name, const std::string& type) + QPID_BROKER_EXTERN std::pair<Exchange::shared_ptr, bool> declare + (const std::string& name, const std::string& type) throw(UnknownExchangeTypeException); - std::pair<Exchange::shared_ptr, bool> declare(const std::string& name, const std::string& type, - bool durable, const qpid::framing::FieldTable& args = framing::FieldTable()) - throw(UnknownExchangeTypeException); - void destroy(const std::string& name); - Exchange::shared_ptr get(const std::string& name); + QPID_BROKER_EXTERN std::pair<Exchange::shared_ptr, bool> declare + (const std::string& name, + const std::string& type, + bool durable, + const qpid::framing::FieldTable& args = framing::FieldTable()) + throw(UnknownExchangeTypeException); + QPID_BROKER_EXTERN void destroy(const std::string& name); + QPID_BROKER_EXTERN Exchange::shared_ptr get(const std::string& name); Exchange::shared_ptr getDefault(); /** diff --git a/cpp/src/qpid/broker/ExpiryPolicy.h b/cpp/src/qpid/broker/ExpiryPolicy.h index 1b7316f6f9..cefe9b7552 100644 --- a/cpp/src/qpid/broker/ExpiryPolicy.h +++ b/cpp/src/qpid/broker/ExpiryPolicy.h @@ -23,6 +23,7 @@ */ #include "qpid/RefCounted.h" +#include "BrokerImportExport.h" namespace qpid { namespace broker { @@ -35,9 +36,9 @@ class Message; class ExpiryPolicy : public RefCounted { public: - virtual ~ExpiryPolicy(); - virtual void willExpire(Message&); - virtual bool hasExpired(Message&); + QPID_BROKER_EXTERN virtual ~ExpiryPolicy(); + QPID_BROKER_EXTERN virtual void willExpire(Message&); + QPID_BROKER_EXTERN virtual bool hasExpired(Message&); }; }} // namespace qpid::broker diff --git a/cpp/src/qpid/broker/FanOutExchange.h b/cpp/src/qpid/broker/FanOutExchange.h index 5884a19732..edfc4395f4 100644 --- a/cpp/src/qpid/broker/FanOutExchange.h +++ b/cpp/src/qpid/broker/FanOutExchange.h @@ -23,6 +23,7 @@ #include <map> #include <vector> +#include "BrokerImportExport.h" #include "Exchange.h" #include "qpid/framing/FieldTable.h" #include "qpid/sys/CopyOnWriteArray.h" @@ -38,22 +39,30 @@ class FanOutExchange : public virtual Exchange { public: static const std::string typeName; - FanOutExchange(const std::string& name, management::Manageable* parent = 0); - FanOutExchange(const string& _name, bool _durable, - const qpid::framing::FieldTable& _args, - management::Manageable* parent = 0); + QPID_BROKER_EXTERN FanOutExchange(const std::string& name, + management::Manageable* parent = 0); + QPID_BROKER_EXTERN FanOutExchange(const string& _name, + bool _durable, + const qpid::framing::FieldTable& _args, + management::Manageable* parent = 0); virtual std::string getType() const { return typeName; } - virtual bool bind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual bool bind(Queue::shared_ptr queue, + const std::string& routingKey, + const qpid::framing::FieldTable* args); virtual bool unbind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args); - virtual void route(Deliverable& msg, const std::string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual void route(Deliverable& msg, + const std::string& routingKey, + const qpid::framing::FieldTable* args); - virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args); + QPID_BROKER_EXTERN virtual bool isBound(Queue::shared_ptr queue, + const string* const routingKey, + const qpid::framing::FieldTable* const args); - virtual ~FanOutExchange(); + QPID_BROKER_EXTERN virtual ~FanOutExchange(); virtual bool supportsDynamicBinding() { return true; } }; diff --git a/cpp/src/qpid/broker/HeadersExchange.h b/cpp/src/qpid/broker/HeadersExchange.h index e10fab2250..2b01f9ecae 100644 --- a/cpp/src/qpid/broker/HeadersExchange.h +++ b/cpp/src/qpid/broker/HeadersExchange.h @@ -22,6 +22,7 @@ #define _HeadersExchange_ #include <vector> +#include "BrokerImportExport.h" #include "Exchange.h" #include "qpid/framing/FieldTable.h" #include "qpid/sys/CopyOnWriteArray.h" @@ -59,24 +60,32 @@ class HeadersExchange : public virtual Exchange { public: static const std::string typeName; - HeadersExchange(const string& name, management::Manageable* parent = 0); - HeadersExchange(const string& _name, bool _durable, - const qpid::framing::FieldTable& _args, - management::Manageable* parent = 0); + QPID_BROKER_EXTERN HeadersExchange(const string& name, + management::Manageable* parent = 0); + QPID_BROKER_EXTERN HeadersExchange(const string& _name, + bool _durable, + const qpid::framing::FieldTable& _args, + management::Manageable* parent = 0); virtual std::string getType() const { return typeName; } - virtual bool bind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual bool bind(Queue::shared_ptr queue, + const string& routingKey, + const qpid::framing::FieldTable* args); virtual bool unbind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args); - virtual void route(Deliverable& msg, const string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual void route(Deliverable& msg, + const string& routingKey, + const qpid::framing::FieldTable* args); - virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args); + QPID_BROKER_EXTERN virtual bool isBound(Queue::shared_ptr queue, + const string* const routingKey, + const qpid::framing::FieldTable* const args); - virtual ~HeadersExchange(); + QPID_BROKER_EXTERN virtual ~HeadersExchange(); - static bool match(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs); + static QPID_BROKER_EXTERN bool match(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs); static bool equal(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs); }; diff --git a/cpp/src/qpid/broker/IncompleteMessageList.h b/cpp/src/qpid/broker/IncompleteMessageList.h index f89c0023b0..449194d571 100644 --- a/cpp/src/qpid/broker/IncompleteMessageList.h +++ b/cpp/src/qpid/broker/IncompleteMessageList.h @@ -21,6 +21,7 @@ #ifndef _IncompleteMessageList_ #define _IncompleteMessageList_ +#include "BrokerImportExport.h" #include "qpid/sys/Monitor.h" #include "qpid/broker/Message.h" #include <boost/intrusive_ptr.hpp> @@ -43,11 +44,11 @@ class IncompleteMessageList public: typedef Message::MessageCallback CompletionListener; - IncompleteMessageList(); - ~IncompleteMessageList(); + QPID_BROKER_EXTERN IncompleteMessageList(); + QPID_BROKER_EXTERN ~IncompleteMessageList(); - void add(boost::intrusive_ptr<Message> msg); - void process(const CompletionListener& l, bool sync); + QPID_BROKER_EXTERN void add(boost::intrusive_ptr<Message> msg); + QPID_BROKER_EXTERN void process(const CompletionListener& l, bool sync); void each(const CompletionListener& l); }; diff --git a/cpp/src/qpid/broker/Message.h b/cpp/src/qpid/broker/Message.h index dbe56270ab..458c6c7d1a 100644 --- a/cpp/src/qpid/broker/Message.h +++ b/cpp/src/qpid/broker/Message.h @@ -22,6 +22,7 @@ * */ +#include "BrokerImportExport.h" #include "PersistableMessage.h" #include "MessageAdapter.h" #include "qpid/framing/amqp_types.h" @@ -51,8 +52,8 @@ class Message : public PersistableMessage { public: typedef boost::function<void (const boost::intrusive_ptr<Message>&)> MessageCallback; - Message(const framing::SequenceNumber& id = framing::SequenceNumber()); - ~Message(); + QPID_BROKER_EXTERN Message(const framing::SequenceNumber& id = framing::SequenceNumber()); + QPID_BROKER_EXTERN ~Message(); uint64_t getPersistenceId() const { return persistenceId; } void setPersistenceId(uint64_t _persistenceId) const { persistenceId = _persistenceId; } @@ -65,18 +66,18 @@ public: const framing::SequenceNumber& getCommandId() { return frames.getId(); } - uint64_t contentSize() const; + QPID_BROKER_EXTERN uint64_t contentSize() const; - std::string getRoutingKey() const; + QPID_BROKER_EXTERN std::string getRoutingKey() const; const boost::shared_ptr<Exchange> getExchange(ExchangeRegistry&) const; - std::string getExchangeName() const; + QPID_BROKER_EXTERN std::string getExchangeName() const; bool isImmediate() const; - const framing::FieldTable* getApplicationHeaders() const; + QPID_BROKER_EXTERN const framing::FieldTable* getApplicationHeaders() const; framing::FieldTable& getOrInsertHeaders(); - bool isPersistent(); + QPID_BROKER_EXTERN bool isPersistent(); bool requiresAccept(); - void setTimestamp(const boost::intrusive_ptr<ExpiryPolicy>& e); + QPID_BROKER_EXTERN void setTimestamp(const boost::intrusive_ptr<ExpiryPolicy>& e); void setExpiryPolicy(const boost::intrusive_ptr<ExpiryPolicy>& e); bool hasExpired(); sys::AbsTime getExpiration() const { return expiration; } @@ -125,8 +126,8 @@ public: uint32_t encodedHeaderSize() const; uint32_t encodedContentSize() const; - void decodeHeader(framing::Buffer& buffer); - void decodeContent(framing::Buffer& buffer); + QPID_BROKER_EXTERN void decodeHeader(framing::Buffer& buffer); + QPID_BROKER_EXTERN void decodeContent(framing::Buffer& buffer); /** * Releases the in-memory content data held by this @@ -140,7 +141,7 @@ public: void sendContent(const Queue& queue, framing::FrameHandler& out, uint16_t maxFrameSize) const; void sendHeader(framing::FrameHandler& out, uint16_t maxFrameSize) const; - bool isContentLoaded() const; + QPID_BROKER_EXTERN bool isContentLoaded() const; bool isExcluded(const std::vector<std::string>& excludes) const; void addTraceId(const std::string& id); diff --git a/cpp/src/qpid/broker/MessageBuilder.h b/cpp/src/qpid/broker/MessageBuilder.h index 395de024ab..1f5a2a8b84 100644 --- a/cpp/src/qpid/broker/MessageBuilder.h +++ b/cpp/src/qpid/broker/MessageBuilder.h @@ -21,6 +21,7 @@ #ifndef _MessageBuilder_ #define _MessageBuilder_ +#include "BrokerImportExport.h" #include "qpid/framing/FrameHandler.h" #include "qpid/framing/SequenceNumber.h" #include "qpid/RefCounted.h" @@ -34,10 +35,11 @@ namespace qpid { class MessageBuilder : public framing::FrameHandler{ public: - MessageBuilder(MessageStore* const store, uint64_t stagingThreshold); - void handle(framing::AMQFrame& frame); + QPID_BROKER_EXTERN MessageBuilder(MessageStore* const store, + uint64_t stagingThreshold); + QPID_BROKER_EXTERN void handle(framing::AMQFrame& frame); boost::intrusive_ptr<Message> getMessage() { return message; } - void start(const framing::SequenceNumber& id); + QPID_BROKER_EXTERN void start(const framing::SequenceNumber& id); void end(); private: enum State {DORMANT, METHOD, HEADER, CONTENT}; diff --git a/cpp/src/qpid/broker/NullMessageStore.h b/cpp/src/qpid/broker/NullMessageStore.h index d99c751d26..a44f8d2804 100644 --- a/cpp/src/qpid/broker/NullMessageStore.h +++ b/cpp/src/qpid/broker/NullMessageStore.h @@ -22,6 +22,7 @@ #define _NullMessageStore_ #include <set> +#include "BrokerImportExport.h" #include "MessageStore.h" #include "Queue.h" @@ -38,46 +39,54 @@ class NullMessageStore : public MessageStore std::set<std::string> prepared; uint64_t nextPersistenceId; public: - NullMessageStore(); + QPID_BROKER_EXTERN NullMessageStore(); - virtual bool init(const Options* options); - virtual std::auto_ptr<TransactionContext> begin(); - virtual std::auto_ptr<TPCTransactionContext> begin(const std::string& xid); - virtual void prepare(TPCTransactionContext& txn); - virtual void commit(TransactionContext& txn); - virtual void abort(TransactionContext& txn); - virtual void collectPreparedXids(std::set<std::string>& xids); + QPID_BROKER_EXTERN virtual bool init(const Options* options); + QPID_BROKER_EXTERN virtual std::auto_ptr<TransactionContext> begin(); + QPID_BROKER_EXTERN virtual std::auto_ptr<TPCTransactionContext> begin(const std::string& xid); + QPID_BROKER_EXTERN virtual void prepare(TPCTransactionContext& txn); + QPID_BROKER_EXTERN virtual void commit(TransactionContext& txn); + QPID_BROKER_EXTERN virtual void abort(TransactionContext& txn); + QPID_BROKER_EXTERN virtual void collectPreparedXids(std::set<std::string>& xids); - virtual void create(PersistableQueue& queue, const framing::FieldTable& args); - virtual void destroy(PersistableQueue& queue); - virtual void create(const PersistableExchange& exchange, const framing::FieldTable& args); - virtual void destroy(const PersistableExchange& exchange); + QPID_BROKER_EXTERN virtual void create(PersistableQueue& queue, + const framing::FieldTable& args); + QPID_BROKER_EXTERN virtual void destroy(PersistableQueue& queue); + QPID_BROKER_EXTERN virtual void create(const PersistableExchange& exchange, + const framing::FieldTable& args); + QPID_BROKER_EXTERN virtual void destroy(const PersistableExchange& exchange); - virtual void bind(const PersistableExchange& exchange, const PersistableQueue& queue, - const std::string& key, const framing::FieldTable& args); - virtual void unbind(const PersistableExchange& exchange, const PersistableQueue& queue, - const std::string& key, const framing::FieldTable& args); - virtual void create(const PersistableConfig& config); - virtual void destroy(const PersistableConfig& config); - virtual void recover(RecoveryManager& queues); - virtual void stage(const boost::intrusive_ptr<PersistableMessage>& msg); - virtual void destroy(PersistableMessage& msg); - virtual void appendContent(const boost::intrusive_ptr<const PersistableMessage>& msg, - const std::string& data); - virtual void loadContent(const qpid::broker::PersistableQueue& queue, - const boost::intrusive_ptr<const PersistableMessage>& msg, std::string& data, - uint64_t offset, uint32_t length); - virtual void enqueue(TransactionContext* ctxt, - const boost::intrusive_ptr<PersistableMessage>& msg, - const PersistableQueue& queue); - virtual void dequeue(TransactionContext* ctxt, - const boost::intrusive_ptr<PersistableMessage>& msg, - const PersistableQueue& queue); - virtual uint32_t outstandingQueueAIO(const PersistableQueue& queue); - virtual void flush(const qpid::broker::PersistableQueue& queue); + QPID_BROKER_EXTERN virtual void bind(const PersistableExchange& exchange, + const PersistableQueue& queue, + const std::string& key, + const framing::FieldTable& args); + QPID_BROKER_EXTERN virtual void unbind(const PersistableExchange& exchange, + const PersistableQueue& queue, + const std::string& key, + const framing::FieldTable& args); + QPID_BROKER_EXTERN virtual void create(const PersistableConfig& config); + QPID_BROKER_EXTERN virtual void destroy(const PersistableConfig& config); + QPID_BROKER_EXTERN virtual void recover(RecoveryManager& queues); + QPID_BROKER_EXTERN virtual void stage(const boost::intrusive_ptr<PersistableMessage>& msg); + QPID_BROKER_EXTERN virtual void destroy(PersistableMessage& msg); + QPID_BROKER_EXTERN virtual void appendContent(const boost::intrusive_ptr<const PersistableMessage>& msg, + const std::string& data); + QPID_BROKER_EXTERN virtual void loadContent(const qpid::broker::PersistableQueue& queue, + const boost::intrusive_ptr<const PersistableMessage>& msg, + std::string& data, + uint64_t offset, + uint32_t length); + QPID_BROKER_EXTERN virtual void enqueue(TransactionContext* ctxt, + const boost::intrusive_ptr<PersistableMessage>& msg, + const PersistableQueue& queue); + QPID_BROKER_EXTERN virtual void dequeue(TransactionContext* ctxt, + const boost::intrusive_ptr<PersistableMessage>& msg, + const PersistableQueue& queue); + QPID_BROKER_EXTERN virtual uint32_t outstandingQueueAIO(const PersistableQueue& queue); + QPID_BROKER_EXTERN virtual void flush(const qpid::broker::PersistableQueue& queue); ~NullMessageStore(){} - virtual bool isNull() const; + QPID_BROKER_EXTERN virtual bool isNull() const; static bool isNullStore(const MessageStore*); }; diff --git a/cpp/src/qpid/broker/PersistableMessage.h b/cpp/src/qpid/broker/PersistableMessage.h index 4f2e3abafa..92f89ba578 100644 --- a/cpp/src/qpid/broker/PersistableMessage.h +++ b/cpp/src/qpid/broker/PersistableMessage.h @@ -26,6 +26,7 @@ #include <list> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> +#include "BrokerImportExport.h" #include "Persistable.h" #include "qpid/framing/amqp_types.h" #include "qpid/sys/Mutex.h" @@ -93,21 +94,23 @@ class PersistableMessage : public Persistable bool isContentReleased() const; - bool isEnqueueComplete(); + QPID_BROKER_EXTERN bool isEnqueueComplete(); - void enqueueComplete(); + QPID_BROKER_EXTERN void enqueueComplete(); - void enqueueAsync(PersistableQueue::shared_ptr queue, MessageStore* _store); + QPID_BROKER_EXTERN void enqueueAsync(PersistableQueue::shared_ptr queue, + MessageStore* _store); - void enqueueAsync(); + QPID_BROKER_EXTERN void enqueueAsync(); - bool isDequeueComplete(); + QPID_BROKER_EXTERN bool isDequeueComplete(); - void dequeueComplete(); + QPID_BROKER_EXTERN void dequeueComplete(); - void dequeueAsync(PersistableQueue::shared_ptr queue, MessageStore* _store); + QPID_BROKER_EXTERN void dequeueAsync(PersistableQueue::shared_ptr queue, + MessageStore* _store); - void dequeueAsync(); + QPID_BROKER_EXTERN void dequeueAsync(); }; }} diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h index f149cb71ea..d1f71581d6 100644 --- a/cpp/src/qpid/broker/Queue.h +++ b/cpp/src/qpid/broker/Queue.h @@ -21,6 +21,8 @@ * under the License. * */ + +#include "BrokerImportExport.h" #include "OwnershipToken.h" #include "Consumer.h" #include "Message.h" @@ -152,13 +154,14 @@ namespace qpid { typedef std::vector<shared_ptr> vector; - Queue(const string& name, bool autodelete = false, - MessageStore* const store = 0, - const OwnershipToken* const owner = 0, - management::Manageable* parent = 0); - ~Queue(); + QPID_BROKER_EXTERN Queue(const string& name, + bool autodelete = false, + MessageStore* const store = 0, + const OwnershipToken* const owner = 0, + management::Manageable* parent = 0); + QPID_BROKER_EXTERN ~Queue(); - bool dispatch(Consumer::shared_ptr); + QPID_BROKER_EXTERN bool dispatch(Consumer::shared_ptr); /** * Check whether there would be a message available for * dispatch to this consumer. If not, the consumer will be @@ -170,24 +173,28 @@ namespace qpid { void create(const qpid::framing::FieldTable& settings); // "recovering" means we are doing a MessageStore recovery. - void configure(const qpid::framing::FieldTable& settings, bool recovering = false); + QPID_BROKER_EXTERN void configure(const qpid::framing::FieldTable& settings, + bool recovering = false); void destroy(); - void bound(const string& exchange, const string& key, const qpid::framing::FieldTable& args); - void unbind(ExchangeRegistry& exchanges, Queue::shared_ptr shared_ref); + QPID_BROKER_EXTERN void bound(const string& exchange, + const string& key, + const qpid::framing::FieldTable& args); + QPID_BROKER_EXTERN void unbind(ExchangeRegistry& exchanges, + Queue::shared_ptr shared_ref); - bool acquire(const QueuedMessage& msg); + QPID_BROKER_EXTERN bool acquire(const QueuedMessage& msg); bool acquireMessageAt(const qpid::framing::SequenceNumber& position, QueuedMessage& message); /** * Delivers a message to the queue. Will record it as * enqueued if persistent then process it. */ - void deliver(boost::intrusive_ptr<Message>& msg); + QPID_BROKER_EXTERN void deliver(boost::intrusive_ptr<Message>& msg); /** * Dispatches the messages immediately to a consumer if * one is available or stores it for later if not. */ - void process(boost::intrusive_ptr<Message>& msg); + QPID_BROKER_EXTERN void process(boost::intrusive_ptr<Message>& msg); /** * Returns a message to the in-memory queue (due to lack * of acknowledegement from a receiver). If a consumer is @@ -200,17 +207,18 @@ namespace qpid { */ void recover(boost::intrusive_ptr<Message>& msg); - void consume(Consumer::shared_ptr c, bool exclusive = false); - void cancel(Consumer::shared_ptr c); + QPID_BROKER_EXTERN void consume(Consumer::shared_ptr c, + bool exclusive = false); + QPID_BROKER_EXTERN void cancel(Consumer::shared_ptr c); uint32_t purge(const uint32_t purge_request = 0); //defaults to all messages - void purgeExpired(); + QPID_BROKER_EXTERN void purgeExpired(); //move qty # of messages to destination Queue destq uint32_t move(const Queue::shared_ptr destq, uint32_t qty); - uint32_t getMessageCount() const; - uint32_t getConsumerCount() const; + QPID_BROKER_EXTERN uint32_t getMessageCount() const; + QPID_BROKER_EXTERN uint32_t getConsumerCount() const; inline const string& getName() const { return name; } bool isExclusiveOwner(const OwnershipToken* const o) const; void releaseExclusiveOwnership(); @@ -226,8 +234,8 @@ namespace qpid { /** * used to take messages from in memory and flush down to disk. */ - void setLastNodeFailure(); - void clearLastNodeFailure(); + QPID_BROKER_EXTERN void setLastNodeFailure(); + QPID_BROKER_EXTERN void clearLastNodeFailure(); bool enqueue(TransactionContext* ctxt, boost::intrusive_ptr<Message> msg); /** @@ -243,7 +251,7 @@ namespace qpid { /** * Gets the next available message */ - QueuedMessage get(); + QPID_BROKER_EXTERN QueuedMessage get(); /** Get the message at position pos */ QueuedMessage find(framing::SequenceNumber pos) const; diff --git a/cpp/src/qpid/broker/QueueCleaner.h b/cpp/src/qpid/broker/QueueCleaner.h index 7903266f5f..007826f33e 100644 --- a/cpp/src/qpid/broker/QueueCleaner.h +++ b/cpp/src/qpid/broker/QueueCleaner.h @@ -22,6 +22,7 @@ * */ +#include "BrokerImportExport.h" #include "Timer.h" namespace qpid { @@ -34,8 +35,8 @@ class QueueRegistry; class QueueCleaner { public: - QueueCleaner(QueueRegistry& queues, Timer& timer); - void start(qpid::sys::Duration period); + QPID_BROKER_EXTERN QueueCleaner(QueueRegistry& queues, Timer& timer); + QPID_BROKER_EXTERN void start(qpid::sys::Duration period); private: class Task : public TimerTask { diff --git a/cpp/src/qpid/broker/QueueEvents.h b/cpp/src/qpid/broker/QueueEvents.h index b0a07b03f2..82abd3d20a 100644 --- a/cpp/src/qpid/broker/QueueEvents.h +++ b/cpp/src/qpid/broker/QueueEvents.h @@ -22,6 +22,7 @@ * */ +#include "BrokerImportExport.h" #include "QueuedMessage.h" #include "qpid/sys/Mutex.h" #include "qpid/sys/PollableQueue.h" @@ -48,21 +49,22 @@ class QueueEvents EventType type; QueuedMessage msg; - Event(EventType, const QueuedMessage&); + QPID_BROKER_EXTERN Event(EventType, const QueuedMessage&); }; typedef boost::function<void (Event)> EventListener; - QueueEvents(const boost::shared_ptr<sys::Poller>& poller); - ~QueueEvents(); - void enqueued(const QueuedMessage&); - void dequeued(const QueuedMessage&); - void registerListener(const std::string& id, const EventListener&); - void unregisterListener(const std::string& id); + QPID_BROKER_EXTERN QueueEvents(const boost::shared_ptr<sys::Poller>& poller); + QPID_BROKER_EXTERN ~QueueEvents(); + QPID_BROKER_EXTERN void enqueued(const QueuedMessage&); + QPID_BROKER_EXTERN void dequeued(const QueuedMessage&); + QPID_BROKER_EXTERN void registerListener(const std::string& id, + const EventListener&); + QPID_BROKER_EXTERN void unregisterListener(const std::string& id); void enable(); void disable(); //process all outstanding events - void shutdown(); + QPID_BROKER_EXTERN void shutdown(); private: typedef qpid::sys::PollableQueue<Event> EventQueue; typedef std::map<std::string, EventListener> Listeners; diff --git a/cpp/src/qpid/broker/QueuePolicy.h b/cpp/src/qpid/broker/QueuePolicy.h index 0e8c15aa0e..45992f87ac 100644 --- a/cpp/src/qpid/broker/QueuePolicy.h +++ b/cpp/src/qpid/broker/QueuePolicy.h @@ -24,6 +24,7 @@ #include <deque> #include <iostream> #include <memory> +#include "BrokerImportExport.h" #include "QueuedMessage.h" #include "qpid/framing/FieldTable.h" #include "qpid/sys/AtomicValue.h" @@ -47,20 +48,20 @@ class QueuePolicy static std::string getType(const qpid::framing::FieldTable& settings); public: - static const std::string maxCountKey; - static const std::string maxSizeKey; - static const std::string typeKey; - static const std::string REJECT; - static const std::string FLOW_TO_DISK; - static const std::string RING; - static const std::string RING_STRICT; + static QPID_BROKER_EXTERN const std::string maxCountKey; + static QPID_BROKER_EXTERN const std::string maxSizeKey; + static QPID_BROKER_EXTERN const std::string typeKey; + static QPID_BROKER_EXTERN const std::string REJECT; + static QPID_BROKER_EXTERN const std::string FLOW_TO_DISK; + static QPID_BROKER_EXTERN const std::string RING; + static QPID_BROKER_EXTERN const std::string RING_STRICT; virtual ~QueuePolicy() {} - void tryEnqueue(const QueuedMessage&); + QPID_BROKER_EXTERN void tryEnqueue(const QueuedMessage&); virtual void dequeued(const QueuedMessage&); virtual bool isEnqueued(const QueuedMessage&); virtual bool checkLimit(const QueuedMessage&); - void update(qpid::framing::FieldTable& settings); + QPID_BROKER_EXTERN void update(qpid::framing::FieldTable& settings); uint32_t getMaxCount() const { return maxCount; } uint64_t getMaxSize() const { return maxSize; } void encode(framing::Buffer& buffer) const; @@ -68,10 +69,11 @@ class QueuePolicy uint32_t encodedSize() const; - static std::auto_ptr<QueuePolicy> createQueuePolicy(const qpid::framing::FieldTable& settings); - static std::auto_ptr<QueuePolicy> createQueuePolicy(uint32_t maxCount, uint64_t maxSize, const std::string& type = REJECT); + static QPID_BROKER_EXTERN std::auto_ptr<QueuePolicy> createQueuePolicy(const qpid::framing::FieldTable& settings); + static QPID_BROKER_EXTERN std::auto_ptr<QueuePolicy> createQueuePolicy(uint32_t maxCount, uint64_t maxSize, const std::string& type = REJECT); static void setDefaultMaxSize(uint64_t); - friend std::ostream& operator<<(std::ostream&, const QueuePolicy&); + friend QPID_BROKER_EXTERN std::ostream& operator<<(std::ostream&, + const QueuePolicy&); protected: QueuePolicy(uint32_t maxCount, uint64_t maxSize, const std::string& type = REJECT); diff --git a/cpp/src/qpid/broker/QueueRegistry.h b/cpp/src/qpid/broker/QueueRegistry.h index 32634dd563..3c02afedc4 100644 --- a/cpp/src/qpid/broker/QueueRegistry.h +++ b/cpp/src/qpid/broker/QueueRegistry.h @@ -21,6 +21,7 @@ #ifndef _QueueRegistry_ #define _QueueRegistry_ +#include "BrokerImportExport.h" #include "Queue.h" #include "qpid/sys/Mutex.h" #include "qpid/management/Manageable.h" @@ -40,10 +41,10 @@ class QueueEvents; * are deleted when and only when they are no longer in use. * */ -class QueueRegistry{ +class QueueRegistry { public: - QueueRegistry(); - ~QueueRegistry(); + QPID_BROKER_EXTERN QueueRegistry(); + QPID_BROKER_EXTERN ~QueueRegistry(); /** * Declare a queue. @@ -51,8 +52,11 @@ class QueueRegistry{ * @return The queue and a boolean flag which is true if the queue * was created by this declare call false if it already existed. */ - std::pair<Queue::shared_ptr, bool> declare(const string& name, bool durable = false, bool autodelete = false, - const OwnershipToken* owner = 0); + QPID_BROKER_EXTERN std::pair<Queue::shared_ptr, bool> declare + (const string& name, + bool durable = false, + bool autodelete = false, + const OwnershipToken* owner = 0); /** * Destroy the named queue. @@ -66,7 +70,7 @@ class QueueRegistry{ * subsequent calls to find or declare with the same name. * */ - void destroy (const string& name); + QPID_BROKER_EXTERN void destroy(const string& name); template <class Test> bool destroyIf(const string& name, Test test) { qpid::sys::RWlock::ScopedWlock locker(lock); @@ -81,7 +85,7 @@ class QueueRegistry{ /** * Find the named queue. Return 0 if not found. */ - Queue::shared_ptr find(const string& name); + QPID_BROKER_EXTERN Queue::shared_ptr find(const string& name); /** * Generate unique queue name. diff --git a/cpp/src/qpid/broker/RetryList.h b/cpp/src/qpid/broker/RetryList.h index 013233ef00..3cdba72ecf 100644 --- a/cpp/src/qpid/broker/RetryList.h +++ b/cpp/src/qpid/broker/RetryList.h @@ -22,6 +22,7 @@ * */ +#include "BrokerImportExport.h" #include "qpid/Address.h" #include "qpid/Url.h" @@ -35,9 +36,9 @@ namespace broker { class RetryList { public: - RetryList(); - void reset(const std::vector<Url>& urls); - bool next(TcpAddress& address); + QPID_BROKER_EXTERN RetryList(); + QPID_BROKER_EXTERN void reset(const std::vector<Url>& urls); + QPID_BROKER_EXTERN bool next(TcpAddress& address); private: std::vector<Url> urls; size_t urlIndex; diff --git a/cpp/src/qpid/broker/SessionState.h b/cpp/src/qpid/broker/SessionState.h index b64461eb86..bdfed87905 100644 --- a/cpp/src/qpid/broker/SessionState.h +++ b/cpp/src/qpid/broker/SessionState.h @@ -56,7 +56,7 @@ class Message; class SessionHandler; class SessionManager; class RateFlowcontrol; -class TimerTask; +struct TimerTask; /** * Broker-side session state includes session's handler chains, which diff --git a/cpp/src/qpid/broker/Timer.h b/cpp/src/qpid/broker/Timer.h index be4ac9d056..564fec5804 100644 --- a/cpp/src/qpid/broker/Timer.h +++ b/cpp/src/qpid/broker/Timer.h @@ -21,6 +21,7 @@ #ifndef _Timer_ #define _Timer_ +#include "BrokerImportExport.h" #include "qpid/sys/Monitor.h" #include "qpid/sys/Thread.h" #include "qpid/sys/Runnable.h" @@ -43,9 +44,9 @@ struct TimerTask : public RefCounted { qpid::sys::AbsTime time; volatile bool cancelled; - TimerTask(qpid::sys::Duration timeout); + QPID_BROKER_EXTERN TimerTask(qpid::sys::Duration timeout); TimerTask(qpid::sys::AbsTime time); - virtual ~TimerTask(); + QPID_BROKER_EXTERN virtual ~TimerTask(); void reset(); void cancel(); bool isCancelled() const; @@ -69,10 +70,10 @@ class Timer : private qpid::sys::Runnable { virtual void run(); public: - Timer(); - virtual ~Timer(); + QPID_BROKER_EXTERN Timer(); + QPID_BROKER_EXTERN virtual ~Timer(); - void add(boost::intrusive_ptr<TimerTask> task); + QPID_BROKER_EXTERN void add(boost::intrusive_ptr<TimerTask> task); void start(); void stop(); diff --git a/cpp/src/qpid/broker/TopicExchange.h b/cpp/src/qpid/broker/TopicExchange.h index f3a2e221f7..24bf5f7bca 100644 --- a/cpp/src/qpid/broker/TopicExchange.h +++ b/cpp/src/qpid/broker/TopicExchange.h @@ -23,6 +23,7 @@ #include <map> #include <vector> +#include "BrokerImportExport.h" #include "Exchange.h" #include "qpid/framing/FieldTable.h" #include "qpid/sys/Monitor.h" @@ -40,7 +41,7 @@ class Tokens : public std::vector<std::string> { /** Tokenize s, provides automatic conversion of string to Tokens */ Tokens(const std::string& s) { operator=(s); } /** Tokenizing assignment operator s */ - Tokens & operator=(const std::string& s); + QPID_BROKER_EXTERN Tokens & operator=(const std::string& s); void key(std::string& key) const; private: @@ -60,12 +61,12 @@ class TopicPattern : public Tokens // Default copy, assign, dtor are sufficient. TopicPattern(const Tokens& tokens) { operator=(tokens); } TopicPattern(const std::string& str) { operator=(str); } - TopicPattern& operator=(const Tokens&); + QPID_BROKER_EXTERN TopicPattern& operator=(const Tokens&); TopicPattern& operator=(const std::string& str) { return operator=(Tokens(str)); } /** Match a topic */ bool match(const std::string& topic) { return match(Tokens(topic)); } - bool match(const Tokens& topic) const; + QPID_BROKER_EXTERN bool match(const Tokens& topic) const; private: void normalize(); @@ -84,21 +85,30 @@ class TopicExchange : public virtual Exchange { public: static const std::string typeName; - TopicExchange(const string& name, management::Manageable* parent = 0); - TopicExchange(const string& _name, bool _durable, - const qpid::framing::FieldTable& _args, management::Manageable* parent = 0); + QPID_BROKER_EXTERN TopicExchange(const string& name, + management::Manageable* parent = 0); + QPID_BROKER_EXTERN TopicExchange(const string& _name, + bool _durable, + const qpid::framing::FieldTable& _args, + management::Manageable* parent = 0); virtual std::string getType() const { return typeName; } - virtual bool bind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual bool bind(Queue::shared_ptr queue, + const string& routingKey, + const qpid::framing::FieldTable* args); virtual bool unbind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args); - virtual void route(Deliverable& msg, const string& routingKey, const qpid::framing::FieldTable* args); + QPID_BROKER_EXTERN virtual void route(Deliverable& msg, + const string& routingKey, + const qpid::framing::FieldTable* args); - virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args); + QPID_BROKER_EXTERN virtual bool isBound(Queue::shared_ptr queue, + const string* const routingKey, + const qpid::framing::FieldTable* const args); - virtual ~TopicExchange(); + QPID_BROKER_EXTERN virtual ~TopicExchange(); virtual bool supportsDynamicBinding() { return true; } }; diff --git a/cpp/src/qpid/broker/TxBuffer.h b/cpp/src/qpid/broker/TxBuffer.h index aabb5ea0b1..f63a65f115 100644 --- a/cpp/src/qpid/broker/TxBuffer.h +++ b/cpp/src/qpid/broker/TxBuffer.h @@ -24,6 +24,7 @@ #include <algorithm> #include <functional> #include <vector> +#include "BrokerImportExport.h" #include "TransactionalStore.h" #include "TxOp.h" @@ -68,7 +69,7 @@ namespace qpid { /** * Adds an operation to the transaction. */ - void enlist(TxOp::shared_ptr op); + QPID_BROKER_EXTERN void enlist(TxOp::shared_ptr op); /** * Requests that all ops are prepared. This should @@ -81,7 +82,7 @@ namespace qpid { * @returns true if all the operations prepared * successfully, false if not. */ - bool prepare(TransactionContext* const ctxt); + QPID_BROKER_EXTERN bool prepare(TransactionContext* const ctxt); /** * Signals that the ops all prepared successfully and can @@ -91,7 +92,7 @@ namespace qpid { * Should only be called after a call to prepare() returns * true. */ - void commit(); + QPID_BROKER_EXTERN void commit(); /** * Signals that all ops can be rolled back. @@ -100,13 +101,13 @@ namespace qpid { * returns true (2pc) or instead of a prepare call * ('server-local') */ - void rollback(); + QPID_BROKER_EXTERN void rollback(); /** * Helper method for managing the process of server local * commit */ - bool commitLocal(TransactionalStore* const store); + QPID_BROKER_EXTERN bool commitLocal(TransactionalStore* const store); // Used by cluster to replicate transaction status. void accept(TxOpConstVisitor& v) const; diff --git a/cpp/src/qpid/broker/TxPublish.h b/cpp/src/qpid/broker/TxPublish.h index 1f73cb8767..ebe3b51f3d 100644 --- a/cpp/src/qpid/broker/TxPublish.h +++ b/cpp/src/qpid/broker/TxPublish.h @@ -21,6 +21,7 @@ #ifndef _TxPublish_ #define _TxPublish_ +#include "BrokerImportExport.h" #include "Queue.h" #include "Deliverable.h" #include "Message.h" @@ -65,19 +66,19 @@ namespace qpid { std::list<Queue::shared_ptr> queues; public: - TxPublish(boost::intrusive_ptr<Message> msg); - virtual bool prepare(TransactionContext* ctxt) throw(); - virtual void commit() throw(); - virtual void rollback() throw(); + QPID_BROKER_EXTERN TxPublish(boost::intrusive_ptr<Message> msg); + QPID_BROKER_EXTERN virtual bool prepare(TransactionContext* ctxt) throw(); + QPID_BROKER_EXTERN virtual void commit() throw(); + QPID_BROKER_EXTERN virtual void rollback() throw(); virtual Message& getMessage() { return *msg; }; - virtual void deliverTo(const boost::shared_ptr<Queue>& queue); + QPID_BROKER_EXTERN virtual void deliverTo(const boost::shared_ptr<Queue>& queue); virtual ~TxPublish(){} virtual void accept(TxOpConstVisitor& visitor) const { visitor(*this); } - uint64_t contentSize(); + QPID_BROKER_EXTERN uint64_t contentSize(); boost::intrusive_ptr<Message> getMessage() const { return msg; } const std::list<Queue::shared_ptr> getQueues() const { return queues; } diff --git a/cpp/src/qpid/client/ClientImportExport.h b/cpp/src/qpid/client/ClientImportExport.h new file mode 100644 index 0000000000..0e6e5660d6 --- /dev/null +++ b/cpp/src/qpid/client/ClientImportExport.h @@ -0,0 +1,33 @@ +#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) +#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/Connection.h b/cpp/src/qpid/client/Connection.h index 03631ef56f..846ac33790 100644 --- a/cpp/src/qpid/client/Connection.h +++ b/cpp/src/qpid/client/Connection.h @@ -24,6 +24,7 @@ #include <map> #include <string> #include "qpid/client/Session.h" +#include "qpid/client/ClientImportExport.h" namespace qpid { @@ -58,9 +59,9 @@ class Connection * Creates a connection object, but does not open the connection. * @see open() */ - Connection(); + QPID_CLIENT_EXTERN Connection(); - ~Connection(); + QPID_CLIENT_EXTERN ~Connection(); /** * Opens a connection to a broker. @@ -79,7 +80,7 @@ class Connection * hosts, where implemented(!), provide namespace partitioning * within a single broker). */ - void open(const std::string& host, int port = 5672, + 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); @@ -101,7 +102,7 @@ class Connection * hosts, where implemented(!), provide namespace partitioning * within a single broker). */ - void open(const Url& url, + 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); @@ -116,14 +117,14 @@ class Connection * @param settings used for any settings not provided by the URL. * Settings provided by the url (e.g. host, port) are ignored. */ - void open(const Url& url, const ConnectionSettings& settings); + 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. */ - void open(const ConnectionSettings& settings); + QPID_CLIENT_EXTERN void open(const ConnectionSettings& settings); /** * Close the connection. @@ -131,7 +132,7 @@ class Connection * Any further use of this connection (without reopening it) will * not succeed. */ - void close(); + QPID_CLIENT_EXTERN void close(); /** * Create a new session on this connection. Sessions allow @@ -174,23 +175,23 @@ class Connection * If the name is empty (the default) then a unique name will be * chosen using a Universally-unique identifier (UUID) algorithm. */ - Session newSession(const std::string& name=std::string(), uint32_t timeoutSeconds = 0); + 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. */ - void resume(Session& session); + QPID_CLIENT_EXTERN void resume(Session& session); - bool isOpen() const; + QPID_CLIENT_EXTERN bool isOpen() const; - std::vector<Url> getKnownBrokers(); - void registerFailureCallback ( boost::function<void ()> fn ); + QPID_CLIENT_EXTERN std::vector<Url> getKnownBrokers(); + QPID_CLIENT_EXTERN void registerFailureCallback ( boost::function<void ()> fn ); /** * Return the set of client negotiated settings */ - const ConnectionSettings& getNegotiatedSettings(); + QPID_CLIENT_EXTERN const ConnectionSettings& getNegotiatedSettings(); friend class ConnectionAccess; ///<@internal friend class SessionBase_0_10; ///<@internal diff --git a/cpp/src/qpid/client/ConnectionSettings.h b/cpp/src/qpid/client/ConnectionSettings.h index f60b11a4ab..71fef219b4 100644 --- a/cpp/src/qpid/client/ConnectionSettings.h +++ b/cpp/src/qpid/client/ConnectionSettings.h @@ -25,6 +25,7 @@ #include "qpid/Options.h" #include "qpid/log/Options.h" #include "qpid/Url.h" +#include "qpid/client/ClientImportExport.h" #include <iostream> #include <exception> @@ -42,14 +43,14 @@ namespace client { */ struct ConnectionSettings { - ConnectionSettings(); - virtual ~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. */ - virtual void configureSocket(qpid::sys::Socket&) const; + QPID_CLIENT_EXTERN virtual void configureSocket(qpid::sys::Socket&) const; /** * The protocol used for the connection (defaults to 'tcp') diff --git a/cpp/src/qpid/client/FailoverManager.h b/cpp/src/qpid/client/FailoverManager.h index 8b6eeda8a1..bef5e18840 100644 --- a/cpp/src/qpid/client/FailoverManager.h +++ b/cpp/src/qpid/client/FailoverManager.h @@ -27,6 +27,7 @@ #include "qpid/Exception.h" #include "qpid/client/AsyncSession.h" #include "qpid/sys/Monitor.h" +#include "qpid/client/ClientImportExport.h" #include <vector> namespace qpid { @@ -84,7 +85,7 @@ class FailoverManager * to edit or reorder the list of urls to which reconnection is * attempted */ - FailoverManager(const ConnectionSettings& settings, ReconnectionStrategy* strategy = 0); + 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 @@ -95,15 +96,15 @@ class FailoverManager * If the full list is tried and all attempts fail, * CannotConnectException is thrown. */ - Connection& connect(std::vector<Url> brokers = std::vector<Url>()); + QPID_CLIENT_EXTERN Connection& connect(std::vector<Url> brokers = std::vector<Url>()); /** * Return the current connection whether open or not */ - Connection& getConnection(); + QPID_CLIENT_EXTERN Connection& getConnection(); /** * Close the current connection */ - void close(); + 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, @@ -116,7 +117,7 @@ class FailoverManager * on failover to ensure they continue to use the same logical * connection. */ - void execute(Command&); + QPID_CLIENT_EXTERN void execute(Command&); private: enum State {IDLE, CONNECTING, CANT_CONNECT}; diff --git a/cpp/src/qpid/client/Future.h b/cpp/src/qpid/client/Future.h index 67f39cdf3f..ea01522fe8 100644 --- a/cpp/src/qpid/client/Future.h +++ b/cpp/src/qpid/client/Future.h @@ -30,6 +30,7 @@ #include "FutureCompletion.h" #include "FutureResult.h" #include "SessionImpl.h" +#include "ClientImportExport.h" namespace qpid { namespace client { @@ -54,9 +55,9 @@ public: } } - void wait(SessionImpl& session); - bool isComplete(SessionImpl& session); - void setFutureResult(boost::shared_ptr<FutureResult> r); + QPID_CLIENT_EXTERN void wait(SessionImpl& session); + QPID_CLIENT_EXTERN bool isComplete(SessionImpl& session); + QPID_CLIENT_EXTERN void setFutureResult(boost::shared_ptr<FutureResult> r); }; }} diff --git a/cpp/src/qpid/client/FutureResult.h b/cpp/src/qpid/client/FutureResult.h index e97d80476d..64428c0341 100644 --- a/cpp/src/qpid/client/FutureResult.h +++ b/cpp/src/qpid/client/FutureResult.h @@ -23,6 +23,8 @@ #define _FutureResult_ #include <string> + +#include "ClientImportExport.h" #include "qpid/framing/amqp_framing.h" #include "FutureCompletion.h" @@ -36,7 +38,7 @@ class FutureResult : public FutureCompletion { std::string result; public: - const std::string& getResult(SessionImpl& session) const; + QPID_CLIENT_EXTERN const std::string& getResult(SessionImpl& session) const; void received(const std::string& result); }; diff --git a/cpp/src/qpid/client/Handle.h b/cpp/src/qpid/client/Handle.h index 4fd82b7646..d8b822d0f9 100644 --- a/cpp/src/qpid/client/Handle.h +++ b/cpp/src/qpid/client/Handle.h @@ -22,6 +22,8 @@ * */ +#include "qpid/client/ClientImportExport.h" + namespace qpid { namespace client { @@ -34,23 +36,23 @@ template <class T> class HandlePrivate; */ template <class T> class Handle { public: - ~Handle(); - Handle(const Handle&); - Handle& operator=(const Handle&); + QPID_CLIENT_EXTERN ~Handle(); + QPID_CLIENT_EXTERN Handle(const Handle&); + QPID_CLIENT_EXTERN Handle& operator=(const Handle&); /**@return true if handle is valid, i.e. not null. */ - bool isValid() const { return impl; } + 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. */ - bool isNull() const { return !impl; } + QPID_CLIENT_EXTERN bool isNull() const { return !impl; } - operator bool() const { return impl; } - bool operator !() const { return impl; } + QPID_CLIENT_EXTERN operator bool() const { return impl; } + QPID_CLIENT_EXTERN bool operator !() const { return impl; } - void swap(Handle<T>&); + QPID_CLIENT_EXTERN void swap(Handle<T>&); protected: - Handle(T* =0); + QPID_CLIENT_EXTERN Handle(T* =0); T* impl; friend class HandlePrivate<T>; diff --git a/cpp/src/qpid/client/LocalQueue.h b/cpp/src/qpid/client/LocalQueue.h index 30ea00612d..5b739d4303 100644 --- a/cpp/src/qpid/client/LocalQueue.h +++ b/cpp/src/qpid/client/LocalQueue.h @@ -22,6 +22,7 @@ * */ +#include "ClientImportExport.h" #include "qpid/client/Message.h" #include "qpid/client/Subscription.h" #include "qpid/client/Demux.h" @@ -75,16 +76,16 @@ class LocalQueue { * * LocalQueue is an alternative to implementing a MessageListener. */ - LocalQueue(); + QPID_CLIENT_EXTERN LocalQueue(); - ~LocalQueue(); + QPID_CLIENT_EXTERN ~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. */ - bool get(Message& result, sys::Duration timeout=0); + 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. @@ -92,16 +93,16 @@ class LocalQueue { *@return message from the queue. *@throw ClosedException if subscription is closed or timeout exceeded. */ - Message get(sys::Duration timeout=sys::TIME_INFINITE); + QPID_CLIENT_EXTERN Message get(sys::Duration timeout=sys::TIME_INFINITE); /** Synonym for get() */ - Message pop(sys::Duration timeout=sys::TIME_INFINITE); + QPID_CLIENT_EXTERN Message pop(sys::Duration timeout=sys::TIME_INFINITE); /** Return true if local queue is empty. */ - bool empty() const; + QPID_CLIENT_EXTERN bool empty() const; /** Number of messages on the local queue */ - size_t size() const; + QPID_CLIENT_EXTERN size_t size() const; private: Demux::QueuePtr queue; diff --git a/cpp/src/qpid/client/Message.h b/cpp/src/qpid/client/Message.h index 3f932efd8b..235e20f97d 100644 --- a/cpp/src/qpid/client/Message.h +++ b/cpp/src/qpid/client/Message.h @@ -25,6 +25,7 @@ #include "qpid/client/Session.h" #include "qpid/framing/MessageTransferBody.h" #include "qpid/framing/TransferContent.h" +#include "qpid/client/ClientImportExport.h" namespace qpid { namespace client { @@ -111,7 +112,7 @@ public: *@param data Data for the message body. *@param routingKey Passed to the exchange that routes the message. */ - Message(const std::string& data=std::string(), + QPID_CLIENT_EXTERN Message(const std::string& data=std::string(), const std::string& routingKey=std::string()); /** The destination of messages sent to the broker is the exchange @@ -119,26 +120,26 @@ public: * the delivery tag identifyig the local subscription (often this * is the name of the subscribed queue.) */ - std::string getDestination() const; + QPID_CLIENT_EXTERN std::string getDestination() const; /** Check the redelivered flag. */ - bool isRedelivered() const; + QPID_CLIENT_EXTERN bool isRedelivered() const; /** Set the redelivered flag. */ - void setRedelivered(bool redelivered); + QPID_CLIENT_EXTERN void setRedelivered(bool redelivered); /** Get a modifyable reference to the message headers. */ - framing::FieldTable& getHeaders(); + QPID_CLIENT_EXTERN framing::FieldTable& getHeaders(); /** Get a non-modifyable reference to the message headers. */ - const framing::FieldTable& getHeaders() const; + QPID_CLIENT_EXTERN const framing::FieldTable& getHeaders() const; ///@internal - const framing::MessageTransferBody& getMethod() const; + QPID_CLIENT_EXTERN const framing::MessageTransferBody& getMethod() const; ///@internal - const framing::SequenceNumber& getId() const; + QPID_CLIENT_EXTERN const framing::SequenceNumber& getId() const; /**@internal for incoming messages */ - Message(const framing::FrameSet& frameset); + QPID_CLIENT_EXTERN Message(const framing::FrameSet& frameset); private: //method and id are only set for received messages: diff --git a/cpp/src/qpid/client/MessageListener.h b/cpp/src/qpid/client/MessageListener.h index 75aad6521b..b86aa10c54 100644 --- a/cpp/src/qpid/client/MessageListener.h +++ b/cpp/src/qpid/client/MessageListener.h @@ -19,6 +19,7 @@ * */ #include <string> +#include "qpid/client/ClientImportExport.h" #ifndef _MessageListener_ #define _MessageListener_ @@ -85,7 +86,7 @@ namespace client { class MessageListener{ public: - virtual ~MessageListener(); + QPID_CLIENT_EXTERN virtual ~MessageListener(); /** Called for each message arriving from the broker. Override * in your own subclass to process messages. diff --git a/cpp/src/qpid/client/MessageReplayTracker.h b/cpp/src/qpid/client/MessageReplayTracker.h index 45b16fb704..280cbae4a5 100644 --- a/cpp/src/qpid/client/MessageReplayTracker.h +++ b/cpp/src/qpid/client/MessageReplayTracker.h @@ -23,7 +23,7 @@ */ #include "AsyncSession.h" #include "Message.h" - +#include "qpid/client/ClientImportExport.h" #include <list> #include <string> @@ -37,13 +37,13 @@ namespace client { class MessageReplayTracker { public: - MessageReplayTracker(uint flushInterval); - void send(const Message& message, const std::string& destination = ""); - void init(AsyncSession session); - void replay(AsyncSession session); - void setFlushInterval(uint interval); - uint getFlushInterval(); - void checkCompletion(); + 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++) { diff --git a/cpp/src/qpid/client/QueueOptions.h b/cpp/src/qpid/client/QueueOptions.h index d159378198..57d9487217 100644 --- a/cpp/src/qpid/client/QueueOptions.h +++ b/cpp/src/qpid/client/QueueOptions.h @@ -18,6 +18,8 @@ * under the License. * */ + +#include "ClientImportExport.h" #include "qpid/framing/FieldTable.h" #ifndef _QueueOptions_ @@ -36,8 +38,8 @@ enum QueueOrderingPolicy {FIFO, LVQ, LVQ_NO_BROWSE}; class QueueOptions: public framing::FieldTable { public: - QueueOptions(); - virtual ~QueueOptions(); + QPID_CLIENT_EXTERN QueueOptions(); + QPID_CLIENT_EXTERN virtual ~QueueOptions(); /** * Sets the queue sizing policy @@ -51,58 +53,58 @@ class QueueOptions: public framing::FieldTable * @param maxSize Set the max number of bytes for the sizing policies * @param setMaxCount Set the max number of messages for the sizing policies */ - void setSizePolicy(QueueSizePolicy sp, uint64_t maxSize, uint32_t maxCount ); + 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. */ - void setPersistLastNode(); + QPID_CLIENT_EXTERN void setPersistLastNode(); /** * Sets the odering policy on the Queue, default ordering is FIFO. */ - void setOrdering(QueueOrderingPolicy op); + QPID_CLIENT_EXTERN void setOrdering(QueueOrderingPolicy op); /** * Use broker defualt sizing ploicy */ - void clearSizePolicy(); + QPID_CLIENT_EXTERN void clearSizePolicy(); /** * Clear Persist Last Node Policy */ - void clearPersistLastNode(); + QPID_CLIENT_EXTERN void clearPersistLastNode(); /** * get the key used match LVQ in args for message transfer */ - void getLVQKey(std::string& key); + QPID_CLIENT_EXTERN void getLVQKey(std::string& key); /** * Use default odering policy */ - void clearOrdering(); + 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. */ - void enableQueueEvents(bool enqueueOnly); + QPID_CLIENT_EXTERN void enableQueueEvents(bool enqueueOnly); - static const std::string strMaxCountKey; - static const std::string strMaxSizeKey; - static const std::string strTypeKey; - static const std::string strREJECT; - static const std::string strFLOW_TO_DISK; - static const std::string strRING; - static const std::string strRING_STRICT; - static const std::string strLastValueQueue; - static const std::string strPersistLastNode; - static const std::string strLVQMatchProperty; - static const std::string strLastValueQueueNoBrowse; - static const std::string strQueueEventMode; + 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; }; } diff --git a/cpp/src/qpid/client/SessionBase_0_10.h b/cpp/src/qpid/client/SessionBase_0_10.h index 091c977053..3ae21936f6 100644 --- a/cpp/src/qpid/client/SessionBase_0_10.h +++ b/cpp/src/qpid/client/SessionBase_0_10.h @@ -33,6 +33,7 @@ #include "qpid/client/SessionImpl.h" #include "qpid/client/TypedResult.h" #include "qpid/shared_ptr.h" +#include "qpid/client/ClientImportExport.h" #include <string> namespace qpid { @@ -65,19 +66,19 @@ class SessionBase_0_10 { typedef framing::TransferContent DefaultContent; ///@internal - SessionBase_0_10(); - ~SessionBase_0_10(); + QPID_CLIENT_EXTERN SessionBase_0_10(); + QPID_CLIENT_EXTERN ~SessionBase_0_10(); /** Get the next message frame-set from the session. */ - framing::FrameSet::shared_ptr get(); + QPID_CLIENT_EXTERN framing::FrameSet::shared_ptr get(); /** Get the session ID */ - SessionId getId() const; + QPID_CLIENT_EXTERN SessionId getId() const; /** Close the session. * A session is automatically closed when all handles to it are destroyed. */ - void close(); + QPID_CLIENT_EXTERN void close(); /** * Synchronize the session: sync() waits until all commands issued @@ -88,25 +89,25 @@ class SessionBase_0_10 { * AsyncSession::executionSync() directly in the unusual event * that you want to do an asynchronous sync. */ - void sync(); + QPID_CLIENT_EXTERN void sync(); /** Set the timeout for this session. */ - uint32_t timeout(uint32_t seconds); + QPID_CLIENT_EXTERN uint32_t timeout(uint32_t seconds); /** Suspend the session - detach it from its connection */ - void suspend(); + QPID_CLIENT_EXTERN void suspend(); /** Resume a suspended session with a new connection */ - void resume(Connection); + QPID_CLIENT_EXTERN void resume(Connection); /** Get the channel associated with this session */ - uint16_t getChannel() const; + QPID_CLIENT_EXTERN uint16_t getChannel() const; - Execution& getExecution(); - void flush(); - void markCompleted(const framing::SequenceSet& ids, bool notifyPeer); - void markCompleted(const framing::SequenceNumber& id, bool cumulative, bool notifyPeer); - void sendCompletion(); + QPID_CLIENT_EXTERN Execution& getExecution(); + 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(); protected: boost::shared_ptr<SessionImpl> impl; diff --git a/cpp/src/qpid/client/Subscription.h b/cpp/src/qpid/client/Subscription.h index 47bb5d42a5..43c6100254 100644 --- a/cpp/src/qpid/client/Subscription.h +++ b/cpp/src/qpid/client/Subscription.h @@ -26,6 +26,7 @@ #include "qpid/client/SubscriptionSettings.h" #include "qpid/client/Handle.h" #include "qpid/client/Message.h" +#include "qpid/client/ClientImportExport.h" namespace qpid { namespace client { @@ -39,74 +40,74 @@ class SubscriptionManager; */ class Subscription : public Handle<SubscriptionImpl> { public: - Subscription(SubscriptionImpl* si=0) : Handle<SubscriptionImpl>(si) {} + QPID_CLIENT_EXTERN Subscription(SubscriptionImpl* si=0) : Handle<SubscriptionImpl>(si) {} - /** The name of the subsctription, used as the "destination" for messages from the broker. + /** 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. */ - std::string getName() const; + QPID_CLIENT_EXTERN std::string getName() const; /** Name of the queue this subscription subscribes to */ - std::string getQueue() const; + QPID_CLIENT_EXTERN std::string getQueue() const; /** Get the flow control and acknowledgement settings for this subscription */ - const SubscriptionSettings& getSettings() const; + QPID_CLIENT_EXTERN const SubscriptionSettings& getSettings() const; /** Set the flow control parameters */ - void setFlowControl(const FlowControl&); + 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. */ - void setAutoAck(unsigned int n); + 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 */ - SequenceSet getUnacquired() const; + QPID_CLIENT_EXTERN SequenceSet getUnacquired() const; /** Get the set of ID's for messages received by this subscription but not yet accepted. */ - SequenceSet getUnaccepted() const; + 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. */ - void acquire(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void acquire(const SequenceSet& messageIds); /** Accept messageIds and remove them from the unaccepted set. *@pre messageIds is a subset of getUnaccepted() */ - void accept(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void accept(const SequenceSet& messageIds); /** Release messageIds and remove them from the unaccepted set. *@pre messageIds is a subset of getUnaccepted() */ - void release(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void release(const SequenceSet& messageIds); /* Acquire a single message */ - void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } + QPID_CLIENT_EXTERN void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } /* Accept a single message */ - void accept(const Message& m) { accept(SequenceSet(m.getId())); } + QPID_CLIENT_EXTERN void accept(const Message& m) { accept(SequenceSet(m.getId())); } /* Release a single message */ - void release(const Message& m) { release(SequenceSet(m.getId())); } + QPID_CLIENT_EXTERN void release(const Message& m) { release(SequenceSet(m.getId())); } /** Get the session associated with this subscription */ - Session getSession() const; + QPID_CLIENT_EXTERN Session getSession() const; /** Get the subscription manager associated with this subscription */ - SubscriptionManager& getSubscriptionManager() const; + QPID_CLIENT_EXTERN SubscriptionManager& getSubscriptionManager() const; /** Cancel the subscription. */ - void cancel(); + QPID_CLIENT_EXTERN void cancel(); /** Grant the specified amount of message credit */ - void grantMessageCredit(uint32_t); + QPID_CLIENT_EXTERN void grantMessageCredit(uint32_t); /** Grant the specified amount of byte credit */ - void grantByteCredit(uint32_t); + QPID_CLIENT_EXTERN void grantByteCredit(uint32_t); friend class SubscriptionManager; }; diff --git a/cpp/src/qpid/client/SubscriptionImpl.h b/cpp/src/qpid/client/SubscriptionImpl.h index 74fbacb951..e2b970ce05 100644 --- a/cpp/src/qpid/client/SubscriptionImpl.h +++ b/cpp/src/qpid/client/SubscriptionImpl.h @@ -30,6 +30,7 @@ #include "qpid/framing/SequenceSet.h" #include "qpid/sys/Mutex.h" #include "qpid/RefCounted.h" +#include "qpid/client/ClientImportExport.h" #include <memory> namespace qpid { @@ -39,62 +40,62 @@ class SubscriptionManager; class SubscriptionImpl : public RefCounted, public MessageListener { public: - SubscriptionImpl(SubscriptionManager&, const std::string& queue, + QPID_CLIENT_EXTERN SubscriptionImpl(SubscriptionManager&, const std::string& queue, const SubscriptionSettings&, const std::string& name, MessageListener* =0); /** The name of the subsctription, used as the "destination" for messages from the broker. * Usually the same as the queue name but can be set differently. */ - std::string getName() const; + QPID_CLIENT_EXTERN std::string getName() const; /** Name of the queue this subscription subscribes to */ - std::string getQueue() const; + QPID_CLIENT_EXTERN std::string getQueue() const; /** Get the flow control and acknowledgement settings for this subscription */ - const SubscriptionSettings& getSettings() const; + QPID_CLIENT_EXTERN const SubscriptionSettings& getSettings() const; /** Set the flow control parameters */ - void setFlowControl(const FlowControl&); + 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. */ - void setAutoAck(size_t n); + QPID_CLIENT_EXTERN void setAutoAck(size_t n); /** Get the set of ID's for messages received by this subscription but not yet acquired. * This will always be empty if acquireMode=ACQUIRE_MODE_PRE_ACQUIRED */ - SequenceSet getUnacquired() const; + QPID_CLIENT_EXTERN SequenceSet getUnacquired() const; /** Get the set of ID's for messages acquired by this subscription but not yet accepted. */ - SequenceSet getUnaccepted() const; + QPID_CLIENT_EXTERN SequenceSet getUnaccepted() const; /** Acquire messageIds and remove them from the un-acquired set for the session. */ - void acquire(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void acquire(const SequenceSet& messageIds); /** Accept messageIds and remove them from the un-accepted set for the session. */ - void accept(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void accept(const SequenceSet& messageIds); /** Release messageIds and remove them from the un-accepted set for the session. */ - void release(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void release(const SequenceSet& messageIds); /** Get the session associated with this subscription */ - Session getSession() const; + QPID_CLIENT_EXTERN Session getSession() const; /** Get the subscription manager associated with this subscription */ - SubscriptionManager& getSubscriptionManager() const; + QPID_CLIENT_EXTERN SubscriptionManager& getSubscriptionManager() const; /** Send subscription request and issue appropriate flow control commands. */ - void subscribe(); + QPID_CLIENT_EXTERN void subscribe(); /** Cancel the subscription. */ - void cancel(); + QPID_CLIENT_EXTERN void cancel(); /** Grant specified credit for this subscription **/ - void grantCredit(framing::message::CreditUnit unit, uint32_t value); + QPID_CLIENT_EXTERN void grantCredit(framing::message::CreditUnit unit, uint32_t value); - void received(Message&); + QPID_CLIENT_EXTERN void received(Message&); /** * Set up demux diversion for messages sent to this subscription @@ -104,7 +105,7 @@ class SubscriptionImpl : public RefCounted, public MessageListener { * Cancel any demux diversion that may have been setup for this * subscription */ - void cancelDiversion(); + QPID_CLIENT_EXTERN void cancelDiversion(); private: diff --git a/cpp/src/qpid/client/SubscriptionManager.h b/cpp/src/qpid/client/SubscriptionManager.h index 6b45092931..91ad2b6d56 100644 --- a/cpp/src/qpid/client/SubscriptionManager.h +++ b/cpp/src/qpid/client/SubscriptionManager.h @@ -30,6 +30,7 @@ #include <qpid/client/LocalQueue.h> #include <qpid/client/Subscription.h> #include <qpid/sys/Runnable.h> +#include <qpid/client/ClientImportExport.h> #include <set> #include <sstream> @@ -97,7 +98,7 @@ class SubscriptionManager : public sys::Runnable { public: /** Create a new SubscriptionManager associated with a session */ - SubscriptionManager(const Session& session); + QPID_CLIENT_EXTERN SubscriptionManager(const Session& session); /** * Subscribe a MessagesListener to receive messages from queue. @@ -110,7 +111,7 @@ class SubscriptionManager : public sys::Runnable *@param settings settings for the subscription. *@param name unique destination name for the subscription, defaults to queue name. */ - Subscription subscribe(MessageListener& listener, + QPID_CLIENT_EXTERN Subscription subscribe(MessageListener& listener, const std::string& queue, const SubscriptionSettings& settings, const std::string& name=std::string()); @@ -125,7 +126,7 @@ class SubscriptionManager : public sys::Runnable *@param name unique destination name for the subscription, defaults to queue name. * If not specified, the queue name is used. */ - Subscription subscribe(LocalQueue& localQueue, + QPID_CLIENT_EXTERN Subscription subscribe(LocalQueue& localQueue, const std::string& queue, const SubscriptionSettings& settings, const std::string& name=std::string()); @@ -141,7 +142,7 @@ class SubscriptionManager : public sys::Runnable *@param name unique destination name for the subscription, defaults to queue name. * If not specified, the queue name is used. */ - Subscription subscribe(MessageListener& listener, + QPID_CLIENT_EXTERN Subscription subscribe(MessageListener& listener, const std::string& queue, const std::string& name=std::string()); @@ -154,7 +155,7 @@ class SubscriptionManager : public sys::Runnable *@param name unique destination name for the subscription, defaults to queue name. * If not specified, the queue name is used. */ - Subscription subscribe(LocalQueue& localQueue, + QPID_CLIENT_EXTERN Subscription subscribe(LocalQueue& localQueue, const std::string& queue, const std::string& name=std::string()); @@ -164,53 +165,53 @@ class SubscriptionManager : public sys::Runnable *@param timeout wait up this timeout for a message to appear. *@return true if result was set, false if no message available after timeout. */ - bool get(Message& result, const std::string& queue, sys::Duration timeout=0); + 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. */ - Message get(const std::string& queue, sys::Duration timeout=sys::TIME_INFINITE); + 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. */ - Subscription getSubscription(const std::string& name) const; + QPID_CLIENT_EXTERN Subscription getSubscription(const std::string& name) const; /** Cancel a subscription. See also: Subscription.cancel() */ - void cancel(const std::string& name); + 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 */ - void 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 */ - void start(); + QPID_CLIENT_EXTERN void start(); /** * Wait for the thread started by a call to start() to complete. */ - void wait(); + 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. */ - void setAutoStop(bool set=true); + QPID_CLIENT_EXTERN void setAutoStop(bool set=true); /** Stop delivery. Causes run() to return, or the thread started with start() to exit. */ - void stop(); + QPID_CLIENT_EXTERN void stop(); static const uint32_t UNLIMITED=0xFFFFFFFF; /** Set the flow control for a subscription. */ - void setFlowControl(const std::string& name, const FlowControl& flow); + 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. @@ -218,22 +219,22 @@ class SubscriptionManager : public sys::Runnable *@param bytes: byte credit. *@param window: if true use window-based flow control. */ - void setFlowControl(const std::string& name, uint32_t messages, uint32_t bytes, bool window=true); + 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. */ - void setDefaultSettings(const SubscriptionSettings& s) { defaultSettings = s; } + QPID_CLIENT_EXTERN void setDefaultSettings(const SubscriptionSettings& s) { defaultSettings = s; } /** Get the default settings for subscribe() calls that don't * include a SubscriptionSettings parameter. */ - const SubscriptionSettings& getDefaultSettings() const { return defaultSettings; } + QPID_CLIENT_EXTERN const SubscriptionSettings& getDefaultSettings() const { return defaultSettings; } /** Get the default settings for subscribe() calls that don't * include a SubscriptionSettings parameter. */ - SubscriptionSettings& getDefaultSettings() { return defaultSettings; } + QPID_CLIENT_EXTERN SubscriptionSettings& getDefaultSettings() { return defaultSettings; } /** * Set the default flow control settings for subscribe() calls @@ -243,7 +244,7 @@ class SubscriptionManager : public sys::Runnable *@param bytes: byte credit. *@param window: if true use window-based flow control. */ - void setFlowControl(uint32_t messages, uint32_t bytes, bool window=true) { + QPID_CLIENT_EXTERN void setFlowControl(uint32_t messages, uint32_t bytes, bool window=true) { defaultSettings.flowControl = FlowControl(messages, bytes, window); } @@ -251,16 +252,16 @@ class SubscriptionManager : public sys::Runnable *Set the default accept-mode for subscribe() calls that don't *include a SubscriptionSettings parameter. */ - void setAcceptMode(AcceptMode mode) { defaultSettings.acceptMode = mode; } + QPID_CLIENT_EXTERN void setAcceptMode(AcceptMode mode) { defaultSettings.acceptMode = mode; } /** * Set the default acquire-mode subscribe()s that don't specify SubscriptionSettings. */ - void setAcquireMode(AcquireMode mode) { defaultSettings.acquireMode = mode; } + QPID_CLIENT_EXTERN void setAcquireMode(AcquireMode mode) { defaultSettings.acquireMode = mode; } - void registerFailoverHandler ( boost::function<void ()> fh ); + QPID_CLIENT_EXTERN void registerFailoverHandler ( boost::function<void ()> fh ); - Session getSession() const; + QPID_CLIENT_EXTERN Session getSession() const; private: mutable sys::Mutex lock; diff --git a/cpp/src/qpid/console/Agent.h b/cpp/src/qpid/console/Agent.h index 3307a1b44b..884d4c92bd 100644 --- a/cpp/src/qpid/console/Agent.h +++ b/cpp/src/qpid/console/Agent.h @@ -22,6 +22,7 @@ #define _QPID_CONSOLE_AGENT_H_ #include "Broker.h" +#include "ConsoleImportExport.h" namespace qpid { namespace console { @@ -30,7 +31,7 @@ namespace console { * * \ingroup qmfconsoleapi */ - class Agent { + class QPID_CONSOLE_EXTERN Agent { public: typedef std::vector<Agent*> Vector; @@ -49,7 +50,7 @@ namespace console { const std::string label; }; - std::ostream& operator<<(std::ostream& o, const Agent& agent); + QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Agent& agent); } } diff --git a/cpp/src/qpid/console/Broker.h b/cpp/src/qpid/console/Broker.h index 9df2380dff..ddbd973dfe 100644 --- a/cpp/src/qpid/console/Broker.h +++ b/cpp/src/qpid/console/Broker.h @@ -21,6 +21,7 @@ #ifndef _QPID_CONSOLE_BROKER_H_ #define _QPID_CONSOLE_BROKER_H_ +#include "ConsoleImportExport.h" #include "qpid/client/Connection.h" #include "qpid/client/ConnectionSettings.h" #include "qpid/client/SubscriptionManager.h" @@ -50,8 +51,9 @@ namespace console { */ class Broker : public client::MessageListener { public: - Broker(SessionManager& sm, client::ConnectionSettings& settings); - ~Broker(); + 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; } @@ -61,7 +63,7 @@ namespace console { void addBinding(const std::string& key) { connThreadBody.bindExchange("qpid.management", key); } - std::string getUrl() const; + QPID_CONSOLE_EXTERN std::string getUrl() const; private: friend class SessionManager; @@ -120,10 +122,10 @@ namespace console { void setBrokerId(const framing::Uuid& id) { brokerId = id; } void appendAgents(std::vector<Agent*>& agents) const; - friend std::ostream& operator<<(std::ostream& o, const Broker& k); + friend QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Broker& k); }; - std::ostream& operator<<(std::ostream& o, const Broker& k); + QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Broker& k); } } diff --git a/cpp/src/qpid/console/ClassKey.h b/cpp/src/qpid/console/ClassKey.h index f6617e22d5..821b01c4ef 100644 --- a/cpp/src/qpid/console/ClassKey.h +++ b/cpp/src/qpid/console/ClassKey.h @@ -22,6 +22,7 @@ #define _QPID_CONSOLE_CLASSKEY_H_ #include <string> +#include "ConsoleImportExport.h" #include "Package.h" #include "qpid/framing/Buffer.h" @@ -32,7 +33,7 @@ namespace console { * * \ingroup qmfconsoleapi */ - class ClassKey { + class QPID_CONSOLE_EXTERN ClassKey { public: static const int HASH_SIZE = 16; @@ -57,7 +58,7 @@ namespace console { uint8_t hash[HASH_SIZE]; }; - std::ostream& operator<<(std::ostream& o, const ClassKey& k); + QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const ClassKey& k); } } diff --git a/cpp/src/qpid/console/ConsoleImportExport.h b/cpp/src/qpid/console/ConsoleImportExport.h new file mode 100644 index 0000000000..e2d0af9db3 --- /dev/null +++ b/cpp/src/qpid/console/ConsoleImportExport.h @@ -0,0 +1,33 @@ +#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) +#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 index d0db6034f6..d661c63120 100644 --- a/cpp/src/qpid/console/ConsoleListener.h +++ b/cpp/src/qpid/console/ConsoleListener.h @@ -22,6 +22,7 @@ #define _QPID_CONSOLE_CONSOLE_LISTENER_H_ #include <string> +#include "ConsoleImportExport.h" #include "Broker.h" #include "ClassKey.h" #include "Object.h" @@ -36,7 +37,7 @@ namespace console { * * \ingroup qmfconsoleapi */ - class ConsoleListener{ + class QPID_CONSOLE_EXTERN ConsoleListener{ public: virtual ~ConsoleListener() {}; diff --git a/cpp/src/qpid/console/Event.h b/cpp/src/qpid/console/Event.h index 14f5a64716..4d51708965 100644 --- a/cpp/src/qpid/console/Event.h +++ b/cpp/src/qpid/console/Event.h @@ -21,6 +21,7 @@ #ifndef _QPID_CONSOLE_EVENT_H_ #define _QPID_CONSOLE_EVENT_H_ +#include "ConsoleImportExport.h" #include "Object.h" #include "qpid/framing/Uuid.h" #include "qpid/framing/FieldTable.h" @@ -46,26 +47,28 @@ namespace console { SEV_WARNING = 4, SEV_NOTICE = 5, SEV_INFO = 6, SEV_DEBUG = 7 } Severity; - Event(Broker* broker, SchemaClass* schemaClass, framing::Buffer& buffer); + QPID_CONSOLE_EXTERN Event(Broker* broker, + SchemaClass* schemaClass, + framing::Buffer& buffer); Broker* getBroker() const { return broker; } - const ClassKey& getClassKey() const; + 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; } - std::string getSeverityString() const; + QPID_CONSOLE_EXTERN std::string getSeverityString() const; - ObjectId attrRef(const std::string& key) const; - uint32_t attrUint(const std::string& key) const; - int32_t attrInt(const std::string& key) const; - uint64_t attrUint64(const std::string& key) const; - int64_t attrInt64(const std::string& key) const; - std::string attrString(const std::string& key) const; - bool attrBool(const std::string& key) const; - float attrFloat(const std::string& key) const; - double attrDouble(const std::string& key) const; - framing::Uuid attrUuid(const std::string& key) const; - framing::FieldTable attrMap(const std::string& key) 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; @@ -75,7 +78,7 @@ namespace console { Object::AttributeMap attributes; }; - std::ostream& operator<<(std::ostream& o, const Event& event); + QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Event& event); } } diff --git a/cpp/src/qpid/console/Object.h b/cpp/src/qpid/console/Object.h index 2c6993fc8a..d2fb09ecca 100644 --- a/cpp/src/qpid/console/Object.h +++ b/cpp/src/qpid/console/Object.h @@ -21,6 +21,7 @@ #ifndef _QPID_CONSOLE_OBJECT_H_ #define _QPID_CONSOLE_OBJECT_H_ +#include "ConsoleImportExport.h" #include "ObjectId.h" #include "qpid/framing/Uuid.h" #include "qpid/framing/FieldTable.h" @@ -55,47 +56,50 @@ namespace console { public: typedef std::vector<Object> Vector; struct AttributeMap : public std::map<std::string, boost::shared_ptr<Value> > { - void addRef(const std::string& key, const ObjectId& val); - void addUint(const std::string& key, uint32_t val); - void addInt(const std::string& key, int32_t val); - void addUint64(const std::string& key, uint64_t val); - void addInt64(const std::string& key, int64_t val); - void addString(const std::string& key, const std::string& val); - void addBool(const std::string& key, bool val); - void addFloat(const std::string& key, float val); - void addDouble(const std::string& key, double val); - void addUuid(const std::string& key, const framing::Uuid& val); - void addMap(const std::string& key, const framing::FieldTable& val); + 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); }; - Object(Broker* broker, SchemaClass* schemaClass, framing::Buffer& buffer, bool prop, bool stat); - ~Object(); + 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; } - const ClassKey& getClassKey() const; + 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; } - std::string getIndex() const; - void mergeUpdate(const Object& updated); + QPID_CONSOLE_EXTERN std::string getIndex() const; + QPID_CONSOLE_EXTERN void mergeUpdate(const Object& updated); const AttributeMap& getAttributes() const { return attributes; } - void invokeMethod(const std::string name, const AttributeMap& args, MethodResponse& result); - void handleMethodResp(framing::Buffer& buffer, uint32_t sequence); + 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); - ObjectId attrRef(const std::string& key) const; - uint32_t attrUint(const std::string& key) const; - int32_t attrInt(const std::string& key) const; - uint64_t attrUint64(const std::string& key) const; - int64_t attrInt64(const std::string& key) const; - std::string attrString(const std::string& key) const; - bool attrBool(const std::string& key) const; - float attrFloat(const std::string& key) const; - double attrDouble(const std::string& key) const; - framing::Uuid attrUuid(const std::string& key) const; - framing::FieldTable attrMap(const std::string& key) 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; @@ -111,7 +115,7 @@ namespace console { void parsePresenceMasks(framing::Buffer& buffer, std::set<std::string>& excludeList); }; - std::ostream& operator<<(std::ostream& o, const Object& object); + QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Object& object); } } diff --git a/cpp/src/qpid/console/ObjectId.h b/cpp/src/qpid/console/ObjectId.h index 73304ca306..ac0e8d8b03 100644 --- a/cpp/src/qpid/console/ObjectId.h +++ b/cpp/src/qpid/console/ObjectId.h @@ -22,6 +22,7 @@ #define _QPID_CONSOLE_OBJECTID_H #include <iostream> +#include "ConsoleImportExport.h" #include "qpid/sys/IntegerTypes.h" namespace qpid { @@ -34,7 +35,7 @@ namespace console { * * \ingroup qmfconsoleapi */ - class ObjectId { + class QPID_CONSOLE_EXTERN ObjectId { public: ObjectId() : first(0), second(0) {} ObjectId(framing::Buffer& buffer); @@ -61,7 +62,7 @@ namespace console { uint64_t second; }; - std::ostream& operator<<(std::ostream& o, const ObjectId& id); + QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const ObjectId& id); } } diff --git a/cpp/src/qpid/console/Package.h b/cpp/src/qpid/console/Package.h index 18203cb807..3cc63c8b75 100644 --- a/cpp/src/qpid/console/Package.h +++ b/cpp/src/qpid/console/Package.h @@ -23,6 +23,7 @@ #include <string> #include <map> +#include "ConsoleImportExport.h" #include "qpid/sys/IntegerTypes.h" namespace qpid { diff --git a/cpp/src/qpid/console/SequenceManager.h b/cpp/src/qpid/console/SequenceManager.h index c7a8c20fe6..5a041f530b 100644 --- a/cpp/src/qpid/console/SequenceManager.h +++ b/cpp/src/qpid/console/SequenceManager.h @@ -21,6 +21,7 @@ #ifndef _QPID_CONSOLE_SEQUENCEMANAGER_H_ #define _QPID_CONSOLE_SEQUENCEMANAGER_H_ +#include "ConsoleImportExport.h" #include "qpid/sys/Mutex.h" #include <map> #include <string> @@ -38,8 +39,8 @@ namespace console { typedef std::set<uint32_t> set; SequenceManager() : sequence(0) {} - uint32_t reserve(const std::string& context = ""); - std::string release(uint32_t seq); + QPID_CONSOLE_EXTERN uint32_t reserve(const std::string& context = ""); + QPID_CONSOLE_EXTERN std::string release(uint32_t seq); private: sys::Mutex lock; diff --git a/cpp/src/qpid/console/SessionManager.h b/cpp/src/qpid/console/SessionManager.h index ab6e111caa..4341fe317c 100644 --- a/cpp/src/qpid/console/SessionManager.h +++ b/cpp/src/qpid/console/SessionManager.h @@ -22,6 +22,7 @@ * */ +#include "ConsoleImportExport.h" #include "Broker.h" #include "Package.h" #include "SequenceManager.h" @@ -80,8 +81,8 @@ class SessionManager * and bindClass methods. If userBindings is false, the listener will receive * updates for all object classes. */ - SessionManager(ConsoleListener* listener = 0, - Settings settings = Settings()); + QPID_CONSOLE_EXTERN SessionManager(ConsoleListener* listener = 0, + Settings settings = Settings()); /** Connect a broker to the console session * @@ -89,32 +90,33 @@ class SessionManager *@return broker object if operation is successful * an exception shall be thrown. */ - Broker* addBroker(client::ConnectionSettings& settings); + 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. */ - void delBroker(Broker* broker); + 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. */ - void getPackages(NameVector& packages); + 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. */ - void getClasses(KeyVector& classKeys, const std::string& packageName); + 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. */ - SchemaClass& getSchema(const ClassKey& classKey); + QPID_CONSOLE_EXTERN SchemaClass& getSchema(const ClassKey& classKey); /** Request that updates be received for all classes within a package * @@ -123,7 +125,7 @@ class SessionManager * *@param packageName Name of the package to which to bind. */ - void bindPackage(const std::string& packageName); + QPID_CONSOLE_EXTERN void bindPackage(const std::string& packageName); /** Request update to be received for a particular class * @@ -132,8 +134,9 @@ class SessionManager * *@param classKey Class key of class to which to bind. */ - void bindClass(const ClassKey& classKey); - void bindClass(const std::string& packageName, const std::string& className); + 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. * @@ -141,7 +144,8 @@ class SessionManager *@param broker Return agents registered with this broker only. If NULL, return agents * from all connected brokers. */ - void getAgents(Agent::Vector& agents, Broker* broker = 0); + 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. @@ -153,8 +157,10 @@ class SessionManager *@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. */ - void getObjects(Object::Vector& objects, const std::string& className, - Broker* broker = 0, Agent* agent = 0); + 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, diff --git a/cpp/src/qpid/framing/AMQBody.h b/cpp/src/qpid/framing/AMQBody.h index 9e66b9738f..60ac2d3b7e 100644 --- a/cpp/src/qpid/framing/AMQBody.h +++ b/cpp/src/qpid/framing/AMQBody.h @@ -26,6 +26,7 @@ #include "qpid/framing/BodyFactory.h" #include <boost/intrusive_ptr.hpp> #include <ostream> +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -48,7 +49,7 @@ struct AMQBodyConstVisitor { class AMQBody : public RefCounted { public: AMQBody() {} - virtual ~AMQBody(); + QPID_COMMON_EXTERN virtual ~AMQBody(); // Make AMQBody copyable even though RefCounted. AMQBody(const AMQBody&) : RefCounted() {} @@ -71,7 +72,7 @@ class AMQBody : public RefCounted { virtual boost::intrusive_ptr<AMQBody> clone() const = 0; }; -std::ostream& operator<<(std::ostream& out, const AMQBody& body) ; +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const AMQBody& body) ; enum BodyTypes { METHOD_BODY = 1, diff --git a/cpp/src/qpid/framing/AMQContentBody.h b/cpp/src/qpid/framing/AMQContentBody.h index a81cf36168..9606ae5ec5 100644 --- a/cpp/src/qpid/framing/AMQContentBody.h +++ b/cpp/src/qpid/framing/AMQContentBody.h @@ -21,6 +21,7 @@ #include "amqp_types.h" #include "AMQBody.h" #include "Buffer.h" +#include "qpid/CommonImportExport.h" #ifndef _AMQContentBody_ #define _AMQContentBody_ @@ -33,18 +34,18 @@ class AMQContentBody : public AMQBody string data; public: - AMQContentBody(); - AMQContentBody(const string& data); + QPID_COMMON_EXTERN AMQContentBody(); + QPID_COMMON_EXTERN AMQContentBody(const string& data); inline virtual ~AMQContentBody(){} - inline uint8_t type() const { return CONTENT_BODY; }; - inline const string& getData() const { return data; } - inline string& getData() { return data; } - uint32_t encodedSize() const; - void encode(Buffer& buffer) const; - void decode(Buffer& buffer, uint32_t size); - void print(std::ostream& out) const; - void accept(AMQBodyConstVisitor& v) const { v.visit(*this); } - boost::intrusive_ptr<AMQBody> clone() const { return BodyFactory::copy(*this); } + QPID_COMMON_EXTERN inline uint8_t type() const { return CONTENT_BODY; }; + QPID_COMMON_EXTERN inline const string& getData() const { return data; } + QPID_COMMON_EXTERN inline string& getData() { return data; } + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN void encode(Buffer& buffer) const; + QPID_COMMON_EXTERN void decode(Buffer& buffer, uint32_t size); + QPID_COMMON_EXTERN void print(std::ostream& out) const; + QPID_COMMON_EXTERN void accept(AMQBodyConstVisitor& v) const { v.visit(*this); } + QPID_COMMON_EXTERN boost::intrusive_ptr<AMQBody> clone() const { return BodyFactory::copy(*this); } }; } diff --git a/cpp/src/qpid/framing/AMQFrame.h b/cpp/src/qpid/framing/AMQFrame.h index 02a1ea4622..34319e7ed4 100644 --- a/cpp/src/qpid/framing/AMQFrame.h +++ b/cpp/src/qpid/framing/AMQFrame.h @@ -29,6 +29,7 @@ #include "qpid/sys/LatencyMetric.h" #include <boost/intrusive_ptr.hpp> #include <boost/cast.hpp> +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -36,15 +37,15 @@ namespace framing { class AMQFrame : public AMQDataBlock, public sys::LatencyMetricTimestamp { public: - AMQFrame(const boost::intrusive_ptr<AMQBody>& b=0); - AMQFrame(const AMQBody& b); - ~AMQFrame(); + QPID_COMMON_EXTERN AMQFrame(const boost::intrusive_ptr<AMQBody>& b=0); + QPID_COMMON_EXTERN AMQFrame(const AMQBody& b); + QPID_COMMON_EXTERN ~AMQFrame(); ChannelId getChannel() const { return channel; } void setChannel(ChannelId c) { channel = c; } - AMQBody* getBody(); - const AMQBody* getBody() const; + QPID_COMMON_EXTERN AMQBody* getBody(); + QPID_COMMON_EXTERN const AMQBody* getBody() const; AMQMethodBody* getMethod() { return getBody()->getMethod(); } const AMQMethodBody* getMethod() const { return getBody()->getMethod(); } @@ -59,9 +60,9 @@ class AMQFrame : public AMQDataBlock, public sys::LatencyMetricTimestamp return boost::polymorphic_downcast<const T*>(getBody()); } - void encode(Buffer& buffer) const; - bool decode(Buffer& buffer); - uint32_t encodedSize() const; + QPID_COMMON_EXTERN void encode(Buffer& buffer) const; + QPID_COMMON_EXTERN bool decode(Buffer& buffer); + QPID_COMMON_EXTERN uint32_t encodedSize() const; // 0-10 terminology: first/last frame (in segment) first/last segment (in assembly) @@ -88,7 +89,7 @@ class AMQFrame : public AMQDataBlock, public sys::LatencyMetricTimestamp void setEos(bool isEos) { eos = isEos; } static uint16_t DECODE_SIZE_MIN; - static uint32_t frameOverhead(); + QPID_COMMON_EXTERN static uint32_t frameOverhead(); /** Must point to at least DECODE_SIZE_MIN bytes of data */ static uint16_t decodeSize(char* data); @@ -105,7 +106,7 @@ class AMQFrame : public AMQDataBlock, public sys::LatencyMetricTimestamp mutable uint32_t encodedSizeCache; }; -std::ostream& operator<<(std::ostream&, const AMQFrame&); +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const AMQFrame&); }} // namespace qpid::framing diff --git a/cpp/src/qpid/framing/AMQHeaderBody.h b/cpp/src/qpid/framing/AMQHeaderBody.h index 9846544949..b8099f2e51 100644 --- a/cpp/src/qpid/framing/AMQHeaderBody.h +++ b/cpp/src/qpid/framing/AMQHeaderBody.h @@ -26,6 +26,7 @@ #include "Buffer.h" #include "qpid/framing/DeliveryProperties.h" #include "qpid/framing/MessageProperties.h" +#include "qpid/CommonImportExport.h" #include <iostream> #include <boost/optional.hpp> @@ -83,12 +84,12 @@ public: inline uint8_t type() const { return HEADER_BODY; } - uint32_t encodedSize() const; - void encode(Buffer& buffer) const; - void decode(Buffer& buffer, uint32_t size); - uint64_t getContentLength() const; - void print(std::ostream& out) const; - void accept(AMQBodyConstVisitor&) const; + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN void encode(Buffer& buffer) const; + QPID_COMMON_EXTERN void decode(Buffer& buffer, uint32_t size); + QPID_COMMON_EXTERN uint64_t getContentLength() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; + QPID_COMMON_EXTERN void accept(AMQBodyConstVisitor&) const; template <class T> T* get(bool create) { boost::optional<T>& p=properties.OptProps<T>::props; diff --git a/cpp/src/qpid/framing/AMQHeartbeatBody.h b/cpp/src/qpid/framing/AMQHeartbeatBody.h index 3fb41c128e..5d3f633576 100644 --- a/cpp/src/qpid/framing/AMQHeartbeatBody.h +++ b/cpp/src/qpid/framing/AMQHeartbeatBody.h @@ -21,6 +21,7 @@ #include "amqp_types.h" #include "AMQBody.h" #include "Buffer.h" +#include "qpid/CommonImportExport.h" #ifndef _AMQHeartbeatBody_ #define _AMQHeartbeatBody_ @@ -31,12 +32,12 @@ namespace framing { class AMQHeartbeatBody : public AMQBody { public: - virtual ~AMQHeartbeatBody(); + QPID_COMMON_EXTERN virtual ~AMQHeartbeatBody(); inline uint32_t encodedSize() const { return 0; } inline uint8_t type() const { return HEARTBEAT_BODY; } inline void encode(Buffer& ) const {} inline void decode(Buffer& , uint32_t /*size*/) {} - virtual void print(std::ostream& out) const; + QPID_COMMON_EXTERN virtual void print(std::ostream& out) const; void accept(AMQBodyConstVisitor& v) const { v.visit(*this); } boost::intrusive_ptr<AMQBody> clone() const { return BodyFactory::copy(*this); } }; diff --git a/cpp/src/qpid/framing/AMQMethodBody.h b/cpp/src/qpid/framing/AMQMethodBody.h index cc7489ddd9..a38726b0fc 100644 --- a/cpp/src/qpid/framing/AMQMethodBody.h +++ b/cpp/src/qpid/framing/AMQMethodBody.h @@ -25,7 +25,7 @@ #include "AMQBody.h" #include "qpid/framing/ProtocolVersion.h" #include "qpid/shared_ptr.h" - +#include "qpid/CommonImportExport.h" #include <ostream> #include <assert.h> @@ -40,7 +40,7 @@ class MethodBodyConstVisitor; class AMQMethodBody : public AMQBody { public: AMQMethodBody() {} - virtual ~AMQMethodBody(); + QPID_COMMON_EXTERN virtual ~AMQMethodBody(); virtual void accept(MethodBodyConstVisitor&) const = 0; diff --git a/cpp/src/qpid/framing/AccumulatedAck.h b/cpp/src/qpid/framing/AccumulatedAck.h index ea78b797e0..ede73897c7 100644 --- a/cpp/src/qpid/framing/AccumulatedAck.h +++ b/cpp/src/qpid/framing/AccumulatedAck.h @@ -27,6 +27,7 @@ #include <ostream> #include "SequenceNumber.h" #include "SequenceNumberSet.h" +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -58,17 +59,17 @@ namespace qpid { */ std::list<Range> ranges; - explicit AccumulatedAck(SequenceNumber r = SequenceNumber()); - void update(SequenceNumber firstTag, SequenceNumber lastTag); - void consolidate(); - void clear(); - bool covers(SequenceNumber tag) const; + QPID_COMMON_EXTERN explicit AccumulatedAck(SequenceNumber r = SequenceNumber()); + QPID_COMMON_EXTERN void update(SequenceNumber firstTag, SequenceNumber lastTag); + QPID_COMMON_EXTERN void consolidate(); + QPID_COMMON_EXTERN void clear(); + QPID_COMMON_EXTERN bool covers(SequenceNumber tag) const; void collectRanges(SequenceNumberSet& set) const; - void update(const SequenceNumber cumulative, const SequenceNumberSet& range); + QPID_COMMON_EXTERN void update(const SequenceNumber cumulative, const SequenceNumberSet& range); void operator()(SequenceNumber first, SequenceNumber last) { update(first, last); } }; - std::ostream& operator<<(std::ostream&, const Range&); - std::ostream& operator<<(std::ostream&, const AccumulatedAck&); + QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const Range&); + QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const AccumulatedAck&); } } diff --git a/cpp/src/qpid/framing/Array.h b/cpp/src/qpid/framing/Array.h index 183fcb6d5c..0b6b704ed2 100644 --- a/cpp/src/qpid/framing/Array.h +++ b/cpp/src/qpid/framing/Array.h @@ -24,6 +24,7 @@ #include <boost/shared_ptr.hpp> #include <iostream> #include <vector> +#include "qpid/CommonImportExport.h" #ifndef _Array_ #define _Array_ @@ -41,38 +42,38 @@ class Array typedef ValueVector::const_iterator const_iterator; typedef ValueVector::iterator iterator; - uint32_t encodedSize() const; - void encode(Buffer& buffer) const; - void decode(Buffer& buffer); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN void encode(Buffer& buffer) const; + QPID_COMMON_EXTERN void decode(Buffer& buffer); - int count() const; - bool operator==(const Array& other) const; + QPID_COMMON_EXTERN int count() const; + QPID_COMMON_EXTERN bool operator==(const Array& other) const; - Array(); - Array(TypeCode type); - Array(uint8_t type); + QPID_COMMON_EXTERN Array(); + QPID_COMMON_EXTERN Array(TypeCode type); + QPID_COMMON_EXTERN Array(uint8_t type); //creates a longstr array - Array(const std::vector<std::string>& in); + QPID_COMMON_EXTERN Array(const std::vector<std::string>& in); - TypeCode getType() const { return type; } + QPID_COMMON_EXTERN TypeCode getType() const { return type; } // std collection interface. - const_iterator begin() const { return values.begin(); } - const_iterator end() const { return values.end(); } - iterator begin() { return values.begin(); } - iterator end(){ return values.end(); } - - ValuePtr front() const { return values.front(); } - ValuePtr back() const { return values.back(); } - size_t size() const { return values.size(); } - - void insert(iterator i, ValuePtr value); - void erase(iterator i) { values.erase(i); } - void push_back(ValuePtr value) { values.insert(end(), value); } - void pop_back() { values.pop_back(); } + 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 - void add(ValuePtr value) { push_back(value); } + QPID_COMMON_EXTERN void add(ValuePtr value) { push_back(value); } template <class T> void collect(std::vector<T>& out) const @@ -86,7 +87,7 @@ class Array TypeCode type; ValueVector values; - friend std::ostream& operator<<(std::ostream& out, const Array& body); + friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const Array& body); }; } diff --git a/cpp/src/qpid/framing/Buffer.h b/cpp/src/qpid/framing/Buffer.h index 828e6e963a..57fb1e32a0 100644 --- a/cpp/src/qpid/framing/Buffer.h +++ b/cpp/src/qpid/framing/Buffer.h @@ -20,6 +20,7 @@ */ #include "amqp_types.h" #include "qpid/Exception.h" +#include "qpid/CommonImportExport.h" #include <boost/iterator/iterator_facade.hpp> #ifndef _Buffer_ @@ -66,65 +67,65 @@ class Buffer friend class Iterator; - Buffer(char* data=0, uint32_t size=0); + QPID_COMMON_EXTERN Buffer(char* data=0, uint32_t size=0); - void record(); - void restore(bool reRecord = false); - void reset(); + QPID_COMMON_EXTERN void record(); + QPID_COMMON_EXTERN void restore(bool reRecord = false); + QPID_COMMON_EXTERN void reset(); - uint32_t available() { return size - position; } - uint32_t getSize() { return size; } - uint32_t getPosition() { return position; } - Iterator getIterator() { return Iterator(*this); } - char* getPointer() { return data; } + 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; } - void putOctet(uint8_t i); - void putShort(uint16_t i); - void putLong(uint32_t i); - void putLongLong(uint64_t i); - void putInt8(int8_t i); - void putInt16(int16_t i); - void putInt32(int32_t i); - void putInt64(int64_t i); - void putFloat(float f); - void putDouble(double f); - void putBin128(uint8_t* b); - - uint8_t getOctet(); - uint16_t getShort(); - uint32_t getLong(); - uint64_t getLongLong(); - int8_t getInt8(); - int16_t getInt16(); - int32_t getInt32(); - int64_t getInt64(); - float getFloat(); - double getDouble(); + 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(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> - uint64_t getUInt(); + QPID_COMMON_EXTERN uint64_t getUInt(); template <int n> - void putUInt(uint64_t); + QPID_COMMON_EXTERN void putUInt(uint64_t); - void putShortString(const string& s); - void putMediumString(const string& s); - void putLongString(const string& s); - void getShortString(string& s); - void getMediumString(string& s); - void getLongString(string& s); - void getBin128(uint8_t* b); + 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); - void putRawData(const string& s); - void getRawData(string& s, uint32_t size); + QPID_COMMON_EXTERN void putRawData(const string& s); + QPID_COMMON_EXTERN void getRawData(string& s, uint32_t size); - void putRawData(const uint8_t* data, size_t size); - void getRawData(uint8_t* data, size_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); } - void dump(std::ostream&) const; + QPID_COMMON_EXTERN void dump(std::ostream&) const; }; std::ostream& operator<<(std::ostream&, const Buffer&); diff --git a/cpp/src/qpid/framing/FieldTable.h b/cpp/src/qpid/framing/FieldTable.h index 9e1214a28c..a07568559f 100644 --- a/cpp/src/qpid/framing/FieldTable.h +++ b/cpp/src/qpid/framing/FieldTable.h @@ -23,6 +23,7 @@ #include <boost/shared_ptr.hpp> #include <map> #include "amqp_types.h" +#include "qpid/CommonImportExport.h" #ifndef _FieldTable_ #define _FieldTable_ @@ -51,45 +52,45 @@ class FieldTable typedef std::map<std::string, ValuePtr> ValueMap; typedef ValueMap::iterator iterator; - FieldTable() {}; - FieldTable(const FieldTable& ft); - ~FieldTable(); - FieldTable& operator=(const FieldTable& ft); - uint32_t encodedSize() const; - void encode(Buffer& buffer) const; - void decode(Buffer& buffer); - - int count() const; - void set(const std::string& name, const ValuePtr& value); - ValuePtr get(const std::string& name) const; - bool isSet(const std::string& name) const { return get(name).get() != 0; } - - void setString(const std::string& name, const std::string& value); - void setInt(const std::string& name, const int value); - void setInt64(const std::string& name, const int64_t value); - void setTimestamp(const std::string& name, const uint64_t value); - void setUInt64(const std::string& name, const uint64_t value); - void setTable(const std::string& name, const FieldTable& value); - void setArray(const std::string& name, const Array& value); - void setFloat(const std::string& name, const float value); - void setDouble(const std::string& name, const double value); + 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 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); - int getAsInt(const std::string& name) const; - uint64_t getAsUInt64(const std::string& name) const; - int64_t getAsInt64(const std::string& name) const; - std::string getAsString(const std::string& name) const; + 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; - bool getTable(const std::string& name, FieldTable& value) const; - bool getArray(const std::string& name, Array& value) const; - bool getFloat(const std::string& name, float& value) const; - bool getDouble(const std::string& name, double& value) 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); - void erase(const std::string& name); + QPID_COMMON_EXTERN void erase(const std::string& name); - bool operator==(const FieldTable& other) const; + QPID_COMMON_EXTERN bool operator==(const FieldTable& other) const; // Map-like interface. // TODO: may need to duplicate into versions that return mutable iterator @@ -107,7 +108,7 @@ class FieldTable private: ValueMap values; - friend std::ostream& operator<<(std::ostream& out, const FieldTable& body); + QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream& out, const FieldTable& body); }; //class FieldNotFoundException{}; diff --git a/cpp/src/qpid/framing/FieldValue.h b/cpp/src/qpid/framing/FieldValue.h index 29760619e5..0f27700ac8 100644 --- a/cpp/src/qpid/framing/FieldValue.h +++ b/cpp/src/qpid/framing/FieldValue.h @@ -25,6 +25,7 @@ #include "amqp_types.h" #include "Buffer.h" #include "FieldTable.h" +#include "qpid/CommonImportExport.h" #include "assert.h" @@ -87,8 +88,8 @@ class FieldValue { bool empty() const { return data.get() == 0; } void encode(Buffer& buffer); void decode(Buffer& buffer); - bool operator==(const FieldValue&) const; - bool operator!=(const FieldValue& v) const { return !(*this == v); } + 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; @@ -244,28 +245,28 @@ class EncodedValue : public FieldValue::Data { class Str8Value : public FieldValue { public: - Str8Value(const std::string& v); + QPID_COMMON_EXTERN Str8Value(const std::string& v); }; class Str16Value : public FieldValue { public: - Str16Value(const std::string& v); + QPID_COMMON_EXTERN Str16Value(const std::string& v); }; class Struct32Value : public FieldValue { public: - Struct32Value(const std::string& v); + QPID_COMMON_EXTERN Struct32Value(const std::string& v); }; class FloatValue : public FieldValue { public: - FloatValue(float f); + QPID_COMMON_EXTERN FloatValue(float f); }; class DoubleValue : public FieldValue { public: - DoubleValue(double f); + QPID_COMMON_EXTERN DoubleValue(double f); }; /* @@ -273,32 +274,32 @@ class DoubleValue : public FieldValue */ class IntegerValue : public FieldValue { public: - IntegerValue(int v); + QPID_COMMON_EXTERN IntegerValue(int v); }; class TimeValue : public FieldValue { public: - TimeValue(uint64_t v); + QPID_COMMON_EXTERN TimeValue(uint64_t v); }; class Integer64Value : public FieldValue { public: - Integer64Value(int64_t v); + QPID_COMMON_EXTERN Integer64Value(int64_t v); }; class Unsigned64Value : public FieldValue { public: - Unsigned64Value(uint64_t v); + QPID_COMMON_EXTERN Unsigned64Value(uint64_t v); }; class FieldTableValue : public FieldValue { public: - FieldTableValue(const FieldTable&); + QPID_COMMON_EXTERN FieldTableValue(const FieldTable&); }; class ArrayValue : public FieldValue { public: - ArrayValue(const Array&); + QPID_COMMON_EXTERN ArrayValue(const Array&); }; template <class T> diff --git a/cpp/src/qpid/framing/FrameSet.h b/cpp/src/qpid/framing/FrameSet.h index b13ca16e97..e3e8727600 100644 --- a/cpp/src/qpid/framing/FrameSet.h +++ b/cpp/src/qpid/framing/FrameSet.h @@ -23,6 +23,7 @@ #include "qpid/framing/amqp_framing.h" #include "qpid/framing/AMQFrame.h" #include "qpid/framing/SequenceNumber.h" +#include "qpid/CommonImportExport.h" #ifndef _FrameSet_ #define _FrameSet_ @@ -44,20 +45,20 @@ class FrameSet public: typedef boost::shared_ptr<FrameSet> shared_ptr; - FrameSet(const SequenceNumber& id); - void append(const AMQFrame& part); - bool isComplete() const; + QPID_COMMON_EXTERN FrameSet(const SequenceNumber& id); + QPID_COMMON_EXTERN void append(const AMQFrame& part); + QPID_COMMON_EXTERN bool isComplete() const; - uint64_t getContentSize() const; + QPID_COMMON_EXTERN uint64_t getContentSize() const; - void getContent(std::string&) const; - std::string getContent() const; + QPID_COMMON_EXTERN void getContent(std::string&) const; + QPID_COMMON_EXTERN std::string getContent() const; bool isContentBearing() const; - const AMQMethodBody* getMethod() const; - const AMQHeaderBody* getHeaders() const; - AMQHeaderBody* getHeaders(); + QPID_COMMON_EXTERN const AMQMethodBody* getMethod() const; + QPID_COMMON_EXTERN const AMQHeaderBody* getHeaders() const; + QPID_COMMON_EXTERN AMQHeaderBody* getHeaders(); template <class T> bool isA() const { const AMQMethodBody* method = getMethod(); diff --git a/cpp/src/qpid/framing/ProtocolInitiation.h b/cpp/src/qpid/framing/ProtocolInitiation.h index 6584fee55c..7a82b3575f 100644 --- a/cpp/src/qpid/framing/ProtocolInitiation.h +++ b/cpp/src/qpid/framing/ProtocolInitiation.h @@ -22,6 +22,7 @@ #include "Buffer.h" #include "AMQDataBlock.h" #include "ProtocolVersion.h" +#include "qpid/CommonImportExport.h" #ifndef _ProtocolInitiation_ #define _ProtocolInitiation_ @@ -35,12 +36,12 @@ private: ProtocolVersion version; public: - ProtocolInitiation(); - ProtocolInitiation(uint8_t major, uint8_t minor); - ProtocolInitiation(ProtocolVersion p); - virtual ~ProtocolInitiation(); - virtual void encode(Buffer& buffer) const; - virtual bool decode(Buffer& buffer); + QPID_COMMON_EXTERN ProtocolInitiation(); + QPID_COMMON_EXTERN ProtocolInitiation(uint8_t major, uint8_t minor); + QPID_COMMON_EXTERN ProtocolInitiation(ProtocolVersion p); + QPID_COMMON_EXTERN virtual ~ProtocolInitiation(); + QPID_COMMON_EXTERN virtual void encode(Buffer& buffer) const; + QPID_COMMON_EXTERN virtual bool decode(Buffer& buffer); inline virtual uint32_t encodedSize() const { return 8; } inline uint8_t getMajor() const { return version.getMajor(); } inline uint8_t getMinor() const { return version.getMinor(); } @@ -48,7 +49,7 @@ public: bool operator==(ProtocolVersion v) const { return v == getVersion(); } }; -std::ostream& operator<<(std::ostream& o, const framing::ProtocolInitiation& pi); +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& o, const framing::ProtocolInitiation& pi); } diff --git a/cpp/src/qpid/framing/ProtocolVersion.h b/cpp/src/qpid/framing/ProtocolVersion.h index 9a7ebec491..681c9daf21 100644 --- a/cpp/src/qpid/framing/ProtocolVersion.h +++ b/cpp/src/qpid/framing/ProtocolVersion.h @@ -22,6 +22,7 @@ #define _ProtocolVersion_ #include "amqp_types.h" +#include "qpid/CommonImportExport.h" namespace qpid { @@ -38,16 +39,16 @@ public: explicit ProtocolVersion(uint8_t _major=0, uint8_t _minor=0) : major_(_major), minor_(_minor) {} - uint8_t getMajor() const { return major_; } - void setMajor(uint8_t major) { major_ = major; } - uint8_t getMinor() const { return minor_; } - void setMinor(uint8_t minor) { minor_ = minor; } - const std::string toString() const; + 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; - ProtocolVersion& operator=(ProtocolVersion p); + QPID_COMMON_EXTERN ProtocolVersion& operator=(ProtocolVersion p); - bool operator==(ProtocolVersion p) const; - bool operator!=(ProtocolVersion p) const { return ! (*this == p); } + QPID_COMMON_EXTERN bool operator==(ProtocolVersion p) const; + QPID_COMMON_EXTERN bool operator!=(ProtocolVersion p) const { return ! (*this == p); } }; } // namespace framing diff --git a/cpp/src/qpid/framing/Proxy.h b/cpp/src/qpid/framing/Proxy.h index 5e2c886af2..a9a6ce981e 100644 --- a/cpp/src/qpid/framing/Proxy.h +++ b/cpp/src/qpid/framing/Proxy.h @@ -22,6 +22,8 @@ #include "FrameHandler.h" #include "ProtocolVersion.h" +#include "qpid/CommonImportExport.h" + namespace qpid { namespace framing { @@ -37,19 +39,19 @@ class Proxy { Proxy& proxy; public: - ScopedSync(Proxy& p); - ~ScopedSync(); + QPID_COMMON_EXTERN ScopedSync(Proxy& p); + QPID_COMMON_EXTERN ~ScopedSync(); }; - Proxy(FrameHandler& h); - virtual ~Proxy(); + QPID_COMMON_EXTERN Proxy(FrameHandler& h); + QPID_COMMON_EXTERN virtual ~Proxy(); - void send(const AMQBody&); + QPID_COMMON_EXTERN void send(const AMQBody&); - ProtocolVersion getVersion() const; + QPID_COMMON_EXTERN ProtocolVersion getVersion() const; - FrameHandler& getHandler(); - void setHandler(FrameHandler&); + QPID_COMMON_EXTERN FrameHandler& getHandler(); + QPID_COMMON_EXTERN void setHandler(FrameHandler&); private: FrameHandler* out; bool sync; diff --git a/cpp/src/qpid/framing/SendContent.h b/cpp/src/qpid/framing/SendContent.h index dcd5202b3e..745c948c9e 100644 --- a/cpp/src/qpid/framing/SendContent.h +++ b/cpp/src/qpid/framing/SendContent.h @@ -22,6 +22,7 @@ #include "qpid/framing/amqp_framing.h" #include "qpid/framing/AMQFrame.h" #include "qpid/framing/FrameHandler.h" +#include "qpid/CommonImportExport.h" #ifndef _SendContent_ #define _SendContent_ @@ -44,8 +45,8 @@ class SendContent void sendFragment(const AMQContentBody& body, uint32_t offset, uint16_t size, bool first, bool last) const; void setFlags(AMQFrame& f, bool first, bool last) const; public: - SendContent(FrameHandler& _handler, uint16_t _maxFrameSize, uint frameCount); - void operator()(const AMQFrame& f); + QPID_COMMON_EXTERN SendContent(FrameHandler& _handler, uint16_t _maxFrameSize, uint frameCount); + QPID_COMMON_EXTERN void operator()(const AMQFrame& f); }; } diff --git a/cpp/src/qpid/framing/SequenceNumber.h b/cpp/src/qpid/framing/SequenceNumber.h index 930e146863..3b18ce1360 100644 --- a/cpp/src/qpid/framing/SequenceNumber.h +++ b/cpp/src/qpid/framing/SequenceNumber.h @@ -23,6 +23,7 @@ #include "amqp_types.h" #include <iosfwd> +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -37,22 +38,22 @@ class SequenceNumber int32_t value; public: - SequenceNumber(); - SequenceNumber(uint32_t v); + QPID_COMMON_EXTERN SequenceNumber(); + QPID_COMMON_EXTERN SequenceNumber(uint32_t v); - SequenceNumber& operator++();//prefix ++ - const SequenceNumber operator++(int);//postfix ++ - SequenceNumber& operator--();//prefix ++ - bool operator==(const SequenceNumber& other) const; - bool operator!=(const SequenceNumber& other) const; - bool operator<(const SequenceNumber& other) const; - bool operator>(const SequenceNumber& other) const; - bool operator<=(const SequenceNumber& other) const; - bool operator>=(const SequenceNumber& other) const; + QPID_COMMON_EXTERN SequenceNumber& operator++();//prefix ++ + QPID_COMMON_EXTERN const SequenceNumber operator++(int);//postfix ++ + QPID_COMMON_EXTERN SequenceNumber& operator--();//prefix ++ + QPID_COMMON_EXTERN bool operator==(const SequenceNumber& other) const; + QPID_COMMON_EXTERN bool operator!=(const SequenceNumber& other) const; + QPID_COMMON_EXTERN bool operator<(const SequenceNumber& other) const; + QPID_COMMON_EXTERN bool operator>(const SequenceNumber& other) const; + QPID_COMMON_EXTERN bool operator<=(const SequenceNumber& other) const; + QPID_COMMON_EXTERN bool operator>=(const SequenceNumber& other) const; uint32_t getValue() const { return (uint32_t) value; } operator uint32_t() const { return (uint32_t) value; } - friend int32_t operator-(const SequenceNumber& a, const SequenceNumber& b); + QPID_COMMON_EXTERN friend int32_t operator-(const SequenceNumber& a, const SequenceNumber& b); void encode(Buffer& buffer) const; void decode(Buffer& buffer); @@ -67,7 +68,7 @@ struct Window SequenceNumber lwm; }; -std::ostream& operator<<(std::ostream& o, const SequenceNumber& n); +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& o, const SequenceNumber& n); }} // namespace qpid::framing diff --git a/cpp/src/qpid/framing/SequenceNumberSet.h b/cpp/src/qpid/framing/SequenceNumberSet.h index 666307f9d9..8e023ba535 100644 --- a/cpp/src/qpid/framing/SequenceNumberSet.h +++ b/cpp/src/qpid/framing/SequenceNumberSet.h @@ -27,6 +27,7 @@ #include "SequenceNumber.h" #include "qpid/framing/reply_exceptions.h" #include "qpid/InlineVector.h" +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -41,8 +42,8 @@ public: void encode(Buffer& buffer) const; void decode(Buffer& buffer); uint32_t encodedSize() const; - SequenceNumberSet condense() const; - void addRange(const SequenceNumber& start, const SequenceNumber& end); + QPID_COMMON_EXTERN SequenceNumberSet condense() const; + QPID_COMMON_EXTERN void addRange(const SequenceNumber& start, const SequenceNumber& end); template <class T> void processRanges(T& t) const @@ -58,7 +59,7 @@ public: } } - friend std::ostream& operator<<(std::ostream&, const SequenceNumberSet&); + friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SequenceNumberSet&); }; diff --git a/cpp/src/qpid/framing/SequenceSet.h b/cpp/src/qpid/framing/SequenceSet.h index 57b9c2c8e1..a5ee6cd649 100644 --- a/cpp/src/qpid/framing/SequenceSet.h +++ b/cpp/src/qpid/framing/SequenceSet.h @@ -23,6 +23,7 @@ #include "SequenceNumber.h" #include "qpid/RangeSet.h" +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -41,13 +42,13 @@ class SequenceSet : public RangeSet<SequenceNumber> { void decode(Buffer& buffer); uint32_t encodedSize() const; - bool contains(const SequenceNumber& s) const; - void add(const SequenceNumber& s); - void add(const SequenceNumber& start, const SequenceNumber& finish); // Closed range - void add(const SequenceSet& set); - void remove(const SequenceNumber& s); - void remove(const SequenceNumber& start, const SequenceNumber& finish); // Closed range - void remove(const SequenceSet& set); + 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++) @@ -59,7 +60,7 @@ class SequenceSet : public RangeSet<SequenceNumber> { t(i->first(), i->last()); } - friend std::ostream& operator<<(std::ostream&, const SequenceSet&); + friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SequenceSet&); }; }} // namespace qpid::framing diff --git a/cpp/src/qpid/framing/StructHelper.h b/cpp/src/qpid/framing/StructHelper.h index e3dce4f5ec..89f556ad3c 100644 --- a/cpp/src/qpid/framing/StructHelper.h +++ b/cpp/src/qpid/framing/StructHelper.h @@ -22,6 +22,7 @@ #define _StructHelper_ #include "qpid/Exception.h" +#include "qpid/CommonImportExport.h" #include "Buffer.h" #include <stdlib.h> // For alloca diff --git a/cpp/src/qpid/framing/TransferContent.h b/cpp/src/qpid/framing/TransferContent.h index e3f6666fa4..236a0b6d93 100644 --- a/cpp/src/qpid/framing/TransferContent.h +++ b/cpp/src/qpid/framing/TransferContent.h @@ -26,6 +26,7 @@ #include "qpid/Exception.h" #include "qpid/framing/MessageProperties.h" #include "qpid/framing/DeliveryProperties.h" +#include "qpid/CommonImportExport.h" namespace qpid { namespace framing { @@ -36,27 +37,27 @@ class TransferContent : public MethodContent AMQHeaderBody header; std::string data; public: - TransferContent(const std::string& data = std::string(), const std::string& key=std::string()); + QPID_COMMON_EXTERN TransferContent(const std::string& data = std::string(), const std::string& key=std::string()); ///@internal - AMQHeaderBody getHeader() const; + QPID_COMMON_EXTERN AMQHeaderBody getHeader() const; - void setData(const std::string&); - const std::string& getData() const; - std::string& getData(); + QPID_COMMON_EXTERN void setData(const std::string&); + QPID_COMMON_EXTERN const std::string& getData() const; + QPID_COMMON_EXTERN std::string& getData(); - void appendData(const std::string&); + QPID_COMMON_EXTERN void appendData(const std::string&); - bool hasMessageProperties() const; - MessageProperties& getMessageProperties(); - const MessageProperties& getMessageProperties() const; + QPID_COMMON_EXTERN bool hasMessageProperties() const; + QPID_COMMON_EXTERN MessageProperties& getMessageProperties(); + QPID_COMMON_EXTERN const MessageProperties& getMessageProperties() const; - bool hasDeliveryProperties() const; - DeliveryProperties& getDeliveryProperties(); - const DeliveryProperties& getDeliveryProperties() const; + QPID_COMMON_EXTERN bool hasDeliveryProperties() const; + QPID_COMMON_EXTERN DeliveryProperties& getDeliveryProperties(); + QPID_COMMON_EXTERN const DeliveryProperties& getDeliveryProperties() const; ///@internal - void populate(const FrameSet& frameset); + QPID_COMMON_EXTERN void populate(const FrameSet& frameset); }; }} diff --git a/cpp/src/qpid/framing/Uuid.h b/cpp/src/qpid/framing/Uuid.h index 7037c5be29..fe0c32dc0b 100644 --- a/cpp/src/qpid/framing/Uuid.h +++ b/cpp/src/qpid/framing/Uuid.h @@ -19,6 +19,7 @@ * */ +#include "qpid/CommonImportExport.h" #include "qpid/sys/uuid.h" #include "qpid/sys/IntegerTypes.h" @@ -64,12 +65,12 @@ struct Uuid : public boost::array<uint8_t, 16> { // Default op= and copy ctor are fine. // boost::array gives us ==, < etc. - void encode(framing::Buffer& buf) const; - void decode(framing::Buffer& buf); - uint32_t encodedSize() const { return size(); } + 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. */ - std::string str() const; + QPID_COMMON_EXTERN std::string str() const; template <class S> void serialize(S& s) { s.raw(begin(), size()); @@ -77,10 +78,10 @@ struct Uuid : public boost::array<uint8_t, 16> { }; /** Print in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ -std::ostream& operator<<(std::ostream&, Uuid); +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, Uuid); /** Read from format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ -std::istream& operator>>(std::istream&, Uuid&); +QPID_COMMON_EXTERN std::istream& operator>>(std::istream&, Uuid&); }} // namespace qpid::framing diff --git a/cpp/src/qpid/log/Logger.h b/cpp/src/qpid/log/Logger.h index 539c1c851b..0cbd7685d6 100644 --- a/cpp/src/qpid/log/Logger.h +++ b/cpp/src/qpid/log/Logger.h @@ -18,6 +18,7 @@ #include <boost/ptr_container/ptr_vector.hpp> #include <boost/noncopyable.hpp> #include <set> +#include "qpid/CommonImportExport.h" namespace qpid { namespace log { @@ -48,48 +49,48 @@ class Logger : private boost::noncopyable { */ class Output { public: - Output(); - virtual ~Output(); + 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; }; - static Logger& instance(); + QPID_COMMON_EXTERN static Logger& instance(); - Logger(); - ~Logger(); + QPID_COMMON_EXTERN Logger(); + QPID_COMMON_EXTERN ~Logger(); /** Select the messages to be logged. */ - void select(const Selector& s); + QPID_COMMON_EXTERN void select(const Selector& s); /** Set the formatting flags, bitwise OR of FormatFlag values. */ - void format(int formatFlags); + QPID_COMMON_EXTERN void format(int formatFlags); /** Set format flags from options object. *@returns computed flags. */ - int format(const Options&); + QPID_COMMON_EXTERN int format(const Options&); /** Configure logger from Options */ - void configure(const Options& o); + QPID_COMMON_EXTERN void configure(const Options& o); /** Add a statement. */ - void add(Statement& s); + QPID_COMMON_EXTERN void add(Statement& s); /** Log a message. */ - void log(const Statement&, const std::string&); + QPID_COMMON_EXTERN void log(const Statement&, const std::string&); /** Add an output destination for messages */ - void output(std::auto_ptr<Output> out); + QPID_COMMON_EXTERN void output(std::auto_ptr<Output> out); /** Set a prefix for all messages */ - void setPrefix(const std::string& prefix); + QPID_COMMON_EXTERN void setPrefix(const std::string& prefix); /** Reset the logger. */ - void clear(); + QPID_COMMON_EXTERN void clear(); /** Get the options used to configure the logger. */ - const Options& getOptions() const { return options; } + QPID_COMMON_EXTERN const Options& getOptions() const { return options; } private: diff --git a/cpp/src/qpid/log/Options.h b/cpp/src/qpid/log/Options.h index 8a3c352d14..5e7bd433af 100644 --- a/cpp/src/qpid/log/Options.h +++ b/cpp/src/qpid/log/Options.h @@ -19,6 +19,7 @@ * */ #include "qpid/Options.h" +#include "qpid/CommonImportExport.h" #include "SinkOptions.h" #include <iosfwd> #include <memory> @@ -29,11 +30,11 @@ namespace log { /** Logging options for config parser. */ struct Options : public qpid::Options { /** Pass argv[0] for use in syslog output */ - Options(const std::string& argv0_=std::string(), + QPID_COMMON_EXTERN Options(const std::string& argv0_=std::string(), const std::string& name_="Logging options"); - Options(const Options &); + QPID_COMMON_EXTERN Options(const Options &); - Options& operator=(const Options&); + QPID_COMMON_EXTERN Options& operator=(const Options&); std::string argv0; std::string name; diff --git a/cpp/src/qpid/log/OstreamOutput.h b/cpp/src/qpid/log/OstreamOutput.h index 8bbfc8c38b..8df38468ad 100644 --- a/cpp/src/qpid/log/OstreamOutput.h +++ b/cpp/src/qpid/log/OstreamOutput.h @@ -26,8 +26,8 @@ namespace log { */ class OstreamOutput : public qpid::log::Logger::Output { public: - OstreamOutput(std::ostream& o); - OstreamOutput(const std::string& file); + QPID_COMMON_EXTERN OstreamOutput(std::ostream& o); + QPID_COMMON_EXTERN OstreamOutput(const std::string& file); virtual void log(const Statement&, const std::string& m); diff --git a/cpp/src/qpid/log/Selector.h b/cpp/src/qpid/log/Selector.h index 705abfeb5d..070ffd4abf 100644 --- a/cpp/src/qpid/log/Selector.h +++ b/cpp/src/qpid/log/Selector.h @@ -20,6 +20,7 @@ */ #include "Statement.h" +#include "qpid/CommonImportExport.h" #include <vector> namespace qpid { @@ -37,7 +38,7 @@ class Selector { Selector() {} /** Set selector from Options */ - Selector(const Options&); + QPID_COMMON_EXTERN Selector(const Options&); /** Equavlient to: Selector s; s.enable(l, s) */ Selector(Level l, const std::string& s=std::string()) { @@ -54,10 +55,10 @@ class Selector { } /** Enable based on a 'level[+]:file' string */ - void enable(const std::string& enableStr); + QPID_COMMON_EXTERN void enable(const std::string& enableStr); /** True if level is enabled for file. */ - bool isEnabled(Level level, const char* function); + QPID_COMMON_EXTERN bool isEnabled(Level level, const char* function); private: std::vector<std::string> substrings[LevelTraits::COUNT]; diff --git a/cpp/src/qpid/log/Statement.h b/cpp/src/qpid/log/Statement.h index 3c67b04b20..445f635cdd 100644 --- a/cpp/src/qpid/log/Statement.h +++ b/cpp/src/qpid/log/Statement.h @@ -20,7 +20,7 @@ */ #include "qpid/Msg.h" - +#include "qpid/CommonImportExport.h" #include <boost/current_function.hpp> namespace qpid { @@ -63,10 +63,10 @@ struct Statement { const char* function; Level level; - void log(const std::string& message); + QPID_COMMON_EXTERN void log(const std::string& message); struct Initializer { - Initializer(Statement& s); + QPID_COMMON_EXTERN Initializer(Statement& s); Statement& statement; }; }; diff --git a/cpp/src/qpid/log/windows/SinkOptions.h b/cpp/src/qpid/log/windows/SinkOptions.h index d14e9352be..605822fd46 100644 --- a/cpp/src/qpid/log/windows/SinkOptions.h +++ b/cpp/src/qpid/log/windows/SinkOptions.h @@ -27,20 +27,20 @@ namespace log { namespace windows { struct SinkOptions : public qpid::log::SinkOptions { - SinkOptions(const std::string& argv0); + QPID_COMMON_EXTERN SinkOptions(const std::string& argv0); virtual ~SinkOptions() {} - virtual qpid::log::SinkOptions& operator=(const qpid::log::SinkOptions& rhs); + QPID_COMMON_EXTERN virtual qpid::log::SinkOptions& operator=(const qpid::log::SinkOptions& rhs); // This allows the caller to indicate that there's no normal outputs // available. For example, when running as a service. 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); + QPID_COMMON_EXTERN virtual void detached(void); // The Logger acting on these options calls setup() to request any // Sinks be set up and fed back to the logger. - virtual void setup(qpid::log::Logger *logger); + QPID_COMMON_EXTERN virtual void setup(qpid::log::Logger *logger); bool logToStderr; bool logToStdout; diff --git a/cpp/src/qpid/management/Manageable.h b/cpp/src/qpid/management/Manageable.h index b4d80d8fad..ededa6141e 100644 --- a/cpp/src/qpid/management/Manageable.h +++ b/cpp/src/qpid/management/Manageable.h @@ -23,11 +23,12 @@ #include "ManagementObject.h" #include "Args.h" #include <string> +#include "qpid/CommonImportExport.h" namespace qpid { namespace management { -class Manageable +class QPID_COMMON_EXTERN Manageable { public: diff --git a/cpp/src/qpid/management/ManagementObject.h b/cpp/src/qpid/management/ManagementObject.h index fbdad347b8..498169318d 100644 --- a/cpp/src/qpid/management/ManagementObject.h +++ b/cpp/src/qpid/management/ManagementObject.h @@ -25,6 +25,7 @@ #include "qpid/sys/Time.h" #include "qpid/sys/Mutex.h" #include <qpid/framing/Buffer.h> +#include "qpid/CommonImportExport.h" #include <map> namespace qpid { @@ -41,7 +42,7 @@ private: uint64_t first; public: AgentAttachment() : first(0) {} - void setBanks(uint32_t broker, uint32_t bank); + QPID_COMMON_EXTERN void setBanks(uint32_t broker, uint32_t bank); uint64_t getFirst() const { return first; } }; @@ -53,17 +54,17 @@ protected: uint64_t second; void fromString(const std::string&); public: - ObjectId() : agent(0), first(0), second(0) {} - ObjectId(framing::Buffer& buf) : agent(0) { decode(buf); } - ObjectId(uint8_t flags, uint16_t seq, uint32_t broker, uint32_t bank, uint64_t object); - ObjectId(AgentAttachment* _agent, uint8_t flags, uint16_t seq, uint64_t object); - ObjectId(std::istream&); - ObjectId(const std::string&); - bool operator==(const ObjectId &other) const; - bool operator<(const ObjectId &other) const; - void encode(framing::Buffer& buffer); - void decode(framing::Buffer& buffer); - friend std::ostream& operator<<(std::ostream&, const ObjectId&); + 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 { @@ -128,8 +129,8 @@ class ManagementObject : public ManagementItem static int nextThreadIndex; bool forcePublish; - int getThreadIndex(); - void writeTimestamps(qpid::framing::Buffer& buf); + QPID_COMMON_EXTERN int getThreadIndex(); + QPID_COMMON_EXTERN void writeTimestamps(qpid::framing::Buffer& buf); public: typedef void (*writeSchemaCall_t) (qpid::framing::Buffer&); @@ -148,7 +149,7 @@ class ManagementObject : public ManagementItem virtual void doMethod(std::string& methodName, qpid::framing::Buffer& inBuf, qpid::framing::Buffer& outBuf) = 0; - virtual void setReference(ObjectId objectId); + QPID_COMMON_EXTERN virtual void setReference(ObjectId objectId); virtual std::string& getClassName() const = 0; virtual std::string& getPackageName() const = 0; diff --git a/cpp/src/qpid/sys/AggregateOutput.h b/cpp/src/qpid/sys/AggregateOutput.h index 1cda4456b4..fcd0d4c2f7 100644 --- a/cpp/src/qpid/sys/AggregateOutput.h +++ b/cpp/src/qpid/sys/AggregateOutput.h @@ -24,6 +24,7 @@ #include "Mutex.h" #include "OutputControl.h" #include "OutputTask.h" +#include "qpid/CommonImportExport.h" #include <algorithm> #include <vector> @@ -42,15 +43,15 @@ namespace sys { public: AggregateOutput(OutputControl& c) : next(0), control(c) {}; //this may be called on any thread - void activateOutput(); - void giveReadCredit(int32_t); + QPID_COMMON_EXTERN void activateOutput(); + QPID_COMMON_EXTERN void giveReadCredit(int32_t); //all the following will be called on the same thread - bool doOutput(); - bool hasOutput(); - void addOutputTask(OutputTask* t); - void removeOutputTask(OutputTask* t); - void removeAll(); + QPID_COMMON_EXTERN bool doOutput(); + QPID_COMMON_EXTERN bool hasOutput(); + QPID_COMMON_EXTERN void addOutputTask(OutputTask* t); + QPID_COMMON_EXTERN void removeOutputTask(OutputTask* t); + QPID_COMMON_EXTERN void removeAll(); /** Apply f to each OutputTask* in the tasks list */ template <class F> void eachOutput(F f) { diff --git a/cpp/src/qpid/sys/AsynchIO.h b/cpp/src/qpid/sys/AsynchIO.h index ffd4436c2a..fb02183359 100644 --- a/cpp/src/qpid/sys/AsynchIO.h +++ b/cpp/src/qpid/sys/AsynchIO.h @@ -22,7 +22,7 @@ */ #include "qpid/sys/IntegerTypes.h" - +#include "qpid/CommonImportExport.h" #include <boost/function.hpp> #include <boost/shared_ptr.hpp> @@ -45,9 +45,9 @@ private: AsynchAcceptorPrivate* impl; public: - AsynchAcceptor(const Socket& s, Callback callback); - ~AsynchAcceptor(); - void start(boost::shared_ptr<Poller> poller); + QPID_COMMON_EXTERN AsynchAcceptor(const Socket& s, Callback callback); + QPID_COMMON_EXTERN ~AsynchAcceptor(); + QPID_COMMON_EXTERN void start(boost::shared_ptr<Poller> poller); }; /* @@ -65,7 +65,7 @@ public: // create a correctly typed object. The platform code also manages // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. - static AsynchConnector* create(const Socket& s, + QPID_COMMON_EXTERN static AsynchConnector* create(const Socket& s, boost::shared_ptr<Poller> poller, std::string hostname, uint16_t port, @@ -121,7 +121,7 @@ public: // create a correctly typed object. The platform code also manages // deletes. To correctly manage heaps when needed, the allocate and // delete should both be done from the same class/library. - static AsynchIO* create(const Socket& s, + QPID_COMMON_EXTERN static AsynchIO* create(const Socket& s, ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb, diff --git a/cpp/src/qpid/sys/AsynchIOHandler.h b/cpp/src/qpid/sys/AsynchIOHandler.h index fa020fbce4..9f1d043b62 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.h +++ b/cpp/src/qpid/sys/AsynchIOHandler.h @@ -25,6 +25,7 @@ #include "ConnectionCodec.h" #include "AtomicValue.h" #include "Mutex.h" +#include "qpid/CommonImportExport.h" namespace qpid { @@ -52,26 +53,26 @@ class AsynchIOHandler : public OutputControl { void write(const framing::ProtocolInitiation&); public: - AsynchIOHandler(std::string id, ConnectionCodec::Factory* f); - ~AsynchIOHandler(); - void init(AsynchIO* a, int numBuffs); + QPID_COMMON_EXTERN AsynchIOHandler(std::string id, ConnectionCodec::Factory* f); + QPID_COMMON_EXTERN ~AsynchIOHandler(); + QPID_COMMON_EXTERN void init(AsynchIO* a, int numBuffs); - void setClient() { isClient = true; } + QPID_COMMON_EXTERN void setClient() { isClient = true; } // Output side - void close(); - void activateOutput(); - void giveReadCredit(int32_t credit); + QPID_COMMON_EXTERN void close(); + QPID_COMMON_EXTERN void activateOutput(); + QPID_COMMON_EXTERN void giveReadCredit(int32_t credit); // Input side - bool readbuff(AsynchIO& aio, AsynchIOBufferBase* buff); - void eof(AsynchIO& aio); - void disconnect(AsynchIO& aio); + QPID_COMMON_EXTERN bool readbuff(AsynchIO& aio, AsynchIOBufferBase* buff); + QPID_COMMON_EXTERN void eof(AsynchIO& aio); + QPID_COMMON_EXTERN void disconnect(AsynchIO& aio); // Notifications - void nobuffs(AsynchIO& aio); - void idle(AsynchIO& aio); - void closedSocket(AsynchIO& aio, const Socket& s); + QPID_COMMON_EXTERN void nobuffs(AsynchIO& aio); + QPID_COMMON_EXTERN void idle(AsynchIO& aio); + QPID_COMMON_EXTERN void closedSocket(AsynchIO& aio, const Socket& s); }; }} // namespace qpid::sys diff --git a/cpp/src/qpid/sys/DispatchHandle.h b/cpp/src/qpid/sys/DispatchHandle.h index fb114ce5be..bc9f98775e 100644 --- a/cpp/src/qpid/sys/DispatchHandle.h +++ b/cpp/src/qpid/sys/DispatchHandle.h @@ -24,7 +24,7 @@ #include "Poller.h" #include "Mutex.h" - +#include "qpid/CommonImportExport.h" #include <boost/function.hpp> #include <queue> @@ -83,7 +83,7 @@ public: *@param wCb Callback called when the handle is writable. *@param dCb Callback called when the handle is disconnected. */ - DispatchHandle(const IOHandle& h, Callback rCb, Callback wCb, Callback dCb) : + QPID_COMMON_EXTERN DispatchHandle(const IOHandle& h, Callback rCb, Callback wCb, Callback dCb) : PollerHandle(h), readableCallback(rCb), writableCallback(wCb), @@ -91,42 +91,42 @@ public: state(IDLE) {} - ~DispatchHandle(); + QPID_COMMON_EXTERN ~DispatchHandle(); /** Add this DispatchHandle to the poller to be watched. */ - void startWatch(Poller::shared_ptr poller); + QPID_COMMON_EXTERN void startWatch(Poller::shared_ptr poller); /** Resume watching for all non-0 callbacks. */ - void rewatch(); + QPID_COMMON_EXTERN void rewatch(); /** Resume watching for read only. */ - void rewatchRead(); + QPID_COMMON_EXTERN void rewatchRead(); /** Resume watching for write only. */ - void rewatchWrite(); + QPID_COMMON_EXTERN void rewatchWrite(); /** Stop watching temporarily. The DispatchHandle remains associated with the poller and can be re-activated using rewatch. */ - void unwatch(); + QPID_COMMON_EXTERN void unwatch(); /** Stop watching for read */ - void unwatchRead(); + QPID_COMMON_EXTERN void unwatchRead(); /** Stop watching for write */ - void unwatchWrite(); + QPID_COMMON_EXTERN void unwatchWrite(); /** Stop watching permanently. Disassociates from the poller. */ - void stopWatch(); + QPID_COMMON_EXTERN void stopWatch(); /** Interrupt watching this handle and make a serialised callback that respects the * same exclusivity guarantees as the other callbacks */ - void call(Callback iCb); + QPID_COMMON_EXTERN void call(Callback iCb); protected: /** Override to get extra processing done when the DispatchHandle is deleted. */ - void doDelete(); + QPID_COMMON_EXTERN void doDelete(); private: - void processEvent(Poller::EventType dir); + QPID_COMMON_EXTERN void processEvent(Poller::EventType dir); }; class DispatchHandleRef { diff --git a/cpp/src/qpid/sys/Dispatcher.h b/cpp/src/qpid/sys/Dispatcher.h index f7c9e8d731..2f3ed10901 100644 --- a/cpp/src/qpid/sys/Dispatcher.h +++ b/cpp/src/qpid/sys/Dispatcher.h @@ -24,6 +24,7 @@ #include "Poller.h" #include "Runnable.h" +#include "qpid/CommonImportExport.h" namespace qpid { namespace sys { @@ -32,10 +33,10 @@ class Dispatcher : public Runnable { const Poller::shared_ptr poller; public: - Dispatcher(Poller::shared_ptr poller); - ~Dispatcher(); + QPID_COMMON_EXTERN Dispatcher(Poller::shared_ptr poller); + QPID_COMMON_EXTERN ~Dispatcher(); - void run(); + QPID_COMMON_EXTERN void run(); }; }} diff --git a/cpp/src/qpid/sys/IOHandle.h b/cpp/src/qpid/sys/IOHandle.h index 0bf2abbafa..656e5e1efd 100644 --- a/cpp/src/qpid/sys/IOHandle.h +++ b/cpp/src/qpid/sys/IOHandle.h @@ -22,6 +22,8 @@ * */ +#include "qpid/CommonImportExport.h" + namespace qpid { namespace sys { @@ -50,8 +52,8 @@ class IOHandle { protected: IOHandlePrivate* const impl; - IOHandle(IOHandlePrivate*); - virtual ~IOHandle(); + IOHandle(IOHandlePrivate*); + QPID_COMMON_EXTERN virtual ~IOHandle(); }; }} diff --git a/cpp/src/qpid/sys/PollableCondition.h b/cpp/src/qpid/sys/PollableCondition.h index 49e84e6cb0..f49fb22cb4 100644 --- a/cpp/src/qpid/sys/PollableCondition.h +++ b/cpp/src/qpid/sys/PollableCondition.h @@ -23,6 +23,7 @@ */ #include "qpid/sys/Poller.h" +#include "qpid/CommonImportExport.h" #include <boost/function.hpp> #include <boost/shared_ptr.hpp> @@ -36,35 +37,35 @@ class PollableCondition { public: typedef boost::function1<void, PollableCondition&> Callback; - PollableCondition(const Callback& cb, + QPID_COMMON_EXTERN PollableCondition(const Callback& cb, const boost::shared_ptr<sys::Poller>& poller); - ~PollableCondition(); + QPID_COMMON_EXTERN ~PollableCondition(); /** * Set the condition. Triggers callback to Callback from Poller. * When callback is made, condition is suspended. Call rearm() to * resume reacting to the condition. */ - void set(); + QPID_COMMON_EXTERN void set(); /** * Get the current state of the condition, then clear it. * * @return The state of the condition before it was cleared. */ - bool clear(); + QPID_COMMON_EXTERN bool clear(); /** * Temporarily suspend the ability for the poller to react to the * condition. It can be rearm()ed later. */ - void disarm(); + QPID_COMMON_EXTERN void disarm(); /** * Reset the ability for the poller to react to the condition. */ - void rearm(); + QPID_COMMON_EXTERN void rearm(); private: PollableConditionPrivate *impl; diff --git a/cpp/src/qpid/sys/Poller.h b/cpp/src/qpid/sys/Poller.h index 96b4b9c361..825ad8bfed 100644 --- a/cpp/src/qpid/sys/Poller.h +++ b/cpp/src/qpid/sys/Poller.h @@ -24,7 +24,7 @@ #include "Time.h" #include "Runnable.h" - +#include "qpid/CommonImportExport.h" #include <boost/shared_ptr.hpp> namespace qpid { @@ -74,10 +74,10 @@ public: void process(); }; - Poller(); - ~Poller(); + QPID_COMMON_EXTERN Poller(); + QPID_COMMON_EXTERN ~Poller(); /** Note: this function is async-signal safe */ - void shutdown(); + QPID_COMMON_EXTERN void shutdown(); // Interrupt waiting for a specific poller handle // returns true if we could interrupt the handle @@ -89,16 +89,16 @@ public: // reported and has not been reenabled since. // - Because it was removed from the monitoring set // - Or because it is already being interrupted - bool interrupt(PollerHandle& handle); + QPID_COMMON_EXTERN bool interrupt(PollerHandle& handle); // Poller run loop - void run(); + QPID_COMMON_EXTERN void run(); - void addFd(PollerHandle& handle, Direction dir); - void delFd(PollerHandle& handle); - void modFd(PollerHandle& handle, Direction dir); - void rearmFd(PollerHandle& handle); - Event wait(Duration timeout = TIME_INFINITE); + QPID_COMMON_EXTERN void addFd(PollerHandle& handle, Direction dir); + QPID_COMMON_EXTERN void delFd(PollerHandle& handle); + QPID_COMMON_EXTERN void modFd(PollerHandle& handle, Direction dir); + QPID_COMMON_EXTERN void rearmFd(PollerHandle& handle); + QPID_COMMON_EXTERN Event wait(Duration timeout = TIME_INFINITE); }; /** @@ -111,11 +111,11 @@ class PollerHandle { friend struct Poller::Event; PollerHandlePrivate* const impl; - virtual void processEvent(Poller::EventType) {}; + QPID_COMMON_EXTERN virtual void processEvent(Poller::EventType) {}; public: - PollerHandle(const IOHandle& h); - virtual ~PollerHandle(); + QPID_COMMON_EXTERN PollerHandle(const IOHandle& h); + QPID_COMMON_EXTERN virtual ~PollerHandle(); }; inline void Poller::Event::process() { diff --git a/cpp/src/qpid/sys/Runnable.h b/cpp/src/qpid/sys/Runnable.h index fb3927c612..4bf43c93d1 100644 --- a/cpp/src/qpid/sys/Runnable.h +++ b/cpp/src/qpid/sys/Runnable.h @@ -22,6 +22,7 @@ */ #include <boost/function.hpp> +#include "qpid/CommonImportExport.h" namespace qpid { namespace sys { @@ -35,7 +36,7 @@ class Runnable /** Type to represent a runnable as a Functor */ typedef boost::function0<void> Functor; - virtual ~Runnable(); + QPID_COMMON_EXTERN virtual ~Runnable(); /** Derived classes override run(). */ virtual void run() = 0; diff --git a/cpp/src/qpid/sys/Shlib.h b/cpp/src/qpid/sys/Shlib.h index a6d94b42d4..7f66cfec14 100644 --- a/cpp/src/qpid/sys/Shlib.h +++ b/cpp/src/qpid/sys/Shlib.h @@ -21,7 +21,8 @@ * under the License. * */ - + +#include "qpid/CommonImportExport.h" #include <boost/noncopyable.hpp> #include <iostream> @@ -40,10 +41,10 @@ class Shlib { Shlib(const std::string& libname) { load(libname.c_str()); } /** Unload shared library. */ - void unload(); + QPID_COMMON_EXTERN void unload(); /** Look up symbol. */ - void* getSymbol(const char* symbol); + QPID_COMMON_EXTERN void* getSymbol(const char* symbol); /** Look up symbol in shared library, cast it to the desired * pointer type, void* by default. @@ -57,7 +58,7 @@ class Shlib { private: void* handle; - void load(const char* libname); + QPID_COMMON_EXTERN void load(const char* libname); }; /** A shared library handle that unloads the shlib in it's dtor */ @@ -66,7 +67,7 @@ class AutoShlib : public Shlib { /** Load shared library */ AutoShlib(const std::string& libname) : Shlib(libname) {} /** Calls unload() */ - ~AutoShlib() throw(); + QPID_COMMON_EXTERN ~AutoShlib() throw(); }; diff --git a/cpp/src/qpid/sys/Socket.h b/cpp/src/qpid/sys/Socket.h index 9b749bdf5e..e6555f5774 100644 --- a/cpp/src/qpid/sys/Socket.h +++ b/cpp/src/qpid/sys/Socket.h @@ -24,7 +24,7 @@ #include "IOHandle.h" #include "qpid/sys/IntegerTypes.h" - +#include "qpid/CommonImportExport.h" #include <string> namespace qpid { @@ -36,7 +36,7 @@ class Socket : public IOHandle { public: /** Create a socket wrapper for descriptor. */ - Socket(); + QPID_COMMON_EXTERN Socket(); /** Create an initialized TCP socket */ void createTcp() const; @@ -47,21 +47,21 @@ public: /** Set socket non blocking */ void setNonblocking() const; - void connect(const std::string& host, uint16_t port) const; + QPID_COMMON_EXTERN void connect(const std::string& host, uint16_t port) const; - void close() const; + QPID_COMMON_EXTERN void close() const; /** Bind to a port and start listening. *@param port 0 means choose an available port. *@param backlog maximum number of pending connections. *@return The bound port. */ - int listen(uint16_t port = 0, int backlog = 10) const; + QPID_COMMON_EXTERN int listen(uint16_t port = 0, int backlog = 10) const; /** Returns the "socket name" ie the address bound to * the near end of the socket */ - std::string getSockname() const; + QPID_COMMON_EXTERN std::string getSockname() const; /** Returns the "peer name" ie the address bound to * the remote end of the socket @@ -72,14 +72,14 @@ public: * Returns an address (host and port) for the remote end of the * socket */ - std::string getPeerAddress() const; + QPID_COMMON_EXTERN std::string getPeerAddress() const; /** * Returns an address (host and port) for the local end of the * socket */ std::string getLocalAddress() const; - uint16_t getLocalPort() const; + QPID_COMMON_EXTERN uint16_t getLocalPort() const; uint16_t getRemotePort() const; /** @@ -91,13 +91,13 @@ public: /** Accept a connection from a socket that is already listening * and has an incoming connection */ - Socket* accept() const; + QPID_COMMON_EXTERN Socket* accept() const; // TODO The following are raw operations, maybe they need better wrapping? - int read(void *buf, size_t count) const; - int write(const void *buf, size_t count) const; + QPID_COMMON_EXTERN int read(void *buf, size_t count) const; + QPID_COMMON_EXTERN int write(const void *buf, size_t count) const; - void setTcpNoDelay(bool nodelay) const; + QPID_COMMON_EXTERN void setTcpNoDelay(bool nodelay) const; private: Socket(IOHandlePrivate*); diff --git a/cpp/src/qpid/sys/StrError.h b/cpp/src/qpid/sys/StrError.h index 3843f2abe1..69cc7e714c 100644 --- a/cpp/src/qpid/sys/StrError.h +++ b/cpp/src/qpid/sys/StrError.h @@ -23,12 +23,13 @@ */ #include <string> +#include "qpid/CommonImportExport.h" namespace qpid { namespace sys { /** Get the error message for a system number err, e.g. errno. */ -std::string strError(int err); +QPID_COMMON_EXTERN std::string strError(int err); }} // namespace qpid diff --git a/cpp/src/qpid/sys/SystemInfo.h b/cpp/src/qpid/sys/SystemInfo.h index 017a05e2c5..6e97022b36 100644 --- a/cpp/src/qpid/sys/SystemInfo.h +++ b/cpp/src/qpid/sys/SystemInfo.h @@ -23,6 +23,7 @@ #include "qpid/sys/IntegerTypes.h" #include "qpid/Address.h" +#include "qpid/CommonImportExport.h" namespace qpid { namespace sys { @@ -36,15 +37,15 @@ namespace SystemInfo { * Estimate available concurrency, e.g. number of CPU cores. * -1 means estimate not available on this platform. */ - long concurrency(); + 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. */ - bool getLocalHostname (TcpAddress &address); + QPID_COMMON_EXTERN bool getLocalHostname (TcpAddress &address); - void getLocalIpAddresses (uint16_t port, std::vector<Address> &addrList); + QPID_COMMON_EXTERN void getLocalIpAddresses (uint16_t port, std::vector<Address> &addrList); /** * Retrieve system identifiers and versions. This is information that can @@ -57,7 +58,7 @@ namespace SystemInfo { * @param version Receives the OS release version (kernel, build, sp, etc.) * @param machine Receives the hardware type. */ - void getSystemId (std::string &osName, + QPID_COMMON_EXTERN void getSystemId (std::string &osName, std::string &nodeName, std::string &release, std::string &version, @@ -66,17 +67,17 @@ namespace SystemInfo { /** * Get the process ID of the current process. */ - uint32_t getProcessId(); + QPID_COMMON_EXTERN uint32_t getProcessId(); /** * Get the process ID of the parent of the current process. */ - uint32_t getParentProcessId(); + QPID_COMMON_EXTERN uint32_t getParentProcessId(); /** * Get the name of the current process (i.e. the name of the executable) */ - std::string getProcessName(); + QPID_COMMON_EXTERN std::string getProcessName(); }}} // namespace qpid::sys::SystemInfo diff --git a/cpp/src/qpid/sys/Thread.h b/cpp/src/qpid/sys/Thread.h index 1531f9619c..b532d4d80a 100644 --- a/cpp/src/qpid/sys/Thread.h +++ b/cpp/src/qpid/sys/Thread.h @@ -22,6 +22,7 @@ * */ #include <boost/shared_ptr.hpp> +#include "qpid/CommonImportExport.h" #ifdef _WIN32 # define QPID_TSS __declspec(thread) @@ -44,15 +45,15 @@ class Thread boost::shared_ptr<ThreadPrivate> impl; public: - Thread(); - explicit Thread(qpid::sys::Runnable*); - explicit Thread(qpid::sys::Runnable&); + QPID_COMMON_EXTERN Thread(); + QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable*); + QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable&); - void join(); + QPID_COMMON_EXTERN void join(); - unsigned long id(); + QPID_COMMON_EXTERN unsigned long id(); - static Thread current(); + QPID_COMMON_EXTERN static Thread current(); /** ID of current thread for logging. * Workaround for broken Thread::current() in APR diff --git a/cpp/src/qpid/sys/Time.h b/cpp/src/qpid/sys/Time.h index d39be95434..b7173406ca 100644 --- a/cpp/src/qpid/sys/Time.h +++ b/cpp/src/qpid/sys/Time.h @@ -33,6 +33,8 @@ # include "posix/Time.h" #endif +#include "qpid/CommonImportExport.h" + #include <limits> #include <iosfwd> @@ -86,23 +88,23 @@ class AbsTime { TimePrivate timepoint; public: - inline AbsTime() {} - AbsTime(const AbsTime& time0, const Duration& duration); + QPID_COMMON_EXTERN inline AbsTime() {} + QPID_COMMON_EXTERN AbsTime(const AbsTime& time0, const Duration& duration); // Default assignment operation fine // Default copy constructor fine - static AbsTime now(); - static AbsTime FarFuture(); + 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); - friend std::ostream& operator << (std::ostream&, const AbsTime&); + QPID_COMMON_EXTERN friend std::ostream& operator << (std::ostream&, const AbsTime&); }; -std::ostream& operator << (std::ostream&, const AbsTime&); +QPID_COMMON_EXTERN std::ostream& operator << (std::ostream&, const AbsTime&); /** * @class Duration @@ -120,9 +122,9 @@ class Duration { friend class AbsTime; public: - inline Duration(int64_t time0); - explicit Duration(const AbsTime& time0); - explicit Duration(const AbsTime& start, const AbsTime& finish); + 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; }; @@ -158,10 +160,10 @@ const Duration TIME_INFINITE = std::numeric_limits<int64_t>::max(); const AbsTime FAR_FUTURE = AbsTime::FarFuture(); /** Portable sleep for a number of seconds */ -void sleep(int secs); +QPID_COMMON_EXTERN void sleep(int secs); /** Portable sleep for a number of microseconds */ -void usleep(uint64_t usecs); +QPID_COMMON_EXTERN void usleep(uint64_t usecs); }} diff --git a/cpp/src/qpid/sys/Timer.h b/cpp/src/qpid/sys/Timer.h index 2561e41034..dab2f55edb 100644 --- a/cpp/src/qpid/sys/Timer.h +++ b/cpp/src/qpid/sys/Timer.h @@ -25,7 +25,7 @@ #include "qpid/sys/Thread.h" #include "qpid/sys/Runnable.h" #include "qpid/RefCounted.h" - +#include "qpid/CommonImportExport.h" #include <memory> #include <queue> @@ -49,15 +49,15 @@ class TimerTask : public RefCounted { void fireTask(); public: - TimerTask(Duration period); - TimerTask(AbsTime fireTime); - virtual ~TimerTask(); + QPID_COMMON_EXTERN TimerTask(Duration period); + QPID_COMMON_EXTERN TimerTask(AbsTime fireTime); + QPID_COMMON_EXTERN virtual ~TimerTask(); - void setupNextFire(); - void restart(); - void delayTill(AbsTime fireTime); - void cancel(); - bool isCancelled() const; + QPID_COMMON_EXTERN void setupNextFire(); + QPID_COMMON_EXTERN void restart(); + QPID_COMMON_EXTERN void delayTill(AbsTime fireTime); + QPID_COMMON_EXTERN void cancel(); + QPID_COMMON_EXTERN bool isCancelled() const; protected: // Must be overridden with callback @@ -78,12 +78,12 @@ class Timer : private Runnable { void run(); public: - Timer(); - ~Timer(); + QPID_COMMON_EXTERN Timer(); + QPID_COMMON_EXTERN ~Timer(); - void add(boost::intrusive_ptr<TimerTask> task); - void start(); - void stop(); + QPID_COMMON_EXTERN void add(boost::intrusive_ptr<TimerTask> task); + QPID_COMMON_EXTERN void start(); + QPID_COMMON_EXTERN void stop(); }; diff --git a/cpp/src/qpid/sys/alloca.h b/cpp/src/qpid/sys/alloca.h new file mode 100644 index 0000000000..e989670e4f --- /dev/null +++ b/cpp/src/qpid/sys/alloca.h @@ -0,0 +1,39 @@ +#ifndef QPID_SYS_ALLOCA_H +#define QPID_SYS_ALLOCA_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 <malloc.h> +#ifdef alloc +# undef alloc +#endif +#define alloc _alloc +#ifdef alloca +# undef alloca +#endif +#define alloca _alloca +#endif +#if !defined _WINDOWS && !defined WIN32 +#include <alloca.h> +#endif + +#endif /*!QPID_SYS_ALLOCA_H*/ diff --git a/cpp/src/qpid/sys/windows/uuid.h b/cpp/src/qpid/sys/windows/uuid.h index a44ef2e9a3..7d003c3739 100644 --- a/cpp/src/qpid/sys/windows/uuid.h +++ b/cpp/src/qpid/sys/windows/uuid.h @@ -23,6 +23,7 @@ */ #include <Rpc.h> +#include "qpid/CommonImportExport.h" #ifdef uuid_t /* Done in rpcdce.h */ # undef uuid_t @@ -31,11 +32,11 @@ namespace qpid { namespace sys { const size_t UuidSize = 16; }} typedef uint8_t uuid_t[qpid::sys::UuidSize]; -void uuid_clear (uuid_t uu); -void uuid_copy (uuid_t dst, const uuid_t src); -void uuid_generate (uuid_t out); -int uuid_is_null (const uuid_t uu); // Returns 1 if null, else 0 -int uuid_parse (const char *in, uuid_t uu); // Returns 0 on success, else -1 -void uuid_unparse (const uuid_t uu, char *out); +QPID_COMMON_EXTERN void uuid_clear (uuid_t uu); +QPID_COMMON_EXTERN void uuid_copy (uuid_t dst, const uuid_t src); +QPID_COMMON_EXTERN void uuid_generate (uuid_t out); +QPID_COMMON_EXTERN int uuid_is_null (const uuid_t uu); // Returns 1 if null, else 0 +QPID_COMMON_EXTERN int uuid_parse (const char *in, uuid_t uu); // Returns 0 on success, else -1 +QPID_COMMON_EXTERN void uuid_unparse (const uuid_t uu, char *out); #endif /*!_sys_windows_uuid_h*/ |