private static DhcpServerOptionElement ReadNative(DHCP_OPTION_DATA_ELEMENT element)
        {
            switch (element.OptionType)
            {
            case DHCP_OPTION_DATA_TYPE.DhcpByteOption:
                return(DhcpServerOptionElementByte.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpWordOption:
                return(DhcpServerOptionElementWord.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpDWordOption:
                return(DhcpServerOptionElementDWord.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpDWordDWordOption:
                return(DhcpServerOptionElementDWordDWord.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpIpAddressOption:
                return(DhcpServerOptionElementIpAddress.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpStringDataOption:
                return(DhcpServerOptionElementString.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpBinaryDataOption:
            case DHCP_OPTION_DATA_TYPE.DhcpEncapsulatedDataOption:
                return(DhcpServerOptionElementBinary.ReadNative(element));

            case DHCP_OPTION_DATA_TYPE.DhcpIpv6AddressOption:
                return(DhcpServerOptionElementIpv6Address.ReadNative(element));

            default:
                throw new InvalidCastException($"Unknown Option Data Type: {element.OptionType}");
            }
        }
 internal static DhcpServerOptionElementIpv6Address ReadNative(DHCP_OPTION_DATA_ELEMENT native)
 => new DhcpServerOptionElementIpv6Address(Marshal.PtrToStringUni(native.Ipv6AddressDataOption));
 internal static DhcpServerOptionElementBinary ReadNative(DHCP_OPTION_DATA_ELEMENT native)
 => new DhcpServerOptionElementBinary((DhcpServerOptionElementType)native.OptionType, native.BinaryDataOption.Data);
 internal static DhcpServerOptionElementString ReadNative(DHCP_OPTION_DATA_ELEMENT native)
 => new DhcpServerOptionElementString(Marshal.PtrToStringUni(native.StringDataOption));
 internal static DhcpServerOptionElementIpAddress ReadNative(DHCP_OPTION_DATA_ELEMENT native)
 => new DhcpServerOptionElementIpAddress(native.IpAddressOption);
 internal static DhcpServerOptionElementDWordDWord ReadNative(DHCP_OPTION_DATA_ELEMENT native)
 => new DhcpServerOptionElementDWordDWord(native.DWordDWordOption);
 internal static DhcpServerOptionElementByte ReadNative(DHCP_OPTION_DATA_ELEMENT native)
 => new DhcpServerOptionElementByte(native.ByteOption);
 internal static DhcpServerOptionElementByte ReadNative(DHCP_OPTION_DATA_ELEMENT Native)
 {
     return(new DhcpServerOptionElementByte(Native.ByteOption));
 }
 internal static DhcpServerOptionElementBinary ReadNative(DHCP_OPTION_DATA_ELEMENT Native)
 {
     return(new DhcpServerOptionElementBinary((DhcpServerOptionElementType)Native.OptionType, Native.BinaryDataOption.Data));
 }
Exemplo n.º 10
0
 internal static DhcpServerOptionElementIpAddress ReadNative(DHCP_OPTION_DATA_ELEMENT Native)
 {
     return(new DhcpServerOptionElementIpAddress(Native.IpAddressOption));
 }
Exemplo n.º 11
0
 internal static DhcpServerOptionElementDWordDWord ReadNative(DHCP_OPTION_DATA_ELEMENT Native)
 {
     return(new DhcpServerOptionElementDWordDWord(Native.DWordDWordOption));
 }