示例#1
0
        public override void HandleConnectionRequestFrame(AleTunnel theConnection, Frames.AleFrame theFrame)
        {
            var crData = theFrame.UserData as AleConnectionRequest;

            // 停止超时检测计时器。
            theConnection.StopHandshakeTimer();

            // 检查CR协议帧。
            this.CheckCrFrame(crData, theConnection);

            // 检查AU1的正确性。
            this.Context.AuMsgBuilder.CheckAu1Packet(crData.UserData);

            // 发送CC帧。
            this.SendConnectionConfirmFrame(theConnection);

            if (!this.Context.ContainsTunnel(theConnection))
            {
                // 事件通知:接收到一个新的TCP连接。
                var args = new TcpConnectedEventArgs(theConnection.ID,
                                                     this.Context.RsspEP.LocalID, theConnection.LocalEndPoint,
                                                     this.Context.RsspEP.RemoteID, theConnection.RemoteEndPoint);
                this.Context.TunnelEventNotifier.NotifyTcpConnected(args);

                // 增加有效的连接个数。
                theConnection.IsHandShaken = true;
                this.Context.IncreaseValidConnection();

                // 保存TCP连接
                this.Context.AddConnection(theConnection);
            }
        }
示例#2
0
        public override void HandleConnectionConfirmFrame(AleTunnel theConnection, Frames.AleFrame theFrame)
        {
            // 停止超时检测计时器。
            theConnection.StopHandshakeTimer();

            // 检查CC帧。
            var ccData = theFrame.UserData as AleConnectionConfirm;

            this.CheckCcFrame(ccData);

            // 如果CC帧中的应答方编号校验通过,则增加一个有效的连接。
            theConnection.IsHandShaken = true;
            this.Context.IncreaseValidConnection();
        }
示例#3
0
        public override void HandleDataTransmissionFrame(AleTunnel theConnection, Frames.AleFrame theFrame)
        {
            var aleData = theFrame.UserData as AleDataTransmission;

            this.Context.Observer.OnAleUserDataArrival(aleData.UserData);
        }