* Sim to sim caps for establishing child agents
* Still working out a bug in the libomv event queue, committing what is done for now

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2485 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2009-03-16 18:02:48 +00:00
parent 1506846d36
commit e69157a4af
14 changed files with 472 additions and 101 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using OpenMetaverse;
@@ -6,7 +7,7 @@ using OpenMetaverse.StructuredData;
namespace Simian
{
public class RegionInfo
public struct RegionInfo
{
public string Name;
public UUID ID;
@@ -16,6 +17,7 @@ namespace Simian
public Uri HttpServer;
public UUID MapTextureID;
public Uri Owner;
public Uri EnableClientCap;
public uint X
{
@@ -23,7 +25,7 @@ namespace Simian
{
uint x, y;
OpenMetaverse.Utils.LongToUInts(Handle, out x, out y);
return x;
return x / 256;
}
set
@@ -40,7 +42,7 @@ namespace Simian
{
uint x, y;
OpenMetaverse.Utils.LongToUInts(Handle, out x, out y);
return y;
return y / 256;
}
set
@@ -50,51 +52,20 @@ namespace Simian
Handle = OpenMetaverse.Utils.UIntsToLong(x, value);
}
}
public OSDMap SerializeToOSD()
{
OSDMap osdata = new OSDMap();
osdata["handle"] = OSD.FromULong(Handle);
osdata["id"] = OSD.FromUUID(ID);
osdata["map_texture_id"] = OSD.FromUUID(MapTextureID);
osdata["name"] = OSD.FromString(Name);
osdata["owner"] = OSD.FromUri(Owner);
osdata["ipaddr"] = OSD.FromString(IPAndPort.Address.ToString());
osdata["port"] = OSD.FromInteger(IPAndPort.Port);
return osdata;
}
public void Deserialize(OSD osdata)
{
if (osdata.Type == OSDType.Map)
{
OSDMap map = (OSDMap)osdata;
Handle = map["handle"].AsULong();
ID = map["id"].AsUUID();
MapTextureID = map["map_texture_id"].AsUUID();
Name = map["name"].AsString();
Owner = map["owner"].AsUri();
IPAddress address;
if (IPAddress.TryParse(map["ipaddr"].AsString(), out address))
IPAndPort = new IPEndPoint(address, map["port"].AsInteger());
}
}
}
public delegate void NeighborSimNotice(RegionInfo neighbor, bool online);
public delegate void RegionUpdateCallback(RegionInfo regionInfo);
public interface IGridProvider
{
event RegionUpdateCallback OnRegionUpdate;
bool TryRegisterGridSpace(RegionInfo regionInfo, X509Certificate2 regionCert, out UUID regionID);
/// <summary>
/// Attempts to register any available space closest to the given grid
/// coordinates
/// </summary>
/// <param name="region">Information about the region to be registered.
/// <param name="regionInfo">Information about the region to be registered.
/// The X, Y, and Handle values may be modified if the exact grid
/// coordinate requested is not available</param>
/// <param name="regionCert">SSL client certificate file for the region.
@@ -104,10 +75,10 @@ namespace Simian
/// <param name="regionID">The unique identifier of the registered
/// region upon success. This will also be assigned to region.ID</param>
/// <returns>True if the registration was successful, otherwise false</returns>
bool TryRegisterAnyGridSpace(RegionInfo region, X509Certificate2 regionCert, bool isolated, out UUID regionID);
bool TryRegisterAnyGridSpace(RegionInfo regionInfo, X509Certificate2 regionCert, bool isolated, out UUID regionID);
bool UnregisterGridSpace(UUID regionID, X509Certificate2 regionCert);
void RegionUpdate(UUID regionID, X509Certificate2 regionCert);
void RegionUpdate(RegionInfo regionInfo, X509Certificate2 regionCert);
void RegionHeartbeat(UUID regionID, X509Certificate2 regionCert);
bool TryGetRegion(UUID regionID, X509Certificate2 regionCert, out RegionInfo region);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using HttpServer;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -149,7 +150,7 @@ namespace Simian
uint TerrainPatchCountWidth { get; }
uint TerrainPatchCountHeight { get; }
bool Start(Simian server, string name, IPEndPoint endpoint, UUID regionID, uint regionX, uint regionY, string defaultTerrainFile, int staticObjects, int physicalObjects);
bool Start(Simian server, RegionInfo regionInfo, X509Certificate2 regionCert, string defaultTerrainFile, int staticObjects, int physicalObjects);
void Stop();
void ObjectAddOrUpdate(object sender, SimulationObject obj, UUID ownerID, int scriptStartParam, PrimFlags creatorFlags, UpdateFlags updateFlags);
@@ -194,5 +195,8 @@ namespace Simian
void SendEvent(Agent agent, string name, OSDMap body);
bool HasRunningEventQueue(Agent agent);
bool SeedCapabilityHandler(IHttpClientContext context, IHttpRequest request, IHttpResponse response, object state);
bool EnableClientCapHandler(IHttpClientContext context, IHttpRequest request, IHttpResponse response, object state);
bool EnableClientCompleteCapHandler(IHttpClientContext context, IHttpRequest request, IHttpResponse response, object state);
}
}

View File

@@ -44,14 +44,23 @@ namespace Simian
/// <param name="category">The specified category of the outgoing packet</param>
/// <returns>True to continue sending this packet, otherwise false</returns>
public delegate bool OutgoingPacketCallback(Packet packet, UUID agentID, PacketCategory category);
/// <summary>
/// Triggered when an agent establishes a UDP connection
/// </summary>
/// <param name="agent">Agent that now has a UDP connection</param>
/// <param name="circuitCode">Circuit code that was used to identify the agent
/// during connection establishment</param>
public delegate void AgentConnectionCallback(Agent agent, uint circuitCode);
public interface IUDPProvider
{
event OutgoingPacketCallback OnOutgoingPacket;
event AgentConnectionCallback OnAgentConnection;
void AddClient(Agent agent, IPEndPoint endpoint);
bool RemoveClient(Agent agent);
uint CreateCircuit(Agent agent);
void CreateCircuit(Agent agent, uint circuitCode);
void SendPacket(UUID agentID, Packet packet, PacketCategory category);
void BroadcastPacket(Packet packet, PacketCategory category);