diff options
Diffstat (limited to 'cpp/src/qpid/sys')
| -rw-r--r-- | cpp/src/qpid/sys/AsynchIO.h | 37 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/AsynchIOHandler.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/AsynchIOHandler.h | 8 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/ProtocolFactory.h | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/TCPIOPlugin.cpp | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/posix/AsynchIO.cpp | 1 |
6 files changed, 34 insertions, 21 deletions
diff --git a/cpp/src/qpid/sys/AsynchIO.h b/cpp/src/qpid/sys/AsynchIO.h index 847bdc50e4..ff7823e00d 100644 --- a/cpp/src/qpid/sys/AsynchIO.h +++ b/cpp/src/qpid/sys/AsynchIO.h @@ -22,13 +22,14 @@ */ #include "Dispatcher.h" -#include "Socket.h" #include <boost/function.hpp> #include <deque> namespace qpid { namespace sys { + +class Socket; /* * Asynchronous acceptor: accepts connections then does a callback with the @@ -78,6 +79,23 @@ private: void failure(int, std::string); }; +struct AsynchIOBufferBase { + char* const bytes; + const int32_t byteCount; + int32_t dataStart; + int32_t dataCount; + + AsynchIOBufferBase(char* const b, const int32_t s) : + bytes(b), + byteCount(s), + dataStart(0), + dataCount(0) + {} + + virtual ~AsynchIOBufferBase() + {} +}; + /* * Asychronous reader/writer: * Reader accepts buffers to read into; reads into the provided buffers @@ -92,22 +110,7 @@ private: */ class AsynchIO : private DispatchHandle { public: - struct BufferBase { - char* const bytes; - const int32_t byteCount; - int32_t dataStart; - int32_t dataCount; - - BufferBase(char* const b, const int32_t s) : - bytes(b), - byteCount(s), - dataStart(0), - dataCount(0) - {} - - virtual ~BufferBase() - {} - }; + typedef AsynchIOBufferBase BufferBase; typedef boost::function2<void, AsynchIO&, BufferBase*> ReadCallback; typedef boost::function1<void, AsynchIO&> EofCallback; diff --git a/cpp/src/qpid/sys/AsynchIOHandler.cpp b/cpp/src/qpid/sys/AsynchIOHandler.cpp index ca2bd7c93c..886dbc8f43 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.cpp +++ b/cpp/src/qpid/sys/AsynchIOHandler.cpp @@ -20,6 +20,8 @@ */ #include "AsynchIOHandler.h" +#include "qpid/sys/AsynchIO.h" +#include "qpid/sys/Socket.h" #include "qpid/framing/AMQP_HighestVersion.h" #include "qpid/framing/ProtocolInitiation.h" #include "qpid/log/Statement.h" diff --git a/cpp/src/qpid/sys/AsynchIOHandler.h b/cpp/src/qpid/sys/AsynchIOHandler.h index 7448094a94..26e2cf4c5c 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.h +++ b/cpp/src/qpid/sys/AsynchIOHandler.h @@ -23,7 +23,6 @@ #include "OutputControl.h" #include "ConnectionCodec.h" -#include "AsynchIO.h" namespace qpid { @@ -32,6 +31,11 @@ namespace framing { } namespace sys { + +class AsynchIO; +class AsynchIOBufferBase; +class Socket; + class AsynchIOHandler : public OutputControl { std::string identifier; AsynchIO* aio; @@ -54,7 +58,7 @@ class AsynchIOHandler : public OutputControl { void activateOutput(); // Input side - void readbuff(AsynchIO& aio, AsynchIO::BufferBase* buff); + void readbuff(AsynchIO& aio, AsynchIOBufferBase* buff); void eof(AsynchIO& aio); void disconnect(AsynchIO& aio); diff --git a/cpp/src/qpid/sys/ProtocolFactory.h b/cpp/src/qpid/sys/ProtocolFactory.h index e8eaefe1f6..4aa14d2cf6 100644 --- a/cpp/src/qpid/sys/ProtocolFactory.h +++ b/cpp/src/qpid/sys/ProtocolFactory.h @@ -35,6 +35,8 @@ class Poller; class ProtocolFactory : public qpid::SharedObject<ProtocolFactory> { public: + typedef boost::function2<void, int, std::string> ConnectFailedCallback; + virtual ~ProtocolFactory() = 0; virtual uint16_t getPort() const = 0; virtual std::string getHost() const = 0; @@ -43,7 +45,7 @@ class ProtocolFactory : public qpid::SharedObject<ProtocolFactory> boost::shared_ptr<Poller>, const std::string& host, int16_t port, ConnectionCodec::Factory* codec, - boost::function2<void, int, std::string> failed) = 0; + ConnectFailedCallback failed) = 0; }; inline ProtocolFactory::~ProtocolFactory() {} diff --git a/cpp/src/qpid/sys/TCPIOPlugin.cpp b/cpp/src/qpid/sys/TCPIOPlugin.cpp index e82a6a9102..4b661f1713 100644 --- a/cpp/src/qpid/sys/TCPIOPlugin.cpp +++ b/cpp/src/qpid/sys/TCPIOPlugin.cpp @@ -24,6 +24,7 @@ #include "AsynchIO.h" #include "qpid/Plugin.h" +#include "qpid/sys/Socket.h" #include "qpid/broker/Broker.h" #include "qpid/log/Statement.h" @@ -112,7 +113,7 @@ void AsynchIOProtocolFactory::connect( Poller::shared_ptr poller, const std::string& host, int16_t port, ConnectionCodec::Factory* fact, - boost::function2<void, int, std::string> failed) + ConnectFailedCallback failed) { // Note that the following logic does not cause a memory leak. // The allocated Socket is freed either by the AsynchConnector diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp index 470db4c614..58c7800514 100644 --- a/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -20,6 +20,7 @@ */ #include "qpid/sys/AsynchIO.h" +#include "qpid/sys/Socket.h" #include "qpid/sys/Time.h" #include "check.h" |
