SetSockets Method of the IFWXDataFilter Interface

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.

Syntax

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

Parameters

piInternalSocket

Pointer to the IFWXSocket interface for an internal socket.

piExternalSocket

Pointer to the IFWXSocket interface for an external socket.

piConnection

Pointer to the IFWXConnection interface on the connection object on which this data filter is installed.

punkFilterContext

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 Value

Implementations of this method should return the following:

S_OK

The method succeeded.

E_OUTOFMEMORY

Not enough memory or resources could be allocated to process the event. The connection will be terminated.

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;

Remarks

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

Requirements

Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).
Header

Declared in Wspfwext.idl.

See Also

IFWXDataFilter


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.