예제 #1
0
        public unsafe static byte[] GetBufferForProtocolId(ProtocolIds supportedProtocols)
        {
            short listLength = 0;

            for (int i = 0; i < _numberOfProtocols.Length; i++)
            {
                if (((int)_numberOfProtocols.GetValue(i) & (int)supportedProtocols) > 0)
                {
                    listLength += (short)(_allProtocols[i].Length + 1);
                }
            }
            //Now we know the total length of the list lets create our array

            byte[] returnValue = new byte[listLength + _HeaderLength];
            var    spa         = new Span <byte>(returnValue);
            int    length      = _HeaderLength + listLength - _ContentOffset;

            spa.Write(length);
            spa = spa.Slice(4);
            spa.Write(ApplicaitonProtocolNegotiationExtension.ALPN);
            spa = spa.Slice(4);
            spa.Write(listLength);
            spa = spa.Slice(2);

            for (int i = 0; i < _numberOfProtocols.Length; i++)
            {
                if (((int)_numberOfProtocols.GetValue(i) & (int)supportedProtocols) > 0)
                {
                    var value = _allProtocols[i];
                    spa.Write((byte)value.Length);
                    spa = spa.Slice(1);
                    spa.Set(value);
                    spa = spa.Slice(value.Length);
                }
            }
            return(returnValue);
        }
예제 #2
0
 public AcnPacket(ProtocolIds protocolId)
     : this((int)protocolId)
 {
 }
예제 #3
0
 public StreamingAcnPacket(ProtocolIds protocolId)
     : base(protocolId)
 {
 }