### ms-dhcpm.idl
"""
RPC definitions for the following interfaces:
- dhcpsrv (v1.0): 6BFFD098-A112-3610-9833-46C3F874532D
- dhcpsrv2 (v1.0): 5b821720-f63b-11d0-aad2-00c04fc324db
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,
    NDRByteField,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRFullPointerField,
    NDRInt3264EnumField,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRShortField,
    NDRSignedIntField,
    NDRSignedLongField,
    NDRUnionField,
    register_dcerpc_interface,
)


class DHCP_HOST_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("IpAddress", 0),
        NDRFullPointerField(NDRShortField("NetBiosName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("HostName", 0), deferred=True),
    ]


class DHCP_SUBNET_STATE(IntEnum):
    DhcpSubnetEnabled = 1
    DhcpSubnetDisabled = 2
    DhcpSubnetEnabledSwitched = 3
    DhcpSubnetDisabledSwitched = 4
    DhcpSubnetInvalidState = 5


class LPDHCP_SUBNET_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("SubnetAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRFullPointerField(NDRShortField("SubnetName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("SubnetComment", 0), deferred=True),
        NDRPacketField("PrimaryHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRInt3264EnumField("SubnetState", 0, DHCP_SUBNET_STATE),
    ]


class R_DhcpCreateSubnet_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField("SubnetInfo", LPDHCP_SUBNET_INFO(), LPDHCP_SUBNET_INFO),
    ]


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


class R_DhcpSetSubnetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField("SubnetInfo", LPDHCP_SUBNET_INFO(), LPDHCP_SUBNET_INFO),
    ]


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


class R_DhcpGetSubnetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
    ]


class R_DhcpGetSubnetInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("SubnetInfo", LPDHCP_SUBNET_INFO(), LPDHCP_SUBNET_INFO)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_IP_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "Elements", [], NDRIntField, size_is=lambda pkt: pkt.NumElements
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnets_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnets_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField("EnumInfo", LPDHCP_IP_ARRAY(), LPDHCP_IP_ARRAY)
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class DHCP_SUBNET_ELEMENT_TYPE(IntEnum):
    DhcpIpRanges = 1
    DhcpSecondaryHosts = 2
    DhcpReservedIps = 3
    DhcpExcludedIpRanges = 4
    DhcpIpUsedClusters = 5
    DhcpIpRangesDhcpOnly = 6
    DhcpIpRangesDhcpBootp = 7
    DhcpIpRangesBootpOnly = 8


class DHCP_IP_RANGE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("StartAddress", 0), NDRIntField("EndAddress", 0)]


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


class DHCP_IP_RESERVATION(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ReservedIpAddress", 0),
        NDRFullPointerField(
            NDRPacketField("ReservedForClient", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
            deferred=True,
        ),
    ]


class DHCP_IP_CLUSTER(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("ClusterAddress", 0), NDRIntField("ClusterMask", 0)]


class LPDHCP_SUBNET_ELEMENT_DATA(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("ElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE(), DHCP_IP_RANGE),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_HOST_INFO(), DHCP_HOST_INFO),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "Element", DHCP_IP_RESERVATION(), DHCP_IP_RESERVATION
                        ),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE(), DHCP_IP_RANGE),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_CLUSTER(), DHCP_IP_CLUSTER),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters
                        ),
                    ),
                ),
            ],
            StrFixedLenField("Element", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpAddSubnetElement_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField(
            "AddElementInfo", LPDHCP_SUBNET_ELEMENT_DATA(), LPDHCP_SUBNET_ELEMENT_DATA
        ),
    ]


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


class LPDHCP_SUBNET_ELEMENT_INFO_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_SUBNET_ELEMENT_DATA()],
                LPDHCP_SUBNET_ELEMENT_DATA,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetElements_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRInt3264EnumField("EnumElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetElements_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "EnumElementInfo",
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY(),
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY,
            )
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class DHCP_FORCE_FLAG(IntEnum):
    DhcpFullForce = 1
    DhcpNoForce = 2
    DhcpFailoverForce = 3


class R_DhcpRemoveSubnetElement_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField(
            "RemoveElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA(),
            LPDHCP_SUBNET_ELEMENT_DATA,
        ),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class R_DhcpDeleteSubnet_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class DHCP_OPTION_DATA_TYPE(IntEnum):
    DhcpByteOption = 1
    DhcpWordOption = 2
    DhcpDWordOption = 3
    DhcpDWordDWordOption = 4
    DhcpIpAddressOption = 5
    DhcpStringDataOption = 6
    DhcpBinaryDataOption = 7
    DhcpEncapsulatedDataOption = 8
    DhcpIpv6AddressOption = 9


class DWORD_DWORD(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("DWord1", 0), NDRIntField("DWord2", 0)]


class LPDHCP_OPTION_DATA_ELEMENT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("OptionType", 0, DHCP_OPTION_DATA_TYPE),
        NDRUnionField(
            [
                (
                    NDRByteField("Element", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpByteOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpByteOption
                        ),
                    ),
                ),
                (
                    NDRShortField("Element", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpWordOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpWordOption
                        ),
                    ),
                ),
                (
                    NDRIntField("Element", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpDWordOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpDWordOption
                        ),
                    ),
                ),
                (
                    NDRPacketField("Element", DWORD_DWORD(), DWORD_DWORD),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpDWordDWordOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpDWordDWordOption
                        ),
                    ),
                ),
                (
                    NDRIntField("Element", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpIpAddressOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpIpAddressOption
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRShortField("Element", 0), deferred=True),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpStringDataOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpStringDataOption
                        ),
                    ),
                ),
                (
                    NDRPacketField("Element", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpBinaryDataOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpBinaryDataOption
                        ),
                    ),
                ),
                (
                    NDRPacketField("Element", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpEncapsulatedDataOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpEncapsulatedDataOption
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRShortField("Element", 0), deferred=True),
                    (
                        (
                            lambda pkt: getattr(pkt, "OptionType", None)
                            == DHCP_OPTION_DATA_TYPE.DhcpIpv6AddressOption
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_DATA_TYPE.DhcpIpv6AddressOption
                        ),
                    ),
                ),
            ],
            StrFixedLenField("Element", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class DHCP_OPTION_DATA(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_OPTION_DATA_ELEMENT()],
                LPDHCP_OPTION_DATA_ELEMENT,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class DHCP_OPTION_TYPE(IntEnum):
    DhcpUnaryElementTypeOption = 1
    DhcpArrayTypeOption = 2


class LPDHCP_OPTION(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRShortField("OptionName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("OptionComment", 0), deferred=True),
        NDRPacketField("DefaultValue", DHCP_OPTION_DATA(), DHCP_OPTION_DATA),
        NDRInt3264EnumField("OptionType", 0, DHCP_OPTION_TYPE),
    ]


class R_DhcpCreateOption_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
        NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION),
    ]


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


class R_DhcpSetOptionInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
        NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION),
    ]


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


class R_DhcpGetOptionInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
    ]


class R_DhcpGetOptionInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveOption_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
    ]


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


class DHCP_OPTION_SCOPE_TYPE(IntEnum):
    DhcpDefaultOptions = 1
    DhcpGlobalOptions = 2
    DhcpSubnetOptions = 3
    DhcpReservedOptions = 4
    DhcpMScopeOptions = 5


class DHCP_RESERVED_SCOPE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("ReservedIpAddress", 0),
        NDRIntField("ReservedIpSubnetAddress", 0),
    ]


class LPDHCP_OPTION_SCOPE_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("ScopeType", 0, DHCP_OPTION_SCOPE_TYPE),
        NDRUnionField(
            [
                (
                    StrFixedLenField("ScopeInfo", "", length=0),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions
                        ),
                    ),
                ),
                (
                    StrFixedLenField("ScopeInfo", "", length=0),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions
                        ),
                    ),
                ),
                (
                    NDRIntField("ScopeInfo", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions
                        ),
                    ),
                ),
                (
                    NDRPacketField(
                        "ScopeInfo", DHCP_RESERVED_SCOPE(), DHCP_RESERVED_SCOPE
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRShortField("ScopeInfo", 0), deferred=True),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions
                        ),
                    ),
                ),
            ],
            StrFixedLenField("ScopeInfo", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class LPDHCP_OPTION_DATA(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_OPTION_DATA_ELEMENT()],
                LPDHCP_OPTION_DATA_ELEMENT,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpSetOptionValue_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRPacketField("OptionValue", LPDHCP_OPTION_DATA(), LPDHCP_OPTION_DATA),
    ]


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


class LPDHCP_OPTION_VALUE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("OptionID", 0),
        NDRPacketField("Value", DHCP_OPTION_DATA(), DHCP_OPTION_DATA),
    ]


class R_DhcpGetOptionValue_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


class R_DhcpGetOptionValue_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionValue", LPDHCP_OPTION_VALUE(), LPDHCP_OPTION_VALUE)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_OPTION_VALUE_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Values"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Values",
                [LPDHCP_OPTION_VALUE()],
                LPDHCP_OPTION_VALUE,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumOptionValues_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumOptionValues_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "OptionValues", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
            )
        ),
        NDRIntField("OptionsRead", 0),
        NDRIntField("OptionsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveOptionValue_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("OptionID", 0),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


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


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


class LPDHCP_CLIENT_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
    ]


class R_DhcpCreateClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO(), LPDHCP_CLIENT_INFO),
    ]


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


class R_DhcpSetClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO(), LPDHCP_CLIENT_INFO),
    ]


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


class DHCP_SEARCH_INFO_TYPE(IntEnum):
    DhcpClientIpAddress = 1
    DhcpClientHardwareAddress = 2
    DhcpClientName = 3


class LPDHCP_SEARCH_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("SearchType", 0, DHCP_SEARCH_INFO_TYPE),
        NDRUnionField(
            [
                (
                    NDRIntField("SearchInfo", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "SearchType", None)
                            == DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress
                        ),
                    ),
                ),
                (
                    NDRPacketField("SearchInfo", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
                    (
                        (
                            lambda pkt: getattr(pkt, "SearchType", None)
                            == DHCP_SEARCH_INFO_TYPE.DhcpClientHardwareAddress
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SEARCH_INFO_TYPE.DhcpClientHardwareAddress
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRShortField("SearchInfo", 0), deferred=True),
                    (
                        (
                            lambda pkt: getattr(pkt, "SearchType", None)
                            == DHCP_SEARCH_INFO_TYPE.DhcpClientName
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SEARCH_INFO_TYPE.DhcpClientName
                        ),
                    ),
                ),
            ],
            StrFixedLenField("SearchInfo", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpGetClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpGetClientInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO(), LPDHCP_CLIENT_INFO)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpDeleteClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


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


class LPDHCP_CLIENT_INFO_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetClients_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetClients_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_ARRAY(), LPDHCP_CLIENT_INFO_ARRAY
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class DHCP_OPTION_VALUE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("OptionID", 0),
        NDRPacketField("Value", DHCP_OPTION_DATA(), DHCP_OPTION_DATA),
    ]


class LPDHCP_OPTION_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumOptions", None, size_of="Options"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Options", [], DHCP_OPTION_VALUE, size_is=lambda pkt: pkt.NumOptions
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetClientOptions_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("ClientSubnetMask", 0),
    ]


class R_DhcpGetClientOptions_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientOptions", LPDHCP_OPTION_LIST(), LPDHCP_OPTION_LIST)
        ),
        NDRIntField("status", 0),
    ]


class LPSCOPE_MIB_INFO(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("Subnet", 0),
        NDRIntField("NumAddressesInuse", 0),
        NDRIntField("NumAddressesFree", 0),
        NDRIntField("NumPendingOffers", 0),
    ]


class LPDHCP_MIB_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Discovers", 0),
        NDRIntField("Offers", 0),
        NDRIntField("Requests", 0),
        NDRIntField("Acks", 0),
        NDRIntField("Naks", 0),
        NDRIntField("Declines", 0),
        NDRIntField("Releases", 0),
        NDRPacketField("ServerStartTime", DATE_TIME(), DATE_TIME),
        NDRIntField("Scopes", None, size_of="ScopeInfo"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScopeInfo",
                [LPSCOPE_MIB_INFO()],
                LPSCOPE_MIB_INFO,
                size_is=lambda pkt: pkt.Scopes,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetMibInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetMibInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("MibInfo", LPDHCP_MIB_INFO(), LPDHCP_MIB_INFO)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_OPTION_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Options"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Options",
                [LPDHCP_OPTION()],
                LPDHCP_OPTION,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumOptions_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumOptions_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField("Options", LPDHCP_OPTION_ARRAY(), LPDHCP_OPTION_ARRAY)
        ),
        NDRIntField("OptionsRead", 0),
        NDRIntField("OptionsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpSetOptionValues_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRPacketField(
            "OptionValues", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
        ),
    ]


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


class LPDHCP_SERVER_CONFIG_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("APIProtocolSupport", 0),
        NDRFullPointerField(NDRShortField("DatabaseName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("DatabasePath", 0), deferred=True),
        NDRFullPointerField(NDRShortField("BackupPath", 0), deferred=True),
        NDRIntField("BackupInterval", 0),
        NDRIntField("DatabaseLoggingFlag", 0),
        NDRIntField("RestoreFlag", 0),
        NDRIntField("DatabaseCleanupInterval", 0),
        NDRIntField("DebugFlag", 0),
    ]


class R_DhcpServerSetConfig_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("FieldsToSet", 0),
        NDRPacketField(
            "ConfigInfo", LPDHCP_SERVER_CONFIG_INFO(), LPDHCP_SERVER_CONFIG_INFO
        ),
    ]


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


class R_DhcpServerGetConfig_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpServerGetConfig_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ConfigInfo", LPDHCP_SERVER_CONFIG_INFO(), LPDHCP_SERVER_CONFIG_INFO
            )
        ),
        NDRIntField("status", 0),
    ]


class DHCP_SCAN_FLAG(IntEnum):
    DhcpRegistryFix = 1
    DhcpDatabaseFix = 2


class DHCP_SCAN_ITEM(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("IpAddress", 0),
        NDRInt3264EnumField("ScanFlag", 0, DHCP_SCAN_FLAG),
    ]


class LPDHCP_SCAN_LIST(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumScanItems", None, size_of="ScanItems"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScanItems", [], DHCP_SCAN_ITEM, size_is=lambda pkt: pkt.NumScanItems
            ),
            deferred=True,
        ),
    ]


class R_DhcpScanDatabase_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("FixFlag", 0),
    ]


class R_DhcpScanDatabase_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ScanList", LPDHCP_SCAN_LIST(), LPDHCP_SCAN_LIST)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpGetVersion_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetVersion_Response(NDRPacket):
    fields_desc = [
        NDRIntField("MajorVersion", 0),
        NDRIntField("MinorVersion", 0),
        NDRIntField("status", 0),
    ]


class DHCP_IP_RESERVATION_V4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ReservedIpAddress", 0),
        NDRFullPointerField(
            NDRPacketField("ReservedForClient", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
            deferred=True,
        ),
        NDRByteField("bAllowedClientTypes", 0),
    ]


class LPDHCP_SUBNET_ELEMENT_DATA_V4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("ElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE(), DHCP_IP_RANGE),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_HOST_INFO(), DHCP_HOST_INFO),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "Element", DHCP_IP_RESERVATION_V4(), DHCP_IP_RESERVATION_V4
                        ),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE(), DHCP_IP_RANGE),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_CLUSTER(), DHCP_IP_CLUSTER),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters
                        ),
                    ),
                ),
            ],
            StrFixedLenField("Element", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpAddSubnetElementV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField(
            "AddElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V4(),
            LPDHCP_SUBNET_ELEMENT_DATA_V4,
        ),
    ]


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


class LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_SUBNET_ELEMENT_DATA_V4()],
                LPDHCP_SUBNET_ELEMENT_DATA_V4,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetElementsV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRInt3264EnumField("EnumElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetElementsV4_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "EnumElementInfo",
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4(),
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4,
            )
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveSubnetElementV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField(
            "RemoveElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V4(),
            LPDHCP_SUBNET_ELEMENT_DATA_V4,
        ),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class LPDHCP_CLIENT_INFO_V4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
    ]


class R_DhcpCreateClientInfoV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_V4(), LPDHCP_CLIENT_INFO_V4),
    ]


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


class R_DhcpSetClientInfoV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_V4(), LPDHCP_CLIENT_INFO_V4),
    ]


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


class R_DhcpGetClientInfoV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpGetClientInfoV4_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_V4(), LPDHCP_CLIENT_INFO_V4)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_CLIENT_INFO_ARRAY_V4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO_V4,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetClientsV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetClientsV4_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_ARRAY_V4(), LPDHCP_CLIENT_INFO_ARRAY_V4
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpSetSuperScopeV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("SuperScopeName", "")),
        NDRSignedIntField("ChangeExisting", 0),
    ]


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


class DHCP_SUPER_SCOPE_TABLE_ENTRY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("SubnetAddress", 0),
        NDRIntField("SuperScopeNumber", 0),
        NDRIntField("NextInSuperScope", 0),
        NDRFullPointerField(NDRShortField("SuperScopeName", 0), deferred=True),
    ]


class LPDHCP_SUPER_SCOPE_TABLE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cEntries", None, size_of="pEntries"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pEntries",
                [],
                DHCP_SUPER_SCOPE_TABLE_ENTRY,
                size_is=lambda pkt: pkt.cEntries,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetSuperScopeInfoV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetSuperScopeInfoV4_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "SuperScopeTable", LPDHCP_SUPER_SCOPE_TABLE(), LPDHCP_SUPER_SCOPE_TABLE
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpDeleteSuperScopeV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRConfVarStrNullFieldUtf16("SuperScopeName", ""),
    ]


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


class LPDHCP_SERVER_CONFIG_INFO_V4(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("APIProtocolSupport", 0),
        NDRFullPointerField(NDRShortField("DatabaseName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("DatabasePath", 0), deferred=True),
        NDRFullPointerField(NDRShortField("BackupPath", 0), deferred=True),
        NDRIntField("BackupInterval", 0),
        NDRIntField("DatabaseLoggingFlag", 0),
        NDRIntField("RestoreFlag", 0),
        NDRIntField("DatabaseCleanupInterval", 0),
        NDRIntField("DebugFlag", 0),
        NDRIntField("dwPingRetries", 0),
        NDRIntField("cbBootTableString", None, size_of="wszBootTableString"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16(
                "wszBootTableString", "", size_is=lambda pkt: pkt.cbBootTableString
            ),
            deferred=True,
        ),
        NDRSignedIntField("fAuditLog", 0),
    ]


class R_DhcpServerSetConfigV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("FieldsToSet", 0),
        NDRPacketField(
            "ConfigInfo", LPDHCP_SERVER_CONFIG_INFO_V4(), LPDHCP_SERVER_CONFIG_INFO_V4
        ),
    ]


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


class R_DhcpServerGetConfigV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpServerGetConfigV4_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ConfigInfo",
                LPDHCP_SERVER_CONFIG_INFO_V4(),
                LPDHCP_SERVER_CONFIG_INFO_V4,
            )
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_SERVER_CONFIG_INFO_VQ(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("APIProtocolSupport", 0),
        NDRFullPointerField(NDRShortField("DatabaseName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("DatabasePath", 0), deferred=True),
        NDRFullPointerField(NDRShortField("BackupPath", 0), deferred=True),
        NDRIntField("BackupInterval", 0),
        NDRIntField("DatabaseLoggingFlag", 0),
        NDRIntField("RestoreFlag", 0),
        NDRIntField("DatabaseCleanupInterval", 0),
        NDRIntField("DebugFlag", 0),
        NDRIntField("dwPingRetries", 0),
        NDRIntField("cbBootTableString", None, size_of="wszBootTableString"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16(
                "wszBootTableString", "", size_is=lambda pkt: pkt.cbBootTableString
            ),
            deferred=True,
        ),
        NDRSignedIntField("fAuditLog", 0),
        NDRSignedIntField("QuarantineOn", 0),
        NDRIntField("QuarDefFail", 0),
        NDRSignedIntField("QuarRuntimeStatus", 0),
    ]


class R_DhcpServerSetConfigVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("FieldsToSet", 0),
        NDRPacketField(
            "ConfigInfo", LPDHCP_SERVER_CONFIG_INFO_VQ(), LPDHCP_SERVER_CONFIG_INFO_VQ
        ),
    ]


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


class R_DhcpServerGetConfigVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpServerGetConfigVQ_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ConfigInfo",
                LPDHCP_SERVER_CONFIG_INFO_VQ(),
                LPDHCP_SERVER_CONFIG_INFO_VQ,
            )
        ),
        NDRIntField("status", 0),
    ]


class LPSCOPE_MIB_INFO_VQ(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("Subnet", 0),
        NDRIntField("NumAddressesInuse", 0),
        NDRIntField("NumAddressesFree", 0),
        NDRIntField("NumPendingOffers", 0),
        NDRIntField("QtnNumLeases", 0),
        NDRIntField("QtnPctQtnLeases", 0),
        NDRIntField("QtnProbationLeases", 0),
        NDRIntField("QtnNonQtnLeases", 0),
        NDRIntField("QtnExemptLeases", 0),
        NDRIntField("QtnCapableClients", 0),
    ]


class LPDHCP_MIB_INFO_VQ(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Discovers", 0),
        NDRIntField("Offers", 0),
        NDRIntField("Requests", 0),
        NDRIntField("Acks", 0),
        NDRIntField("Naks", 0),
        NDRIntField("Declines", 0),
        NDRIntField("Releases", 0),
        NDRPacketField("ServerStartTime", DATE_TIME(), DATE_TIME),
        NDRIntField("QtnNumLeases", 0),
        NDRIntField("QtnPctQtnLeases", 0),
        NDRIntField("QtnProbationLeases", 0),
        NDRIntField("QtnNonQtnLeases", 0),
        NDRIntField("QtnExemptLeases", 0),
        NDRIntField("QtnCapableClients", 0),
        NDRIntField("QtnIASErrors", 0),
        NDRIntField("Scopes", None, size_of="ScopeInfo"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScopeInfo",
                [LPSCOPE_MIB_INFO_VQ()],
                LPSCOPE_MIB_INFO_VQ,
                size_is=lambda pkt: pkt.Scopes,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetMibInfoVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetMibInfoVQ_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("MibInfo", LPDHCP_MIB_INFO_VQ(), LPDHCP_MIB_INFO_VQ)
        ),
        NDRIntField("status", 0),
    ]


class QuarantineStatus(IntEnum):
    NOQUARANTINE = 0
    RESTRICTEDACCESS = 1
    DROPPACKET = 2
    PROBATION = 3
    EXEMPT = 4
    DEFAULTQUARSETTING = 5
    NOQUARINFO = 6


class LPDHCP_CLIENT_INFO_VQ(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
        NDRByteField("AddressState", 0),
        NDRInt3264EnumField("Status", 0, QuarantineStatus),
        NDRPacketField("ProbationEnds", DATE_TIME(), DATE_TIME),
        NDRSignedIntField("QuarantineCapable", 0),
    ]


class R_DhcpCreateClientInfoVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_VQ(), LPDHCP_CLIENT_INFO_VQ),
    ]


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


class R_DhcpSetClientInfoVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_VQ(), LPDHCP_CLIENT_INFO_VQ),
    ]


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


class R_DhcpGetClientInfoVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpGetClientInfoVQ_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_VQ(), LPDHCP_CLIENT_INFO_VQ)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_CLIENT_INFO_ARRAY_VQ(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO_VQ,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetClientsVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetClientsVQ_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_ARRAY_VQ(), LPDHCP_CLIENT_INFO_ARRAY_VQ
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class LPDHCP_SUBNET_INFO_VQ(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntField("SubnetAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRFullPointerField(NDRShortField("SubnetName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("SubnetComment", 0), deferred=True),
        NDRPacketField("PrimaryHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRInt3264EnumField("SubnetState", 0, DHCP_SUBNET_STATE),
        NDRIntField("QuarantineOn", 0),
        NDRIntField("Reserved1", 0),
        NDRIntField("Reserved2", 0),
        NDRSignedLongField("Reserved3", 0),
        NDRSignedLongField("Reserved4", 0),
    ]


class R_DhcpCreateSubnetVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField("SubnetInfoVQ", LPDHCP_SUBNET_INFO_VQ(), LPDHCP_SUBNET_INFO_VQ),
    ]


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


class R_DhcpGetSubnetInfoVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
    ]


class R_DhcpGetSubnetInfoVQ_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "SubnetInfoVQ", LPDHCP_SUBNET_INFO_VQ(), LPDHCP_SUBNET_INFO_VQ
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpSetSubnetInfoVQ_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField("SubnetInfoVQ", LPDHCP_SUBNET_INFO_VQ(), LPDHCP_SUBNET_INFO_VQ),
    ]


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


DHCPSRV_OPNUMS = {
    0: DceRpcOp(R_DhcpCreateSubnet_Request, R_DhcpCreateSubnet_Response),
    1: DceRpcOp(R_DhcpSetSubnetInfo_Request, R_DhcpSetSubnetInfo_Response),
    2: DceRpcOp(R_DhcpGetSubnetInfo_Request, R_DhcpGetSubnetInfo_Response),
    3: DceRpcOp(R_DhcpEnumSubnets_Request, R_DhcpEnumSubnets_Response),
    4: DceRpcOp(R_DhcpAddSubnetElement_Request, R_DhcpAddSubnetElement_Response),
    5: DceRpcOp(R_DhcpEnumSubnetElements_Request, R_DhcpEnumSubnetElements_Response),
    6: DceRpcOp(R_DhcpRemoveSubnetElement_Request, R_DhcpRemoveSubnetElement_Response),
    7: DceRpcOp(R_DhcpDeleteSubnet_Request, R_DhcpDeleteSubnet_Response),
    8: DceRpcOp(R_DhcpCreateOption_Request, R_DhcpCreateOption_Response),
    9: DceRpcOp(R_DhcpSetOptionInfo_Request, R_DhcpSetOptionInfo_Response),
    10: DceRpcOp(R_DhcpGetOptionInfo_Request, R_DhcpGetOptionInfo_Response),
    11: DceRpcOp(R_DhcpRemoveOption_Request, R_DhcpRemoveOption_Response),
    12: DceRpcOp(R_DhcpSetOptionValue_Request, R_DhcpSetOptionValue_Response),
    13: DceRpcOp(R_DhcpGetOptionValue_Request, R_DhcpGetOptionValue_Response),
    14: DceRpcOp(R_DhcpEnumOptionValues_Request, R_DhcpEnumOptionValues_Response),
    15: DceRpcOp(R_DhcpRemoveOptionValue_Request, R_DhcpRemoveOptionValue_Response),
    16: DceRpcOp(R_DhcpCreateClientInfo_Request, R_DhcpCreateClientInfo_Response),
    17: DceRpcOp(R_DhcpSetClientInfo_Request, R_DhcpSetClientInfo_Response),
    18: DceRpcOp(R_DhcpGetClientInfo_Request, R_DhcpGetClientInfo_Response),
    19: DceRpcOp(R_DhcpDeleteClientInfo_Request, R_DhcpDeleteClientInfo_Response),
    20: DceRpcOp(R_DhcpEnumSubnetClients_Request, R_DhcpEnumSubnetClients_Response),
    21: DceRpcOp(R_DhcpGetClientOptions_Request, R_DhcpGetClientOptions_Response),
    22: DceRpcOp(R_DhcpGetMibInfo_Request, R_DhcpGetMibInfo_Response),
    23: DceRpcOp(R_DhcpEnumOptions_Request, R_DhcpEnumOptions_Response),
    24: DceRpcOp(R_DhcpSetOptionValues_Request, R_DhcpSetOptionValues_Response),
    25: DceRpcOp(R_DhcpServerSetConfig_Request, R_DhcpServerSetConfig_Response),
    26: DceRpcOp(R_DhcpServerGetConfig_Request, R_DhcpServerGetConfig_Response),
    27: DceRpcOp(R_DhcpScanDatabase_Request, R_DhcpScanDatabase_Response),
    28: DceRpcOp(R_DhcpGetVersion_Request, R_DhcpGetVersion_Response),
    29: DceRpcOp(R_DhcpAddSubnetElementV4_Request, R_DhcpAddSubnetElementV4_Response),
    30: DceRpcOp(
        R_DhcpEnumSubnetElementsV4_Request, R_DhcpEnumSubnetElementsV4_Response
    ),
    31: DceRpcOp(
        R_DhcpRemoveSubnetElementV4_Request, R_DhcpRemoveSubnetElementV4_Response
    ),
    32: DceRpcOp(R_DhcpCreateClientInfoV4_Request, R_DhcpCreateClientInfoV4_Response),
    33: DceRpcOp(R_DhcpSetClientInfoV4_Request, R_DhcpSetClientInfoV4_Response),
    34: DceRpcOp(R_DhcpGetClientInfoV4_Request, R_DhcpGetClientInfoV4_Response),
    35: DceRpcOp(R_DhcpEnumSubnetClientsV4_Request, R_DhcpEnumSubnetClientsV4_Response),
    36: DceRpcOp(R_DhcpSetSuperScopeV4_Request, R_DhcpSetSuperScopeV4_Response),
    37: DceRpcOp(R_DhcpGetSuperScopeInfoV4_Request, R_DhcpGetSuperScopeInfoV4_Response),
    38: DceRpcOp(R_DhcpDeleteSuperScopeV4_Request, R_DhcpDeleteSuperScopeV4_Response),
    39: DceRpcOp(R_DhcpServerSetConfigV4_Request, R_DhcpServerSetConfigV4_Response),
    40: DceRpcOp(R_DhcpServerGetConfigV4_Request, R_DhcpServerGetConfigV4_Response),
    41: DceRpcOp(R_DhcpServerSetConfigVQ_Request, R_DhcpServerSetConfigVQ_Response),
    42: DceRpcOp(R_DhcpServerGetConfigVQ_Request, R_DhcpServerGetConfigVQ_Response),
    43: DceRpcOp(R_DhcpGetMibInfoVQ_Request, R_DhcpGetMibInfoVQ_Response),
    44: DceRpcOp(R_DhcpCreateClientInfoVQ_Request, R_DhcpCreateClientInfoVQ_Response),
    45: DceRpcOp(R_DhcpSetClientInfoVQ_Request, R_DhcpSetClientInfoVQ_Response),
    46: DceRpcOp(R_DhcpGetClientInfoVQ_Request, R_DhcpGetClientInfoVQ_Response),
    47: DceRpcOp(R_DhcpEnumSubnetClientsVQ_Request, R_DhcpEnumSubnetClientsVQ_Response),
    48: DceRpcOp(R_DhcpCreateSubnetVQ_Request, R_DhcpCreateSubnetVQ_Response),
    49: DceRpcOp(R_DhcpGetSubnetInfoVQ_Request, R_DhcpGetSubnetInfoVQ_Response),
    50: DceRpcOp(R_DhcpSetSubnetInfoVQ_Request, R_DhcpSetSubnetInfoVQ_Response),
}
register_dcerpc_interface(
    name="dhcpsrv",
    uuid=uuid.UUID("6BFFD098-A112-3610-9833-46C3F874532D"),
    version="1.0",
    opnums=DHCPSRV_OPNUMS,
)


class LPDHCP_CLIENT_INFO_V5(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
        NDRByteField("AddressState", 0),
    ]


class LPDHCP_CLIENT_INFO_ARRAY_V5(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO_V5,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetClientsV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetClientsV5_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_ARRAY_V5(), LPDHCP_CLIENT_INFO_ARRAY_V5
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class LPDHCP_MSCOPE_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("MScopeName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("MScopeComment", 0), deferred=True),
        NDRIntField("MScopeId", 0),
        NDRIntField("MScopeAddressPolicy", 0),
        NDRPacketField("PrimaryHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRInt3264EnumField("MScopeState", 0, DHCP_SUBNET_STATE),
        NDRIntField("MScopeFlags", 0),
        NDRPacketField("ExpiryTime", DATE_TIME(), DATE_TIME),
        NDRFullPointerField(NDRShortField("LangTag", 0), deferred=True),
        NDRByteField("TTL", 0),
    ]


class R_DhcpSetMScopeInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRPacketField("MScopeInfo", LPDHCP_MSCOPE_INFO(), LPDHCP_MSCOPE_INFO),
        NDRSignedIntField("NewScope", 0),
    ]


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


class R_DhcpGetMScopeInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
    ]


class R_DhcpGetMScopeInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("MScopeInfo", LPDHCP_MSCOPE_INFO(), LPDHCP_MSCOPE_INFO)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_MSCOPE_TABLE(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="pMScopeNames"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "pMScopeNames",
                [],
                NDRFullPointerField(NDRShortField("pMScopeNames", 0), deferred=True),
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumMScopes_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumMScopes_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField("MScopeTable", LPDHCP_MSCOPE_TABLE(), LPDHCP_MSCOPE_TABLE)
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpAddMScopeElement_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRPacketField(
            "AddElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V4(),
            LPDHCP_SUBNET_ELEMENT_DATA_V4,
        ),
    ]


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


class R_DhcpEnumMScopeElements_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRInt3264EnumField("EnumElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumMScopeElements_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "EnumElementInfo",
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4(),
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4,
            )
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveMScopeElement_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRPacketField(
            "RemoveElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V4(),
            LPDHCP_SUBNET_ELEMENT_DATA_V4,
        ),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class R_DhcpDeleteMScope_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class R_DhcpScanMDatabase_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRIntField("FixFlag", 0),
    ]


class R_DhcpScanMDatabase_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ScanList", LPDHCP_SCAN_LIST(), LPDHCP_SCAN_LIST)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_MCLIENT_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("MScopeId", 0),
        NDRPacketField("ClientId", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRPacketField("ClientLeaseStarts", DATE_TIME(), DATE_TIME),
        NDRPacketField("ClientLeaseEnds", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRIntField("AddressFlags", 0),
        NDRByteField("AddressState", 0),
    ]


class R_DhcpCreateMClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRPacketField("ClientInfo", LPDHCP_MCLIENT_INFO(), LPDHCP_MCLIENT_INFO),
    ]


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


class R_DhcpSetMClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_MCLIENT_INFO(), LPDHCP_MCLIENT_INFO),
    ]


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


class R_DhcpGetMClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpGetMClientInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_MCLIENT_INFO(), LPDHCP_MCLIENT_INFO)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpDeleteMClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


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


class LPDHCP_MCLIENT_INFO_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_MCLIENT_INFO,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumMScopeClients_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("MScopeName", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumMScopeClients_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_MCLIENT_INFO_ARRAY(), LPDHCP_MCLIENT_INFO_ARRAY
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpCreateOptionV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionId", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION),
    ]


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


class R_DhcpSetOptionInfoV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION),
    ]


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


class R_DhcpGetOptionInfoV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
    ]


class R_DhcpGetOptionInfoV5_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpEnumOptionsV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumOptionsV5_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField("Options", LPDHCP_OPTION_ARRAY(), LPDHCP_OPTION_ARRAY)
        ),
        NDRIntField("OptionsRead", 0),
        NDRIntField("OptionsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveOptionV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
    ]


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


class R_DhcpSetOptionValueV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionId", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRPacketField("OptionValue", LPDHCP_OPTION_DATA(), LPDHCP_OPTION_DATA),
    ]


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


class R_DhcpSetOptionValuesV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRPacketField(
            "OptionValues", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
        ),
    ]


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


class R_DhcpGetOptionValueV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


class R_DhcpGetOptionValueV5_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionValue", LPDHCP_OPTION_VALUE(), LPDHCP_OPTION_VALUE)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpEnumOptionValuesV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumOptionValuesV5_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "OptionValues", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
            )
        ),
        NDRIntField("OptionsRead", 0),
        NDRIntField("OptionsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveOptionValueV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


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


class LPDHCP_CLASS_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("ClassName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClassComment", 0), deferred=True),
        NDRIntField("ClassDataLength", None, size_of="ClassData"),
        NDRSignedIntField("IsVendor", 0),
        NDRIntField("Flags", 0),
        NDRFullPointerField(
            NDRConfStrLenField(
                "ClassData", "", size_is=lambda pkt: pkt.ClassDataLength
            ),
            deferred=True,
        ),
    ]


class R_DhcpCreateClass_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRPacketField("ClassInfo", LPDHCP_CLASS_INFO(), LPDHCP_CLASS_INFO),
    ]


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


class R_DhcpModifyClass_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRPacketField("ClassInfo", LPDHCP_CLASS_INFO(), LPDHCP_CLASS_INFO),
    ]


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


class R_DhcpDeleteClass_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
    ]


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


class R_DhcpGetClassInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRPacketField("PartialClassInfo", LPDHCP_CLASS_INFO(), LPDHCP_CLASS_INFO),
    ]


class R_DhcpGetClassInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("FilledClassInfo", LPDHCP_CLASS_INFO(), LPDHCP_CLASS_INFO)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_CLASS_INFO_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Classes"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Classes",
                [LPDHCP_CLASS_INFO()],
                LPDHCP_CLASS_INFO,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumClasses_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumClasses_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClassInfoArray", LPDHCP_CLASS_INFO_ARRAY(), LPDHCP_CLASS_INFO_ARRAY
            )
        ),
        NDRIntField("nRead", 0),
        NDRIntField("nTotal", 0),
        NDRIntField("status", 0),
    ]


class DHCP_OPTION(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRShortField("OptionName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("OptionComment", 0), deferred=True),
        NDRPacketField("DefaultValue", DHCP_OPTION_DATA(), DHCP_OPTION_DATA),
        NDRInt3264EnumField("OptionType", 0, DHCP_OPTION_TYPE),
    ]


class VendorOptions_DHCP_ALL_OPTIONS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Option", DHCP_OPTION(), DHCP_OPTION),
        NDRFullPointerField(NDRShortField("VendorName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClassName", 0), deferred=True),
    ]


class LPDHCP_ALL_OPTIONS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Flags", 0),
        NDRFullPointerField(
            NDRPacketField(
                "NonVendorOptions", LPDHCP_OPTION_ARRAY(), LPDHCP_OPTION_ARRAY
            ),
            deferred=True,
        ),
        NDRIntField("NumVendorOptions", None, size_of="VendorOptions_DHCP_ALL_OPTIONS"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "VendorOptions_DHCP_ALL_OPTIONS",
                [VendorOptions_DHCP_ALL_OPTIONS()],
                VendorOptions_DHCP_ALL_OPTIONS,
                size_is=lambda pkt: pkt.NumVendorOptions,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetAllOptions_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
    ]


class R_DhcpGetAllOptions_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionStruct", LPDHCP_ALL_OPTIONS(), LPDHCP_ALL_OPTIONS)
        ),
        NDRIntField("status", 0),
    ]


class Options_DHCP_ALL_OPTION_VALUES(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("ClassName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("VendorName", 0), deferred=True),
        NDRSignedIntField("IsVendor", 0),
        NDRFullPointerField(
            NDRPacketField(
                "OptionsArray", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
            ),
            deferred=True,
        ),
    ]


class LPDHCP_ALL_OPTION_VALUES(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Flags", 0),
        NDRIntField("NumElements", None, size_of="Options_DHCP_ALL_OPTION_VALUES"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Options_DHCP_ALL_OPTION_VALUES",
                [Options_DHCP_ALL_OPTION_VALUES()],
                Options_DHCP_ALL_OPTION_VALUES,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetAllOptionValues_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


class R_DhcpGetAllOptionValues_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "Values", LPDHCP_ALL_OPTION_VALUES(), LPDHCP_ALL_OPTION_VALUES
            )
        ),
        NDRIntField("status", 0),
    ]


class LPMSCOPE_MIB_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("MScopeId", 0),
        NDRFullPointerField(NDRShortField("MScopeName", 0), deferred=True),
        NDRIntField("NumAddressesInuse", 0),
        NDRIntField("NumAddressesFree", 0),
        NDRIntField("NumPendingOffers", 0),
    ]


class LPDHCP_MCAST_MIB_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Discovers", 0),
        NDRIntField("Offers", 0),
        NDRIntField("Requests", 0),
        NDRIntField("Renews", 0),
        NDRIntField("Acks", 0),
        NDRIntField("Naks", 0),
        NDRIntField("Releases", 0),
        NDRIntField("Informs", 0),
        NDRPacketField("ServerStartTime", DATE_TIME(), DATE_TIME),
        NDRIntField("Scopes", None, size_of="ScopeInfo"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScopeInfo",
                [LPMSCOPE_MIB_INFO()],
                LPMSCOPE_MIB_INFO,
                size_is=lambda pkt: pkt.Scopes,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetMCastMibInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetMCastMibInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("MibInfo", LPDHCP_MCAST_MIB_INFO(), LPDHCP_MCAST_MIB_INFO)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpAuditLogSetParams_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRConfVarStrNullFieldUtf16("AuditLogDir", ""),
        NDRIntField("DiskCheckInterval", 0),
        NDRIntField("MaxLogFilesSize", 0),
        NDRIntField("MinSpaceOnDisk", 0),
    ]


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


class R_DhcpAuditLogGetParams_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
    ]


class R_DhcpAuditLogGetParams_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("AuditLogDir", "")),
        NDRIntField("DiskCheckInterval", 0),
        NDRIntField("MaxLogFilesSize", 0),
        NDRIntField("MinSpaceOnDisk", 0),
        NDRIntField("status", 0),
    ]


class LPDHCP_ATTRIB(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("DhcpAttribId", 0),
        NDRIntField("DhcpAttribType", 0),
        NDRUnionField(
            [
                (
                    NDRSignedIntField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "DhcpAttribType", None)
                            == ULONG.DHCP_ATTRIB_TYPE_BOOL
                        ),
                        (lambda _, val: val.tag == ULONG.DHCP_ATTRIB_TYPE_BOOL),
                    ),
                ),
                (
                    NDRIntField("value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "DhcpAttribType", None)
                            == ULONG.DHCP_ATTRIB_TYPE_ULONG
                        ),
                        (lambda _, val: val.tag == ULONG.DHCP_ATTRIB_TYPE_ULONG),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(4, 4),
            switch_fmt=("L", "L"),
        ),
    ]


class R_DhcpServerQueryAttribute_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("dwReserved", 0),
        NDRIntField("DhcpAttribId", 0),
    ]


class R_DhcpServerQueryAttribute_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pDhcpAttrib", LPDHCP_ATTRIB(), LPDHCP_ATTRIB)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_ATTRIB_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="DhcpAttribs"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "DhcpAttribs",
                [LPDHCP_ATTRIB()],
                LPDHCP_ATTRIB,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpServerQueryAttributes_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("dwReserved", 0),
        NDRIntField("dwAttribCount", None, size_of="pDhcpAttribs"),
        NDRConfFieldListField(
            "pDhcpAttribs", [], NDRIntField, size_is=lambda pkt: pkt.dwAttribCount
        ),
    ]


class R_DhcpServerQueryAttributes_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pDhcpAttribArr", LPDHCP_ATTRIB_ARRAY(), LPDHCP_ATTRIB_ARRAY)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpServerRedoAuthorization_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("dwReserved", 0),
    ]


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


class DHCP_BOOTP_IP_RANGE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("StartAddress", 0),
        NDRIntField("EndAddress", 0),
        NDRIntField("BootpAllocated", 0),
        NDRIntField("MaxBootpAllowed", 0),
    ]


class LPDHCP_SUBNET_ELEMENT_DATA_V5(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("ElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "Element", DHCP_BOOTP_IP_RANGE(), DHCP_BOOTP_IP_RANGE
                        ),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_HOST_INFO(), DHCP_HOST_INFO),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "Element", DHCP_IP_RESERVATION_V4(), DHCP_IP_RESERVATION_V4
                        ),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE(), DHCP_IP_RANGE),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_CLUSTER(), DHCP_IP_CLUSTER),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters
                        ),
                    ),
                ),
            ],
            StrFixedLenField("Element", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpAddSubnetElementV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField(
            "AddElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V5(),
            LPDHCP_SUBNET_ELEMENT_DATA_V5,
        ),
    ]


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


class LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V5(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_SUBNET_ELEMENT_DATA_V5()],
                LPDHCP_SUBNET_ELEMENT_DATA_V5,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetElementsV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRInt3264EnumField("EnumElementType", 0, DHCP_SUBNET_ELEMENT_TYPE),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetElementsV5_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "EnumElementInfo",
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V5(),
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V5,
            )
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveSubnetElementV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRPacketField(
            "RemoveElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V5(),
            LPDHCP_SUBNET_ELEMENT_DATA_V5,
        ),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class LPDHCP_BIND_ELEMENT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Flags", 0),
        NDRSignedIntField("fBoundToDHCPServer", 0),
        NDRIntField("AdapterPrimaryAddress", 0),
        NDRIntField("AdapterSubnetAddress", 0),
        NDRFullPointerField(NDRShortField("IfDescription", 0), deferred=True),
        NDRIntField("IfIdSize", None, size_of="IfId"),
        NDRFullPointerField(
            NDRConfStrLenField("IfId", "", size_is=lambda pkt: pkt.IfIdSize),
            deferred=True,
        ),
    ]


class LPDHCP_BIND_ELEMENT_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_BIND_ELEMENT()],
                LPDHCP_BIND_ELEMENT,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetServerBindingInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
    ]


class R_DhcpGetServerBindingInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "BindElementsInfo",
                LPDHCP_BIND_ELEMENT_ARRAY(),
                LPDHCP_BIND_ELEMENT_ARRAY,
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpSetServerBindingInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRPacketField(
            "BindElementsInfo", LPDHCP_BIND_ELEMENT_ARRAY(), LPDHCP_BIND_ELEMENT_ARRAY
        ),
    ]


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


class R_DhcpQueryDnsRegCredentials_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("UnameSize", 0),
        NDRIntField("DomainSize", 0),
    ]


class R_DhcpQueryDnsRegCredentials_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenFieldUtf16("Uname", "", size_is=lambda pkt: pkt.UnameSize),
        NDRConfStrLenFieldUtf16("Domain", "", size_is=lambda pkt: pkt.DomainSize),
        NDRIntField("status", 0),
    ]


class R_DhcpSetDnsRegCredentials_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Uname", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Domain", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Passwd", "")),
    ]


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


class R_DhcpBackupDatabase_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRConfVarStrNullFieldUtf16("Path", ""),
    ]


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


class R_DhcpRestoreDatabase_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRConfVarStrNullFieldUtf16("Path", ""),
    ]


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


class LPDHCP_SERVER_SPECIFIC_STRINGS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("DefaultVendorClassName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("DefaultUserClassName", 0), deferred=True),
    ]


class R_DhcpGetServerSpecificStrings_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetServerSpecificStrings_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ServerSpecificStrings",
                LPDHCP_SERVER_SPECIFIC_STRINGS(),
                LPDHCP_SERVER_SPECIFIC_STRINGS,
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpCreateOptionV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionId", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION),
    ]


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


class R_DhcpSetOptionInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION),
    ]


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


class R_DhcpGetOptionInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
    ]


class R_DhcpGetOptionInfoV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionInfo", LPDHCP_OPTION(), LPDHCP_OPTION)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpEnumOptionsV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumOptionsV6_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField("Options", LPDHCP_OPTION_ARRAY(), LPDHCP_OPTION_ARRAY)
        ),
        NDRIntField("OptionsRead", 0),
        NDRIntField("OptionsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveOptionV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
    ]


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


class DHCP_OPTION_SCOPE_TYPE6(IntEnum):
    DhcpDefaultOptions6 = 1
    DhcpScopeOptions6 = 2
    DhcpReservedOptions6 = 3
    DhcpGlobalOptions6 = 4


class DHCP_IPV6_ADDRESS(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [NDRLongField("HighOrderBits", 0), NDRLongField("LowOrderBits", 0)]


class DHCP_RESERVED_SCOPE6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("ReservedIpAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField(
            "ReservedIpSubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS
        ),
    ]


class LPDHCP_OPTION_SCOPE_INFO6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRInt3264EnumField("ScopeType", 0, DHCP_OPTION_SCOPE_TYPE6),
        NDRUnionField(
            [
                (
                    StrFixedLenField("ScopeInfo", "", length=0),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions6
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions6
                        ),
                    ),
                ),
                (
                    NDRPacketField("ScopeInfo", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpScopeOptions6
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpScopeOptions6
                        ),
                    ),
                ),
                (
                    NDRPacketField(
                        "ScopeInfo", DHCP_RESERVED_SCOPE6(), DHCP_RESERVED_SCOPE6
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions6
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions6
                        ),
                    ),
                ),
                (
                    StrFixedLenField("ScopeInfo", "", length=0),
                    (
                        (
                            lambda pkt: getattr(pkt, "ScopeType", None)
                            == DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions6
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions6
                        ),
                    ),
                ),
            ],
            StrFixedLenField("ScopeInfo", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpSetOptionValueV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionId", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
        NDRPacketField("OptionValue", LPDHCP_OPTION_DATA(), LPDHCP_OPTION_DATA),
    ]


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


class R_DhcpEnumOptionValuesV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumOptionValuesV6_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "OptionValues", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
            )
        ),
        NDRIntField("OptionsRead", 0),
        NDRIntField("OptionsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveOptionValueV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
    ]


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


class R_DhcpGetAllOptionsV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
    ]


class R_DhcpGetAllOptionsV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionStruct", LPDHCP_ALL_OPTIONS(), LPDHCP_ALL_OPTIONS)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpGetAllOptionValuesV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
    ]


class R_DhcpGetAllOptionValuesV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "Values", LPDHCP_ALL_OPTION_VALUES(), LPDHCP_ALL_OPTION_VALUES
            )
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_SUBNET_INFO_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRIntField("Prefix", 0),
        NDRShortField("Preference", 0),
        NDRFullPointerField(NDRShortField("SubnetName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("SubnetComment", 0), deferred=True),
        NDRIntField("State", 0),
        NDRIntField("ScopeId", 0),
    ]


class R_DhcpCreateSubnetV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("SubnetInfo", LPDHCP_SUBNET_INFO_V6(), LPDHCP_SUBNET_INFO_V6),
    ]


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


class LPDHCP_IPV6_ADDRESS(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [NDRLongField("HighOrderBits", 0), NDRLongField("LowOrderBits", 0)]


class LPDHCPV6_IP_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_IPV6_ADDRESS()],
                LPDHCP_IPV6_ADDRESS,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetsV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetsV6_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField("EnumInfo", LPDHCPV6_IP_ARRAY(), LPDHCPV6_IP_ARRAY)
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class DHCP_SUBNET_ELEMENT_TYPE_V6(IntEnum):
    Dhcpv6IpRanges = 1
    Dhcpv6ReservedIps = 2
    Dhcpv6ExcludedIpRanges = 3


class DHCP_IP_RANGE_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("StartAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("EndAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
    ]


class DHCP_IP_RESERVATION_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("ReservedIpAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRFullPointerField(
            NDRPacketField("ReservedForClient", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
            deferred=True,
        ),
        NDRIntField("InterfaceId", 0),
    ]


class LPDHCP_SUBNET_ELEMENT_DATA_V6(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("ElementType", 0, DHCP_SUBNET_ELEMENT_TYPE_V6),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE_V6(), DHCP_IP_RANGE_V6),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE_V6.Dhcpv6IpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE_V6.Dhcpv6IpRanges
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "Element", DHCP_IP_RESERVATION_V6(), DHCP_IP_RESERVATION_V6
                        ),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE_V6.Dhcpv6ReservedIps
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE_V6.Dhcpv6ReservedIps
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Element", DHCP_IP_RANGE_V6(), DHCP_IP_RANGE_V6),
                        deferred=True,
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "ElementType", None)
                            == DHCP_SUBNET_ELEMENT_TYPE_V6.Dhcpv6ExcludedIpRanges
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SUBNET_ELEMENT_TYPE_V6.Dhcpv6ExcludedIpRanges
                        ),
                    ),
                ),
            ],
            StrFixedLenField("Element", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpAddSubnetElementV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField(
            "AddElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V6(),
            LPDHCP_SUBNET_ELEMENT_DATA_V6,
        ),
    ]


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


class LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V6(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_SUBNET_ELEMENT_DATA_V6()],
                LPDHCP_SUBNET_ELEMENT_DATA_V6,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetElementsV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRInt3264EnumField("EnumElementType", 0, DHCP_SUBNET_ELEMENT_TYPE_V6),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetElementsV6_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "EnumElementInfo",
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V6(),
                LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V6,
            )
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpRemoveSubnetElementV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField(
            "RemoveElementInfo",
            LPDHCP_SUBNET_ELEMENT_DATA_V6(),
            LPDHCP_SUBNET_ELEMENT_DATA_V6,
        ),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class R_DhcpDeleteSubnetV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRInt3264EnumField("ForceFlag", 0, DHCP_FORCE_FLAG),
    ]


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


class R_DhcpGetSubnetInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
    ]


class R_DhcpGetSubnetInfoV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("SubnetInfo", LPDHCP_SUBNET_INFO_V6(), LPDHCP_SUBNET_INFO_V6)
        ),
        NDRIntField("status", 0),
    ]


class DHCP_HOST_INFO_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("IpAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRFullPointerField(NDRShortField("NetBiosName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("HostName", 0), deferred=True),
    ]


class LPDHCP_CLIENT_INFO_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("ClientIpAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("ClientDUID", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRIntField("AddressType", 0),
        NDRIntField("IAID", 0),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientValidLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("ClientPrefLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO_V6(), DHCP_HOST_INFO_V6),
    ]


class LPDHCP_CLIENT_INFO_ARRAY_V6(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO_V6,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetClientsV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("ResumeHandle", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetClientsV6_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("ResumeHandle", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_ARRAY_V6(), LPDHCP_CLIENT_INFO_ARRAY_V6
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class LPDHCP_SERVER_CONFIG_INFO_V6(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRSignedIntField("UnicastFlag", 0),
        NDRSignedIntField("RapidCommitFlag", 0),
        NDRIntField("PreferredLifetime", 0),
        NDRIntField("ValidLifetime", 0),
        NDRIntField("T1", 0),
        NDRIntField("T2", 0),
        NDRIntField("PreferredLifetimeIATA", 0),
        NDRIntField("ValidLifetimeIATA", 0),
        NDRSignedIntField("fAuditLog", 0),
    ]


class R_DhcpServerSetConfigV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
        NDRIntField("FieldsToSet", 0),
        NDRPacketField(
            "ConfigInfo", LPDHCP_SERVER_CONFIG_INFO_V6(), LPDHCP_SERVER_CONFIG_INFO_V6
        ),
    ]


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


class R_DhcpServerGetConfigV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
    ]


class R_DhcpServerGetConfigV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ConfigInfo",
                LPDHCP_SERVER_CONFIG_INFO_V6(),
                LPDHCP_SERVER_CONFIG_INFO_V6,
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpSetSubnetInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("SubnetInfo", LPDHCP_SUBNET_INFO_V6(), LPDHCP_SUBNET_INFO_V6),
    ]


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


class LPSCOPE_MIB_INFO_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("Subnet", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRLongField("NumAddressesInuse", 0),
        NDRLongField("NumAddressesFree", 0),
        NDRLongField("NumPendingAdvertises", 0),
    ]


class LPDHCP_MIB_INFO_V6(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Solicits", 0),
        NDRIntField("Advertises", 0),
        NDRIntField("Requests", 0),
        NDRIntField("Renews", 0),
        NDRIntField("Rebinds", 0),
        NDRIntField("Replies", 0),
        NDRIntField("Confirms", 0),
        NDRIntField("Declines", 0),
        NDRIntField("Releases", 0),
        NDRIntField("Informs", 0),
        NDRPacketField("ServerStartTime", DATE_TIME(), DATE_TIME),
        NDRIntField("Scopes", None, size_of="ScopeInfo"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScopeInfo",
                [LPSCOPE_MIB_INFO_V6()],
                LPSCOPE_MIB_INFO_V6,
                size_is=lambda pkt: pkt.Scopes,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetMibInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetMibInfoV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("MibInfo", LPDHCP_MIB_INFO_V6(), LPDHCP_MIB_INFO_V6)
        ),
        NDRIntField("status", 0),
    ]


class LPDHCPV6_BIND_ELEMENT(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntField("Flags", 0),
        NDRSignedIntField("fBoundToDHCPServer", 0),
        NDRPacketField("AdapterPrimaryAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("AdapterSubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRFullPointerField(NDRShortField("IfDescription", 0), deferred=True),
        NDRIntField("IpV6IfIndex", 0),
        NDRIntField("IfIdSize", None, size_of="IfId"),
        NDRFullPointerField(
            NDRConfStrLenField("IfId", "", size_is=lambda pkt: pkt.IfIdSize),
            deferred=True,
        ),
    ]


class LPDHCPV6_BIND_ELEMENT_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCPV6_BIND_ELEMENT()],
                LPDHCPV6_BIND_ELEMENT,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetServerBindingInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
    ]


class R_DhcpGetServerBindingInfoV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "BindElementsInfo",
                LPDHCPV6_BIND_ELEMENT_ARRAY(),
                LPDHCPV6_BIND_ELEMENT_ARRAY,
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpSetServerBindingInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRPacketField(
            "BindElementsInfo",
            LPDHCPV6_BIND_ELEMENT_ARRAY(),
            LPDHCPV6_BIND_ELEMENT_ARRAY,
        ),
    ]


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


class R_DhcpSetClientInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_V6(), LPDHCP_CLIENT_INFO_V6),
    ]


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


class DHCP_SEARCH_INFO_TYPE_V6(IntEnum):
    Dhcpv6ClientIpAddress = 1
    Dhcpv6ClientDUID = 2
    Dhcpv6ClientName = 3


class LPDHCP_SEARCH_INFO_V6(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRInt3264EnumField("SearchType", 0, DHCP_SEARCH_INFO_TYPE_V6),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "SearchInfo", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "SearchType", None)
                            == DHCP_SEARCH_INFO_TYPE_V6.Dhcpv6ClientIpAddress
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SEARCH_INFO_TYPE_V6.Dhcpv6ClientIpAddress
                        ),
                    ),
                ),
                (
                    NDRPacketField("SearchInfo", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
                    (
                        (
                            lambda pkt: getattr(pkt, "SearchType", None)
                            == DHCP_SEARCH_INFO_TYPE_V6.Dhcpv6ClientDUID
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SEARCH_INFO_TYPE_V6.Dhcpv6ClientDUID
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRShortField("SearchInfo", 0), deferred=True),
                    (
                        (
                            lambda pkt: getattr(pkt, "SearchType", None)
                            == DHCP_SEARCH_INFO_TYPE_V6.Dhcpv6ClientName
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_SEARCH_INFO_TYPE_V6.Dhcpv6ClientName
                        ),
                    ),
                ),
            ],
            StrFixedLenField("SearchInfo", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class R_DhcpGetClientInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO_V6(), LPDHCP_SEARCH_INFO_V6),
    ]


class R_DhcpGetClientInfoV6_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_V6(), LPDHCP_CLIENT_INFO_V6)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpDeleteClientInfoV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_SEARCH_INFO_V6(), LPDHCP_SEARCH_INFO_V6),
    ]


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


class LPDHCP_CLASS_INFO_V6(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("ClassName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClassComment", 0), deferred=True),
        NDRIntField("ClassDataLength", None, size_of="ClassData"),
        NDRSignedIntField("IsVendor", 0),
        NDRIntField("EnterpriseNumber", 0),
        NDRIntField("Flags", 0),
        NDRFullPointerField(
            NDRConfStrLenField(
                "ClassData", "", size_is=lambda pkt: pkt.ClassDataLength
            ),
            deferred=True,
        ),
    ]


class R_DhcpCreateClassV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRPacketField("ClassInfo", LPDHCP_CLASS_INFO_V6(), LPDHCP_CLASS_INFO_V6),
    ]


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


class R_DhcpModifyClassV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRPacketField("ClassInfo", LPDHCP_CLASS_INFO_V6(), LPDHCP_CLASS_INFO_V6),
    ]


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


class R_DhcpDeleteClassV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
    ]


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


class LPDHCP_CLASS_INFO_ARRAY_V6(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Classes"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Classes",
                [LPDHCP_CLASS_INFO_V6()],
                LPDHCP_CLASS_INFO_V6,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumClassesV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ReservedMustBeZero", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumClassesV6_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClassInfoArray",
                LPDHCP_CLASS_INFO_ARRAY_V6(),
                LPDHCP_CLASS_INFO_ARRAY_V6,
            )
        ),
        NDRIntField("nRead", 0),
        NDRIntField("nTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpGetOptionValueV6_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClassName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO6(), LPDHCP_OPTION_SCOPE_INFO6
        ),
    ]


class R_DhcpGetOptionValueV6_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("OptionValue", LPDHCP_OPTION_VALUE(), LPDHCP_OPTION_VALUE),
        NDRIntField("status", 0),
    ]


class R_DhcpSetSubnetDelayOffer_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRShortField("TimeDelayInMilliseconds", 0),
    ]


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


class R_DhcpGetSubnetDelayOffer_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
    ]


class R_DhcpGetSubnetDelayOffer_Response(NDRPacket):
    fields_desc = [
        NDRShortField("TimeDelayInMilliseconds", 0),
        NDRIntField("status", 0),
    ]


class LPSCOPE_MIB_INFO_V5(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("Subnet", 0),
        NDRIntField("NumAddressesInuse", 0),
        NDRIntField("NumAddressesFree", 0),
        NDRIntField("NumPendingOffers", 0),
    ]


class LPDHCP_MIB_INFO_V5(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Discovers", 0),
        NDRIntField("Offers", 0),
        NDRIntField("Requests", 0),
        NDRIntField("Acks", 0),
        NDRIntField("Naks", 0),
        NDRIntField("Declines", 0),
        NDRIntField("Releases", 0),
        NDRPacketField("ServerStartTime", DATE_TIME(), DATE_TIME),
        NDRIntField("QtnNumLeases", 0),
        NDRIntField("QtnPctQtnLeases", 0),
        NDRIntField("QtnProbationLeases", 0),
        NDRIntField("QtnNonQtnLeases", 0),
        NDRIntField("QtnExemptLeases", 0),
        NDRIntField("QtnCapableClients", 0),
        NDRIntField("QtnIASErrors", 0),
        NDRIntField("DelayedOffers", 0),
        NDRIntField("ScopesWithDelayedOffers", 0),
        NDRIntField("Scopes", None, size_of="ScopeInfo"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScopeInfo",
                [LPSCOPE_MIB_INFO_V5()],
                LPSCOPE_MIB_INFO_V5,
                size_is=lambda pkt: pkt.Scopes,
            ),
            deferred=True,
        ),
    ]


class R_DhcpGetMibInfoV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetMibInfoV5_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("MibInfo", LPDHCP_MIB_INFO_V5(), LPDHCP_MIB_INFO_V5)
        ),
        NDRIntField("status", 0),
    ]


class DHCP_ADDR_PATTERN(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRSignedIntField("MatchHWType", 0),
        NDRByteField("HWType", 0),
        NDRSignedIntField("IsWildcard", 0),
        NDRByteField("Length", 0),
        StrFixedLenField("Pattern", "", length=255),
    ]


class DHCP_FILTER_LIST_TYPE(IntEnum):
    Deny = 1
    Allow = 2


class DHCP_FILTER_ADD_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("AddrPatt", DHCP_ADDR_PATTERN(), DHCP_ADDR_PATTERN),
        NDRFullPointerField(NDRShortField("Comment", 0), deferred=True),
        NDRInt3264EnumField("ListType", 0, DHCP_FILTER_LIST_TYPE),
    ]


class R_DhcpAddFilterV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("AddFilterInfo", DHCP_FILTER_ADD_INFO(), DHCP_FILTER_ADD_INFO),
        NDRSignedIntField("ForceFlag", 0),
    ]


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


class R_DhcpDeleteFilterV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("DeleteFilterInfo", DHCP_ADDR_PATTERN(), DHCP_ADDR_PATTERN),
    ]


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


class DHCP_FILTER_GLOBAL_INFO(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRSignedIntField("EnforceAllowList", 0),
        NDRSignedIntField("EnforceDenyList", 0),
    ]


class R_DhcpSetFilterV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "GlobalFilterInfo", DHCP_FILTER_GLOBAL_INFO(), DHCP_FILTER_GLOBAL_INFO
        ),
    ]


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


class R_DhcpGetFilterV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpGetFilterV4_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "GlobalFilterInfo", DHCP_FILTER_GLOBAL_INFO(), DHCP_FILTER_GLOBAL_INFO
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_ADDR_PATTERN(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRSignedIntField("MatchHWType", 0),
        NDRByteField("HWType", 0),
        NDRSignedIntField("IsWildcard", 0),
        NDRByteField("Length", 0),
        StrFixedLenField("Pattern", "", length=255),
    ]


class LPDHCP_FILTER_RECORD(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("AddrPatt", DHCP_ADDR_PATTERN(), DHCP_ADDR_PATTERN),
        NDRFullPointerField(NDRShortField("Comment", 0), deferred=True),
    ]


class LPDHCP_FILTER_ENUM_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="pEnumRecords"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pEnumRecords",
                [LPDHCP_FILTER_RECORD()],
                LPDHCP_FILTER_RECORD,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumFilterV4_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ResumeHandle", LPDHCP_ADDR_PATTERN(), LPDHCP_ADDR_PATTERN),
        NDRIntField("PreferredMaximum", 0),
        NDRInt3264EnumField("ListType", 0, DHCP_FILTER_LIST_TYPE),
    ]


class R_DhcpEnumFilterV4_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("ResumeHandle", LPDHCP_ADDR_PATTERN(), LPDHCP_ADDR_PATTERN),
        NDRFullPointerField(
            NDRPacketField(
                "EnumFilterInfo", LPDHCP_FILTER_ENUM_INFO(), LPDHCP_FILTER_ENUM_INFO
            )
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpSetDnsRegCredentialsV5_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Uname", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Domain", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Passwd", "")),
    ]


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


class LPDHCP_CLIENT_FILTER_STATUS_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
        NDRByteField("AddressState", 0),
        NDRInt3264EnumField("Status", 0, QuarantineStatus),
        NDRPacketField("ProbationEnds", DATE_TIME(), DATE_TIME),
        NDRSignedIntField("QuarantineCapable", 0),
        NDRIntField("FilterStatus", 0),
    ]


class LPDHCP_CLIENT_FILTER_STATUS_INFO_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_FILTER_STATUS_INFO,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpEnumSubnetClientsFilterStatusInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpEnumSubnetClientsFilterStatusInfo_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo",
                LPDHCP_CLIENT_FILTER_STATUS_INFO_ARRAY(),
                LPDHCP_CLIENT_FILTER_STATUS_INFO_ARRAY,
            )
        ),
        NDRIntField("ClientRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class DHCP_FAILOVER_MODE(IntEnum):
    LoadBalance = 0
    HotStandby = 1


class DHCP_FAILOVER_SERVER(IntEnum):
    PrimaryServer = 0
    SecondaryServer = 1


class FSM_STATE(IntEnum):
    NO_STATE = 0
    INIT = 1
    STARTUP = 2
    NORMAL = 3
    COMMUNICATION_INT = 4
    PARTNER_DOWN = 5
    POTENTIAL_CONFLICT = 6
    CONFLICT_DONE = 7
    RESOLUTION_INT = 8
    RECOVER = 9
    RECOVER_WAIT = 10
    RECOVER_DONE = 11


class LPDHCP_FAILOVER_RELATIONSHIP(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("primaryServer", 0),
        NDRIntField("secondaryServer", 0),
        NDRInt3264EnumField("mode", 0, DHCP_FAILOVER_MODE),
        NDRInt3264EnumField("serverType", 0, DHCP_FAILOVER_SERVER),
        NDRInt3264EnumField("state", 0, FSM_STATE),
        NDRInt3264EnumField("prevState", 0, FSM_STATE),
        NDRIntField("mclt", 0),
        NDRIntField("safePeriod", 0),
        NDRFullPointerField(NDRShortField("relationshipName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("primaryServerName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("secondaryServerName", 0), deferred=True),
        NDRFullPointerField(
            NDRPacketField("pScopes", LPDHCP_IP_ARRAY(), LPDHCP_IP_ARRAY), deferred=True
        ),
        NDRByteField("percentage", 0),
        NDRFullPointerField(NDRShortField("pSharedSecret", 0), deferred=True),
    ]


class R_DhcpV4FailoverCreateRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "pRelationship",
            LPDHCP_FAILOVER_RELATIONSHIP(),
            LPDHCP_FAILOVER_RELATIONSHIP,
        ),
    ]


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


class R_DhcpV4FailoverSetRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRPacketField(
            "pRelationship",
            LPDHCP_FAILOVER_RELATIONSHIP(),
            LPDHCP_FAILOVER_RELATIONSHIP,
        ),
    ]


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


class R_DhcpV4FailoverDeleteRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pRelationshipName", "")),
    ]


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


class R_DhcpV4FailoverGetRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("pRelationshipName", "")),
    ]


class R_DhcpV4FailoverGetRelationship_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pRelationship",
                LPDHCP_FAILOVER_RELATIONSHIP(),
                LPDHCP_FAILOVER_RELATIONSHIP,
            )
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_FAILOVER_RELATIONSHIP_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("numElements", None, size_of="pRelationships"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "pRelationships",
                [LPDHCP_FAILOVER_RELATIONSHIP()],
                LPDHCP_FAILOVER_RELATIONSHIP,
                size_is=lambda pkt: pkt.numElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4FailoverEnumRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("preferredMaximum", 0),
    ]


class R_DhcpV4FailoverEnumRelationship_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "pRelationship",
                LPDHCP_FAILOVER_RELATIONSHIP_ARRAY(),
                LPDHCP_FAILOVER_RELATIONSHIP_ARRAY,
            )
        ),
        NDRIntField("relationshipRead", 0),
        NDRIntField("relationshipTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpV4FailoverAddScopeToRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "pRelationship",
            LPDHCP_FAILOVER_RELATIONSHIP(),
            LPDHCP_FAILOVER_RELATIONSHIP,
        ),
    ]


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


class R_DhcpV4FailoverDeleteScopeFromRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField(
            "pRelationship",
            LPDHCP_FAILOVER_RELATIONSHIP(),
            LPDHCP_FAILOVER_RELATIONSHIP,
        ),
    ]


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


class R_DhcpV4FailoverGetScopeRelationship_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("scopeId", 0),
    ]


class R_DhcpV4FailoverGetScopeRelationship_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pRelationship",
                LPDHCP_FAILOVER_RELATIONSHIP(),
                LPDHCP_FAILOVER_RELATIONSHIP,
            )
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_FAILOVER_STATISTICS(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("numAddr", 0),
        NDRIntField("addrFree", 0),
        NDRIntField("addrInUse", 0),
        NDRIntField("partnerAddrFree", 0),
        NDRIntField("thisAddrFree", 0),
        NDRIntField("partnerAddrInUse", 0),
        NDRIntField("thisAddrInUse", 0),
    ]


class R_DhcpV4FailoverGetScopeStatistics_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("scopeId", 0),
    ]


class R_DhcpV4FailoverGetScopeStatistics_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pStats", LPDHCP_FAILOVER_STATISTICS(), LPDHCP_FAILOVER_STATISTICS
            )
        ),
        NDRIntField("status", 0),
    ]


class LPDHCPV4_FAILOVER_CLIENT_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
        NDRByteField("AddressState", 0),
        NDRInt3264EnumField("Status", 0, QuarantineStatus),
        NDRPacketField("ProbationEnds", DATE_TIME(), DATE_TIME),
        NDRSignedIntField("QuarantineCapable", 0),
        NDRIntField("SentPotExpTime", 0),
        NDRIntField("AckPotExpTime", 0),
        NDRIntField("RecvPotExpTime", 0),
        NDRIntField("StartTime", 0),
        NDRIntField("CltLastTransTime", 0),
        NDRIntField("LastBndUpdTime", 0),
        NDRIntField("bndMsgStatus", 0),
        NDRFullPointerField(NDRShortField("PolicyName", 0), deferred=True),
        NDRByteField("flags", 0),
    ]


class R_DhcpV4FailoverGetClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpV4FailoverGetClientInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo",
                LPDHCPV4_FAILOVER_CLIENT_INFO(),
                LPDHCPV4_FAILOVER_CLIENT_INFO,
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV4FailoverGetSystemTime_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


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


class R_DhcpV4FailoverTriggerAddrAllocation_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("FailRelName", "")),
    ]


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


class R_DhcpV4SetOptionValue_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRPacketField("OptionValue", LPDHCP_OPTION_DATA(), LPDHCP_OPTION_DATA),
    ]


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


class R_DhcpV4SetOptionValues_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
        NDRPacketField(
            "OptionValues", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
        ),
    ]


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


class R_DhcpV4GetOptionValue_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


class R_DhcpV4GetOptionValue_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("OptionValue", LPDHCP_OPTION_VALUE(), LPDHCP_OPTION_VALUE)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV4RemoveOptionValue_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRIntField("OptionID", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("VendorName", "")),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


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


class Options_DHCP_ALL_OPTION_VALUES_PB(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("PolicyName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("VendorName", 0), deferred=True),
        NDRSignedIntField("IsVendor", 0),
        NDRFullPointerField(
            NDRPacketField(
                "OptionsArray", LPDHCP_OPTION_VALUE_ARRAY(), LPDHCP_OPTION_VALUE_ARRAY
            ),
            deferred=True,
        ),
    ]


class LPDHCP_ALL_OPTION_VALUES_PB(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Flags", 0),
        NDRIntField("NumElements", None, size_of="Options_DHCP_ALL_OPTION_VALUES_PB"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Options_DHCP_ALL_OPTION_VALUES_PB",
                [Options_DHCP_ALL_OPTION_VALUES_PB()],
                Options_DHCP_ALL_OPTION_VALUES_PB,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4GetAllOptionValues_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("Flags", 0),
        NDRPacketField(
            "ScopeInfo", LPDHCP_OPTION_SCOPE_INFO(), LPDHCP_OPTION_SCOPE_INFO
        ),
    ]


class R_DhcpV4GetAllOptionValues_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "Values", LPDHCP_ALL_OPTION_VALUES_PB(), LPDHCP_ALL_OPTION_VALUES_PB
            )
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV4QueryPolicyEnforcement_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
    ]


class R_DhcpV4QueryPolicyEnforcement_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("Enabled", 0), NDRIntField("status", 0)]


class R_DhcpV4SetPolicyEnforcement_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
        NDRSignedIntField("Enable", 0),
    ]


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


class DHCP_POL_ATTR_TYPE(IntEnum):
    DhcpAttrHWAddr = 1
    DhcpAttrOption = 2
    DhcpAttrSubOption = 3
    DhcpAttrFqdn = 4
    DhcpAttrFqdnSingleLabel = 5


class DHCP_POL_COMPARATOR(IntEnum):
    DhcpCompEqual = 1
    DhcpCompNotEqual = 2
    DhcpCompBeginsWith = 3
    DhcpCompNotBeginWith = 4
    DhcpCompEndsWith = 5
    DhcpCompNotEndWith = 6


class LPDHCP_POL_COND(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ParentExpr", 0),
        NDRInt3264EnumField("Type", 0, DHCP_POL_ATTR_TYPE),
        NDRIntField("OptionID", 0),
        NDRIntField("SubOptionID", 0),
        NDRFullPointerField(NDRShortField("VendorName", 0), deferred=True),
        NDRInt3264EnumField("Operator", 0, DHCP_POL_COMPARATOR),
        NDRFullPointerField(
            NDRConfStrLenField("Value", "", size_is=lambda pkt: pkt.ValueLength),
            deferred=True,
        ),
        NDRIntField("ValueLength", None, size_of="Value"),
    ]


class LPDHCP_POL_COND_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_POL_COND()],
                LPDHCP_POL_COND,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class DHCP_POL_LOGIC_OPER(IntEnum):
    DhcpLogicalOr = 1
    DhcpLogicalAnd = 2


class LPDHCP_POL_EXPR(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("ParentExpr", 0),
        NDRInt3264EnumField("Operator", 0, DHCP_POL_LOGIC_OPER),
    ]


class LPDHCP_POL_EXPR_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_POL_EXPR()],
                LPDHCP_POL_EXPR,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class LPDHCP_IP_RANGE(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("StartAddress", 0), NDRIntField("EndAddress", 0)]


class LPDHCP_IP_RANGE_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_IP_RANGE()],
                LPDHCP_IP_RANGE,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class LPDHCP_POLICY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("PolicyName", 0), deferred=True),
        NDRSignedIntField("IsGlobalPolicy", 0),
        NDRIntField("Subnet", 0),
        NDRIntField("ProcessingOrder", 0),
        NDRFullPointerField(
            NDRPacketField(
                "Conditions", LPDHCP_POL_COND_ARRAY(), LPDHCP_POL_COND_ARRAY
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField(
                "Expressions", LPDHCP_POL_EXPR_ARRAY(), LPDHCP_POL_EXPR_ARRAY
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField("Ranges", LPDHCP_IP_RANGE_ARRAY(), LPDHCP_IP_RANGE_ARRAY),
            deferred=True,
        ),
        NDRFullPointerField(NDRShortField("Description", 0), deferred=True),
        NDRSignedIntField("Enabled", 0),
    ]


class R_DhcpV4CreatePolicy_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("pPolicy", LPDHCP_POLICY(), LPDHCP_POLICY),
    ]


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


class R_DhcpV4GetPolicy_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
    ]


class R_DhcpV4GetPolicy_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("Policy", LPDHCP_POLICY(), LPDHCP_POLICY)),
        NDRIntField("status", 0),
    ]


class R_DhcpV4SetPolicy_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("FieldsModified", 0),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRPacketField("Policy", LPDHCP_POLICY(), LPDHCP_POLICY),
    ]


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


class R_DhcpV4DeletePolicy_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
    ]


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


class LPDHCP_POLICY_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_POLICY()],
                LPDHCP_POLICY,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4EnumPolicies_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
    ]


class R_DhcpV4EnumPolicies_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRPacketField("EnumInfo", LPDHCP_POLICY_ARRAY(), LPDHCP_POLICY_ARRAY),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpV4AddPolicyRange_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRPacketField("Range", LPDHCP_IP_RANGE(), LPDHCP_IP_RANGE),
    ]


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


class R_DhcpV4RemovePolicyRange_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRPacketField("Range", LPDHCP_IP_RANGE(), LPDHCP_IP_RANGE),
    ]


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


class LPDHCP_CLIENT_INFO_PB(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
        NDRByteField("AddressState", 0),
        NDRInt3264EnumField("Status", 0, QuarantineStatus),
        NDRPacketField("ProbationEnds", DATE_TIME(), DATE_TIME),
        NDRSignedIntField("QuarantineCapable", 0),
        NDRIntField("FilterStatus", 0),
        NDRFullPointerField(NDRShortField("PolicyName", 0), deferred=True),
    ]


class LPDHCP_CLIENT_INFO_PB_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO_PB,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4EnumSubnetClients_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpV4EnumSubnetClients_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_PB_ARRAY(), LPDHCP_CLIENT_INFO_PB_ARRAY
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class LPDHCPV6_STATELESS_PARAMS(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("Status", 0), NDRIntField("PurgeInterval", 0)]


class R_DhcpV6SetStatelessStoreParams_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("fServerLevel", 0),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRIntField("FieldModified", 0),
        NDRPacketField(
            "Params", LPDHCPV6_STATELESS_PARAMS(), LPDHCPV6_STATELESS_PARAMS
        ),
    ]


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


class R_DhcpV6GetStatelessStoreParams_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("fServerLevel", 0),
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
    ]


class R_DhcpV6GetStatelessStoreParams_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "Params", LPDHCPV6_STATELESS_PARAMS(), LPDHCPV6_STATELESS_PARAMS
        ),
        NDRIntField("status", 0),
    ]


class LPDHCPV6_STATELESS_SCOPE_STATS(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("SubnetAddress", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRLongField("NumStatelessClientsAdded", 0),
        NDRLongField("NumStatelessClientsRemoved", 0),
    ]


class LPDHCPV6_STATELESS_STATS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumScopes", None, size_of="ScopeStats"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "ScopeStats",
                [LPDHCPV6_STATELESS_SCOPE_STATS()],
                LPDHCPV6_STATELESS_SCOPE_STATS,
                size_is=lambda pkt: pkt.NumScopes,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV6GetStatelessStatistics_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", ""))
    ]


class R_DhcpV6GetStatelessStatistics_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "StatelessStats", LPDHCPV6_STATELESS_STATS(), LPDHCPV6_STATELESS_STATS
            )
        ),
        NDRIntField("status", 0),
    ]


class LPDHCP_IP_RESERVATION_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ReservedIpAddress", 0),
        NDRPacketField("ReservedForClient", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ReservedClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ReservedClientDesc", 0), deferred=True),
        NDRByteField("bAllowedClientTypes", 0),
        NDRByteField("fOptionsPresent", 0),
    ]


class LPDHCP_RESERVATION_INFO_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [],
                LPDHCP_IP_RESERVATION_INFO,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4EnumSubnetReservations_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpV4EnumSubnetReservations_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRPacketField(
            "EnumElementInfo",
            LPDHCP_RESERVATION_INFO_ARRAY(),
            LPDHCP_RESERVATION_INFO_ARRAY,
        ),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpV4GetFreeIPAddress_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ScopeId", 0),
        NDRIntField("startIP", 0),
        NDRIntField("endIP", 0),
        NDRIntField("numFreeAddr", 0),
    ]


class R_DhcpV4GetFreeIPAddress_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("IPAddrList", LPDHCP_IP_ARRAY(), LPDHCP_IP_ARRAY)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV6GetFreeIPAddress_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ScopeId", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("startIP", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRPacketField("endIP", DHCP_IPV6_ADDRESS(), DHCP_IPV6_ADDRESS),
        NDRIntField("numFreeAddr", 0),
    ]


class R_DhcpV6GetFreeIPAddress_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("IPAddrList", LPDHCPV6_IP_ARRAY(), LPDHCPV6_IP_ARRAY)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV4CreateClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_PB(), LPDHCP_CLIENT_INFO_PB),
    ]


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


class R_DhcpV4GetClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpV4GetClientInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_PB(), LPDHCP_CLIENT_INFO_PB)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV6CreateClientInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_V6(), LPDHCP_CLIENT_INFO_V6),
    ]


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


class R_DhcpV4FailoverGetAddressStatus_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
    ]


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


class DHCP_PROPERTY_ID(IntEnum):
    DhcpPropIdPolicyDnsSuffix = 1
    DhcpPropIdClientAddressStateEx = 2


class DHCP_PROPERTY_TYPE(IntEnum):
    DhcpPropTypeByte = 1
    DhcpPropTypeWord = 2
    DhcpPropTypeDword = 3
    DhcpPropTypeString = 4
    DhcpPropTypeBinary = 5


class LPDHCP_PROPERTY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("ID", 0, DHCP_PROPERTY_ID),
        NDRInt3264EnumField("Type", 0, DHCP_PROPERTY_TYPE),
        NDRUnionField(
            [
                (
                    NDRByteField("Value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeByte
                        ),
                        (lambda _, val: val.tag == DHCP_PROPERTY_TYPE.DhcpPropTypeByte),
                    ),
                ),
                (
                    NDRShortField("Value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeWord
                        ),
                        (lambda _, val: val.tag == DHCP_PROPERTY_TYPE.DhcpPropTypeWord),
                    ),
                ),
                (
                    NDRIntField("Value", 0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeDword
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeDword
                        ),
                    ),
                ),
                (
                    NDRFullPointerField(NDRShortField("Value", 0), deferred=True),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeString
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeString
                        ),
                    ),
                ),
                (
                    NDRPacketField("Value", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeBinary
                        ),
                        (
                            lambda _, val: val.tag
                            == DHCP_PROPERTY_TYPE.DhcpPropTypeBinary
                        ),
                    ),
                ),
            ],
            StrFixedLenField("Value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class LPDHCP_PROPERTY_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_PROPERTY()],
                LPDHCP_PROPERTY,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class LPDHCP_POLICY_EX(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(NDRShortField("PolicyName", 0), deferred=True),
        NDRSignedIntField("IsGlobalPolicy", 0),
        NDRIntField("Subnet", 0),
        NDRIntField("ProcessingOrder", 0),
        NDRFullPointerField(
            NDRPacketField(
                "Conditions", LPDHCP_POL_COND_ARRAY(), LPDHCP_POL_COND_ARRAY
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField(
                "Expressions", LPDHCP_POL_EXPR_ARRAY(), LPDHCP_POL_EXPR_ARRAY
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRPacketField("Ranges", LPDHCP_IP_RANGE_ARRAY(), LPDHCP_IP_RANGE_ARRAY),
            deferred=True,
        ),
        NDRFullPointerField(NDRShortField("Description", 0), deferred=True),
        NDRSignedIntField("Enabled", 0),
        NDRFullPointerField(
            NDRPacketField(
                "Properties", LPDHCP_PROPERTY_ARRAY(), LPDHCP_PROPERTY_ARRAY
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4CreatePolicyEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("pPolicy", LPDHCP_POLICY_EX(), LPDHCP_POLICY_EX),
    ]


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


class R_DhcpV4GetPolicyEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
    ]


class R_DhcpV4GetPolicyEx_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("Policy", LPDHCP_POLICY_EX(), LPDHCP_POLICY_EX)
        ),
        NDRIntField("status", 0),
    ]


class R_DhcpV4SetPolicyEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("FieldsModified", 0),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("PolicyName", "")),
        NDRPacketField("Policy", LPDHCP_POLICY_EX(), LPDHCP_POLICY_EX),
    ]


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


class LPDHCP_POLICY_EX_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Elements"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Elements",
                [LPDHCP_POLICY_EX()],
                LPDHCP_POLICY_EX,
                size_is=lambda pkt: pkt.NumElements,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4EnumPoliciesEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
        NDRSignedIntField("ServerPolicy", 0),
        NDRIntField("SubnetAddress", 0),
    ]


class R_DhcpV4EnumPoliciesEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRPacketField("EnumInfo", LPDHCP_POLICY_EX_ARRAY(), LPDHCP_POLICY_EX_ARRAY),
        NDRIntField("ElementsRead", 0),
        NDRIntField("ElementsTotal", 0),
        NDRIntField("status", 0),
    ]


class LPDHCP_CLIENT_INFO_EX(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ClientIpAddress", 0),
        NDRIntField("SubnetMask", 0),
        NDRPacketField("ClientHardwareAddress", DHCP_BINARY_DATA(), DHCP_BINARY_DATA),
        NDRFullPointerField(NDRShortField("ClientName", 0), deferred=True),
        NDRFullPointerField(NDRShortField("ClientComment", 0), deferred=True),
        NDRPacketField("ClientLeaseExpires", DATE_TIME(), DATE_TIME),
        NDRPacketField("OwnerHost", DHCP_HOST_INFO(), DHCP_HOST_INFO),
        NDRByteField("bClientType", 0),
        NDRByteField("AddressState", 0),
        NDRInt3264EnumField("Status", 0, QuarantineStatus),
        NDRPacketField("ProbationEnds", DATE_TIME(), DATE_TIME),
        NDRSignedIntField("QuarantineCapable", 0),
        NDRIntField("FilterStatus", 0),
        NDRFullPointerField(NDRShortField("PolicyName", 0), deferred=True),
        NDRFullPointerField(
            NDRPacketField(
                "Properties", LPDHCP_PROPERTY_ARRAY(), LPDHCP_PROPERTY_ARRAY
            ),
            deferred=True,
        ),
    ]


class LPDHCP_CLIENT_INFO_EX_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("NumElements", None, size_of="Clients"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Clients",
                [],
                LPDHCP_CLIENT_INFO_EX,
                size_is=lambda pkt: pkt.NumElements,
                ptr_pack=True,
            ),
            deferred=True,
        ),
    ]


class R_DhcpV4EnumSubnetClientsEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRIntField("SubnetAddress", 0),
        NDRIntField("ResumeHandle", 0),
        NDRIntField("PreferredMaximum", 0),
    ]


class R_DhcpV4EnumSubnetClientsEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ResumeHandle", 0),
        NDRFullPointerField(
            NDRPacketField(
                "ClientInfo", LPDHCP_CLIENT_INFO_EX_ARRAY(), LPDHCP_CLIENT_INFO_EX_ARRAY
            )
        ),
        NDRIntField("ClientsRead", 0),
        NDRIntField("ClientsTotal", 0),
        NDRIntField("status", 0),
    ]


class R_DhcpV4CreateClientInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_EX(), LPDHCP_CLIENT_INFO_EX),
    ]


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


class R_DhcpV4GetClientInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerIpAddress", "")),
        NDRPacketField("SearchInfo", LPDHCP_SEARCH_INFO(), LPDHCP_SEARCH_INFO),
    ]


class R_DhcpV4GetClientInfoEx_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ClientInfo", LPDHCP_CLIENT_INFO_EX(), LPDHCP_CLIENT_INFO_EX)
        ),
        NDRIntField("status", 0),
    ]


DHCPSRV2_OPNUMS = {
    0: DceRpcOp(R_DhcpEnumSubnetClientsV5_Request, R_DhcpEnumSubnetClientsV5_Response),
    1: DceRpcOp(R_DhcpSetMScopeInfo_Request, R_DhcpSetMScopeInfo_Response),
    2: DceRpcOp(R_DhcpGetMScopeInfo_Request, R_DhcpGetMScopeInfo_Response),
    3: DceRpcOp(R_DhcpEnumMScopes_Request, R_DhcpEnumMScopes_Response),
    4: DceRpcOp(R_DhcpAddMScopeElement_Request, R_DhcpAddMScopeElement_Response),
    5: DceRpcOp(R_DhcpEnumMScopeElements_Request, R_DhcpEnumMScopeElements_Response),
    6: DceRpcOp(R_DhcpRemoveMScopeElement_Request, R_DhcpRemoveMScopeElement_Response),
    7: DceRpcOp(R_DhcpDeleteMScope_Request, R_DhcpDeleteMScope_Response),
    8: DceRpcOp(R_DhcpScanMDatabase_Request, R_DhcpScanMDatabase_Response),
    9: DceRpcOp(R_DhcpCreateMClientInfo_Request, R_DhcpCreateMClientInfo_Response),
    10: DceRpcOp(R_DhcpSetMClientInfo_Request, R_DhcpSetMClientInfo_Response),
    11: DceRpcOp(R_DhcpGetMClientInfo_Request, R_DhcpGetMClientInfo_Response),
    12: DceRpcOp(R_DhcpDeleteMClientInfo_Request, R_DhcpDeleteMClientInfo_Response),
    13: DceRpcOp(R_DhcpEnumMScopeClients_Request, R_DhcpEnumMScopeClients_Response),
    14: DceRpcOp(R_DhcpCreateOptionV5_Request, R_DhcpCreateOptionV5_Response),
    15: DceRpcOp(R_DhcpSetOptionInfoV5_Request, R_DhcpSetOptionInfoV5_Response),
    16: DceRpcOp(R_DhcpGetOptionInfoV5_Request, R_DhcpGetOptionInfoV5_Response),
    17: DceRpcOp(R_DhcpEnumOptionsV5_Request, R_DhcpEnumOptionsV5_Response),
    18: DceRpcOp(R_DhcpRemoveOptionV5_Request, R_DhcpRemoveOptionV5_Response),
    19: DceRpcOp(R_DhcpSetOptionValueV5_Request, R_DhcpSetOptionValueV5_Response),
    20: DceRpcOp(R_DhcpSetOptionValuesV5_Request, R_DhcpSetOptionValuesV5_Response),
    21: DceRpcOp(R_DhcpGetOptionValueV5_Request, R_DhcpGetOptionValueV5_Response),
    22: DceRpcOp(R_DhcpEnumOptionValuesV5_Request, R_DhcpEnumOptionValuesV5_Response),
    23: DceRpcOp(R_DhcpRemoveOptionValueV5_Request, R_DhcpRemoveOptionValueV5_Response),
    24: DceRpcOp(R_DhcpCreateClass_Request, R_DhcpCreateClass_Response),
    25: DceRpcOp(R_DhcpModifyClass_Request, R_DhcpModifyClass_Response),
    26: DceRpcOp(R_DhcpDeleteClass_Request, R_DhcpDeleteClass_Response),
    27: DceRpcOp(R_DhcpGetClassInfo_Request, R_DhcpGetClassInfo_Response),
    28: DceRpcOp(R_DhcpEnumClasses_Request, R_DhcpEnumClasses_Response),
    29: DceRpcOp(R_DhcpGetAllOptions_Request, R_DhcpGetAllOptions_Response),
    30: DceRpcOp(R_DhcpGetAllOptionValues_Request, R_DhcpGetAllOptionValues_Response),
    31: DceRpcOp(R_DhcpGetMCastMibInfo_Request, R_DhcpGetMCastMibInfo_Response),
    32: DceRpcOp(R_DhcpAuditLogSetParams_Request, R_DhcpAuditLogSetParams_Response),
    33: DceRpcOp(R_DhcpAuditLogGetParams_Request, R_DhcpAuditLogGetParams_Response),
    34: DceRpcOp(
        R_DhcpServerQueryAttribute_Request, R_DhcpServerQueryAttribute_Response
    ),
    35: DceRpcOp(
        R_DhcpServerQueryAttributes_Request, R_DhcpServerQueryAttributes_Response
    ),
    36: DceRpcOp(
        R_DhcpServerRedoAuthorization_Request, R_DhcpServerRedoAuthorization_Response
    ),
    37: DceRpcOp(R_DhcpAddSubnetElementV5_Request, R_DhcpAddSubnetElementV5_Response),
    38: DceRpcOp(
        R_DhcpEnumSubnetElementsV5_Request, R_DhcpEnumSubnetElementsV5_Response
    ),
    39: DceRpcOp(
        R_DhcpRemoveSubnetElementV5_Request, R_DhcpRemoveSubnetElementV5_Response
    ),
    40: DceRpcOp(
        R_DhcpGetServerBindingInfo_Request, R_DhcpGetServerBindingInfo_Response
    ),
    41: DceRpcOp(
        R_DhcpSetServerBindingInfo_Request, R_DhcpSetServerBindingInfo_Response
    ),
    42: DceRpcOp(
        R_DhcpQueryDnsRegCredentials_Request, R_DhcpQueryDnsRegCredentials_Response
    ),
    43: DceRpcOp(
        R_DhcpSetDnsRegCredentials_Request, R_DhcpSetDnsRegCredentials_Response
    ),
    44: DceRpcOp(R_DhcpBackupDatabase_Request, R_DhcpBackupDatabase_Response),
    45: DceRpcOp(R_DhcpRestoreDatabase_Request, R_DhcpRestoreDatabase_Response),
    46: DceRpcOp(
        R_DhcpGetServerSpecificStrings_Request, R_DhcpGetServerSpecificStrings_Response
    ),
    47: DceRpcOp(R_DhcpCreateOptionV6_Request, R_DhcpCreateOptionV6_Response),
    48: DceRpcOp(R_DhcpSetOptionInfoV6_Request, R_DhcpSetOptionInfoV6_Response),
    49: DceRpcOp(R_DhcpGetOptionInfoV6_Request, R_DhcpGetOptionInfoV6_Response),
    50: DceRpcOp(R_DhcpEnumOptionsV6_Request, R_DhcpEnumOptionsV6_Response),
    51: DceRpcOp(R_DhcpRemoveOptionV6_Request, R_DhcpRemoveOptionV6_Response),
    52: DceRpcOp(R_DhcpSetOptionValueV6_Request, R_DhcpSetOptionValueV6_Response),
    53: DceRpcOp(R_DhcpEnumOptionValuesV6_Request, R_DhcpEnumOptionValuesV6_Response),
    54: DceRpcOp(R_DhcpRemoveOptionValueV6_Request, R_DhcpRemoveOptionValueV6_Response),
    55: DceRpcOp(R_DhcpGetAllOptionsV6_Request, R_DhcpGetAllOptionsV6_Response),
    56: DceRpcOp(
        R_DhcpGetAllOptionValuesV6_Request, R_DhcpGetAllOptionValuesV6_Response
    ),
    57: DceRpcOp(R_DhcpCreateSubnetV6_Request, R_DhcpCreateSubnetV6_Response),
    58: DceRpcOp(R_DhcpEnumSubnetsV6_Request, R_DhcpEnumSubnetsV6_Response),
    59: DceRpcOp(R_DhcpAddSubnetElementV6_Request, R_DhcpAddSubnetElementV6_Response),
    60: DceRpcOp(
        R_DhcpEnumSubnetElementsV6_Request, R_DhcpEnumSubnetElementsV6_Response
    ),
    61: DceRpcOp(
        R_DhcpRemoveSubnetElementV6_Request, R_DhcpRemoveSubnetElementV6_Response
    ),
    62: DceRpcOp(R_DhcpDeleteSubnetV6_Request, R_DhcpDeleteSubnetV6_Response),
    63: DceRpcOp(R_DhcpGetSubnetInfoV6_Request, R_DhcpGetSubnetInfoV6_Response),
    64: DceRpcOp(R_DhcpEnumSubnetClientsV6_Request, R_DhcpEnumSubnetClientsV6_Response),
    65: DceRpcOp(R_DhcpServerSetConfigV6_Request, R_DhcpServerSetConfigV6_Response),
    66: DceRpcOp(R_DhcpServerGetConfigV6_Request, R_DhcpServerGetConfigV6_Response),
    67: DceRpcOp(R_DhcpSetSubnetInfoV6_Request, R_DhcpSetSubnetInfoV6_Response),
    68: DceRpcOp(R_DhcpGetMibInfoV6_Request, R_DhcpGetMibInfoV6_Response),
    69: DceRpcOp(
        R_DhcpGetServerBindingInfoV6_Request, R_DhcpGetServerBindingInfoV6_Response
    ),
    70: DceRpcOp(
        R_DhcpSetServerBindingInfoV6_Request, R_DhcpSetServerBindingInfoV6_Response
    ),
    71: DceRpcOp(R_DhcpSetClientInfoV6_Request, R_DhcpSetClientInfoV6_Response),
    72: DceRpcOp(R_DhcpGetClientInfoV6_Request, R_DhcpGetClientInfoV6_Response),
    73: DceRpcOp(R_DhcpDeleteClientInfoV6_Request, R_DhcpDeleteClientInfoV6_Response),
    74: DceRpcOp(R_DhcpCreateClassV6_Request, R_DhcpCreateClassV6_Response),
    75: DceRpcOp(R_DhcpModifyClassV6_Request, R_DhcpModifyClassV6_Response),
    76: DceRpcOp(R_DhcpDeleteClassV6_Request, R_DhcpDeleteClassV6_Response),
    77: DceRpcOp(R_DhcpEnumClassesV6_Request, R_DhcpEnumClassesV6_Response),
    78: DceRpcOp(R_DhcpGetOptionValueV6_Request, R_DhcpGetOptionValueV6_Response),
    79: DceRpcOp(R_DhcpSetSubnetDelayOffer_Request, R_DhcpSetSubnetDelayOffer_Response),
    80: DceRpcOp(R_DhcpGetSubnetDelayOffer_Request, R_DhcpGetSubnetDelayOffer_Response),
    81: DceRpcOp(R_DhcpGetMibInfoV5_Request, R_DhcpGetMibInfoV5_Response),
    82: DceRpcOp(R_DhcpAddFilterV4_Request, R_DhcpAddFilterV4_Response),
    83: DceRpcOp(R_DhcpDeleteFilterV4_Request, R_DhcpDeleteFilterV4_Response),
    84: DceRpcOp(R_DhcpSetFilterV4_Request, R_DhcpSetFilterV4_Response),
    85: DceRpcOp(R_DhcpGetFilterV4_Request, R_DhcpGetFilterV4_Response),
    86: DceRpcOp(R_DhcpEnumFilterV4_Request, R_DhcpEnumFilterV4_Response),
    87: DceRpcOp(
        R_DhcpSetDnsRegCredentialsV5_Request, R_DhcpSetDnsRegCredentialsV5_Response
    ),
    88: DceRpcOp(
        R_DhcpEnumSubnetClientsFilterStatusInfo_Request,
        R_DhcpEnumSubnetClientsFilterStatusInfo_Response,
    ),
    89: DceRpcOp(
        R_DhcpV4FailoverCreateRelationship_Request,
        R_DhcpV4FailoverCreateRelationship_Response,
    ),
    90: DceRpcOp(
        R_DhcpV4FailoverSetRelationship_Request,
        R_DhcpV4FailoverSetRelationship_Response,
    ),
    91: DceRpcOp(
        R_DhcpV4FailoverDeleteRelationship_Request,
        R_DhcpV4FailoverDeleteRelationship_Response,
    ),
    92: DceRpcOp(
        R_DhcpV4FailoverGetRelationship_Request,
        R_DhcpV4FailoverGetRelationship_Response,
    ),
    93: DceRpcOp(
        R_DhcpV4FailoverEnumRelationship_Request,
        R_DhcpV4FailoverEnumRelationship_Response,
    ),
    94: DceRpcOp(
        R_DhcpV4FailoverAddScopeToRelationship_Request,
        R_DhcpV4FailoverAddScopeToRelationship_Response,
    ),
    95: DceRpcOp(
        R_DhcpV4FailoverDeleteScopeFromRelationship_Request,
        R_DhcpV4FailoverDeleteScopeFromRelationship_Response,
    ),
    96: DceRpcOp(
        R_DhcpV4FailoverGetScopeRelationship_Request,
        R_DhcpV4FailoverGetScopeRelationship_Response,
    ),
    97: DceRpcOp(
        R_DhcpV4FailoverGetScopeStatistics_Request,
        R_DhcpV4FailoverGetScopeStatistics_Response,
    ),
    98: DceRpcOp(
        R_DhcpV4FailoverGetClientInfo_Request, R_DhcpV4FailoverGetClientInfo_Response
    ),
    99: DceRpcOp(
        R_DhcpV4FailoverGetSystemTime_Request, R_DhcpV4FailoverGetSystemTime_Response
    ),
    100: DceRpcOp(
        R_DhcpV4FailoverTriggerAddrAllocation_Request,
        R_DhcpV4FailoverTriggerAddrAllocation_Response,
    ),
    101: DceRpcOp(R_DhcpV4SetOptionValue_Request, R_DhcpV4SetOptionValue_Response),
    102: DceRpcOp(R_DhcpV4SetOptionValues_Request, R_DhcpV4SetOptionValues_Response),
    103: DceRpcOp(R_DhcpV4GetOptionValue_Request, R_DhcpV4GetOptionValue_Response),
    104: DceRpcOp(
        R_DhcpV4RemoveOptionValue_Request, R_DhcpV4RemoveOptionValue_Response
    ),
    105: DceRpcOp(
        R_DhcpV4GetAllOptionValues_Request, R_DhcpV4GetAllOptionValues_Response
    ),
    106: DceRpcOp(
        R_DhcpV4QueryPolicyEnforcement_Request, R_DhcpV4QueryPolicyEnforcement_Response
    ),
    107: DceRpcOp(
        R_DhcpV4SetPolicyEnforcement_Request, R_DhcpV4SetPolicyEnforcement_Response
    ),
    108: DceRpcOp(R_DhcpV4CreatePolicy_Request, R_DhcpV4CreatePolicy_Response),
    109: DceRpcOp(R_DhcpV4GetPolicy_Request, R_DhcpV4GetPolicy_Response),
    110: DceRpcOp(R_DhcpV4SetPolicy_Request, R_DhcpV4SetPolicy_Response),
    111: DceRpcOp(R_DhcpV4DeletePolicy_Request, R_DhcpV4DeletePolicy_Response),
    112: DceRpcOp(R_DhcpV4EnumPolicies_Request, R_DhcpV4EnumPolicies_Response),
    113: DceRpcOp(R_DhcpV4AddPolicyRange_Request, R_DhcpV4AddPolicyRange_Response),
    114: DceRpcOp(
        R_DhcpV4RemovePolicyRange_Request, R_DhcpV4RemovePolicyRange_Response
    ),
    115: DceRpcOp(
        R_DhcpV4EnumSubnetClients_Request, R_DhcpV4EnumSubnetClients_Response
    ),
    116: DceRpcOp(
        R_DhcpV6SetStatelessStoreParams_Request,
        R_DhcpV6SetStatelessStoreParams_Response,
    ),
    117: DceRpcOp(
        R_DhcpV6GetStatelessStoreParams_Request,
        R_DhcpV6GetStatelessStoreParams_Response,
    ),
    118: DceRpcOp(
        R_DhcpV6GetStatelessStatistics_Request, R_DhcpV6GetStatelessStatistics_Response
    ),
    119: DceRpcOp(
        R_DhcpV4EnumSubnetReservations_Request, R_DhcpV4EnumSubnetReservations_Response
    ),
    120: DceRpcOp(R_DhcpV4GetFreeIPAddress_Request, R_DhcpV4GetFreeIPAddress_Response),
    121: DceRpcOp(R_DhcpV6GetFreeIPAddress_Request, R_DhcpV6GetFreeIPAddress_Response),
    122: DceRpcOp(R_DhcpV4CreateClientInfo_Request, R_DhcpV4CreateClientInfo_Response),
    123: DceRpcOp(R_DhcpV4GetClientInfo_Request, R_DhcpV4GetClientInfo_Response),
    124: DceRpcOp(R_DhcpV6CreateClientInfo_Request, R_DhcpV6CreateClientInfo_Response),
    125: DceRpcOp(
        R_DhcpV4FailoverGetAddressStatus_Request,
        R_DhcpV4FailoverGetAddressStatus_Response,
    ),
    126: DceRpcOp(R_DhcpV4CreatePolicyEx_Request, R_DhcpV4CreatePolicyEx_Response),
    127: DceRpcOp(R_DhcpV4GetPolicyEx_Request, R_DhcpV4GetPolicyEx_Response),
    128: DceRpcOp(R_DhcpV4SetPolicyEx_Request, R_DhcpV4SetPolicyEx_Response),
    129: DceRpcOp(R_DhcpV4EnumPoliciesEx_Request, R_DhcpV4EnumPoliciesEx_Response),
    130: DceRpcOp(
        R_DhcpV4EnumSubnetClientsEx_Request, R_DhcpV4EnumSubnetClientsEx_Response
    ),
    131: DceRpcOp(
        R_DhcpV4CreateClientInfoEx_Request, R_DhcpV4CreateClientInfoEx_Response
    ),
    132: DceRpcOp(R_DhcpV4GetClientInfoEx_Request, R_DhcpV4GetClientInfoEx_Response),
}
register_dcerpc_interface(
    name="dhcpsrv2",
    uuid=uuid.UUID("5b821720-f63b-11d0-aad2-00c04fc324db"),
    version="1.0",
    opnums=DHCPSRV2_OPNUMS,
)
