summaryrefslogtreecommitdiff
path: root/cpp/common/io/inc
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2006-10-12 18:52:49 +0000
committerAlan Conway <aconway@apache.org>2006-10-12 18:52:49 +0000
commitc256b20602a42a3d33f36bb0e8d9692906d282a6 (patch)
tree0fba6619fbb98c3511785143ca30647c5e6a4469 /cpp/common/io/inc
parent1e6a034ccd8e260e615195bf193aed7d37b928a8 (diff)
downloadqpid-python-c256b20602a42a3d33f36bb0e8d9692906d282a6.tar.gz
Converted broker to a class for use in tests, plugins etc.
qpid::Exception base class for all exceptions, inherits std::exception. Require boost on all platforms: http://www.boost.org, 'yum boost' on fedora. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@463376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/common/io/inc')
-rw-r--r--cpp/common/io/inc/Acceptor.h21
-rw-r--r--cpp/common/io/inc/BlockingAPRAcceptor.h7
-rw-r--r--cpp/common/io/inc/LFAcceptor.h7
-rw-r--r--cpp/common/io/inc/LFProcessor.h6
4 files changed, 33 insertions, 8 deletions
diff --git a/cpp/common/io/inc/Acceptor.h b/cpp/common/io/inc/Acceptor.h
index 5c690c546f..d7313b84db 100644
--- a/cpp/common/io/inc/Acceptor.h
+++ b/cpp/common/io/inc/Acceptor.h
@@ -20,15 +20,30 @@
#include "SessionHandlerFactory.h"
-
namespace qpid {
namespace io {
class Acceptor
{
public:
- virtual void bind(int port, SessionHandlerFactory* factory) = 0;
- virtual ~Acceptor(){}
+ /**
+ * Bind to port.
+ * @param port Port to bind to, 0 to bind to dynamically chosen port.
+ * @return The local bound port.
+ */
+ virtual int16_t bind(int16_t port) = 0;
+
+ /**
+ * Run the acceptor.
+ */
+ virtual void run(SessionHandlerFactory* factory) = 0;
+
+ /**
+ * Shut down the acceptor.
+ */
+ virtual void shutdown() = 0;
+
+ virtual ~Acceptor();
};
}
diff --git a/cpp/common/io/inc/BlockingAPRAcceptor.h b/cpp/common/io/inc/BlockingAPRAcceptor.h
index b77371b02e..bd069ed8db 100644
--- a/cpp/common/io/inc/BlockingAPRAcceptor.h
+++ b/cpp/common/io/inc/BlockingAPRAcceptor.h
@@ -47,10 +47,13 @@ namespace io {
apr_socket_t* socket;
const int connectionBacklog;
volatile bool running;
-
+
public:
BlockingAPRAcceptor(bool debug = false, int connectionBacklog = 10);
- virtual void bind(int port, SessionHandlerFactory* factory);
+ virtual int16_t bind(int16_t port);
+ virtual int16_t getPort() const;
+ virtual void run(SessionHandlerFactory* factory);
+ virtual void shutdown();
virtual ~BlockingAPRAcceptor();
void closed(BlockingAPRSessionContext* session);
};
diff --git a/cpp/common/io/inc/LFAcceptor.h b/cpp/common/io/inc/LFAcceptor.h
index 314f811827..9a40eed222 100644
--- a/cpp/common/io/inc/LFAcceptor.h
+++ b/cpp/common/io/inc/LFAcceptor.h
@@ -48,7 +48,7 @@ namespace io {
APRPool aprPool;
LFProcessor processor;
-
+ apr_socket_t* socket;
const int max_connections_per_processor;
const bool debug;
const int connectionBacklog;
@@ -60,7 +60,10 @@ namespace io {
int connectionBacklog = 10,
int worker_threads = 5,
int max_connections_per_processor = 500);
- virtual void bind(int port, SessionHandlerFactory* factory);
+ virtual int16_t bind(int16_t port);
+ virtual int16_t getPort() const;
+ virtual void run(SessionHandlerFactory* factory);
+ virtual void shutdown();
virtual ~LFAcceptor();
};
diff --git a/cpp/common/io/inc/LFProcessor.h b/cpp/common/io/inc/LFProcessor.h
index 6e67268906..25a3c8626c 100644
--- a/cpp/common/io/inc/LFProcessor.h
+++ b/cpp/common/io/inc/LFProcessor.h
@@ -104,7 +104,11 @@ namespace io {
* Start processing.
*/
void start();
-
+ /**
+ * Is processing stopped?
+ */
+ bool isStopped();
+
~LFProcessor();
};