GetHostByName Method of the IFWXSession Interface

The GetHostByName method retrieves host information corresponding to a host name. This method is similar to the Winsock gethostbyname function.

Syntax

HRESULT GetHostByName(
  [in]	 const char* name,
  [out]	char* buf,
  [in, out]  int* buflen
);

Parameters

name

Pointer to a null-terminated string that specifies the name of the host. UTF-8 encoding is expected in this parameter.

buf

Pointer to the data area to receive the hostent data. The data area must be larger than the size of a hostent structure because the supplied data area is used by Windows Sockets (Winsock) to contain a hostent structure and all of the data referenced by members of the hostent structure. A buffer of MAXGETHOSTSTRUCT bytes is recommended. The strings returned in the structure are encoded using the current system ANSI code page (ACP).

buflen

On input, specifies the size of data area for the buf parameter. If the buffer is too small, the error code HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) is returned and the buflen parameter receives the size of the required buffer.

Return Value

S_OK

The method was successful. The buffer was filled with the host information.

HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)

Insufficient buffer space was provided. That is, the buffer pointed to by buf is not large enough to contain the host information.

HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND)

The name specified could not be found in the relevant database.

HRESULT_FROM_WIN32(WSATRY_AGAIN)

No response was received from an authoritative server.

HRESULT_FROM_WIN32(WSANO_DATA)

The name specified is valid and was found in the database, but no information of the type requested is associated with it.

Remarks

Like the IFWXFirewall::GetHostByName method, this method checks permissions and policy rules, prior to providing the address. If there are no permissions or if the policy rules do not allow access, the host information will not be provided, and the method returns HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND). This method also logs the name resolution and can use autodial to dial out for the name resolution.

Requirements

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

Declared in Wspfwext.idl.

DLL

Requires Wspsrv.exe.

See Also

IFWXSession


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.

508 Resource Limit Is Reached

Resource Limit Is Reached

The website is temporarily unable to service your request as it exceeded resource limit. Please try again later.