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.

1788 lines
37 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. winipsec.h
  5. Abstract:
  6. Header file for IPSec WINAPIs.
  7. Author:
  8. krishnaG 21-September-1999
  9. abhisheV 21-September-1999 Added all the structures.
  10. Environment:
  11. User Level: Win32
  12. Revision History:
  13. --*/
  14. #ifndef _WINIPSEC_
  15. #define _WINIPSEC_
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #ifdef __midl
  20. #define MIDL_DEFINE_INT(_C, _V) const unsigned short int _C = _V
  21. #else
  22. #define MIDL_DEFINE_INT(_C, _V)
  23. #endif
  24. #define PERSIST_SPD_OBJECT (ULONG) 0x00000001
  25. #define IPSEC_STORE_PERSISTENT 0x1
  26. #define IPSEC_STORE_LOCAL 0x2
  27. // Flags sent to ike during shutdown
  28. //
  29. // Service is being shutdown, but not machine
  30. #define SPD_SHUTDOWN_SERVICE 0X1
  31. // Service is being shutdown as well as machine
  32. #define SPD_SHUTDOWN_MACHINE 0X2
  33. // Flag for AddMMFilter, to open if duplicate filter found.
  34. //
  35. #define OPEN_IF_EXISTS (ULONG) 0x00000002
  36. //
  37. // Flags that specify where policy is from.
  38. #define IPSEC_STORE_PERSISTENT 0x1
  39. #define IPSEC_STORE_LOCAL 0x2
  40. // Address specification special values
  41. #define IP_ADDRESS_ME (ULONG) 0x00000000
  42. #define IP_ADDRESS_MASK_NONE (ULONG) 0xFFFFFFFF
  43. #define SUBNET_ADDRESS_ANY (ULONG) 0x00000000
  44. #define SUBNET_MASK_ANY (ULONG) 0x00000000
  45. #define FILTER_NATURE_PASS_THRU 0x00000001
  46. #define FILTER_NATURE_BLOCKING 0x00000002
  47. #define FILTER_DIRECTION_INBOUND 0x00000004
  48. #define FILTER_DIRECTION_OUTBOUND 0x00000008
  49. #define ENUM_GENERIC_FILTERS 0x00000001
  50. #define ENUM_SELECT_SPECIFIC_FILTERS 0x00000002
  51. #define ENUM_SPECIFIC_FILTERS 0x00000004
  52. //
  53. // Policy flags.
  54. //
  55. #define IPSEC_MM_POLICY_ENABLE_DIAGNOSTICS 0x00000001
  56. #define IPSEC_MM_POLICY_DEFAULT_POLICY 0x00000002
  57. #define IPSEC_MM_POLICY_ON_NO_MATCH 0x00000004
  58. #define IPSEC_MM_POLICY_DISABLE_CRL 0x00000008
  59. #define IPSEC_MM_POLICY_DISABLE_NEGOTIATE 0x00000010
  60. #define IPSEC_MM_POLICY_ENABLE_CERT_MAPPING 0x00000020
  61. #define IPSEC_MM_POLICY_STORE_CERT_CHAINS 0x00000040
  62. #define IPSEC_QM_POLICY_TRANSPORT_MODE 0x00000000
  63. #define IPSEC_QM_POLICY_TUNNEL_MODE 0x00000001
  64. #define IPSEC_QM_POLICY_DEFAULT_POLICY 0x00000002
  65. #define IPSEC_QM_POLICY_ALLOW_SOFT 0x00000004
  66. #define IPSEC_QM_POLICY_ON_NO_MATCH 0x00000008
  67. #define IPSEC_QM_POLICY_DISABLE_NEGOTIATE 0x00000010
  68. #define IPSEC_QM_POLICY_DISALLOW_NAT 0x00000020
  69. #define IPSEC_MM_AUTH_DEFAULT_AUTH 0x00000001
  70. #define IPSEC_MM_AUTH_ON_NO_MATCH 0x00000002
  71. #define IPSEC_MM_CERT_AUTH_ENABLE_ACCOUNT_MAP 0x00000001
  72. #define IPSEC_MM_CERT_AUTH_DISABLE_CERT_REQUEST 0x00000002
  73. //
  74. // MatchXXX
  75. //
  76. #define RETURN_DEFAULTS_ON_NO_MATCH 0x00000001
  77. #define RETURN_NON_AH_OFFERS 0x00000002
  78. //
  79. // Delete MM SA flags.
  80. //
  81. #define IPSEC_MM_DELETE_ASSOCIATED_QMS 0x00000001
  82. #define IPSEC_SA_TUNNEL 0x00000001
  83. #define IPSEC_SA_MULTICAST_MIRROR 0x00000002
  84. #define IPSEC_SA_DISABLE_IDLE_OUT 0x00000004
  85. #define IPSEC_SA_DISABLE_ANTI_REPLAY_CHECK 0x00000008
  86. #define IPSEC_SA_DISABLE_LIFETIME_CHECK 0x00000010
  87. #define IPSEC_SA_ENABLE_NLBS_IDLE_CHECK 0x00000020
  88. typedef enum _IPSEC_SA_DIRECTION {
  89. SA_DIRECTION_BOTH = 1,
  90. SA_DIRECTION_INBOUND,
  91. SA_DIRECTION_OUTBOUND,
  92. SA_DIRECTION_MAX
  93. } IPSEC_SA_DIRECTION, *PIPSEC_SA_DIRECTION;
  94. typedef enum _IPSEC_SA_UDP_ENCAP_TYPE {
  95. SA_UDP_ENCAP_TYPE_NONE = 1,
  96. SA_UDP_ENCAP_TYPE_IKE,
  97. SA_UDP_ENCAP_TYPE_OTHER,
  98. SA_UDP_ENCAP_TYPE_MAX
  99. } IPSEC_SA_UDP_ENCAP_TYPE, *PIPSEC_SA_UDP_ENCAP_TYPE;
  100. //
  101. // Bounds for number of offers.
  102. //
  103. #define IPSEC_MAX_MM_OFFERS 20
  104. #define IPSEC_MAX_QM_OFFERS 50
  105. typedef enum _IP_PROTOCOL_VERSION {
  106. IPSEC_PROTOCOL_V4 = 0,
  107. IPSEC_PROTOCOL_V6,
  108. } IP_PROTOCOL_VERSION, * PIP_PROTOCOL_VERSION;
  109. typedef enum _ADDR_TYPE {
  110. IP_ADDR_UNIQUE = 1,
  111. IP_ADDR_SUBNET,
  112. IP_ADDR_INTERFACE,
  113. IP_ADDR_DNS_SERVER,
  114. IP_ADDR_WINS_SERVER,
  115. IP_ADDR_DHCP_SERVER,
  116. IP_ADDR_DEFAULT_GATEWAY
  117. } ADDR_TYPE, * PADDR_TYPE;
  118. typedef struct _ADDR {
  119. ADDR_TYPE AddrType;
  120. #ifdef __midl
  121. UCHAR ucIpAddr[4];
  122. UCHAR ucSubNetMask[4];
  123. #else
  124. ULONG uIpAddr;
  125. ULONG uSubNetMask;
  126. #endif
  127. GUID * pgInterfaceID;
  128. } ADDR, * PADDR, IPV4ADDR, * PIPV4ADDR;
  129. typedef struct _IPV6ADDR {
  130. ADDR_TYPE AddrType;
  131. UCHAR ucIpAddr[16];
  132. UCHAR ucSubNetMask;
  133. GUID * pgInterfaceID;
  134. } IPV6ADDR, * PIPV6ADDR;
  135. typedef enum _PROTOCOL_TYPE {
  136. PROTOCOL_UNIQUE = 1,
  137. } PROTOCOL_TYPE, * PPROTOCOL_TYPE;
  138. typedef struct _PROTOCOL {
  139. PROTOCOL_TYPE ProtocolType;
  140. DWORD dwProtocol;
  141. } PROTOCOL, * PPROTOCOL;
  142. typedef enum _PORT_TYPE {
  143. PORT_UNIQUE = 1,
  144. } PORT_TYPE, * PPORT_TYPE;
  145. typedef struct _PORT {
  146. PORT_TYPE PortType;
  147. WORD wPort;
  148. } PORT, * PPORT;
  149. typedef enum _IF_TYPE {
  150. INTERFACE_TYPE_ALL = 1,
  151. INTERFACE_TYPE_LAN,
  152. INTERFACE_TYPE_DIALUP,
  153. INTERFACE_TYPE_MAX
  154. } IF_TYPE, * PIF_TYPE;
  155. typedef enum _FILTER_ACTION {
  156. PASS_THRU = 1,
  157. BLOCKING,
  158. NEGOTIATE_SECURITY,
  159. FILTER_ACTION_MAX
  160. } FILTER_ACTION, * PFILTER_ACTION;
  161. typedef struct _TRANSPORT_FILTER {
  162. IP_PROTOCOL_VERSION IpVersion;
  163. GUID gFilterID;
  164. LPWSTR pszFilterName;
  165. IF_TYPE InterfaceType;
  166. BOOL bCreateMirror;
  167. DWORD dwFlags;
  168. #ifdef __midl
  169. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  170. [case(IPSEC_PROTOCOL_V4)] ADDR SrcAddr;
  171. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR SrcV6Addr;
  172. [default] ;
  173. };
  174. #else
  175. union {
  176. ADDR SrcAddr;
  177. IPV6ADDR SrcV6Addr;
  178. };
  179. #endif
  180. #ifdef __midl
  181. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  182. [case(IPSEC_PROTOCOL_V4)] ADDR DesAddr;
  183. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR DesV6Addr;
  184. [default] ;
  185. };
  186. #else
  187. union {
  188. ADDR DesAddr;
  189. IPV6ADDR DesV6Addr;
  190. };
  191. #endif
  192. PROTOCOL Protocol;
  193. PORT SrcPort;
  194. PORT DesPort;
  195. FILTER_ACTION InboundFilterAction;
  196. FILTER_ACTION OutboundFilterAction;
  197. DWORD dwDirection;
  198. DWORD dwWeight;
  199. GUID gPolicyID;
  200. } TRANSPORT_FILTER, * PTRANSPORT_FILTER;
  201. //
  202. // Maximum number of transport filters that can be enumerated
  203. // by SPD at a time.
  204. //
  205. #define MAX_TRANSPORTFILTER_ENUM_COUNT 1000
  206. MIDL_DEFINE_INT(MIDL_MAX_TRANSPORTFILTER_COUNT, MAX_TRANSPORTFILTER_ENUM_COUNT);
  207. typedef struct _TUNNEL_FILTER {
  208. IP_PROTOCOL_VERSION IpVersion;
  209. GUID gFilterID;
  210. LPWSTR pszFilterName;
  211. IF_TYPE InterfaceType;
  212. BOOL bCreateMirror;
  213. DWORD dwFlags;
  214. #ifdef __midl
  215. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  216. [case(IPSEC_PROTOCOL_V4)] ADDR SrcAddr;
  217. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR SrcV6Addr;
  218. [default] ;
  219. };
  220. #else
  221. union {
  222. ADDR SrcAddr;
  223. IPV6ADDR SrcV6Addr;
  224. };
  225. #endif
  226. #ifdef __midl
  227. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  228. [case(IPSEC_PROTOCOL_V4)] ADDR DesAddr;
  229. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR DesV6Addr;
  230. [default] ;
  231. };
  232. #else
  233. union {
  234. ADDR DesAddr;
  235. IPV6ADDR DesV6Addr;
  236. };
  237. #endif
  238. PROTOCOL Protocol;
  239. PORT SrcPort;
  240. PORT DesPort;
  241. #ifdef __midl
  242. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  243. [case(IPSEC_PROTOCOL_V4)] ADDR SrcTunnelAddr;
  244. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR SrcV6TunnelAddr;
  245. [default] ;
  246. };
  247. #else
  248. union {
  249. ADDR SrcTunnelAddr;
  250. IPV6ADDR SrcV6TunnelAddr;
  251. };
  252. #endif
  253. #ifdef __midl
  254. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  255. [case(IPSEC_PROTOCOL_V4)] ADDR DesTunnelAddr;
  256. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR DesV6TunnelAddr;
  257. [default] ;
  258. };
  259. #else
  260. union {
  261. ADDR DesTunnelAddr;
  262. IPV6ADDR DesV6TunnelAddr;
  263. };
  264. #endif
  265. FILTER_ACTION InboundFilterAction;
  266. FILTER_ACTION OutboundFilterAction;
  267. DWORD dwDirection;
  268. DWORD dwWeight;
  269. GUID gPolicyID;
  270. } TUNNEL_FILTER, * PTUNNEL_FILTER;
  271. //
  272. // Maximum number of tunnel filters that can be enumerated
  273. // by SPD at a time.
  274. //
  275. #define MAX_TUNNELFILTER_ENUM_COUNT 1000
  276. MIDL_DEFINE_INT(MIDL_MAX_TUNNELFILTER_COUNT, MAX_TUNNELFILTER_ENUM_COUNT);
  277. typedef struct _MM_FILTER {
  278. IP_PROTOCOL_VERSION IpVersion;
  279. GUID gFilterID;
  280. LPWSTR pszFilterName;
  281. IF_TYPE InterfaceType;
  282. BOOL bCreateMirror;
  283. DWORD dwFlags;
  284. #ifdef __midl
  285. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  286. [case(IPSEC_PROTOCOL_V4)] ADDR SrcAddr;
  287. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR SrcV6Addr;
  288. [default] ;
  289. };
  290. #else
  291. union {
  292. ADDR SrcAddr;
  293. IPV6ADDR SrcV6Addr;
  294. };
  295. #endif
  296. #ifdef __midl
  297. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  298. [case(IPSEC_PROTOCOL_V4)] ADDR DesAddr;
  299. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR DesV6Addr;
  300. [default] ;
  301. };
  302. #else
  303. union {
  304. ADDR DesAddr;
  305. IPV6ADDR DesV6Addr;
  306. };
  307. #endif
  308. DWORD dwDirection;
  309. DWORD dwWeight;
  310. GUID gMMAuthID;
  311. GUID gPolicyID;
  312. } MM_FILTER, * PMM_FILTER;
  313. //
  314. // Maximum number of main mode filters that can be enumerated
  315. // by SPD at a time.
  316. //
  317. #define MAX_MMFILTER_ENUM_COUNT 1000
  318. MIDL_DEFINE_INT(MIDL_MAX_MMFILTER_COUNT, MAX_MMFILTER_ENUM_COUNT);
  319. //
  320. // Common Structures for Main Mode and Quick Mode Policies.
  321. //
  322. //
  323. // IPSEC confidentiality algorithms supported by SPD.
  324. //
  325. typedef enum _CONF_ALGO_ENUM {
  326. CONF_ALGO_NONE = 0,
  327. CONF_ALGO_DES,
  328. CONF_ALGO_3_DES = 3,
  329. CONF_ALGO_MAX
  330. } CONF_ALGO_ENUM, * PCONF_ALGO_ENUM;
  331. //
  332. // IPSEC integrity algorithms supported by SPD.
  333. //
  334. typedef enum _AUTH_ALGO_ENUM {
  335. AUTH_ALGO_NONE = 0,
  336. AUTH_ALGO_MD5,
  337. AUTH_ALGO_SHA1,
  338. AUTH_ALGO_MAX
  339. } AUTH_ALGO_ENUM, * PAUTH_ALGO_ENUM;
  340. //
  341. // Types of IPSEC Operations supported by SPD.
  342. //
  343. typedef enum _IPSEC_OPERATION {
  344. NONE = 0,
  345. AUTHENTICATION,
  346. ENCRYPTION,
  347. COMPRESSION,
  348. SA_DELETE
  349. } IPSEC_OPERATION, * PIPSEC_OPERATION;
  350. //
  351. // HMAC authentication algorithms to use with IPSEC
  352. // Encryption operation.
  353. //
  354. typedef enum _HMAC_AUTH_ALGO_ENUM {
  355. HMAC_AUTH_ALGO_NONE = 0,
  356. HMAC_AUTH_ALGO_MD5,
  357. HMAC_AUTH_ALGO_SHA1,
  358. HMAC_AUTH_ALGO_MAX
  359. } HMAC_AUTH_ALGO_ENUM, * PHMAC_AUTH_ALGO_ENUM;
  360. //
  361. // Key Lifetime structure.
  362. //
  363. typedef struct _KEY_LIFETIME {
  364. ULONG uKeyExpirationTime;
  365. ULONG uKeyExpirationKBytes;
  366. } KEY_LIFETIME, * PKEY_LIFETIME;
  367. //
  368. // Main mode policy structures.
  369. //
  370. //
  371. // Main mode authentication algorithms supported by SPD.
  372. //
  373. typedef enum _MM_AUTH_ENUM {
  374. IKE_PRESHARED_KEY = 1,
  375. IKE_DSS_SIGNATURE,
  376. IKE_RSA_SIGNATURE,
  377. IKE_RSA_ENCRYPTION,
  378. IKE_SSPI
  379. } MM_AUTH_ENUM, * PMM_AUTH_ENUM;
  380. //
  381. // Main mode authentication information structure.
  382. //
  383. typedef struct _CERT_ROOT_CONFIG {
  384. DWORD dwCertDataSize;
  385. #ifdef __midl
  386. [size_is(dwCertDataSize)] LPBYTE pCertData;
  387. #else
  388. LPBYTE pCertData;
  389. #endif
  390. DWORD dwAuthorizationDataSize;
  391. #ifdef __midl
  392. [size_is(dwAuthorizationDataSize)] LPBYTE pAuthorizationData;
  393. #else
  394. LPBYTE pAuthorizationData;
  395. #endif
  396. DWORD dwFlags;
  397. } CERT_ROOT_CONFIG, * PCERT_ROOT_CONFIG;
  398. typedef struct __MM_CERT_INFO {
  399. DWORD dwVersion;
  400. DWORD dwMyCertHashSize;
  401. #ifdef __midl
  402. [size_is(dwMyCertHashSize)] LPBYTE pMyCertHash;
  403. #else
  404. LPBYTE pMyCertHash;
  405. #endif
  406. DWORD dwInboundRootArraySize;
  407. #ifdef __midl
  408. [size_is(dwInboundRootArraySize)] PCERT_ROOT_CONFIG pInboundRootArray;
  409. #else
  410. PCERT_ROOT_CONFIG pInboundRootArray;
  411. #endif
  412. DWORD dwOutboundRootArraySize;
  413. #ifdef __midl
  414. [size_is(dwOutboundRootArraySize)] PCERT_ROOT_CONFIG pOutboundRootArray;
  415. #else
  416. PCERT_ROOT_CONFIG pOutboundRootArray;
  417. #endif
  418. } MM_CERT_INFO, * PMM_CERT_INFO;
  419. typedef struct __MM_GENERAL_AUTH_INFO {
  420. DWORD dwAuthInfoSize;
  421. #ifdef __midl
  422. [size_is(dwAuthInfoSize)] LPBYTE pAuthInfo;
  423. #else
  424. LPBYTE pAuthInfo;
  425. #endif
  426. } MM_GENERAL_AUTH_INFO, * PMM_GENERAL_AUTH_INFO;
  427. typedef struct _IPSEC_MM_AUTH_INFO {
  428. MM_AUTH_ENUM AuthMethod;
  429. #ifdef __midl
  430. [switch_type(MM_AUTH_ENUM), switch_is(AuthMethod)] union {
  431. [case(IKE_PRESHARED_KEY,
  432. IKE_DSS_SIGNATURE,
  433. IKE_RSA_ENCRYPTION,
  434. IKE_SSPI)] MM_GENERAL_AUTH_INFO GeneralAuthInfo;
  435. [case(IKE_RSA_SIGNATURE)] MM_CERT_INFO CertAuthInfo;
  436. [default] ;
  437. };
  438. #else
  439. union {
  440. MM_GENERAL_AUTH_INFO GeneralAuthInfo;
  441. MM_CERT_INFO CertAuthInfo;
  442. };
  443. #endif
  444. } IPSEC_MM_AUTH_INFO, * PIPSEC_MM_AUTH_INFO;
  445. //
  446. // Main mode authentication methods.
  447. //
  448. typedef struct _MM_AUTH_METHODS {
  449. GUID gMMAuthID;
  450. DWORD dwFlags;
  451. DWORD dwNumAuthInfos;
  452. #ifdef __midl
  453. [size_is(dwNumAuthInfos)] PIPSEC_MM_AUTH_INFO pAuthenticationInfo;
  454. #else
  455. PIPSEC_MM_AUTH_INFO pAuthenticationInfo;
  456. #endif
  457. } MM_AUTH_METHODS, * PMM_AUTH_METHODS;
  458. //
  459. // Maximum number of main mode auth methods that can be enumerated
  460. // by SPD at a time.
  461. //
  462. #define MAX_MMAUTH_ENUM_COUNT 1000
  463. MIDL_DEFINE_INT(MIDL_MAX_MMAUTH_COUNT, MAX_MMAUTH_ENUM_COUNT);
  464. //
  465. // Main mode algorithm structure.
  466. //
  467. typedef struct _IPSEC_MM_ALGO {
  468. ULONG uAlgoIdentifier;
  469. ULONG uAlgoKeyLen;
  470. ULONG uAlgoRounds;
  471. } IPSEC_MM_ALGO, * PIPSEC_MM_ALGO;
  472. //
  473. // Main mode policy offer structure.
  474. //
  475. typedef struct _IPSEC_MM_OFFER {
  476. KEY_LIFETIME Lifetime;
  477. DWORD dwFlags;
  478. DWORD dwQuickModeLimit;
  479. DWORD dwDHGroup;
  480. IPSEC_MM_ALGO EncryptionAlgorithm;
  481. IPSEC_MM_ALGO HashingAlgorithm;
  482. } IPSEC_MM_OFFER, * PIPSEC_MM_OFFER;
  483. //
  484. // Defines for DH groups.
  485. //
  486. #define DH_GROUP_1 0x00000001 // For Diffe Hellman group 1.
  487. #define DH_GROUP_2 0x00000002 // For Diffe Hellman group 2.
  488. #define DH_GROUP_2048 0x10000001
  489. //
  490. // Default Main Mode key expiration time.
  491. //
  492. #define DEFAULT_MM_KEY_EXPIRATION_TIME 480*60 // 8 hours expressed in seconds.
  493. //
  494. // Maximum number of main mode policies that can be enumerated
  495. // by SPD at a time.
  496. //
  497. #define MAX_MMPOLICY_ENUM_COUNT 10
  498. MIDL_DEFINE_INT(MIDL_MAX_MMPOLICY_COUNT, MAX_MMPOLICY_ENUM_COUNT);
  499. //
  500. // Main mode policy structure.
  501. //
  502. typedef struct _IPSEC_MM_POLICY {
  503. GUID gPolicyID;
  504. LPWSTR pszPolicyName;
  505. DWORD dwFlags;
  506. ULONG uSoftExpirationTime;
  507. DWORD dwOfferCount;
  508. #ifdef __midl
  509. [size_is(dwOfferCount)] PIPSEC_MM_OFFER pOffers;
  510. #else
  511. PIPSEC_MM_OFFER pOffers;
  512. #endif
  513. } IPSEC_MM_POLICY, * PIPSEC_MM_POLICY;
  514. //
  515. // Quick mode policy structures.
  516. //
  517. typedef DWORD IPSEC_QM_SPI, * PIPSEC_QM_SPI;
  518. //
  519. // Quick mode algorithm structure.
  520. //
  521. typedef struct _IPSEC_QM_ALGO {
  522. IPSEC_OPERATION Operation;
  523. ULONG uAlgoIdentifier;
  524. HMAC_AUTH_ALGO_ENUM uSecAlgoIdentifier;
  525. ULONG uAlgoKeyLen;
  526. ULONG uSecAlgoKeyLen;
  527. ULONG uAlgoRounds;
  528. ULONG uSecAlgoRounds;
  529. IPSEC_QM_SPI MySpi;
  530. IPSEC_QM_SPI PeerSpi;
  531. } IPSEC_QM_ALGO, * PIPSEC_QM_ALGO;
  532. //
  533. // Maximum number of quick mode algorithms in
  534. // a quick mode policy offer.
  535. //
  536. #define QM_MAX_ALGOS 2
  537. //
  538. // Quick mode policy offer structure.
  539. //
  540. typedef struct _IPSEC_QM_OFFER {
  541. KEY_LIFETIME Lifetime;
  542. DWORD dwFlags;
  543. BOOL bPFSRequired;
  544. DWORD dwPFSGroup;
  545. DWORD dwNumAlgos;
  546. IPSEC_QM_ALGO Algos[QM_MAX_ALGOS];
  547. DWORD dwReserved;
  548. } IPSEC_QM_OFFER, * PIPSEC_QM_OFFER;
  549. //
  550. // Defines for PFS groups.
  551. //
  552. #define PFS_GROUP_NONE 0x00000000 // If PFS is not required.
  553. #define PFS_GROUP_1 DH_GROUP_1 // For Diffe Hellman group 1 PFS.
  554. #define PFS_GROUP_2 DH_GROUP_2 // For Diffe Hellman group 2 PFS.
  555. #define PFS_GROUP_2048 DH_GROUP_2048
  556. #define PFS_GROUP_MM 0x80000000 // Use group negotiated in MM
  557. //
  558. // Default Quick Mode key expiration time.
  559. //
  560. #define DEFAULT_QM_KEY_EXPIRATION_TIME 60*60 // 1 hour expressed in seconds.
  561. //
  562. // Default Quick Mode key expiration kbytes.
  563. //
  564. #define DEFAULT_QM_KEY_EXPIRATION_KBYTES 100*1000 // 100 MB expressed in KB.
  565. //
  566. // Maximum number of quick mode policies that can be enumerated
  567. // by SPD at a time.
  568. //
  569. #define MAX_QMPOLICY_ENUM_COUNT 100
  570. MIDL_DEFINE_INT(MIDL_MAX_QMPOLICY_COUNT, MAX_QMPOLICY_ENUM_COUNT);
  571. //
  572. // Quick mode policy structure.
  573. //
  574. typedef struct _IPSEC_QM_POLICY {
  575. GUID gPolicyID;
  576. LPWSTR pszPolicyName;
  577. DWORD dwFlags;
  578. DWORD dwReserved;
  579. DWORD dwOfferCount;
  580. #ifdef __midl
  581. [size_is(dwOfferCount)] PIPSEC_QM_OFFER pOffers;
  582. #else
  583. PIPSEC_QM_OFFER pOffers;
  584. #endif
  585. } IPSEC_QM_POLICY, * PIPSEC_QM_POLICY;
  586. //
  587. // IKE structures.
  588. //
  589. typedef struct _IKE_STATISTICS {
  590. DWORD dwActiveAcquire;
  591. DWORD dwActiveReceive;
  592. DWORD dwAcquireFail;
  593. DWORD dwReceiveFail;
  594. DWORD dwSendFail;
  595. DWORD dwAcquireHeapSize;
  596. DWORD dwReceiveHeapSize;
  597. DWORD dwNegotiationFailures;
  598. DWORD dwAuthenticationFailures;
  599. DWORD dwInvalidCookiesReceived;
  600. DWORD dwTotalAcquire;
  601. DWORD dwTotalGetSpi;
  602. DWORD dwTotalKeyAdd;
  603. DWORD dwTotalKeyUpdate;
  604. DWORD dwGetSpiFail;
  605. DWORD dwKeyAddFail;
  606. DWORD dwKeyUpdateFail;
  607. DWORD dwIsadbListSize;
  608. DWORD dwConnListSize;
  609. DWORD dwOakleyMainModes;
  610. DWORD dwOakleyQuickModes;
  611. DWORD dwSoftAssociations;
  612. DWORD dwInvalidPacketsReceived;
  613. } IKE_STATISTICS, * PIKE_STATISTICS;
  614. typedef LARGE_INTEGER IKE_COOKIE, * PIKE_COOKIE;
  615. typedef struct _IKE_COOKIE_PAIR {
  616. IKE_COOKIE Initiator;
  617. IKE_COOKIE Responder;
  618. } IKE_COOKIE_PAIR, * PIKE_COOKIE_PAIR;
  619. typedef struct _IPSEC_BYTE_BLOB {
  620. DWORD dwSize;
  621. #ifdef __midl
  622. [size_is(dwSize)] LPBYTE pBlob;
  623. #else
  624. LPBYTE pBlob;
  625. #endif
  626. } IPSEC_BYTE_BLOB, * PIPSEC_BYTE_BLOB;
  627. typedef struct _IPSEC_UDP_ENCAP_CONTEXT {
  628. WORD wSrcEncapPort;
  629. WORD wDesEncapPort;
  630. } IPSEC_UDP_ENCAP_CONTEXT, * PIPSEC_UDP_ENCAP_CONTEXT;
  631. //
  632. // Maximum number of main mode SAs that can be enumerated
  633. // by SPD at a time.
  634. //
  635. #define MAX_MMSA_ENUM_COUNT 1000
  636. MIDL_DEFINE_INT(MIDL_MAX_MMSA_COUNT, MAX_MMSA_ENUM_COUNT);
  637. typedef struct _IPSEC_MM_SA {
  638. IP_PROTOCOL_VERSION IpVersion;
  639. GUID gMMPolicyID;
  640. IPSEC_MM_OFFER SelectedMMOffer;
  641. MM_AUTH_ENUM MMAuthEnum;
  642. IKE_COOKIE_PAIR MMSpi;
  643. #ifdef __midl
  644. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  645. [case(IPSEC_PROTOCOL_V4)] ADDR Me;
  646. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR MyV6Addr;
  647. [default] ;
  648. };
  649. #else
  650. union {
  651. ADDR Me;
  652. IPV6ADDR MyV6Addr;
  653. };
  654. #endif
  655. IPSEC_BYTE_BLOB MyId;
  656. IPSEC_BYTE_BLOB MyCertificateChain;
  657. #ifdef __midl
  658. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  659. [case(IPSEC_PROTOCOL_V4)] ADDR Peer;
  660. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR PeerV6Addr;
  661. [default] ;
  662. };
  663. #else
  664. union {
  665. ADDR Peer;
  666. IPV6ADDR PeerV6Addr;
  667. };
  668. #endif
  669. IPSEC_BYTE_BLOB PeerId;
  670. IPSEC_BYTE_BLOB PeerCertificateChain;
  671. IPSEC_UDP_ENCAP_CONTEXT UdpEncapContext;
  672. DWORD dwFlags;
  673. } IPSEC_MM_SA, * PIPSEC_MM_SA;
  674. typedef enum _QM_FILTER_TYPE {
  675. QM_TRANSPORT_FILTER = 1,
  676. QM_TUNNEL_FILTER
  677. } QM_FILTER_TYPE, * PQM_FILTER_TYPE;
  678. typedef struct _IPSEC_QM_FILTER {
  679. IP_PROTOCOL_VERSION IpVersion;
  680. QM_FILTER_TYPE QMFilterType;
  681. #ifdef __midl
  682. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  683. [case(IPSEC_PROTOCOL_V4)] ADDR SrcAddr;
  684. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR SrcV6Addr;
  685. [default] ;
  686. };
  687. #else
  688. union {
  689. ADDR SrcAddr;
  690. IPV6ADDR SrcV6Addr;
  691. };
  692. #endif
  693. #ifdef __midl
  694. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  695. [case(IPSEC_PROTOCOL_V4)] ADDR DesAddr;
  696. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR DesV6Addr;
  697. [default] ;
  698. };
  699. #else
  700. union {
  701. ADDR DesAddr;
  702. IPV6ADDR DesV6Addr;
  703. };
  704. #endif
  705. PROTOCOL Protocol;
  706. PORT SrcPort;
  707. PORT DesPort;
  708. #ifdef __midl
  709. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  710. [case(IPSEC_PROTOCOL_V4)] ADDR MyTunnelEndpt;
  711. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR MyV6TunnelEndpt;
  712. [default] ;
  713. };
  714. #else
  715. union {
  716. ADDR MyTunnelEndpt;
  717. IPV6ADDR MyV6TunnelEndpt;
  718. };
  719. #endif
  720. #ifdef __midl
  721. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  722. [case(IPSEC_PROTOCOL_V4)] ADDR PeerTunnelEndpt;
  723. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR PeerV6TunnelEndpt;
  724. [default] ;
  725. };
  726. #else
  727. union {
  728. ADDR PeerTunnelEndpt;
  729. IPV6ADDR PeerV6TunnelEndpt;
  730. };
  731. #endif
  732. DWORD dwFlags;
  733. } IPSEC_QM_FILTER, * PIPSEC_QM_FILTER;
  734. //
  735. // Maximum number of quick mode filters allowed in an RPC container
  736. //
  737. MIDL_DEFINE_INT(MIDL_MAX_QMFILTER_COUNT, MAX_TRANSPORTFILTER_ENUM_COUNT);
  738. typedef struct _UDP_ENCAP_INFO {
  739. IPSEC_SA_UDP_ENCAP_TYPE SAEncapType;
  740. IPSEC_UDP_ENCAP_CONTEXT UdpEncapContext;
  741. IP_PROTOCOL_VERSION PeerAddrVersion;
  742. #ifdef __midl
  743. [switch_type(IP_PROTOCOL_VERSION), switch_is(PeerAddrVersion)] union {
  744. [case(IPSEC_PROTOCOL_V4)] ADDR PeerPrivateAddr;
  745. [case(IPSEC_PROTOCOL_V6)] IPV6ADDR PeerPrivateAddrV6;
  746. [default] ;
  747. };
  748. #else
  749. union {
  750. ADDR PeerPrivateAddr;
  751. IPV6ADDR PeerPrivateAddrV6;
  752. };
  753. #endif
  754. } UDP_ENCAP_INFO, *PUDP_ENCAP_INFO;
  755. typedef struct _IPSEC_QM_SA {
  756. GUID gQMPolicyID;
  757. IPSEC_QM_OFFER SelectedQMOffer;
  758. GUID gQMFilterID;
  759. IPSEC_QM_FILTER IpsecQMFilter;
  760. IKE_COOKIE_PAIR MMSpi;
  761. UDP_ENCAP_INFO EncapInfo;
  762. } IPSEC_QM_SA, * PIPSEC_QM_SA;
  763. #define MAX_QMSA_ENUM_COUNT 500
  764. MIDL_DEFINE_INT(MIDL_MAX_QMSA_COUNT, MAX_QMSA_ENUM_COUNT);
  765. typedef enum _SA_FAIL_MODE {
  766. MAIN_MODE = 1,
  767. QUICK_MODE,
  768. } SA_FAIL_MODE, * PSA_FAIL_MODE;
  769. typedef enum _SA_FAIL_POINT {
  770. FAIL_POINT_ME = 1,
  771. FAIL_POINT_PEER,
  772. } SA_FAIL_POINT, * PSA_FAIL_POINT;
  773. typedef struct _SA_NEGOTIATION_STATUS_INFO {
  774. SA_FAIL_MODE FailMode;
  775. SA_FAIL_POINT FailPoint;
  776. DWORD dwError;
  777. } SA_NEGOTIATION_STATUS_INFO, * PSA_NEGOTIATION_STATUS_INFO;
  778. //
  779. // IPSec structures.
  780. //
  781. typedef struct _IPSEC_STATISTICS {
  782. DWORD dwNumActiveAssociations;
  783. DWORD dwNumOffloadedSAs;
  784. DWORD dwNumPendingKeyOps;
  785. DWORD dwNumKeyAdditions;
  786. DWORD dwNumKeyDeletions;
  787. DWORD dwNumReKeys;
  788. DWORD dwNumActiveTunnels;
  789. DWORD dwNumBadSPIPackets;
  790. DWORD dwNumPacketsNotDecrypted;
  791. DWORD dwNumPacketsNotAuthenticated;
  792. DWORD dwNumPacketsWithReplayDetection;
  793. ULARGE_INTEGER uConfidentialBytesSent;
  794. ULARGE_INTEGER uConfidentialBytesReceived;
  795. ULARGE_INTEGER uAuthenticatedBytesSent;
  796. ULARGE_INTEGER uAuthenticatedBytesReceived;
  797. ULARGE_INTEGER uTransportBytesSent;
  798. ULARGE_INTEGER uTransportBytesReceived;
  799. ULARGE_INTEGER uBytesSentInTunnels;
  800. ULARGE_INTEGER uBytesReceivedInTunnels;
  801. ULARGE_INTEGER uOffloadedBytesSent;
  802. ULARGE_INTEGER uOffloadedBytesReceived;
  803. } IPSEC_STATISTICS, * PIPSEC_STATISTICS;
  804. typedef struct _IPSEC_INTERFACE_INFO {
  805. GUID gInterfaceID;
  806. DWORD dwIndex;
  807. LPWSTR pszInterfaceName;
  808. LPWSTR pszDeviceName;
  809. DWORD dwInterfaceType;
  810. IP_PROTOCOL_VERSION IpVersion;
  811. #ifdef __midl
  812. [switch_type(IP_PROTOCOL_VERSION), switch_is(IpVersion)] union {
  813. [case(IPSEC_PROTOCOL_V4)] UCHAR ucIpAddr[4];
  814. [case(IPSEC_PROTOCOL_V6)] UCHAR ucIpv6Addr[16];
  815. [default] ;
  816. };
  817. #else
  818. union {
  819. ULONG uIpAddr;
  820. UCHAR ucIpv6Addr[16];
  821. };
  822. #endif
  823. } IPSEC_INTERFACE_INFO, * PIPSEC_INTERFACE_INFO;
  824. //
  825. // Constants to track the source of policy
  826. //
  827. #define IPSEC_SOURCE_PERSISTENT 0x1
  828. #define IPSEC_SOURCE_LOCAL 0x2
  829. #define IPSEC_SOURCE_DOMAIN 0x3
  830. #define IPSEC_SOURCE_CACHE 0x4
  831. #define IPSEC_SOURCE_WINIPSEC 0x5
  832. typedef enum _SPD_STATE {
  833. SPD_STATE_INITIAL,
  834. SPD_STATE_DS_LOAD_SUCCESS,
  835. SPD_STATE_DS_LOAD_FAIL,
  836. SPD_STATE_DS_APPLY_SUCCESS,
  837. SPD_STATE_DS_APPLY_FAIL,
  838. SPD_STATE_CACHE_LOAD_SUCCESS,
  839. SPD_STATE_CACHE_LOAD_FAIL,
  840. SPD_STATE_CACHE_APPLY_SUCCESS,
  841. SPD_STATE_CACHE_APPLY_FAIL,
  842. SPD_STATE_LOCAL_LOAD_SUCCESS,
  843. SPD_STATE_LOCAL_LOAD_FAIL,
  844. SPD_STATE_LOCAL_APPLY_SUCCESS,
  845. SPD_STATE_LOCAL_APPLY_FAIL,
  846. SPD_STATE_PERSISTENT_LOAD_SUCCESS,
  847. SPD_STATE_PERSISTENT_LOAD_FAIL,
  848. SPD_STATE_PERSISTENT_APPLY_SUCCESS,
  849. SPD_STATE_PERSISTENT_APPLY_FAIL,
  850. } SPD_STATE, * PSPD_STATE;
  851. typedef enum _SPD_ACTION {
  852. SPD_POLICY_APPLY,
  853. SPD_POLICY_LOAD
  854. } SPD_ACTION, * PSPD_ACTION;
  855. typedef struct _SPD_POLICY_STATE {
  856. SPD_STATE PolicyLoadState;
  857. DWORD dwWhenChanged;
  858. } SPD_POLICY_STATE, * PSPD_POLICY_STATE;
  859. #define FLAGS_NLBS_UNBOUND 0x00000000
  860. #define FLAGS_NLBS_BOUND 0x00000001
  861. #define FLAGS_NLBS_MAX 0x00000002
  862. typedef struct _IKE_CONFIG {
  863. DWORD dwDebug;
  864. DWORD dwEnableLogging;
  865. DWORD dwStrongCRLCheck;
  866. DWORD dwMaxRespOpenMM;
  867. DWORD dwNLBSFlags;
  868. DWORD dwFlags;
  869. DWORD dwEnableDOSProtect;
  870. DWORD dw2048DHGroupId;
  871. } IKE_CONFIG, * PIKE_CONFIG;
  872. //
  873. // If dwInterfaceType is MIB_IF_TYPE_ETHERNET or MIB_IF_TYPE_FDDI
  874. // or MIB_IF_TYPE_TOKENRING then its a LAN interface.
  875. // If dwInterfaceType is MIB_IF_TYPE_PPP or MIB_IF_TYPE_SLIP
  876. // then its a WAN/DIALUP interface.
  877. //
  878. #define MAX_INTERFACE_ENUM_COUNT 100
  879. MIDL_DEFINE_INT(MIDL_MAX_INTERFACE_COUNT, MAX_INTERFACE_ENUM_COUNT);
  880. //
  881. // IPSEC SPD APIs.
  882. //
  883. DWORD
  884. WINAPI
  885. SPDApiBufferAllocate(
  886. DWORD dwByteCount,
  887. LPVOID * ppBuffer
  888. );
  889. VOID
  890. WINAPI
  891. SPDApiBufferFree(
  892. LPVOID pBuffer
  893. );
  894. DWORD
  895. WINAPI
  896. AddTransportFilter(
  897. LPWSTR pServerName,
  898. DWORD dwVersion,
  899. DWORD dwFlags,
  900. PTRANSPORT_FILTER pTransportFilter,
  901. LPVOID pvReserved,
  902. PHANDLE phFilter
  903. );
  904. DWORD
  905. WINAPI
  906. DeleteTransportFilter(
  907. HANDLE hFilter
  908. );
  909. DWORD
  910. WINAPI
  911. EnumTransportFilters(
  912. LPWSTR pServerName,
  913. DWORD dwVersion,
  914. PTRANSPORT_FILTER pTransportTemplateFilter,
  915. DWORD dwLevel,
  916. GUID gGenericFilterID,
  917. DWORD dwPreferredNumEntries,
  918. PTRANSPORT_FILTER * ppTransportFilters,
  919. LPDWORD pdwNumFilters,
  920. LPDWORD pdwResumeHandle,
  921. LPVOID pvReserved
  922. );
  923. DWORD
  924. WINAPI
  925. SetTransportFilter(
  926. HANDLE hFilter,
  927. DWORD dwVersion,
  928. PTRANSPORT_FILTER pTransportFilter,
  929. LPVOID pvReserved
  930. );
  931. DWORD
  932. WINAPI
  933. GetTransportFilter(
  934. HANDLE hFilter,
  935. DWORD dwVersion,
  936. PTRANSPORT_FILTER * ppTransportFilter,
  937. LPVOID pvReserved
  938. );
  939. DWORD
  940. WINAPI
  941. AddQMPolicy(
  942. LPWSTR pServerName,
  943. DWORD dwVersion,
  944. DWORD dwFlags,
  945. PIPSEC_QM_POLICY pQMPolicy,
  946. LPVOID pvReserved
  947. );
  948. DWORD
  949. WINAPI
  950. DeleteQMPolicy(
  951. LPWSTR pServerName,
  952. DWORD dwVersion,
  953. LPWSTR pszPolicyName,
  954. LPVOID pvReserved
  955. );
  956. DWORD
  957. WINAPI
  958. EnumQMPolicies(
  959. LPWSTR pServerName,
  960. DWORD dwVersion,
  961. PIPSEC_QM_POLICY pQMTemplatePolicy,
  962. DWORD dwFlags,
  963. DWORD dwPreferredNumEntries,
  964. PIPSEC_QM_POLICY * ppQMPolicies,
  965. LPDWORD pdwNumPolicies,
  966. LPDWORD pdwResumeHandle,
  967. LPVOID pvReserved
  968. );
  969. DWORD
  970. WINAPI
  971. SetQMPolicy(
  972. LPWSTR pServerName,
  973. DWORD dwVersion,
  974. LPWSTR pszPolicyName,
  975. PIPSEC_QM_POLICY pQMPolicy,
  976. LPVOID pvReserved
  977. );
  978. DWORD
  979. WINAPI
  980. GetQMPolicy(
  981. LPWSTR pServerName,
  982. DWORD dwVersion,
  983. LPWSTR pszPolicyName,
  984. DWORD dwFlags,
  985. PIPSEC_QM_POLICY * ppQMPolicy,
  986. LPVOID pvReserved
  987. );
  988. DWORD
  989. WINAPI
  990. AddMMPolicy(
  991. LPWSTR pServerName,
  992. DWORD dwVersion,
  993. DWORD dwFlags,
  994. PIPSEC_MM_POLICY pMMPolicy,
  995. LPVOID pvReserved
  996. );
  997. DWORD
  998. WINAPI
  999. DeleteMMPolicy(
  1000. LPWSTR pServerName,
  1001. DWORD dwVersion,
  1002. LPWSTR pszPolicyName,
  1003. LPVOID pvReserved
  1004. );
  1005. DWORD
  1006. WINAPI
  1007. EnumMMPolicies(
  1008. LPWSTR pServerName,
  1009. DWORD dwVersion,
  1010. PIPSEC_MM_POLICY pMMTemplatePolicy,
  1011. DWORD dwFlags,
  1012. DWORD dwPreferredNumEntries,
  1013. PIPSEC_MM_POLICY * ppMMPolicies,
  1014. LPDWORD pdwNumPolicies,
  1015. LPDWORD pdwResumeHandle,
  1016. LPVOID pvReserved
  1017. );
  1018. DWORD
  1019. WINAPI
  1020. SetMMPolicy(
  1021. LPWSTR pServerName,
  1022. DWORD dwVersion,
  1023. LPWSTR pszPolicyName,
  1024. PIPSEC_MM_POLICY pMMPolicy,
  1025. LPVOID pvReserved
  1026. );
  1027. DWORD
  1028. WINAPI
  1029. GetMMPolicy(
  1030. LPWSTR pServerName,
  1031. DWORD dwVersion,
  1032. LPWSTR pszPolicyName,
  1033. PIPSEC_MM_POLICY * ppMMPolicy,
  1034. LPVOID pvReserved
  1035. );
  1036. DWORD
  1037. WINAPI
  1038. AddMMFilter(
  1039. LPWSTR pServerName,
  1040. DWORD dwVersion,
  1041. DWORD dwFlags,
  1042. PMM_FILTER pMMFilter,
  1043. LPVOID pvReserved,
  1044. PHANDLE phMMFilter
  1045. );
  1046. DWORD
  1047. WINAPI
  1048. DeleteMMFilter(
  1049. HANDLE hMMFilter
  1050. );
  1051. DWORD
  1052. WINAPI
  1053. EnumMMFilters(
  1054. LPWSTR pServerName,
  1055. DWORD dwVersion,
  1056. PMM_FILTER pMMTemplateFilter,
  1057. DWORD dwLevel,
  1058. GUID gGenericFilterID,
  1059. DWORD dwPreferredNumEntries,
  1060. PMM_FILTER * ppMMFilters,
  1061. LPDWORD pdwNumMMFilters,
  1062. LPDWORD pdwResumeHandle,
  1063. LPVOID pvReserved
  1064. );
  1065. DWORD
  1066. WINAPI
  1067. SetMMFilter(
  1068. HANDLE hMMFilter,
  1069. DWORD dwVersion,
  1070. PMM_FILTER pMMFilter,
  1071. LPVOID pvReserved
  1072. );
  1073. DWORD
  1074. WINAPI
  1075. GetMMFilter(
  1076. HANDLE hMMFilter,
  1077. DWORD dwVersion,
  1078. PMM_FILTER * ppMMFilter,
  1079. LPVOID pvReserved
  1080. );
  1081. DWORD
  1082. WINAPI
  1083. MatchMMFilter(
  1084. LPWSTR pServerName,
  1085. DWORD dwVersion,
  1086. PMM_FILTER pMMFilter,
  1087. DWORD dwFlags,
  1088. DWORD dwPreferredNumEntries,
  1089. PMM_FILTER * ppMatchedMMFilters,
  1090. PIPSEC_MM_POLICY * ppMatchedMMPolicies,
  1091. PMM_AUTH_METHODS * ppMatchedMMAuthMethods,
  1092. LPDWORD pdwNumMatches,
  1093. LPDWORD pdwResumeHandle,
  1094. LPVOID pvReserved
  1095. );
  1096. DWORD
  1097. WINAPI
  1098. MatchTransportFilter(
  1099. LPWSTR pServerName,
  1100. DWORD dwVersion,
  1101. PTRANSPORT_FILTER pTxFilter,
  1102. DWORD dwFlags,
  1103. DWORD dwPreferredNumEntries,
  1104. PTRANSPORT_FILTER * ppMatchedTxFilters,
  1105. PIPSEC_QM_POLICY * ppMatchedQMPolicies,
  1106. LPDWORD pdwNumMatches,
  1107. LPDWORD pdwResumeHandle,
  1108. LPVOID pvReserved
  1109. );
  1110. DWORD
  1111. WINAPI
  1112. GetQMPolicyByID(
  1113. LPWSTR pServerName,
  1114. DWORD dwVersion,
  1115. GUID gQMPolicyID,
  1116. DWORD dwFlags,
  1117. PIPSEC_QM_POLICY * ppQMPolicy,
  1118. LPVOID pvReserved
  1119. );
  1120. DWORD
  1121. WINAPI
  1122. GetMMPolicyByID(
  1123. LPWSTR pServerName,
  1124. DWORD dwVersion,
  1125. GUID gMMPolicyID,
  1126. PIPSEC_MM_POLICY * ppMMPolicy,
  1127. LPVOID pvReserved
  1128. );
  1129. DWORD
  1130. WINAPI
  1131. AddMMAuthMethods(
  1132. LPWSTR pServerName,
  1133. DWORD dwVersion,
  1134. DWORD dwFlags,
  1135. PMM_AUTH_METHODS pMMAuthMethods,
  1136. LPVOID pvReserved
  1137. );
  1138. DWORD
  1139. WINAPI
  1140. DeleteMMAuthMethods(
  1141. LPWSTR pServerName,
  1142. DWORD dwVersion,
  1143. GUID gMMAuthID,
  1144. LPVOID pvReserved
  1145. );
  1146. DWORD
  1147. WINAPI
  1148. EnumMMAuthMethods(
  1149. LPWSTR pServerName,
  1150. DWORD dwVersion,
  1151. PMM_AUTH_METHODS pMMTemplateAuthMethods,
  1152. DWORD dwFlags,
  1153. DWORD dwPreferredNumEntries,
  1154. PMM_AUTH_METHODS * ppMMAuthMethods,
  1155. LPDWORD pdwNumAuthMethods,
  1156. LPDWORD pdwResumeHandle,
  1157. LPVOID pvReserved
  1158. );
  1159. DWORD
  1160. WINAPI
  1161. SetMMAuthMethods(
  1162. LPWSTR pServerName,
  1163. DWORD dwVersion,
  1164. GUID gMMAuthID,
  1165. PMM_AUTH_METHODS pMMAuthMethods,
  1166. LPVOID pvReserved
  1167. );
  1168. DWORD
  1169. WINAPI
  1170. GetMMAuthMethods(
  1171. LPWSTR pServerName,
  1172. DWORD dwVersion,
  1173. GUID gMMAuthID,
  1174. PMM_AUTH_METHODS * ppMMAuthMethods,
  1175. LPVOID pvReserved
  1176. );
  1177. DWORD
  1178. WINAPI
  1179. InitiateIKENegotiation(
  1180. LPWSTR pServerName,
  1181. DWORD dwVersion,
  1182. PIPSEC_QM_FILTER pQMFilter,
  1183. DWORD dwClientProcessId,
  1184. HANDLE hClientEvent,
  1185. DWORD dwFlags,
  1186. IPSEC_UDP_ENCAP_CONTEXT UdpEncapContext,
  1187. LPVOID pvReserved,
  1188. PHANDLE phNegotiation
  1189. );
  1190. DWORD
  1191. WINAPI
  1192. QueryIKENegotiationStatus(
  1193. HANDLE hNegotiation,
  1194. DWORD dwVersion,
  1195. PSA_NEGOTIATION_STATUS_INFO pNegotiationStatus,
  1196. LPVOID pvReserved
  1197. );
  1198. DWORD
  1199. WINAPI
  1200. CloseIKENegotiationHandle(
  1201. HANDLE hNegotiation
  1202. );
  1203. DWORD
  1204. WINAPI
  1205. EnumMMSAs(
  1206. LPWSTR pServerName,
  1207. DWORD dwVersion,
  1208. PIPSEC_MM_SA pMMTemplate,
  1209. DWORD dwFlags,
  1210. DWORD dwPreferredNumEntries,
  1211. PIPSEC_MM_SA * ppMMSAs,
  1212. LPDWORD pdwNumEntries,
  1213. LPDWORD pdwTotalMMsAvailable,
  1214. LPDWORD pdwEnumHandle,
  1215. LPVOID pvReserved
  1216. );
  1217. DWORD
  1218. WINAPI
  1219. DeleteMMSAs(
  1220. LPWSTR pServerName,
  1221. DWORD dwVersion,
  1222. PIPSEC_MM_SA pMMTemplate,
  1223. DWORD dwFlags,
  1224. LPVOID pvReserved
  1225. );
  1226. DWORD
  1227. WINAPI
  1228. DeleteQMSAs(
  1229. LPWSTR pServerName,
  1230. DWORD dwVersion,
  1231. PIPSEC_QM_SA pIpsecQMSA,
  1232. DWORD dwFlags,
  1233. LPVOID pvReserved
  1234. );
  1235. DWORD
  1236. WINAPI
  1237. QueryIKEStatistics(
  1238. LPWSTR pServerName,
  1239. DWORD dwVersion,
  1240. PIKE_STATISTICS pIKEStatistics,
  1241. LPVOID pvReserved
  1242. );
  1243. DWORD
  1244. WINAPI
  1245. RegisterIKENotifyClient(
  1246. LPWSTR pServerName,
  1247. DWORD dwVersion,
  1248. DWORD dwClientProcessId,
  1249. HANDLE hClientEvent,
  1250. IPSEC_QM_SA QMTemplate,
  1251. DWORD dwFlags,
  1252. LPVOID pvReserved,
  1253. PHANDLE phNotifyHandle
  1254. );
  1255. DWORD
  1256. WINAPI
  1257. QueryIKENotifyData(
  1258. HANDLE hNotifyHandle,
  1259. DWORD dwVersion,
  1260. DWORD dwFlags,
  1261. PIPSEC_QM_SA * ppQMSAs,
  1262. PDWORD pdwNumEntries,
  1263. LPVOID pvReserved
  1264. );
  1265. DWORD
  1266. WINAPI
  1267. CloseIKENotifyHandle(
  1268. HANDLE hNotifyHandle
  1269. );
  1270. DWORD
  1271. WINAPI
  1272. QueryIPSecStatistics(
  1273. LPWSTR pServerName,
  1274. DWORD dwVersion,
  1275. PIPSEC_STATISTICS * ppIpsecStatistics,
  1276. LPVOID pvReserved
  1277. );
  1278. DWORD
  1279. WINAPI
  1280. EnumQMSAs(
  1281. LPWSTR pServerName,
  1282. DWORD dwVersion,
  1283. PIPSEC_QM_SA pQMSATemplate,
  1284. DWORD dwFlags,
  1285. DWORD dwPreferredNumEntries,
  1286. PIPSEC_QM_SA * ppQMSAs,
  1287. LPDWORD pdwNumQMSAs,
  1288. LPDWORD pdwNumTotalQMSAs,
  1289. LPDWORD pdwResumeHandle,
  1290. LPVOID pvReserved
  1291. );
  1292. DWORD
  1293. WINAPI
  1294. AddTunnelFilter(
  1295. LPWSTR pServerName,
  1296. DWORD dwVersion,
  1297. DWORD dwFlags,
  1298. PTUNNEL_FILTER pTunnelFilter,
  1299. LPVOID pvReserved,
  1300. PHANDLE phFilter
  1301. );
  1302. DWORD
  1303. WINAPI
  1304. DeleteTunnelFilter(
  1305. HANDLE hFilter
  1306. );
  1307. DWORD
  1308. WINAPI
  1309. EnumTunnelFilters(
  1310. LPWSTR pServerName,
  1311. DWORD dwVersion,
  1312. PTUNNEL_FILTER pTunnelTemplateFilter,
  1313. DWORD dwLevel,
  1314. GUID gGenericFilterID,
  1315. DWORD dwPreferredNumEntries,
  1316. PTUNNEL_FILTER * ppTunnelFilters,
  1317. LPDWORD pdwNumFilters,
  1318. LPDWORD pdwResumeHandle,
  1319. LPVOID pvReserved
  1320. );
  1321. DWORD
  1322. WINAPI
  1323. SetTunnelFilter(
  1324. HANDLE hFilter,
  1325. DWORD dwVersion,
  1326. PTUNNEL_FILTER pTunnelFilter,
  1327. LPVOID pvReserved
  1328. );
  1329. DWORD
  1330. WINAPI
  1331. GetTunnelFilter(
  1332. HANDLE hFilter,
  1333. DWORD dwVersion,
  1334. PTUNNEL_FILTER * ppTunnelFilter,
  1335. LPVOID pvReserved
  1336. );
  1337. DWORD
  1338. WINAPI
  1339. MatchTunnelFilter(
  1340. LPWSTR pServerName,
  1341. DWORD dwVersion,
  1342. PTUNNEL_FILTER pTnFilter,
  1343. DWORD dwFlags,
  1344. DWORD dwPreferredNumEntries,
  1345. PTUNNEL_FILTER * ppMatchedTnFilters,
  1346. PIPSEC_QM_POLICY * ppMatchedQMPolicies,
  1347. LPDWORD pdwNumMatches,
  1348. LPDWORD pdwResumeHandle,
  1349. LPVOID pvReserved
  1350. );
  1351. DWORD
  1352. WINAPI
  1353. OpenMMFilterHandle(
  1354. LPWSTR pServerName,
  1355. DWORD dwVersion,
  1356. PMM_FILTER pMMFilter,
  1357. LPVOID pvReserved,
  1358. PHANDLE phMMFilter
  1359. );
  1360. DWORD
  1361. WINAPI
  1362. CloseMMFilterHandle(
  1363. HANDLE hMMFilter
  1364. );
  1365. DWORD
  1366. WINAPI
  1367. OpenTransportFilterHandle(
  1368. LPWSTR pServerName,
  1369. DWORD dwVersion,
  1370. PTRANSPORT_FILTER pTransportFilter,
  1371. LPVOID pvReserved,
  1372. PHANDLE phTxFilter
  1373. );
  1374. DWORD
  1375. WINAPI
  1376. CloseTransportFilterHandle(
  1377. HANDLE hTxFilter
  1378. );
  1379. DWORD
  1380. WINAPI
  1381. OpenTunnelFilterHandle(
  1382. LPWSTR pServerName,
  1383. DWORD dwVersion,
  1384. PTUNNEL_FILTER pTunnelFilter,
  1385. LPVOID pvReserved,
  1386. PHANDLE phTnFilter
  1387. );
  1388. DWORD
  1389. WINAPI
  1390. CloseTunnelFilterHandle(
  1391. HANDLE hTnFilter
  1392. );
  1393. DWORD
  1394. WINAPI
  1395. EnumIPSecInterfaces(
  1396. LPWSTR pServerName,
  1397. DWORD dwVersion,
  1398. PIPSEC_INTERFACE_INFO pIpsecIfTemplate,
  1399. DWORD dwFlags,
  1400. DWORD dwPreferredNumEntries,
  1401. PIPSEC_INTERFACE_INFO * ppIpsecInterfaces,
  1402. LPDWORD pdwNumInterfaces,
  1403. LPDWORD pdwNumTotalInterfaces,
  1404. LPDWORD pdwResumeHandle,
  1405. LPVOID pvReserved
  1406. );
  1407. DWORD
  1408. WINAPI
  1409. AddSAs(
  1410. LPWSTR pServerName,
  1411. DWORD dwVersion,
  1412. IPSEC_SA_DIRECTION SADirection,
  1413. PIPSEC_QM_OFFER pQMOffer,
  1414. PIPSEC_QM_FILTER pQMFilter,
  1415. HANDLE * phLarvalContext,
  1416. DWORD dwInboundKeyMatLen,
  1417. BYTE * pInboundKeyMat,
  1418. DWORD dwOutboundKeyMatLen,
  1419. BYTE * pOutboundKeyMat,
  1420. BYTE * pContextInfo,
  1421. UDP_ENCAP_INFO EncapInfo,
  1422. LPVOID pvReserved,
  1423. DWORD dwFlags
  1424. );
  1425. DWORD
  1426. WINAPI
  1427. QuerySpdPolicyState(
  1428. LPWSTR pServerName,
  1429. DWORD dwVersion,
  1430. PSPD_POLICY_STATE * ppSpdPolicyState,
  1431. LPVOID pvReserved
  1432. );
  1433. DWORD
  1434. WINAPI
  1435. SetConfigurationVariables(
  1436. LPWSTR pServerName,
  1437. IKE_CONFIG IKEConfig
  1438. );
  1439. DWORD
  1440. WINAPI
  1441. GetConfigurationVariables(
  1442. LPWSTR pServerName,
  1443. PIKE_CONFIG pIKEConfig
  1444. );
  1445. #ifdef __cplusplus
  1446. }
  1447. #endif
  1448. #endif // _WINIPSEC_