### ms-ocspa.idl
"""
RPC definitions for the following interfaces:
- IOCSPAdminD (v0.0): 784b693d-95f3-420b-8126-365c098659f2
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid


from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    NDRRecursiveField,
    NDRRefEmbPointerField,
    NDRShortField,
    NDRSignedIntField,
    NDRSignedLongField,
    register_com_interface,
)


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 VARENUM(IntEnum):
    VT_EMPTY = 0
    VT_NULL = 1
    VT_I2 = 2
    VT_I4 = 3
    VT_R4 = 4
    VT_R8 = 5
    VT_CY = 6
    VT_DATE = 7
    VT_BSTR = 8
    VT_DISPATCH = 9
    VT_ERROR = 10
    VT_BOOL = 11
    VT_VARIANT = 12
    VT_UNKNOWN = 13
    VT_DECIMAL = 14
    VT_I1 = 16
    VT_UI1 = 17
    VT_UI2 = 18
    VT_UI4 = 19
    VT_I8 = 20
    VT_UI8 = 21
    VT_INT = 22
    VT_UINT = 23
    VT_VOID = 24
    VT_HRESULT = 25
    VT_PTR = 26
    VT_SAFEARRAY = 27
    VT_CARRAY = 28
    VT_USERDEFINED = 29
    VT_LPSTR = 30
    VT_LPWSTR = 31
    VT_RECORD = 36
    VT_INT_PTR = 37
    VT_UINT_PTR = 38
    VT_ARRAY = 8192
    VT_BYREF = 16384


class CURRENCY(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [NDRSignedLongField("int64", 0)]


class MInterfacePointer(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["abData"]
    fields_desc = [
        NDRIntField("ulCntData", None, size_of="abData"),
        NDRConfStrLenField(
            "abData", "", size_is=lambda pkt: pkt.ulCntData, conformant_in_struct=True
        ),
    ]


class VARENUM(IntEnum):
    VT_EMPTY = 0
    VT_NULL = 1
    VT_I2 = 2
    VT_I4 = 3
    VT_R4 = 4
    VT_R8 = 5
    VT_CY = 6
    VT_DATE = 7
    VT_BSTR = 8
    VT_DISPATCH = 9
    VT_ERROR = 10
    VT_BOOL = 11
    VT_VARIANT = 12
    VT_UNKNOWN = 13
    VT_DECIMAL = 14
    VT_I1 = 16
    VT_UI1 = 17
    VT_UI2 = 18
    VT_UI4 = 19
    VT_I8 = 20
    VT_UI8 = 21
    VT_INT = 22
    VT_UINT = 23
    VT_VOID = 24
    VT_HRESULT = 25
    VT_PTR = 26
    VT_SAFEARRAY = 27
    VT_CARRAY = 28
    VT_USERDEFINED = 29
    VT_LPSTR = 30
    VT_LPWSTR = 31
    VT_RECORD = 36
    VT_INT_PTR = 37
    VT_UINT_PTR = 38
    VT_ARRAY = 8192
    VT_BYREF = 16384


class SF_TYPE(IntEnum):
    SF_ERROR = VARENUM.VT_ERROR
    SF_I1 = VARENUM.VT_I1
    SF_I2 = VARENUM.VT_I2
    SF_I4 = VARENUM.VT_I4
    SF_I8 = VARENUM.VT_I8
    SF_BSTR = VARENUM.VT_BSTR
    SF_UNKNOWN = VARENUM.VT_UNKNOWN
    SF_DISPATCH = VARENUM.VT_DISPATCH
    SF_VARIANT = VARENUM.VT_VARIANT
    SF_RECORD = VARENUM.VT_RECORD
    SF_HAVEIID = VARENUM.VT_UNKNOWN | 32768


class SAFEARR_BSTR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="aBstr"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "aBstr", [], FLAGGED_WORD_BLOB, size_is=lambda pkt: pkt.Size
            ),
            deferred=True,
        ),
    ]


class SAFEARR_UNKNOWN(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="apUnknown"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "apUnknown", [], MInterfacePointer, size_is=lambda pkt: pkt.Size
            ),
            deferred=True,
        ),
    ]


class SAFEARR_DISPATCH(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="apDispatch"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "apDispatch", [], MInterfacePointer, size_is=lambda pkt: pkt.Size
            ),
            deferred=True,
        ),
    ]


class wireVARIANTStr(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("clSize", 0),
        NDRIntField("rpcReserved", 0),
        NDRShortField("vt", 0),
        NDRShortField("wReserved1", 0),
        NDRShortField("wReserved2", 0),
        NDRShortField("wReserved3", 0),
        NDRRecursiveField("_varUnion"),
    ]


class GetOCSPProperty_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrEntryName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetOCSPProperty_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pEntryValue", wireVARIANTStr(), wireVARIANTStr)
        ),
        NDRIntField("status", 0),
    ]


class SetOCSPProperty_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrEntryName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRFullPointerField(
            NDRPacketField("pEntryValue", wireVARIANTStr(), wireVARIANTStr)
        ),
    ]


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


class GetCAConfigInformation_Request(NDRPacket):
    fields_desc = [NDRPacketField("bstrCAId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)]


class GetCAConfigInformation_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pEntryValue", wireVARIANTStr(), wireVARIANTStr)
        ),
        NDRIntField("status", 0),
    ]


class SetCAConfigInformation_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCAId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRFullPointerField(
            NDRPacketField("pEntryValue", wireVARIANTStr(), wireVARIANTStr)
        ),
    ]


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


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


class GetSecurity_Request(NDRPacket):
    fields_desc = []


class GetSecurity_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pctbSD", CERTTRANSBLOB(), CERTTRANSBLOB),
        NDRIntField("status", 0),
    ]


class SetSecurity_Request(NDRPacket):
    fields_desc = [NDRPacketField("pctbSD", CERTTRANSBLOB(), CERTTRANSBLOB)]


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


class GetSigningCertificates_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("pCAVar", wireVARIANTStr(), wireVARIANTStr))
    ]


class GetSigningCertificates_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pSigningCertificates", wireVARIANTStr(), wireVARIANTStr)
        ),
        NDRIntField("status", 0),
    ]


class GetHashAlgorithms_Request(NDRPacket):
    fields_desc = [NDRPacketField("bstrCAId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)]


class GetHashAlgorithms_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pHashAlgorithms", wireVARIANTStr(), wireVARIANTStr)
        ),
        NDRIntField("status", 0),
    ]


class GetMyRoles_Request(NDRPacket):
    fields_desc = []


class GetMyRoles_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pdwRoles", 0), NDRIntField("status", 0)]


class Ping_Request(NDRPacket):
    fields_desc = []


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


IOCSPADMIND_OPNUMS = {
    0: DceRpcOp(GetOCSPProperty_Request, GetOCSPProperty_Response),
    1: DceRpcOp(SetOCSPProperty_Request, SetOCSPProperty_Response),
    2: DceRpcOp(GetCAConfigInformation_Request, GetCAConfigInformation_Response),
    3: DceRpcOp(SetCAConfigInformation_Request, SetCAConfigInformation_Response),
    4: DceRpcOp(GetSecurity_Request, GetSecurity_Response),
    5: DceRpcOp(SetSecurity_Request, SetSecurity_Response),
    6: DceRpcOp(GetSigningCertificates_Request, GetSigningCertificates_Response),
    7: DceRpcOp(GetHashAlgorithms_Request, GetHashAlgorithms_Response),
    8: DceRpcOp(GetMyRoles_Request, GetMyRoles_Response),
    9: DceRpcOp(Ping_Request, Ping_Response),
}
register_com_interface(
    name="IOCSPAdminD",
    uuid=uuid.UUID("784b693d-95f3-420b-8126-365c098659f2"),
    opnums=IOCSPADMIND_OPNUMS,
)
