Public Member Functions | |
CStreamSocketConnectionFilterBase (const JetByteTools::Core::_tstring &filterName, bool canGenerateOurOwnWrites, JetByteTools::Socket::IAcceptStreamSocketConnectionFilters &manager, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, bool enableFiltering=true) | |
CStreamSocketConnectionFilterBase (const CStreamSocketConnectionFilterBase &rhs) | |
CStreamSocketConnectionFilterBase & | operator= (const CStreamSocketConnectionFilterBase &rhs) |
void | FilterSocketAttached (JetByteTools::Core::IIndexedOpaqueUserData &) override |
Called when a socket is first prepared for use. Can be used to allow the filter to plug its own user data into the socket's user data store. Note that unlike most other filter functions this call is always executed on the whole of the filter chain. | |
void | FilterConnect (IFilterableStreamSocket &, const IFullAddress &, const void *, const void *) override |
Called before an outbound connection is attempted but after the socket is allocated. This call can be used to reroute connections or to "plug" connect data into the socket's user data. | |
void | FilterConnectionEstablished (IFilterableStreamSocket &, const IAddress &) override |
Called when a connection (inbound or outbound) is established. You can determine which direction the connection is (if that's important) by calling GetConnectionDirection() on the socket. Note that a filter may receive a read or write request before a connection establishment notification if a filter lower in the chain issues a read or write during its connection establishment notification. | |
void | FilterReadCompletionError (IFilterableStreamSocket &, JetByteTools::IO::CSmartBuffer &, const DWORD) override |
Called when a read has completed with an error. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. | |
void | FilterConnectionClosure (IFilterableStreamSocket &, const ConnectionClosureReason) override |
Called when the connection is closed. | |
Protected Member Functions | |
~CStreamSocketConnectionFilterBase () | |
void | SetPerConnectionFilterData (JetByteTools::Core::IIndexedOpaqueUserData &userData, IFilterData *pFilterData) const |
IFilterData * | GetPerConnectionFilterData (const JetByteTools::Core::IIndexedOpaqueUserData &userData) const |
JetByteTools::Socket::IManageStreamSocketConnectionFilters & | GetFilterManager () const |
void | InitialiseFilter (JetByteTools::Socket::IManageStreamSocketConnectionFilters &manager) override |
Called once before any other method on this interface is called. The manager interface should be used to generate new read and write events. | |
void | FilterConnectionFailed (JetByteTools::Socket::IFilterableStreamSocket &socket, const JetByteTools::Socket::IAddress &address, DWORD lastError) override |
Called when an outbound connection fails to be established. The filter cannot block these notifications, but it can use it to track the success of connects that it is filtering. | |
bool | FilterReadRequest (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer) override |
Called when a read is requested. The supplied buffer is optional and may be null. The filter can remove the supplied buffer or add one of its own. If no buffer is available and the read is allowed to occur then a buffer will be allocated just before the read is issued. Filters can prevent the application (and filters above) from issuing reads by returning false which will cause the filter chain traversal to stop and the request to be cancelled. If a filter wishes to generate its own reads then it should use IManageStreamSocketConnectionFilters rather than calling this function with its own buffer. | |
void | FilterReadCompleted (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer) override |
Called when a read has completed. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. Filters can also generate any number of their own read completions via the IManageStreamSocketConnectionFilters interface. | |
void | FilterWriteRequest (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer) override |
Called when a write is requested. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. If a filter wishes to generate its own writes then it should use IManageStreamSocketConnectionFilters rather than calling this function with its own buffer. Note that should a filter clear the CSmartBuffer then it is taking responsibility for calling WriteCompleted() on the socket when the write actually completes. This may be straight away, if the filter is simply preventing writes being issued or it may be when the buffer is eventually written if it's queuing writes internally. | |
void | FilterWriteRequest (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::IO::IIterateableBufferChain &buffers) override |
Called when a buffer chain write is requested. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffers with completely new buffers or by replacing the contents of the supplied buffers, and cancelling the call by clearing the buffer chain which will cause the filter chain traversal to stop. If a filter wishes to generate its own writes then it should use IManageStreamSocketConnectionFilters rather than calling this function with its own buffers. Note that should a filter clear the buffer chain then it is taking responsibility for calling WriteCompleted() on the socket when the writes actually complete. This may be straight away, if the filter is simply preventing writes being issued or it may be when the buffer is eventually written if it's queuing writes internally. | |
void | FilterWriteCompleted (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer) override |
Called when a write has completed. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. Filters can also generate any number of their own write completions via the IManageStreamSocketConnectionFilters interface. | |
void | FilterWriteCompletionError (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError) override |
Called when a write has completed with an error. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. | |
void | FilterClientClose (JetByteTools::Socket::IFilterableStreamSocket &socket) override |
Called when the receive side of a connection is closed by the peer. | |
void | FilterConnectionReset (JetByteTools::Socket::IFilterableStreamSocket &socket, DWORD lastError) override |
Called when the a connection is reset. | |
void | FilterConnectionClosed (JetByteTools::Socket::IFilterableStreamSocket &socket) override |
void | FilterShutdown (JetByteTools::Socket::IFilterableStreamSocket &socket, JetByteTools::Socket::ShutdownHow how) override |
Called when the socket has been shutdown, note that the filter cannot currently intercept and change/delay the shutdown call. | |
void | FilterConnectionAborted (JetByteTools::Socket::IFilterableStreamSocket &socket, ConnectionClosureReason reason, bool wasUserSocket) override |
Called for each socket when a connection manager aborts all of its active connections. | |
void | FilterSocketReleased (JetByteTools::Core::IIndexedOpaqueUserData &userData) override |
Called after IStreamSocketConnectionManagerCallback::OnSocketReleased() callback and before the socket is passed to the allocator. This can be used to remove any user data that was added by the filter in a FilterConnect() call or a FilterSocketAttached() call. Note that unlike most other filter functions this call is always executed on the whole of the filter chain. |
CStreamSocketConnectionFilterBase | ( | const JetByteTools::Core::_tstring & | filterName, | |
bool | canGenerateOurOwnWrites, | |||
JetByteTools::Socket::IAcceptStreamSocketConnectionFilters & | manager, | |||
JetByteTools::Socket::IAllocateSequencedStreamSockets & | socketAllocator, | |||
bool | enableFiltering = true | |||
) |
CStreamSocketConnectionFilterBase | ( | const CStreamSocketConnectionFilterBase & | rhs | ) |
~CStreamSocketConnectionFilterBase | ( | ) | [protected] |
CStreamSocketConnectionFilterBase& operator= | ( | const CStreamSocketConnectionFilterBase & | rhs | ) |
void SetPerConnectionFilterData | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData, | |
IFilterData * | pFilterData | |||
) | const [protected] |
IFilterData * GetPerConnectionFilterData | ( | const JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | const [protected] |
IManageStreamSocketConnectionFilters & GetFilterManager | ( | ) | const [protected] |
void InitialiseFilter | ( | JetByteTools::Socket::IManageStreamSocketConnectionFilters & | manager | ) | [override, protected, virtual] |
Called once before any other method on this interface is called. The manager interface should be used to generate new read and write events.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterConnectionFailed | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
const JetByteTools::Socket::IAddress & | address, | |||
DWORD | lastError | |||
) | [override, protected, virtual] |
Called when an outbound connection fails to be established. The filter cannot block these notifications, but it can use it to track the success of connects that it is filtering.
Reimplemented from CNullStreamSocketConnectionFilter.
bool FilterReadRequest | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [override, protected, virtual] |
Called when a read is requested. The supplied buffer is optional and may be null. The filter can remove the supplied buffer or add one of its own. If no buffer is available and the read is allowed to occur then a buffer will be allocated just before the read is issued. Filters can prevent the application (and filters above) from issuing reads by returning false which will cause the filter chain traversal to stop and the request to be cancelled. If a filter wishes to generate its own reads then it should use IManageStreamSocketConnectionFilters rather than calling this function with its own buffer.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterReadCompleted | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [override, protected, virtual] |
Called when a read has completed. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. Filters can also generate any number of their own read completions via the IManageStreamSocketConnectionFilters interface.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterWriteRequest | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [override, protected, virtual] |
Called when a write is requested. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. If a filter wishes to generate its own writes then it should use IManageStreamSocketConnectionFilters rather than calling this function with its own buffer. Note that should a filter clear the CSmartBuffer then it is taking responsibility for calling WriteCompleted() on the socket when the write actually completes. This may be straight away, if the filter is simply preventing writes being issued or it may be when the buffer is eventually written if it's queuing writes internally.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterWriteRequest | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::IO::IIterateableBufferChain & | buffers | |||
) | [override, protected, virtual] |
Called when a buffer chain write is requested. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffers with completely new buffers or by replacing the contents of the supplied buffers, and cancelling the call by clearing the buffer chain which will cause the filter chain traversal to stop. If a filter wishes to generate its own writes then it should use IManageStreamSocketConnectionFilters rather than calling this function with its own buffers. Note that should a filter clear the buffer chain then it is taking responsibility for calling WriteCompleted() on the socket when the writes actually complete. This may be straight away, if the filter is simply preventing writes being issued or it may be when the buffer is eventually written if it's queuing writes internally.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterWriteCompleted | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [override, protected, virtual] |
Called when a write has completed. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop. Filters can also generate any number of their own write completions via the IManageStreamSocketConnectionFilters interface.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterWriteCompletionError | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
DWORD | lastError | |||
) | [override, protected, virtual] |
Called when a write has completed with an error. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterClientClose | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket | ) | [override, protected, virtual] |
Called when the receive side of a connection is closed by the peer.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterConnectionReset | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
DWORD | lastError | |||
) | [override, protected, virtual] |
void FilterConnectionClosed | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket | ) | [override, protected, virtual] |
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterShutdown | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
JetByteTools::Socket::ShutdownHow | how | |||
) | [override, protected, virtual] |
Called when the socket has been shutdown, note that the filter cannot currently intercept and change/delay the shutdown call.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterConnectionAborted | ( | JetByteTools::Socket::IFilterableStreamSocket & | socket, | |
ConnectionClosureReason | reason, | |||
bool | wasUserSocket | |||
) | [override, protected, virtual] |
Called for each socket when a connection manager aborts all of its active connections.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterSocketReleased | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | [override, protected, virtual] |
Called after IStreamSocketConnectionManagerCallback::OnSocketReleased() callback and before the socket is passed to the allocator. This can be used to remove any user data that was added by the filter in a FilterConnect() call or a FilterSocketAttached() call. Note that unlike most other filter functions this call is always executed on the whole of the filter chain.
Reimplemented from CNullStreamSocketConnectionFilter.
void FilterSocketAttached | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | [inline, override, virtual, inherited] |
Called when a socket is first prepared for use. Can be used to allow the filter to plug its own user data into the socket's user data store. Note that unlike most other filter functions this call is always executed on the whole of the filter chain.
Implements IFilterStreamSocketConnections.
void FilterConnect | ( | IFilterableStreamSocket & | socket, | |
const IFullAddress & | address, | |||
const void * | pUserData, | |||
const void * | pFilterData | |||
) | [inline, override, virtual, inherited] |
Called before an outbound connection is attempted but after the socket is allocated. This call can be used to reroute connections or to "plug" connect data into the socket's user data.
Implements IFilterStreamSocketConnections.
void FilterConnectionEstablished | ( | IFilterableStreamSocket & | socket, | |
const IAddress & | address | |||
) | [inline, override, virtual, inherited] |
Called when a connection (inbound or outbound) is established. You can determine which direction the connection is (if that's important) by calling GetConnectionDirection() on the socket. Note that a filter may receive a read or write request before a connection establishment notification if a filter lower in the chain issues a read or write during its connection establishment notification.
Implements IFilterStreamSocketConnections.
void FilterReadCompletionError | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
const | lastError | |||
) | [inline, override, virtual, inherited] |
Called when a read has completed with an error. The filter can manipulate the data in any way that it likes. This includes using the data for its own purposes, replacing the data with its own, either by replacing the buffer with a completely new buffer or by replacing the contents of the supplied buffer, and cancelling the call by clearing the CSmartBuffer (by calling Release()) which will cause the filter chain traversal to stop.
Implements IFilterStreamSocketConnections.
void FilterConnectionClosure | ( | IFilterableStreamSocket & | socket, | |
const | reason | |||
) | [inline, override, virtual, inherited] |