Пример #1
0
 public static DHCPv6Packet ConstructPacket(DHCPv6Packet receivedPacket, DHCPv6Packet innerResponse)
 {
     if (receivedPacket.PacketType == DHCPv6PacketTypes.RELAY_FORW)
     {
         return(DHCPv6RelayPacket.ConstructRelayPacket((DHCPv6RelayPacket)receivedPacket, innerResponse));
     }
     else
     {
         return(innerResponse);
     }
 }
Пример #2
0
        protected static DHCPv6Packet FromByteArray(Byte[] rawData)
        {
            DHCPv6PacketTypes type = (DHCPv6PacketTypes)rawData[0];

            DHCPv6Packet result;

            if (type == DHCPv6PacketTypes.RELAY_REPL || type == DHCPv6PacketTypes.RELAY_FORW)
            {
                result = DHCPv6RelayPacket.FromByteArray(rawData, 0);
            }
            else
            {
                UInt32 transactionId = (UInt32)((rawData[1] << 16) | (rawData[2] << 8) | rawData[3]);

                result = new DHCPv6Packet(
                    type, transactionId,
                    DHCPv6PacketOptionFactory.GetOptions(rawData, 4));
            }

            return(result);
        }