示例#1
0
        public override void ParseBytes(byte[] bytes)
        {
            int startIndex = 0;

            // 消息类型
            this.FrameType = (SaiFrameType)bytes[startIndex++];

            // 序列号
            this.SequenceNo = RsspEncoding.ToHostUInt16(bytes, startIndex);
            startIndex     += 2;

            // Padding
            startIndex += SaiFrame.TtsPaddingLength;

            // 初始值
            this.InitialValue = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex       += 4;

            // 版本
            this.Version = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex  += 4;

            // EC周期
            this.Interval = RsspEncoding.ToHostUInt16(bytes, startIndex);
        }
示例#2
0
        public override void ParseBytes(byte[] bytes)
        {
            int startIndex = 0;

            // 消息类型
            this.FrameType = (SaiFrameType)bytes[startIndex++];

            // 序列号
            this.SequenceNo = RsspEncoding.ToHostUInt16(bytes, startIndex);
            startIndex     += 2;

            // sender timestamp
            this.SenderTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex          += 4;

            // Responsor last timestamp
            this.ReceiverLastSendTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex += 4;

            // sender last timestamp
            this.SenderLastRecvTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex += 4;

            // user data
            var len = bytes.Length - startIndex;

            if (len > 0)
            {
                this.UserData = new byte[len];
                Array.Copy(bytes, startIndex, this.UserData, 0, len);
            }
        }
示例#3
0
        public override void ParseBytes(byte[] bytes)
        {
            int startIndex = 0;

            // 消息类型
            this.FrameType = (SaiFrameType)bytes[startIndex++];

            // 序列号
            this.SequenceNo = RsspEncoding.ToHostUInt16(bytes, startIndex);
            startIndex     += 2;

            // Padding
            startIndex += SaiFrame.TtsPaddingLength;

            // EC计数
            this.EcValue = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex  += 4;

            // user data
            var len = bytes.Length - startIndex;

            if (len > 0)
            {
                this.UserData = new byte[len];
                Array.Copy(bytes, startIndex, this.UserData, 0, len);
            }
        }
示例#4
0
        public override void ParseBytes(byte[] bytes)
        {
            int startIndex = 0;

            // 消息类型
            this.FrameType = (SaiFrameType)bytes[startIndex++];

            // 序列号
            this.SequenceNo = RsspEncoding.ToHostUInt16(bytes, startIndex);
            startIndex     += 2;

            // sender timestamp
            this.SenderTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex          += 4;

            // Responsor last timestamp
            this.ReceiverLastSendTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex += 4;

            // sender last timestamp
            this.SenderLastRecvTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex += 4;

            // valid
            this.Valid = (bytes[startIndex++] == 1);
        }
示例#5
0
        public override void ParseBytes(byte[] bytes, int startIndex, int endIndex)
        {
            if ((endIndex - startIndex + 1) < MaslAu2Frame.FrameLength)
            {
                throw new Au2LengthException();
            }

            var orgStartIndex = startIndex;

            // ETY + MTI + DF
            this.ParseHeaderByte(bytes[startIndex++]);

            // 消息发起方ID
            this.ServerID = (RsspEncoding.ToHostUInt32(bytes, orgStartIndex) & 0xFFFFFF);
            startIndex   += 3;

            // 安全特征
            this.EncryAlgorithm = (EncryptionAlgorithm)bytes[startIndex++];

            // 随机数
            Array.Copy(bytes, startIndex, this.RandomA, 0, 8);
            startIndex += 8;

            // MAC
            Array.Copy(bytes, startIndex, this.MAC, 0, 8);
            startIndex += 8;
        }
示例#6
0
        public override void ParseBytes(byte[] bytes, int startIndex, int endIndex)
        {
            // 应答方编号
            this.ServerID = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex   += 4;

            // 用户数据
            var len = endIndex - startIndex + 1;

            if (len > 0)
            {
                this.UserData = new byte[len];
                Array.Copy(bytes, startIndex, this.UserData, 0, len);
            }
        }
示例#7
0
        public override void ParseBytes(byte[] bytes)
        {
            int startIndex = 0;

            // 消息类型
            this.FrameType = (SaiFrameType)bytes[startIndex++];

            // 序列号
            this.SequenceNo = RsspEncoding.ToHostUInt16(bytes, startIndex);
            startIndex     += 2;

            // sender timestamp
            this.SenderTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex          += 4;

            // Responsor last timestamp
            this.ReceiverLastSendTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex += 4;

            // sender last timestamp
            this.SenderLastRecvTimestamp = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex += 4;

            // 偏移标志
            bool negative = (bytes[startIndex] == 1);

            startIndex++;

            // |最小偏移值|
            this.OffsetMin = RsspEncoding.ToHostUInt32(bytes, startIndex);
            if (negative)
            {
                this.OffsetMin = -this.OffsetMin;
            }
            startIndex += 4;

            // 偏移标志
            negative = (bytes[startIndex] == 1);
            startIndex++;

            // |最大偏移值|
            this.OffsetMax = RsspEncoding.ToHostUInt32(bytes, startIndex);
            if (negative)
            {
                this.OffsetMax = -this.OffsetMax;
            }
            startIndex += 4;
        }
示例#8
0
        public override void ParseBytes(byte[] bytes, int startIndex, int endIndex)
        {
            // 主叫编号
            this.InitiatorID = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex      += 4;

            // 被叫编号
            this.ResponderID = RsspEncoding.ToHostUInt32(bytes, startIndex);
            startIndex      += 4;

            // 服务类型
            this.ServiceType = (ServiceType)bytes[startIndex++];

            // 用户数据
            var len = endIndex - startIndex + 1;

            if (len > 0)
            {
                this.UserData = new byte[len];
                Array.Copy(bytes, startIndex, this.UserData, 0, len);
            }
        }