コード例 #1
0
        /// <summary>
        /// Used by tests that aren't testing this stage.
        /// </summary>
        private ScenePresence AddClient()
        {
            UUID       myAgentUuid   = TestHelpers.ParseTail(0x1);
            UUID       mySessionUuid = TestHelpers.ParseTail(0x2);
            uint       myCircuitCode = 123456;
            IPEndPoint testEp        = new IPEndPoint(IPAddress.Loopback, 999);

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code      = myCircuitCode;
            uccpCcBlock.ID        = myAgentUuid;
            uccpCcBlock.SessionID = mySessionUuid;
            uccp.CircuitCode      = uccpCcBlock;

            byte[]          uccpBytes = uccp.ToBytes();
            UDPPacketBuffer upb       = new UDPPacketBuffer(testEp, uccpBytes.Length);

            upb.DataLength = uccpBytes.Length;  // God knows why this isn't set by the constructor.
            Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);

            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID   = myAgentUuid;
            acd.SessionID = mySessionUuid;

            m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd);

            m_udpServer.PacketReceived(upb);

            return(m_scene.GetScenePresence(myAgentUuid));
        }
コード例 #2
0
        public static ScenePresence AddChildClient(
            Scene scene, LLUDPServer udpServer, UUID agentId, UUID sessionId, uint circuitCode)
        {
            IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code      = circuitCode;
            uccpCcBlock.ID        = agentId;
            uccpCcBlock.SessionID = sessionId;
            uccp.CircuitCode      = uccpCcBlock;

            byte[]          uccpBytes = uccp.ToBytes();
            UDPPacketBuffer upb       = new UDPPacketBuffer(testEp, uccpBytes.Length);

            upb.DataLength = uccpBytes.Length;  // God knows why this isn't set by the constructor.
            Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);

            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID   = agentId;
            acd.SessionID = sessionId;

            scene.AuthenticateHandler.AddNewCircuit(circuitCode, acd);

            udpServer.PacketReceived(upb);

            return(scene.GetScenePresence(agentId));
        }
コード例 #3
0
        public void TestAddClient()
        {
            TestHelpers.InMethod();
            //            TestHelpers.EnableLogging();

            AddUdpServer();

            UUID       myAgentUuid   = TestHelpers.ParseTail(0x1);
            UUID       mySessionUuid = TestHelpers.ParseTail(0x2);
            uint       myCircuitCode = 123456;
            IPEndPoint testEp        = new IPEndPoint(IPAddress.Loopback, 999);

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code      = myCircuitCode;
            uccpCcBlock.ID        = myAgentUuid;
            uccpCcBlock.SessionID = mySessionUuid;
            uccp.CircuitCode      = uccpCcBlock;

            byte[]          uccpBytes = uccp.ToBytes();
            UDPPacketBuffer upb       = new UDPPacketBuffer(testEp, uccpBytes.Length);

            upb.DataLength = uccpBytes.Length;  // God knows why this isn't set by the constructor.
            Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);

            m_udpServer.PacketReceived(upb);

            // Presence shouldn't exist since the circuit manager doesn't know about this circuit for authentication yet
            Assert.That(m_scene.GetScenePresence(myAgentUuid), Is.Null);

            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID   = myAgentUuid;
            acd.SessionID = mySessionUuid;

            m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd);

            m_udpServer.PacketReceived(upb);

            // Should succeed now
            ScenePresence sp = m_scene.GetScenePresence(myAgentUuid);

            Assert.That(sp.UUID, Is.EqualTo(myAgentUuid));

            Assert.That(m_udpServer.PacketsSent.Count, Is.EqualTo(1));

            Packet packet = m_udpServer.PacketsSent[0];

            Assert.That(packet, Is.InstanceOf(typeof(PacketAckPacket)));

            PacketAckPacket ackPacket = packet as PacketAckPacket;

            Assert.That(ackPacket.Packets.Length, Is.EqualTo(1));
            Assert.That(ackPacket.Packets[0].ID, Is.EqualTo(0));
        }
コード例 #4
0
        public void TestAddClient()
        {
            TestHelper.InMethod();

            uint myCircuitCode = 123456;
            UUID myAgentUuid   = UUID.Parse("00000000-0000-0000-0000-000000000001");
            UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");

            TestLLUDPServer     testLLUDPServer;
            TestLLPacketServer  testLLPacketServer;
            AgentCircuitManager acm;

            SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);

            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID   = myAgentUuid;
            acd.SessionID = mySessionUuid;

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code      = myCircuitCode;
            uccpCcBlock.ID        = myAgentUuid;
            uccpCcBlock.SessionID = mySessionUuid;
            uccp.CircuitCode      = uccpCcBlock;

            EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);

            testLLUDPServer.LoadReceive(uccp, testEp);
            testLLUDPServer.ReceiveData(null);

            // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet
            Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));

            acm.AddNewCircuit(myCircuitCode, acd);

            testLLUDPServer.LoadReceive(uccp, testEp);
            testLLUDPServer.ReceiveData(null);

            // Should succeed now
            Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
            Assert.IsFalse(testLLUDPServer.HasCircuit(101));
        }
コード例 #5
0
        /// <summary>
        /// Set up a client for tests which aren't concerned with this process itself
        /// </summary>
        /// <param name="circuitCode"></param>
        /// <param name="epSender"></param>
        /// <param name="agentId"></param>
        /// <param name="sessionId"></param>
        /// <param name="testLLUDPServer"></param>
        /// <param name="acm"></param>
        protected void AddClient(
            uint circuitCode, EndPoint epSender, UUID agentId, UUID sessionId,
            TestLLUDPServer testLLUDPServer, AgentCircuitManager acm)
        {
            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID   = agentId;
            acd.SessionID = sessionId;

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code      = circuitCode;
            uccpCcBlock.ID        = agentId;
            uccpCcBlock.SessionID = sessionId;
            uccp.CircuitCode      = uccpCcBlock;

            acm.AddNewCircuit(circuitCode, acd);

            testLLUDPServer.LoadReceive(uccp, epSender);
            testLLUDPServer.ReceiveData(null);
        }
コード例 #6
0
ファイル: BasicCircuitTests.cs プロジェクト: CCIR/opensim
        public void TestAddClient()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            AddUdpServer();

            UUID myAgentUuid   = TestHelpers.ParseTail(0x1);
            UUID mySessionUuid = TestHelpers.ParseTail(0x2);
            uint myCircuitCode = 123456;
            IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code = myCircuitCode;
            uccpCcBlock.ID = myAgentUuid;
            uccpCcBlock.SessionID = mySessionUuid;
            uccp.CircuitCode = uccpCcBlock;

            byte[] uccpBytes = uccp.ToBytes();
            UDPPacketBuffer upb = new UDPPacketBuffer(testEp, uccpBytes.Length);
            upb.DataLength = uccpBytes.Length;  // God knows why this isn't set by the constructor.
            Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);

            m_udpServer.PacketReceived(upb);

            // Presence shouldn't exist since the circuit manager doesn't know about this circuit for authentication yet
            Assert.That(m_scene.GetScenePresence(myAgentUuid), Is.Null);

            AgentCircuitData acd = new AgentCircuitData();
            acd.AgentID = myAgentUuid;
            acd.SessionID = mySessionUuid;

            m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd);

            m_udpServer.PacketReceived(upb);

            // Should succeed now
            ScenePresence sp = m_scene.GetScenePresence(myAgentUuid);
            Assert.That(sp.UUID, Is.EqualTo(myAgentUuid));

            Assert.That(m_udpServer.PacketsSent.Count, Is.EqualTo(1));

            Packet packet = m_udpServer.PacketsSent[0];
            Assert.That(packet, Is.InstanceOf(typeof(PacketAckPacket)));

            PacketAckPacket ackPacket = packet as PacketAckPacket;
            Assert.That(ackPacket.Packets.Length, Is.EqualTo(1));
            Assert.That(ackPacket.Packets[0].ID, Is.EqualTo(0));
        }
コード例 #7
0
ファイル: BasicCircuitTests.cs プロジェクト: CCIR/opensim
        /// <summary>
        /// Used by tests that aren't testing this stage.
        /// </summary>
        private ScenePresence AddClient()
        {
            UUID myAgentUuid   = TestHelpers.ParseTail(0x1);
            UUID mySessionUuid = TestHelpers.ParseTail(0x2);
            uint myCircuitCode = 123456;
            IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);

            UseCircuitCodePacket uccp = new UseCircuitCodePacket();

            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code = myCircuitCode;
            uccpCcBlock.ID = myAgentUuid;
            uccpCcBlock.SessionID = mySessionUuid;
            uccp.CircuitCode = uccpCcBlock;

            byte[] uccpBytes = uccp.ToBytes();
            UDPPacketBuffer upb = new UDPPacketBuffer(testEp, uccpBytes.Length);
            upb.DataLength = uccpBytes.Length;  // God knows why this isn't set by the constructor.
            Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);

            AgentCircuitData acd = new AgentCircuitData();
            acd.AgentID = myAgentUuid;
            acd.SessionID = mySessionUuid;

            m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd);

            m_udpServer.PacketReceived(upb);

            return m_scene.GetScenePresence(myAgentUuid);
        }
コード例 #8
0
ファイル: BasicCircuitTests.cs プロジェクト: ChrisD/opensim
        public void TestAddClient()
        {            
            TestHelper.InMethod();

            uint myCircuitCode = 123456;
            UUID myAgentUuid   = UUID.Parse("00000000-0000-0000-0000-000000000001");
            UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
            
            TestLLUDPServer testLLUDPServer;
            TestLLPacketServer testLLPacketServer;
            AgentCircuitManager acm;
            SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
            
            AgentCircuitData acd = new AgentCircuitData();
            acd.AgentID = myAgentUuid;
            acd.SessionID = mySessionUuid;
            
            UseCircuitCodePacket uccp = new UseCircuitCodePacket();
            
            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock 
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code = myCircuitCode;
            uccpCcBlock.ID = myAgentUuid;
            uccpCcBlock.SessionID = mySessionUuid;
            uccp.CircuitCode = uccpCcBlock;
            
            EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
            
            testLLUDPServer.LoadReceive(uccp, testEp);            
            testLLUDPServer.ReceiveData(null);
            
            // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet
            Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
                        
            acm.AddNewCircuit(myCircuitCode, acd);
            
            testLLUDPServer.LoadReceive(uccp, testEp);            
            testLLUDPServer.ReceiveData(null);            
            
            // Should succeed now
            Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
            Assert.IsFalse(testLLUDPServer.HasCircuit(101));
        }
コード例 #9
0
ファイル: BasicCircuitTests.cs プロジェクト: ChrisD/opensim
        /// <summary>
        /// Set up a client for tests which aren't concerned with this process itself
        /// </summary>
        /// <param name="circuitCode"></param>
        /// <param name="epSender"></param>
        /// <param name="agentId"></param>
        /// <param name="sessionId"></param>
        /// <param name="testLLUDPServer"></param>
        /// <param name="acm"></param>
        protected void AddClient(
            uint circuitCode, EndPoint epSender, UUID agentId, UUID sessionId, 
            TestLLUDPServer testLLUDPServer, AgentCircuitManager acm)
        {
            AgentCircuitData acd = new AgentCircuitData();
            acd.AgentID = agentId;
            acd.SessionID = sessionId; 
            
            UseCircuitCodePacket uccp = new UseCircuitCodePacket();
            
            UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock 
                = new UseCircuitCodePacket.CircuitCodeBlock();
            uccpCcBlock.Code = circuitCode;
            uccpCcBlock.ID = agentId;
            uccpCcBlock.SessionID = sessionId;
            uccp.CircuitCode = uccpCcBlock;

            acm.AddNewCircuit(circuitCode, acd);
            
            testLLUDPServer.LoadReceive(uccp, epSender);            
            testLLUDPServer.ReceiveData(null);
        }