예제 #1
0
        public Packet Unpack(byte[] data)
        {
            Packet result = null;

            PacketType type = GetPacketType(data);

            switch (type)
            {
            case PacketType.InitialPacket: result = new InitialPacket(); break;

            case PacketType.ShortHeaderPacket: result = new ShortHeaderPacket(); break;
            }

            if (result == null)
            {
                return(null);
            }

            result.Decode(data);

            return(result);
        }
예제 #2
0
        public Packet Unpack(byte[] data)
        {
            Packet result = null;

            QuicPacketType type = GetPacketType(data);

            switch (type)
            {
            case QuicPacketType.Initial: result = new InitialPacket(); break;

            // TODO: ShortHeaderPacket Destination Connection Id Lenght is known by the server
            // Should be passed by the QuicConnection to the PacketWireTransfer -> Unpacker
            case QuicPacketType.ShortHeader: result = new ShortHeaderPacket(1); break;
            }

            if (result == null)
            {
                return(null);
            }

            result.Decode(data);

            return(result);
        }