#pragma warning disable IDE1006 // Naming Styles namespace Vanara.PInvoke; public static partial class FwpUClnt { /// /// The FWP_CLASSIFY_OPTION_TYPE enumerated type is used by callouts and shims during run-time classification. /// /// FWP_CLASSIFY_OPTION_TYPE specifies timeout options for unicast, multicast, and loose source mapping states and enables /// blocking or permission of state creation on outbound multicast and broadcast traffic. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_classify_option_type typedef enum // FWP_CLASSIFY_OPTION_TYPE_ { FWP_CLASSIFY_OPTION_MULTICAST_STATE = 0, FWP_CLASSIFY_OPTION_LOOSE_SOURCE_MAPPING, // FWP_CLASSIFY_OPTION_UNICAST_LIFETIME, FWP_CLASSIFY_OPTION_MCAST_BCAST_LIFETIME, FWP_CLASSIFY_OPTION_SECURE_SOCKET_SECURITY_FLAGS, // FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_MM_POLICY_KEY, FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_QM_POLICY_KEY, // FWP_CLASSIFY_OPTION_LOCAL_ONLY_MAPPING, FWP_CLASSIFY_OPTION_MAX } FWP_CLASSIFY_OPTION_TYPE; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_CLASSIFY_OPTION_TYPE_")] public enum FWP_CLASSIFY_OPTION_TYPE { /// /// Value: /// 0 /// Specifies the multicast conditions on outbound traffic. See FWPM_CLASSIFY_OPTION0 for possible values. /// FWP_CLASSIFY_OPTION_MULTICAST_STATE, /// /// Specifies the source mapping conditions for callout filters. See /// FWPM_CLASSIFY_OPTION0 /// for possible values. /// /// Loose source mapping allows unicast responses from a remote peer to match only the port number, instead of the entire source address. /// /// FWP_CLASSIFY_OPTION_LOOSE_SOURCE_MAPPING, /// Specifies the unicast state lifetime, in seconds. FWP_CLASSIFY_OPTION_UNICAST_LIFETIME, /// Specifies the multicast/broadcast state lifetime, in seconds. FWP_CLASSIFY_OPTION_MCAST_BCAST_LIFETIME, /// /// /// Specifies that the callout can set secure socket settings on the endpoint. Such flags are only allowed to increase the overall /// security level. The possible values are defined in the /// /// Mstcpip.h /// header file. /// /// /// /// Value /// /// Meaning /// /// /// /// /// SOCKET_SETTINGS_GUARANTEE_ENCRYPTION 0x00000001 /// /// /// Indicates that guaranteed encryption of traffic is required. This flag should be set if the default policy prefers methods of /// protection that do not use encryption. If this flag is set and encryption is not possible for any reason, no packets will be sent /// and a connection will not be established. /// /// /// /// /// /// SOCKET_SETTINGS_ALLOW_INSECURE 0x00000002 /// /// /// Indicates that clear text connections are allowed. If this flag is set, some or all of the sent packets will be sent in clear /// text, especially if security with the peer could not be negotiated. /// /// /// /// /// Note Available only in Windows 7, Windows Server 2008 R2, and later. /// FWP_CLASSIFY_OPTION_SECURE_SOCKET_SECURITY_FLAGS, /// /// Allows the callout to specify the specific main mode (MM) policy used for the connection. /// Note Available only in Windows 7, Windows Server 2008 R2, and later. /// FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_MM_POLICY_KEY, /// /// Allows the callout to specify the specific quick mode (QM) policy used for the connection. /// Note Available only in Windows 7, Windows Server 2008 R2, and later. /// FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_QM_POLICY_KEY, /// FWP_CLASSIFY_OPTION_LOCAL_ONLY_MAPPING, /// Maximum value for testing purposes. FWP_CLASSIFY_OPTION_MAX, } /// The FWP_VALUE0 or an FWP_CONDITION_VALUE0structure. /// Not all data types are valid for each structure; see the tagged union in each structure to determine which are allowed. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_data_type typedef enum FWP_DATA_TYPE_ { FWP_EMPTY = 0, // FWP_UINT8, FWP_UINT16, FWP_UINT32, FWP_UINT64, FWP_INT8, FWP_INT16, FWP_INT32, FWP_INT64, FWP_FLOAT, FWP_DOUBLE, // FWP_BYTE_ARRAY16_TYPE, FWP_BYTE_BLOB_TYPE, FWP_SID, FWP_SECURITY_DESCRIPTOR_TYPE, FWP_TOKEN_INFORMATION_TYPE, // FWP_TOKEN_ACCESS_INFORMATION_TYPE, FWP_UNICODE_STRING_TYPE, FWP_BYTE_ARRAY6_TYPE, FWP_SINGLE_DATA_TYPE_MAX = 0xff, FWP_V4_ADDR_MASK, // FWP_V6_ADDR_MASK, FWP_RANGE_TYPE, FWP_DATA_TYPE_MAX } FWP_DATA_TYPE; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_DATA_TYPE_")] public enum FWP_DATA_TYPE { /// /// Value: /// 0 /// Indicates no data. /// FWP_EMPTY, /// Indicates an unsigned 8-bit integer value. FWP_UINT8, /// Indicates an unsigned 16-bit integer value. FWP_UINT16, /// Indicates an unsigned 32-bit integer value. FWP_UINT32, /// Indicates an unsigned 64-bit integer value. FWP_UINT64, /// Indicates a signed 8-bit integer value. FWP_INT8, /// Indicates a signed 16-bit integer value. FWP_INT16, /// Indicates a signed 32-bit integer value. FWP_INT32, /// Indicates a signed 64-bit integer value. FWP_INT64, /// Indicates a pointer to a single-precision floating-point value. FWP_FLOAT, /// Indicates a pointer to a double-precision floating-point value. FWP_DOUBLE, /// /// Indicates a pointer to an /// FWP_BYTE_ARRAY16 /// structure. /// FWP_BYTE_ARRAY16_TYPE, /// /// Indicates a pointer to an /// FWP_BYTE_BLOB /// structure. /// FWP_BYTE_BLOB_TYPE, /// Indicates a pointer to a SID. FWP_SID, /// /// Indicates a pointer to an /// FWP_BYTE_BLOB /// structure that describes a security descriptor. /// FWP_SECURITY_DESCRIPTOR_TYPE, /// /// Indicates a pointer to an /// FWP_BYTE_BLOB /// structure that describes token information. /// FWP_TOKEN_INFORMATION_TYPE, /// /// Indicates a pointer to an /// FWP_BYTE_BLOB /// structure that describes token access information. /// FWP_TOKEN_ACCESS_INFORMATION_TYPE, /// Indicates a pointer to a null-terminated unicode string. FWP_UNICODE_STRING_TYPE, /// Reserved. FWP_BYTE_ARRAY6_TYPE, /// /// Value: /// 0xff /// Reserved for future use. /// FWP_SINGLE_DATA_TYPE_MAX, /// /// Indicates a pointer to an /// FWP_V4_ADDR_AND_MASK /// structure. /// FWP_V4_ADDR_MASK, /// /// Indicates a pointer to an /// FWP_V6_ADDR_AND_MASK /// structure. /// FWP_V6_ADDR_MASK, /// /// Indicates a pointer to an /// FWP_RANGE0 /// structure. /// FWP_RANGE_TYPE, /// Maximum value for testing purposes. FWP_DATA_TYPE_MAX, } /// The FWP_DIRECTION enumerated type specifies direction of network traffic. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_direction typedef enum FWP_DIRECTION_ { // FWP_DIRECTION_OUTBOUND = 0, FWP_DIRECTION_INBOUND, FWP_DIRECTION_MAX } FWP_DIRECTION; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_DIRECTION_")] public enum FWP_DIRECTION { /// /// Value: /// 0 /// Specifies outbound traffic. /// FWP_DIRECTION_OUTBOUND, /// Specifies inbound traffic. FWP_DIRECTION_INBOUND, /// Maximum value for testing purposes. FWP_DIRECTION_MAX, } /// /// The FWP_ETHER_ENCAP_METHOD enumerated type specifies the method of encapsulating Ethernet II and SNAP traffic. Reserved. /// /// This enumeration is reserved. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_ether_encap_method typedef enum FWP_ETHER_ENCAP_METHOD_ { // FWP_ETHER_ENCAP_METHOD_ETHER_V2 = 0, FWP_ETHER_ENCAP_METHOD_SNAP = 1, FWP_ETHER_ENCAP_METHOD_SNAP_W_OUI_ZERO = 3 } FWP_ETHER_ENCAP_METHOD; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_ETHER_ENCAP_METHOD_")] public enum FWP_ETHER_ENCAP_METHOD { /// /// Value: /// 0 /// Specifies Ethernet V2 encapsulation. /// FWP_ETHER_ENCAP_METHOD_ETHER_V2 = 0, /// /// Value: /// 1 /// /// Specifies Subnet Access Protocol (SNAP) encapsulation with an unknown Organizationally Unique Identifier (OUI) and Service Access /// Point (SAP) prefix. /// /// FWP_ETHER_ENCAP_METHOD_SNAP, /// /// Value: /// 3 /// Specifies SNAP encapsulation with a recognized OUI and a SAP prefix of 03.AA.AA.00.00.00 + Ethertype. /// FWP_ETHER_ENCAP_METHOD_SNAP_W_OUI_ZERO = 3, } /// Flags for FWPM_FILTER_ENUM_TEMPLATE0_. [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwpmtypes.FWPM_FILTER_ENUM_TEMPLATE0_")] [Flags] public enum FWP_FILTER_ENUM_FLAG : uint { /// Only return the terminating filter with the highest weight. FWP_FILTER_ENUM_FLAG_BEST_TERMINATING_MATCH = 0x00000001, /// Return all matching filters sorted by weight (highest to lowest). FWP_FILTER_ENUM_FLAG_SORTED = 0x00000002, /// Return only boot-time filters. FWP_FILTER_ENUM_FLAG_BOOTTIME_ONLY = 0x00000004, /// Include boot-time filters; ignored if the FWP_FILTER_ENUM_FLAG_BOOTTIME_ONLY flag is set. FWP_FILTER_ENUM_FLAG_INCLUDE_BOOTTIME = 0x00000008, /// Include disabled filters; ignored if the FWP_FILTER_ENUM_FLAG_BOOTTIME_ONLY flag is set. FWP_FILTER_ENUM_FLAG_INCLUDE_DISABLED = 0x00000010, /// FWP_FILTER_ENUM_FLAG_RESERVED1 = 0x00000020, } /// The FWP_FILTER_ENUM_TYPE enumerated type specifies how the filter enum conditions should be interpreted. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_filter_enum_type typedef enum FWP_FILTER_ENUM_TYPE_ { // FWP_FILTER_ENUM_FULLY_CONTAINED = 0, FWP_FILTER_ENUM_OVERLAPPING, FWP_FILTER_ENUM_TYPE_MAX } FWP_FILTER_ENUM_TYPE; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_FILTER_ENUM_TYPE_")] public enum FWP_FILTER_ENUM_TYPE { /// /// Value: /// 0 /// Return only filters that fully contain the enum conditions. /// FWP_FILTER_ENUM_FULLY_CONTAINED, /// Return filters that overlap with the enum conditions, including filters that fully contain the enum conditions. FWP_FILTER_ENUM_OVERLAPPING, /// Maximum value for testing purposes. FWP_FILTER_ENUM_TYPE_MAX, } /// The FWP_IP_VERSION enumerated type specifies the IP version. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_ip_version typedef enum FWP_IP_VERSION_ { // FWP_IP_VERSION_V4 = 0, FWP_IP_VERSION_V6, FWP_IP_VERSION_NONE, FWP_IP_VERSION_MAX } FWP_IP_VERSION; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_IP_VERSION_")] public enum FWP_IP_VERSION { /// /// Value: /// 0 /// Specifies IPv4. /// FWP_IP_VERSION_V4, /// Specifies IPv6. FWP_IP_VERSION_V6, /// Reserved. FWP_IP_VERSION_NONE, /// Maximum value for testing purposes. FWP_IP_VERSION_MAX, } /// The FWP_MATCH_TYPE enumerated type specifies different match types allowed in filter conditions. /// /// /// In general, the value data type and the filter condition data type must be the same. The Base Filtering Engine (BFE) does not perform /// any data conversion. For example, an FWP_UINT32 value cannot be compared with an FWP_UINT16 value. /// /// Exceptions to this rule are as follows. /// /// /// An FWP_UINT32 field that contains an IPv4 address can be compared with an FWP_V4_ADDR_MASK value. /// /// /// An FWP_BYTE_ARRAY16_TYPE field that contains an IPv6 address can be compared with an FWP_V6_ADDR_MASK value. /// /// /// An FWP_TOKEN_INFORMATION_TYPE field can be compared with an FWP_SECURITY_DESCRIPTOR_TYPE value when adding filters. /// /// /// An FWP_TOKEN_ACCESS_INFORMATION_TYPE field can be compared with an FWP_SECURITY_DESCRIPTOR_TYPE value when adding filters. /// /// /// An FWP_TOKEN_INFORMATION_TYPE field can be compared with an FWP_SID value when enumerating. /// /// /// An FWP_TOKEN_ACCESS_INFORMATION_TYPE field can be compared with an FWP_SID value when enumerating. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_match_type typedef enum FWP_MATCH_TYPE_ { FWP_MATCH_EQUAL // = 0, FWP_MATCH_GREATER, FWP_MATCH_LESS, FWP_MATCH_GREATER_OR_EQUAL, FWP_MATCH_LESS_OR_EQUAL, FWP_MATCH_RANGE, FWP_MATCH_FLAGS_ALL_SET, // FWP_MATCH_FLAGS_ANY_SET, FWP_MATCH_FLAGS_NONE_SET, FWP_MATCH_EQUAL_CASE_INSENSITIVE, FWP_MATCH_NOT_EQUAL, FWP_MATCH_PREFIX, // FWP_MATCH_NOT_PREFIX, FWP_MATCH_TYPE_MAX } FWP_MATCH_TYPE; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_MATCH_TYPE_")] public enum FWP_MATCH_TYPE { /// /// Value: /// 0 /// Tests whether the value is equal to the condition value. /// All data types support /// FWP_MATCH_EQUAL /// . /// FWP_MATCH_EQUAL, /// /// Tests whether the value is greater than the condition value. /// Only sortable data types support /// FWP_MATCH_GREATER /// . Sortable data types consist of all integer types, FWP_BYTE_ARRAY16_TYPE, FWP_BYTE_BLOB_TYPE, and FWP_UNICODE_STRING_TYPE. /// FWP_MATCH_GREATER, /// /// Tests whether the value is less than the condition value. /// Only sortable data types support /// FWP_MATCH_LESS /// . /// FWP_MATCH_LESS, /// /// Tests whether the value is greater than or equal to the condition value. /// Only sortable data types support /// FWP_MATCH_GREATER_OR_EQUAL /// . /// FWP_MATCH_GREATER_OR_EQUAL, /// /// Tests whether the value is less than or equal to the condition value. /// Only sortable data types support /// FWP_MATCH_LESS_OR_EQUAL /// . /// FWP_MATCH_LESS_OR_EQUAL, /// /// Tests whether the value is within a given range of condition values. /// Only sortable data types support /// FWP_MATCH_RANGE /// . /// FWP_MATCH_RANGE, /// /// Tests whether all flags are set. /// Only unsigned integer data types support /// FWP_MATCH_FLAGS_ALL_SET /// . /// FWP_MATCH_FLAGS_ALL_SET, /// /// Tests whether any flags are set. /// Only unsigned integer data types support /// FWP_MATCH_FLAGS_ANY_SET /// . /// FWP_MATCH_FLAGS_ANY_SET, /// /// Tests whether no flags are set. /// Only unsigned integer data types support /// FWP_MATCH_FLAGS_NONE_SET /// . /// FWP_MATCH_FLAGS_NONE_SET, /// /// Tests whether the value is equal to the condition value. The test is case insensitive. /// Only the FWP_UNICODE_STRING_TYPE data type supports /// FWP_MATCH_EQUAL_CASE_INSENSITIVE /// . /// FWP_MATCH_EQUAL_CASE_INSENSITIVE, /// /// Tests whether the value is not equal to the condition value. /// Only sortable data types support /// FWP_MATCH_NOT_EQUAL /// . /// Note Available only in Windows 7 and Windows Server 2008 R2. /// FWP_MATCH_NOT_EQUAL, /// FWP_MATCH_PREFIX, /// FWP_MATCH_NOT_PREFIX, /// Maximum value for testing purposes. FWP_MATCH_TYPE_MAX, } /// The FWP_AF enumerated type specifies the address family. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_af typedef enum FWP_NE_FAMILY_ { FWP_AF_INET, // FWP_AF_INET6, FWP_AF_ETHER, FWP_AF_NONE } FWP_AF; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_NE_FAMILY_")] public enum FWP_NE_FAMILY { /// Specifies an address as an IPv4 address. FWP_AF_INET = FWP_IP_VERSION.FWP_IP_VERSION_V4, /// Specifies an address as an IPv6 address. FWP_AF_INET6 = FWP_IP_VERSION.FWP_IP_VERSION_V6, /// Reserved. FWP_AF_ETHER = FWP_IP_VERSION.FWP_IP_VERSION_NONE, /// Placeholder value to be used when the address family is not yet identified. FWP_AF_NONE = FWP_AF_ETHER + 1, } /// The FWP_VSWITCH_NETWORK_TYPE enumeration specifies the network type of a vSwitch. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ne-fwptypes-fwp_vswitch_network_type typedef enum // FWP_VSWITCH_NETWORK_TYPE_ { FWP_VSWITCH_NETWORK_TYPE_UNKNOWN = 0, FWP_VSWITCH_NETWORK_TYPE_PRIVATE, FWP_VSWITCH_NETWORK_TYPE_INTERNAL, // FWP_VSWITCH_NETWORK_TYPE_EXTERNAL } FWP_VSWITCH_NETWORK_TYPE; [PInvokeData("fwptypes.h", MSDNShortId = "NE:fwptypes.FWP_VSWITCH_NETWORK_TYPE_")] public enum FWP_VSWITCH_NETWORK_TYPE { /// /// Value: /// 0 /// Specifies an unknown network type. /// FWP_VSWITCH_NETWORK_TYPE_UNKNOWN, /// Specifies a private network. FWP_VSWITCH_NETWORK_TYPE_PRIVATE, /// Specifies an internal network. FWP_VSWITCH_NETWORK_TYPE_INTERNAL, /// Specifies an external network. FWP_VSWITCH_NETWORK_TYPE_EXTERNAL, } /// The FWP_BYTE_ARRAY16 structure stores an array of exactly 16 bytes. /// This data type is useful for IPv6 addresses. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_byte_array16 typedef struct FWP_BYTE_ARRAY16_ { UINT8 // byteArray16[16]; } FWP_BYTE_ARRAY16; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_BYTE_ARRAY16_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_BYTE_ARRAY16 { private Guid block; /// Array of 16 bytes. public byte[] byteArray16 { get => block.ToByteArray(); set => block = new(value); } } [StructLayout(LayoutKind.Explicit, Pack = 4)] internal struct FWP_BYTE_ARRAY_ADDR { [FieldOffset(0)] public IN_ADDR addr; [FieldOffset(0)] public IN6_ADDR addr6; } /// The FWP_BYTE_ARRAY6 structure stores an array of exactly 6 bytes. Reserved. /// This structure is reserved. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_byte_array6 typedef struct FWP_BYTE_ARRAY6_ { UINT8 // byteArray6[6]; } FWP_BYTE_ARRAY6; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_BYTE_ARRAY6_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_BYTE_ARRAY6 { /// Array of 6 bytes. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] byteArray6; } /// The FWP_BYTE_BLOB structure stores an array containing a variable number of bytes. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_byte_blob typedef struct FWP_BYTE_BLOB_ { UINT32 size; // UINT8 *data; } FWP_BYTE_BLOB; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_BYTE_BLOB_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_BYTE_BLOB : IBlob { /// Number of bytes in the array. public uint size; /// Pointer to the array. public IntPtr data; } /// /// The FWP_CONDITION_VALUE0 structure contains values that are used in filter conditions when testing for matching filters. /// /// /// /// The data type of FWP_CONDITION_VALUE0 must be compatible with the data type of the FWP_VALUE0 to which it is being compared. /// However, this does not mean the data types necessarily need to be the same. For example, an FWP_V4_ADDR_MASK can be compared to an /// FWP_UINT32 containing an IPv4 address. See FWP_MATCH_TYPE for detailed information about FWP_CONDITION_VALUE0 and /// FWP_VALUE0 compatibility rules. /// /// /// FWP_CONDITION_VALUE0 is a specific implementation of FWP_CONDITION_VALUE. See WFP Version-Independent Names and Targeting /// Specific Versions of Windows for more information. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_condition_value0 typedef struct FWP_CONDITION_VALUE0_ { // FWP_DATA_TYPE type; union { UINT8 uint8; UINT16 uint16; UINT32 uint32; UINT64 *uint64; INT8 int8; INT16 int16; INT32 int32; INT64 // *int64; float float32; double *double64; FWP_BYTE_ARRAY16 *byteArray16; FWP_BYTE_BLOB *byteBlob; SID *sid; FWP_BYTE_BLOB *sd; // FWP_TOKEN_INFORMATION *tokenInformation; FWP_BYTE_BLOB *tokenAccessInformation; LPWSTR unicodeString; FWP_BYTE_ARRAY6 *byteArray6; // FWP_V4_ADDR_AND_MASK *v4AddrMask; FWP_V6_ADDR_AND_MASK *v6AddrMask; FWP_RANGE0 *rangeValue; }; } FWP_CONDITION_VALUE0; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_CONDITION_VALUE0_")] [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] public struct FWP_CONDITION_VALUE0 { /// /// Specifies the data type of the condition value. /// See FWP_DATA_TYPE for more information. /// [FieldOffset(0)] public FWP_DATA_TYPE type; /// /// Available when type is FWP_UINT8. /// An unsigned 8-bit integer. /// [FieldOffset(8)] public byte uint8; /// /// Available when type is FWP_UINT16. /// An unsigned 16-bit integer. /// [FieldOffset(8)] public ushort uint16; /// /// Available when type is FWP_UINT32. /// An unsigned 32-bit integer. /// [FieldOffset(8)] public uint uint32; [FieldOffset(8)] private IntPtr ptr; /// /// Available when type is FWP_UINT64. /// A pointer to an unsigned 64-bit integer. /// /// Note /// This value cannot be null. /// /// public SafeCoTaskMemStruct uint64 { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_INT8. /// A signed 8-bit integer. /// [FieldOffset(8)] public sbyte int8; /// /// Available when type is FWP_INT16. /// A signed 16-bit integer. /// [FieldOffset(8)] public short int16; /// /// Available when type is FWP_INT32. /// A signed 32-bit integer. /// [FieldOffset(8)] public int int32; /// /// Available when type is FWP_INT64. /// A pointer to a signed 64-bit integer. /// /// Note /// This value cannot be null. /// /// public SafeCoTaskMemStruct int64 { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_FLOAT. /// A single-precision floating-point value. /// [FieldOffset(8)] public float float32; /// /// Available when type is FWP_DOUBLE. /// A pointer to a double-precision floating-point value. /// /// Note /// This value cannot be null. /// /// public SafeCoTaskMemStruct double64 { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_BYTE_ARRAY16_TYPE. /// A pointer to a FWP_BYTE_ARRAY16 structure. /// /// Note /// This value cannot be null. /// /// public SafeCoTaskMemStruct byteArray16 { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_BYTE_BLOB_TYPE. /// A pointer to a FWP_BYTE_BLOB structure. /// /// Note /// FWP_BYTE_BLOB structure cannot be null. /// /// public SafeCoTaskMemStruct byteBlob { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_SID. /// A pointer to a security identifier (SID) structure. /// /// Note /// This security identifier cannot be null. /// /// [FieldOffset(8)] public PSID sid; /// /// Available when type is FWP_SECURITY_DESCRIPTOR_TYPE. /// A pointer to a security descriptor contained in a FWP_BYTE_BLOB structure. /// /// Note /// Security descriptors cannot be null when used in filter conditions. Moreover, they need to be in self-relative format. /// /// public SafeCoTaskMemStruct sd { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_TOKEN_INFORMATION_TYPE. /// A pointer to token information contained in a FWP_TOKEN_INFORMATION structure. /// public SafeCoTaskMemStruct tokenInformation { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_TOKEN_ACCESS_INFORMATION_TYPE. /// A pointer to token access information contained in a FWP_BYTE_BLOB structure. /// /// Note /// FWP_BYTE_BLOB structure cannot be null. /// /// public SafeCoTaskMemStruct tokenAccessInformation { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_UNICODE_STRING_TYPE. /// A pointer to a null-terminated unicode string. /// /// Note /// This value cannot be null. /// /// [FieldOffset(8)] public StrPtrUni unicodeString; /// /// Available when type is FWP_BYTE_ARRAY6_TYPE. /// A pointer to a FWP_BYTE_ARRAY6 structure. /// /// Note /// This value cannot be null. /// /// /// Note /// Available only in Windows 7 and Windows Server 2008 R2. /// /// public SafeCoTaskMemStruct byteArray6 { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_V4_ADDR_MASK. /// A pointer to an IPv4 address contained in an FWP_V4_ADDR_AND_MASK structure. /// public SafeCoTaskMemStruct v4AddrMask { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_V6_ADDR_MASK. /// A pointer to an IPv6 address contained in an FWP_V6_ADDR_AND_MASK structure. /// public SafeCoTaskMemStruct v6AddrMask { get => new(ptr, false); set => ptr = value; } /// /// Available when type is FWP_RANGE_TYPE. /// A pointer to a range contained in an FWP_RANGE0 structure. /// public SafeCoTaskMemStruct rangeValue { get => new(ptr, false); set => ptr = value; } } /// The FWP_RANGE0 structure specifies a range of values. /// /// /// The elements valueLow and valueHigh must be the same data type and valueHigh must be greater than or equal to valueLow. /// /// Ranges are always inclusive. Thus, if a value equals valueLow or valueHigh, it is contained in the range. /// /// FWP_RANGE0 is a specific implementation of FWP_RANGE. See WFP Version-Independent Names and Targeting Specific Versions of /// Windows for more information. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_range0 typedef struct FWP_RANGE0_ { FWP_VALUE0 valueLow; // FWP_VALUE0 valueHigh; } FWP_RANGE0; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_RANGE0_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_RANGE0 { /// /// Low value of the range. /// See FWP_VALUE0 for more information. /// public FWP_VALUE0 valueLow; /// /// High value of the range. /// See FWP_VALUE0 for more information. /// public FWP_VALUE0 valueHigh; } /// The FWP_TOKEN_INFORMATION structure defines a set of security identifiers that are used for user-mode classification. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_token_information typedef struct FWP_TOKEN_INFORMATION_ { // ULONG sidCount; PSID_AND_ATTRIBUTES sids; ULONG restrictedSidCount; PSID_AND_ATTRIBUTES restrictedSids; } FWP_TOKEN_INFORMATION; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_TOKEN_INFORMATION_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_TOKEN_INFORMATION { /// The number of structures stored in the sids array. public uint sidCount; /// An array of SID_AND_ATTRIBUTES structures containing user and group security information. public IntPtr sids; /// The number of SID_AND_ATTRIBUTES structures stored in the restrictedSids array. public uint restrictedSidCount; /// An array of SID_AND_ATTRIBUTES structures containing restricted SIDs security information. public IntPtr restrictedSids; } /// The FWP_V4_ADDR_AND_MASK structure specifies IPv4 address and mask in host order.. // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_v4_addr_and_mask typedef struct FWP_V4_ADDR_AND_MASK_ { // UINT32 addr; UINT32 mask; } FWP_V4_ADDR_AND_MASK; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_V4_ADDR_AND_MASK_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_V4_ADDR_AND_MASK { /// Specifies an IPv4 address. public IN_ADDR addr; /// Specifies an IPv4 mask. public IN_ADDR mask; } /// The FWP_V6_ADDR_AND_MASK structure specifies an IPv6 address and mask. /// /// The mask is specified by the width in bits. For example, a prefixLength of 16 specifies a mask consisting of 16 1's followed by 112 0's. /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_v6_addr_and_mask typedef struct FWP_V6_ADDR_AND_MASK_ { // UINT8 addr[16]; UINT8 prefixLength; } FWP_V6_ADDR_AND_MASK; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_V6_ADDR_AND_MASK_")] [StructLayout(LayoutKind.Sequential)] public struct FWP_V6_ADDR_AND_MASK { /// An array of size FWP_V6_ADDR_SIZE bytes containing an IPv6 address. FWP_V6_ADDR_SIZE maps to 16. public IN6_ADDR addr; /// Value specifying the prefix length of the IPv6 address. public byte prefixLength; } /// The FWP_VALUE0 structure defines a data value that can be one of a number of different data types. /// /// For the unnamed union, switch_type(FWP_DATA_TYPE), switch_is(type). /// This is primarily used to supply incoming values to the filter engine. /// /// When IP addresses are stored in FWP_UINT32 format or when IP port is stored in FWP_UINT16 format, they are stored in host-order not network-order. /// /// /// FWP_VALUE0 is a specific implementation of FWP_VALUE. See WFP Version-Independent Names and Targeting Specific Versions of /// Windows for more information. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwp_value0 typedef struct FWP_VALUE0_ { FWP_DATA_TYPE type; // union { UINT8 uint8; UINT16 uint16; UINT32 uint32; UINT64 *uint64; INT8 int8; INT16 int16; INT32 int32; INT64 *int64; float float32; // double *double64; FWP_BYTE_ARRAY16 *byteArray16; FWP_BYTE_BLOB *byteBlob; SID *sid; FWP_BYTE_BLOB *sd; FWP_TOKEN_INFORMATION // *tokenInformation; FWP_BYTE_BLOB *tokenAccessInformation; LPWSTR unicodeString; FWP_BYTE_ARRAY6 *byteArray6; }; } FWP_VALUE0; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWP_VALUE0_")] [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] public struct FWP_VALUE0 { /// /// The type of data for this value. /// See FWP_DATA_TYPE for more information. /// [FieldOffset(0)] public FWP_DATA_TYPE type; /// /// case(FWP_UINT8) /// An unsigned 8-bit integer. /// [FieldOffset(0)] public byte uint8; /// /// case(FWP_UINT16) /// An unsigned 16-bit integer. /// [FieldOffset(0)] public ushort uint16; /// /// case(FWP_UINT32) /// An unsigned 32-bit integer. /// [FieldOffset(0)] public uint uint32; [FieldOffset(0)] private IntPtr ptr; /// /// case(FWP_UINT64) /// A pointer to an unsigned 64-bit integer. /// public SafeCoTaskMemStruct uint64 { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_INT8) /// A signed 8-bit integer. /// [FieldOffset(0)] public sbyte int8; /// /// case(FWP_INT16) /// A signed 16-bit integer. /// [FieldOffset(0)] public short int16; /// /// case(FWP_INT32) /// A signed 32-bit integer. /// [FieldOffset(0)] public int int32; /// /// case(FWP_INT64) /// A pointer to a signed 64-bit integer. /// public SafeCoTaskMemStruct int64 { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_FLOAT) /// A single-precision floating-point value. /// [FieldOffset(0)] public float float32; /// /// case(FWP_DOUBLE) /// A pointer to a double-precision floating-point value. /// public SafeCoTaskMemStruct double64 { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_BYTE_ARRAY16_TYPE) /// A pointer to a FWP_BYTE_ARRAY16 structure. /// public SafeCoTaskMemStruct byteArray16 { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_BYTE_BLOB_TYPE) /// A pointer to a FWP_BYTE_BLOB structure. /// public SafeCoTaskMemStruct byteBlob { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_SID) /// A pointer to a SID. /// [FieldOffset(0)] public PSID sid; /// /// case(FWP_SECURITY_DESCRIPTOR_TYPE) /// /// A pointer to a security descriptor contained in a FWP_BYTE_BLOB structure. The data contained in the blob is a /// SECURITY_DESCRIPTOR structure. /// /// public SafeCoTaskMemStruct sd { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_TOKEN_INFORMATION_TYPE) /// A pointer to an FWP_TOKEN_INFORMATION structure. /// public SafeCoTaskMemStruct tokenInformation { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_TOKEN_ACCESS_INFORMATION_TYPE) /// /// A pointer to token access information contained in a FWP_BYTE_BLOB structure. The data contained in the blob is a /// TOKEN_ACCESS_INFORMATION structure. /// /// public SafeCoTaskMemStruct tokenAccessInformation { get => new(ptr, false); set => ptr = value; } /// /// case(FWP_UNICODE_STRING_TYPE) /// A pointer to a null-terminated unicode string. /// [FieldOffset(0)] public StrPtrUni unicodeString; /// /// case(FWP_BYTE_ARRAY6_TYPE) /// Reserved. /// public SafeCoTaskMemStruct byteArray6 { get => new(ptr, false); set => ptr = value; } } /// The FWPM_DISPLAY_DATA0 structure stores an optional friendly name and an optional description for an object. /// /// In order to support MUI, both strings may contain indirect strings. See SHLoadIndirectString for details. /// /// FWPM_DISPLAY_DATA0 is a specific implementation of FWPM_DISPLAY_DATA. See WFP Version-Independent Names and Targeting Specific /// Versions of Windows for more information. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-fwpm_display_data0 typedef struct FWPM_DISPLAY_DATA0_ { // wchar_t *name; wchar_t *description; } FWPM_DISPLAY_DATA0; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.FWPM_DISPLAY_DATA0_")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct FWPM_DISPLAY_DATA0 { /// Optional friendly name. [MarshalAs(UnmanagedType.LPWStr)] public string? name; /// Optional description. [MarshalAs(UnmanagedType.LPWStr)] public string? description; } /// The IPSEC_VIRTUAL_IF_TUNNEL_INFO0 structure is used to store information specific to virtual interface tunneling. /// /// The IPSEC_VIRTUAL_IF_TUNNEL_INFO0 structure is applicable only to Internet Key Exchange version 2 (IKEv2). /// /// IPSEC_VIRTUAL_IF_TUNNEL_INFO0 is a specific implementation of IPSEC_VIRTUAL_IF_TUNNEL_INFO. See WFP Version-Independent Names /// and Targeting Specific Versions of Windows for more information. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/fwptypes/ns-fwptypes-ipsec_virtual_if_tunnel_info0 typedef struct // IPSEC_VIRTUAL_IF_TUNNEL_INFO0_ { UINT64 virtualIfTunnelId; UINT64 trafficSelectorId; } IPSEC_VIRTUAL_IF_TUNNEL_INFO0; [PInvokeData("fwptypes.h", MSDNShortId = "NS:fwptypes.IPSEC_VIRTUAL_IF_TUNNEL_INFO0_")] [StructLayout(LayoutKind.Sequential)] public struct IPSEC_VIRTUAL_IF_TUNNEL_INFO0 { /// ID of the virtual interface tunnel state. public ulong virtualIfTunnelId; /// ID of the virtual interface tunneling traffic selector(s). public ulong trafficSelectorId; } }