2008-08-16 02:04:20 +00:00
|
|
|
using System;
|
2008-10-05 22:05:18 +00:00
|
|
|
using ExtensionLoader;
|
2008-08-16 02:04:20 +00:00
|
|
|
using OpenMetaverse;
|
|
|
|
|
using OpenMetaverse.Packets;
|
|
|
|
|
|
2008-08-21 05:14:16 +00:00
|
|
|
namespace Simian.Extensions
|
2008-08-16 02:04:20 +00:00
|
|
|
{
|
2008-10-29 20:11:28 +00:00
|
|
|
public class ConnectionManagement : IExtension<Simian>
|
2008-08-16 02:04:20 +00:00
|
|
|
{
|
2008-08-18 04:40:05 +00:00
|
|
|
Simian server;
|
2008-08-16 23:38:10 +00:00
|
|
|
|
2008-10-29 20:11:28 +00:00
|
|
|
public ConnectionManagement()
|
2008-08-16 23:38:10 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-29 20:11:28 +00:00
|
|
|
public void Start(Simian server)
|
2008-08-16 23:38:10 +00:00
|
|
|
{
|
2008-10-29 20:11:28 +00:00
|
|
|
this.server = server;
|
|
|
|
|
|
2008-08-28 22:11:47 +00:00
|
|
|
server.UDP.RegisterPacketCallback(PacketType.UseCircuitCode, new PacketCallback(UseCircuitCodeHandler));
|
|
|
|
|
server.UDP.RegisterPacketCallback(PacketType.StartPingCheck, new PacketCallback(StartPingCheckHandler));
|
|
|
|
|
server.UDP.RegisterPacketCallback(PacketType.LogoutRequest, new PacketCallback(LogoutRequestHandler));
|
2008-08-16 23:38:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-16 02:04:20 +00:00
|
|
|
void UseCircuitCodeHandler(Packet packet, Agent agent)
|
|
|
|
|
{
|
|
|
|
|
RegionHandshakePacket handshake = new RegionHandshakePacket();
|
|
|
|
|
handshake.RegionInfo.BillableFactor = 0f;
|
|
|
|
|
handshake.RegionInfo.CacheID = UUID.Random();
|
|
|
|
|
handshake.RegionInfo.IsEstateManager = false;
|
2008-09-22 15:11:39 +00:00
|
|
|
handshake.RegionInfo.RegionFlags = (uint)(RegionFlags.AllowDirectTeleport | RegionFlags.AllowLandmark |
|
|
|
|
|
RegionFlags.AllowParcelChanges | RegionFlags.AllowSetHome | RegionFlags.AllowVoice | RegionFlags.PublicAllowed |
|
|
|
|
|
RegionFlags.Sandbox | RegionFlags.TaxFree);
|
2008-08-16 02:04:20 +00:00
|
|
|
handshake.RegionInfo.SimOwner = UUID.Random();
|
2008-09-22 15:11:39 +00:00
|
|
|
handshake.RegionInfo.SimAccess = (byte)SimAccess.Min;
|
2008-08-16 02:04:20 +00:00
|
|
|
handshake.RegionInfo.SimName = Utils.StringToBytes("Simian");
|
2008-09-22 16:33:42 +00:00
|
|
|
handshake.RegionInfo.WaterHeight = server.Scene.WaterHeight;
|
2008-08-16 02:04:20 +00:00
|
|
|
handshake.RegionInfo.TerrainBase0 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainBase1 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainBase2 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainBase3 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainDetail0 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainDetail1 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainDetail2 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainDetail3 = UUID.Zero;
|
|
|
|
|
handshake.RegionInfo.TerrainHeightRange00 = 0f;
|
|
|
|
|
handshake.RegionInfo.TerrainHeightRange01 = 20f;
|
|
|
|
|
handshake.RegionInfo.TerrainHeightRange10 = 0f;
|
|
|
|
|
handshake.RegionInfo.TerrainHeightRange11 = 20f;
|
|
|
|
|
handshake.RegionInfo.TerrainStartHeight00 = 0f;
|
|
|
|
|
handshake.RegionInfo.TerrainStartHeight01 = 40f;
|
|
|
|
|
handshake.RegionInfo.TerrainStartHeight10 = 0f;
|
|
|
|
|
handshake.RegionInfo.TerrainStartHeight11 = 40f;
|
|
|
|
|
handshake.RegionInfo2.RegionID = UUID.Random();
|
|
|
|
|
|
2008-08-28 22:11:47 +00:00
|
|
|
server.UDP.SendPacket(agent.AgentID, handshake, PacketCategory.Transaction);
|
2008-08-16 02:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartPingCheckHandler(Packet packet, Agent agent)
|
|
|
|
|
{
|
|
|
|
|
StartPingCheckPacket start = (StartPingCheckPacket)packet;
|
|
|
|
|
|
|
|
|
|
CompletePingCheckPacket complete = new CompletePingCheckPacket();
|
|
|
|
|
complete.Header.Reliable = false;
|
|
|
|
|
complete.PingID.PingID = start.PingID.PingID;
|
|
|
|
|
|
2008-08-28 22:11:47 +00:00
|
|
|
server.UDP.SendPacket(agent.AgentID, complete, PacketCategory.Overhead);
|
2008-08-16 02:04:20 +00:00
|
|
|
}
|
2008-08-18 07:17:45 +00:00
|
|
|
|
|
|
|
|
void LogoutRequestHandler(Packet packet, Agent agent)
|
|
|
|
|
{
|
|
|
|
|
LogoutRequestPacket request = (LogoutRequestPacket)packet;
|
|
|
|
|
|
2008-09-28 21:28:10 +00:00
|
|
|
LogoutReplyPacket reply = new LogoutReplyPacket();
|
|
|
|
|
reply.AgentData.AgentID = agent.AgentID;
|
|
|
|
|
reply.AgentData.SessionID = agent.SessionID;
|
|
|
|
|
reply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
|
|
|
|
|
reply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
|
|
|
|
|
reply.InventoryData[0].ItemID = UUID.Zero;
|
|
|
|
|
|
|
|
|
|
server.UDP.SendPacket(agent.AgentID, reply, PacketCategory.Transaction);
|
|
|
|
|
|
2008-10-01 00:12:59 +00:00
|
|
|
server.DisconnectClient(agent);
|
2008-08-18 07:17:45 +00:00
|
|
|
}
|
2008-08-16 02:04:20 +00:00
|
|
|
}
|
|
|
|
|
}
|