Ejemplo n.º 1
0
        } // ChannelInput (String)

        public void CloseProtocol()
        {
            objB2Protocol = null;
            Globals.queStateDisplay.Enqueue("");
            Globals.queProgressDisplay.Enqueue(0);
            Globals.strConnectedGridSquare = ""; // and clear the connected Grid square
        } // CloseProtocol
Ejemplo n.º 2
0
        } // LinkState

        private void ProtocolStateChange(EProtocolStates enmNewState)
        {
            // This function is called to change the state of the protocol...

            Globals.queStatusDisplay.Enqueue(enmNewState.ToString());
            if (ProtocolState != enmNewState)
            {
                ProtocolState = enmNewState;
                var switchExpr = ProtocolState;
                switch (switchExpr)
                {
                case EProtocolStates.Disconnected:
                {
                    if (objB2Protocol != null)
                    {
                        objB2Protocol.Close();
                        objB2Protocol = null;
                    }

                    break;
                }

                case EProtocolStates.Connected:
                {
                    if (objB2Protocol != null)
                    {
                        objB2Protocol = null;
                    }
                    GetPendingOutboundMessages();
                    break;
                }
                }
            }
        } // NewState
Ejemplo n.º 3
0
        } // GetPendingOutboundMessages

        private void ProtocolCommands(string strText, bool blnCrLf)
        {
            // Interprets the protocol commands as they are received...

            Globals.queChannelDisplay.Enqueue("X" + strText);
            string strCommand = strText.ToUpper();

            if (strCommand.StartsWith(";PM:"))
            {
                // Ignore preview-message commands
                return;
            }

            var switchExpr = ProtocolState;

            switch (switchExpr)
            {
            case EProtocolStates.Connected:
            {
                if (string.IsNullOrEmpty(Globals.strConnectedGridSquare))         // test for one
                {
                    IsGridSquare(strCommand);
                }

                if (strCommand.StartsWith("[") & strText.EndsWith("]"))
                {
                    ParseInboundSID(strText);
                }
                else if (strText.EndsWith(">"))
                {
                    ProtocolStateChange(EProtocolStates.Accepted);
                    SendFWFeature();
                    Send(strSID);
                    if (blnSecureLogin)
                    {
                        uint intResult;
                        // This is compatible with WL2K secure login and generates the same ;PR: reply as AirMail
                        intResult      = WinlinkAuth.ChallengedPassword(strChallengePhrase, Globals.SecureLoginPassword);
                        strSecureReply = ";PR: " + intResult.ToString("0000000000").Substring(2, 8);
                        Send(strSecureReply);
                    }

                    if (blnIFlag)
                    {
                        Send("; " + stcChannel.RemoteCallsign + " DE " + Globals.SiteCallsign + " (" + Globals.SiteGridSquare + ") QTC " + aryOutboundMessages.Count.ToString() + "...");
                    }
                    objB2Protocol = new ProtocolB2(this, ref stcChannel, ref aryOutboundMessages);
                }
                else if (strCommand.StartsWith(";PQ: "))         // Check for secure login challenge phrase
                {
                    strChallengePhrase = strCommand.Substring(4).Trim();
                    uint temp = 0;
                    if (!UInt32.TryParse(strChallengePhrase, out temp))
                    {
                        Globals.queChannelDisplay.Enqueue("R*** Non numeric challange phrase - ending connection");
                        Disconnect();
                    }
                    else
                    {
                        blnSecureLogin = true;
                    }
                }

                break;
            }

            case EProtocolStates.Accepted:
            {
                objB2Protocol.ChannelInput(strText);
                break;
            }
            }
        } // ProtocolCommands