Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

718 lines
16 KiB

  1. /*++
  2. Copyright (c) 1997, Microsoft Corporation
  3. Module Name:
  4. ipnat.h
  5. Abstract:
  6. Contains semi-public IOCTLS and data-structures related to
  7. the IP Network Address Translator.
  8. Author:
  9. Abolade Gbadegesin (t-abolag) 11-July-1997
  10. Revision History:
  11. --*/
  12. #ifndef _ROUTING_IP_NAT_H_
  13. #define _ROUTING_IP_NAT_H_
  14. #include <rtinfo.h> // for RTR_INFO_BLOCK_HEADER
  15. #include <ipinfoid.h> // for IP_GENERAL_INFO_BASE
  16. //
  17. // Moved to ipinfoid.h
  18. //
  19. // #define IP_NAT_INFO IP_GENERAL_INFO_BASE + 8
  20. //
  21. // MISCELLANEOUS DECLARATIONS
  22. //
  23. #define IP_NAT_VERSION 1
  24. #define IP_NAT_SERVICE_NAME "IPNAT"
  25. #define DD_IP_NAT_DEVICE_NAME L"\\Device\\IPNAT"
  26. //
  27. // IP header protocol-field constants
  28. //
  29. #define NAT_PROTOCOL_ICMP 0x01
  30. #define NAT_PROTOCOL_IGMP 0x02
  31. #define NAT_PROTOCOL_TCP 0x06
  32. #define NAT_PROTOCOL_UDP 0x11
  33. #define NAT_PROTOCOL_PPTP 0x2F
  34. //
  35. // IOCTL DECLARATIONS
  36. //
  37. #define FSCTL_IP_NAT_BASE FILE_DEVICE_NETWORK
  38. #define _IP_NAT_CTL_CODE(function, method, access) \
  39. CTL_CODE(FSCTL_IP_NAT_BASE, function, method, access)
  40. //
  41. // NAT-supported IOCTL constant declarations
  42. //
  43. #define IOCTL_IP_NAT_SET_GLOBAL_INFO \
  44. _IP_NAT_CTL_CODE(0, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  45. #define IOCTL_IP_NAT_GET_GLOBAL_INFO \
  46. _IP_NAT_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  47. #define IOCTL_IP_NAT_CREATE_INTERFACE \
  48. _IP_NAT_CTL_CODE(2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  49. #define IOCTL_IP_NAT_DELETE_INTERFACE \
  50. _IP_NAT_CTL_CODE(3, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  51. #define IOCTL_IP_NAT_BIND_INTERFACE \
  52. _IP_NAT_CTL_CODE(4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  53. #define IOCTL_IP_NAT_UNBIND_INTERFACE \
  54. _IP_NAT_CTL_CODE(5, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  55. #define IOCTL_IP_NAT_SET_INTERFACE_INFO \
  56. _IP_NAT_CTL_CODE(6, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  57. #define IOCTL_IP_NAT_GET_INTERFACE_INFO \
  58. _IP_NAT_CTL_CODE(7, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  59. #define IOCTL_IP_NAT_REGISTER_EDITOR \
  60. _IP_NAT_CTL_CODE(8, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  61. #define IOCTL_IP_NAT_GET_INTERFACE_STATISTICS \
  62. _IP_NAT_CTL_CODE(9, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  63. #define IOCTL_IP_NAT_ENUMERATE_SESSION_MAPPINGS \
  64. _IP_NAT_CTL_CODE(10, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  65. #define IOCTL_IP_NAT_REGISTER_DIRECTOR \
  66. _IP_NAT_CTL_CODE(11, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  67. //
  68. // IOCTL_IP_NAT_SET_GLOBAL_INFO
  69. //
  70. // Invoked by the IP router-manager to supply the NAT with its configuration.
  71. //
  72. //
  73. // IOCTL_IP_NAT_GET_GLOBAL_INFO
  74. //
  75. // Invoked by the IP router-manager to retrieve the NAT's configuration.
  76. //
  77. //
  78. // Structure: IP_NAT_GLOBAL_INFO
  79. //
  80. // Holds global configuration information for the NAT.
  81. //
  82. typedef struct _IP_NAT_GLOBAL_INFO {
  83. BOOL NATEnabled; // used by IPRTRMGR
  84. ULONG TCPTimeoutSeconds;
  85. ULONG UDPTimeoutSeconds;
  86. } IP_NAT_GLOBAL_INFO, *PIP_NAT_GLOBAL_INFO;
  87. //
  88. // IOCTL_IP_NAT_CREATE_INTERFACE
  89. //
  90. // Invoked by the IP router-manager to add router-interfaces to the NAT.
  91. //
  92. //
  93. // Structure: IP_NAT_CREATE_INTERFACE
  94. //
  95. // On output, 'NatInterfaceContext' contains the new interface's NAT-created
  96. // context.
  97. //
  98. typedef struct _IP_NAT_CREATE_INTERFACE {
  99. IN ULONG RtrMgrIndex;
  100. IN PVOID RtrMgrContext;
  101. OUT PVOID NatInterfaceContext;
  102. } IP_NAT_CREATE_INTERFACE, *PIP_NAT_CREATE_INTERFACE;
  103. //
  104. // IOCTL_IP_NAT_DELETE_INTERFACE
  105. //
  106. // Invoked by the IP router-manager to delete router-interfaces from the NAT.
  107. //
  108. //
  109. // Structure: IP_NAT_DELETE_INTERFACE
  110. //
  111. // On input, 'NatInterfaceContext' should contain the context for the interface
  112. // to be deleted, as obtained from IOCTL_IP_NAT_CREATE_INTERFACE.
  113. //
  114. typedef struct _IP_NAT_DELETE_INTERFACE {
  115. IN PVOID NatInterfaceContext;
  116. } IP_NAT_DELETE_INTERFACE, *PIP_NAT_DELETE_INTERFACE;
  117. //
  118. // IOCTL_IP_NAT_BIND_INTERFACE
  119. //
  120. // Invoked by the IP router-manager to set the interface's binding.
  121. //
  122. //
  123. // Structure: IP_NAT_BIND_INTERFACE
  124. //
  125. // Holds the binding for the specified interface.
  126. // The field 'BindingInfo' should be the beginning of
  127. // an IP_ADAPTER_BINDING_INFO structure (see routprot.h) which
  128. // contains the interface's binding.
  129. //
  130. typedef struct _IP_NAT_BIND_INTERFACE {
  131. IN PVOID NatInterfaceContext;
  132. IN ULONG BindingInfo[1];
  133. } IP_NAT_BIND_INTERFACE, *PIP_NAT_BIND_INTERFACE;
  134. //
  135. // IOCTL_NAT_UNBIND_INTERFACE
  136. //
  137. // Invoked by the IP router-manager to remove binding from an interface.
  138. //
  139. //
  140. // Structure: IP_NAT_UNBIND_INTERFACE
  141. //
  142. // Used to indicate to the NAT which interface should be unbound.
  143. //
  144. typedef struct _IP_NAT_UNBIND_INTERFACE {
  145. IN PVOID NatInterfaceContext;
  146. } IP_NAT_UNBIND_INTERFACE, *PIP_NAT_UNBIND_INTERFACE;
  147. //
  148. // IOCTL_IP_NAT_SET_INTERFACE_INFO
  149. //
  150. // Invoked by the IP router-manager to set configuration information
  151. // on boundary-interfaces, i.e. interfaces over which translation takes place.
  152. //
  153. // Uses 'IP_NAT_INTERFACE_INFO' for input.
  154. //
  155. //
  156. // IOCTL_IP_NAT_GET_INTERFACE_INFO
  157. //
  158. // Invoked by the IP router-manager to get configuration information on
  159. // boundary interfaces.
  160. //
  161. // uses 'IP_NAT_INTERFACE_INFO' for input and output.
  162. //
  163. //
  164. // Structure: IP_NAT_INTERFACE_INFO
  165. //
  166. // 'NatInterfaceContext' identifies the interface to be configured or whose
  167. // configuration is being retrieved, and is the context supplied on output from
  168. // 'IOCTL_IP_NAT_CREATE_INTERFACE'.
  169. //
  170. // The configuration information uses the RTR_INFO_BLOCK_HEADER structure
  171. // of rtinfo.h. See below for the type-codes for structures which may appear
  172. // after IP_NAT_INTERFACE_INFO.Header within the RTR_TOC_ENTRY.InfoType field.
  173. //
  174. typedef struct _IP_NAT_INTERFACE_INFO {
  175. IN PVOID NatInterfaceContext;
  176. IN ULONG Flags;
  177. IN RTR_INFO_BLOCK_HEADER Header;
  178. } IP_NAT_INTERFACE_INFO, *PIP_NAT_INTERFACE_INFO;
  179. //
  180. // Flags for IP_NAT_INTERFACE_INFO.Flags
  181. //
  182. // _BOUNDARY: set to mark interface as boundary-interface.
  183. // _NAPT: set to enable address-sharing via port-translation.
  184. //
  185. #define IP_NAT_INTERFACE_FLAGS_BOUNDARY 0x00000001
  186. #define IP_NAT_INTERFACE_FLAGS_NAPT 0x00000002
  187. #define IP_NAT_INTERFACE_FLAGS_ALL 0x00000003
  188. //
  189. // Type-codes for the IP_NAT_INTERFACE_INFO.Header.TocEntry[] array.
  190. //
  191. // The structures which correspond to each info-type are given below.
  192. //
  193. #define IP_NAT_PORT_RANGE_TYPE IP_GENERAL_INFO_BASE + 1
  194. #define IP_NAT_ADDRESS_RANGE_TYPE IP_GENERAL_INFO_BASE + 2
  195. #define IP_NAT_PORT_MAPPING_TYPE IP_GENERAL_INFO_BASE + 3
  196. #define IP_NAT_ADDRESS_MAPPING_TYPE IP_GENERAL_INFO_BASE + 4
  197. //
  198. // Structure: IP_NAT_PORT_RANGE
  199. //
  200. // Holds a range of port numbers which the NAT is allowed to use
  201. // on a boundary interface.
  202. //
  203. // In the case of an interface with a pool of addresses, 'PublicAddress'
  204. // should specify which of those addresses this static-mapping applies to.
  205. //
  206. typedef struct _IP_NAT_PORT_RANGE {
  207. UCHAR Protocol;
  208. ULONG PublicAddress; // OPTIONAL - see IP_NAT_ADDRESS_UNSPECIFIED
  209. USHORT StartPort;
  210. USHORT EndPort;
  211. } IP_NAT_PORT_RANGE, *PIP_NAT_PORT_RANGE;
  212. //
  213. // Structure: IP_NAT_ADDRESS_RANGE
  214. //
  215. // Holds a range of addresses which are part of the address-pool
  216. // for a boundary interface.
  217. //
  218. // An address-pool consists of a list of these structures.
  219. //
  220. // Note: overlapping address-ranges are not supported;
  221. // discontiguous subnet masks are also unsupported.
  222. //
  223. typedef struct _IP_NAT_ADDRESS_RANGE {
  224. ULONG StartAddress;
  225. ULONG EndAddress;
  226. ULONG SubnetMask;
  227. } IP_NAT_ADDRESS_RANGE, *PIP_NAT_ADDRESS_RANGE;
  228. //
  229. // Structure: IP_NAT_PORT_MAPPING
  230. //
  231. // Holds a static mapping which ties a public-side port on this NAT interface
  232. // to a particular private machine's address/port.
  233. //
  234. // In the case of an interface with a pool of addresses, 'PublicAddress'
  235. // should specify which of those addresses this static-mapping applies to.
  236. //
  237. typedef struct _IP_NAT_PORT_MAPPING {
  238. UCHAR Protocol;
  239. USHORT PublicPort;
  240. ULONG PublicAddress; // OPTIONAL - see IP_NAT_ADDRESS_UNSPECIFIED
  241. USHORT PrivatePort;
  242. ULONG PrivateAddress;
  243. } IP_NAT_PORT_MAPPING, *PIP_NAT_PORT_MAPPING;
  244. //
  245. // Constant for 'PublicAddress' in IP_NAT_PORT_RANGE and IP_NAT_PORT_MAPPING;
  246. // may be specified for boundary-interfaces which have no address-pool, in
  247. // which case the range/mapping is for the boundary-interface's sole address.
  248. //
  249. #define IP_NAT_ADDRESS_UNSPECIFIED ((ULONG)0)
  250. //
  251. // Structure: IP_NAT_ADDRESS_MAPPING
  252. //
  253. // Holds a static mapping which ties an address from this NAT interface's
  254. // address pool to a particular private-machine's address.
  255. //
  256. // Note that this address must fall within one of the ranges comprising
  257. // the pool as specified by the IP_NAT_ADDRESS_RANGE structures.
  258. //
  259. typedef struct _IP_NAT_ADDRESS_MAPPING {
  260. ULONG PrivateAddress;
  261. ULONG PublicAddress;
  262. BOOL AllowInboundSessions;
  263. } IP_NAT_ADDRESS_MAPPING, *PIP_NAT_ADDRESS_MAPPING;
  264. //
  265. // IOCTL_IP_NAT_REGISTER_EDITOR
  266. //
  267. // This IOCTL is invoked by a kernel-mode component which wishes to act
  268. // as an editor for packets which match a particular session-description.
  269. //
  270. //
  271. // Enum: IP_NAT_DIRECTION
  272. //
  273. // Lists the session-flow directions for which an editor may register.
  274. // IpNatInbound refers to the 'public-to-private' flow, while
  275. // IpNatOutbound refers to the 'private-to-public' flow.
  276. //
  277. typedef enum _IP_NAT_DIRECTION {
  278. IpNatInbound = 0,
  279. IpNatOutbound = 1
  280. } IP_NAT_DIRECTION, *PIP_NAT_DIRECTION;
  281. //
  282. // Editor function prototypes
  283. //
  284. //
  285. // For synchronization reasons, 'CreateHandler' and 'DeleteHandler'
  286. // CANNOT invoke any helper functions other than 'QueryInfoSession'.
  287. //
  288. typedef NTSTATUS
  289. (*PNAT_EDITOR_CREATE_HANDLER)(
  290. IN PVOID EditorContext,
  291. IN ULONG PrivateAddress,
  292. IN USHORT PrivatePort,
  293. IN ULONG PublicAddress,
  294. IN USHORT PublicPort,
  295. IN ULONG RemoteAddress,
  296. IN USHORT RemotePort,
  297. OUT PVOID* EditorSessionContextp OPTIONAL
  298. );
  299. typedef NTSTATUS
  300. (*PNAT_EDITOR_DELETE_HANDLER)(
  301. IN PVOID InterfaceHandle,
  302. IN PVOID SessionHandle,
  303. IN PVOID EditorContext,
  304. IN PVOID EditorSessionContext
  305. );
  306. typedef NTSTATUS
  307. (*PNAT_EDITOR_DATA_HANDLER)(
  308. IN PVOID InterfaceHandle,
  309. IN PVOID SessionHandle,
  310. IN PVOID DataHandle,
  311. IN PVOID EditorContext,
  312. IN PVOID EditorSessionContext,
  313. IN PVOID RecvBuffer,
  314. IN ULONG DataOffset
  315. );
  316. //
  317. // Helper function prototypes
  318. //
  319. typedef NTSTATUS
  320. (*PNAT_HELPER_CREATE_TICKET)(
  321. IN PVOID InterfaceHandle,
  322. IN UCHAR Protocol,
  323. IN ULONG PrivateAddress,
  324. IN USHORT PrivatePort,
  325. IN ULONG TimeoutSeconds,
  326. OUT PULONG PublicAddress,
  327. OUT PUSHORT PublicPort
  328. );
  329. typedef NTSTATUS
  330. (*PNAT_HELPER_DELETE_TICKET)(
  331. IN PVOID InterfaceHandle,
  332. IN ULONG PublicAddress,
  333. IN UCHAR Protocol,
  334. IN USHORT PublicPort
  335. );
  336. typedef NTSTATUS
  337. (*PNAT_HELPER_DEREGISTER_EDITOR)(
  338. IN PVOID EditorHandle
  339. );
  340. typedef NTSTATUS
  341. (*PNAT_HELPER_DISSOCIATE_SESSION)(
  342. IN PVOID EditorHandle,
  343. IN PVOID SessionHandle
  344. );
  345. typedef NTSTATUS
  346. (*PNAT_HELPER_EDIT_SESSION)(
  347. IN PVOID DataHandle,
  348. IN PVOID RecvBuffer,
  349. IN ULONG OldDataOffset,
  350. IN ULONG OldDataLength,
  351. IN PUCHAR NewData,
  352. IN ULONG NewDataLength
  353. );
  354. typedef VOID
  355. (*PNAT_HELPER_QUERY_INFO_SESSION)(
  356. IN PVOID SessionHandle,
  357. IN PULONG PrivateAddress OPTIONAL,
  358. IN PUSHORT PrivatePort OPTIONAL,
  359. IN PULONG RemoteAddress OPTIONAL,
  360. IN PUSHORT RemotePort OPTIONAL,
  361. IN PULONG PublicAddress OPTIONAL,
  362. IN PUSHORT PublicPort OPTIONAL
  363. );
  364. typedef VOID
  365. (*PNAT_HELPER_TIMEOUT_SESSION)(
  366. IN PVOID EditorHandle,
  367. IN PVOID SessionHandle
  368. );
  369. //
  370. // Structure: IP_NAT_REGISTER_EDITOR
  371. //
  372. // The editor uses this structure to register itself with the NAT,
  373. // and to obtain entrypoints of helper-functions provided by the NAT.
  374. //
  375. // On input, 'EditorContext' should contain a value which the NAT will
  376. // pass to the editor's provided functions to serve as identification.
  377. //
  378. // On output, 'EditorHandle' contains the handle which the editor should
  379. // pass to the NAT's helper functions to identify itself.
  380. //
  381. typedef struct _IP_NAT_REGISTER_EDITOR {
  382. IN ULONG Version;
  383. IN ULONG Flags;
  384. IN UCHAR Protocol;
  385. IN USHORT Port;
  386. IN IP_NAT_DIRECTION Direction;
  387. IN PVOID EditorContext;
  388. IN PNAT_EDITOR_CREATE_HANDLER CreateHandler; // OPTIONAL
  389. IN PNAT_EDITOR_DELETE_HANDLER DeleteHandler; // OPTIONAL
  390. IN PNAT_EDITOR_DATA_HANDLER InboundDataHandler; // OPTIONAL
  391. IN PNAT_EDITOR_DATA_HANDLER OutboundDataHandler; // OPTIONAL
  392. OUT PVOID EditorHandle;
  393. OUT PNAT_HELPER_CREATE_TICKET CreateTicket;
  394. OUT PNAT_HELPER_DELETE_TICKET DeleteTicket;
  395. OUT PNAT_HELPER_DEREGISTER_EDITOR Deregister;
  396. OUT PNAT_HELPER_DISSOCIATE_SESSION DissociateSession;
  397. OUT PNAT_HELPER_EDIT_SESSION EditSession;
  398. OUT PNAT_HELPER_QUERY_INFO_SESSION QueryInfoSession;
  399. OUT PNAT_HELPER_TIMEOUT_SESSION TimeoutSession;
  400. } IP_NAT_REGISTER_EDITOR, *PIP_NAT_REGISTER_EDITOR;
  401. #define IP_NAT_EDITOR_FLAGS_RESIZE 0x00000001
  402. //
  403. // IOCTL_IP_NAT_REGISTER_DIRECTOR
  404. //
  405. // This IOCTL is invoked by a kernel-mode component that wishes to be consulted
  406. // about the direction of incoming TCP/UDP sessions.
  407. //
  408. // Such a component, if installed, is consulted by the NAT
  409. // to determine dynamically how to direct inbound sessions. The module
  410. // could, for instance, be installed to direct sessions destined for
  411. // a cluster of HTTP servers in such a way as to balance the load across
  412. // the servers via round-robin or other means.
  413. //
  414. //
  415. // Director function prototypes
  416. //
  417. typedef NTSTATUS
  418. (*PNAT_DIRECTOR_QUERY_SESSION)(
  419. IN PVOID DirectorContext,
  420. IN UCHAR Protocol,
  421. IN ULONG PublicAddress,
  422. IN USHORT PublicPort,
  423. IN ULONG RemoteAddress,
  424. IN USHORT RemotePort,
  425. OUT PULONG PrivateAddress,
  426. OUT PUSHORT PrivatePort,
  427. OUT PVOID* Contextp OPTIONAL
  428. );
  429. typedef NTSTATUS
  430. (*PNAT_DIRECTOR_DELETE_SESSION)(
  431. IN PVOID SessionHandle,
  432. IN PVOID DirectorContext,
  433. IN PVOID DirectorSessionContext
  434. );
  435. //
  436. // Director-helper function prototypes
  437. //
  438. typedef NTSTATUS
  439. (*PNAT_HELPER_DEREGISTER_DIRECTOR)(
  440. IN PVOID DirectorHandle
  441. );
  442. //
  443. // Structure: IP_NAT_REGISTER_DIRECTOR
  444. //
  445. // The director uses this structure to register itself with the NAT.
  446. //
  447. typedef struct _IP_NAT_REGISTER_DIRECTOR {
  448. IN ULONG Version;
  449. IN ULONG Flags;
  450. IN UCHAR Protocol;
  451. IN USHORT Port;
  452. IN PVOID DirectorContext;
  453. IN PNAT_DIRECTOR_QUERY_SESSION QueryHandler;
  454. IN PNAT_DIRECTOR_DELETE_SESSION DeleteHandler;
  455. OUT PVOID DirectorHandle;
  456. OUT PNAT_HELPER_QUERY_INFO_SESSION QueryInfoSession;
  457. OUT PNAT_HELPER_DEREGISTER_DIRECTOR Deregister;
  458. } IP_NAT_REGISTER_DIRECTOR, *PIP_NAT_REGISTER_DIRECTOR;
  459. //
  460. // IOCTL_IP_NAT_GET_INTERFACE_STATISTICS
  461. //
  462. // This IOCTL is invoked to retrieve per-interface statistics.
  463. //
  464. //
  465. // Structure: IP_NAT_INTERFACE_STATISTICS
  466. //
  467. // Used for retrieving statistics. On input, 'NatInterfaceContext'
  468. // should contain the context of the NAT interface whose statistics
  469. // are to be obtained.
  470. //
  471. typedef struct _IP_NAT_INTERFACE_STATISTICS {
  472. IN PVOID NatInterfaceContext;
  473. OUT ULONG TotalMappings;
  474. OUT ULONG InboundMappings;
  475. OUT ULONG InboundPacketsRejected;
  476. OUT ULONG OutboundPacketsRejected;
  477. } IP_NAT_INTERFACE_STATISTICS, *PIP_NAT_INTERFACE_STATISTICS;
  478. //
  479. // IOCTL_IP_NAT_ENUMERATE_SESSION_MAPPINGS
  480. //
  481. // This IOCTL is invoked to enumerate the dynamic TCP and UDP mappings
  482. // for an interface.
  483. //
  484. //
  485. // Structure: IP_NAT_SESSION_MAPPING
  486. //
  487. // This structure holds information for a single mapping
  488. //
  489. typedef struct _IP_NAT_SESSION_MAPPING {
  490. IP_NAT_DIRECTION Direction;
  491. UCHAR Protocol; // see NAT_PROTOCOL_* above
  492. ULONG PrivateAddress;
  493. USHORT PrivatePort;
  494. ULONG PublicAddress;
  495. USHORT PublicPort;
  496. ULONG RemoteAddress;
  497. USHORT RemotePort;
  498. ULONG IdleTime; // in seconds
  499. } IP_NAT_SESSION_MAPPING, *PIP_NAT_SESSION_MAPPING;
  500. //
  501. // Structure: IP_NAT_ENUMERATE_SESSION_MAPPINGS
  502. //
  503. // Used for enumerate session mappings. On input, 'NatInterfaceContext'
  504. // should hold the context for the interface whose mappings are to be
  505. // enumerated. On the first call to this routine, 'EnumerateContext'
  506. // should be zeroed out; it will be filled by the NAT with information
  507. // to be passed back down as the enumeration continues. To indicate
  508. // there are no items remaining, the NAT will set EnumerateContext[0] to 0.
  509. //
  510. typedef struct _IP_NAT_ENUMERATE_SESSION_MAPPINGS {
  511. IN PVOID NatInterfaceContext;
  512. IN OUT ULONG EnumerateContext[4];
  513. OUT ULONG EnumerateCount;
  514. OUT IP_NAT_SESSION_MAPPING EnumerateTable[1];
  515. } IP_NAT_ENUMERATE_SESSION_MAPPINGS, *PIP_NAT_ENUMERATE_SESSION_MAPPINGS;
  516. #endif // _ROUTING_IP_NAT_H_