Share via


IFWXConnection::EmulateConnection method

Applies to: desktop apps only

The EmulateConnection method creates a connection to a client for a filter-emulated listening (inbound) connection.

Syntax

HRESULT EmulateConnection(
  [in]   IFWXDataFilter *piDataFilter,
  [in]   LPSOCKADDR RemoteAddress,
  [in]   DWORD RemoteAddressLength,
  [in]   LPSOCKADDR LocalAddress,
  [in]   DWORD LocalAddressLength,
  [out]  IFWXConnection **ppNewIFWXConnection
);

Parameters

  • piDataFilter [in]
    Pointer to the IFWXDataFilter interface on the data filter that supplies the data for the connection. The data filter is installed with fwx_dfpc_Emulation priority, which is closest to the Internet. The data filter only receives an interface of an internal socket. An external socket is assumed to be held by the caller.

  • RemoteAddress [in]
    Pointer to a sockaddr structure that contains the address of the remote socket that is connecting to the client. This address is set in the output parameter of the accept and getpeername functions on the client.

  • RemoteAddressLength [in]
    Length, in bytes, of the RemoteAddress parameter.

  • LocalAddress [in]
    Pointer to a sockaddr structure that contains the local Microsoft Firewall service address that is used for the connection. This is the address that the getsockname function returns to the client.

  • LocalAddressLength [in]
    Length, in bytes, of the LocalAddress parameter.

  • ppNewIFWXConnection [out]
    Pointer to a variable that receives an IFWXConnection interface pointer on the connection object that is created for this new connection. The parameter can be NULL. The reference to the new connection object must not be held after an event of type fwx_ConnectionTerminating for that connection is received.

Return value

This method can return one of these values.

  • S_OK
    The method succeeded.

  • HRESULT_FROM_WIN32(WSAEINVAL)
    The connection object is not in a listening state or is not being emulated.

  • HRESULT_FROM_WIN32
    The method failed and returned a Windows Sockets (Winsock) error code.

  • E_OUTOFMEMORY
    Not enough memory or resources could be allocated to complete the operation.

  • FWX_E_TERMINATING
    The object is shutting down.

Remarks

This method may be called only if this connection is in the listening state, and the caller is a filter that is emulating the listening state for the connection. Clients use the emulated connection, so that, effectively, only one real connection is used.

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

DLL

Wspsrv.exe

See also

IFWXConnection

EmulateForBind

 

 

Build date: 7/12/2010