Exemple #1
0
        protected void SendEcStartFrame()
        {
            // 发送EC Start Frame.
            var initValue  = this.DefenseStrategy.GetLocalEcValue();
            var ecInterval = this.Context.RsspEP.EcInterval;
            var seqNo      = (ushort)this.Context.SeqNoManager.GetAndUpdateSendSeq();
            var frame      = new SaiEcFrameStart(seqNo, initValue, 1, ecInterval);

            var bytes = frame.GetBytes();

            this.Context.NextLayer.SendUserData(bytes);
        }
        public void Test1()
        {
            var frame1 = new SaiEcFrameStart();

            frame1.SequenceNo   = 200;
            frame1.Version      = 1;
            frame1.InitialValue = 100;
            frame1.Interval     = 1000;

            var bytes = frame1.GetBytes();

            var frame2 = SaiFrame.Parse(bytes) as SaiEcFrameStart;

            Assert.AreEqual(SaiFrameType.EC_Start, frame2.FrameType);
            Assert.AreEqual(frame2.Version, frame1.Version);
            Assert.AreEqual(frame2.SequenceNo, frame1.SequenceNo);
            Assert.AreEqual(frame2.InitialValue, frame1.InitialValue);
            Assert.AreEqual(frame2.Interval, frame1.Interval);
        }