Leaked source code of windows server 2003
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.

335 lines
7.4 KiB

  1. /*
  2. File hnportmapping.h
  3. Definition of the set port mapping functions for intergrating incoming
  4. connection with personal firewall, for whistler bug#123769
  5. Gang Zhao 11/6/2000
  6. */
  7. #ifndef __rassrvui_hnportmapping_h
  8. #define __rassrvui_hnportmapping_h
  9. #include <windows.h>
  10. #include <hnetcfg.h>
  11. typedef struct {
  12. //An Array to store Connections of INetConnection * type
  13. //
  14. INetConnection ** ConnArray;
  15. //Number of Connections found
  16. DWORD ConnCount;
  17. //An Array to store connection properties
  18. //
  19. NETCON_PROPERTIES* ConnPropTable;
  20. //Connection Manager used to generate another member EnumCon
  21. //
  22. INetConnectionManager* ConnMan;
  23. //Connection Enumerator
  24. //
  25. IEnumNetConnection* EnumCon;
  26. //Connection on which to Set Up PortMapping right now
  27. // pNetConnection and pGuid can both represent connections
  28. //but only one of them is used and valid for portmapping at each time
  29. //
  30. INetConnection * pNetConnection;
  31. //The Guid of the current connection on which to Set Up PortMapping right now
  32. //
  33. GUID * pGuid;
  34. //Converted from pNetConnection, the PortMapping needs
  35. //the connection to be of type (IHNetConnection *)
  36. //In all, Enumerate Connection will return connections of
  37. // INetConnection * type, PortMapping operations require
  38. //IHNetConnection * type
  39. //
  40. IHNetConnection * pHNetConn;
  41. //High level COM interface to generate pSettings
  42. //
  43. IHNetCfgMgr * pHNetCfgMgr;
  44. //Used to generate pEnumPMP(PortMapping protocol enumerator)
  45. //
  46. IHNetProtocolSettings * pSettings;
  47. //PortMapping protocol enumerator, to enumerate existing
  48. //PortMapping protocols like (PPTP, L2TP, IKE (if exist)), FTP, ....
  49. //
  50. IEnumHNetPortMappingProtocols* pEnumPMP;
  51. //PortMapping Protocol for PPTP
  52. //
  53. IHNetPortMappingProtocol * pProtocolPPTP;
  54. //PortMapping Protocol for L2TP
  55. //
  56. IHNetPortMappingProtocol * pProtocolL2TP;
  57. //PortMapping Protocol for IKE
  58. //
  59. IHNetPortMappingProtocol * pProtocolIKE;
  60. //PortMapping Protocol for IKE
  61. //
  62. IHNetPortMappingProtocol * pProtocolNAT_T; // IKE Negotiation
  63. //Title for PPTP, read from resource file
  64. //
  65. WCHAR * pwszTitlePPTP;
  66. //Title for L2TP, read from resource file
  67. //
  68. WCHAR * pwszTitleL2TP;
  69. //Title for IKE, read from resource file
  70. //
  71. WCHAR * pwszTitleIKE;
  72. //Title for Nat-Traveral, read from resource file
  73. WCHAR * pwszTitleNAT_T;
  74. //Title for PortMapping address, read from resource file
  75. //currently, it is always 127.0.0.1 loopback address
  76. //
  77. TCHAR * pszLoopbackAddr;
  78. //Indicating if COM is already initialized
  79. //
  80. BOOL fComInitialized;
  81. //Indicating if we need to do the COM un-initialization
  82. BOOL fCleanupOle;
  83. } HNPMParams, * LPHNPMParams;
  84. //Define callback function type for Pick Protocol
  85. typedef DWORD (APIENTRY * PFNHNPMPICKPROTOCOL) ( LPHNPMParams, IHNetPortMappingProtocol* , WCHAR *, UCHAR, USHORT );
  86. //When Using CoSetProxyBlanket, we should set both the interface
  87. //and the IUnknown interface queried from it
  88. //
  89. HRESULT
  90. HnPMSetProxyBlanket (
  91. IUnknown* pUnk);
  92. //Do the CoInitialize() COM if necessary
  93. //Set up cleanup flag and initialized flag
  94. //
  95. DWORD
  96. HnPMInit(
  97. IN OUT LPHNPMParams pInfo);
  98. DWORD
  99. HnPMCleanUp(
  100. IN OUT LPHNPMParams pInfo);
  101. DWORD
  102. HnPMParamsInitParameterCheck(
  103. IN LPHNPMParams pInfo);
  104. HnPMParamsInit(
  105. IN OUT LPHNPMParams pInfo);
  106. DWORD
  107. HnPMParamsCleanUp(
  108. IN OUT LPHNPMParams pInfo);
  109. DWORD
  110. HnPMCfgMgrInit(
  111. IN OUT LPHNPMParams pInfo);
  112. DWORD
  113. HnPMCfgMgrCleanUp(
  114. IN OUT LPHNPMParams pInfo);
  115. DWORD
  116. HnPMConnectionEnumInit(
  117. IN LPHNPMParams pInfo);
  118. DWORD
  119. HnPMConnectionEnumCleanUp(
  120. IN LPHNPMParams pInfo);
  121. //Return all the connections like DUN, VPN, LAN and Incoming Connection
  122. //and the properties of them
  123. //
  124. DWORD
  125. HnPMConnectionEnum(
  126. IN LPHNPMParams pInfo);
  127. DWORD
  128. HnPMPickProtcolParameterCheck(
  129. IN LPHNPMParams pInfo);
  130. //Pick PortMapping protocols: PPTP, L2TP, IKE
  131. //
  132. DWORD
  133. HnPMPickProtocol(
  134. IN OUT LPHNPMParams pInfo,
  135. IN IHNetPortMappingProtocol * pProtocolTemp,
  136. IN WCHAR * pszwName,
  137. IN UCHAR uchIPProtocol,
  138. IN USHORT usPort );
  139. DWORD
  140. HnPMPProtoclEnumParameterCheck(
  141. IN LPHNPMParams pInfo);
  142. //Enumerate all existing Port Mapping protocols
  143. //
  144. DWORD
  145. HnPMProtocolEnum(
  146. IN OUT LPHNPMParams pInfo,
  147. IN PFNHNPMPICKPROTOCOL pfnPickProtocolCallBack
  148. );
  149. DWORD
  150. HnPMCreatePorotocolParameterCheck(
  151. IN LPHNPMParams pInfo);
  152. //Create PortMapping Protocols for PPTP, L2TP, IKE
  153. // if they are not found by HnPMPProtocolEnum()
  154. //
  155. DWORD
  156. HnPMCreateProtocol(
  157. IN OUT LPHNPMParams pInfo);
  158. //Set up a single PortMapping protocol on
  159. //a single connection
  160. //
  161. DWORD
  162. HnPMSetSinglePMForSingleConnection(
  163. IN IHNetConnection * pHNetConn,
  164. IN IHNetPortMappingProtocol * pProtocol,
  165. IN TCHAR * pszLoopbackAddr,
  166. IN BOOL fEnabled);
  167. //Clean up the ConnArray and ConnPropTable items
  168. //in the HNPMParams struct
  169. //
  170. DWORD
  171. HnPMParamsConnectionCleanUp(
  172. IN OUT LPHNPMParams pInfo);
  173. //Set up the PortMapping of PPTP, L2TP for a single
  174. //Connection
  175. //
  176. DWORD
  177. HnPMConfigureAllPMForSingleConnection(
  178. IN OUT LPHNPMParams pInfo,
  179. BOOL fEnabled);
  180. DWORD
  181. HnPMConfigureAllPMForSingleConnectionParameterCheck(
  182. IN OUT LPHNPMParams pInfo);
  183. DWORD
  184. HnPMConfigureSingleConnectionInitParameterCheck(
  185. IN LPHNPMParams pInfo );
  186. DWORD
  187. HnPMConfigureSingleConnectionInit(
  188. IN OUT LPHNPMParams pInfo);
  189. DWORD
  190. HnPMConfigureSingleConnectionCleanUp(
  191. IN OUT LPHNPMParams pInfo);
  192. //Set the PortMapping on a single connection
  193. //According to pInfo->pNetConnection
  194. //
  195. DWORD
  196. HnPMConfigureSingleConnection(
  197. IN OUT LPHNPMParams pInfo,
  198. BOOL fEnabled);
  199. //Delete the PortMapping protocols:PPTP, L2TP, IKE
  200. //
  201. DWORD
  202. HnPMDeletePortMapping();
  203. DWORD
  204. HnPMDeletePortMappingInit(
  205. IN OUT LPHNPMParams pInfo);
  206. DWORD
  207. HnPMDeletePortMappingCleanUp(
  208. IN OUT LPHNPMParams pInfo);
  209. DWORD
  210. HnPMConfigureAllConnectionsInit(
  211. IN OUT LPHNPMParams pInfo);
  212. DWORD
  213. HnPMConfigureAllConnectionsCleanUp(
  214. IN OUT LPHNPMParams pInfo);
  215. //
  216. //Set up the PortMapping of PPTP, L2TP for a
  217. //group of Connections
  218. //
  219. DWORD
  220. HnPMConfigureAllConnections(
  221. IN BOOL fEnabled );
  222. //Configure Port Mapping on a single connection
  223. //
  224. DWORD
  225. HnPMConfigureSingleConnectionGUID(
  226. IN GUID * pGuid,
  227. IN BOOL fEnabled);
  228. DWORD
  229. HnPMConfigureSingleConnectionGUIDInit(
  230. IN OUT LPHNPMParams pInfo,
  231. GUID * pGuid);
  232. DWORD
  233. HnPMConfigureSingleConnectionGUIDCleanUp(
  234. IN OUT LPHNPMParams pInfo);
  235. //Set up the port mapping for only one
  236. //connection according to its GUID only when
  237. //Incoming Connection exists and
  238. //the VPN is enabled
  239. //
  240. DWORD
  241. HnPMConfigureSingleConnectionGUIDIfVpnEnabled(
  242. GUID* pGuid,
  243. BOOL fDual,
  244. HANDLE hDatabase);
  245. //Set up the port mapping on all connections
  246. //only when Incoming Connection exists and
  247. //the VPN is enabled
  248. //
  249. DWORD
  250. HnPMConfigureIfVpnEnabled(
  251. BOOL fDual,
  252. HANDLE hDatabase);
  253. #endif