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.

225 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1998, Microsoft Corporation
  3. Module Name:
  4. natio.h
  5. Abstract:
  6. This module contains declarations for the NAT's I/O interface
  7. to the kernel-mode driver. It also contains the user-mode stubs
  8. which proxy router-manager requests to the kernel-mode driver.
  9. Author:
  10. Abolade Gbadegesin (aboladeg) 10-Mar-1998
  11. Revision History:
  12. --*/
  13. #ifndef _NATHLP_NATIO_H_
  14. #define _NATHLP_NATIO_H_
  15. //
  16. // Structure: NAT_INTERFACE
  17. //
  18. // This structure describes an interface which has been created with the NAT.
  19. // Each interface is inserted into the list of interfaces, sorted by 'Index'.
  20. // Access to the list of interfaces is controlled by 'NatInterfaceLock'.
  21. //
  22. typedef struct _NAT_INTERFACE {
  23. LIST_ENTRY Link;
  24. ULONG Index;
  25. ULONG AdapterIndex;
  26. ROUTER_INTERFACE_TYPE Type;
  27. ULONG Flags;
  28. PIP_NAT_INTERFACE_INFO Info;
  29. } NAT_INTERFACE, *PNAT_INTERFACE;
  30. #define NAT_INTERFACE_FLAG_ADDED_FTP 0x80000000
  31. #define NAT_INTERFACE_ADDED_FTP(i) \
  32. ((i)->Flags & NAT_INTERFACE_FLAG_ADDED_FTP)
  33. #define NAT_INTERFACE_FLAG_BOUND 0x40000000
  34. #define NAT_INTERFACE_BOUND(i) \
  35. ((i)->Flags & NAT_INTERFACE_FLAG_BOUND)
  36. // MASK 0x20000000 is available
  37. #define NAT_INTERFACE_FLAG_ADDED_H323 0x10000000
  38. #define NAT_INTERFACE_ADDED_H323(i) \
  39. ((i)->Flags & NAT_INTERFACE_FLAG_ADDED_H323)
  40. #define NAT_INTERFACE_FLAG_ADDED_ALG 0x08000000
  41. #define NAT_INTERFACE_ADDED_ALG(i) \
  42. ((i)->Flags & NAT_INTERFACE_FLAG_ADDED_ALG)
  43. //
  44. // GLOBAL VARIABLE DECLARATIONS
  45. //
  46. extern HANDLE NatFileHandle;
  47. extern LIST_ENTRY NatInterfaceList;
  48. extern CRITICAL_SECTION NatInterfaceLock;
  49. //
  50. // FUNCTION DECLARATIONS
  51. //
  52. ULONG
  53. NatBindInterface(
  54. ULONG Index,
  55. PNAT_INTERFACE Interfacep OPTIONAL,
  56. PIP_ADAPTER_BINDING_INFO BindingInfo,
  57. ULONG AdapterIndex
  58. );
  59. VOID
  60. NatCloseDriver(
  61. HANDLE FileHandle
  62. );
  63. ULONG
  64. NatConfigureDriver(
  65. PIP_NAT_GLOBAL_INFO GlobalInfo
  66. );
  67. ULONG
  68. NatConfigureInterface(
  69. ULONG Index,
  70. PIP_NAT_INTERFACE_INFO InterfaceInfo
  71. );
  72. ULONG
  73. NatCreateInterface(
  74. ULONG Index,
  75. NET_INTERFACE_TYPE Type,
  76. PIP_NAT_INTERFACE_INFO InterfaceInfo
  77. );
  78. ULONG
  79. NatCreateTicket(
  80. ULONG InterfaceIndex,
  81. UCHAR Protocol,
  82. USHORT PublicPort,
  83. ULONG PublicAddress,
  84. USHORT PrivatePort,
  85. ULONG PrivateAddress
  86. );
  87. ULONG
  88. NatDeleteInterface(
  89. ULONG Index
  90. );
  91. ULONG
  92. NatDeleteTicket(
  93. ULONG InterfaceIndex,
  94. UCHAR Protocol,
  95. USHORT PublicPort,
  96. ULONG PublicAddress,
  97. USHORT PrivatePort,
  98. ULONG PrivateAddress
  99. );
  100. #define NAT_IF_CHAR_BOUNDARY 0x00000001
  101. #define NAT_IF_CHAR_PRIVATE 0x00000002
  102. #define NAT_IF_CHAR_FW 0x00000004
  103. #define NAT_IFC_BOUNDARY(_Flags) \
  104. ((_Flags) & NAT_IF_CHAR_BOUNDARY)
  105. #define NAT_IFC_PRIVATE(_Flags) \
  106. ((_Flags) & NAT_IF_CHAR_PRIVATE)
  107. #define NAT_IFC_FW(_Flags) \
  108. ((_Flags) & NAT_IF_CHAR_FW)
  109. ULONG
  110. NatGetInterfaceCharacteristics(
  111. ULONG Index
  112. );
  113. VOID
  114. NatInstallApplicationSettings(
  115. VOID
  116. );
  117. BOOLEAN
  118. NatIsBoundaryInterface(
  119. ULONG Index,
  120. PBOOLEAN IsNatInterface OPTIONAL
  121. );
  122. ULONG
  123. NatLoadDriver(
  124. OUT PHANDLE FileHandle,
  125. PIP_NAT_GLOBAL_INFO GlobalInfo
  126. );
  127. ULONG
  128. NatOpenDriver(
  129. OUT PHANDLE FileHandle
  130. );
  131. ULONG
  132. NatQueryInterface(
  133. ULONG Index,
  134. PIP_NAT_INTERFACE_INFO InterfaceInfo,
  135. PULONG InterfaceInfoSize
  136. );
  137. ULONG
  138. NatQueryInterfaceMappingTable(
  139. ULONG Index,
  140. PIP_NAT_ENUMERATE_SESSION_MAPPINGS EnumerateTable,
  141. PULONG EnumerateTableSize
  142. );
  143. ULONG
  144. NatQueryMappingTable(
  145. PIP_NAT_ENUMERATE_SESSION_MAPPINGS EnumerateTable,
  146. PULONG EnumerateTableSize
  147. );
  148. ULONG
  149. NatQueryStatisticsInterface(
  150. ULONG Index,
  151. PIP_NAT_INTERFACE_STATISTICS InterfaceStatistics,
  152. PULONG InterfaceStatisticsSize
  153. );
  154. VOID
  155. NatRemoveApplicationSettings(
  156. VOID
  157. );
  158. ULONG
  159. NatUnbindInterface(
  160. ULONG Index,
  161. PNAT_INTERFACE Interfacep OPTIONAL
  162. );
  163. ULONG
  164. NatUnloadDriver(
  165. HANDLE FileHandle
  166. );
  167. ULONG
  168. NatLookupPortMappingAdapter(
  169. ULONG AdapterIndex,
  170. UCHAR Protocol,
  171. ULONG PublicAddress,
  172. USHORT PublicPort,
  173. PIP_NAT_PORT_MAPPING PortMappingp
  174. );
  175. #endif // _NATHLP_NATIO_H_