### ms-cmrp_clusapi2.idl
"""
RPC definitions for the following interfaces:
- clusapi (v2.0): b97db8b2-4c63-11cf-bff6-08002be23f2f
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import PacketListField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRByteField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfVarPacketListField,
    NDRConfVarStrLenField,
    NDRConfVarStrLenFieldUtf16,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRContextHandle,
    NDRFullPointerField,
    NDRInt3264EnumField,
    NDRIntField,
    NDRPacketField,
    NDRShortField,
    NDRSignedIntField,
    register_dcerpc_interface,
)


class ApiOpenCluster_Request(NDRPacket):
    fields_desc = []


class ApiOpenCluster_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCloseCluster_Request(NDRPacket):
    fields_desc = [NDRPacketField("Cluster", NDRContextHandle(), NDRContextHandle)]


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


class ApiSetClusterName_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("NewClusterName", "")]


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


class ApiGetClusterName_Request(NDRPacket):
    fields_desc = []


class ApiGetClusterName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClusterName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("NodeName", "")),
        NDRIntField("status", 0),
    ]


class ApiGetClusterVersion_Request(NDRPacket):
    fields_desc = []


class ApiGetClusterVersion_Response(NDRPacket):
    fields_desc = [
        NDRShortField("lpwMajorVersion", 0),
        NDRShortField("lpwMinorVersion", 0),
        NDRShortField("lpwBuildNumber", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszVendorId", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszCSDVersion", "")),
        NDRIntField("status", 0),
    ]


class ApiGetQuorumResource_Request(NDRPacket):
    fields_desc = []


class ApiGetQuorumResource_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszResourceName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszDeviceName", "")),
        NDRIntField("pdwMaxQuorumLogSize", 0),
        NDRIntField("status", 0),
    ]


class ApiSetQuorumResource_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszDeviceName", ""),
        NDRIntField("dwMaxQuorumLogSize", 0),
    ]


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


class ENUM_ENTRY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Type", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Name", ""), deferred=True),
    ]


class PENUM_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["Entry"]
    fields_desc = [
        NDRIntField("EntryCount", None, size_of="Entry"),
        NDRConfPacketListField(
            "Entry",
            [],
            ENUM_ENTRY,
            size_is=lambda pkt: pkt.EntryCount,
            conformant_in_struct=True,
        ),
    ]


class ApiCreateEnum_Request(NDRPacket):
    fields_desc = [NDRIntField("dwType", 0)]


class ApiCreateEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReturnEnum", PENUM_LIST(), PENUM_LIST)),
        NDRIntField("status", 0),
    ]


class ApiOpenResource_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszResourceName", "")]


class ApiOpenResource_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCreateResource_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszResourceName", ""),
        NDRConfVarStrNullFieldUtf16("lpszResourceType", ""),
        NDRIntField("dwFlags", 0),
    ]


class ApiCreateResource_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiDeleteResource_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


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


class ApiCloseResource_Request(NDRPacket):
    fields_desc = [NDRPacketField("Resource", NDRContextHandle(), NDRContextHandle)]


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


class ApiGetResourceState_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


class ApiGetResourceState_Response(NDRPacket):
    fields_desc = [
        NDRIntField("State", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("NodeName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("GroupName", "")),
        NDRIntField("status", 0),
    ]


class ApiSetResourceName_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszResourceName", ""),
    ]


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


class ApiGetResourceId_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


class ApiGetResourceId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pGuid", "")),
        NDRIntField("status", 0),
    ]


class ApiGetResourceType_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


class ApiGetResourceType_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszResourceType", "")),
        NDRIntField("status", 0),
    ]


class ApiFailResource_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


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


class ApiOnlineResource_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


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


class ApiOfflineResource_Request(NDRPacket):
    fields_desc = [NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle)]


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


class ApiAddResourceDependency_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hDependsOn", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiRemoveResourceDependency_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hDependsOn", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiCanResourceBeDependent_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hResourceDependent", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiCreateResEnum_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwType", 0),
    ]


class ApiCreateResEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReturnEnum", PENUM_LIST(), PENUM_LIST)),
        NDRIntField("status", 0),
    ]


class ApiAddResourceNode_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiRemoveResourceNode_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiChangeResourceGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiCreateResourceType_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpszTypeName", ""),
        NDRConfVarStrNullFieldUtf16("lpszDisplayName", ""),
        NDRConfVarStrNullFieldUtf16("lpszDllName", ""),
        NDRIntField("dwLooksAlive", 0),
        NDRIntField("dwIsAlive", 0),
    ]


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


class ApiDeleteResourceType_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszTypeName", "")]


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


class ApiGetRootKey_Request(NDRPacket):
    fields_desc = [NDRIntField("samDesired", 0)]


class ApiGetRootKey_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class RPC_SECURITY_DESCRIPTOR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpSecurityDescriptor",
                "",
                size_is=lambda pkt: pkt.cbInSecurityDescriptor,
                length_is=lambda pkt: pkt.cbOutSecurityDescriptor,
            ),
            deferred=True,
        ),
        NDRIntField("cbInSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
        NDRIntField("cbOutSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
    ]


class PRPC_SECURITY_ATTRIBUTES(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("nLength", 0),
        NDRPacketField(
            "RpcSecurityDescriptor", RPC_SECURITY_DESCRIPTOR(), RPC_SECURITY_DESCRIPTOR
        ),
        NDRSignedIntField("bInheritHandle", 0),
    ]


class ApiCreateKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpSubKey", ""),
        NDRIntField("dwOptions", 0),
        NDRIntField("samDesired", 0),
        NDRFullPointerField(
            NDRPacketField(
                "lpSecurityAttributes",
                PRPC_SECURITY_ATTRIBUTES(),
                PRPC_SECURITY_ATTRIBUTES,
            )
        ),
    ]


class ApiCreateKey_Response(NDRPacket):
    fields_desc = [NDRIntField("lpdwDisposition", 0), NDRIntField("Status", 0)]


class ApiOpenKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpSubKey", ""),
        NDRIntField("samDesired", 0),
    ]


class ApiOpenKey_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class FILETIME(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwLowDateTime", 0), NDRIntField("dwHighDateTime", 0)]


class ApiEnumKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwIndex", 0),
    ]


class ApiEnumKey_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("KeyName", "")),
        NDRPacketField("lpftLastWriteTime", FILETIME(), FILETIME),
        NDRIntField("status", 0),
    ]


class ApiSetValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpValueName", ""),
        NDRIntField("dwType", 0),
        NDRConfStrLenField("lpData", "", size_is=lambda pkt: pkt.cbData),
        NDRIntField("cbData", None, size_of="lpData"),
    ]


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


class ApiDeleteValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpValueName", ""),
    ]


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


class ApiQueryValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpValueName", ""),
        NDRIntField("cbData", 0),
    ]


class ApiQueryValue_Response(NDRPacket):
    fields_desc = [
        NDRIntField("lpValueType", 0),
        NDRConfStrLenField("lpData", "", size_is=lambda pkt: pkt.cbData),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiDeleteKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpSubKey", ""),
    ]


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


class ApiEnumValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwIndex", 0),
        NDRIntField("lpcbData", 0),
    ]


class ApiEnumValue_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpValueName", "")),
        NDRIntField("lpType", 0),
        NDRConfStrLenField("lpData", "", size_is=lambda pkt: pkt.lpcbData),
        NDRIntField("lpcbData", None, size_of="lpData"),
        NDRIntField("TotalSize", 0),
        NDRIntField("status", 0),
    ]


class ApiCloseKey_Request(NDRPacket):
    fields_desc = [NDRPacketField("pKey", NDRContextHandle(), NDRContextHandle)]


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


class PFILETIME(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwLowDateTime", 0), NDRIntField("dwHighDateTime", 0)]


class ApiQueryInfoKey_Request(NDRPacket):
    fields_desc = [NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle)]


class ApiQueryInfoKey_Response(NDRPacket):
    fields_desc = [
        NDRIntField("lpcSubKeys", 0),
        NDRIntField("lpcbMaxSubKeyLen", 0),
        NDRIntField("lpcValues", 0),
        NDRIntField("lpcbMaxValueNameLen", 0),
        NDRIntField("lpcbMaxValueLen", 0),
        NDRIntField("lpcbSecurityDescriptor", 0),
        NDRPacketField("lpftLastWriteTime", PFILETIME(), PFILETIME),
        NDRIntField("status", 0),
    ]


class PRPC_SECURITY_DESCRIPTOR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpSecurityDescriptor",
                "",
                size_is=lambda pkt: pkt.cbInSecurityDescriptor,
                length_is=lambda pkt: pkt.cbOutSecurityDescriptor,
            ),
            deferred=True,
        ),
        NDRIntField("cbInSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
        NDRIntField("cbOutSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
    ]


class ApiSetKeySecurity_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("SecurityInformation", 0),
        NDRPacketField(
            "pRpcSecurityDescriptor",
            PRPC_SECURITY_DESCRIPTOR(),
            PRPC_SECURITY_DESCRIPTOR,
        ),
    ]


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


class ApiGetKeySecurity_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("SecurityInformation", 0),
        NDRPacketField(
            "pRpcSecurityDescriptor",
            PRPC_SECURITY_DESCRIPTOR(),
            PRPC_SECURITY_DESCRIPTOR,
        ),
    ]


class ApiGetKeySecurity_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pRpcSecurityDescriptor",
            PRPC_SECURITY_DESCRIPTOR(),
            PRPC_SECURITY_DESCRIPTOR,
        ),
        NDRIntField("status", 0),
    ]


class ApiOpenGroup_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszGroupName", "")]


class ApiOpenGroup_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCreateGroup_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszGroupName", "")]


class ApiCreateGroup_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiDeleteGroup_Request(NDRPacket):
    fields_desc = [NDRPacketField("Group", NDRContextHandle(), NDRContextHandle)]


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


class ApiCloseGroup_Request(NDRPacket):
    fields_desc = [NDRPacketField("Group", NDRContextHandle(), NDRContextHandle)]


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


class ApiGetGroupState_Request(NDRPacket):
    fields_desc = [NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle)]


class ApiGetGroupState_Response(NDRPacket):
    fields_desc = [
        NDRIntField("State", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("NodeName", "")),
        NDRIntField("status", 0),
    ]


class ApiSetGroupName_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszGroupName", ""),
    ]


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


class ApiGetGroupId_Request(NDRPacket):
    fields_desc = [NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle)]


class ApiGetGroupId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pGuid", "")),
        NDRIntField("status", 0),
    ]


class ApiGetNodeId_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle)]


class ApiGetNodeId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pGuid", "")),
        NDRIntField("status", 0),
    ]


class ApiOnlineGroup_Request(NDRPacket):
    fields_desc = [NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle)]


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


class ApiOfflineGroup_Request(NDRPacket):
    fields_desc = [NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle)]


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


class ApiMoveGroup_Request(NDRPacket):
    fields_desc = [NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle)]


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


class ApiMoveGroupToNode_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
    ]


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


class ApiCreateGroupResourceEnum_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwType", 0),
    ]


class ApiCreateGroupResourceEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReturnEnum", PENUM_LIST(), PENUM_LIST)),
        NDRIntField("status", 0),
    ]


class ApiSetGroupNodeList_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRConfStrLenField("lpNodeList", "", size_is=lambda pkt: pkt.cbListSize),
        NDRIntField("cbListSize", None, size_of="lpNodeList"),
    ]


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


class ApiCreateNotify_Request(NDRPacket):
    fields_desc = []


class ApiCreateNotify_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCloseNotify_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle)]


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


class ApiAddNotifyCluster_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hCluster", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
    ]


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


class ApiAddNotifyNode_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
    ]


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


class ApiAddNotifyGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
    ]


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


class ApiAddNotifyResource_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
    ]


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


class ApiAddNotifyKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("dwFilter", 0),
        NDRSignedIntField("WatchSubTree", 0),
    ]


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


class ApiReAddNotifyNode_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("StateSequence", 0),
    ]


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


class ApiReAddNotifyGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("StateSequence", 0),
    ]


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


class ApiReAddNotifyResource_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("StateSequence", 0),
    ]


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


class ApiGetNotify_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Timeout", 0),
    ]


class ApiGetNotify_Response(NDRPacket):
    fields_desc = [
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwStateSequence", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Name", "")),
        NDRIntField("status", 0),
    ]


class ApiOpenNode_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszNodeName", "")]


class ApiOpenNode_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCloseNode_Request(NDRPacket):
    fields_desc = [NDRPacketField("Node", NDRContextHandle(), NDRContextHandle)]


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


class ApiGetNodeState_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle)]


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


class ApiPauseNode_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle)]


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


class ApiResumeNode_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle)]


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


class ApiEvictNode_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle)]


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


class ApiNodeResourceControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeResourceControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiResourceControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hResource", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiResourceControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiNodeResourceTypeControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hCluster", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszResourceTypeName", ""),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeResourceTypeControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiResourceTypeControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hCluster", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszResourceTypeName", ""),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiResourceTypeControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiNodeGroupControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeGroupControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiGroupControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hGroup", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiGroupControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiNodeNodeControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hHostNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeNodeControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiNodeControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiOpenNetwork_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszNetworkName", "")]


class ApiOpenNetwork_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCloseNetwork_Request(NDRPacket):
    fields_desc = [NDRPacketField("Network", NDRContextHandle(), NDRContextHandle)]


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


class ApiGetNetworkState_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle)]


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


class ApiSetNetworkName_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("lpszNetworkName", ""),
    ]


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


class ApiCreateNetworkEnum_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwType", 0),
    ]


class ApiCreateNetworkEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReturnEnum", PENUM_LIST(), PENUM_LIST)),
        NDRIntField("status", 0),
    ]


class ApiGetNetworkId_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle)]


class ApiGetNetworkId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pGuid", "")),
        NDRIntField("status", 0),
    ]


class ApiSetNetworkPriorityOrder_Request(NDRPacket):
    fields_desc = [
        NDRIntField("NetworkCount", None, size_of="NetworkIdList"),
        NDRConfVarStrLenFieldUtf16(
            "NetworkIdList", "", size_is=lambda pkt: pkt.NetworkCount
        ),
    ]


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


class ApiNodeNetworkControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeNetworkControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiNetworkControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNetworkControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiAddNotifyNetwork_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
    ]


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


class ApiReAddNotifyNetwork_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNetwork", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("StateSequence", 0),
    ]


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


class ApiOpenNetInterface_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszNetInterfaceName", "")]


class ApiOpenNetInterface_Response(NDRPacket):
    fields_desc = [NDRIntField("Status", 0)]


class ApiCloseNetInterface_Request(NDRPacket):
    fields_desc = [NDRPacketField("NetInterface", NDRContextHandle(), NDRContextHandle)]


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


class ApiGetNetInterfaceState_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetInterface", NDRContextHandle(), NDRContextHandle)
    ]


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


class ApiGetNetInterface_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpszNodeName", ""),
        NDRConfVarStrNullFieldUtf16("lpszNetworkName", ""),
    ]


class ApiGetNetInterface_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lppszInterfaceName", "")),
        NDRIntField("status", 0),
    ]


class ApiGetNetInterfaceId_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetInterface", NDRContextHandle(), NDRContextHandle)
    ]


class ApiGetNetInterfaceId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pGuid", "")),
        NDRIntField("status", 0),
    ]


class ApiNodeNetInterfaceControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetInterface", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeNetInterfaceControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiNetInterfaceControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNetInterface", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNetInterfaceControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiAddNotifyNetInterface_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNetInterface", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
    ]


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


class ApiReAddNotifyNetInterface_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hNetInterface", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFilter", 0),
        NDRIntField("dwNotifyKey", 0),
        NDRIntField("StateSequence", 0),
    ]


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


class ApiCreateNodeEnum_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwType", 0),
    ]


class ApiCreateNodeEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReturnEnum", PENUM_LIST(), PENUM_LIST)),
        NDRIntField("status", 0),
    ]


class PCLUSTER_OPERATIONAL_VERSION_INFO(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("dwSize", 0),
        NDRIntField("dwClusterHighestVersion", 0),
        NDRIntField("dwClusterLowestVersion", 0),
        NDRIntField("dwFlags", 0),
        NDRIntField("dwReserved", 0),
    ]


class ApiGetClusterVersion2_Request(NDRPacket):
    fields_desc = []


class ApiGetClusterVersion2_Response(NDRPacket):
    fields_desc = [
        NDRShortField("lpwMajorVersion", 0),
        NDRShortField("lpwMinorVersion", 0),
        NDRShortField("lpwBuildNumber", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszVendorId", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpszCSDVersion", "")),
        NDRFullPointerField(
            NDRPacketField(
                "ppClusterOpVerInfo",
                PCLUSTER_OPERATIONAL_VERSION_INFO(),
                PCLUSTER_OPERATIONAL_VERSION_INFO,
            )
        ),
        NDRIntField("status", 0),
    ]


class ApiCreateResTypeEnum_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpszTypeName", ""),
        NDRIntField("dwType", 0),
    ]


class ApiCreateResTypeEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReturnEnum", PENUM_LIST(), PENUM_LIST)),
        NDRIntField("status", 0),
    ]


class ApiBackupClusterDatabase_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("lpszPathName", "")]


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


class ApiNodeClusterControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hCluster", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("hHostNode", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiNodeClusterControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiClusterControl_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hCluster", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwControlCode", 0),
        NDRConfStrLenField("lpInBuffer", "", size_is=lambda pkt: pkt.nInBufferSize),
        NDRIntField("nInBufferSize", None, size_of="lpInBuffer"),
        NDRIntField("nOutBufferSize", 0),
    ]


class ApiClusterControl_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrLenField(
            "lpOutBuffer",
            "",
            size_is=lambda pkt: pkt.nOutBufferSize,
            length_is=lambda pkt: pkt.lpBytesReturned,
        ),
        NDRIntField("lpBytesReturned", None, size_of="lpOutBuffer"),
        NDRIntField("lpcbRequired", 0),
        NDRIntField("status", 0),
    ]


class ApiUnblockGetNotifyCall_Request(NDRPacket):
    fields_desc = [NDRPacketField("hNotify", NDRContextHandle(), NDRContextHandle)]


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


class IDL_CLUSTER_SET_PASSWORD_FLAGS(IntEnum):
    IDL_CLUSTER_SET_PASSWORD_IGNORE_DOWN_NODES = 1


class PIDL_CLUSTER_SET_PASSWORD_STATUS(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("NodeId", 0),
        NDRByteField("SetAttempted", 0),
        NDRIntField("ReturnStatus", 0),
    ]


class ApiSetServiceAccountPassword_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpszNewPassword", ""),
        NDRInt3264EnumField("dwFlags", 0, IDL_CLUSTER_SET_PASSWORD_FLAGS),
        NDRIntField("ReturnStatusBufferSize", 0),
    ]


class ApiSetServiceAccountPassword_Response(NDRPacket):
    fields_desc = [
        NDRConfVarPacketListField(
            "ReturnStatusBufferPtr",
            [],
            PIDL_CLUSTER_SET_PASSWORD_STATUS,
            size_is=lambda pkt: pkt.ReturnStatusBufferSize,
            length_is=lambda pkt: pkt.SizeReturned,
            ptr_pack=True,
        ),
        NDRIntField("SizeReturned", None, size_of="ReturnStatusBufferPtr"),
        NDRIntField("ExpectedBufferSize", 0),
        NDRIntField("status", 0),
    ]


CLUSAPI_OPNUMS = {
    0: DceRpcOp(ApiOpenCluster_Request, ApiOpenCluster_Response),
    1: DceRpcOp(ApiCloseCluster_Request, ApiCloseCluster_Response),
    2: DceRpcOp(ApiSetClusterName_Request, ApiSetClusterName_Response),
    3: DceRpcOp(ApiGetClusterName_Request, ApiGetClusterName_Response),
    4: DceRpcOp(ApiGetClusterVersion_Request, ApiGetClusterVersion_Response),
    5: DceRpcOp(ApiGetQuorumResource_Request, ApiGetQuorumResource_Response),
    6: DceRpcOp(ApiSetQuorumResource_Request, ApiSetQuorumResource_Response),
    7: DceRpcOp(ApiCreateEnum_Request, ApiCreateEnum_Response),
    8: DceRpcOp(ApiOpenResource_Request, ApiOpenResource_Response),
    9: DceRpcOp(ApiCreateResource_Request, ApiCreateResource_Response),
    10: DceRpcOp(ApiDeleteResource_Request, ApiDeleteResource_Response),
    11: DceRpcOp(ApiCloseResource_Request, ApiCloseResource_Response),
    12: DceRpcOp(ApiGetResourceState_Request, ApiGetResourceState_Response),
    13: DceRpcOp(ApiSetResourceName_Request, ApiSetResourceName_Response),
    14: DceRpcOp(ApiGetResourceId_Request, ApiGetResourceId_Response),
    15: DceRpcOp(ApiGetResourceType_Request, ApiGetResourceType_Response),
    16: DceRpcOp(ApiFailResource_Request, ApiFailResource_Response),
    17: DceRpcOp(ApiOnlineResource_Request, ApiOnlineResource_Response),
    18: DceRpcOp(ApiOfflineResource_Request, ApiOfflineResource_Response),
    19: DceRpcOp(ApiAddResourceDependency_Request, ApiAddResourceDependency_Response),
    20: DceRpcOp(
        ApiRemoveResourceDependency_Request, ApiRemoveResourceDependency_Response
    ),
    21: DceRpcOp(ApiCanResourceBeDependent_Request, ApiCanResourceBeDependent_Response),
    22: DceRpcOp(ApiCreateResEnum_Request, ApiCreateResEnum_Response),
    23: DceRpcOp(ApiAddResourceNode_Request, ApiAddResourceNode_Response),
    24: DceRpcOp(ApiRemoveResourceNode_Request, ApiRemoveResourceNode_Response),
    25: DceRpcOp(ApiChangeResourceGroup_Request, ApiChangeResourceGroup_Response),
    26: DceRpcOp(ApiCreateResourceType_Request, ApiCreateResourceType_Response),
    27: DceRpcOp(ApiDeleteResourceType_Request, ApiDeleteResourceType_Response),
    28: DceRpcOp(ApiGetRootKey_Request, ApiGetRootKey_Response),
    29: DceRpcOp(ApiCreateKey_Request, ApiCreateKey_Response),
    30: DceRpcOp(ApiOpenKey_Request, ApiOpenKey_Response),
    31: DceRpcOp(ApiEnumKey_Request, ApiEnumKey_Response),
    32: DceRpcOp(ApiSetValue_Request, ApiSetValue_Response),
    33: DceRpcOp(ApiDeleteValue_Request, ApiDeleteValue_Response),
    34: DceRpcOp(ApiQueryValue_Request, ApiQueryValue_Response),
    35: DceRpcOp(ApiDeleteKey_Request, ApiDeleteKey_Response),
    36: DceRpcOp(ApiEnumValue_Request, ApiEnumValue_Response),
    37: DceRpcOp(ApiCloseKey_Request, ApiCloseKey_Response),
    38: DceRpcOp(ApiQueryInfoKey_Request, ApiQueryInfoKey_Response),
    39: DceRpcOp(ApiSetKeySecurity_Request, ApiSetKeySecurity_Response),
    40: DceRpcOp(ApiGetKeySecurity_Request, ApiGetKeySecurity_Response),
    41: DceRpcOp(ApiOpenGroup_Request, ApiOpenGroup_Response),
    42: DceRpcOp(ApiCreateGroup_Request, ApiCreateGroup_Response),
    43: DceRpcOp(ApiDeleteGroup_Request, ApiDeleteGroup_Response),
    44: DceRpcOp(ApiCloseGroup_Request, ApiCloseGroup_Response),
    45: DceRpcOp(ApiGetGroupState_Request, ApiGetGroupState_Response),
    46: DceRpcOp(ApiSetGroupName_Request, ApiSetGroupName_Response),
    47: DceRpcOp(ApiGetGroupId_Request, ApiGetGroupId_Response),
    48: DceRpcOp(ApiGetNodeId_Request, ApiGetNodeId_Response),
    49: DceRpcOp(ApiOnlineGroup_Request, ApiOnlineGroup_Response),
    50: DceRpcOp(ApiOfflineGroup_Request, ApiOfflineGroup_Response),
    51: DceRpcOp(ApiMoveGroup_Request, ApiMoveGroup_Response),
    52: DceRpcOp(ApiMoveGroupToNode_Request, ApiMoveGroupToNode_Response),
    53: DceRpcOp(
        ApiCreateGroupResourceEnum_Request, ApiCreateGroupResourceEnum_Response
    ),
    54: DceRpcOp(ApiSetGroupNodeList_Request, ApiSetGroupNodeList_Response),
    55: DceRpcOp(ApiCreateNotify_Request, ApiCreateNotify_Response),
    56: DceRpcOp(ApiCloseNotify_Request, ApiCloseNotify_Response),
    57: DceRpcOp(ApiAddNotifyCluster_Request, ApiAddNotifyCluster_Response),
    58: DceRpcOp(ApiAddNotifyNode_Request, ApiAddNotifyNode_Response),
    59: DceRpcOp(ApiAddNotifyGroup_Request, ApiAddNotifyGroup_Response),
    60: DceRpcOp(ApiAddNotifyResource_Request, ApiAddNotifyResource_Response),
    61: DceRpcOp(ApiAddNotifyKey_Request, ApiAddNotifyKey_Response),
    62: DceRpcOp(ApiReAddNotifyNode_Request, ApiReAddNotifyNode_Response),
    63: DceRpcOp(ApiReAddNotifyGroup_Request, ApiReAddNotifyGroup_Response),
    64: DceRpcOp(ApiReAddNotifyResource_Request, ApiReAddNotifyResource_Response),
    65: DceRpcOp(ApiGetNotify_Request, ApiGetNotify_Response),
    66: DceRpcOp(ApiOpenNode_Request, ApiOpenNode_Response),
    67: DceRpcOp(ApiCloseNode_Request, ApiCloseNode_Response),
    68: DceRpcOp(ApiGetNodeState_Request, ApiGetNodeState_Response),
    69: DceRpcOp(ApiPauseNode_Request, ApiPauseNode_Response),
    70: DceRpcOp(ApiResumeNode_Request, ApiResumeNode_Response),
    71: DceRpcOp(ApiEvictNode_Request, ApiEvictNode_Response),
    72: DceRpcOp(ApiNodeResourceControl_Request, ApiNodeResourceControl_Response),
    73: DceRpcOp(ApiResourceControl_Request, ApiResourceControl_Response),
    74: DceRpcOp(
        ApiNodeResourceTypeControl_Request, ApiNodeResourceTypeControl_Response
    ),
    75: DceRpcOp(ApiResourceTypeControl_Request, ApiResourceTypeControl_Response),
    76: DceRpcOp(ApiNodeGroupControl_Request, ApiNodeGroupControl_Response),
    77: DceRpcOp(ApiGroupControl_Request, ApiGroupControl_Response),
    78: DceRpcOp(ApiNodeNodeControl_Request, ApiNodeNodeControl_Response),
    79: DceRpcOp(ApiNodeControl_Request, ApiNodeControl_Response),
    # 80: Opnum80NotUsedOnWire,
    81: DceRpcOp(ApiOpenNetwork_Request, ApiOpenNetwork_Response),
    82: DceRpcOp(ApiCloseNetwork_Request, ApiCloseNetwork_Response),
    83: DceRpcOp(ApiGetNetworkState_Request, ApiGetNetworkState_Response),
    84: DceRpcOp(ApiSetNetworkName_Request, ApiSetNetworkName_Response),
    85: DceRpcOp(ApiCreateNetworkEnum_Request, ApiCreateNetworkEnum_Response),
    86: DceRpcOp(ApiGetNetworkId_Request, ApiGetNetworkId_Response),
    87: DceRpcOp(
        ApiSetNetworkPriorityOrder_Request, ApiSetNetworkPriorityOrder_Response
    ),
    88: DceRpcOp(ApiNodeNetworkControl_Request, ApiNodeNetworkControl_Response),
    89: DceRpcOp(ApiNetworkControl_Request, ApiNetworkControl_Response),
    90: DceRpcOp(ApiAddNotifyNetwork_Request, ApiAddNotifyNetwork_Response),
    91: DceRpcOp(ApiReAddNotifyNetwork_Request, ApiReAddNotifyNetwork_Response),
    92: DceRpcOp(ApiOpenNetInterface_Request, ApiOpenNetInterface_Response),
    93: DceRpcOp(ApiCloseNetInterface_Request, ApiCloseNetInterface_Response),
    94: DceRpcOp(ApiGetNetInterfaceState_Request, ApiGetNetInterfaceState_Response),
    95: DceRpcOp(ApiGetNetInterface_Request, ApiGetNetInterface_Response),
    96: DceRpcOp(ApiGetNetInterfaceId_Request, ApiGetNetInterfaceId_Response),
    97: DceRpcOp(
        ApiNodeNetInterfaceControl_Request, ApiNodeNetInterfaceControl_Response
    ),
    98: DceRpcOp(ApiNetInterfaceControl_Request, ApiNetInterfaceControl_Response),
    99: DceRpcOp(ApiAddNotifyNetInterface_Request, ApiAddNotifyNetInterface_Response),
    100: DceRpcOp(
        ApiReAddNotifyNetInterface_Request, ApiReAddNotifyNetInterface_Response
    ),
    101: DceRpcOp(ApiCreateNodeEnum_Request, ApiCreateNodeEnum_Response),
    102: DceRpcOp(ApiGetClusterVersion2_Request, ApiGetClusterVersion2_Response),
    103: DceRpcOp(ApiCreateResTypeEnum_Request, ApiCreateResTypeEnum_Response),
    104: DceRpcOp(ApiBackupClusterDatabase_Request, ApiBackupClusterDatabase_Response),
    105: DceRpcOp(ApiNodeClusterControl_Request, ApiNodeClusterControl_Response),
    106: DceRpcOp(ApiClusterControl_Request, ApiClusterControl_Response),
    107: DceRpcOp(ApiUnblockGetNotifyCall_Request, ApiUnblockGetNotifyCall_Response),
    108: DceRpcOp(
        ApiSetServiceAccountPassword_Request, ApiSetServiceAccountPassword_Response
    ),
}
register_dcerpc_interface(
    name="clusapi",
    uuid=uuid.UUID("b97db8b2-4c63-11cf-bff6-08002be23f2f"),
    version="2.0",
    opnums=CLUSAPI_OPNUMS,
)
