### ms-fasp.idl
"""
RPC definitions for the following interfaces:
- RemoteFW (v1.0): 6b5bdd1e-528c-422c-af8c-a4079be4fe48
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRByteField,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfVarStrLenField,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRContextHandle,
    NDRFullPointerField,
    NDRInt3264EnumField,
    NDRIntEnumField,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRRecursiveField,
    NDRRefEmbPointerField,
    NDRShortField,
    NDRSignedByteField,
    NDRUnionField,
    register_dcerpc_interface,
)


class FW_STORE_TYPE(IntEnum):
    FW_STORE_TYPE_INVALID = 1
    FW_STORE_TYPE_GP_RSOP = 2
    FW_STORE_TYPE_LOCAL = 3
    FW_STORE_TYPE_NOT_USED_VALUE_3 = 4
    FW_STORE_TYPE_NOT_USED_VALUE_4 = 5
    FW_STORE_TYPE_DYNAMIC = 6
    FW_STORE_TYPE_GPO = 7
    FW_STORE_TYPE_DEFAULTS = 8
    FW_STORE_TYPE_NOT_USED_VALUE_8 = 9
    FW_STORE_TYPE_NOT_USED_VALUE_9 = 10
    FW_STORE_TYPE_NOT_USED_VALUE_10 = 11
    FW_STORE_TYPE_NOT_USED_VALUE_11 = 12
    FW_STORE_TYPE_MAX = 13


class FW_POLICY_ACCESS_RIGHT(IntEnum):
    FW_POLICY_ACCESS_RIGHT_INVALID = 1
    FW_POLICY_ACCESS_RIGHT_READ = 2
    FW_POLICY_ACCESS_RIGHT_READ_WRITE = 3
    FW_POLICY_ACCESS_RIGHT_MAX = 4


class RRPC_FWOpenPolicyStore_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRShortField("BinaryVersion", 0),
        NDRInt3264EnumField("StoreType", 0, FW_STORE_TYPE),
        NDRInt3264EnumField("AccessRight", 0, FW_POLICY_ACCESS_RIGHT),
        NDRIntField("dwFlags", 0),
    ]


class RRPC_FWOpenPolicyStore_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("phPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("status", 0),
    ]


class RRPC_FWClosePolicyStore_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("phPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWClosePolicyStore_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("phPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("status", 0),
    ]


class RRPC_FWRestoreDefaults_Request(NDRPacket):
    fields_desc = [NDRLongField("rpcConnHandle", 0)]


class RRPC_FWRestoreDefaults_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class FW_GLOBAL_CONFIG(IntEnum):
    FW_GLOBAL_CONFIG_INVALID = 1
    FW_GLOBAL_CONFIG_POLICY_VERSION_SUPPORTED = 2
    FW_GLOBAL_CONFIG_CURRENT_PROFILE = 3
    FW_GLOBAL_CONFIG_DISABLE_STATEFUL_FTP = 4
    FW_GLOBAL_CONFIG_DISABLE_STATEFUL_PPTP = 5
    FW_GLOBAL_CONFIG_SA_IDLE_TIME = 6
    FW_GLOBAL_CONFIG_PRESHARED_KEY_ENCODING = 7
    FW_GLOBAL_CONFIG_IPSEC_EXEMPT = 8
    FW_GLOBAL_CONFIG_CRL_CHECK = 9
    FW_GLOBAL_CONFIG_IPSEC_THROUGH_NAT = 10
    FW_GLOBAL_CONFIG_POLICY_VERSION = 11
    FW_GLOBAL_CONFIG_BINARY_VERSION_SUPPORTED = 12
    FW_GLOBAL_CONFIG_IPSEC_TUNNEL_REMOTE_MACHINE_AUTHORIZATION_LIST = 13
    FW_GLOBAL_CONFIG_IPSEC_TUNNEL_REMOTE_USER_AUTHORIZATION_LIST = 14
    FW_GLOBAL_CONFIG_OPPORTUNISTICALLY_MATCH_AUTH_SET_PER_KM = 15
    FW_GLOBAL_CONFIG_IPSEC_TRANSPORT_REMOTE_MACHINE_AUTHORIZATION_LIST = 16
    FW_GLOBAL_CONFIG_IPSEC_TRANSPORT_REMOTE_USER_AUTHORIZATION_LIST = 17
    FW_GLOBAL_CONFIG_ENABLE_PACKET_QUEUE = 18
    FW_GLOBAL_CONFIG_MAX = 19


class RRPC_FWGetGlobalConfig_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRShortField("BinaryVersion", 0),
        NDRInt3264EnumField("StoreType", 0, FW_STORE_TYPE),
        NDRInt3264EnumField("configID", 0, FW_GLOBAL_CONFIG),
        NDRIntField("dwFlags", 0),
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("cbData", None, size_of="pBuffer"),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
    ]


class RRPC_FWGetGlobalConfig_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
        NDRIntField("pcbRequired", 0),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetGlobalConfig_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRShortField("BinaryVersion", 0),
        NDRInt3264EnumField("StoreType", 0, FW_STORE_TYPE),
        NDRInt3264EnumField("configID", 0, FW_GLOBAL_CONFIG),
        NDRConfStrLenField("lpBuffer", "", size_is=lambda pkt: pkt.dwBufSize),
        NDRIntField("dwBufSize", None, size_of="lpBuffer"),
    ]


class RRPC_FWSetGlobalConfig_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class FW_DIRECTION(IntEnum):
    FW_DIR_INVALID = 0
    FW_DIR_IN = 1
    FW_DIR_OUT = 2
    FW_DIR_MAX = 3


class PFW_PORT_RANGE(NDRPacket):
    ALIGNMENT = (2, 2)
    fields_desc = [NDRShortField("wBegin", 0), NDRShortField("wEnd", 0)]


class FW_PORT_RANGE_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pPorts"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pPorts",
                [PFW_PORT_RANGE()],
                PFW_PORT_RANGE,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class FW_PORTS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("wPortKeywords", 0),
        NDRPacketField("Ports", FW_PORT_RANGE_LIST(), FW_PORT_RANGE_LIST),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class PFW_ICMP_TYPE_CODE(NDRPacket):
    ALIGNMENT = (2, 2)
    fields_desc = [NDRByteField("bType", 0), NDRShortField("wCode", 0)]


class FW_ICMP_TYPE_CODE_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pEntries"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pEntries",
                [PFW_ICMP_TYPE_CODE()],
                PFW_ICMP_TYPE_CODE,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_IPV4_SUBNET(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwAddress", 0), NDRIntField("dwSubNetMask", 0)]


class FW_IPV4_SUBNET_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pSubNets"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pSubNets",
                [PFW_IPV4_SUBNET()],
                PFW_IPV4_SUBNET,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_IPV4_ADDRESS_RANGE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwBegin", 0), NDRIntField("dwEnd", 0)]


class FW_IPV4_RANGE_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pRanges"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pRanges",
                [PFW_IPV4_ADDRESS_RANGE()],
                PFW_IPV4_ADDRESS_RANGE,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_IPV6_SUBNET(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        StrFixedLenField("Address", "", length=16),
        NDRIntField("dwNumPrefixBits", 0),
    ]


class FW_IPV6_SUBNET_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pSubNets"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pSubNets",
                [PFW_IPV6_SUBNET()],
                PFW_IPV6_SUBNET,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_IPV6_ADDRESS_RANGE(NDRPacket):
    fields_desc = [
        StrFixedLenField("Begin", "", length=16),
        StrFixedLenField("End", "", length=16),
    ]


class FW_IPV6_RANGE_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pRanges"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pRanges",
                [PFW_IPV6_ADDRESS_RANGE()],
                PFW_IPV6_ADDRESS_RANGE,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class FW_ADDRESSES(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwV4AddressKeywords", 0),
        NDRIntField("dwV6AddressKeywords", 0),
        NDRPacketField("V4SubNets", FW_IPV4_SUBNET_LIST(), FW_IPV4_SUBNET_LIST),
        NDRPacketField("V4Ranges", FW_IPV4_RANGE_LIST(), FW_IPV4_RANGE_LIST),
        NDRPacketField("V6SubNets", FW_IPV6_SUBNET_LIST(), FW_IPV6_SUBNET_LIST),
        NDRPacketField("V6Ranges", FW_IPV6_RANGE_LIST(), FW_IPV6_RANGE_LIST),
    ]


class GUID(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("Data1", 0),
        NDRShortField("Data2", 0),
        NDRShortField("Data3", 0),
        StrFixedLenField("Data4", "", length=8),
    ]


class FW_INTERFACE_LUIDS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumLUIDs", None, size_of="pLUIDs"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pLUIDs", [], GUID, size_is=lambda pkt: pkt.dwNumLUIDs
            ),
            deferred=True,
        ),
    ]


class FW_RULE_ACTION(IntEnum):
    FW_RULE_ACTION_INVALID = 0
    FW_RULE_ACTION_ALLOW_BYPASS = 1
    FW_RULE_ACTION_BLOCK = 2
    FW_RULE_ACTION_ALLOW = 3
    FW_RULE_ACTION_MAX = 4


class PFW_OS_PLATFORM(NDRPacket):
    fields_desc = [
        NDRByteField("bPlatform", 0),
        NDRByteField("bMajorVersion", 0),
        NDRByteField("bMinorVersion", 0),
        NDRByteField("Reserved", 0),
    ]


class FW_OS_PLATFORM_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="pPlatforms"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pPlatforms",
                [PFW_OS_PLATFORM()],
                PFW_OS_PLATFORM,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class FW_RULE_STATUS(IntEnum):
    FW_RULE_STATUS_OK = 65536
    FW_RULE_STATUS_PARTIALLY_IGNORED = 131072
    FW_RULE_STATUS_IGNORED = 262144
    FW_RULE_STATUS_PARSING_ERROR = 524288
    FW_RULE_STATUS_PARSING_ERROR_NAME = 524289
    FW_RULE_STATUS_PARSING_ERROR_DESC = 524290
    FW_RULE_STATUS_PARSING_ERROR_APP = 524291
    FW_RULE_STATUS_PARSING_ERROR_SVC = 524292
    FW_RULE_STATUS_PARSING_ERROR_RMA = 524293
    FW_RULE_STATUS_PARSING_ERROR_RUA = 524294
    FW_RULE_STATUS_PARSING_ERROR_EMBD = 524295
    FW_RULE_STATUS_PARSING_ERROR_RULE_ID = 524296
    FW_RULE_STATUS_PARSING_ERROR_PHASE1_AUTH = 524297
    FW_RULE_STATUS_PARSING_ERROR_PHASE2_CRYPTO = 524298
    FW_RULE_STATUS_PARSING_ERROR_PHASE2_AUTH = 524299
    FW_RULE_STATUS_PARSING_ERROR_RESOLVE_APP = 524300
    FW_RULE_STATUS_PARSING_ERROR_MAINMODE_ID = 524301
    FW_RULE_STATUS_PARSING_ERROR_PHASE1_CRYPTO = 524302
    FW_RULE_STATUS_PARSING_ERROR_REMOTE_ENDPOINTS = 524303
    FW_RULE_STATUS_PARSING_ERROR_REMOTE_ENDPOINT_FQDN = 524304
    FW_RULE_STATUS_PARSING_ERROR_KEY_MODULE = 524305
    FW_RULE_STATUS_PARSING_ERROR_LUA = 524306
    FW_RULE_STATUS_PARSING_ERROR_FWD_LIFETIME = 524307
    FW_RULE_STATUS_PARSING_ERROR_TRANSPORT_MACHINE_AUTHZ_SDDL = 524308
    FW_RULE_STATUS_PARSING_ERROR_TRANSPORT_USER_AUTHZ_SDDL = 524309
    FW_RULE_STATUS_PARSING_ERROR_NETNAMES_STRING = 524310
    FW_RULE_STATUS_PARSING_ERROR_SECURITY_REALM_ID_STRING = 524311
    FW_RULE_STATUS_PARSING_ERROR_FQBN_STRING = 524312
    FW_RULE_STATUS_SEMANTIC_ERROR = 1048576
    FW_RULE_STATUS_SEMANTIC_ERROR_RULE_ID = 1048592
    FW_RULE_STATUS_SEMANTIC_ERROR_PORTS = 1048608
    FW_RULE_STATUS_SEMANTIC_ERROR_PORT_KEYW = 1048609
    FW_RULE_STATUS_SEMANTIC_ERROR_PORT_RANGE = 1048610
    FW_RULE_STATUS_SEMANTIC_ERROR_PORTRANGE_RESTRICTION = 1048611
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_V4_SUBNETS = 1048640
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_V6_SUBNETS = 1048641
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_V4_RANGES = 1048642
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_V6_RANGES = 1048643
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_RANGE = 1048644
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_MASK = 1048645
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_PREFIX = 1048646
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_KEYW = 1048647
    FW_RULE_STATUS_SEMANTIC_ERROR_LADDR_PROP = 1048648
    FW_RULE_STATUS_SEMANTIC_ERROR_RADDR_PROP = 1048649
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_V6 = 1048650
    FW_RULE_STATUS_SEMANTIC_ERROR_LADDR_INTF = 1048651
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_V4 = 1048652
    FW_RULE_STATUS_SEMANTIC_ERROR_TUNNEL_ENDPOINT_ADDR = 1048653
    FW_RULE_STATUS_SEMANTIC_ERROR_DTE_VER = 1048654
    FW_RULE_STATUS_SEMANTIC_ERROR_DTE_MISMATCH_ADDR = 1048655
    FW_RULE_STATUS_SEMANTIC_ERROR_PROFILE = 1048656
    FW_RULE_STATUS_SEMANTIC_ERROR_ICMP = 1048672
    FW_RULE_STATUS_SEMANTIC_ERROR_ICMP_CODE = 1048673
    FW_RULE_STATUS_SEMANTIC_ERROR_IF_ID = 1048688
    FW_RULE_STATUS_SEMANTIC_ERROR_IF_TYPE = 1048689
    FW_RULE_STATUS_SEMANTIC_ERROR_ACTION = 1048704
    FW_RULE_STATUS_SEMANTIC_ERROR_ALLOW_BYPASS = 1048705
    FW_RULE_STATUS_SEMANTIC_ERROR_DO_NOT_SECURE = 1048706
    FW_RULE_STATUS_SEMANTIC_ERROR_ACTION_BLOCK_IS_ENCRYPTED_SECURE = 1048707
    FW_RULE_STATUS_SEMANTIC_ERROR_INCOMPATIBLE_FLAG_OR_ACTION_WITH_SECURITY_REALM = (
        1048708
    )
    FW_RULE_STATUS_SEMANTIC_ERROR_DIR = 1048720
    FW_RULE_STATUS_SEMANTIC_ERROR_PROT = 1048736
    FW_RULE_STATUS_SEMANTIC_ERROR_PROT_PROP = 1048737
    FW_RULE_STATUS_SEMANTIC_ERROR_DEFER_EDGE_PROP = 1048738
    FW_RULE_STATUS_SEMANTIC_ERROR_ALLOW_BYPASS_OUTBOUND = 1048739
    FW_RULE_STATUS_SEMANTIC_ERROR_DEFER_USER_INVALID_RULE = 1048740
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS = 1048752
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTO_AUTH = 1048753
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTO_BLOCK = 1048754
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTO_DYN_RPC = 1048755
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTHENTICATE_ENCRYPT = 1048756
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTH_WITH_ENC_NEGOTIATE_VER = 1048757
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTH_WITH_ENC_NEGOTIATE = 1048758
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_ESP_NO_ENCAP_VER = 1048759
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_ESP_NO_ENCAP = 1048760
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_TUNNEL_AUTH_MODES_VER = 1048761
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_TUNNEL_AUTH_MODES = 1048762
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_IP_HTTPS_VER = 1048763
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_IP_TLS_VER = 1048763
    FW_RULE_STATUS_SEMANTIC_ERROR_PORTRANGE_VER = 1048764
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_ADDRS_TRAVERSE_DEFER_VER = 1048765
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTH_WITH_ENC_NEGOTIATE_OUTBOUND = 1048766
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_AUTHENTICATE_WITH_OUTBOUND_BYPASS_VER = 1048767
    FW_RULE_STATUS_SEMANTIC_ERROR_REMOTE_AUTH_LIST = 1048768
    FW_RULE_STATUS_SEMANTIC_ERROR_REMOTE_USER_LIST = 1048769
    FW_RULE_STATUS_SEMANTIC_ERROR_LOCAL_USER_LIST = 1048770
    FW_RULE_STATUS_SEMANTIC_ERROR_LUA_VER = 1048771
    FW_RULE_STATUS_SEMANTIC_ERROR_LOCAL_USER_OWNER = 1048772
    FW_RULE_STATUS_SEMANTIC_ERROR_LOCAL_USER_OWNER_VER = 1048773
    FW_RULE_STATUS_SEMANTIC_ERROR_LUA_CONDITIONAL_VER = 1048774
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_SYSTEMOS_GAMEOS = 1048775
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_CORTANA_VER = 1048776
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_REMOTENAME = 1048777
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_ALLOW_PROFILE_CROSSING_VER = 1048784
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_LOCAL_ONLY_MAPPED_VER = 1048785
    FW_RULE_STATUS_SEMANTIC_ERROR_PLATFORM = 1048800
    FW_RULE_STATUS_SEMANTIC_ERROR_PLATFORM_OP_VER = 1048801
    FW_RULE_STATUS_SEMANTIC_ERROR_PLATFORM_OP = 1048802
    FW_RULE_STATUS_SEMANTIC_ERROR_DTE_NOANY_ADDR = 1048816
    FW_RULE_STATUS_SEMANTIC_ERROR_TUNNEL_EXEMPT_WITH_GATEWAY = 1048817
    FW_RULE_STATUS_SEMANTIC_ERROR_TUNNEL_EXEMPT_VER = 1048818
    FW_RULE_STATUS_SEMANTIC_ERROR_ADDR_KEYWORD_VER = 1048819
    FW_RULE_STATUS_SEMANTIC_ERROR_KEY_MODULE_VER = 1048820
    FW_RULE_STATUS_SEMANTIC_ERROR_APP_CONTAINER_PACKAGE_ID = 1048832
    FW_RULE_STATUS_SEMANTIC_ERROR_APP_CONTAINER_PACKAGE_ID_VER = 1048833
    FW_RULE_STATUS_SEMANTIC_ERROR_TRUST_TUPLE_KEYWORD_INCOMPATIBLE = 1049088
    FW_RULE_STATUS_SEMANTIC_ERROR_TRUST_TUPLE_KEYWORD_INVALID = 1049089
    FW_RULE_STATUS_SEMANTIC_ERROR_TRUST_TUPLE_KEYWORD_VER = 1049090
    FW_RULE_STATUS_SEMANTIC_ERROR_INTERFACE_TYPES_VER = 1049345
    FW_RULE_STATUS_SEMANTIC_ERROR_NETNAMES_VER = 1049601
    FW_RULE_STATUS_SEMANTIC_ERROR_SECURITY_REALM_ID_VER = 1049602
    FW_RULE_STATUS_SEMANTIC_ERROR_SYSTEMOS_GAMEOS_VER = 1049603
    FW_RULE_STATUS_SEMANTIC_ERROR_DEVMODE_VER = 1049604
    FW_RULE_STATUS_SEMANTIC_ERROR_REMOTE_SERVERNAME_VER = 1049605
    FW_RULE_STATUS_SEMANTIC_ERROR_FQBN_VER = 1049606
    FW_RULE_STATUS_SEMANTIC_ERROR_COMPARTMENT_ID_VER = 1049607
    FW_RULE_STATUS_SEMANTIC_ERROR_CALLOUT_AND_AUDIT_VER = 1049608
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_AUTH_SET_ID = 1049856
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_SET_ID = 1049872
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_SET_ID = 1049873
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_KEY_MANAGER_DICTATE_VER = 1049874
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_KEY_MANAGER_NOTIFY_VER = 1049875
    FW_RULE_STATUS_SEMANTIC_ERROR_TRANSPORT_MACHINE_AUTHZ_VER = 1049876
    FW_RULE_STATUS_SEMANTIC_ERROR_TRANSPORT_USER_AUTHZ_VER = 1049877
    FW_RULE_STATUS_SEMANTIC_ERROR_TRANSPORT_MACHINE_AUTHZ_ON_TUNNEL = 1049878
    FW_RULE_STATUS_SEMANTIC_ERROR_TRANSPORT_USER_AUTHZ_ON_TUNNEL = 1049879
    FW_RULE_STATUS_SEMANTIC_ERROR_PER_RULE_AND_GLOBAL_AUTHZ = 1049880
    FW_RULE_STATUS_SEMANTIC_ERROR_FLAGS_SECURITY_REALM = 1049881
    FW_RULE_STATUS_SEMANTIC_ERROR_SET_ID = 1052672
    FW_RULE_STATUS_SEMANTIC_ERROR_IPSEC_PHASE = 1052688
    FW_RULE_STATUS_SEMANTIC_ERROR_EMPTY_SUITES = 1052704
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_AUTH_METHOD = 1052720
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_AUTH_METHOD = 1052721
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_METHOD_ANONYMOUS = 1052722
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_METHOD_DUPLICATE = 1052723
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_METHOD_VER = 1052724
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_SUITE_FLAGS = 1052736
    FW_RULE_STATUS_SEMANTIC_ERROR_HEALTH_CERT = 1052737
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_SIGNCERT_VER = 1052738
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_INTERMEDIATE_CA_VER = 1052739
    FW_RULE_STATUS_SEMANTIC_ERROR_MACHINE_SHKEY = 1052752
    FW_RULE_STATUS_SEMANTIC_ERROR_CA_NAME = 1052768
    FW_RULE_STATUS_SEMANTIC_ERROR_MIXED_CERTS = 1052769
    FW_RULE_STATUS_SEMANTIC_ERROR_NON_CONTIGUOUS_CERTS = 1052770
    FW_RULE_STATUS_SEMANTIC_ERROR_MIXED_CA_TYPE_IN_BLOCK = 1052771
    FW_RULE_STATUS_SEMANTIC_ERROR_MACHINE_USER_AUTH = 1052784
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_VER = 1052785
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_VER_MISMATCH = 1052786
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_RENEWAL_HASH = 1052787
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_INVALID_HASH = 1052788
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_INVALID_EKU = 1052789
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_INVALID_NAME_TYPE = 1052790
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_INVALID_NAME = 1052791
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_INVALID_CRITERIA_TYPE = 1052792
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_CERT_CRITERIA_MISSING_CRITERIA = 1052793
    FW_RULE_STATUS_SEMANTIC_ERROR_PROXY_SERVER = 1052800
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_PROXY_SERVER_VER = 1052801
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_NON_DEFAULT_ID = 1069056
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_FLAGS = 1069057
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_TIMEOUT_MINUTES = 1069058
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_TIMEOUT_SESSIONS = 1069059
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_KEY_EXCHANGE = 1069060
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_ENCRYPTION = 1069061
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_HASH = 1069062
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_ENCRYPTION_VER = 1069063
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_HASH_VER = 1069064
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE1_CRYPTO_KEY_EXCH_VER = 1069065
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_PFS = 1069088
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_PROTOCOL = 1069089
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_ENCRYPTION = 1069090
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_HASH = 1069091
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_TIMEOUT_MINUTES = 1069092
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_TIMEOUT_KBYTES = 1069093
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_ENCRYPTION_VER = 1069094
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_HASH_VER = 1069095
    FW_RULE_STATUS_SEMANTIC_ERROR_PHASE2_CRYPTO_PFS_VER = 1069096
    FW_RULE_STATUS_SEMANTIC_ERROR_CRYPTO_ENCR_HASH = 1069120
    FW_RULE_STATUS_SEMANTIC_ERROR_CRYPTO_ENCR_HASH_COMPAT = 1069121
    FW_RULE_STATUS_SEMANTIC_ERROR_SCHEMA_VERSION = 1069136
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_OR_AND_CONDITIONS = 1073152
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_AND_CONDITIONS = 1073153
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_CONDITION_KEY = 1073154
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_CONDITION_MATCH_TYPE = 1073155
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_CONDITION_DATA_TYPE = 1073156
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_CONDITION_KEY_AND_DATA_TYPE = 1073157
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEYS_PROTOCOL_PORT = 1073158
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_PROFILE = 1073159
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_STATUS = 1073160
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_FILTERID = 1073161
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_APP_PATH = 1073168
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_PROTOCOL = 1073169
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_LOCAL_PORT = 1073170
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_REMOTE_PORT = 1073171
    FW_RULE_STATUS_SEMANTIC_ERROR_QUERY_KEY_SVC_NAME = 1073173
    FW_RULE_STATUS_SEMANTIC_ERROR_REQUIRE_IN_CLEAR_OUT_ON_TRANSPORT = 1077248
    FW_RULE_STATUS_SEMANTIC_ERROR_BYPASS_TUNNEL_IF_SECURE_ON_TRANSPORT = 1077249
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_NOENCAP_ON_TUNNEL = 1077250
    FW_RULE_STATUS_SEMANTIC_ERROR_AUTH_NOENCAP_ON_PSK = 1077251
    FW_RULE_STATUS_RUNTIME_ERROR = 2097152
    FW_RULE_STATUS_RUNTIME_ERROR_PHASE1_AUTH_NOT_FOUND = 2097153
    FW_RULE_STATUS_RUNTIME_ERROR_PHASE2_AUTH_NOT_FOUND = 2097154
    FW_RULE_STATUS_RUNTIME_ERROR_PHASE2_CRYPTO_NOT_FOUND = 2097155
    FW_RULE_STATUS_RUNTIME_ERROR_AUTH_MCHN_SHKEY_MISMATCH = 2097156
    FW_RULE_STATUS_RUNTIME_ERROR_PHASE1_CRYPTO_NOT_FOUND = 2097157
    FW_RULE_STATUS_RUNTIME_ERROR_AUTH_NOENCAP_ON_TUNNEL = 2097158
    FW_RULE_STATUS_RUNTIME_ERROR_AUTH_NOENCAP_ON_PSK = 2097159
    FW_RULE_STATUS_RUNTIME_ERROR_KEY_MODULE_AUTH_MISMATCH = 2097160
    FW_RULE_STATUS_ERROR = (
        FW_RULE_STATUS_PARSING_ERROR | FW_RULE_STATUS_SEMANTIC_ERROR
    ) | FW_RULE_STATUS_RUNTIME_ERROR
    FW_RULE_STATUS_ALL = 4294901760


class FW_RULE_ORIGIN_TYPE(IntEnum):
    FW_RULE_ORIGIN_INVALID = 1
    FW_RULE_ORIGIN_LOCAL = 2
    FW_RULE_ORIGIN_GP = 3
    FW_RULE_ORIGIN_DYNAMIC = 4
    FW_RULE_ORIGIN_AUTOGEN = 5
    FW_RULE_ORIGIN_HARDCODED = 6
    FW_RULE_ORIGIN_MAX = 7


class PFW_RULE2_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
    ]


class RRPC_FWAddFirewallRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_0(), PFW_RULE2_0),
    ]


class RRPC_FWAddFirewallRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWSetFirewallRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_0(), PFW_RULE2_0),
    ]


class RRPC_FWSetFirewallRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteFirewallRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("wszRuleID", ""),
    ]


class RRPC_FWDeleteFirewallRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteAllFirewallRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWDeleteAllFirewallRules_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWEnumFirewallRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_0(), PFW_RULE2_0)),
        NDRIntField("status", 0),
    ]


class FW_PROFILE_CONFIG(IntEnum):
    FW_PROFILE_CONFIG_INVALID = 1
    FW_PROFILE_CONFIG_ENABLE_FW = 2
    FW_PROFILE_CONFIG_DISABLE_STEALTH_MODE = 3
    FW_PROFILE_CONFIG_SHIELDED = 4
    FW_PROFILE_CONFIG_DISABLE_UNICAST_RESPONSES_TO_MULTICAST_BROADCAST = 5
    FW_PROFILE_CONFIG_LOG_DROPPED_PACKETS = 6
    FW_PROFILE_CONFIG_LOG_SUCCESS_CONNECTIONS = 7
    FW_PROFILE_CONFIG_LOG_IGNORED_RULES = 8
    FW_PROFILE_CONFIG_LOG_MAX_FILE_SIZE = 9
    FW_PROFILE_CONFIG_LOG_FILE_PATH = 10
    FW_PROFILE_CONFIG_DISABLE_INBOUND_NOTIFICATIONS = 11
    FW_PROFILE_CONFIG_AUTH_APPS_ALLOW_USER_PREF_MERGE = 12
    FW_PROFILE_CONFIG_GLOBAL_PORTS_ALLOW_USER_PREF_MERGE = 13
    FW_PROFILE_CONFIG_ALLOW_LOCAL_POLICY_MERGE = 14
    FW_PROFILE_CONFIG_ALLOW_LOCAL_IPSEC_POLICY_MERGE = 15
    FW_PROFILE_CONFIG_DISABLED_INTERFACES = 16
    FW_PROFILE_CONFIG_DEFAULT_OUTBOUND_ACTION = 17
    FW_PROFILE_CONFIG_DEFAULT_INBOUND_ACTION = 18
    FW_PROFILE_CONFIG_DISABLE_STEALTH_MODE_IPSEC_SECURED_PACKET_EXEMPTION = 19
    FW_PROFILE_CONFIG_MAX = 20


class FW_PROFILE_TYPE(IntEnum):
    FW_PROFILE_TYPE_INVALID = 0
    FW_PROFILE_TYPE_DOMAIN = 1
    FW_PROFILE_TYPE_STANDARD = 2
    FW_PROFILE_TYPE_PRIVATE = FW_PROFILE_TYPE_STANDARD
    FW_PROFILE_TYPE_PUBLIC = 4
    FW_PROFILE_TYPE_ALL = 2147483647
    FW_PROFILE_TYPE_CURRENT = 2147483648
    FW_PROFILE_TYPE_NONE = FW_PROFILE_TYPE_CURRENT + 1


class RRPC_FWGetConfig_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("configID", 0, FW_PROFILE_CONFIG),
        NDRIntEnumField("Profile", 0, FW_PROFILE_TYPE),
        NDRIntField("dwFlags", 0),
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("cbData", None, size_of="pBuffer"),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
    ]


class RRPC_FWGetConfig_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
        NDRIntField("pcbRequired", 0),
        NDRIntField("status", 0),
    ]


class PFW_INTERFACE_LUIDS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumLUIDs", None, size_of="pLUIDs"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pLUIDs", [], GUID, size_is=lambda pkt: pkt.dwNumLUIDs
            ),
            deferred=True,
        ),
    ]


class RRPC_FWSetConfig_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("configID", 0, FW_PROFILE_CONFIG),
        NDRIntEnumField("Profile", 0, FW_PROFILE_TYPE),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pConfig", "")),
                    (
                        (
                            lambda pkt: getattr(pkt, "configID", None)
                            == FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_FILE_PATH
                        ),
                        (
                            lambda _, val: val.tag
                            == FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_FILE_PATH
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "pConfig", PFW_INTERFACE_LUIDS(), PFW_INTERFACE_LUIDS
                        )
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "configID", None)
                            == FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLED_INTERFACES
                        ),
                        (
                            lambda _, val: val.tag
                            == FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLED_INTERFACES
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRIntField("pConfig", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "configID", None)
                            in [
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_ENABLE_FW,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_STEALTH_MODE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_SHIELDED,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_UNICAST_RESPONSES_TO_MULTICAST_BROADCAST,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_DROPPED_PACKETS,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_SUCCESS_CONNECTIONS,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_IGNORED_RULES,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_MAX_FILE_SIZE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_INBOUND_NOTIFICATIONS,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_AUTH_APPS_ALLOW_USER_PREF_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_GLOBAL_PORTS_ALLOW_USER_PREF_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_ALLOW_LOCAL_POLICY_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_ALLOW_LOCAL_IPSEC_POLICY_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DEFAULT_OUTBOUND_ACTION,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DEFAULT_INBOUND_ACTION,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_STEALTH_MODE_IPSEC_SECURED_PACKET_EXEMPTION,
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_ENABLE_FW,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_STEALTH_MODE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_SHIELDED,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_UNICAST_RESPONSES_TO_MULTICAST_BROADCAST,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_DROPPED_PACKETS,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_SUCCESS_CONNECTIONS,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_IGNORED_RULES,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_LOG_MAX_FILE_SIZE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_INBOUND_NOTIFICATIONS,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_AUTH_APPS_ALLOW_USER_PREF_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_GLOBAL_PORTS_ALLOW_USER_PREF_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_ALLOW_LOCAL_POLICY_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_ALLOW_LOCAL_IPSEC_POLICY_MERGE,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DEFAULT_OUTBOUND_ACTION,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DEFAULT_INBOUND_ACTION,
                                FW_PROFILE_CONFIG.FW_PROFILE_CONFIG_DISABLE_STEALTH_MODE_IPSEC_SECURED_PACKET_EXEMPTION,
                            ]
                        ),
                    ),
                ),
            ],
            StrFixedLenField("pConfig", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
        NDRIntField("dwBufSize", 0),
    ]


class RRPC_FWSetConfig_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class FW_CS_RULE_ACTION(IntEnum):
    FW_CS_RULE_ACTION_INVALID = 1
    FW_CS_RULE_ACTION_SECURE_SERVER = 2
    FW_CS_RULE_ACTION_BOUNDARY = 3
    FW_CS_RULE_ACTION_SECURE = 4
    FW_CS_RULE_ACTION_DO_NOT_SECURE = 5
    FW_CS_RULE_ACTION_MAX = 6


class PFW_CS_RULE2_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRPacketField("Endpoint1", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("Endpoint2", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRIntField("dwLocalTunnelEndpointV4", 0),
        StrFixedLenField("LocalTunnelEndpointV6", "", length=16),
        NDRIntField("dwRemoteTunnelEndpointV4", 0),
        StrFixedLenField("RemoteTunnelEndpointV6", "", length=16),
        NDRPacketField("Endpoint1Ports", FW_PORTS(), FW_PORTS),
        NDRPacketField("Endpoint2Ports", FW_PORTS(), FW_PORTS),
        NDRShortField("wIpProtocol", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase1AuthSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase2CryptoSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase2AuthSet", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_CS_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
    ]


class RRPC_FWAddConnectionSecurityRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_CS_RULE2_0(), PFW_CS_RULE2_0),
    ]


class RRPC_FWAddConnectionSecurityRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWSetConnectionSecurityRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_CS_RULE2_0(), PFW_CS_RULE2_0),
    ]


class RRPC_FWSetConnectionSecurityRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteConnectionSecurityRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("pRuleId", ""),
    ]


class RRPC_FWDeleteConnectionSecurityRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteAllConnectionSecurityRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWDeleteAllConnectionSecurityRules_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWEnumConnectionSecurityRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumConnectionSecurityRules_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(
            NDRPacketField("ppRules", PFW_CS_RULE2_0(), PFW_CS_RULE2_0)
        ),
        NDRIntField("status", 0),
    ]


class FW_IPSEC_PHASE(IntEnum):
    FW_IPSEC_PHASE_INVALID = 1
    FW_IPSEC_PHASE_1 = 2
    FW_IPSEC_PHASE_2 = 3
    FW_IPSEC_PHASE_MAX = 4


class FW_AUTH_METHOD(IntEnum):
    FW_AUTH_METHOD_INVALID = 1
    FW_AUTH_METHOD_ANONYMOUS = 2
    FW_AUTH_METHOD_MACHINE_KERB = 3
    FW_AUTH_METHOD_MACHINE_SHKEY = 4
    FW_AUTH_METHOD_MACHINE_NTLM = 5
    FW_AUTH_METHOD_MACHINE_CERT = 6
    FW_AUTH_METHOD_USER_KERB = 7
    FW_AUTH_METHOD_USER_CERT = 8
    FW_AUTH_METHOD_USER_NTLM = 9
    FW_AUTH_METHOD_MACHINE_RESERVED = 10
    FW_AUTH_METHOD_USER_RESERVED = 11
    FW_AUTH_METHOD_MAX = 12
    FW_AUTH_METHOD_MAX_2_10 = FW_AUTH_METHOD_USER_NTLM + 1


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszCAName", ""), deferred=True
        )
    ]


class u_sub1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszSHKey", ""), deferred=True
        )
    ]


class PFW_AUTH_SUITE2_10(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("Method", 0, FW_AUTH_METHOD),
        NDRShortField("wFlags", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Method", None)
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_CERT,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_CERT,
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_CERT,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_CERT,
                            ]
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", u_sub1(), u_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "Method", None)
                            == FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_SHKEY
                        ),
                        (
                            lambda _, val: val.tag
                            == FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_SHKEY
                        ),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class PFW_AUTH_SET2_10(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszSetId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRIntField("dwNumSuites", None, size_of="pSuites"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pSuites",
                [PFW_AUTH_SUITE2_10()],
                PFW_AUTH_SUITE2_10,
                size_is=lambda pkt: pkt.dwNumSuites,
            ),
            deferred=True,
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRIntField("dwAuthSetFlags", 0),
    ]


class RRPC_FWAddAuthenticationSet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pAuth", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10),
    ]


class RRPC_FWAddAuthenticationSet_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWSetAuthenticationSet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pAuth", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10),
    ]


class RRPC_FWSetAuthenticationSet_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteAuthenticationSet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRConfVarStrNullFieldUtf16("wszSetId", ""),
    ]


class RRPC_FWDeleteAuthenticationSet_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteAllAuthenticationSets_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
    ]


class RRPC_FWDeleteAllAuthenticationSets_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWEnumAuthenticationSets_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRIntField("dwFilteredByStatus", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumAuthenticationSets_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumAuthSets", 0),
        NDRFullPointerField(
            NDRPacketField("ppAuth", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10)
        ),
        NDRIntField("status", 0),
    ]


class FW_CRYPTO_KEY_EXCHANGE_TYPE(IntEnum):
    FW_CRYPTO_KEY_EXCHANGE_NONE = 0
    FW_CRYPTO_KEY_EXCHANGE_DH1 = 1
    FW_CRYPTO_KEY_EXCHANGE_DH2 = 2
    FW_CRYPTO_KEY_EXCHANGE_ECDH256 = 3
    FW_CRYPTO_KEY_EXCHANGE_ECDH384 = 4
    FW_CRYPTO_KEY_EXCHANGE_DH2048 = 5
    FW_CRYPTO_KEY_EXCHANGE_DH24 = 6
    FW_CRYPTO_KEY_EXCHANGE_MAX = 7
    FW_CRYPTO_KEY_EXCHANGE_DH14 = FW_CRYPTO_KEY_EXCHANGE_DH2048
    FW_CRYPTO_KEY_EXCHANGE_MAX_V2_10 = FW_CRYPTO_KEY_EXCHANGE_DH24


class FW_CRYPTO_ENCRYPTION_TYPE(IntEnum):
    FW_CRYPTO_ENCRYPTION_NONE = 1
    FW_CRYPTO_ENCRYPTION_DES = 2
    FW_CRYPTO_ENCRYPTION_3DES = 3
    FW_CRYPTO_ENCRYPTION_AES128 = 4
    FW_CRYPTO_ENCRYPTION_AES192 = 5
    FW_CRYPTO_ENCRYPTION_AES256 = 6
    FW_CRYPTO_ENCRYPTION_AES_GCM128 = 7
    FW_CRYPTO_ENCRYPTION_AES_GCM192 = 8
    FW_CRYPTO_ENCRYPTION_AES_GCM256 = 9
    FW_CRYPTO_ENCRYPTION_MAX = 10
    FW_CRYPTO_ENCRYPTION_MAX_V2_0 = FW_CRYPTO_ENCRYPTION_AES_GCM128


class FW_CRYPTO_HASH_TYPE(IntEnum):
    FW_CRYPTO_HASH_NONE = 1
    FW_CRYPTO_HASH_MD5 = 2
    FW_CRYPTO_HASH_SHA1 = 3
    FW_CRYPTO_HASH_SHA256 = 4
    FW_CRYPTO_HASH_SHA384 = 5
    FW_CRYPTO_HASH_AES_GMAC128 = 6
    FW_CRYPTO_HASH_AES_GMAC192 = 7
    FW_CRYPTO_HASH_AES_GMAC256 = 8
    FW_CRYPTO_HASH_MAX = 9
    FW_CRYPTO_HASH_MAX_V2_0 = FW_CRYPTO_HASH_SHA256


class PFW_PHASE1_CRYPTO_SUITE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRInt3264EnumField("KeyExchange", 0, FW_CRYPTO_KEY_EXCHANGE_TYPE),
        NDRInt3264EnumField("Encryption", 0, FW_CRYPTO_ENCRYPTION_TYPE),
        NDRInt3264EnumField("Hash", 0, FW_CRYPTO_HASH_TYPE),
        NDRIntField("dwP1CryptoSuiteFlags", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("wFlags", 0),
        NDRIntField("dwNumPhase1Suites", None, size_of="pPhase1Suites"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pPhase1Suites",
                [PFW_PHASE1_CRYPTO_SUITE()],
                PFW_PHASE1_CRYPTO_SUITE,
                size_is=lambda pkt: pkt.dwNumPhase1Suites,
            ),
            deferred=True,
        ),
        NDRIntField("dwTimeOutMinutes", 0),
        NDRIntField("dwTimeOutSessions", 0),
    ]


class FW_PHASE2_CRYPTO_PFS(IntEnum):
    FW_PHASE2_CRYPTO_PFS_INVALID = 1
    FW_PHASE2_CRYPTO_PFS_DISABLE = 2
    FW_PHASE2_CRYPTO_PFS_PHASE1 = 3
    FW_PHASE2_CRYPTO_PFS_DH1 = 4
    FW_PHASE2_CRYPTO_PFS_DH2 = 5
    FW_PHASE2_CRYPTO_PFS_DH2048 = 6
    FW_PHASE2_CRYPTO_PFS_ECDH256 = 7
    FW_PHASE2_CRYPTO_PFS_ECDH384 = 8
    FW_PHASE2_CRYPTO_PFS_DH24 = 9
    FW_PHASE2_CRYPTO_PFS_MAX = 10
    FW_PHASE2_CRYPTO_PFS_MAX_V2_10 = FW_PHASE2_CRYPTO_PFS_DH24


class FW_CRYPTO_PROTOCOL_TYPE(IntEnum):
    FW_CRYPTO_PROTOCOL_INVALID = 1
    FW_CRYPTO_PROTOCOL_AH = 2
    FW_CRYPTO_PROTOCOL_ESP = 3
    FW_CRYPTO_PROTOCOL_BOTH = 4
    FW_CRYPTO_PROTOCOL_AUTH_NO_ENCAP = 5
    FW_CRYPTO_PROTOCOL_MAX = 6
    FW_CRYPTO_PROTOCOL_MAX_2_1 = FW_CRYPTO_PROTOCOL_BOTH + 1


class PFW_PHASE2_CRYPTO_SUITE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRInt3264EnumField("Protocol", 0, FW_CRYPTO_PROTOCOL_TYPE),
        NDRInt3264EnumField("AhHash", 0, FW_CRYPTO_HASH_TYPE),
        NDRInt3264EnumField("EspHash", 0, FW_CRYPTO_HASH_TYPE),
        NDRInt3264EnumField("Encryption", 0, FW_CRYPTO_ENCRYPTION_TYPE),
        NDRIntField("dwTimeoutMinutes", 0),
        NDRIntField("dwTimeoutKBytes", 0),
        NDRIntField("dwP2CryptoSuiteFlags", 0),
    ]


class u_sub1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("Pfs", 0, FW_PHASE2_CRYPTO_PFS),
        NDRIntField("dwNumPhase2Suites", None, size_of="pPhase2Suites"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pPhase2Suites",
                [PFW_PHASE2_CRYPTO_SUITE()],
                PFW_PHASE2_CRYPTO_SUITE,
                size_is=lambda pkt: pkt.dwNumPhase2Suites,
            ),
            deferred=True,
        ),
    ]


class PFW_CRYPTO_SET(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszSetId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "IpSecPhase", None)
                            == FW_IPSEC_PHASE.FW_IPSEC_PHASE_1
                        ),
                        (lambda _, val: val.tag == FW_IPSEC_PHASE.FW_IPSEC_PHASE_1),
                    ),
                ),
                (
                    NDRPacketField("value", u_sub1(), u_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "IpSecPhase", None)
                            == FW_IPSEC_PHASE.FW_IPSEC_PHASE_2
                        ),
                        (lambda _, val: val.tag == FW_IPSEC_PHASE.FW_IPSEC_PHASE_2),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRIntField("dwCryptoSetFlags", 0),
    ]


class RRPC_FWAddCryptoSet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pCrypto", PFW_CRYPTO_SET(), PFW_CRYPTO_SET),
    ]


class RRPC_FWAddCryptoSet_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWSetCryptoSet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pCrypto", PFW_CRYPTO_SET(), PFW_CRYPTO_SET),
    ]


class RRPC_FWSetCryptoSet_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteCryptoSet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRConfVarStrNullFieldUtf16("wszSetId", ""),
    ]


class RRPC_FWDeleteCryptoSet_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteAllCryptoSets_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
    ]


class RRPC_FWDeleteAllCryptoSets_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWEnumCryptoSets_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRIntField("dwFilteredByStatus", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumCryptoSets_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSets", 0),
        NDRFullPointerField(
            NDRPacketField("ppCryptoSets", PFW_CRYPTO_SET(), PFW_CRYPTO_SET)
        ),
        NDRIntField("status", 0),
    ]


class FW_IP_VERSION(IntEnum):
    FW_IP_VERSION_INVALID = 1
    FW_IP_VERSION_V4 = 2
    FW_IP_VERSION_V6 = 3
    FW_IP_VERSION_MAX = 4


class PFW_ENDPOINTS(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRInt3264EnumField("IpVersion", 0, FW_IP_VERSION),
        NDRIntField("dwSourceV4Address", 0),
        NDRIntField("dwDestinationV4Address", 0),
        StrFixedLenField("SourceV6Address", "", length=16),
        StrFixedLenField("DestinationV6Address", "", length=16),
    ]


class FW_PHASE1_KEY_MODULE_TYPE(IntEnum):
    FW_PHASE1_KEY_MODULE_INVALID = 1
    FW_PHASE1_KEY_MODULE_IKE = 2
    FW_PHASE1_KEY_MODULE_AUTH_IP = 3
    FW_PHASE1_KEY_MODULE_MAX = 4


class FW_ENDPOINTS(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRInt3264EnumField("IpVersion", 0, FW_IP_VERSION),
        NDRIntField("dwSourceV4Address", 0),
        NDRIntField("dwDestinationV4Address", 0),
        StrFixedLenField("SourceV6Address", "", length=16),
        StrFixedLenField("DestinationV6Address", "", length=16),
    ]


class FW_PHASE1_CRYPTO_SUITE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRInt3264EnumField("KeyExchange", 0, FW_CRYPTO_KEY_EXCHANGE_TYPE),
        NDRInt3264EnumField("Encryption", 0, FW_CRYPTO_ENCRYPTION_TYPE),
        NDRInt3264EnumField("Hash", 0, FW_CRYPTO_HASH_TYPE),
        NDRIntField("dwP1CryptoSuiteFlags", 0),
    ]


class FW_COOKIE_PAIR(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [NDRLongField("Initiator", 0), NDRLongField("Responder", 0)]


class FW_BYTE_BLOB(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwSize", None, size_of="Blob"),
        NDRFullPointerField(
            NDRConfStrLenField("Blob", "", size_is=lambda pkt: pkt.dwSize),
            deferred=True,
        ),
    ]


class FW_CERT_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("SubjectName", FW_BYTE_BLOB(), FW_BYTE_BLOB),
        NDRIntField("dwCertFlags", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("MyCert", FW_CERT_INFO(), FW_CERT_INFO),
        NDRPacketField("PeerCert", FW_CERT_INFO(), FW_CERT_INFO),
    ]


class u_sub1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszMyId", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPeerId", ""), deferred=True
        ),
    ]


class PFW_AUTH_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("AuthMethod", 0, FW_AUTH_METHOD),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "AuthMethod", None)
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_CERT,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_CERT,
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_CERT,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_CERT,
                            ]
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", u_sub1(), u_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "AuthMethod", None)
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_KERB,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_KERB,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_RESERVED,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_RESERVED,
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_KERB,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_KERB,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_RESERVED,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_RESERVED,
                            ]
                        ),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
        NDRIntField("dwAuthInfoFlags", 0),
    ]


class PFW_PHASE1_SA_DETAILS(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRLongField("SaId", 0),
        NDRInt3264EnumField("KeyModuleType", 0, FW_PHASE1_KEY_MODULE_TYPE),
        NDRPacketField("Endpoints", FW_ENDPOINTS(), FW_ENDPOINTS),
        NDRPacketField(
            "SelectedProposal", FW_PHASE1_CRYPTO_SUITE(), FW_PHASE1_CRYPTO_SUITE
        ),
        NDRIntField("dwProposalLifetimeKBytes", 0),
        NDRIntField("dwProposalLifetimeMinutes", 0),
        NDRIntField("dwProposalMaxNumPhase2", 0),
        NDRPacketField("CookiePair", FW_COOKIE_PAIR(), FW_COOKIE_PAIR),
        NDRFullPointerField(
            NDRPacketField("pFirstAuth", PFW_AUTH_INFO(), PFW_AUTH_INFO), deferred=True
        ),
        NDRFullPointerField(
            NDRPacketField("pSecondAuth", PFW_AUTH_INFO(), PFW_AUTH_INFO), deferred=True
        ),
        NDRIntField("dwP1SaFlags", 0),
    ]


class RRPC_FWEnumPhase1SAs_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRFullPointerField(
            NDRPacketField("pEndpoints", PFW_ENDPOINTS(), PFW_ENDPOINTS)
        ),
    ]


class RRPC_FWEnumPhase1SAs_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSAs", None, size_of="ppSAs"),
        NDRConfPacketListField(
            "ppSAs",
            [],
            PFW_PHASE1_SA_DETAILS,
            size_is=lambda pkt: pkt.pdwNumSAs,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class FW_PHASE2_CRYPTO_SUITE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRInt3264EnumField("Protocol", 0, FW_CRYPTO_PROTOCOL_TYPE),
        NDRInt3264EnumField("AhHash", 0, FW_CRYPTO_HASH_TYPE),
        NDRInt3264EnumField("EspHash", 0, FW_CRYPTO_HASH_TYPE),
        NDRInt3264EnumField("Encryption", 0, FW_CRYPTO_ENCRYPTION_TYPE),
        NDRIntField("dwTimeoutMinutes", 0),
        NDRIntField("dwTimeoutKBytes", 0),
        NDRIntField("dwP2CryptoSuiteFlags", 0),
    ]


class PFW_PHASE2_SA_DETAILS(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRLongField("SaId", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRPacketField("Endpoints", FW_ENDPOINTS(), FW_ENDPOINTS),
        NDRShortField("wLocalPort", 0),
        NDRShortField("wRemotePort", 0),
        NDRShortField("wIpProtocol", 0),
        NDRPacketField(
            "SelectedProposal", FW_PHASE2_CRYPTO_SUITE(), FW_PHASE2_CRYPTO_SUITE
        ),
        NDRInt3264EnumField("Pfs", 0, FW_PHASE2_CRYPTO_PFS),
        NDRPacketField("TransportFilterId", GUID(), GUID),
        NDRIntField("dwP2SaFlags", 0),
    ]


class RRPC_FWEnumPhase2SAs_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRFullPointerField(
            NDRPacketField("pEndpoints", PFW_ENDPOINTS(), PFW_ENDPOINTS)
        ),
    ]


class RRPC_FWEnumPhase2SAs_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSAs", None, size_of="ppSAs"),
        NDRConfPacketListField(
            "ppSAs",
            [],
            PFW_PHASE2_SA_DETAILS,
            size_is=lambda pkt: pkt.pdwNumSAs,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class RRPC_FWDeletePhase1SAs_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRFullPointerField(
            NDRPacketField("pEndpoints", PFW_ENDPOINTS(), PFW_ENDPOINTS)
        ),
    ]


class RRPC_FWDeletePhase1SAs_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeletePhase2SAs_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRFullPointerField(
            NDRPacketField("pEndpoints", PFW_ENDPOINTS(), PFW_ENDPOINTS)
        ),
    ]


class RRPC_FWDeletePhase2SAs_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class FW_RULE_CATEGORY(IntEnum):
    FW_RULE_CATEGORY_BOOT = 1
    FW_RULE_CATEGORY_STEALTH = 2
    FW_RULE_CATEGORY_FIREWALL = 3
    FW_RULE_CATEGORY_CONSEC = 4
    FW_RULE_CATEGORY_MAX = 5


class PFW_PRODUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwFlags", 0),
        NDRIntField("dwNumRuleCategories", None, size_of="pRuleCategories"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "pRuleCategories",
                [],
                NDRIntEnumField("pRuleCategories", 0, FW_RULE_CATEGORY),
                size_is=lambda pkt: pkt.dwNumRuleCategories,
            ),
            deferred=True,
        ),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("pszDisplayName", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("pszPathToSignedProductExe", ""), deferred=True
        ),
    ]


class RRPC_FWEnumProducts_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWEnumProducts_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumProducts", None, size_of="ppProducts"),
        NDRConfPacketListField(
            "ppProducts",
            [],
            PFW_PRODUCT,
            size_is=lambda pkt: pkt.pdwNumProducts,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class FW_ENFORCEMENT_STATE(IntEnum):
    FW_ENFORCEMENT_STATE_INVALID = 1
    FW_ENFORCEMENT_STATE_FULL = 2
    FW_ENFORCEMENT_STATE_WF_OFF_IN_PROFILE = 3
    FW_ENFORCEMENT_STATE_CATEGORY_OFF = 4
    FW_ENFORCEMENT_STATE_DISABLED_OBJECT = 5
    FW_ENFORCEMENT_STATE_INACTIVE_PROFILE = 6
    FW_ENFORCEMENT_STATE_LOCAL_ADDRESS_RESOLUTION_EMPTY = 7
    FW_ENFORCEMENT_STATE_REMOTE_ADDRESS_RESOLUTION_EMPTY = 8
    FW_ENFORCEMENT_STATE_LOCAL_PORT_RESOLUTION_EMPTY = 9
    FW_ENFORCEMENT_STATE_REMOTE_PORT_RESOLUTION_EMPTY = 10
    FW_ENFORCEMENT_STATE_INTERFACE_RESOLUTION_EMPTY = 11
    FW_ENFORCEMENT_STATE_APPLICATION_RESOLUTION_EMPTY = 12
    FW_ENFORCEMENT_STATE_REMOTE_MACHINE_EMPTY = 13
    FW_ENFORCEMENT_STATE_REMOTE_USER_EMPTY = 14
    FW_ENFORCEMENT_STATE_LOCAL_GLOBAL_OPEN_PORTS_DISALLOWED = 15
    FW_ENFORCEMENT_STATE_LOCAL_AUTHORIZED_APPLICATIONS_DISALLOWED = 16
    FW_ENFORCEMENT_STATE_LOCAL_FIREWALL_RULES_DISALLOWED = 17
    FW_ENFORCEMENT_STATE_LOCAL_CONSEC_RULES_DISALLOWED = 18
    FW_ENFORCEMENT_STATE_MISMATCHED_PLATFORM = 19
    FW_ENFORCEMENT_STATE_OPTIMIZED_OUT = 20
    FW_ENFORCEMENT_STATE_LOCAL_USER_EMPTY = 21
    FW_ENFORCEMENT_STATE_TRANSPORT_MACHINE_SD_EMPTY = 22
    FW_ENFORCEMENT_STATE_TRANSPORT_USER_SD_EMPTY = 23
    FW_ENFORCEMENT_STATE_TUPLE_RESOLUTION_EMPTY = 24
    FW_ENFORCEMENT_STATE_NETNAME_RESOLUTION_EMPTY = 25
    FW_ENFORCEMENT_STATE_MAX = 26


class PFW_OBJECT_METADATA(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRLongField("qwFilterContextID", 0),
        NDRIntField("dwNumEntries", None, size_of="pEnforcementStates"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "pEnforcementStates",
                [],
                NDRInt3264EnumField("pEnforcementStates", 0, FW_ENFORCEMENT_STATE),
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_MM_RULE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRPacketField("Endpoint1", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("Endpoint2", FW_ADDRESSES(), FW_ADDRESSES),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase1AuthSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase1CryptoSet", ""), deferred=True
        ),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
    ]


class RRPC_FWAddMainModeRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pMMRule", PFW_MM_RULE(), PFW_MM_RULE),
    ]


class RRPC_FWAddMainModeRule_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetMainModeRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pMMRule", PFW_MM_RULE(), PFW_MM_RULE),
    ]


class RRPC_FWSetMainModeRule_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWDeleteMainModeRule_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("pRuleId", ""),
    ]


class RRPC_FWDeleteMainModeRule_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWDeleteAllMainModeRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWDeleteAllMainModeRules_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RRPC_FWEnumMainModeRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumMainModeRules_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppMMRules", PFW_MM_RULE(), PFW_MM_RULE)),
        NDRIntField("status", 0),
    ]


class FW_MATCH_KEY(IntEnum):
    FW_MATCH_KEY_PROFILE = 1
    FW_MATCH_KEY_STATUS = 2
    FW_MATCH_KEY_OBJECTID = 3
    FW_MATCH_KEY_FILTERID = 4
    FW_MATCH_KEY_APP_PATH = 5
    FW_MATCH_KEY_PROTOCOL = 6
    FW_MATCH_KEY_LOCAL_PORT = 7
    FW_MATCH_KEY_REMOTE_PORT = 8
    FW_MATCH_KEY_GROUP = 9
    FW_MATCH_KEY_SVC_NAME = 10
    FW_MATCH_KEY_DIRECTION = 11
    FW_MATCH_KEY_LOCAL_USER_OWNER = 12
    FW_MATCH_KEY_PACKAGE_ID = 13
    FW_MATCH_KEY_FQBN = 14
    FW_MATCH_KEY_COMPARTMENT_ID = 15
    FW_MATCH_KEY_MAX = 16


class FW_MATCH_TYPE(IntEnum):
    FW_MATCH_TYPE_TRAFFIC_MATCH = 1
    FW_MATCH_TYPE_EQUAL = 2
    FW_MATCH_TYPE_MAX = 3


class FW_DATA_TYPE(IntEnum):
    FW_DATA_TYPE_EMPTY = 1
    FW_DATA_TYPE_UINT8 = 2
    FW_DATA_TYPE_UINT16 = 3
    FW_DATA_TYPE_UINT32 = 4
    FW_DATA_TYPE_UINT64 = 5
    FW_DATA_TYPE_UNICODE_STRING = 6


class u_sub4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszString", ""), deferred=True)
    ]


class FW_MATCH_VALUE(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRInt3264EnumField("type", 0, FW_DATA_TYPE),
        NDRUnionField(
            [
                (
                    NDRByteField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == FW_DATA_TYPE.FW_DATA_TYPE_UINT8
                        ),
                        (lambda _, val: val.tag == FW_DATA_TYPE.FW_DATA_TYPE_UINT8),
                    ),
                ),
                (
                    NDRShortField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == FW_DATA_TYPE.FW_DATA_TYPE_UINT16
                        ),
                        (lambda _, val: val.tag == FW_DATA_TYPE.FW_DATA_TYPE_UINT16),
                    ),
                ),
                (
                    NDRIntField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == FW_DATA_TYPE.FW_DATA_TYPE_UINT32
                        ),
                        (lambda _, val: val.tag == FW_DATA_TYPE.FW_DATA_TYPE_UINT32),
                    ),
                ),
                (
                    NDRLongField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == FW_DATA_TYPE.FW_DATA_TYPE_UINT64
                        ),
                        (lambda _, val: val.tag == FW_DATA_TYPE.FW_DATA_TYPE_UINT64),
                    ),
                ),
                (
                    NDRPacketField("value", u_sub4(), u_sub4),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == FW_DATA_TYPE.FW_DATA_TYPE_UNICODE_STRING
                        ),
                        (
                            lambda _, val: val.tag
                            == FW_DATA_TYPE.FW_DATA_TYPE_UNICODE_STRING
                        ),
                    ),
                ),
                (
                    StrFixedLenField("value", "", length=0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == FW_DATA_TYPE.FW_DATA_TYPE_EMPTY
                        ),
                        (lambda _, val: val.tag == FW_DATA_TYPE.FW_DATA_TYPE_EMPTY),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class FW_QUERY_CONDITION(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRInt3264EnumField("matchKey", 0, FW_MATCH_KEY),
        NDRInt3264EnumField("matchType", 0, FW_MATCH_TYPE),
        NDRPacketField("matchValue", FW_MATCH_VALUE(), FW_MATCH_VALUE),
    ]


class FW_QUERY_CONDITIONS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="AndedConditions"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "AndedConditions",
                [],
                FW_QUERY_CONDITION,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_QUERY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("wSchemaVersion", 0),
        NDRIntField("dwNumEntries", None, size_of="ORConditions"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ORConditions",
                [],
                FW_QUERY_CONDITIONS,
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class PFW_RULE2_10(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
    ]


class RRPC_FWQueryFirewallRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_10(), PFW_RULE2_10)),
        NDRIntField("status", 0),
    ]


class PFW_CS_RULE2_10(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRPacketField("Endpoint1", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("Endpoint2", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRIntField("dwLocalTunnelEndpointV4", 0),
        StrFixedLenField("LocalTunnelEndpointV6", "", length=16),
        NDRIntField("dwRemoteTunnelEndpointV4", 0),
        StrFixedLenField("RemoteTunnelEndpointV6", "", length=16),
        NDRPacketField("Endpoint1Ports", FW_PORTS(), FW_PORTS),
        NDRPacketField("Endpoint2Ports", FW_PORTS(), FW_PORTS),
        NDRShortField("wIpProtocol", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase1AuthSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase2CryptoSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase2AuthSet", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_CS_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszMMParentRuleId", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
    ]


class RRPC_FWQueryConnectionSecurityRules2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryConnectionSecurityRules2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(
            NDRPacketField("ppRules", PFW_CS_RULE2_10(), PFW_CS_RULE2_10)
        ),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryMainModeRules_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryMainModeRules_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppMMRules", PFW_MM_RULE(), PFW_MM_RULE)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryAuthenticationSets_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IPsecPhase", 0, FW_IPSEC_PHASE),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryAuthenticationSets_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSets", 0),
        NDRFullPointerField(
            NDRPacketField("ppAuthSets", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10)
        ),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryCryptoSets_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IPsecPhase", 0, FW_IPSEC_PHASE),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryCryptoSets_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSets", 0),
        NDRFullPointerField(
            NDRPacketField("ppCryptoSets", PFW_CRYPTO_SET(), PFW_CRYPTO_SET)
        ),
        NDRIntField("status", 0),
    ]


class PFW_NETWORK(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pszName", ""), deferred=True),
        NDRIntEnumField("ProfileType", 0, FW_PROFILE_TYPE),
    ]


class RRPC_FWEnumNetworks_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWEnumNetworks_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumNetworks", None, size_of="ppNetworks"),
        NDRConfPacketListField(
            "ppNetworks",
            [],
            PFW_NETWORK,
            size_is=lambda pkt: pkt.pdwNumNetworks,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class PFW_ADAPTER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("pszFriendlyName", ""), deferred=True
        ),
        NDRPacketField("Guid", GUID(), GUID),
    ]


class RRPC_FWEnumAdapters_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
    ]


class RRPC_FWEnumAdapters_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumAdapters", None, size_of="ppAdapters"),
        NDRConfPacketListField(
            "ppAdapters",
            [],
            PFW_ADAPTER,
            size_is=lambda pkt: pkt.pdwNumAdapters,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class RRPC_FWGetGlobalConfig2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRShortField("BinaryVersion", 0),
        NDRInt3264EnumField("StoreType", 0, FW_STORE_TYPE),
        NDRInt3264EnumField("configID", 0, FW_GLOBAL_CONFIG),
        NDRIntField("dwFlags", 0),
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("cbData", None, size_of="pBuffer"),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
    ]


class RRPC_FWGetGlobalConfig2_10_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
        NDRIntField("pcbRequired", 0),
        NDRInt3264EnumField("pOrigin", 0, FW_RULE_ORIGIN_TYPE),
        NDRIntField("status", 0),
    ]


class RRPC_FWGetConfig2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("configID", 0, FW_PROFILE_CONFIG),
        NDRIntEnumField("Profile", 0, FW_PROFILE_TYPE),
        NDRIntField("dwFlags", 0),
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("cbData", None, size_of="pBuffer"),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
    ]


class RRPC_FWGetConfig2_10_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "pBuffer",
            "",
            size_is=lambda pkt: pkt.cbData,
            length_is=lambda pkt: pkt.pcbTransmittedLen,
        ),
        NDRIntField("pcbTransmittedLen", None, size_of="pBuffer"),
        NDRIntField("pcbRequired", 0),
        NDRInt3264EnumField("pOrigin", 0, FW_RULE_ORIGIN_TYPE),
        NDRIntField("status", 0),
    ]


class RRPC_FWAddFirewallRule2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_10(), PFW_RULE2_10),
    ]


class RRPC_FWAddFirewallRule2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_10(), PFW_RULE2_10),
    ]


class RRPC_FWSetFirewallRule2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_10(), PFW_RULE2_10)),
        NDRIntField("status", 0),
    ]


class RRPC_FWAddConnectionSecurityRule2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_CS_RULE2_10(), PFW_CS_RULE2_10),
    ]


class RRPC_FWAddConnectionSecurityRule2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetConnectionSecurityRule2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_CS_RULE2_10(), PFW_CS_RULE2_10),
    ]


class RRPC_FWSetConnectionSecurityRule2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumConnectionSecurityRules2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumConnectionSecurityRules2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(
            NDRPacketField("ppRules", PFW_CS_RULE2_10(), PFW_CS_RULE2_10)
        ),
        NDRIntField("status", 0),
    ]


class RRPC_FWAddAuthenticationSet2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pAuth", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10),
    ]


class RRPC_FWAddAuthenticationSet2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetAuthenticationSet2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pAuth", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10),
    ]


class RRPC_FWSetAuthenticationSet2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumAuthenticationSets2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRIntField("dwFilteredByStatus", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumAuthenticationSets2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumAuthSets", 0),
        NDRFullPointerField(
            NDRPacketField("ppAuth", PFW_AUTH_SET2_10(), PFW_AUTH_SET2_10)
        ),
        NDRIntField("status", 0),
    ]


class RRPC_FWAddCryptoSet2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pCrypto", PFW_CRYPTO_SET(), PFW_CRYPTO_SET),
    ]


class RRPC_FWAddCryptoSet2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetCryptoSet2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pCrypto", PFW_CRYPTO_SET(), PFW_CRYPTO_SET),
    ]


class RRPC_FWSetCryptoSet2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumCryptoSets2_10_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRIntField("dwFilteredByStatus", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumCryptoSets2_10_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSets", 0),
        NDRFullPointerField(
            NDRPacketField("ppCryptoSets", PFW_CRYPTO_SET(), PFW_CRYPTO_SET)
        ),
        NDRIntField("status", 0),
    ]


class PFW_CS_RULE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRPacketField("Endpoint1", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("Endpoint2", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRIntField("dwLocalTunnelEndpointV4", 0),
        StrFixedLenField("LocalTunnelEndpointV6", "", length=16),
        NDRIntField("dwRemoteTunnelEndpointV4", 0),
        StrFixedLenField("RemoteTunnelEndpointV6", "", length=16),
        NDRPacketField("Endpoint1Ports", FW_PORTS(), FW_PORTS),
        NDRPacketField("Endpoint2Ports", FW_PORTS(), FW_PORTS),
        NDRShortField("wIpProtocol", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase1AuthSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase2CryptoSet", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPhase2AuthSet", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_CS_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszMMParentRuleId", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteTunnelEndpointFqdn", ""),
            deferred=True,
        ),
        NDRPacketField("RemoteTunnelEndpoints", FW_ADDRESSES(), FW_ADDRESSES),
        NDRIntField("dwKeyModules", 0),
        NDRIntField("FwdPathSALifetime", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszTransportMachineAuthzSDDL", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszTransportUserAuthzSDDL", ""), deferred=True
        ),
    ]


class RRPC_FWAddConnectionSecurityRule2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_CS_RULE(), PFW_CS_RULE),
    ]


class RRPC_FWAddConnectionSecurityRule2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetConnectionSecurityRule2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_CS_RULE(), PFW_CS_RULE),
    ]


class RRPC_FWSetConnectionSecurityRule2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumConnectionSecurityRules2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumConnectionSecurityRules2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_CS_RULE(), PFW_CS_RULE)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryConnectionSecurityRules2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryConnectionSecurityRules2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_CS_RULE(), PFW_CS_RULE)),
        NDRIntField("status", 0),
    ]


class FW_CERT_CRITERIA_TYPE(IntEnum):
    FW_CERT_CRITERIA_TYPE_BOTH = 1
    FW_CERT_CRITERIA_TYPE_SELECTION = 2
    FW_CERT_CRITERIA_TYPE_VALIDATION = 3
    FW_CERT_CRITERIA_TYPE_MAX = 4


class FW_CERT_CRITERIA_NAME_TYPE(IntEnum):
    FW_CERT_CRITERIA_NAME_NONE = 1
    FW_CERT_CRITERIA_NAME_DNS = 2
    FW_CERT_CRITERIA_NAME_UPN = 3
    FW_CERT_CRITERIA_NAME_RFC822 = 4
    FW_CERT_CRITERIA_NAME_CN = 5
    FW_CERT_CRITERIA_NAME_OU = 6
    FW_CERT_CRITERIA_NAME_O = 7
    FW_CERT_CRITERIA_NAME_DC = 8
    FW_CERT_CRITERIA_NAME_MAX = 9


class PFW_CERT_CRITERIA(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("wSchemaVersion", 0),
        NDRShortField("wFlags", 0),
        NDRInt3264EnumField("CertCriteriaType", 0, FW_CERT_CRITERIA_TYPE),
        NDRInt3264EnumField("NameType", 0, FW_CERT_CRITERIA_NAME_TYPE),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRIntField("dwNumEku", None, size_of="ppEku"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "ppEku",
                [],
                NDRFullPointerField(NDRSignedByteField("ppEku", 0), deferred=True),
                size_is=lambda pkt: pkt.dwNumEku,
            ),
            deferred=True,
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszHash", ""), deferred=True),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszCAName", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRPacketField("pCertCriteria", PFW_CERT_CRITERIA(), PFW_CERT_CRITERIA),
            deferred=True,
        ),
    ]


class u_sub1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszSHKey", ""), deferred=True
        )
    ]


class u_sub2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszProxyServer", ""), deferred=True
        )
    ]


class PFW_AUTH_SUITE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("Method", 0, FW_AUTH_METHOD),
        NDRShortField("wFlags", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Method", None)
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_CERT,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_CERT,
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_CERT,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_CERT,
                            ]
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", u_sub1(), u_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "Method", None)
                            == FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_SHKEY
                        ),
                        (
                            lambda _, val: val.tag
                            == FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_SHKEY
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", u_sub2(), u_sub2),
                    (
                        (
                            lambda pkt: getattr(pkt, "Method", None)
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_KERB,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_KERB,
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                FW_AUTH_METHOD.FW_AUTH_METHOD_MACHINE_KERB,
                                FW_AUTH_METHOD.FW_AUTH_METHOD_USER_KERB,
                            ]
                        ),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class PFW_AUTH_SET(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszSetId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRIntField("dwNumSuites", None, size_of="pSuites"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pSuites",
                [PFW_AUTH_SUITE()],
                PFW_AUTH_SUITE,
                size_is=lambda pkt: pkt.dwNumSuites,
            ),
            deferred=True,
        ),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRIntField("dwAuthSetFlags", 0),
    ]


class RRPC_FWAddAuthenticationSet2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pAuth", PFW_AUTH_SET(), PFW_AUTH_SET),
    ]


class RRPC_FWAddAuthenticationSet2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetAuthenticationSet2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pAuth", PFW_AUTH_SET(), PFW_AUTH_SET),
    ]


class RRPC_FWSetAuthenticationSet2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumAuthenticationSets2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IpSecPhase", 0, FW_IPSEC_PHASE),
        NDRIntField("dwFilteredByStatus", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumAuthenticationSets2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumAuthSets", 0),
        NDRFullPointerField(NDRPacketField("ppAuth", PFW_AUTH_SET(), PFW_AUTH_SET)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryAuthenticationSets2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRInt3264EnumField("IPsecPhase", 0, FW_IPSEC_PHASE),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryAuthenticationSets2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumSets", 0),
        NDRFullPointerField(NDRPacketField("ppAuthSets", PFW_AUTH_SET(), PFW_AUTH_SET)),
        NDRIntField("status", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class PFW_RULE2_20(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPackageId", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserOwner", ""), deferred=True
        ),
        NDRIntField("dwTrustTupleKeywords", 0),
    ]


class RRPC_FWAddFirewallRule2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_20(), PFW_RULE2_20),
    ]


class RRPC_FWAddFirewallRule2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_20(), PFW_RULE2_20),
    ]


class RRPC_FWSetFirewallRule2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_20(), PFW_RULE2_20)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryFirewallRules2_20_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules2_20_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_20(), PFW_RULE2_20)),
        NDRIntField("status", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class FW_NETWORK_NAMES(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumEntries", None, size_of="wszNames"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "wszNames",
                [],
                NDRFullPointerField(
                    NDRConfVarStrNullFieldUtf16("wszNames", ""), deferred=True
                ),
                size_is=lambda pkt: pkt.dwNumEntries,
            ),
            deferred=True,
        ),
    ]


class PFW_RULE2_24(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPackageId", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserOwner", ""), deferred=True
        ),
        NDRIntField("dwTrustTupleKeywords", 0),
        NDRPacketField("OnNetworkNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszSecurityRealmId", ""), deferred=True
        ),
    ]


class RRPC_FWAddFirewallRule2_24_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_24(), PFW_RULE2_24),
    ]


class RRPC_FWAddFirewallRule2_24_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_24_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_24(), PFW_RULE2_24),
    ]


class RRPC_FWSetFirewallRule2_24_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_24_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_24_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_24(), PFW_RULE2_24)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryFirewallRules2_24_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules2_24_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_24(), PFW_RULE2_24)),
        NDRIntField("status", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class PFW_RULE2_25(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPackageId", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserOwner", ""), deferred=True
        ),
        NDRIntField("dwTrustTupleKeywords", 0),
        NDRPacketField("OnNetworkNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszSecurityRealmId", ""), deferred=True
        ),
        NDRShortField("wFlags2", 0),
    ]


class RRPC_FWAddFirewallRule2_25_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_25(), PFW_RULE2_25),
    ]


class RRPC_FWAddFirewallRule2_25_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_25_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_25(), PFW_RULE2_25),
    ]


class RRPC_FWSetFirewallRule2_25_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_25_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_25_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_25(), PFW_RULE2_25)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryFirewallRules2_25_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules2_25_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_25(), PFW_RULE2_25)),
        NDRIntField("status", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class PFW_RULE2_26(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRShortField("wszRemoteUserAuthorizationList", 0), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPackageId", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserOwner", ""), deferred=True
        ),
        NDRIntField("dwTrustTupleKeywords", 0),
        NDRPacketField("OnNetworkNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszSecurityRealmId", ""), deferred=True
        ),
        NDRShortField("wFlags2", 0),
        NDRPacketField("RemoteOutServerNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
    ]


class RRPC_FWAddFirewallRule2_26_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_26(), PFW_RULE2_26),
    ]


class RRPC_FWAddFirewallRule2_26_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_26_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_26(), PFW_RULE2_26),
    ]


class RRPC_FWSetFirewallRule2_26_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_26_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_26_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_26(), PFW_RULE2_26)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryFirewallRules2_26_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules2_26_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_26(), PFW_RULE2_26)),
        NDRIntField("status", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class PFW_RULE2_27(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPackageId", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserOwner", ""), deferred=True
        ),
        NDRIntField("dwTrustTupleKeywords", 0),
        NDRPacketField("OnNetworkNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszSecurityRealmId", ""), deferred=True
        ),
        NDRShortField("wFlags2", 0),
        NDRPacketField("RemoteOutServerNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszFqbn", ""), deferred=True),
        NDRIntField("compartmentId", 0),
    ]


class RRPC_FWAddFirewallRule2_27_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_27(), PFW_RULE2_27),
    ]


class RRPC_FWAddFirewallRule2_27_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_27_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE2_27(), PFW_RULE2_27),
    ]


class RRPC_FWSetFirewallRule2_27_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_27_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_27_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_27(), PFW_RULE2_27)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryFirewallRules2_27_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules2_27_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE2_27(), PFW_RULE2_27)),
        NDRIntField("status", 0),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("LocalPorts", FW_PORTS(), FW_PORTS),
        NDRPacketField("RemotePorts", FW_PORTS(), FW_PORTS),
    ]


class FW_DYNAMIC_KEYWORD_ADDRESS_ID_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumIds", None, size_of="ids"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "ids", [], NDRIntField("ids", 0), size_is=lambda pkt: pkt.dwNumIds
            ),
            deferred=True,
        ),
    ]


class PFW_RULE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRRecursiveField("pNext"),
        NDRShortField("wSchemaVersion", 0),
        NDRRefEmbPointerField(
            NDRConfVarStrNullFieldUtf16("wszRuleId", ""), deferred=True
        ),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszName", ""), deferred=True),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszDescription", ""), deferred=True
        ),
        NDRIntField("dwProfiles", 0),
        NDRInt3264EnumField("Direction", 0, FW_DIRECTION),
        NDRShortField("wIpProtocol", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", u_sub0(), u_sub0),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) in [6, 17]),
                        (lambda _, val: val.tag in [6, 17]),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "value", FW_ICMP_TYPE_CODE_LIST(), FW_ICMP_TYPE_CODE_LIST
                    ),
                    (
                        (lambda pkt: getattr(pkt, "wIpProtocol", None) == 58),
                        (lambda _, val: val.tag == 58),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
        NDRPacketField("LocalAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("RemoteAddresses", FW_ADDRESSES(), FW_ADDRESSES),
        NDRPacketField("LocalInterfaceIds", FW_INTERFACE_LUIDS(), FW_INTERFACE_LUIDS),
        NDRIntField("dwLocalInterfaceTypes", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalApplication", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalService", ""), deferred=True
        ),
        NDRInt3264EnumField("Action", 0, FW_RULE_ACTION),
        NDRShortField("wFlags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteMachineAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszRemoteUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszEmbeddedContext", ""), deferred=True
        ),
        NDRPacketField(
            "PlatformValidityList", FW_OS_PLATFORM_LIST(), FW_OS_PLATFORM_LIST
        ),
        NDRIntEnumField("Status", 0, FW_RULE_STATUS),
        NDRInt3264EnumField("Origin", 0, FW_RULE_ORIGIN_TYPE),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszGPOName", ""), deferred=True
        ),
        NDRIntField("Reserved", 0),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pMetaData",
                [PFW_OBJECT_METADATA()],
                PFW_OBJECT_METADATA,
                size_is=lambda pkt: (
                    1
                    if (pkt.Reserved & pkt.FW_OBJECT_CTRL_FLAG_INCLUDE_METADATA)
                    else 0
                ),
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserAuthorizationList", ""),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszPackageId", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszLocalUserOwner", ""), deferred=True
        ),
        NDRIntField("dwTrustTupleKeywords", 0),
        NDRPacketField("OnNetworkNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("wszSecurityRealmId", ""), deferred=True
        ),
        NDRShortField("wFlags2", 0),
        NDRPacketField("RemoteOutServerNames", FW_NETWORK_NAMES(), FW_NETWORK_NAMES),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("wszFqbn", ""), deferred=True),
        NDRIntField("compartmentId", 0),
        NDRPacketField("providerContextKey", GUID(), GUID),
        NDRPacketField(
            "RemoteDynamicKeywordAddresses",
            FW_DYNAMIC_KEYWORD_ADDRESS_ID_LIST(),
            FW_DYNAMIC_KEYWORD_ADDRESS_ID_LIST,
        ),
    ]


class RRPC_FWAddFirewallRule2_31_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE(), PFW_RULE),
    ]


class RRPC_FWAddFirewallRule2_31_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWSetFirewallRule2_31_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pRule", PFW_RULE(), PFW_RULE),
    ]


class RRPC_FWSetFirewallRule2_31_Response(NDRPacket):
    fields_desc = [
        NDRIntEnumField("pStatus", 0, FW_RULE_STATUS),
        NDRIntField("status", 0),
    ]


class RRPC_FWEnumFirewallRules2_31_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilteredByStatus", 0),
        NDRIntField("dwProfileFilter", 0),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWEnumFirewallRules2_31_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE(), PFW_RULE)),
        NDRIntField("status", 0),
    ]


class RRPC_FWQueryFirewallRules2_31_Request(NDRPacket):
    fields_desc = [
        NDRLongField("rpcConnHandle", 0),
        NDRPacketField("hPolicyStore", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("pQuery", PFW_QUERY(), PFW_QUERY),
        NDRShortField("wFlags", 0),
    ]


class RRPC_FWQueryFirewallRules2_31_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumRules", 0),
        NDRFullPointerField(NDRPacketField("ppRules", PFW_RULE(), PFW_RULE)),
        NDRIntField("status", 0),
    ]


REMOTEFW_OPNUMS = {
    0: DceRpcOp(RRPC_FWOpenPolicyStore_Request, RRPC_FWOpenPolicyStore_Response),
    1: DceRpcOp(RRPC_FWClosePolicyStore_Request, RRPC_FWClosePolicyStore_Response),
    2: DceRpcOp(RRPC_FWRestoreDefaults_Request, RRPC_FWRestoreDefaults_Response),
    3: DceRpcOp(RRPC_FWGetGlobalConfig_Request, RRPC_FWGetGlobalConfig_Response),
    4: DceRpcOp(RRPC_FWSetGlobalConfig_Request, RRPC_FWSetGlobalConfig_Response),
    5: DceRpcOp(RRPC_FWAddFirewallRule_Request, RRPC_FWAddFirewallRule_Response),
    6: DceRpcOp(RRPC_FWSetFirewallRule_Request, RRPC_FWSetFirewallRule_Response),
    7: DceRpcOp(RRPC_FWDeleteFirewallRule_Request, RRPC_FWDeleteFirewallRule_Response),
    8: DceRpcOp(
        RRPC_FWDeleteAllFirewallRules_Request, RRPC_FWDeleteAllFirewallRules_Response
    ),
    9: DceRpcOp(RRPC_FWEnumFirewallRules_Request, RRPC_FWEnumFirewallRules_Response),
    10: DceRpcOp(RRPC_FWGetConfig_Request, RRPC_FWGetConfig_Response),
    11: DceRpcOp(RRPC_FWSetConfig_Request, RRPC_FWSetConfig_Response),
    12: DceRpcOp(
        RRPC_FWAddConnectionSecurityRule_Request,
        RRPC_FWAddConnectionSecurityRule_Response,
    ),
    13: DceRpcOp(
        RRPC_FWSetConnectionSecurityRule_Request,
        RRPC_FWSetConnectionSecurityRule_Response,
    ),
    14: DceRpcOp(
        RRPC_FWDeleteConnectionSecurityRule_Request,
        RRPC_FWDeleteConnectionSecurityRule_Response,
    ),
    15: DceRpcOp(
        RRPC_FWDeleteAllConnectionSecurityRules_Request,
        RRPC_FWDeleteAllConnectionSecurityRules_Response,
    ),
    16: DceRpcOp(
        RRPC_FWEnumConnectionSecurityRules_Request,
        RRPC_FWEnumConnectionSecurityRules_Response,
    ),
    17: DceRpcOp(
        RRPC_FWAddAuthenticationSet_Request, RRPC_FWAddAuthenticationSet_Response
    ),
    18: DceRpcOp(
        RRPC_FWSetAuthenticationSet_Request, RRPC_FWSetAuthenticationSet_Response
    ),
    19: DceRpcOp(
        RRPC_FWDeleteAuthenticationSet_Request, RRPC_FWDeleteAuthenticationSet_Response
    ),
    20: DceRpcOp(
        RRPC_FWDeleteAllAuthenticationSets_Request,
        RRPC_FWDeleteAllAuthenticationSets_Response,
    ),
    21: DceRpcOp(
        RRPC_FWEnumAuthenticationSets_Request, RRPC_FWEnumAuthenticationSets_Response
    ),
    22: DceRpcOp(RRPC_FWAddCryptoSet_Request, RRPC_FWAddCryptoSet_Response),
    23: DceRpcOp(RRPC_FWSetCryptoSet_Request, RRPC_FWSetCryptoSet_Response),
    24: DceRpcOp(RRPC_FWDeleteCryptoSet_Request, RRPC_FWDeleteCryptoSet_Response),
    25: DceRpcOp(
        RRPC_FWDeleteAllCryptoSets_Request, RRPC_FWDeleteAllCryptoSets_Response
    ),
    26: DceRpcOp(RRPC_FWEnumCryptoSets_Request, RRPC_FWEnumCryptoSets_Response),
    27: DceRpcOp(RRPC_FWEnumPhase1SAs_Request, RRPC_FWEnumPhase1SAs_Response),
    28: DceRpcOp(RRPC_FWEnumPhase2SAs_Request, RRPC_FWEnumPhase2SAs_Response),
    29: DceRpcOp(RRPC_FWDeletePhase1SAs_Request, RRPC_FWDeletePhase1SAs_Response),
    30: DceRpcOp(RRPC_FWDeletePhase2SAs_Request, RRPC_FWDeletePhase2SAs_Response),
    31: DceRpcOp(RRPC_FWEnumProducts_Request, RRPC_FWEnumProducts_Response),
    32: DceRpcOp(RRPC_FWAddMainModeRule_Request, RRPC_FWAddMainModeRule_Response),
    33: DceRpcOp(RRPC_FWSetMainModeRule_Request, RRPC_FWSetMainModeRule_Response),
    34: DceRpcOp(RRPC_FWDeleteMainModeRule_Request, RRPC_FWDeleteMainModeRule_Response),
    35: DceRpcOp(
        RRPC_FWDeleteAllMainModeRules_Request, RRPC_FWDeleteAllMainModeRules_Response
    ),
    36: DceRpcOp(RRPC_FWEnumMainModeRules_Request, RRPC_FWEnumMainModeRules_Response),
    37: DceRpcOp(RRPC_FWQueryFirewallRules_Request, RRPC_FWQueryFirewallRules_Response),
    38: DceRpcOp(
        RRPC_FWQueryConnectionSecurityRules2_10_Request,
        RRPC_FWQueryConnectionSecurityRules2_10_Response,
    ),
    39: DceRpcOp(RRPC_FWQueryMainModeRules_Request, RRPC_FWQueryMainModeRules_Response),
    40: DceRpcOp(
        RRPC_FWQueryAuthenticationSets_Request, RRPC_FWQueryAuthenticationSets_Response
    ),
    41: DceRpcOp(RRPC_FWQueryCryptoSets_Request, RRPC_FWQueryCryptoSets_Response),
    42: DceRpcOp(RRPC_FWEnumNetworks_Request, RRPC_FWEnumNetworks_Response),
    43: DceRpcOp(RRPC_FWEnumAdapters_Request, RRPC_FWEnumAdapters_Response),
    44: DceRpcOp(
        RRPC_FWGetGlobalConfig2_10_Request, RRPC_FWGetGlobalConfig2_10_Response
    ),
    45: DceRpcOp(RRPC_FWGetConfig2_10_Request, RRPC_FWGetConfig2_10_Response),
    46: DceRpcOp(
        RRPC_FWAddFirewallRule2_10_Request, RRPC_FWAddFirewallRule2_10_Response
    ),
    47: DceRpcOp(
        RRPC_FWSetFirewallRule2_10_Request, RRPC_FWSetFirewallRule2_10_Response
    ),
    48: DceRpcOp(
        RRPC_FWEnumFirewallRules2_10_Request, RRPC_FWEnumFirewallRules2_10_Response
    ),
    49: DceRpcOp(
        RRPC_FWAddConnectionSecurityRule2_10_Request,
        RRPC_FWAddConnectionSecurityRule2_10_Response,
    ),
    50: DceRpcOp(
        RRPC_FWSetConnectionSecurityRule2_10_Request,
        RRPC_FWSetConnectionSecurityRule2_10_Response,
    ),
    51: DceRpcOp(
        RRPC_FWEnumConnectionSecurityRules2_10_Request,
        RRPC_FWEnumConnectionSecurityRules2_10_Response,
    ),
    52: DceRpcOp(
        RRPC_FWAddAuthenticationSet2_10_Request,
        RRPC_FWAddAuthenticationSet2_10_Response,
    ),
    53: DceRpcOp(
        RRPC_FWSetAuthenticationSet2_10_Request,
        RRPC_FWSetAuthenticationSet2_10_Response,
    ),
    54: DceRpcOp(
        RRPC_FWEnumAuthenticationSets2_10_Request,
        RRPC_FWEnumAuthenticationSets2_10_Response,
    ),
    55: DceRpcOp(RRPC_FWAddCryptoSet2_10_Request, RRPC_FWAddCryptoSet2_10_Response),
    56: DceRpcOp(RRPC_FWSetCryptoSet2_10_Request, RRPC_FWSetCryptoSet2_10_Response),
    57: DceRpcOp(RRPC_FWEnumCryptoSets2_10_Request, RRPC_FWEnumCryptoSets2_10_Response),
    58: DceRpcOp(
        RRPC_FWAddConnectionSecurityRule2_20_Request,
        RRPC_FWAddConnectionSecurityRule2_20_Response,
    ),
    59: DceRpcOp(
        RRPC_FWSetConnectionSecurityRule2_20_Request,
        RRPC_FWSetConnectionSecurityRule2_20_Response,
    ),
    60: DceRpcOp(
        RRPC_FWEnumConnectionSecurityRules2_20_Request,
        RRPC_FWEnumConnectionSecurityRules2_20_Response,
    ),
    61: DceRpcOp(
        RRPC_FWQueryConnectionSecurityRules2_20_Request,
        RRPC_FWQueryConnectionSecurityRules2_20_Response,
    ),
    62: DceRpcOp(
        RRPC_FWAddAuthenticationSet2_20_Request,
        RRPC_FWAddAuthenticationSet2_20_Response,
    ),
    63: DceRpcOp(
        RRPC_FWSetAuthenticationSet2_20_Request,
        RRPC_FWSetAuthenticationSet2_20_Response,
    ),
    64: DceRpcOp(
        RRPC_FWEnumAuthenticationSets2_20_Request,
        RRPC_FWEnumAuthenticationSets2_20_Response,
    ),
    65: DceRpcOp(
        RRPC_FWQueryAuthenticationSets2_20_Request,
        RRPC_FWQueryAuthenticationSets2_20_Response,
    ),
    66: DceRpcOp(
        RRPC_FWAddFirewallRule2_20_Request, RRPC_FWAddFirewallRule2_20_Response
    ),
    67: DceRpcOp(
        RRPC_FWSetFirewallRule2_20_Request, RRPC_FWSetFirewallRule2_20_Response
    ),
    68: DceRpcOp(
        RRPC_FWEnumFirewallRules2_20_Request, RRPC_FWEnumFirewallRules2_20_Response
    ),
    69: DceRpcOp(
        RRPC_FWQueryFirewallRules2_20_Request, RRPC_FWQueryFirewallRules2_20_Response
    ),
    70: DceRpcOp(
        RRPC_FWAddFirewallRule2_24_Request, RRPC_FWAddFirewallRule2_24_Response
    ),
    71: DceRpcOp(
        RRPC_FWSetFirewallRule2_24_Request, RRPC_FWSetFirewallRule2_24_Response
    ),
    72: DceRpcOp(
        RRPC_FWEnumFirewallRules2_24_Request, RRPC_FWEnumFirewallRules2_24_Response
    ),
    73: DceRpcOp(
        RRPC_FWQueryFirewallRules2_24_Request, RRPC_FWQueryFirewallRules2_24_Response
    ),
    74: DceRpcOp(
        RRPC_FWAddFirewallRule2_25_Request, RRPC_FWAddFirewallRule2_25_Response
    ),
    75: DceRpcOp(
        RRPC_FWSetFirewallRule2_25_Request, RRPC_FWSetFirewallRule2_25_Response
    ),
    76: DceRpcOp(
        RRPC_FWEnumFirewallRules2_25_Request, RRPC_FWEnumFirewallRules2_25_Response
    ),
    77: DceRpcOp(
        RRPC_FWQueryFirewallRules2_25_Request, RRPC_FWQueryFirewallRules2_25_Response
    ),
    78: DceRpcOp(
        RRPC_FWAddFirewallRule2_26_Request, RRPC_FWAddFirewallRule2_26_Response
    ),
    79: DceRpcOp(
        RRPC_FWSetFirewallRule2_26_Request, RRPC_FWSetFirewallRule2_26_Response
    ),
    80: DceRpcOp(
        RRPC_FWEnumFirewallRules2_26_Request, RRPC_FWEnumFirewallRules2_26_Response
    ),
    81: DceRpcOp(
        RRPC_FWQueryFirewallRules2_26_Request, RRPC_FWQueryFirewallRules2_26_Response
    ),
    82: DceRpcOp(
        RRPC_FWAddFirewallRule2_27_Request, RRPC_FWAddFirewallRule2_27_Response
    ),
    83: DceRpcOp(
        RRPC_FWSetFirewallRule2_27_Request, RRPC_FWSetFirewallRule2_27_Response
    ),
    84: DceRpcOp(
        RRPC_FWEnumFirewallRules2_27_Request, RRPC_FWEnumFirewallRules2_27_Response
    ),
    85: DceRpcOp(
        RRPC_FWQueryFirewallRules2_27_Request, RRPC_FWQueryFirewallRules2_27_Response
    ),
    86: DceRpcOp(
        RRPC_FWAddFirewallRule2_31_Request, RRPC_FWAddFirewallRule2_31_Response
    ),
    87: DceRpcOp(
        RRPC_FWSetFirewallRule2_31_Request, RRPC_FWSetFirewallRule2_31_Response
    ),
    88: DceRpcOp(
        RRPC_FWEnumFirewallRules2_31_Request, RRPC_FWEnumFirewallRules2_31_Response
    ),
    89: DceRpcOp(
        RRPC_FWQueryFirewallRules2_31_Request, RRPC_FWQueryFirewallRules2_31_Response
    ),
}
register_dcerpc_interface(
    name="RemoteFW",
    uuid=uuid.UUID("6b5bdd1e-528c-422c-af8c-a4079be4fe48"),
    version="1.0",
    opnums=REMOTEFW_OPNUMS,
)
