Public Member Functions | |
virtual void | HandleOperation (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD ioSize, DWORD lastError)=0 |
Handles an I/O operation. | |
virtual void | ReleaseSocket (IPoolableSocket &socket, bool wasUserSocket)=0 |
Used to pass the socket back to the allocator when its reference count reaches 0. | |
virtual void | RequestRead (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
Called by a socket to have the manager shedule a read operation to occur on one of the I/O threads. | |
virtual void | RequestWrite (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
Called by a socket to have the manager shedule a write operation to occur on one of the I/O threads. | |
virtual void | RequestWrite (IStreamSocketEx &socket, JetByteTools::IO::IIterateableBufferChain &buffers)=0 |
Called by a socket to have the manager shedule a write operation to occur on one of the I/O threads. | |
virtual void | ExecuteWrite (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
Called by a socket to have the manager actually perform a write operation. The socket controls this action as it may be responsible for sequencing buffers into the correct order before issuing the writes. | |
virtual JetByteTools::IO::CSmartBuffer | AllocateBuffer ()=0 |
Allows the socket to access the buffer allocator that is being used by the manager so that it can generate write calls using the correct buffers. These write calls are the result of the non buffer based Write() and TryWrite() methods being called. | |
virtual JetByteTools::IO::CSmartBuffer | AllocateCustomSizedBuffer (JetByteTools::IO::IBuffer::BufferSize bufferSize)=0 |
virtual JetByteTools::IO::CSmartBuffer | AllocateBuffer (JetByteTools::IO::IPoolBuffers &pool)=0 |
virtual void | OnClientClose (IStreamSocketEx &socket)=0 |
Called by the socket when a OnConnectionClientClose event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock. | |
virtual void | OnConnectionReset (IStreamSocketEx &socket, DWORD lastError)=0 |
Called by the socket when a OnConnectionConnectionReset event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock. | |
virtual void | OnConnectionClosed (IStreamSocketEx &socket, ConnectionClosureReason reason)=0 |
Called by the socket when an OnConnectionClosed event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock. | |
virtual void | OnConnectionShutdown (IStreamSocketEx &socket, ShutdownHow how)=0 |
Called by the socket when the socket is shutdown. Allows the manager to notify filters of the shutdown. | |
virtual void | OnConnectionAborted (IStreamSocketEx &socket, ConnectionClosureReason reason, bool wasUserSocket)=0 |
Called when a socket is aborted due to the connection manager aborting all of its connections. | |
virtual void | RequestCancelIO (IStreamSocketEx &socket)=0 |
virtual CSmartStreamSocket | Connect (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize)=0 |
Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on failure to connect, the resulting stream socket is always connected and valid. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful. | |
virtual CSmartStreamSocket | ConnectNoThrow (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize)=0 |
Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), before returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful. | |
virtual CSmartStreamSocket | AsyncConnect (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize)=0 |
Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on some failures to connect. The smart stream pointer is not connected until the IStreamSocketConnectionManagerCallback::OnConnectionEstablished() has been called and this may be before or after the function returns to the caller. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful. | |
virtual CSmartStreamSocket | AsyncConnectNoThrow (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize)=0 |
Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful. | |
virtual CSmartStreamSocket | ConnectAsyncIfAvailable (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize)=0 |
If the platform supports asynchronous connections for this address type then acts as an AsyncConnect() else acts as a ConnectNoThrow(). | |
virtual CSmartStreamSocket | ConnectAsyncIfAvailableNoThrow (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize)=0 |
If the platform supports asynchronous connections for this address type then acts as an AsyncConnectNoThrow() else acts as a ConnectNoThrow(). | |
virtual bool | AsyncConnectAvailable (const IAddressType &addressType) const =0 |
Returns true if the platform supports asynchronous connections for this address type. | |
virtual DWORD | AbortAllConnections ()=0 |
Aborts all connections that are managed by this connection manager. | |
Protected Member Functions | |
virtual | ~IStreamSocketConnectionManager () |
We never delete instances of this interface; you must manage the lifetime of the class that implements it. |
virtual ~IStreamSocketConnectionManager | ( | ) | [protected, virtual] |
We never delete instances of this interface; you must manage the lifetime of the class that implements it.
virtual void HandleOperation | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
DWORD | ioSize, | |||
DWORD | lastError | |||
) | [pure virtual] |
Handles an I/O operation.
virtual void ReleaseSocket | ( | IPoolableSocket & | socket, | |
bool | wasUserSocket | |||
) | [pure virtual] |
Used to pass the socket back to the allocator when its reference count reaches 0.
Implemented in TConnectionManagerBase< JetByteTools::Socket::CFilteringStreamSocketConnectionManagerBase, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >, and TConnectionManagerBase< Base, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >.
virtual void RequestRead | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure virtual] |
Called by a socket to have the manager shedule a read operation to occur on one of the I/O threads.
virtual void RequestWrite | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure virtual] |
Called by a socket to have the manager shedule a write operation to occur on one of the I/O threads.
virtual void RequestWrite | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::IIterateableBufferChain & | buffers | |||
) | [pure virtual] |
Called by a socket to have the manager shedule a write operation to occur on one of the I/O threads.
virtual void ExecuteWrite | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure virtual] |
Called by a socket to have the manager actually perform a write operation. The socket controls this action as it may be responsible for sequencing buffers into the correct order before issuing the writes.
virtual JetByteTools::IO::CSmartBuffer AllocateBuffer | ( | ) | [pure virtual] |
Allows the socket to access the buffer allocator that is being used by the manager so that it can generate write calls using the correct buffers. These write calls are the result of the non buffer based Write() and TryWrite() methods being called.
Implemented in TConnectionManagerBase< JetByteTools::Socket::CFilteringStreamSocketConnectionManagerBase, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >, and TConnectionManagerBase< Base, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >.
virtual JetByteTools::IO::CSmartBuffer AllocateCustomSizedBuffer | ( | JetByteTools::IO::IBuffer::BufferSize | bufferSize | ) | [pure virtual] |
Implemented in TConnectionManagerBase< JetByteTools::Socket::CFilteringStreamSocketConnectionManagerBase, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >, and TConnectionManagerBase< Base, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >.
virtual JetByteTools::IO::CSmartBuffer AllocateBuffer | ( | JetByteTools::IO::IPoolBuffers & | pool | ) | [pure virtual] |
Implemented in TConnectionManagerBase< JetByteTools::Socket::CFilteringStreamSocketConnectionManagerBase, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >, and TConnectionManagerBase< Base, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >.
virtual void OnClientClose | ( | IStreamSocketEx & | socket | ) | [pure virtual] |
Called by the socket when a OnConnectionClientClose event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.
virtual void OnConnectionReset | ( | IStreamSocketEx & | socket, | |
DWORD | lastError | |||
) | [pure virtual] |
Called by the socket when a OnConnectionConnectionReset event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.
virtual void OnConnectionClosed | ( | IStreamSocketEx & | socket, | |
ConnectionClosureReason | reason | |||
) | [pure virtual] |
Called by the socket when an OnConnectionClosed event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.
virtual void OnConnectionShutdown | ( | IStreamSocketEx & | socket, | |
ShutdownHow | how | |||
) | [pure virtual] |
Called by the socket when the socket is shutdown. Allows the manager to notify filters of the shutdown.
virtual void OnConnectionAborted | ( | IStreamSocketEx & | socket, | |
ConnectionClosureReason | reason, | |||
bool | wasUserSocket | |||
) | [pure virtual] |
Called when a socket is aborted due to the connection manager aborting all of its connections.
virtual void RequestCancelIO | ( | IStreamSocketEx & | socket | ) | [pure virtual] |
virtual CSmartStreamSocket Connect | ( | const IFullAddress & | address, | |
const void * | pUserData = nullptr , |
|||
SocketBufferSize | recvBufferSize = DefaultSocketBufferSize , |
|||
SocketBufferSize | sendBufferSize = DefaultSocketBufferSize | |||
) | [pure virtual, inherited] |
Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on failure to connect, the resulting stream socket is always connected and valid. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual CSmartStreamSocket ConnectNoThrow | ( | const IFullAddress & | address, | |
const void * | pUserData = nullptr , |
|||
SocketBufferSize | recvBufferSize = DefaultSocketBufferSize , |
|||
SocketBufferSize | sendBufferSize = DefaultSocketBufferSize | |||
) | [pure virtual, inherited] |
Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), before returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual CSmartStreamSocket AsyncConnect | ( | const IFullAddress & | address, | |
const void * | pUserData = nullptr , |
|||
SocketBufferSize | recvBufferSize = DefaultSocketBufferSize , |
|||
SocketBufferSize | sendBufferSize = DefaultSocketBufferSize | |||
) | [pure virtual, inherited] |
Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on some failures to connect. The smart stream pointer is not connected until the IStreamSocketConnectionManagerCallback::OnConnectionEstablished() has been called and this may be before or after the function returns to the caller. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful.
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual CSmartStreamSocket AsyncConnectNoThrow | ( | const IFullAddress & | address, | |
const void * | pUserData = nullptr , |
|||
SocketBufferSize | recvBufferSize = DefaultSocketBufferSize , |
|||
SocketBufferSize | sendBufferSize = DefaultSocketBufferSize | |||
) | [pure virtual, inherited] |
Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful.
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual CSmartStreamSocket ConnectAsyncIfAvailable | ( | const IFullAddress & | address, | |
const void * | pUserData = nullptr , |
|||
SocketBufferSize | recvBufferSize = DefaultSocketBufferSize , |
|||
SocketBufferSize | sendBufferSize = DefaultSocketBufferSize | |||
) | [pure virtual, inherited] |
If the platform supports asynchronous connections for this address type then acts as an AsyncConnect() else acts as a ConnectNoThrow().
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual CSmartStreamSocket ConnectAsyncIfAvailableNoThrow | ( | const IFullAddress & | address, | |
const void * | pUserData = nullptr , |
|||
SocketBufferSize | recvBufferSize = DefaultSocketBufferSize , |
|||
SocketBufferSize | sendBufferSize = DefaultSocketBufferSize | |||
) | [pure virtual, inherited] |
If the platform supports asynchronous connections for this address type then acts as an AsyncConnectNoThrow() else acts as a ConnectNoThrow().
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual bool AsyncConnectAvailable | ( | const IAddressType & | addressType | ) | const [pure virtual, inherited] |
Returns true if the platform supports asynchronous connections for this address type.
Implemented in CConnectionMaintainingStreamSocketConnectionFilter.
virtual DWORD AbortAllConnections | ( | ) | [pure virtual, inherited] |
Aborts all connections that are managed by this connection manager.
Implemented in CConnectionMaintainingStreamSocketConnectionFilter, TConnectionManagerBase< JetByteTools::Socket::CFilteringStreamSocketConnectionManagerBase, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >, and TConnectionManagerBase< Base, JetByteTools::Socket::IStreamSocketConnectionManager, JetByteTools::Socket::IStreamSocketConnectionManagerIO, JetByteTools::Socket::IStreamSocketConnectionManagerCallback, JetByteTools::Socket::IAllocateStreamSockets >.