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 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 EditSessionfunction 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_DIRECTIONenumeration 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 CreateHandlerfunction to call on when a mapping is created. This parameter is optional.

DeleteHandler

[in] Pointer to a DeleteHandlerfunction to call when a mapping is deleted. This parameter is optional.

ForwardDataHandler

[in] Pointer to a DataHandlerfunction to call on each forward channel packet. This parameter is optional.

ReverseDataHandler

[in] Pointer to a DataHandlerfunction 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 CreateTicketfunction.

DeleteTicket

[out] Pointer that receives the address of the DeleteTicketfunction.

Deregister

[out] Pointer that receives the address of the EditorDeregisterfunction.

DissociateSession

[out] Pointer that receives the address of the DisassociateSessionfunction.

EditSession

[out] Pointer that receives the address of the EditSessionfunction.

QueryInfoSession

[out] Pointer that receives the address of the QueryInfoSessionfunction.

TimeoutSession

[out] Pointer that receives the address of the TimeoutSessionfunction.

Remarks

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

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

The value of the Portparameter 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 CE–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 ntohsfunction, and you can change a value from host byte order to network byte order by calling the htonsfunction.

Requirements

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

See Also