### ms-frs1_frsrpc.idl
"""
RPC definitions for the following interfaces:
- frsrpc (v1.1): F5CC59B4-4264-101A-8C59-08002B2F8426
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid


from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfStrLenField,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    register_dcerpc_interface,
)


class PCOMM_PACKET(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Major", 0),
        NDRIntField("Minor", 0),
        NDRIntField("CsId", 0),
        NDRIntField("MemLen", 0),
        NDRIntField("PktLen", None, size_of="Pkt"),
        NDRIntField("UpkLen", 0),
        NDRFullPointerField(
            NDRConfStrLenField("Pkt", "", size_is=lambda pkt: pkt.PktLen), deferred=True
        ),
    ]


class FrsRpcSendCommPkt_Request(NDRPacket):
    fields_desc = [NDRPacketField("CommPkt", PCOMM_PACKET(), PCOMM_PACKET)]


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


class FrsRpcVerifyPromotionParent_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ParentAccount", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ParentPassword", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ReplicaSetName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ReplicaSetType", "")),
        NDRIntField("PartnerAuthLevel", 0),
        NDRIntField("GuidSize", 0),
    ]


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


class FrsRpcStartPromotionParent_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ParentAccount", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ParentPassword", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ReplicaSetName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ReplicaSetType", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("CxtionName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PartnerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PartnerPrincName", "")),
        NDRIntField("PartnerAuthLevel", 0),
        NDRIntField("GuidSize", None, size_of="ParentGuid"),
        NDRConfStrLenField("CxtionGuid", "", size_is=lambda pkt: pkt.GuidSize),
        NDRConfStrLenField("PartnerGuid", "", size_is=lambda pkt: pkt.GuidSize),
        NDRConfStrLenField("ParentGuid", "", size_is=lambda pkt: pkt.GuidSize),
    ]


class FrsRpcStartPromotionParent_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenField("ParentGuid", "", size_is=lambda pkt: pkt.GuidSize),
        NDRIntField("status", 0),
    ]


class FrsNOP_Request(NDRPacket):
    fields_desc = []


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


FRSRPC_OPNUMS = {
    0: DceRpcOp(FrsRpcSendCommPkt_Request, FrsRpcSendCommPkt_Response),
    1: DceRpcOp(
        FrsRpcVerifyPromotionParent_Request, FrsRpcVerifyPromotionParent_Response
    ),
    2: DceRpcOp(
        FrsRpcStartPromotionParent_Request, FrsRpcStartPromotionParent_Response
    ),
    3: DceRpcOp(FrsNOP_Request, FrsNOP_Response),
    # 4: Opnum4NotUsedOnWire,
    # 5: Opnum5NotUsedOnWire,
    # 6: Opnum6NotUsedOnWire,
    # 7: Opnum7NotUsedOnWire,
    # 8: Opnum8NotUsedOnWire,
    # 9: Opnum9NotUsedOnWire,
    # 10: Opnum10NotUsedOnWire
}
register_dcerpc_interface(
    name="frsrpc",
    uuid=uuid.UUID("F5CC59B4-4264-101A-8C59-08002B2F8426"),
    version="1.1",
    opnums=FRSRPC_OPNUMS,
)
