### rpctypes.idl
"""
RPC definitions for the following interfaces:
-
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,
    NDRByteField,
    NDRConfPacketListField,
    NDRFieldListField,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    NDRShortField,
    NDRSignedByteField,
)


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


class RPC_IF_ID(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRPacketField("Uuid", UUID(), UUID),
        NDRShortField("VersMajor", 0),
        NDRShortField("VersMinor", 0),
    ]


class uuid_t(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("time_low", 0),
        NDRShortField("time_mid", 0),
        NDRShortField("time_hi_and_version", 0),
        NDRByteField("clock_seq_hi_and_reserved", 0),
        NDRByteField("clock_seq_low", 0),
        StrFixedLenField("node", "", length=6),
    ]


class uuid_p_t(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("time_low", 0),
        NDRShortField("time_mid", 0),
        NDRShortField("time_hi_and_version", 0),
        NDRByteField("clock_seq_hi_and_reserved", 0),
        NDRByteField("clock_seq_low", 0),
        StrFixedLenField("node", "", length=6),
    ]


class ndr_format_t(NDRPacket):
    fields_desc = [
        NDRByteField("int_rep", 0),
        NDRByteField("char_rep", 0),
        NDRByteField("float_rep", 0),
        NDRSignedByteField("reserved", 0),
    ]


class ndr_format_p_t(NDRPacket):
    fields_desc = [
        NDRByteField("int_rep", 0),
        NDRByteField("char_rep", 0),
        NDRByteField("float_rep", 0),
        NDRSignedByteField("reserved", 0),
    ]


class ndr_context_handle(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("context_handle_attributes", 0),
        NDRPacketField("context_handle_uuid", uuid_t(), uuid_t),
    ]


class ISO_MULTI_LINGUAL(NDRPacket):
    fields_desc = [NDRSignedByteField("row", 0), NDRSignedByteField("column", 0)]


class ISO_UCS(NDRPacket):
    fields_desc = [
        NDRSignedByteField("group", 0),
        NDRSignedByteField("plane", 0),
        NDRSignedByteField("row", 0),
        NDRSignedByteField("column", 0),
    ]


class rpc_if_id_vector_t(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Count", None, size_of="IfId"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "IfId", [], RPC_IF_ID, size_is=lambda pkt: pkt.Count, ptr_pack=True
            ),
            deferred=True,
        ),
    ]


class rpc_if_id_vector_p_t(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Count", None, size_of="IfId"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "IfId", [], RPC_IF_ID, size_is=lambda pkt: pkt.Count, ptr_pack=True
            ),
            deferred=True,
        ),
    ]


class rpc_stats_vector_t(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("count", 0),
        NDRFieldListField("stats", [], NDRIntField("", 0), length_is=lambda _: 1),
    ]


class rpc_stats_vector_p_t(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("count", 0),
        NDRFieldListField("stats", [], NDRIntField("", 0), length_is=lambda _: 1),
    ]
