Public Member Functions | |
void | AddConnectionFilter (IFilterStreamSocketConnections &filter, bool canGenerateOurOwnWrites) override |
Adds a connection filter to the connection manager. Connection filters are called in order to process calls with requests being called from "top to bottom" and completions being called from "bottom to top". For example, if filter A is added and then filter B is added and then we make a write request the data would be processed first by filter B and then by filter A (user -> B -> A -> wire). When a read completes. | |
JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex | RequestUserDataSlot (const JetByteTools::Core::_tstring &name) override |
Request a named user data slot and get an index to use in calls to methods on IIndexedOpaqueUserData. | |
JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex | LockUserDataSlots () override |
Prevent more user data slots from being allocated. Returns the number of user data slots that have been allocated. | |
virtual CSmartStreamSocket | Connect (const IFullAddress &address, const void *pUserData, const void *pFilterData, SocketBufferSize recvBufferSize, SocketBufferSize sendBufferSize)=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. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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, const void *pFilterData, SocketBufferSize recvBufferSize, SocketBufferSize sendBufferSize)=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. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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, const void *pFilterData, SocketBufferSize recvBufferSize, SocketBufferSize sendBufferSize)=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. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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 | AsyncConnectNoThrow (const IFullAddress &address, const void *pUserData, const void *pFilterData, SocketBufferSize recvBufferSize, SocketBufferSize sendBufferSize)=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. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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, const void *pFilterData, SocketBufferSize recvBufferSize, SocketBufferSize sendBufferSize)=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, const void *pFilterData, SocketBufferSize recvBufferSize, SocketBufferSize sendBufferSize)=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 | |
CFilteringStreamSocketConnectionManagerBase (IStreamSocketConnectionManagerCallback &callback, IStreamSocketConnectionManagerIO &manager, JetByteTools::Core::IProvideUserData &dataProvider) | |
void | OnSocketAttached (JetByteTools::Core::IIndexedOpaqueUserData &userData) |
void | OnPreOutgoingConnect (IStreamSocketEx &socket, const IFullAddress &address, const void *pUserData, const void *pFilterData) |
void | OnConnectionEstablished (IStreamSocketEx &socket, const IAddress &address) |
void | OnOutgoingConnectionFailed (IStreamSocketEx &socket, const IAddress &address, DWORD lastError) |
bool | OnRequestRead (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer) |
void | OnReadCompleted (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer) |
void | OnReadCompletionError (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError) |
void | OnReadOOBCompleted (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer) |
void | OnRequestWrite (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer) |
void | OnRequestWrite (IStreamSocketEx &socket, JetByteTools::IO::IIterateableBufferChain &buffers) |
void | OnWriteCompleted (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer) |
void | OnWriteCompletionError (IStreamSocketEx &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError) |
void | OnConnectionClientClose (IStreamSocketEx &socket) |
void | OnConnectionReset (IStreamSocketEx &socket, DWORD lastError) |
void | OnConnectionClosed (IStreamSocketEx &socket, ConnectionClosureReason reason) |
void | OnConnectionShutdown (IStreamSocketEx &socket, ShutdownHow how) |
void | OnConnectionAborted (IStreamSocketEx &socket, ConnectionClosureReason reason, bool wasUserSocket) |
void | OnSocketReleased (JetByteTools::Core::IIndexedOpaqueUserData &userData) |
Protected Attributes | |
IStreamSocketConnectionManagerCallback & | m_callback |
CFilteringStreamSocketConnectionManagerBase | ( | IStreamSocketConnectionManagerCallback & | callback, | |
IStreamSocketConnectionManagerIO & | manager, | |||
JetByteTools::Core::IProvideUserData & | dataProvider | |||
) | [protected] |
void AddConnectionFilter | ( | IFilterStreamSocketConnections & | filter, | |
bool | canGenerateOurOwnWrites | |||
) | [override, virtual] |
Adds a connection filter to the connection manager. Connection filters are called in order to process calls with requests being called from "top to bottom" and completions being called from "bottom to top". For example, if filter A is added and then filter B is added and then we make a write request the data would be processed first by filter B and then by filter A (user -> B -> A -> wire). When a read completes.
(wire -> A -> B -> user).
Implements IAcceptStreamSocketConnectionFilters.
JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex RequestUserDataSlot | ( | const JetByteTools::Core::_tstring & | name | ) | [override, virtual] |
Request a named user data slot and get an index to use in calls to methods on IIndexedOpaqueUserData.
Implements IProvideUserData.
IIndexedOpaqueUserData::UserDataIndex LockUserDataSlots | ( | ) | [override, virtual] |
Prevent more user data slots from being allocated. Returns the number of user data slots that have been allocated.
Implements IProvideUserData.
void OnSocketAttached | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | [protected] |
void OnPreOutgoingConnect | ( | IStreamSocketEx & | socket, | |
const IFullAddress & | address, | |||
const void * | pUserData, | |||
const void * | pFilterData | |||
) | [protected] |
void OnConnectionEstablished | ( | IStreamSocketEx & | socket, | |
const IAddress & | address | |||
) | [protected] |
void OnOutgoingConnectionFailed | ( | IStreamSocketEx & | socket, | |
const IAddress & | address, | |||
DWORD | lastError | |||
) | [protected] |
bool OnRequestRead | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [protected] |
void OnReadCompleted | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [protected] |
void OnReadCompletionError | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
DWORD | lastError | |||
) | [protected] |
void OnReadOOBCompleted | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [protected] |
void OnRequestWrite | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [protected] |
void OnRequestWrite | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::IIterateableBufferChain & | buffers | |||
) | [protected] |
void OnWriteCompleted | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [protected] |
void OnWriteCompletionError | ( | IStreamSocketEx & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
DWORD | lastError | |||
) | [protected] |
void OnConnectionClientClose | ( | IStreamSocketEx & | socket | ) | [protected] |
void OnConnectionReset | ( | IStreamSocketEx & | socket, | |
DWORD | lastError | |||
) | [protected] |
void OnConnectionClosed | ( | IStreamSocketEx & | socket, | |
ConnectionClosureReason | reason | |||
) | [protected] |
void OnConnectionShutdown | ( | IStreamSocketEx & | socket, | |
ShutdownHow | how | |||
) | [protected] |
void OnConnectionAborted | ( | IStreamSocketEx & | socket, | |
ConnectionClosureReason | reason, | |||
bool | wasUserSocket | |||
) | [protected] |
void OnSocketReleased | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | [protected] |
virtual CSmartStreamSocket Connect | ( | const IFullAddress & | address, | |
const void * | pUserData, | |||
const void * | pFilterData, | |||
SocketBufferSize | recvBufferSize, | |||
SocketBufferSize | sendBufferSize | |||
) | [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. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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, | |||
const void * | pFilterData, | |||
SocketBufferSize | recvBufferSize, | |||
SocketBufferSize | sendBufferSize | |||
) | [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. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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, | |||
const void * | pFilterData, | |||
SocketBufferSize | recvBufferSize, | |||
SocketBufferSize | sendBufferSize | |||
) | [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. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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 AsyncConnectNoThrow | ( | const IFullAddress & | address, | |
const void * | pUserData, | |||
const void * | pFilterData, | |||
SocketBufferSize | recvBufferSize, | |||
SocketBufferSize | sendBufferSize | |||
) | [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. Passes the filter data pointer through to any filters in the filter chain via IFilterStreamSocketConnections::FilterConnect(). 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, | |||
const void * | pFilterData, | |||
SocketBufferSize | recvBufferSize, | |||
SocketBufferSize | sendBufferSize | |||
) | [pure virtual, inherited] |
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, | |||
const void * | pFilterData, | |||
SocketBufferSize | recvBufferSize, | |||
SocketBufferSize | sendBufferSize | |||
) | [pure virtual, inherited] |
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 [pure virtual, inherited] |
Returns true if the platform supports asynchronous connections for this address type.
virtual DWORD AbortAllConnections | ( | ) | [pure virtual, inherited] |
Aborts all connections that are managed by this connection manager.
IStreamSocketConnectionManagerCallback& m_callback [protected] |