Share via


IFWXDataFilter::SetSockets method

Applies to: desktop apps only

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 [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 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.

Remarks

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

Examples

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

Minimum supported client

None supported

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)

Version

Forefront Threat Management Gateway (TMG) 2010

Header

Wspfwext.idl

See also

IFWXDataFilter

 

 

Build date: 7/12/2010