### ms-fax_faxclient.idl
"""
RPC definitions for the following interfaces:
- faxclient (v3.0): 6099fc12-3eff-11d0-abd0-00c04fd91a4e
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid


from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfStrLenField,
    NDRContextHandle,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    register_dcerpc_interface,
)


class FAX_OpenConnection_Request(NDRPacket):
    fields_desc = [NDRLongField("Context", 0)]


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


class FILETIME(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwLowDateTime", 0), NDRIntField("dwHighDateTime", 0)]


class FAX_EVENT(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("SizeOfStruct", 0),
        NDRPacketField("TimeStamp", FILETIME(), FILETIME),
        NDRIntField("DeviceId", 0),
        NDRIntField("EventId", 0),
        NDRIntField("JobId", 0),
    ]


class FAX_ClientEventQueue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("FaxPortHandle", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("FaxEvent", FAX_EVENT(), FAX_EVENT),
    ]


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


class FAX_CloseConnection_Request(NDRPacket):
    fields_desc = [NDRPacketField("FaxHandle", NDRContextHandle(), NDRContextHandle)]


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


class FAX_ClientEventQueueEx_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hClientContext", NDRContextHandle(), NDRContextHandle),
        NDRConfStrLenField("lpbData", "", size_is=lambda pkt: pkt.dwDataSize),
        NDRIntField("dwDataSize", None, size_of="lpbData"),
    ]


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


FAXCLIENT_OPNUMS = {
    0: DceRpcOp(FAX_OpenConnection_Request, FAX_OpenConnection_Response),
    1: DceRpcOp(FAX_ClientEventQueue_Request, FAX_ClientEventQueue_Response),
    2: DceRpcOp(FAX_CloseConnection_Request, FAX_CloseConnection_Response),
    3: DceRpcOp(FAX_ClientEventQueueEx_Request, FAX_ClientEventQueueEx_Response),
}
register_dcerpc_interface(
    name="faxclient",
    uuid=uuid.UUID("6099fc12-3eff-11d0-abd0-00c04fd91a4e"),
    version="3.0",
    opnums=FAXCLIENT_OPNUMS,
)
