public override byte[] GetBytes()
        {
            var bytes      = new byte[15];
            int startIndex = 0;

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

            // 序列号
            var tempBuf = RsspEncoding.ToNetUInt16(this.SequenceNo);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 2;

            // sender timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.SenderTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // Responsor last timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.ReceiverLastSendTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // sender last timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.SenderLastRecvTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            return(bytes);
        }
示例#2
0
        public override byte[] GetBytes()
        {
            var bytes      = new byte[25];
            int startIndex = 0;

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

            // 序列号
            var tempBuf = RsspEncoding.ToNetUInt16(this.SequenceNo);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 2;

            // Padding
            startIndex += SaiFrame.TtsPaddingLength;

            // 初始值
            tempBuf = RsspEncoding.ToNetUInt32(this.InitialValue);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // 版本
            tempBuf = RsspEncoding.ToNetUInt32(this.Version);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // EC周期
            tempBuf = RsspEncoding.ToNetUInt16(this.Interval);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);

            return(bytes);
        }
示例#3
0
        public override byte[] GetBytes()
        {
            if (this.UserDataLength > SaiFrame.MaxUserDataLength)
            {
                throw new ArgumentException(string.Format("SAI层用户数据长度不能超过{0}。", SaiFrame.MaxUserDataLength));
            }

            var bytes      = new byte[19 + this.UserDataLength];
            int startIndex = 0;

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

            // 序列号
            var tempBuf = RsspEncoding.ToNetUInt16(this.SequenceNo);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 2;

            // Padding
            startIndex += SaiFrame.TtsPaddingLength;

            // EC计数
            tempBuf = RsspEncoding.ToNetUInt32(this.EcValue);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // user data
            if (this.UserData != null)
            {
                Array.Copy(this.UserData, 0, bytes, startIndex, this.UserData.Length);
            }

            return(bytes);
        }
示例#4
0
        public override byte[] GetBytes()
        {
            var bytes      = new byte[this.Length];
            int startIndex = 0;

            // 主叫编号
            var tempBuf = RsspEncoding.ToNetUInt32(this.InitiatorID);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // 被叫编号
            tempBuf = RsspEncoding.ToNetUInt32(this.ResponderID);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

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

            // 用户数据
            if (this.UserData != null)
            {
                Array.Copy(this.UserData, 0, bytes, startIndex, this.UserData.Length);
            }

            return(bytes);
        }
示例#5
0
        public override byte[] GetBytes()
        {
            int index = 0;
            var bytes = new byte[MaslAu2Frame.FrameLength];

            // ETY + MTI + DF
            bytes[index++] = this.GetHeaderByte();

            // 消息发起方ID
            var tempBuf = RsspEncoding.ToNetUInt32(this.ServerID);

            Array.Copy(tempBuf, 1, bytes, index, 3);
            index += 3;

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

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

            // MAC
            Array.Copy(this.MAC, 0, bytes, index, 8);
            index += 8;

            return(bytes);
        }
示例#6
0
        public override byte[] GetBytes()
        {
            var bytes      = new byte[25];
            int startIndex = 0;

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

            // 序列号
            var tempBuf = RsspEncoding.ToNetUInt16(this.SequenceNo);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 2;

            // sender timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.SenderTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // Responsor last timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.ReceiverLastSendTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // sender last timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.SenderLastRecvTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // 偏移标志
            bytes[startIndex++] = (this.OffsetMin >= 0) ? (byte)0 : (byte)1;

            // |最小偏移值|
            tempBuf = RsspEncoding.ToNetUInt32((uint)Math.Abs(this.OffsetMin));
            Array.Copy(tempBuf, 0, bytes, startIndex, 4);
            startIndex += 4;

            // 偏移标志
            bytes[startIndex++] = (this.OffsetMax >= 0) ? (byte)0 : (byte)1;

            // |最大偏移值|
            tempBuf = RsspEncoding.ToNetUInt32((uint)Math.Abs(this.OffsetMax));
            Array.Copy(tempBuf, 0, bytes, startIndex, 4);
            startIndex += 4;

            return(bytes);
        }
示例#7
0
        public override byte[] GetBytes()
        {
            var bytes      = new byte[this.Length];
            int startIndex = 0;

            // 应答方编号
            var tempBuf = RsspEncoding.ToNetUInt32(this.ServerID);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // 用户数据
            if (this.UserData != null)
            {
                Array.Copy(this.UserData, 0, bytes, startIndex, this.UserData.Length);
            }

            return(bytes);
        }
示例#8
0
        public override byte[] GetBytes()
        {
            if (this.UserDataLength > SaiFrame.MaxUserDataLength)
            {
                throw new ArgumentException(string.Format("SAI层用户数据长度不能超过{0}。", SaiFrame.MaxUserDataLength));
            }

            var bytes      = new byte[15 + this.UserDataLength];
            int startIndex = 0;

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

            // 序列号
            var tempBuf = RsspEncoding.ToNetUInt16(this.SequenceNo);

            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 2;

            // sender timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.SenderTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // Responsor last timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.ReceiverLastSendTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // sender last timestamp
            tempBuf = RsspEncoding.ToNetUInt32(this.SenderLastRecvTimestamp);
            Array.Copy(tempBuf, 0, bytes, startIndex, tempBuf.Length);
            startIndex += 4;

            // user data
            if (this.UserData != null)
            {
                Array.Copy(this.UserData, 0, bytes, startIndex, this.UserData.Length);
            }

            return(bytes);
        }