/// <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)); }
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)); }
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)); }
/// <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); }