More work on CAPS handler.

Sugilite
MW 2007-06-23 11:14:58 +00:00
parent b2eb668814
commit 303ea70efa
9 changed files with 61 additions and 44 deletions

View File

@ -45,5 +45,6 @@ namespace OpenSim.Framework.Types
public bool child;
public LLUUID InventoryFolder;
public LLUUID BaseFolder;
public string CapsPath = "";
}
}

View File

@ -42,6 +42,7 @@ namespace OpenSim.Framework.Types
public LLUUID InventoryFolder;
public LLUUID BaseFolder;
public uint CircuitCode;
public string CapsPath ="";
public Login()
{

View File

@ -81,6 +81,14 @@ namespace OpenSim.Framework.Utilities
return sb.ToString();
}
public static string GetRandomCapsPath()
{
LLUUID caps = LLUUID.Random();
string capsPath = caps.ToStringHyphenated();
capsPath = capsPath.Remove(capsPath.Length - 4, 4);
return capsPath;
}
//public static int fast_distance2d(int x, int y)
//{
// x = System.Math.Abs(x);

View File

@ -193,6 +193,7 @@ namespace OpenSim.LocalCommunications
agent.BaseFolder = loginData.BaseFolder;
agent.InventoryFolder = loginData.InventoryFolder;
agent.startpos = new LLVector3(128, 128, 70);
agent.CapsPath = loginData.CapsPath;
if (this.regionHosts.ContainsKey(regionHandle))
{

View File

@ -86,12 +86,12 @@ namespace OpenSim.LocalCommunications
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
string capsPath = Util.GetRandomCapsPath();
response.SimAddress = reg.IPListenAddr;
response.SimPort = (Int32)reg.IPListenPort;
response.RegionX = reg.RegionLocX ;
response.RegionY = reg.RegionLocY ;
response.SeedCapability = "http://" + reg.IPListenAddr + ":" + "9000" + "/CAPS/00334-0000/";
response.SeedCapability = "http://" + reg.IPListenAddr + ":" + "9000" + "/CAPS/"+capsPath +"0000/";
theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle;
@ -103,6 +103,7 @@ namespace OpenSim.LocalCommunications
_login.Session = response.SessionID;
_login.SecureSession = response.SecureSessionID;
_login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath;
m_Parent.InformRegionOfLogin(currentRegion, _login);
}

View File

@ -10,16 +10,19 @@ namespace OpenSim.Region
{
private string httpListenerAddress;
private uint httpListenPort;
private string MainPath = "00334-0000/";
private string MapLayerPath = "00334-0001/";
private string capsObjectPath = "00001-";
private string requestPath = "0000/";
private string mapLayerPath = "0001/";
private BaseHttpServer httpListener;
// private LLUUID agentID;
private LLUUID agentID;
public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort)
public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent)
{
capsObjectPath = capsPath;
httpListener = httpServer;
httpListenerAddress = httpListen;
httpListenPort = httpPort;
agentID = agent;
}
/// <summary>
@ -28,8 +31,8 @@ namespace OpenSim.Region
public void RegisterHandlers()
{
Console.WriteLine("registering CAPS handlers");
httpListener.AddRestHandler("POST", "/CAPS/" + MainPath, CapsRequest);
httpListener.AddRestHandler("POST", "/CAPS/" + MapLayerPath, MapLayer);
httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ requestPath, CapsRequest);
httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ mapLayerPath, MapLayer);
}
/// <summary>
@ -41,6 +44,7 @@ namespace OpenSim.Region
/// <returns></returns>
public string CapsRequest(string request, string path, string param)
{
//Console.WriteLine("Caps Request " + request);
string result = "<llsd><map>";
result += this.GetCapabilities();
result += "</map></llsd>";
@ -55,7 +59,7 @@ namespace OpenSim.Region
{
string capURLS="";
capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + MapLayerPath + "</string>";
capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" +capsObjectPath+ mapLayerPath + "</string>";
return capURLS;
}

View File

@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
@ -6,8 +6,7 @@
<ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<ApplicationIcon></ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region</AssemblyName>
@ -16,11 +15,9 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<AppDesignerFolder></AppDesignerFolder>
<RootNamespace>OpenSim.Region</RootNamespace>
<StartupObject>
</StartupObject>
<StartupObject></StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
@ -31,8 +28,7 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DocumentationFile></DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
@ -41,8 +37,7 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
<NoWarn></NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -51,8 +46,7 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DocumentationFile></DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
@ -61,28 +55,26 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
<NoWarn></NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Axiom.MathLib.dll">
<Reference Include="Axiom.MathLib.dll" >
<HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Db4objects.Db4o.dll">
<Reference Include="Db4objects.Db4o.dll" >
<HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll">
<Reference Include="libsecondlife.dll" >
<HintPath>..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<Reference Include="System" >
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml">
<Reference Include="System.Xml" >
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
@ -92,59 +84,61 @@
<Name>OpenGrid.Framework.Communications</Name>
<Project>{683344D5-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
<Name>OpenSim.Caches</Name>
<Project>{1938EB12-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
<Name>OpenSim.GenericConfig.Xml</Name>
<Project>{E88EF749-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Name>OpenSim.Physics.Manager</Name>
<Project>{8BE16150-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
<Name>OpenSim.Servers</Name>
<Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
<Name>OpenSim.Terrain.BasicTerrain</Name>
<Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
<Name>XMLRPC</Name>
<Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Caps.cs" />
<Compile Include="Caps.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="EstateManager.cs">
<SubType>Code</SubType>
</Compile>

View File

@ -11,6 +11,7 @@
<resources prefix="OpenSim.Region" dynamicprefix="true" >
</resources>
<sources failonempty="true">
<include name="Caps.cs" />
<include name="EstateManager.cs" />
<include name="ParcelManager.cs" />
<include name="Scenes/Entity.cs" />

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.Scenes
protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager;
protected Caps TestCapsHandler;
protected List<Caps> capsHandlers = new List<Caps>();
protected BaseHttpServer httpListener;
public ParcelManager parcelManager;
@ -132,8 +132,7 @@ namespace OpenSim.Region.Scenes
ScenePresence.LoadAnims();
this.httpListener = httpServer;
this.TestCapsHandler = new Caps(httpListener, "127.0.0.1" , 9000);
this.TestCapsHandler.RegisterHandlers();
}
catch (Exception e)
{
@ -728,6 +727,13 @@ namespace OpenSim.Region.Scenes
//should just check that its meant for this region
if (regionHandle == this.m_regInfo.RegionHandle)
{
if (agent.CapsPath != "")
{
//Console.WriteLine("new user, so creating caps handler for it");
Caps cap = new Caps(httpListener, this.m_regInfo.IPListenAddr, 9000, agent.CapsPath, agent.AgentID);
cap.RegisterHandlers();
this.capsHandlers.Add(cap);
}
this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
}
}