Esempio n. 1
0
        bool _WP.IController.QueueOutput(_WP.MessageRaw raw)
        {
            _WP.Packet pkt = new _WP.Packet();

            new _WP.Converter(this.ParentIController.Capabilities).Deserialize(pkt, raw.m_header);

            if (m_requests.Count > c_ForcedPurgeLimit)
            {
                Purge(c_ForcedPurgeThreshold);
            }

            m_requests[pkt.m_seq] = DateTime.Now;

            return(this.ParentIController.QueueOutput(raw));
        }
Esempio n. 2
0
        bool _WP.IController.QueueOutput( _WP.MessageRaw raw )
        {
            _WP.Packet pkt = new _WP.Packet();
            
            new _WP.Converter( this.ParentIController.Capabilities ).Deserialize( pkt, raw.m_header );

            if(m_requests.Count > c_ForcedPurgeLimit) Purge( c_ForcedPurgeThreshold );

            m_requests[pkt.m_seq] = DateTime.Now;

            return this.ParentIController.QueueOutput( raw );
        }
Esempio n. 3
0
        internal void SetSignature( Packet bp, string sig )
        {
            byte[] buf = Encoding.UTF8.GetBytes( sig );

            Array.Copy( buf, 0, bp.m_signature, 0, buf.Length );
        }
Esempio n. 4
0
        Packet IController.NewPacket()
        {
            if(!m_state.IsRunning) throw new ArgumentException( "Controller not started, cannot create message" );

            Packet bp = new Packet();

            SetSignature( bp, m_marker );

            bp.m_seq = (ushort)Interlocked.Increment( ref m_lastOutboundMessage );

            return bp;
        }
Esempio n. 5
0
        private ArrayList FindGatewayStubsForMessage(_WP.IncomingMessage msg, bool fReply)
        {
            ArrayList   stubs      = null;
            GatewayStub stub       = null;
            bool        fMulticast = false;

            msg.Payload = _WP.Commands.ResolveCommandToPayload(msg.Header.m_cmd, fReply, ((_WP.IController) this).Capabilities);

            _WP.Packet bp = msg.Header;

            if (fReply)
            {
                stub = FindGatewayStubForReply(msg);
            }
            else
            {
                switch (bp.m_cmd)
                {
                case _WP.Commands.c_Monitor_Ping:
                    if ((msg.Header.m_flags & _WP.Flags.c_NonCritical) == 0)
                    {
                        _WP.Commands.Monitor_Ping.Reply cmdReply = new _WP.Commands.Monitor_Ping.Reply();
                        cmdReply.m_source    = _WP.Commands.Monitor_Ping.c_Ping_Source_Host;
                        cmdReply.m_dbg_flags = (m_stopDebuggerOnBoot? _WP.Commands.Monitor_Ping.c_Ping_DbgFlag_Stop: 0);

                        msg.Reply(null, _WP.Flags.c_NonCritical, cmdReply);
                    }
                    break;

                case _WP.Commands.c_Monitor_Message:
                case _WP.Commands.c_Monitor_ProgramExit:
                case _WP.Commands.c_Debugging_Button_Report:
                case _WP.Commands.c_Debugging_Execution_BreakpointHit:
                case _WP.Commands.c_Debugging_Lcd_NewFrame:
                case _WP.Commands.c_Debugging_Lcd_NewFrameData:
                    fMulticast = true;
                    break;

                case _WP.Commands.c_Debugging_Messaging_Query:
                case _WP.Commands.c_Debugging_Messaging_Reply:
                case _WP.Commands.c_Debugging_Messaging_Send:
                    stub = FindGatewayStubForRpc(msg);
                    break;
                }
            }

            if (fMulticast)
            {
                stubs = CreateCopyOfStubs();
            }
            else
            {
                stubs = new ArrayList();

                if (stub != null)
                {
                    stubs.Add(stub);
                }
            }

            return(stubs);
        }