다음을 통해 공유


DataHandler (Windows CE 5.0)

Send Feedback

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

NTSTATUSDataHandler(PVOIDInterfaceHandle, PVOIDSessionHandle, PVOIDDataHandle, PVOIDEditorContext, PVOIDEditorSessionContext, PIPRCVBUFRecvBuffer, ULONGDataOffset)

Parameters

  • InterfaceHandle
    [in] Handle to an interface.
  • SessionHandle
    [in] Handle to the session. Use this handle when calling the QueryInfoSession function.
  • DataHandle
    [in] Handle to the per-packet data context. Use this handle when calling the EditSession function.
  • EditorContext
    [in] Pointer to a context that the NAT editor supplied when the editor called the RegisterEditor function.
  • EditorSessionContext
    [in] Pointer to the context of the session mapping that the editor supplied when the editor called the CreateHandler function.
  • RecvBuffer
    [in] Pointer to an IPRcvBuf structure that specifies the received packet data.
  • DataOffset
    [in] Unsigned long integer that specifies the offset of the protocol data contained in RecvBuffer.

Return Values

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 DataHandler function.

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

OS Versions: Windows CE 3.0 and later.
Header: Natedit.h.
Link Library: Coredll.dll.

See Also

CreateHandler | EditSession | IPRcvBuf | QueryInfoSession | RegisterEditor

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.