EmulateConnection Method of the IFWXConnection Interface

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

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

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

Length, in bytes, of the RemoteAddress parameter.

LocalAddress

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

Length, in bytes, of the LocalAddress parameter.

ppNewIFWXConnection

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

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

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

Declared in Wspfwext.idl.

DLL

Requires Wspsrv.exe.

See Also

IFWXConnection
EmulateForBind


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.

[an error occurred while processing this directive]