### ms-even6.idl
"""
RPC definitions for the following interfaces:
- IEventService (v1.0): f6beaff7-1e19-4fbb-9f8f-b89e2018337c
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfVarStrLenField,
    NDRConfVarStrLenFieldUtf16,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRContextHandle,
    NDRFullPointerField,
    NDRIntEnumField,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRShortField,
    NDRSignedIntField,
    NDRSignedLongField,
    NDRUnionField,
    register_dcerpc_interface,
)


class EvtRpcQueryChannelInfo(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("name", 0), deferred=True),
        NDRIntField("status", 0),
    ]


class RpcInfo(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("m_error", 0),
        NDRIntField("m_subErr", 0),
        NDRIntField("m_subErrParam", 0),
    ]


class EvtRpcRegisterRemoteSubscription_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("channelPath", "")),
        NDRConfVarStrNullFieldUtf16("query", ""),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("bookmarkXml", "")),
        NDRIntField("flags", 0),
    ]


class EvtRpcRegisterRemoteSubscription_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("handle", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("control", NDRContextHandle(), NDRContextHandle),
        NDRIntField("queryChannelInfoSize", None, size_of="queryChannelInfo"),
        NDRConfPacketListField(
            "queryChannelInfo",
            [],
            EvtRpcQueryChannelInfo,
            size_is=lambda pkt: pkt.queryChannelInfoSize,
            ptr_pack=True,
        ),
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcRemoteSubscriptionNextAsync_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("handle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("numRequestedRecords", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcRemoteSubscriptionNextAsync_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numActualRecords", None, size_of="eventDataSizes"),
        NDRConfFieldListField(
            "eventDataIndices",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.numActualRecords,
            ptr_pack=True,
        ),
        NDRConfFieldListField(
            "eventDataSizes",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.numActualRecords,
            ptr_pack=True,
        ),
        NDRIntField("resultBufferSize", None, size_of="resultBuffer"),
        NDRConfStrLenField(
            "resultBuffer", "", size_is=lambda pkt: pkt.resultBufferSize
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcRemoteSubscriptionNext_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("handle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("numRequestedRecords", 0),
        NDRIntField("timeOut", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcRemoteSubscriptionNext_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numActualRecords", None, size_of="eventDataSizes"),
        NDRConfFieldListField(
            "eventDataIndices",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.numActualRecords,
            ptr_pack=True,
        ),
        NDRConfFieldListField(
            "eventDataSizes",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.numActualRecords,
            ptr_pack=True,
        ),
        NDRIntField("resultBufferSize", None, size_of="resultBuffer"),
        NDRConfStrLenField(
            "resultBuffer", "", size_is=lambda pkt: pkt.resultBufferSize
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcRemoteSubscriptionWaitAsync_Request(NDRPacket):
    fields_desc = [NDRPacketField("handle", NDRContextHandle(), NDRContextHandle)]


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


class EvtRpcRegisterControllableOperation_Request(NDRPacket):
    fields_desc = []


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


class EvtRpcRegisterLogQuery_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("path", "")),
        NDRConfVarStrNullFieldUtf16("query", ""),
        NDRIntField("flags", 0),
    ]


class EvtRpcRegisterLogQuery_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("handle", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("opControl", NDRContextHandle(), NDRContextHandle),
        NDRIntField("queryChannelInfoSize", None, size_of="queryChannelInfo"),
        NDRConfPacketListField(
            "queryChannelInfo",
            [],
            EvtRpcQueryChannelInfo,
            size_is=lambda pkt: pkt.queryChannelInfoSize,
            ptr_pack=True,
        ),
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcClearLog_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("control", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("channelPath", ""),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("backupPath", "")),
        NDRIntField("flags", 0),
    ]


class EvtRpcClearLog_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcExportLog_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("control", NDRContextHandle(), NDRContextHandle),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("channelPath", "")),
        NDRConfVarStrNullFieldUtf16("query", ""),
        NDRConfVarStrNullFieldUtf16("backupPath", ""),
        NDRIntField("flags", 0),
    ]


class EvtRpcExportLog_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcLocalizeExportLog_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("control", NDRContextHandle(), NDRContextHandle),
        NDRConfVarStrNullFieldUtf16("logFilePath", ""),
        NDRIntField("locale", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcLocalizeExportLog_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcVariantType(IntEnum):
    EvtRpcVarTypeNull = 0
    EvtRpcVarTypeBoolean = 1
    EvtRpcVarTypeUInt32 = 2
    EvtRpcVarTypeUInt64 = 3
    EvtRpcVarTypeString = 4
    EvtRpcVarTypeGuid = 5
    EvtRpcVarTypeBooleanArray = 6
    EvtRpcVarTypeUInt32Array = 7
    EvtRpcVarTypeUInt64Array = 8
    EvtRpcVarTypeStringArray = 9
    EvtRpcVarTypeGuidArray = 10


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


class BooleanArray(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("count", None, size_of="ptr"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "ptr", [], NDRIntField("ptr", 0), size_is=lambda pkt: pkt.count
            ),
            deferred=True,
        ),
    ]


class UInt32Array(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("count", None, size_of="ptr"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "ptr", [], NDRIntField("ptr", 0), size_is=lambda pkt: pkt.count
            ),
            deferred=True,
        ),
    ]


class UInt64Array(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("count", None, size_of="ptr"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "ptr", [], NDRLongField("ptr", 0), size_is=lambda pkt: pkt.count
            ),
            deferred=True,
        ),
    ]


class StringArray(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("count", None, size_of="ptr"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "ptr",
                [],
                NDRFullPointerField(
                    NDRConfVarStrNullFieldUtf16("ptr", ""), deferred=True
                ),
                size_is=lambda pkt: pkt.count,
            ),
            deferred=True,
        ),
    ]


class GuidArray(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("count", None, size_of="ptr"),
        NDRFullPointerField(
            NDRConfPacketListField("ptr", [], GUID, size_is=lambda pkt: pkt.count),
            deferred=True,
        ),
    ]


class EvtRpcVariant(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntEnumField("type", 0, EvtRpcVariantType),
        NDRIntField("flags", 0),
        NDRUnionField(
            [
                (
                    NDRSignedIntField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeNull
                        ),
                        (lambda _, val: val.tag == EvtRpcVariantType.EvtRpcVarTypeNull),
                    ),
                ),
                (
                    NDRIntField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeBoolean
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeBoolean
                        ),
                    ),
                ),
                (
                    NDRIntField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeUInt32
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeUInt32
                        ),
                    ),
                ),
                (
                    NDRLongField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeUInt64
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeUInt64
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRConfVarStrNullFieldUtf16("value", ""), deferred=True
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeString
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeString
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("value", GUID(), GUID), deferred=True
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeGuid
                        ),
                        (lambda _, val: val.tag == EvtRpcVariantType.EvtRpcVarTypeGuid),
                    ),
                ),
                (
                    NDRPacketField("value", BooleanArray(), BooleanArray),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeBooleanArray
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeBooleanArray
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", UInt32Array(), UInt32Array),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeUInt32Array
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeUInt32Array
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", UInt64Array(), UInt64Array),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeUInt64Array
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeUInt64Array
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", StringArray(), StringArray),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeStringArray
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeStringArray
                        ),
                    ),
                ),
                (
                    NDRPacketField("value", GuidArray(), GuidArray),
                    (
                        (
                            lambda pkt: getattr(pkt, "type", None)
                            == EvtRpcVariantType.EvtRpcVarTypeGuidArray
                        ),
                        (
                            lambda _, val: val.tag
                            == EvtRpcVariantType.EvtRpcVarTypeGuidArray
                        ),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
    ]


class EvtRpcVariantList(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("count", None, size_of="props"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "props", [], EvtRpcVariant, size_is=lambda pkt: pkt.count
            ),
            deferred=True,
        ),
    ]


class EvtRpcMessageRender_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("pubCfgObj", NDRContextHandle(), NDRContextHandle),
        NDRIntField("sizeEventId", None, size_of="eventId"),
        NDRConfStrLenField("eventId", "", size_is=lambda pkt: pkt.sizeEventId),
        NDRIntField("messageId", 0),
        NDRPacketField("values", EvtRpcVariantList(), EvtRpcVariantList),
        NDRIntField("flags", 0),
        NDRIntField("maxSizeString", 0),
    ]


class EvtRpcMessageRender_Response(NDRPacket):
    fields_desc = [
        NDRIntField("actualSizeString", None, size_of="string"),
        NDRIntField("neededSizeString", 0),
        NDRConfStrLenField("string", "", size_is=lambda pkt: pkt.actualSizeString),
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcMessageRenderDefault_Request(NDRPacket):
    fields_desc = [
        NDRIntField("sizeEventId", None, size_of="eventId"),
        NDRConfStrLenField("eventId", "", size_is=lambda pkt: pkt.sizeEventId),
        NDRIntField("messageId", 0),
        NDRPacketField("values", EvtRpcVariantList(), EvtRpcVariantList),
        NDRIntField("flags", 0),
        NDRIntField("maxSizeString", 0),
    ]


class EvtRpcMessageRenderDefault_Response(NDRPacket):
    fields_desc = [
        NDRIntField("actualSizeString", None, size_of="string"),
        NDRIntField("neededSizeString", 0),
        NDRConfStrLenField("string", "", size_is=lambda pkt: pkt.actualSizeString),
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcQueryNext_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("logQuery", NDRContextHandle(), NDRContextHandle),
        NDRIntField("numRequestedRecords", 0),
        NDRIntField("timeOutEnd", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcQueryNext_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numActualRecords", None, size_of="eventDataSizes"),
        NDRConfFieldListField(
            "eventDataIndices",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.numActualRecords,
            ptr_pack=True,
        ),
        NDRConfFieldListField(
            "eventDataSizes",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.numActualRecords,
            ptr_pack=True,
        ),
        NDRIntField("resultBufferSize", None, size_of="resultBuffer"),
        NDRConfStrLenField(
            "resultBuffer", "", size_is=lambda pkt: pkt.resultBufferSize
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcQuerySeek_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("logQuery", NDRContextHandle(), NDRContextHandle),
        NDRSignedLongField("pos", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("bookmarkXml", "")),
        NDRIntField("timeOut", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcQuerySeek_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcClose_Request(NDRPacket):
    fields_desc = [NDRPacketField("handle", NDRContextHandle(), NDRContextHandle)]


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


class EvtRpcCancel_Request(NDRPacket):
    fields_desc = [NDRPacketField("handle", NDRContextHandle(), NDRContextHandle)]


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


class EvtRpcAssertConfig_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("path", ""), NDRIntField("flags", 0)]


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


class EvtRpcRetractConfig_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("path", ""), NDRIntField("flags", 0)]


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


class EvtRpcOpenLogHandle_Request(NDRPacket):
    fields_desc = [NDRConfVarStrNullFieldUtf16("channel", ""), NDRIntField("flags", 0)]


class EvtRpcOpenLogHandle_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("handle", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcGetLogFileInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("logHandle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("propertyId", 0),
        NDRIntField("propertyValueBufferSize", 0),
    ]


class EvtRpcGetLogFileInfo_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenField(
            "propertyValueBuffer", "", size_is=lambda pkt: pkt.propertyValueBufferSize
        ),
        NDRIntField("propertyValueBufferLength", 0),
        NDRIntField("status", 0),
    ]


class EvtRpcGetChannelList_Request(NDRPacket):
    fields_desc = [NDRIntField("flags", 0)]


class EvtRpcGetChannelList_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numChannelPaths", None, size_of="channelPaths"),
        NDRConfVarStrLenFieldUtf16(
            "channelPaths", "", size_is=lambda pkt: pkt.numChannelPaths
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcGetChannelConfig_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("channelPath", ""),
        NDRIntField("flags", 0),
    ]


class EvtRpcGetChannelConfig_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("props", EvtRpcVariantList(), EvtRpcVariantList),
        NDRIntField("status", 0),
    ]


class EvtRpcPutChannelConfig_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("channelPath", ""),
        NDRIntField("flags", 0),
        NDRPacketField("props", EvtRpcVariantList(), EvtRpcVariantList),
    ]


class EvtRpcPutChannelConfig_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("error", RpcInfo(), RpcInfo),
        NDRIntField("status", 0),
    ]


class EvtRpcGetPublisherList_Request(NDRPacket):
    fields_desc = [NDRIntField("flags", 0)]


class EvtRpcGetPublisherList_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numPublisherIds", None, size_of="publisherIds"),
        NDRConfVarStrLenFieldUtf16(
            "publisherIds", "", size_is=lambda pkt: pkt.numPublisherIds
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcGetPublisherListForChannel_Request(NDRPacket):
    fields_desc = [NDRShortField("channelName", 0), NDRIntField("flags", 0)]


class EvtRpcGetPublisherListForChannel_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numPublisherIds", None, size_of="publisherIds"),
        NDRConfVarStrLenFieldUtf16(
            "publisherIds", "", size_is=lambda pkt: pkt.numPublisherIds
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcGetPublisherMetadata_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("publisherId", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("logFilePath", "")),
        NDRIntField("locale", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcGetPublisherMetadata_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pubMetadataProps", EvtRpcVariantList(), EvtRpcVariantList),
        NDRPacketField("pubMetadata", NDRContextHandle(), NDRContextHandle),
        NDRIntField("status", 0),
    ]


class EvtRpcGetPublisherResourceMetadata_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("handle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("propertyId", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcGetPublisherResourceMetadata_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pubMetadataProps", EvtRpcVariantList(), EvtRpcVariantList),
        NDRIntField("status", 0),
    ]


class EvtRpcGetEventMetadataEnum_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("pubMetadata", NDRContextHandle(), NDRContextHandle),
        NDRIntField("flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("reservedForFilter", "")),
    ]


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


class EvtRpcGetNextEventMetadata_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("eventMetaDataEnum", NDRContextHandle(), NDRContextHandle),
        NDRIntField("flags", 0),
        NDRIntField("numRequested", 0),
    ]


class EvtRpcGetNextEventMetadata_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numReturned", None, size_of="eventMetadataInstances"),
        NDRConfPacketListField(
            "eventMetadataInstances",
            [],
            EvtRpcVariantList,
            size_is=lambda pkt: pkt.numReturned,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class EvtRpcGetClassicLogDisplayName_Request(NDRPacket):
    fields_desc = [
        NDRConfVarStrNullFieldUtf16("logName", ""),
        NDRIntField("locale", 0),
        NDRIntField("flags", 0),
    ]


class EvtRpcGetClassicLogDisplayName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("displayName", 0)),
        NDRIntField("status", 0),
    ]


IEVENTSERVICE_OPNUMS = {
    0: DceRpcOp(
        EvtRpcRegisterRemoteSubscription_Request,
        EvtRpcRegisterRemoteSubscription_Response,
    ),
    1: DceRpcOp(
        EvtRpcRemoteSubscriptionNextAsync_Request,
        EvtRpcRemoteSubscriptionNextAsync_Response,
    ),
    2: DceRpcOp(
        EvtRpcRemoteSubscriptionNext_Request, EvtRpcRemoteSubscriptionNext_Response
    ),
    3: DceRpcOp(
        EvtRpcRemoteSubscriptionWaitAsync_Request,
        EvtRpcRemoteSubscriptionWaitAsync_Response,
    ),
    4: DceRpcOp(
        EvtRpcRegisterControllableOperation_Request,
        EvtRpcRegisterControllableOperation_Response,
    ),
    5: DceRpcOp(EvtRpcRegisterLogQuery_Request, EvtRpcRegisterLogQuery_Response),
    6: DceRpcOp(EvtRpcClearLog_Request, EvtRpcClearLog_Response),
    7: DceRpcOp(EvtRpcExportLog_Request, EvtRpcExportLog_Response),
    8: DceRpcOp(EvtRpcLocalizeExportLog_Request, EvtRpcLocalizeExportLog_Response),
    9: DceRpcOp(EvtRpcMessageRender_Request, EvtRpcMessageRender_Response),
    10: DceRpcOp(
        EvtRpcMessageRenderDefault_Request, EvtRpcMessageRenderDefault_Response
    ),
    11: DceRpcOp(EvtRpcQueryNext_Request, EvtRpcQueryNext_Response),
    12: DceRpcOp(EvtRpcQuerySeek_Request, EvtRpcQuerySeek_Response),
    13: DceRpcOp(EvtRpcClose_Request, EvtRpcClose_Response),
    14: DceRpcOp(EvtRpcCancel_Request, EvtRpcCancel_Response),
    15: DceRpcOp(EvtRpcAssertConfig_Request, EvtRpcAssertConfig_Response),
    16: DceRpcOp(EvtRpcRetractConfig_Request, EvtRpcRetractConfig_Response),
    17: DceRpcOp(EvtRpcOpenLogHandle_Request, EvtRpcOpenLogHandle_Response),
    18: DceRpcOp(EvtRpcGetLogFileInfo_Request, EvtRpcGetLogFileInfo_Response),
    19: DceRpcOp(EvtRpcGetChannelList_Request, EvtRpcGetChannelList_Response),
    20: DceRpcOp(EvtRpcGetChannelConfig_Request, EvtRpcGetChannelConfig_Response),
    21: DceRpcOp(EvtRpcPutChannelConfig_Request, EvtRpcPutChannelConfig_Response),
    22: DceRpcOp(EvtRpcGetPublisherList_Request, EvtRpcGetPublisherList_Response),
    23: DceRpcOp(
        EvtRpcGetPublisherListForChannel_Request,
        EvtRpcGetPublisherListForChannel_Response,
    ),
    24: DceRpcOp(
        EvtRpcGetPublisherMetadata_Request, EvtRpcGetPublisherMetadata_Response
    ),
    25: DceRpcOp(
        EvtRpcGetPublisherResourceMetadata_Request,
        EvtRpcGetPublisherResourceMetadata_Response,
    ),
    26: DceRpcOp(
        EvtRpcGetEventMetadataEnum_Request, EvtRpcGetEventMetadataEnum_Response
    ),
    27: DceRpcOp(
        EvtRpcGetNextEventMetadata_Request, EvtRpcGetNextEventMetadata_Response
    ),
    28: DceRpcOp(
        EvtRpcGetClassicLogDisplayName_Request, EvtRpcGetClassicLogDisplayName_Response
    ),
}
register_dcerpc_interface(
    name="IEventService",
    uuid=uuid.UUID("f6beaff7-1e19-4fbb-9f8f-b89e2018337c"),
    version="1.0",
    opnums=IEVENTSERVICE_OPNUMS,
)
