Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function is called by the network address translation (NAT) driver for each packet received during a session controlled by a NAT editor.

Syntax

NTSTATUS DataHandler( 
  PVOID 
InterfaceHandle, 
  PVOID 
SessionHandle, 
  PVOID 
DataHandle, 
  PVOID 
EditorContext, 
  PVOID 
EditorSessionContext, 
  PIPRCVBUF 
RecvBuffer, 
  ULONG 
DataOffset 
)

Parameters

InterfaceHandle

[in] Handle to an interface.

SessionHandle

[in] Handle to the session. Use this handle when calling the QueryInfoSessionfunction.

DataHandle

[in] Handle to the per-packet data context. Use this handle when calling the EditSessionfunction.

EditorContext

[in] Pointer to a context that the NAT editor supplied when the editor called the RegisterEditorfunction.

EditorSessionContext

[in] Pointer to the context of the session mapping that the editor supplied when the editor called the CreateHandlerfunction.

RecvBuffer

[in] Pointer to an IPRcvBufstructure that specifies the received packet data.

DataOffset

[in] Unsigned long integer that specifies the offset of the protocol data contained in RecvBuffer.

Return Value

STATUS_SUCCESS indicates success. A non-zero value indicates failure.

Remarks

This function is optional. Not all protocol editors need to implement this function.

The following code example shows an example of a DataHandlerfunction.

Copy Code
NTSTATUS EditorForwardDataHandler(
	IN PVOID InterfaceHandle,
	IN PVOID SessionHandle,
	IN PVOID DataHandle,
	IN PVOID EditorContext,
	IN PVOID EditorSessionContext,
	IN PIPRCVBUF RecvBuffer,
	IN ULONG DataOffset
	)
{
#define BUFFER_LEN  64
PIPRCVBUF pRcvBuf = RecvBuffer;
TCHAR szTextBuffer[BUFFER_LEN];
while (pRcvBuf) 
	{
	_sntprintf(szTextBuffer, BUFFER_LEN, 
			TEXT("	ipr_buf: 0x%X, size: %u\r\n"), 
			pRcvBuf, pRcvBuf->ipr_size);
	szTextBuffer[BUFFER_LEN-1] = TEXT('\0'); // Guarantee
null-termination
	OutputDebugString(szTextBuffer);
	pRcvBuf = pRcvBuf->ipr_next;
}
return STATUS_SUCCESS;
}

Requirements

Header natedit.h
Library coredll.dll
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.