IP_NAT_REGISTER_EDITOR (Compact 2013)

3/28/2014

This structure allows the editor to register itself with the network address translation (NAT), and to obtain the entry points of helper functions provided by the NAT.

Syntax

typedef struct {
  ULONG Version;
  ULONG Flags;
  UCHAR Protocol;
    USHORT Port;
  IP_NAT_DIRECTION Direction;
  PVOID EditorContext;
  PNAT_EDITOR_CREATE_HANDLER CreateHandler;
  PNAT_EDITOR_DELETE_HANDLER DeleteHandler;
  PNAT_EDITOR_DATA_HANDLER ForwardDataHandler;
  PNAT_EDITOR_DATA_HANDLER ReverseDataHandler;
  PVOID EditorHandle;
  PNAT_EDITOR_CREATE_TICKET CreateTicket;
  PNAT_EDITOR_DELETE_TICKET DeleteTicket;
  PNAT_EDITOR_DEREGISTER Deregister;
  PNAT_EDITOR_DISSOCIATE_SESSION DissociateSession;
  PNAT_EDITOR_EDIT_SESSION EditSession;
  PNAT_EDITOR_QUERY_INFO_SESSION QueryInfoSession;
  PNAT_EDITOR_TIMEOUT_SESSION TimeoutSession;
} IP_NAT_REGISTER_EDITOR;

Members

  • Version
    [in] Unsigned long integer that specifies the version of NAT. Set to IP_NAT_VERSION.
  • Flags
    [in] Unsigned long integer that specifies the flags. Set to IP_NAT_EDITOR_FLAGS_RESIZE if the editor potentially needs to change the size of packets.

    Note

    If the IP_NAT_EDITOR_FLAGS_RESIZE flag is not set, the EditSession function resizes packets and the acknowledge number that the client returns to the server is not adjusted properly.

  • Protocol
    [in] Unsigned character that specifies the protocol field of the IP header. It is one of the following values.

    Value

    Description

    NAT_PROTOCOL_TCP

    Specifies the TCP protocol.

    NAT_PROTOCOL_UDP

    Specifies the UDP protocol.

  • Port
    [in] Unsigned short integer that specifies the TCP or UDP port that you want to edit, expressed as a hexadecimal value arranged in host byte order.
  • Direction
    [in] Value from the IP_NAT_DIRECTION enumeration that specifies whether editor is interested in inbound or outbound sessions. It is one of the following values.

    Value

    Description

    NatInboundDirection

    Specifies inbound sessions; in other words, sessions in which network traffic moves from the Internet to the home network.

    NatOutboundDirection

    Specifies outbound sessions; in other words, sessions in which network traffic moves from the home network to the Internet.

  • EditorContext
    [in] Pointer to a context to pass to the NAT editor functions.
  • CreateHandler
    [in] Pointer to a CreateHandler function to call on when a mapping is created. This parameter is optional.
  • DeleteHandler
    [in] Pointer to a DeleteHandler function to call when a mapping is deleted. This parameter is optional.
  • ForwardDataHandler
    [in] Pointer to a DataHandler function to call on each forward channel packet. This parameter is optional.
  • ReverseDataHandler
    [in] Pointer to a DataHandler function to call on each reverse channel packet. This parameter is optional.
  • EditorHandle
    [out] Pointer that receives a handle that identifies the editor to NAT module.
  • CreateTicket
    [out] Pointer that receives the address of the CreateTicket function.
  • DeleteTicket
    [out] Pointer that receives the address of the DeleteTicket function.
  • Deregister
    [out] Pointer that receives the address of the EditorDeregister function.
  • DissociateSession
    [out] Pointer that receives the address of the DisassociateSession function.
  • EditSession
    [out] Pointer that receives the address of the EditSession function.
  • QueryInfoSession
    [out] Pointer that receives the address of the QueryInfoSession function.
  • TimeoutSession
    [out] Pointer that receives the address of the TimeoutSession function.

Remarks

You should specify a value for EditorContext that the NAT can pass to the functions provided by the editor to serve as identification.

EditorHandle receives the handle that the editor should pass to the helper functions to identify itself.

The value of the Port parameter is interpreted as a hexadecimal number arranged in host byte order. Network byte order means that the bytes are stored in big-endian order. Host byte order means that the bytes are stored with the same byte ordering that the host uses. Windows Embedded Compact-based computers are currently all little-endian, so host byte order stores the bytes in reverse order. For example, you would specify the bytes for port 42045 (0xA43D) in the order A4, 3D when using network byte order, and in the order 3D, A4 when using host byte order. You can change a value from network byte order to host byte order by calling the ntohs function, and you can change a value from host byte order to network byte order by calling the htons function.

Requirements

Header

natedit.h

See Also

Reference

Network Address Translation Structures
CreateHandler
CreateTicket
DataHandler
DeleteHandler
DeleteTicket
EditorDeregister
DisassociateSession
EditSession
IP_NAT_DIRECTION
QueryInfoSession
RegisterEditor
TimeoutSession

Other Resources

htons
ntohs