Example #1
0
 internal void Start(GatewayStub stub)
 {
     if (m_stubs.Contains(stub) == false)
     {
         m_stubs.Add(stub);
     }
 }
Example #2
0
        internal void Stop(GatewayStub stub)
        {
            m_stubs.Remove(stub);

            DeregisterEndpoints(stub);

            if (m_stubs.Count == 0)
            {
                ((_WP.IController) this).Stop();
            }
        }
        /// <include file='doc\ConnectionManager.uex' path='docs/doc[@for="Manager.Connect"]/*' />
        public _DBG.Engine Connect(_DBG.PortDefinition pd)
        {
            _DBG.Engine eng = new _DBG.Engine();

            GatewayProxy gwp = new GatewayProxy();
            GatewayStub  gws = m_mgr.Connect(pd, gwp);

            gwp.SetOwner(eng);

            eng.SetController(gwp);

            return(eng);
        }
Example #4
0
        internal void DeregisterEndpoint(uint epType, uint epId, GatewayStub stub)
        {
            ulong epKey = EndpointKeyFromTypeId(epType, epId);

            GatewayStub gws = (GatewayStub)m_endpoints[epKey];

            if (gws != stub)
            {
                throw new ArgumentException("Endpoint is not registered");
            }

            m_endpoints.Remove(epKey);
        }
Example #5
0
        private void DeregisterEndpoints(GatewayStub stub)
        {
            lock (m_endpoints.SyncRoot)
            {
                Hashtable htClone = (Hashtable)m_endpoints.Clone();

                foreach (DictionaryEntry de in htClone)
                {
                    if (de.Value == stub)
                    {
                        m_endpoints.Remove(de.Key);
                    }
                }
            }
        }
Example #6
0
        //--//

        private GatewayStub FindGatewayStubForReply(_WP.IncomingMessage msg)
        {
            ArrayList stubs = CreateCopyOfStubs();

            for (int iStub = stubs.Count - 1; iStub >= 0; iStub--)
            {
                GatewayStub stub = (GatewayStub)stubs[iStub];

                if (stub.CanProcessMessageReply(msg))
                {
                    return(stub);
                }
            }

            return(null);
        }
Example #7
0
        //--//

        internal bool RegisterEndpoint(uint epType, uint epId, GatewayStub stub)
        {
            ulong epKey = EndpointKeyFromTypeId(epType, epId);

            lock (m_endpoints.SyncRoot)
            {
                if (m_endpoints.ContainsKey(epKey))
                {
                    return(false);
                }

                m_endpoints[epKey] = stub;
            }

            return(true);
        }
Example #8
0
        private GatewayStub FindGatewayStubForRpc(_WP.IncomingMessage msg)
        {
            object payload = msg.Payload;
            uint   epType  = 0;
            uint   epId    = 0;

            _WP.Commands.Debugging_Messaging_Address addr = null;

            switch (msg.Header.m_cmd)
            {
            case _WP.Commands.c_Debugging_Messaging_Query:
                addr = ((_WP.Commands.Debugging_Messaging_Query)payload).m_addr;

                epType = addr.m_to_Type;
                epId   = addr.m_to_Id;
                break;

            case _WP.Commands.c_Debugging_Messaging_Reply:
                addr = ((_WP.Commands.Debugging_Messaging_Reply)payload).m_addr;

                epType = addr.m_from_Type;
                epId   = addr.m_from_Id;
                break;

            case _WP.Commands.c_Debugging_Messaging_Send:
                addr = ((_WP.Commands.Debugging_Messaging_Send)payload).m_addr;

                epType = addr.m_to_Type;
                epId   = addr.m_to_Id;
                break;

            default:
                return(null);
            }

            ulong epKey = EndpointKeyFromTypeId(epType, epId);

            GatewayStub stub = (GatewayStub)m_endpoints[epKey];

            return(stub);
        }
Example #9
0
        //--//

        public void SetParent( GatewayStub parent )
        {
            m_parent = parent;                    
                        
            RegisterRemoteObject( m_parent );
        }
Example #10
0
        private void DeregisterEndpoints( GatewayStub stub )
        {
            lock(m_endpoints.SyncRoot)
            {
                Hashtable htClone = (Hashtable)m_endpoints.Clone();

                foreach(DictionaryEntry de in htClone)
                {
                    if(de.Value == stub)
                    {
                        m_endpoints.Remove( de.Key );
                    }
                }
            }
        }
Example #11
0
        internal void Stop( GatewayStub stub )
        {
            m_stubs.Remove( stub );

            DeregisterEndpoints( stub );

            if(m_stubs.Count == 0)
            {
                ((_WP.IController)this).Stop();
            }
        }
Example #12
0
 internal void Start( GatewayStub stub )
 {
     if(m_stubs.Contains( stub ) == false)
     {
         m_stubs.Add( stub );
     }
 }
Example #13
0
        internal void DeregisterEndpoint( uint epType, uint epId, GatewayStub stub )
        {
            ulong epKey = EndpointKeyFromTypeId( epType, epId );

            GatewayStub gws = (GatewayStub)m_endpoints[epKey];

            if(gws != stub)
            {
                throw new ArgumentException( "Endpoint is not registered" );
            }

            m_endpoints.Remove( epKey );
        }
Example #14
0
        //--//

        internal bool RegisterEndpoint( uint epType, uint epId, GatewayStub stub )
        {
            ulong epKey = EndpointKeyFromTypeId( epType, epId );

            lock(m_endpoints.SyncRoot)
            {
                if(m_endpoints.ContainsKey( epKey ))
                {
                    return false;
                }

                m_endpoints[epKey] = stub;
            }

            return true;
        }
Example #15
0
        //--//

        public void SetParent(GatewayStub parent)
        {
            m_parent = parent;

            RegisterRemoteObject(m_parent);
        }
Example #16
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);
        }