Public Member Functions | |
virtual void | InitialiseFilter (IManageStreamSocketConnectionFilters &manager)=0 |
Called once before any other method on this interface is called. The manager interface should be used to generate new read and write events. | |
virtual void | FilterSocketAttached (JetByteTools::Core::IIndexedOpaqueUserData &userData)=0 |
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. | |
virtual void | FilterConnect (IFilterableStreamSocket &socket, const IFullAddress &address, const void *pUserData, const void *pFilterData)=0 |
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. | |
virtual void | FilterConnectionEstablished (IFilterableStreamSocket &socket, const IAddress &address)=0 |
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. | |
virtual void | FilterConnectionFailed (IFilterableStreamSocket &socket, const IAddress &address, DWORD lastError)=0 |
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. | |
virtual bool | FilterReadRequest (IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
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. | |
virtual void | FilterReadCompleted (IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
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. | |
virtual void | FilterReadCompletionError (IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError)=0 |
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. | |
virtual void | FilterWriteRequest (IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
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. | |
virtual void | FilterWriteRequest (IFilterableStreamSocket &socket, JetByteTools::IO::IIterateableBufferChain &buffers)=0 |
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. | |
virtual void | FilterWriteCompleted (IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0 |
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. | |
virtual void | FilterWriteCompletionError (IFilterableStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError)=0 |
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. | |
virtual void | FilterClientClose (IFilterableStreamSocket &socket)=0 |
Called when the receive side of a connection is closed by the peer. | |
virtual void | FilterConnectionReset (IFilterableStreamSocket &socket, DWORD lastError)=0 |
Called when the a connection is reset. | |
virtual void | FilterConnectionClosure (IFilterableStreamSocket &socket, ConnectionClosureReason reason)=0 |
Called when the connection is closed. | |
virtual void | FilterConnectionClosed (IFilterableStreamSocket &socket)=0 |
virtual void | FilterShutdown (IFilterableStreamSocket &socket, ShutdownHow how)=0 |
Called when the socket has been shutdown, note that the filter cannot currently intercept and change/delay the shutdown call. | |
virtual void | FilterConnectionAborted (IFilterableStreamSocket &socket, ConnectionClosureReason reason, bool wasUserSocket)=0 |
Called for each socket when a connection manager aborts all of its active connections. | |
virtual void | FilterSocketReleased (JetByteTools::Core::IIndexedOpaqueUserData &userData)=0 |
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. | |
Protected Member Functions | |
virtual | ~IFilterStreamSocketConnections () |
We never delete instances of this interface; you must manage the lifetime of the class that implements it. |
virtual ~IFilterStreamSocketConnections | ( | ) | [protected, virtual] |
We never delete instances of this interface; you must manage the lifetime of the class that implements it.
virtual void InitialiseFilter | ( | IManageStreamSocketConnectionFilters & | manager | ) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterSocketAttached | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | [pure virtual] |
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.
Implemented in CNullStreamSocketConnectionFilter.
virtual void FilterConnect | ( | IFilterableStreamSocket & | socket, | |
const IFullAddress & | address, | |||
const void * | pUserData, | |||
const void * | pFilterData | |||
) | [pure virtual] |
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.
Implemented in CNullStreamSocketConnectionFilter.
virtual void FilterConnectionEstablished | ( | IFilterableStreamSocket & | socket, | |
const IAddress & | address | |||
) | [pure virtual] |
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.
Implemented in CNullStreamSocketConnectionFilter.
virtual void FilterConnectionFailed | ( | IFilterableStreamSocket & | socket, | |
const IAddress & | address, | |||
DWORD | lastError | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual bool FilterReadRequest | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterReadCompleted | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterReadCompletionError | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
DWORD | lastError | |||
) | [pure virtual] |
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.
Implemented in CNullStreamSocketConnectionFilter.
virtual void FilterWriteRequest | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterWriteRequest | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::IIterateableBufferChain & | buffers | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterWriteCompleted | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterWriteCompletionError | ( | IFilterableStreamSocket & | socket, | |
JetByteTools::IO::CSmartBuffer & | buffer, | |||
DWORD | lastError | |||
) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterClientClose | ( | IFilterableStreamSocket & | socket | ) | [pure virtual] |
Called when the receive side of a connection is closed by the peer.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterConnectionReset | ( | IFilterableStreamSocket & | socket, | |
DWORD | lastError | |||
) | [pure virtual] |
Called when the a connection is reset.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterConnectionClosure | ( | IFilterableStreamSocket & | socket, | |
ConnectionClosureReason | reason | |||
) | [pure virtual] |
virtual void FilterConnectionClosed | ( | IFilterableStreamSocket & | socket | ) | [pure virtual] |
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterShutdown | ( | IFilterableStreamSocket & | socket, | |
ShutdownHow | how | |||
) | [pure virtual] |
Called when the socket has been shutdown, note that the filter cannot currently intercept and change/delay the shutdown call.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterConnectionAborted | ( | IFilterableStreamSocket & | socket, | |
ConnectionClosureReason | reason, | |||
bool | wasUserSocket | |||
) | [pure virtual] |
Called for each socket when a connection manager aborts all of its active connections.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.
virtual void FilterSocketReleased | ( | JetByteTools::Core::IIndexedOpaqueUserData & | userData | ) | [pure 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.
Implemented in CNullStreamSocketConnectionFilter, and CStreamSocketConnectionFilterBase.