Microsoft Internet Security and Acceleration Server 2004 SDK

IFWXDataFilter::SetSockets

The SetSockets method sets the internal and external sockets for the data filter. When this method is called, the filter is expected to begin the data-pumping process between the sockets.

HRESULT SetSockets(
  IFWXSocket* piInternalSocket,
  IFWXSocket* piExternalSocket,
  IFWXConnection* piConnection,
  IUnknown* punkFilterContext
);

Parameters

piInternalSocket
[in] Pointer to the IFWXSocket interface for an internal socket.
piExternalSocket
[in] Pointer to the IFWXSocket interface for an external socket.
piConnection
[in] Pointer to the IFWXConnection interface on the connection object on which this data filter is installed.
punkFilterContext
[in] Pointer to the interface used to pass context information to the data filter. The parameter will have the same value as the punkFilterContext parameter of the IFWXConnection::AttachDataFilter and IFWXSession::SetDataFilterFactory methods.

Return Values

Implementations of this method should return the following:
S_OK
The method succeeded.
E_OUTOFMEMORY
Insufficient memory or resources to process the event. The connection will be terminated.

Remarks

A filter that is emulating a connection receives NULL for the external socket interface.

Example Code

The following is an example implementation of the IFWXDataFilter::SetSockets method.

STDMETHODIMP
//CDumpData is the name of the object that implements
//IFWXDataFilter in this example.
CDumpData::SetSockets(
	IN   IFWXSocket *piInternalSocket,
	IN   IFWXSocket *piExternalSocket,
	IN   IFWXConnection *piConnection,
	IN   IUnknown *punkFilterContext
	)
{
	// Using Lock/Unlock, all access to the sockets is protected 
	// because Detach could be called at any time.
	Lock();
	m_spInternalSocket = piInternalSocket;
	m_spExternalSocket = piExternalSocket;
	Unlock();
		 
	//ReadFirstBuffers is a function that waits for
	//data on both sockets.
	return ReadFirstBuffers();
}

The variables m_spInternalSocket and m_spExternalSocket are defined as follows:

	CComPtr<IFWXSocket> m_spExternalSocket;
	CComPtr<IFWXSocket> m_spInternalSocket;

Requirements

Server: Requires Windows Server 2003 or Windows 2000.
Version: Requires Internet Security and Acceleration Server 2004.
Header: Declared in Wspfwext.idl.

See Also

IFWXDataFilter