The C++ framework for developing highly scalable, high performance servers on Windows platforms.

IFilterStreamSocketConnections Class Reference
[Stream SocketsFilteringProtected destructors on abstract base classes]

Inheritance diagram for IFilterStreamSocketConnections:

List of all members.


Detailed Description

An interface for objects that wish to filter a byte stream. An instance of this interface can be added to a CStreamSocketConnectionManager as a filter by calling AddConnectionFilter(). 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 we call AddConnectionFilter() with filter A and then with filter B and then 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 the data is processed first by filter A and then by filter B (wire -> A -> B -> user). Each filter can manipulate the connection and data flow and may or may not pass calls onto filters below it in the chain. Thus a filter can swallow requests from layers above it by not passing them on and can also generate requests of its own. A filter is initialised once by the connection manager before it is used and during this initialisation it is given a management interface that can be used to generate new read and write events.

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.

Constructor & Destructor Documentation

virtual ~IFilterStreamSocketConnections (  )  [protected, virtual]

We never delete instances of this interface; you must manage the lifetime of the class that implements it.


Member Function Documentation

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]

Called when the connection is closed.

Implemented in CNullStreamSocketConnectionFilter.

virtual void FilterConnectionClosed ( IFilterableStreamSocket socket  )  [pure virtual]

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.


Generated on Sun Sep 12 19:10:22 2021 for The Server Framework - v7.4 by doxygen 1.5.3