### ms-rrasm.idl
"""
RPC definitions for the following interfaces:
- dimsvc (v0.0): 8f09f000-b7ed-11ce-bbd2-00001a181cad
- rasrpc (v1.0): 20610036-fa22-11cf-9823-00a0c911e5df
- IRemoteNetworkConfig (v0.0): 66a2db1b-d706-11d0-a37b-00c04fc9da04
- IRemoteRouterRestart (v0.0): 66a2db20-d706-11d0-a37b-00c04fc9da04
- IRemoteSetDnsConfig (v0.0): 66a2db21-d706-11d0-a37b-00c04fc9da04
- IRemoteICFICSConfig (v0.0): 66a2db22-d706-11d0-a37b-00c04fc9da04
- IRemoteStringIdConfig (v0.0): 67e08fc2-2984-4b62-b92e-fc1aae64bbbb
- IRemoteIPV6Config (v0.0): 6139d8a4-e508-4ebb-bac7-d7f275145897
- IRemoteSstpCertCheck (v0.0): 5ff9bdf6-bd91-4d8b-a614-d6317acc8dd8
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import StrFixedLenField, StrFixedLenFieldUtf16
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRByteField,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRFullPointerField,
    NDRInt3264EnumField,
    NDRInt3264Field,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRRecursiveField,
    NDRShortField,
    NDRSignedIntField,
    NDRUnionField,
    register_dcerpc_interface,
)


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


class RMprAdminServerGetInfo_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("dwLevel", 0)]


class RMprAdminServerGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRasAdminConnectionEnum_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("dwPreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
    ]


class RRasAdminConnectionEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("lpdwEntriesRead", 0),
        NDRIntField("lpdwTotalEntries", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class RRasAdminConnectionGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRIntField("hDimConnection", 0),
    ]


class RRasAdminConnectionGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRasAdminConnectionClearStats_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hDimConnection", 0)]


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


class RRasAdminPortEnum_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRIntField("hRasConnection", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("dwPreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
    ]


class RRasAdminPortEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("lpdwEntriesRead", 0),
        NDRIntField("lpdwTotalEntries", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class RRasAdminPortGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRIntField("hPort", 0),
    ]


class RRasAdminPortGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRasAdminPortClearStats_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hPort", 0)]


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


class RRasAdminPortReset_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hPort", 0)]


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


class RRasAdminPortDisconnect_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hPort", 0)]


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


class PDIM_INTERFACE_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("fGetInterfaceInfo", 0),
        NDRIntField("dwInterfaceInfoSize", None, size_of="pInterfaceInfo"),
        NDRFullPointerField(
            NDRConfStrLenField(
                "pInterfaceInfo", "", size_is=lambda pkt: pkt.dwInterfaceInfoSize
            ),
            deferred=True,
        ),
        NDRIntField("fGetGlobalInfo", 0),
        NDRIntField("dwGlobalInfoSize", None, size_of="pGlobalInfo"),
        NDRFullPointerField(
            NDRConfStrLenField(
                "pGlobalInfo", "", size_is=lambda pkt: pkt.dwGlobalInfoSize
            ),
            deferred=True,
        ),
    ]


class RRouterInterfaceTransportSetGlobalInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwTransportId", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
    ]


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


class RRouterInterfaceTransportGetGlobalInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwTransportId", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
    ]


class RRouterInterfaceTransportGetGlobalInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceGetHandle_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRConfVarStrNullFieldUtf16("lpwsInterfaceName", ""),
        NDRIntField("phInterface", 0),
        NDRIntField("fIncludeClientInterfaces", 0),
    ]


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


class RRouterInterfaceCreate_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("phInterface", 0),
    ]


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


class RRouterInterfaceGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("hInterface", 0),
    ]


class RRouterInterfaceGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceSetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("hInterface", 0),
    ]


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


class RRouterInterfaceDelete_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hInterface", 0)]


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


class RRouterInterfaceTransportRemove_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRIntField("dwTransportId", 0),
    ]


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


class RRouterInterfaceTransportAdd_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRIntField("dwTransportId", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
    ]


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


class RRouterInterfaceTransportGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRIntField("dwTransportId", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
    ]


class RRouterInterfaceTransportGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceTransportSetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRIntField("dwTransportId", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
    ]


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


class RRouterInterfaceEnum_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("dwPreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
    ]


class RRouterInterfaceEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("lpdwEntriesRead", 0),
        NDRIntField("lpdwTotalEntries", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceConnect_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRInt3264Field("hEvent", 0),
        NDRIntField("fBlocking", 0),
        NDRIntField("dwCallersProcessId", 0),
    ]


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


class RRouterInterfaceDisconnect_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hInterface", 0)]


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


class RRouterInterfaceUpdateRoutes_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRIntField("dwTransportId", 0),
        NDRInt3264Field("hEvent", 0),
        NDRIntField("dwClientProcessId", 0),
    ]


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


class RRouterInterfaceQueryUpdateResult_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRIntField("dwTransportId", 0),
    ]


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


class RRouterInterfaceUpdatePhonebookInfo_Request(NDRPacket):
    fields_desc = [NDRLongField("hDimServer", 0), NDRIntField("hInterface", 0)]


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


class PDIM_MIB_ENTRY_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwMibInEntrySize", None, size_of="pMibInEntry"),
        NDRFullPointerField(
            NDRConfStrLenField(
                "pMibInEntry", "", size_is=lambda pkt: pkt.dwMibInEntrySize
            ),
            deferred=True,
        ),
        NDRIntField("dwMibOutEntrySize", None, size_of="pMibOutEntry"),
        NDRFullPointerField(
            NDRConfStrLenField(
                "pMibOutEntry", "", size_is=lambda pkt: pkt.dwMibOutEntrySize
            ),
            deferred=True,
        ),
    ]


class RMIBEntryCreate_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


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


class RMIBEntryDelete_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


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


class RMIBEntrySet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


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


class RMIBEntryGet_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


class RMIBEntryGet_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RMIBEntryGetFirst_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


class RMIBEntryGetFirst_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RMIBEntryGetNext_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


class RMIBEntryGetNext_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStuct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RMIBGetTrapInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


class RMIBGetTrapInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RMIBSetTrapInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwPid", 0),
        NDRIntField("dwRoutingPid", 0),
        NDRInt3264Field("hEvent", 0),
        NDRIntField("dwClientProcessId", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
    ]


class RMIBSetTrapInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_MIB_ENTRY_CONTAINER(), PDIM_MIB_ENTRY_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRasAdminConnectionNotification_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("fRegister", 0),
        NDRIntField("dwClientProcessId", 0),
        NDRInt3264Field("hEventNotification", 0),
    ]


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


class RRasAdminSendUserMessage_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hDimConnection", 0),
        NDRConfVarStrNullFieldUtf16("lpwszMessage", ""),
    ]


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


class RRouterDeviceEnum_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("lpdwTotalEntries", 0),
    ]


class RRouterDeviceEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("lpdwTotalEntries", 0),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceTransportCreate_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwTransportId", 0),
        NDRConfVarStrNullFieldUtf16("lpwsTransportName", ""),
        NDRPacketField(
            "pInfoStruct", PDIM_INTERFACE_CONTAINER(), PDIM_INTERFACE_CONTAINER
        ),
        NDRConfVarStrNullFieldUtf16("lpwsDLLPath", ""),
    ]


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


class RRouterInterfaceDeviceGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("dwIndex", 0),
        NDRIntField("hInterface", 0),
    ]


class RRouterInterfaceDeviceGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceDeviceSetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("dwIndex", 0),
        NDRIntField("hInterface", 0),
    ]


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


class RRouterInterfaceSetCredentialsEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("hInterface", 0),
    ]


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


class RRouterInterfaceGetCredentialsEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("hInterface", 0),
    ]


class RRouterInterfaceGetCredentialsEx_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
        NDRIntField("status", 0),
    ]


class RRasAdminConnectionRemoveQuarantine_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hRasConnection", 0),
        NDRSignedIntField("fIsIpAddress", 0),
    ]


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


class RMprAdminServerSetInfo_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("dwLevel", 0),
        NDRPacketField(
            "pInfoStruct", PDIM_INFORMATION_CONTAINER(), PDIM_INFORMATION_CONTAINER
        ),
    ]


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


class MPRAPI_OBJECT_HEADER_IDL(NDRPacket):
    ALIGNMENT = (2, 2)
    fields_desc = [
        NDRByteField("revision", 0),
        NDRByteField("type", 0),
        NDRShortField("size", 0),
    ]


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


class IKEV2_TUNNEL_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwIdleTimeout", 0),
        NDRIntField("dwNetworkBlackoutTime", 0),
        NDRIntField("dwSaLifeTime", 0),
        NDRIntField("dwSaDataSizeForRenegotiation", 0),
        NDRIntField("dwConfigOptions", 0),
        NDRIntField("dwTotalCertificates", None, size_of="certificateNames"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "certificateNames",
                [],
                CERT_BLOB_1,
                size_is=lambda pkt: pkt.dwTotalCertificates,
            ),
            deferred=True,
        ),
    ]


class IKEV2_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumPorts", 0),
        NDRIntField("dwPortFlags", 0),
        NDRIntField("dwTunnelConfigParamFlags", 0),
        NDRPacketField(
            "TunnelConfigParams",
            IKEV2_TUNNEL_CONFIG_PARAMS_1(),
            IKEV2_TUNNEL_CONFIG_PARAMS_1,
        ),
    ]


class PPTP_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwNumPorts", 0), NDRIntField("dwPortFlags", 0)]


class L2TP_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwNumPorts", 0), NDRIntField("dwPortFlags", 0)]


class SSTP_CERT_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRSignedIntField("isDefault", 0),
        NDRPacketField("certBlob", CERT_BLOB_1(), CERT_BLOB_1),
    ]


class SSTP_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumPorts", 0),
        NDRIntField("dwPortFlags", 0),
        NDRSignedIntField("isUseHttps", 0),
        NDRIntField("certAlgorithm", 0),
        NDRPacketField("sstpCertDetails", SSTP_CERT_INFO_1(), SSTP_CERT_INFO_1),
    ]


class MPRAPI_TUNNEL_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField(
            "IkeConfigParams", IKEV2_CONFIG_PARAMS_1(), IKEV2_CONFIG_PARAMS_1
        ),
        NDRPacketField(
            "PptpConfigParams", PPTP_CONFIG_PARAMS_1(), PPTP_CONFIG_PARAMS_1
        ),
        NDRPacketField(
            "L2tpConfigParams", L2TP_CONFIG_PARAMS_1(), L2TP_CONFIG_PARAMS_1
        ),
        NDRPacketField(
            "SstpConfigParams", SSTP_CONFIG_PARAMS_1(), SSTP_CONFIG_PARAMS_1
        ),
    ]


class MPR_SERVER_EX_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRSignedIntField("fLanOnlyMode", 0),
        NDRIntField("dwUpTime", 0),
        NDRIntField("dwTotalPorts", 0),
        NDRIntField("dwPortsInUse", 0),
        NDRIntField("Reserved", 0),
        NDRPacketField(
            "ConfigParams",
            MPRAPI_TUNNEL_CONFIG_PARAMS_1(),
            MPRAPI_TUNNEL_CONFIG_PARAMS_1,
        ),
    ]


class ROUTER_CUSTOM_IKEv2_POLICY_0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("dwIntegrityMethod", 0),
        NDRIntField("dwEncryptionMethod", 0),
        NDRIntField("dwCipherTransformConstant", 0),
        NDRIntField("dwAuthTransformConstant", 0),
        NDRIntField("dwPfsGroup", 0),
        NDRIntField("dwDhGroup", 0),
    ]


class IKEV2_TUNNEL_CONFIG_PARAMS_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwIdleTimeout", 0),
        NDRIntField("dwNetworkBlackoutTime", 0),
        NDRIntField("dwSaLifeTime", 0),
        NDRIntField("dwSaDataSizeForRenegotiation", 0),
        NDRIntField("dwConfigOptions", 0),
        NDRIntField("dwTotalCertificates", None, size_of="certificateNames"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "certificateNames",
                [],
                CERT_BLOB_1,
                size_is=lambda pkt: pkt.dwTotalCertificates,
            ),
            deferred=True,
        ),
        NDRPacketField("machineCertificateName", CERT_BLOB_1(), CERT_BLOB_1),
        NDRIntField("dwEncryptionType", 0),
        NDRFullPointerField(
            NDRPacketField(
                "customPolicy",
                ROUTER_CUSTOM_IKEv2_POLICY_0(),
                ROUTER_CUSTOM_IKEv2_POLICY_0,
            ),
            deferred=True,
        ),
    ]


class IKEV2_CONFIG_PARAMS_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumPorts", 0),
        NDRIntField("dwPortFlags", 0),
        NDRIntField("dwTunnelConfigParamFlags", 0),
        NDRPacketField(
            "TunnelConfigParams",
            IKEV2_TUNNEL_CONFIG_PARAMS_2(),
            IKEV2_TUNNEL_CONFIG_PARAMS_2,
        ),
    ]


class MPRAPI_TUNNEL_CONFIG_PARAMS_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField(
            "IkeConfigParams", IKEV2_CONFIG_PARAMS_2(), IKEV2_CONFIG_PARAMS_2
        ),
        NDRPacketField(
            "PptpConfigParams", PPTP_CONFIG_PARAMS_1(), PPTP_CONFIG_PARAMS_1
        ),
        NDRPacketField(
            "L2tpConfigParams", L2TP_CONFIG_PARAMS_1(), L2TP_CONFIG_PARAMS_1
        ),
        NDRPacketField(
            "SstpConfigParams", SSTP_CONFIG_PARAMS_1(), SSTP_CONFIG_PARAMS_1
        ),
    ]


class MPR_SERVER_EX_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRSignedIntField("fLanOnlyMode", 0),
        NDRIntField("dwUpTime", 0),
        NDRIntField("dwTotalPorts", 0),
        NDRIntField("dwPortsInUse", 0),
        NDRIntField("Reserved", 0),
        NDRPacketField(
            "ConfigParams",
            MPRAPI_TUNNEL_CONFIG_PARAMS_2(),
            MPRAPI_TUNNEL_CONFIG_PARAMS_2,
        ),
    ]


class CERT_EKU_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwSize", None, size_of="pwszEKU"),
        NDRSignedIntField("IsEKUOID", 0),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("pwszEKU", "", size_is=lambda pkt: pkt.dwSize),
            deferred=True,
        ),
    ]


class IKEV2_TUNNEL_CONFIG_PARAMS_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwIdleTimeout", 0),
        NDRIntField("dwNetworkBlackoutTime", 0),
        NDRIntField("dwSaLifeTime", 0),
        NDRIntField("dwSaDataSizeForRenegotiation", 0),
        NDRIntField("dwConfigOptions", 0),
        NDRIntField("dwTotalCertificates", None, size_of="certificateNames"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "certificateNames",
                [],
                CERT_BLOB_1,
                size_is=lambda pkt: pkt.dwTotalCertificates,
            ),
            deferred=True,
        ),
        NDRPacketField("machineCertificateName", CERT_BLOB_1(), CERT_BLOB_1),
        NDRIntField("dwEncryptionType", 0),
        NDRFullPointerField(
            NDRPacketField(
                "customPolicy",
                ROUTER_CUSTOM_IKEv2_POLICY_0(),
                ROUTER_CUSTOM_IKEv2_POLICY_0,
            ),
            deferred=True,
        ),
        NDRIntField("dwTotalEkus", None, size_of="certificateEKUs"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "certificateEKUs", [], CERT_EKU_1, size_is=lambda pkt: pkt.dwTotalEkus
            ),
            deferred=True,
        ),
        NDRPacketField("machineCertificateHash", CERT_BLOB_1(), CERT_BLOB_1),
    ]


class IKEV2_CONFIG_PARAMS_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumPorts", 0),
        NDRIntField("dwPortFlags", 0),
        NDRIntField("dwTunnelConfigParamFlags", 0),
        NDRPacketField(
            "TunnelConfigParams",
            IKEV2_TUNNEL_CONFIG_PARAMS_3(),
            IKEV2_TUNNEL_CONFIG_PARAMS_3,
        ),
    ]


class PROUTER_CUSTOM_L2TP_POLICY_0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("dwIntegrityMethod", 0),
        NDRIntField("dwEncryptionMethod", 0),
        NDRIntField("dwCipherTransformConstant", 0),
        NDRIntField("dwAuthTransformConstant", 0),
        NDRIntField("dwPfsGroup", 0),
        NDRIntField("dwDhGroup", 0),
    ]


class L2TP_TUNNEL_CONFIG_PARAMS_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwIdleTimeout", 0),
        NDRIntField("dwEncryptionType", 0),
        NDRIntField("dwSaLifeTime", 0),
        NDRIntField("dwSaDataSizeForRenegotiation", 0),
        NDRFullPointerField(
            NDRPacketField(
                "customPolicy",
                PROUTER_CUSTOM_L2TP_POLICY_0(),
                PROUTER_CUSTOM_L2TP_POLICY_0,
            ),
            deferred=True,
        ),
    ]


class L2TP_CONFIG_PARAMS_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwNumPorts", 0),
        NDRIntField("dwPortFlags", 0),
        NDRIntField("dwTunnelConfigParamFlags", 0),
        NDRPacketField(
            "TunnelConfigParams",
            L2TP_TUNNEL_CONFIG_PARAMS_1(),
            L2TP_TUNNEL_CONFIG_PARAMS_1,
        ),
    ]


class MPRAPI_TUNNEL_CONFIG_PARAMS_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField(
            "IkeConfigParams", IKEV2_CONFIG_PARAMS_3(), IKEV2_CONFIG_PARAMS_3
        ),
        NDRPacketField(
            "PptpConfigParams", PPTP_CONFIG_PARAMS_1(), PPTP_CONFIG_PARAMS_1
        ),
        NDRPacketField(
            "L2tpConfigParams", L2TP_CONFIG_PARAMS_2(), L2TP_CONFIG_PARAMS_2
        ),
        NDRPacketField(
            "SstpConfigParams", SSTP_CONFIG_PARAMS_1(), SSTP_CONFIG_PARAMS_1
        ),
    ]


class MPR_SERVER_EX_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRSignedIntField("fLanOnlyMode", 0),
        NDRIntField("dwUpTime", 0),
        NDRIntField("dwTotalPorts", 0),
        NDRIntField("dwPortsInUse", 0),
        NDRIntField("Reserved", 0),
        NDRPacketField(
            "ConfigParams",
            MPRAPI_TUNNEL_CONFIG_PARAMS_3(),
            MPRAPI_TUNNEL_CONFIG_PARAMS_3,
        ),
    ]


class RMprAdminServerGetInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("pServerConfig", MPR_SERVER_EX_1(), MPR_SERVER_EX_1),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField("pServerConfig", MPR_SERVER_EX_2(), MPR_SERVER_EX_2),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
                (
                    NDRPacketField("pServerConfig", MPR_SERVER_EX_3(), MPR_SERVER_EX_3),
                    ((lambda pkt: None == 3), (lambda _, val: val.tag == 3)),
                ),
            ],
            StrFixedLenField("pServerConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
    ]


class RMprAdminServerGetInfoEx_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRPacketField("pServerConfig", MPR_SERVER_EX_1(), MPR_SERVER_EX_1),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField("pServerConfig", MPR_SERVER_EX_2(), MPR_SERVER_EX_2),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
                (
                    NDRPacketField("pServerConfig", MPR_SERVER_EX_3(), MPR_SERVER_EX_3),
                    ((lambda pkt: None == 3), (lambda _, val: val.tag == 3)),
                ),
            ],
            StrFixedLenField("pServerConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
        NDRIntField("status", 0),
    ]


class PMPRAPI_OBJECT_HEADER_IDL(NDRPacket):
    ALIGNMENT = (2, 2)
    fields_desc = [
        NDRByteField("revision", 0),
        NDRByteField("type", 0),
        NDRShortField("size", 0),
    ]


class ROUTER_INTERFACE_TYPE(IntEnum):
    ROUTER_IF_TYPE_CLIENT = 1
    ROUTER_IF_TYPE_HOME_ROUTER = 2
    ROUTER_IF_TYPE_FULL_ROUTER = 3
    ROUTER_IF_TYPE_DEDICATED = 4
    ROUTER_IF_TYPE_INTERNAL = 5
    ROUTER_IF_TYPE_LOOPBACK = 6
    ROUTER_IF_TYPE_TUNNEL1 = 7
    ROUTER_IF_TYPE_DIALOUT = 8


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


class RAS_QUARANTINE_STATE(IntEnum):
    RAS_QUAR_STATE_NORMAL = 1
    RAS_QUAR_STATE_QUARANTINE = 2
    RAS_QUAR_STATE_PROBATION = 3
    RAS_QUAR_STATE_UNKNOWN = 4


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


class PPP_PROJECTION_INFO_1(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntField("dwIPv4NegotiationError", 0),
        StrFixedLenFieldUtf16("wszAddress", "", length=16 * 2),
        StrFixedLenFieldUtf16("wszRemoteAddress", "", length=16 * 2),
        NDRIntField("dwIPv4Options", 0),
        NDRIntField("dwIPv4RemoteOptions", 0),
        NDRLongField("IPv4SubInterfaceIndex", 0),
        NDRIntField("dwIPv6NegotiationError", 0),
        StrFixedLenField("bInterfaceIdentifier", "", length=8),
        StrFixedLenField("bRemoteInterfaceIdentifier", "", length=8),
        StrFixedLenField("bPrefix", "", length=8),
        NDRIntField("dwPrefixLength", 0),
        NDRLongField("IPv6SubInterfaceIndex", 0),
        NDRIntField("dwLcpError", 0),
        NDRIntField("dwAuthenticationProtocol", 0),
        NDRIntField("dwAuthenticationData", 0),
        NDRIntField("dwRemoteAuthenticationProtocol", 0),
        NDRIntField("dwRemoteAuthenticationData", 0),
        NDRIntField("dwLcpTerminateReason", 0),
        NDRIntField("dwLcpRemoteTerminateReason", 0),
        NDRIntField("dwLcpOptions", 0),
        NDRIntField("dwLcpRemoteOptions", 0),
        NDRIntField("dwEapTypeId", 0),
        NDRIntField("dwRemoteEapTypeId", 0),
        NDRIntField("dwCcpError", 0),
        NDRIntField("dwCompressionAlgorithm", 0),
        NDRIntField("dwCcpOptions", 0),
        NDRIntField("dwRemoteCompressionAlgorithm", 0),
        NDRIntField("dwCcpRemoteOptions", 0),
    ]


class PIKEV2_PROJECTION_INFO_1(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntField("dwIPv4NegotiationError", 0),
        StrFixedLenFieldUtf16("wszAddress", "", length=16 * 2),
        StrFixedLenFieldUtf16("wszRemoteAddress", "", length=16 * 2),
        NDRLongField("IPv4SubInterfaceIndex", 0),
        NDRIntField("dwIPv6NegotiationError", 0),
        StrFixedLenField("bInterfaceIdentifier", "", length=8),
        StrFixedLenField("bRemoteInterfaceIdentifier", "", length=8),
        StrFixedLenField("bPrefix", "", length=8),
        NDRIntField("dwPrefixLength", 0),
        NDRLongField("IPv6SubInterfaceIndex", 0),
        NDRIntField("dwOptions", 0),
        NDRIntField("dwAuthenticationProtocol", 0),
        NDRIntField("dwEapTypeId", 0),
        NDRIntField("dwCompressionAlgorithm", 0),
        NDRIntField("dwEncryptionMethod", 0),
    ]


class RAS_CONNECTION_EX_1_IDL(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("dwConnectDuration", 0),
        NDRInt3264EnumField("dwInterfaceType", 0, ROUTER_INTERFACE_TYPE),
        NDRIntField("dwConnectionFlags", 0),
        StrFixedLenFieldUtf16("wszInterfaceName", "", length=257 * 2),
        StrFixedLenFieldUtf16("wszUserName", "", length=257 * 2),
        StrFixedLenFieldUtf16("wszLogonDomain", "", length=16 * 2),
        StrFixedLenFieldUtf16("wszRemoteComputer", "", length=17 * 2),
        NDRPacketField("guid", GUID(), GUID),
        NDRInt3264EnumField("rasQuarState", 0, RAS_QUARANTINE_STATE),
        NDRPacketField("probationTime", FILETIME(), FILETIME),
        NDRIntField("dwBytesXmited", 0),
        NDRIntField("dwBytesRcved", 0),
        NDRIntField("dwFramesXmited", 0),
        NDRIntField("dwFramesRcved", 0),
        NDRIntField("dwCrcErr", 0),
        NDRIntField("dwTimeoutErr", 0),
        NDRIntField("dwAlignmentErr", 0),
        NDRIntField("dwHardwareOverrunErr", 0),
        NDRIntField("dwFramingErr", 0),
        NDRIntField("dwBufferOverrunErr", 0),
        NDRIntField("dwCompressionRatioIn", 0),
        NDRIntField("dwCompressionRatioOut", 0),
        NDRIntField("dwNumSwitchOvers", 0),
        StrFixedLenFieldUtf16("wszRemoteEndpointAddress", "", length=65 * 2),
        StrFixedLenFieldUtf16("wszLocalEndpointAddress", "", length=65 * 2),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "ProjectionInfo", PPP_PROJECTION_INFO_1(), PPP_PROJECTION_INFO_1
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ProjectionInfo",
                            PIKEV2_PROJECTION_INFO_1(),
                            PIKEV2_PROJECTION_INFO_1,
                        ),
                        deferred=True,
                    ),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
            ],
            StrFixedLenField("ProjectionInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
        NDRIntField("hConnection", 0),
        NDRIntField("hInterface", 0),
    ]


class RRasAdminConnectionEnumEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRPacketField(
            "objectHeader", PMPRAPI_OBJECT_HEADER_IDL(), PMPRAPI_OBJECT_HEADER_IDL
        ),
        NDRIntField("dwPreferedMaxLen", 0),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
    ]


class RRasAdminConnectionEnumEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("lpdwEntriesRead", None, size_of="pRasConections"),
        NDRIntField("lpdNumTotalElements", 0),
        NDRConfFieldListField(
            "pRasConections",
            [],
            NDRFullPointerField(
                NDRUnionField(
                    [
                        (
                            NDRPacketField(
                                "pRasConnection",
                                RAS_CONNECTION_EX_1_IDL(),
                                RAS_CONNECTION_EX_1_IDL,
                            ),
                            ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                        )
                    ],
                    StrFixedLenField("pRasConnection", "", length=0),
                    align=(4, 8),
                    switch_fmt=("I", "I"),
                )
            ),
            size_is=lambda pkt: pkt.lpdwEntriesRead,
            ptr_pack=True,
        ),
        NDRFullPointerField(NDRIntField("lpdwResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class RRasAdminConnectionGetInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hDimConnection", 0),
        NDRPacketField(
            "objectHeader", PMPRAPI_OBJECT_HEADER_IDL(), PMPRAPI_OBJECT_HEADER_IDL
        ),
    ]


class RRasAdminConnectionGetInfoEx_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pRasConnection",
                        RAS_CONNECTION_EX_1_IDL(),
                        RAS_CONNECTION_EX_1_IDL,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                )
            ],
            StrFixedLenField("pRasConnection", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
        NDRIntField("status", 0),
    ]


class MPR_SERVER_SET_CONFIG_EX_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("setConfigForProtocols", 0),
        NDRPacketField(
            "ConfigParams",
            MPRAPI_TUNNEL_CONFIG_PARAMS_1(),
            MPRAPI_TUNNEL_CONFIG_PARAMS_1,
        ),
    ]


class MPR_SERVER_SET_CONFIG_EX_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("setConfigForProtocols", 0),
        NDRPacketField(
            "ConfigParams",
            MPRAPI_TUNNEL_CONFIG_PARAMS_2(),
            MPRAPI_TUNNEL_CONFIG_PARAMS_2,
        ),
    ]


class MPR_SERVER_SET_CONFIG_EX_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("setConfigForProtocols", 0),
        NDRPacketField(
            "ConfigParams",
            MPRAPI_TUNNEL_CONFIG_PARAMS_3(),
            MPRAPI_TUNNEL_CONFIG_PARAMS_3,
        ),
    ]


class RMprAdminServerSetInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pServerConfig",
                        MPR_SERVER_SET_CONFIG_EX_1(),
                        MPR_SERVER_SET_CONFIG_EX_1,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField(
                        "pServerConfig",
                        MPR_SERVER_SET_CONFIG_EX_2(),
                        MPR_SERVER_SET_CONFIG_EX_2,
                    ),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
                (
                    NDRPacketField(
                        "pServerConfig",
                        MPR_SERVER_SET_CONFIG_EX_3(),
                        MPR_SERVER_SET_CONFIG_EX_3,
                    ),
                    ((lambda pkt: None == 3), (lambda _, val: val.tag == 3)),
                ),
            ],
            StrFixedLenField("pServerConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
    ]


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


class RAS_UPDATE_CONNECTION_1_IDL(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("dwIfIndex", 0),
        StrFixedLenFieldUtf16("wszRemoteEndpointAddress", "", length=65 * 2),
    ]


class RRasAdminUpdateConnection_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hDimConnection", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pServerConfig",
                        RAS_UPDATE_CONNECTION_1_IDL(),
                        RAS_UPDATE_CONNECTION_1_IDL,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                )
            ],
            StrFixedLenField("pServerConfig", "", length=0),
            align=(4, 4),
            switch_fmt=("I", "I"),
        ),
    ]


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


class RRouterInterfaceSetCredentialsLocal_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRConfVarStrNullFieldUtf16("lpwsInterfaceName", ""),
        NDRConfVarStrNullFieldUtf16("lpwsUserName", ""),
        NDRConfVarStrNullFieldUtf16("lpwsDomainName", ""),
        NDRConfVarStrNullFieldUtf16("lpwsPassword", ""),
    ]


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


class RRouterInterfaceGetCredentialsLocal_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRConfVarStrNullFieldUtf16("lpwsInterfaceName", ""),
    ]


class RRouterInterfaceGetCredentialsLocal_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpwsUserName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpwsDomainName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("lpwsPassword", "")),
        NDRIntField("status", 0),
    ]


class PROUTER_CUSTOM_IKEv2_POLICY_0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("dwIntegrityMethod", 0),
        NDRIntField("dwEncryptionMethod", 0),
        NDRIntField("dwCipherTransformConstant", 0),
        NDRIntField("dwAuthTransformConstant", 0),
        NDRIntField("dwPfsGroup", 0),
        NDRIntField("dwDhGroup", 0),
    ]


class ROUTER_IKEv2_IF_CUSTOM_CONFIG_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwSaLifeTime", 0),
        NDRIntField("dwSaDataSize", 0),
        NDRPacketField("certificateName", CERT_BLOB_1(), CERT_BLOB_1),
        NDRFullPointerField(
            NDRPacketField(
                "customPolicy",
                PROUTER_CUSTOM_IKEv2_POLICY_0(),
                PROUTER_CUSTOM_IKEv2_POLICY_0,
            ),
            deferred=True,
        ),
    ]


class MPR_IF_CUSTOMINFOEX_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("dwFlags", 0),
        NDRPacketField(
            "customIkev2Config",
            ROUTER_IKEv2_IF_CUSTOM_CONFIG_0(),
            ROUTER_IKEv2_IF_CUSTOM_CONFIG_0,
        ),
    ]


class ROUTER_IKEv2_IF_CUSTOM_CONFIG_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwSaLifeTime", 0),
        NDRIntField("dwSaDataSize", 0),
        NDRPacketField("certificateName", CERT_BLOB_1(), CERT_BLOB_1),
        NDRFullPointerField(
            NDRPacketField(
                "customPolicy",
                PROUTER_CUSTOM_IKEv2_POLICY_0(),
                PROUTER_CUSTOM_IKEv2_POLICY_0,
            ),
            deferred=True,
        ),
        NDRPacketField("certificateHash", CERT_BLOB_1(), CERT_BLOB_1),
    ]


class MPR_IF_CUSTOMINFOEX_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Header", MPRAPI_OBJECT_HEADER_IDL(), MPRAPI_OBJECT_HEADER_IDL),
        NDRIntField("dwFlags", 0),
        NDRPacketField(
            "customIkev2Config",
            ROUTER_IKEv2_IF_CUSTOM_CONFIG_1(),
            ROUTER_IKEv2_IF_CUSTOM_CONFIG_1,
        ),
    ]


class RRouterInterfaceGetCustomInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_0(),
                        MPR_IF_CUSTOMINFOEX_0,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_1(),
                        MPR_IF_CUSTOMINFOEX_1,
                    ),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
            ],
            StrFixedLenField("pIfCustomConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
    ]


class RRouterInterfaceGetCustomInfoEx_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_0(),
                        MPR_IF_CUSTOMINFOEX_0,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_1(),
                        MPR_IF_CUSTOMINFOEX_1,
                    ),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
            ],
            StrFixedLenField("pIfCustomConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
        NDRIntField("status", 0),
    ]


class RRouterInterfaceSetCustomInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRLongField("hDimServer", 0),
        NDRIntField("hInterface", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_0(),
                        MPR_IF_CUSTOMINFOEX_0,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_1(),
                        MPR_IF_CUSTOMINFOEX_1,
                    ),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
            ],
            StrFixedLenField("pIfCustomConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
    ]


class RRouterInterfaceSetCustomInfoEx_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_0(),
                        MPR_IF_CUSTOMINFOEX_0,
                    ),
                    ((lambda pkt: None == 1), (lambda _, val: val.tag == 1)),
                ),
                (
                    NDRPacketField(
                        "pIfCustomConfig",
                        MPR_IF_CUSTOMINFOEX_1(),
                        MPR_IF_CUSTOMINFOEX_1,
                    ),
                    ((lambda pkt: None == 2), (lambda _, val: val.tag == 2)),
                ),
            ],
            StrFixedLenField("pIfCustomConfig", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
        NDRIntField("status", 0),
    ]


DIMSVC_OPNUMS = {
    0: DceRpcOp(RMprAdminServerGetInfo_Request, RMprAdminServerGetInfo_Response),
    1: DceRpcOp(RRasAdminConnectionEnum_Request, RRasAdminConnectionEnum_Response),
    2: DceRpcOp(
        RRasAdminConnectionGetInfo_Request, RRasAdminConnectionGetInfo_Response
    ),
    3: DceRpcOp(
        RRasAdminConnectionClearStats_Request, RRasAdminConnectionClearStats_Response
    ),
    4: DceRpcOp(RRasAdminPortEnum_Request, RRasAdminPortEnum_Response),
    5: DceRpcOp(RRasAdminPortGetInfo_Request, RRasAdminPortGetInfo_Response),
    6: DceRpcOp(RRasAdminPortClearStats_Request, RRasAdminPortClearStats_Response),
    7: DceRpcOp(RRasAdminPortReset_Request, RRasAdminPortReset_Response),
    8: DceRpcOp(RRasAdminPortDisconnect_Request, RRasAdminPortDisconnect_Response),
    9: DceRpcOp(
        RRouterInterfaceTransportSetGlobalInfo_Request,
        RRouterInterfaceTransportSetGlobalInfo_Response,
    ),
    10: DceRpcOp(
        RRouterInterfaceTransportGetGlobalInfo_Request,
        RRouterInterfaceTransportGetGlobalInfo_Response,
    ),
    11: DceRpcOp(RRouterInterfaceGetHandle_Request, RRouterInterfaceGetHandle_Response),
    12: DceRpcOp(RRouterInterfaceCreate_Request, RRouterInterfaceCreate_Response),
    13: DceRpcOp(RRouterInterfaceGetInfo_Request, RRouterInterfaceGetInfo_Response),
    14: DceRpcOp(RRouterInterfaceSetInfo_Request, RRouterInterfaceSetInfo_Response),
    15: DceRpcOp(RRouterInterfaceDelete_Request, RRouterInterfaceDelete_Response),
    16: DceRpcOp(
        RRouterInterfaceTransportRemove_Request,
        RRouterInterfaceTransportRemove_Response,
    ),
    17: DceRpcOp(
        RRouterInterfaceTransportAdd_Request, RRouterInterfaceTransportAdd_Response
    ),
    18: DceRpcOp(
        RRouterInterfaceTransportGetInfo_Request,
        RRouterInterfaceTransportGetInfo_Response,
    ),
    19: DceRpcOp(
        RRouterInterfaceTransportSetInfo_Request,
        RRouterInterfaceTransportSetInfo_Response,
    ),
    20: DceRpcOp(RRouterInterfaceEnum_Request, RRouterInterfaceEnum_Response),
    21: DceRpcOp(RRouterInterfaceConnect_Request, RRouterInterfaceConnect_Response),
    22: DceRpcOp(
        RRouterInterfaceDisconnect_Request, RRouterInterfaceDisconnect_Response
    ),
    23: DceRpcOp(
        RRouterInterfaceUpdateRoutes_Request, RRouterInterfaceUpdateRoutes_Response
    ),
    24: DceRpcOp(
        RRouterInterfaceQueryUpdateResult_Request,
        RRouterInterfaceQueryUpdateResult_Response,
    ),
    25: DceRpcOp(
        RRouterInterfaceUpdatePhonebookInfo_Request,
        RRouterInterfaceUpdatePhonebookInfo_Response,
    ),
    26: DceRpcOp(RMIBEntryCreate_Request, RMIBEntryCreate_Response),
    27: DceRpcOp(RMIBEntryDelete_Request, RMIBEntryDelete_Response),
    28: DceRpcOp(RMIBEntrySet_Request, RMIBEntrySet_Response),
    29: DceRpcOp(RMIBEntryGet_Request, RMIBEntryGet_Response),
    30: DceRpcOp(RMIBEntryGetFirst_Request, RMIBEntryGetFirst_Response),
    31: DceRpcOp(RMIBEntryGetNext_Request, RMIBEntryGetNext_Response),
    32: DceRpcOp(RMIBGetTrapInfo_Request, RMIBGetTrapInfo_Response),
    33: DceRpcOp(RMIBSetTrapInfo_Request, RMIBSetTrapInfo_Response),
    34: DceRpcOp(
        RRasAdminConnectionNotification_Request,
        RRasAdminConnectionNotification_Response,
    ),
    35: DceRpcOp(RRasAdminSendUserMessage_Request, RRasAdminSendUserMessage_Response),
    36: DceRpcOp(RRouterDeviceEnum_Request, RRouterDeviceEnum_Response),
    37: DceRpcOp(
        RRouterInterfaceTransportCreate_Request,
        RRouterInterfaceTransportCreate_Response,
    ),
    38: DceRpcOp(
        RRouterInterfaceDeviceGetInfo_Request, RRouterInterfaceDeviceGetInfo_Response
    ),
    39: DceRpcOp(
        RRouterInterfaceDeviceSetInfo_Request, RRouterInterfaceDeviceSetInfo_Response
    ),
    40: DceRpcOp(
        RRouterInterfaceSetCredentialsEx_Request,
        RRouterInterfaceSetCredentialsEx_Response,
    ),
    41: DceRpcOp(
        RRouterInterfaceGetCredentialsEx_Request,
        RRouterInterfaceGetCredentialsEx_Response,
    ),
    42: DceRpcOp(
        RRasAdminConnectionRemoveQuarantine_Request,
        RRasAdminConnectionRemoveQuarantine_Response,
    ),
    43: DceRpcOp(RMprAdminServerSetInfo_Request, RMprAdminServerSetInfo_Response),
    44: DceRpcOp(RMprAdminServerGetInfoEx_Request, RMprAdminServerGetInfoEx_Response),
    45: DceRpcOp(RRasAdminConnectionEnumEx_Request, RRasAdminConnectionEnumEx_Response),
    46: DceRpcOp(
        RRasAdminConnectionGetInfoEx_Request, RRasAdminConnectionGetInfoEx_Response
    ),
    47: DceRpcOp(RMprAdminServerSetInfoEx_Request, RMprAdminServerSetInfoEx_Response),
    48: DceRpcOp(RRasAdminUpdateConnection_Request, RRasAdminUpdateConnection_Response),
    49: DceRpcOp(
        RRouterInterfaceSetCredentialsLocal_Request,
        RRouterInterfaceSetCredentialsLocal_Response,
    ),
    50: DceRpcOp(
        RRouterInterfaceGetCredentialsLocal_Request,
        RRouterInterfaceGetCredentialsLocal_Response,
    ),
    51: DceRpcOp(
        RRouterInterfaceGetCustomInfoEx_Request,
        RRouterInterfaceGetCustomInfoEx_Response,
    ),
    52: DceRpcOp(
        RRouterInterfaceSetCustomInfoEx_Request,
        RRouterInterfaceSetCustomInfoEx_Response,
    ),
}
register_dcerpc_interface(
    name="dimsvc",
    uuid=uuid.UUID("8f09f000-b7ed-11ce-bbd2-00001a181cad"),
    version="0.0",
    opnums=DIMSVC_OPNUMS,
)


class RasRpcDeleteEntry_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpszPhonebook", ""),
        NDRConfVarStrNullFieldUtf16("lpszEntry", ""),
    ]


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


class LPRASRPC_CALLBACKLIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        StrFixedLenFieldUtf16("pszPortName", "", length=(16 + 1) * 2),
        StrFixedLenFieldUtf16("pszDeviceName", "", length=(128 + 1) * 2),
        StrFixedLenFieldUtf16("pszNumber", "", length=(128 + 1) * 2),
        NDRIntField("dwDeviceType", 0),
        NDRRecursiveField("pNext"),
    ]


class LPRASRPC_STRINGLIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        StrFixedLenFieldUtf16("psz", "", length=256 * 2),
        NDRRecursiveField("pNext"),
    ]


class LPRASRPC_LOCATIONLIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("dwLocationId", 0),
        NDRIntField("iPrefix", 0),
        NDRIntField("iSuffix", 0),
        NDRRecursiveField("pNext"),
    ]


class LPRASRPC_PBUSER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRSignedIntField("fOperatorDial", 0),
        NDRSignedIntField("fPreviewPhoneNumber", 0),
        NDRSignedIntField("fUseLocation", 0),
        NDRSignedIntField("fShowLights", 0),
        NDRSignedIntField("fShowConnectStatus", 0),
        NDRSignedIntField("fCloseOnDial", 0),
        NDRSignedIntField("fAllowLogonPhonebookEdits", 0),
        NDRSignedIntField("fAllowLogonLocationEdits", 0),
        NDRSignedIntField("fSkipConnectComplete", 0),
        NDRSignedIntField("fNewEntryWizard", 0),
        NDRIntField("dwRedialAttempts", 0),
        NDRIntField("dwRedialSeconds", 0),
        NDRIntField("dwIdleDisconnectSeconds", 0),
        NDRSignedIntField("fRedialOnLinkFailure", 0),
        NDRSignedIntField("fPopupOnTopWhenRedialing", 0),
        NDRSignedIntField("fExpandAutoDialQuery", 0),
        NDRIntField("dwCallbackMode", 0),
        NDRFullPointerField(
            NDRPacketField(
                "pCallbacks", LPRASRPC_CALLBACKLIST(), LPRASRPC_CALLBACKLIST
            ),
            deferred=True,
        ),
        StrFixedLenFieldUtf16("pszLastCallbackByCaller", "", length=129 * 2),
        NDRIntField("dwPhonebookMode", 0),
        StrFixedLenFieldUtf16("pszPersonalFile", "", length=260 * 2),
        StrFixedLenFieldUtf16("pszAlternatePath", "", length=260 * 2),
        NDRFullPointerField(
            NDRPacketField("pPhonebooks", LPRASRPC_STRINGLIST(), LPRASRPC_STRINGLIST),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField("pAreaCodes", LPRASRPC_STRINGLIST(), LPRASRPC_STRINGLIST),
            deferred=True,
        ),
        NDRSignedIntField("fUseAreaAndCountry", 0),
        NDRFullPointerField(
            NDRPacketField("pPrefixes", LPRASRPC_STRINGLIST(), LPRASRPC_STRINGLIST),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField("pSuffixes", LPRASRPC_STRINGLIST(), LPRASRPC_STRINGLIST),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField(
                "pLocations", LPRASRPC_LOCATIONLIST(), LPRASRPC_LOCATIONLIST
            ),
            deferred=True,
        ),
        NDRIntField("dwXPhonebook", 0),
        NDRIntField("dwYPhonebook", 0),
        StrFixedLenFieldUtf16("pszDefaultEntry", "", length=257 * 2),
        NDRSignedIntField("fInitialized", 0),
        NDRSignedIntField("fDirty", 0),
    ]


class RasRpcGetUserPreferences_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("pUser", LPRASRPC_PBUSER(), LPRASRPC_PBUSER),
        NDRIntField("dwMode", 0),
    ]


class RasRpcGetUserPreferences_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pUser", LPRASRPC_PBUSER(), LPRASRPC_PBUSER),
        NDRIntField("status", 0),
    ]


class RasRpcSetUserPreferences_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("pUser", LPRASRPC_PBUSER(), LPRASRPC_PBUSER),
        NDRIntField("dwMode", 0),
    ]


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


class RasRpcGetSystemDirectory_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpBuffer", ""),
        NDRIntField("uSize", None, size_of="lpBuffer"),
    ]


class RasRpcGetSystemDirectory_Response(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("lpBuffer", ""),
        NDRIntField("status", 0),
    ]


class RasRpcSubmitRequest_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRConfStrLenField("pReqBuffer", "", size_is=lambda pkt: pkt.dwcbBufSize)
        ),
        NDRIntField("dwcbBufSize", None, size_of="pReqBuffer"),
    ]


class RasRpcSubmitRequest_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRConfStrLenField("pReqBuffer", "", size_is=lambda pkt: pkt.dwcbBufSize)
        ),
        NDRIntField("status", 0),
    ]


class RasRpcGetInstalledProtocolsEx_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("fRouter", 0),
        NDRSignedIntField("fRasCli", 0),
        NDRSignedIntField("fRasSrv", 0),
    ]


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


class RasRpcGetVersion_Request(NDRPacket):
    fields_desc = [NDRIntField("pdwVersion", 0)]


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


RASRPC_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    # 3: Opnum3NotUsedOnWire,
    # 4: Opnum4NotUsedOnWire,
    5: DceRpcOp(RasRpcDeleteEntry_Request, RasRpcDeleteEntry_Response),
    # 6: Opnum6NotUsedOnWire,
    # 7: Opnum7NotUsedOnWire,
    # 8: Opnum8NotUsedOnWire,
    9: DceRpcOp(RasRpcGetUserPreferences_Request, RasRpcGetUserPreferences_Response),
    10: DceRpcOp(RasRpcSetUserPreferences_Request, RasRpcSetUserPreferences_Response),
    11: DceRpcOp(RasRpcGetSystemDirectory_Request, RasRpcGetSystemDirectory_Response),
    12: DceRpcOp(RasRpcSubmitRequest_Request, RasRpcSubmitRequest_Response),
    # 13: Opnum13NotUsedOnWire,
    14: DceRpcOp(
        RasRpcGetInstalledProtocolsEx_Request, RasRpcGetInstalledProtocolsEx_Response
    ),
    15: DceRpcOp(RasRpcGetVersion_Request, RasRpcGetVersion_Response),
    # 16: Opnum16NotUsedOnWire
}
register_dcerpc_interface(
    name="rasrpc",
    uuid=uuid.UUID("20610036-fa22-11cf-9823-00a0c911e5df"),
    version="1.0",
    opnums=RASRPC_OPNUMS,
)


class UpgradeRouterConfig_Request(NDRPacket):
    fields_desc = []


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


class SetUserConfig_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("pszService", ""),
        NDRConfVarStrNullFieldUtf16("pszNewGroup", ""),
    ]


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


IREMOTENETWORKCONFIG_OPNUMS = {
    0: DceRpcOp(UpgradeRouterConfig_Request, UpgradeRouterConfig_Response),
    1: DceRpcOp(SetUserConfig_Request, SetUserConfig_Response),
}
register_dcerpc_interface(
    name="IRemoteNetworkConfig",
    uuid=uuid.UUID("66a2db1b-d706-11d0-a37b-00c04fc9da04"),
    version="0.0",
    opnums=IREMOTENETWORKCONFIG_OPNUMS,
)


class RestartRouter_Request(NDRPacket):
    fields_desc = [NDRIntField("dwFlags", 0)]


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


IREMOTEROUTERRESTART_OPNUMS = {
    0: DceRpcOp(RestartRouter_Request, RestartRouter_Response)
}
register_dcerpc_interface(
    name="IRemoteRouterRestart",
    uuid=uuid.UUID("66a2db20-d706-11d0-a37b-00c04fc9da04"),
    version="0.0",
    opnums=IREMOTEROUTERRESTART_OPNUMS,
)


class SetDnsConfig_Request(NDRPacket):
    fields_desc = [NDRIntField("dwConfigId", 0), NDRIntField("dwNewValue", 0)]


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


IREMOTESETDNSCONFIG_OPNUMS = {0: DceRpcOp(SetDnsConfig_Request, SetDnsConfig_Response)}
register_dcerpc_interface(
    name="IRemoteSetDnsConfig",
    uuid=uuid.UUID("66a2db21-d706-11d0-a37b-00c04fc9da04"),
    version="0.0",
    opnums=IREMOTESETDNSCONFIG_OPNUMS,
)


class GetIcfEnabled_Request(NDRPacket):
    fields_desc = []


class GetIcfEnabled_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("status", 0), NDRIntField("comm_status", 0)]


class GetIcsEnabled_Request(NDRPacket):
    fields_desc = []


class GetIcsEnabled_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("status", 0), NDRIntField("comm_status", 0)]


IREMOTEICFICSCONFIG_OPNUMS = {
    0: DceRpcOp(GetIcfEnabled_Request, GetIcfEnabled_Response),
    1: DceRpcOp(GetIcsEnabled_Request, GetIcsEnabled_Response),
}
register_dcerpc_interface(
    name="IRemoteICFICSConfig",
    uuid=uuid.UUID("66a2db22-d706-11d0-a37b-00c04fc9da04"),
    version="0.0",
    opnums=IREMOTEICFICSCONFIG_OPNUMS,
)


class FLAGGED_WORD_BLOB(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["asData"]
    fields_desc = [
        NDRIntField("cBytes", 0),
        NDRIntField("clSize", None, size_of="asData"),
        NDRConfStrLenFieldUtf16(
            "asData", "", size_is=lambda pkt: pkt.clSize, conformant_in_struct=True
        ),
    ]


class GetStringFromId_Request(NDRPacket):
    fields_desc = [NDRIntField("stringId", 0)]


class GetStringFromId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pBstrName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


IREMOTESTRINGIDCONFIG_OPNUMS = {
    0: DceRpcOp(GetStringFromId_Request, GetStringFromId_Response)
}
register_dcerpc_interface(
    name="IRemoteStringIdConfig",
    uuid=uuid.UUID("67e08fc2-2984-4b62-b92e-fc1aae64bbbb"),
    version="0.0",
    opnums=IREMOTESTRINGIDCONFIG_OPNUMS,
)


class IPV6Address(NDRPacket):
    fields_desc = [StrFixedLenField("bytes", "", length=16)]


class GetAddressList_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("pszInterfaceName", ""),
        NDRIntField("dwIfIndex", 0),
    ]


class GetAddressList_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwNumAddresses", None, size_of="ppIPV6AddressList"),
        NDRConfPacketListField(
            "ppIPV6AddressList",
            [],
            IPV6Address,
            size_is=lambda pkt: pkt.pdwNumAddresses,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


IREMOTEIPV6CONFIG_OPNUMS = {
    0: DceRpcOp(GetAddressList_Request, GetAddressList_Response)
}
register_dcerpc_interface(
    name="IRemoteIPV6Config",
    uuid=uuid.UUID("6139d8a4-e508-4ebb-bac7-d7f275145897"),
    version="0.0",
    opnums=IREMOTEIPV6CONFIG_OPNUMS,
)


class PSSTP_CERT_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRSignedIntField("isDefault", 0),
        NDRPacketField("certBlob", CERT_BLOB_1(), CERT_BLOB_1),
    ]


class CheckIfCertificateAllowedRR_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("adminCertName", ""),
        NDRPacketField("certSha1", PSSTP_CERT_INFO_1(), PSSTP_CERT_INFO_1),
        NDRPacketField("certSha256", PSSTP_CERT_INFO_1(), PSSTP_CERT_INFO_1),
    ]


class CheckIfCertificateAllowedRR_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("certSha1", PSSTP_CERT_INFO_1(), PSSTP_CERT_INFO_1),
        NDRPacketField("certSha256", PSSTP_CERT_INFO_1(), PSSTP_CERT_INFO_1),
        NDRIntField("status", 0),
    ]


IREMOTESSTPCERTCHECK_OPNUMS = {
    0: DceRpcOp(
        CheckIfCertificateAllowedRR_Request, CheckIfCertificateAllowedRR_Response
    )
}
register_dcerpc_interface(
    name="IRemoteSstpCertCheck",
    uuid=uuid.UUID("5ff9bdf6-bd91-4d8b-a614-d6317acc8dd8"),
    version="0.0",
    opnums=IREMOTESSTPCERTCHECK_OPNUMS,
)
