Пример #1
0
        /// <summary>
        /// Generate a packet with SMUX header
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <returns>Encapsulated SNI packet</returns>
        private SNIPacket GetSMUXEncapsulatedPacket(SNIPacket packet)
        {
            uint        xSequenceNumber = _sequenceNumber;
            Span <byte> header          = stackalloc byte[SNISMUXHeader.HEADER_LENGTH];

            GetSMUXHeaderBytes(packet.Length, SNISMUXFlags.SMUX_DATA, header);

            SNIPacket smuxPacket = new SNIPacket(SNISMUXHeader.HEADER_LENGTH + packet.Length);

            smuxPacket.AppendData(header);
            smuxPacket.AppendPacket(packet);
            packet.Dispose();

            return(smuxPacket);
        }