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.

470 lines
7.3 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. ipsecshr.h
  5. Abstract:
  6. Header file for IPSec Shared lib
  7. Author:
  8. BrianSw 10-19-2000
  9. Environment:
  10. User Level: Win32 / kernel
  11. Revision History:
  12. --*/
  13. #ifndef _IPSECSHR_
  14. #define _IPSECSHR_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <validate.h>
  19. #define IN_CLASSE(i) (((long)(i) != 0xffffffff) && (((long)(i) & 0xF0000000) == 0xF0000000))
  20. BOOL WINAPI IsAllZero(BYTE *c, DWORD dwSize);
  21. BOOL WINAPI CmpBlob(IPSEC_BYTE_BLOB* c1, IPSEC_BYTE_BLOB *c2);
  22. BOOL WINAPI CmpData(BYTE* c1, BYTE *c2, DWORD size);
  23. BOOL WINAPI CmpAddr(ADDR *Template, ADDR *a2);
  24. BOOL WINAPI CmpTypeStruct(BYTE *Template, BYTE *comp,
  25. DWORD dwTypeSize, DWORD dwStructSize);
  26. BOOL WINAPI CmpFilter(IPSEC_QM_FILTER *Template, IPSEC_QM_FILTER* f2);
  27. BOOL WINAPI CmpQMAlgo(PIPSEC_QM_ALGO Template, PIPSEC_QM_ALGO a2);
  28. BOOL WINAPI CmpQMOffer(PIPSEC_QM_OFFER Template, PIPSEC_QM_OFFER o2);
  29. BOOL WINAPI MatchQMSATemplate(IPSEC_QM_SA *Template,IPSEC_QM_SA *CurInfo);
  30. BOOL WINAPI MatchMMSATemplate(IPSEC_MM_SA *MMTemplate, IPSEC_MM_SA *SaData);
  31. typedef struct _INT_IPSEC_MM_AUTH_INFO {
  32. MM_AUTH_ENUM AuthMethod;
  33. DWORD dwAuthInfoSize;
  34. LPBYTE pAuthInfo;
  35. DWORD dwAuthFlags;
  36. } INT_IPSEC_MM_AUTH_INFO, * PINT_IPSEC_MM_AUTH_INFO;
  37. typedef struct _INT_MM_AUTH_METHODS {
  38. GUID gMMAuthID;
  39. DWORD dwFlags;
  40. DWORD dwNumAuthInfos;
  41. PINT_IPSEC_MM_AUTH_INFO pAuthenticationInfo;
  42. } INT_MM_AUTH_METHODS, * PINT_MM_AUTH_METHODS;
  43. DWORD
  44. ValidateAddr(
  45. PADDR pAddr
  46. );
  47. BOOL
  48. IsMulticastAddress(
  49. PADDR pAddr
  50. );
  51. BOOL
  52. IsBroadcastAddress(
  53. PADDR pAddr
  54. );
  55. BOOL
  56. IsSubnetBroadcastAddress(
  57. PADDR pAddr
  58. );
  59. BOOL
  60. IsUnicastAddress(
  61. PADDR pAddr
  62. );
  63. BOOL
  64. IsSupportedAddress(
  65. PADDR pAddr
  66. );
  67. BOOL
  68. IsLoopbackAddress(
  69. PADDR pAddr
  70. );
  71. BOOL
  72. IsValidTunnelEndpointAddress(
  73. PADDR pAddr
  74. );
  75. BOOL
  76. IsSpecialServer(
  77. PADDR pAddr
  78. );
  79. BOOL
  80. IsValidSubnet(
  81. PADDR pAddr
  82. );
  83. BOOL
  84. IsValidSubnettedAddress(
  85. PADDR pAddr
  86. );
  87. DWORD
  88. ValidateQMFilterAddresses(
  89. PIPSEC_QM_FILTER pIpsecQMFilter
  90. );
  91. DWORD
  92. ValidateMMPolicy(
  93. PIPSEC_MM_POLICY pMMPolicy
  94. );
  95. DWORD
  96. ValidateMMOffers(
  97. DWORD dwOfferCount,
  98. PIPSEC_MM_OFFER pOffers
  99. );
  100. DWORD
  101. ValidateMMAuthMethods(
  102. PMM_AUTH_METHODS pMMAuthMethods
  103. );
  104. DWORD
  105. ValidateQMPolicy(
  106. PIPSEC_QM_POLICY pQMPolicy
  107. );
  108. DWORD
  109. ValidateQMOffers(
  110. DWORD dwOfferCount,
  111. PIPSEC_QM_OFFER pOffers
  112. );
  113. DWORD
  114. ValidateMMFilter(
  115. PMM_FILTER pMMFilter
  116. );
  117. DWORD
  118. VerifyAddresses(
  119. PADDR pAddr,
  120. BOOL bAcceptMe,
  121. BOOL bIsDesAddr
  122. );
  123. DWORD
  124. VerifySubNetAddress(
  125. ULONG uSubNetAddr,
  126. ULONG uSubNetMask,
  127. BOOL bIsDesAddr
  128. );
  129. BOOL
  130. bIsValidIPMask(
  131. ULONG uMask
  132. );
  133. BOOL
  134. bIsValidIPAddress(
  135. ULONG uIpAddr,
  136. BOOL bAcceptMe,
  137. BOOL bIsDesAddr
  138. );
  139. BOOL
  140. bIsValidSubnet(
  141. ULONG uIpAddr,
  142. ULONG uMask,
  143. BOOL bIsDesAddr
  144. );
  145. BOOL
  146. AddressesConflict(
  147. ADDR SrcAddr,
  148. ADDR DesAddr
  149. );
  150. BOOL
  151. HtoNAddressesConflict(
  152. ADDR SrcAddr,
  153. ADDR DesAddr
  154. );
  155. DWORD
  156. ValidateTransportFilter(
  157. PTRANSPORT_FILTER pTransportFilter
  158. );
  159. DWORD
  160. ValidateIPSecQMFilter(
  161. PIPSEC_QM_FILTER pQMFilter
  162. );
  163. DWORD
  164. VerifyProtocols(
  165. PROTOCOL Protocol
  166. );
  167. DWORD
  168. VerifyPortsForProtocol(
  169. PORT Port,
  170. PROTOCOL Protocol
  171. );
  172. DWORD
  173. ValidateMMFilterTemplate(
  174. PMM_FILTER pMMFilter
  175. );
  176. DWORD
  177. ValidateTxFilterTemplate(
  178. PTRANSPORT_FILTER pTxFilter
  179. );
  180. DWORD
  181. ValidateTunnelFilter(
  182. PTUNNEL_FILTER pTunnelFilter
  183. );
  184. DWORD
  185. ValidateTnFilterTemplate(
  186. PTUNNEL_FILTER pTnFilter
  187. );
  188. DWORD
  189. ApplyMulticastFilterValidation(
  190. ADDR Addr,
  191. BOOL bCreateMirror
  192. );
  193. BOOLEAN
  194. IsSpecialServ(
  195. ADDR_TYPE AddrType
  196. );
  197. ADDR_TYPE
  198. ExTypeToAddrType(
  199. UCHAR ExType
  200. );
  201. DWORD
  202. WINAPI
  203. ConvertExtMMAuthToInt(
  204. PMM_AUTH_METHODS pMMAuthMethods,
  205. PINT_MM_AUTH_METHODS * pIntMMAuthMethods
  206. );
  207. DWORD
  208. WINAPI
  209. FreeIntMMAuthMethods(
  210. PINT_MM_AUTH_METHODS pIntMMAuthMethods
  211. );
  212. DWORD
  213. WINAPI
  214. SPDFreeIntMMAuthMethods(
  215. PINT_MM_AUTH_METHODS pIntMMAuthMethods,
  216. BOOLEAN FreeTop
  217. );
  218. DWORD
  219. WINAPI
  220. SPDFreeIntMMAuthMethodsArray(
  221. PINT_MM_AUTH_METHODS pIntMMAuthMethods,
  222. DWORD dwNumAuthMeths
  223. );
  224. DWORD
  225. WINAPI
  226. ConvertIntMMAuthToExt(
  227. PINT_MM_AUTH_METHODS pIntMMAuthMethods,
  228. PMM_AUTH_METHODS * pMMAuthMethods
  229. );
  230. DWORD
  231. WINAPI
  232. SPDConvertArrayIntMMAuthToExt(
  233. PINT_MM_AUTH_METHODS pIntMMAuthMethods,
  234. PMM_AUTH_METHODS *ppMMAuthMethods,
  235. DWORD dwNumAuthMeths
  236. );
  237. DWORD
  238. WINAPI
  239. FreeExtMMAuthMethods(
  240. PMM_AUTH_METHODS pMMAuthMethods
  241. );
  242. DWORD
  243. WINAPI
  244. SPDFreeExtMMAuthMethods(
  245. PMM_AUTH_METHODS pMMAuthMethods
  246. );
  247. DWORD
  248. WINAPI
  249. SPDConvertIntMMAuthToExt(
  250. PINT_MM_AUTH_METHODS pIntMMAuthMethods,
  251. PMM_AUTH_METHODS * pMMAuthMethods
  252. );
  253. #ifdef __IPSEC_VALIDATE
  254. DWORD
  255. ValidateInitiateIKENegotiation(
  256. STRING_HANDLE pServerName,
  257. PQM_FILTER_CONTAINER pQMFilterContainer,
  258. DWORD dwClientProcessId,
  259. ULONG uhClientEvent,
  260. DWORD dwFlags,
  261. IPSEC_UDP_ENCAP_CONTEXT UdpEncapContext,
  262. IKENEGOTIATION_HANDLE * phIKENegotiation
  263. );
  264. DWORD
  265. ValidateQueryIKENegotiationStatus(
  266. IKENEGOTIATION_HANDLE hIKENegotiation,
  267. SA_NEGOTIATION_STATUS_INFO *NegotiationStatus
  268. );
  269. DWORD
  270. ValidateCloseIKENegotiationHandle(
  271. IKENEGOTIATION_HANDLE * phIKENegotiation
  272. );
  273. DWORD
  274. ValidateEnumMMSAs(
  275. STRING_HANDLE pServerName,
  276. PMM_SA_CONTAINER pMMTemplate,
  277. PMM_SA_CONTAINER *ppMMSAContainer,
  278. LPDWORD pdwNumEntries,
  279. LPDWORD pdwTotalMMsAvailable,
  280. LPDWORD pdwEnumHandle,
  281. DWORD dwFlags
  282. );
  283. DWORD
  284. ValidateDeleteMMSAs(
  285. STRING_HANDLE pServerName,
  286. PMM_SA_CONTAINER pMMTemplate,
  287. DWORD dwFlags
  288. );
  289. DWORD
  290. ValidateQueryIKEStatistics(
  291. STRING_HANDLE pServerName,
  292. IKE_STATISTICS *pIKEStatistics
  293. );
  294. DWORD
  295. ValidateRegisterIKENotifyClient(
  296. STRING_HANDLE pServerName,
  297. DWORD dwClientProcessId,
  298. ULONG uhClientEvent,
  299. PQM_SA_CONTAINER pQMSATemplateContainer,
  300. IKENOTIFY_HANDLE *phNotifyHandle,
  301. DWORD dwFlags
  302. );
  303. DWORD ValidateQueryNotifyData(
  304. IKENOTIFY_HANDLE uhNotifyHandle,
  305. PDWORD pdwNumEntries,
  306. PQM_SA_CONTAINER *ppQMSAContainer,
  307. DWORD dwFlags
  308. );
  309. DWORD ValidateCloseNotifyHandle(
  310. IKENOTIFY_HANDLE *phHandle
  311. );
  312. DWORD ValidateIPSecAddSA(
  313. STRING_HANDLE pServerName,
  314. IPSEC_SA_DIRECTION SADirection,
  315. PIPSEC_QM_POLICY_CONTAINER pQMPolicyContainer,
  316. PQM_FILTER_CONTAINER pQMFilterContainer,
  317. DWORD *puhLarvalContext,
  318. DWORD dwInboundKeyMatLen,
  319. BYTE *pInboundKeyMat,
  320. DWORD dwOutboundKeyMatLen,
  321. BYTE *pOutboundKeyMat,
  322. BYTE *pContextInfo,
  323. UDP_ENCAP_INFO EncapInfo,
  324. DWORD dwFlags);
  325. DWORD ValidateSetConfigurationVariables(
  326. LPWSTR pServerName,
  327. IKE_CONFIG IKEConfig
  328. );
  329. DWORD ValidateGetConfigurationVariables(
  330. LPWSTR pServerName,
  331. PIKE_CONFIG pIKEConfig
  332. );
  333. #endif //__IPSEC_VALIDATE
  334. #ifdef __cplusplus
  335. }
  336. #endif
  337. #endif // _WINIPSEC_