### ms-frs1_frsapi.idl
"""
RPC definitions for the following interfaces:
- NtFrsApi (v1.1): D049B186-814F-11D1-9A3C-00C04FC9B232
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid

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


class NtFrsApi_Rpc_Set_DsPollingIntervalW_Request(NDRPacket):
    fields_desc = [
        NDRIntField("UseShortInterval", 0),
        NDRIntField("LongInterval", 0),
        NDRIntField("ShortInterval", 0),
    ]


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


class NtFrsApi_Rpc_Get_DsPollingIntervalW_Request(NDRPacket):
    fields_desc = []


class NtFrsApi_Rpc_Get_DsPollingIntervalW_Response(NDRPacket):
    fields_desc = [
        NDRIntField("Interval", 0),
        NDRIntField("LongInterval", 0),
        NDRIntField("ShortInterval", 0),
        NDRIntField("status", 0),
    ]


class NtFrsApi_Rpc_InfoW_Request(NDRPacket):
    fields_desc = [
        NDRIntField("BlobSize", None, size_of="Blob"),
        NDRConfStrLenField("Blob", "", size_is=lambda pkt: pkt.BlobSize),
    ]


class NtFrsApi_Rpc_InfoW_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenField("Blob", "", size_is=lambda pkt: pkt.BlobSize),
        NDRIntField("status", 0),
    ]


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


class NtFrsApi_Rpc_IsPathReplicated_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Path", "")),
        NDRIntField("ReplicaSetTypeOfInterest", 0),
    ]


class NtFrsApi_Rpc_IsPathReplicated_Response(NDRPacket):
    fields_desc = [
        NDRIntField("Replicated", 0),
        NDRIntField("Primary", 0),
        NDRIntField("Root", 0),
        NDRPacketField("ReplicaSetGuid", GUID(), GUID),
        NDRIntField("status", 0),
    ]


class NtFrsApi_Rpc_WriterCommand_Request(NDRPacket):
    fields_desc = [NDRIntField("Command", 0)]


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


class NtFrsApi_Rpc_ForceReplication_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ReplicaSetGuid", GUID(), GUID)),
        NDRFullPointerField(NDRPacketField("CxtionGuid", GUID(), GUID)),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ReplicaSetName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PartnerDnsName", "")),
    ]


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


NTFRSAPI_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    # 3: Opnum3NotUsedOnWire,
    4: DceRpcOp(
        NtFrsApi_Rpc_Set_DsPollingIntervalW_Request,
        NtFrsApi_Rpc_Set_DsPollingIntervalW_Response,
    ),
    5: DceRpcOp(
        NtFrsApi_Rpc_Get_DsPollingIntervalW_Request,
        NtFrsApi_Rpc_Get_DsPollingIntervalW_Response,
    ),
    # 6: Opnum6NotUsedOnWire,
    7: DceRpcOp(NtFrsApi_Rpc_InfoW_Request, NtFrsApi_Rpc_InfoW_Response),
    8: DceRpcOp(
        NtFrsApi_Rpc_IsPathReplicated_Request, NtFrsApi_Rpc_IsPathReplicated_Response
    ),
    9: DceRpcOp(
        NtFrsApi_Rpc_WriterCommand_Request, NtFrsApi_Rpc_WriterCommand_Response
    ),
    10: DceRpcOp(
        NtFrsApi_Rpc_ForceReplication_Request, NtFrsApi_Rpc_ForceReplication_Response
    ),
}
register_dcerpc_interface(
    name="NtFrsApi",
    uuid=uuid.UUID("D049B186-814F-11D1-9A3C-00C04FC9B232"),
    version="1.1",
    opnums=NTFRSAPI_OPNUMS,
)
