36 #ifndef _CONNECTION_HANDLER_HPP_INCLUDED
37 #define _CONNECTION_HANDLER_HPP_INCLUDED
45 #include <boost/noncopyable.hpp>
69 const void*
data()
const {
return (
const void*)
data_; }
85 explicit ReadData(
void* d, std::size_t s,
unsigned to = 0 )
93 explicit SendData(
const void* d, std::size_t s,
unsigned to = 0 )
147 virtual void networkInput(
const void* buffer, std::size_t bytesTransferred ) = 0;
163 struct HandlerConfiguration;
164 namespace module {
class ModulesDirectory; }
179 class ServerHandlerImpl;
180 ServerHandlerImpl *
m_impl;
185 #endif // _CONNECTION_HANDLER_HPP_INCLUDED
unsigned timeout_
Definition: connectionHandler.hpp:76
Definition: connectionHandler.hpp:139
Definition: connectionHandler.hpp:138
Network operation: asynchronously read a block of data.
Definition: connectionHandler.hpp:82
NetworkSignal
Definition: connectionHandler.hpp:135
ServerHandler(const HandlerConfiguration *conf, const module::ModulesDirectory *modules)
unsigned timeout() const
Definition: connectionHandler.hpp:68
Classes for network endpoints.
The modules directory used by the constructors of the providers to build themselves.
Definition: moduleDirectory.hpp:48
Definition: connectionHandler.hpp:140
Definition: connectionHandler.hpp:60
ServerHandlerImpl * m_impl
Definition: connectionHandler.hpp:179
Network operation: no operation.
Definition: connectionHandler.hpp:116
std::size_t size_
Definition: connectionHandler.hpp:78
Definition: connectionHandler.hpp:136
friend class ConnectionBase
Definition: connectionHandler.hpp:125
The common handler for the connection status.
Definition: connectionHandler.hpp:123
Network operation: asynchronously send a block of data.
Definition: connectionHandler.hpp:90
boost::shared_ptr< LocalEndpoint > LocalEndpointR
Definition: connectionEndpoint.hpp:163
Operation operation() const
Definition: connectionHandler.hpp:72
Definition: connectionHandler.hpp:58
const void * data() const
Definition: connectionHandler.hpp:69
Definition: connectionHandler.hpp:142
NetworkOperation(Operation op, void *d=NULL, std::size_t s=0, unsigned to=0)
Definition: connectionHandler.hpp:64
Definition: connectionHandler.hpp:61
Definition: connectionHandler.hpp:59
virtual ~ConnectionHandler()
Definition: connectionHandler.hpp:128
SendString(const char *s, unsigned to=0)
Definition: connectionHandler.hpp:104
virtual const NetworkOperation nextOperation()=0
What should the network do next.
void * buffer()
Definition: connectionHandler.hpp:70
Definition: connectionHandler.hpp:137
virtual void networkInput(const void *buffer, std::size_t bytesTransferred)=0
Signal the incoming data. buffer is the buffer given to the read operation.
SendData(const void *d, std::size_t s, unsigned to=0)
Definition: connectionHandler.hpp:93
virtual void signalOccured(NetworkSignal)
A network error, timeout or signal occured.
Definition: connectionHandler.hpp:154
net::ConnectionHandler * newConnection(const net::LocalEndpointR &local)
Create a new connection handler and return a pointer to it.
Definition: connectionHandler.hpp:141
boost::shared_ptr< RemoteEndpoint > RemoteEndpointR
Definition: connectionEndpoint.hpp:208
SendString(const std::string &s, unsigned to=0)
Definition: connectionHandler.hpp:102
friend class ConnectionBase
Definition: connectionHandler.hpp:54
Operation
Definition: connectionHandler.hpp:57
void * data_
Definition: connectionHandler.hpp:77
Operation operation_
Definition: connectionHandler.hpp:75
Network operation: close the current network connection.
Definition: connectionHandler.hpp:109
CloseConnection()
Definition: connectionHandler.hpp:112
virtual void setPeer(const RemoteEndpointR &remote)=0
Set the remote peer. The connection is up now.
std::size_t size() const
Definition: connectionHandler.hpp:71
ConnectionHandler & operator=(const ConnectionHandler &)
Base class for a network operation. It should never be accessed directly by the user code...
Definition: connectionHandler.hpp:52
ConnectionHandler()
Definition: connectionHandler.hpp:127
Network operation: asynchronously send a string (message) This is just some syntactic sugar...
Definition: connectionHandler.hpp:99
The server main handler All it should do is to provide connection handlers.
Definition: connectionHandler.hpp:168
ReadData(void *d, std::size_t s, unsigned to=0)
Definition: connectionHandler.hpp:85
NoOp()
Definition: connectionHandler.hpp:119