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 bool child;
public LLUUID InventoryFolder; public LLUUID InventoryFolder;
public LLUUID BaseFolder; public LLUUID BaseFolder;
public string CapsPath = "";
} }
} }

View File

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

View File

@ -81,6 +81,14 @@ namespace OpenSim.Framework.Utilities
return sb.ToString(); 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) //public static int fast_distance2d(int x, int y)
//{ //{
// x = System.Math.Abs(x); // x = System.Math.Abs(x);

View File

@ -193,6 +193,7 @@ namespace OpenSim.LocalCommunications
agent.BaseFolder = loginData.BaseFolder; agent.BaseFolder = loginData.BaseFolder;
agent.InventoryFolder = loginData.InventoryFolder; agent.InventoryFolder = loginData.InventoryFolder;
agent.startpos = new LLVector3(128, 128, 70); agent.startpos = new LLVector3(128, 128, 70);
agent.CapsPath = loginData.CapsPath;
if (this.regionHosts.ContainsKey(regionHandle)) 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() + "], " + 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() + "], " + "'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() + "]}"; "'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.SimAddress = reg.IPListenAddr;
response.SimPort = (Int32)reg.IPListenPort; response.SimPort = (Int32)reg.IPListenPort;
response.RegionX = reg.RegionLocX ; response.RegionX = reg.RegionLocX ;
response.RegionY = reg.RegionLocY ; 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.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle; theUser.currentAgent.currentHandle = reg.RegionHandle;
@ -103,6 +103,7 @@ namespace OpenSim.LocalCommunications
_login.Session = response.SessionID; _login.Session = response.SessionID;
_login.SecureSession = response.SecureSessionID; _login.SecureSession = response.SecureSessionID;
_login.CircuitCode = (uint)response.CircuitCode; _login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath;
m_Parent.InformRegionOfLogin(currentRegion, _login); m_Parent.InformRegionOfLogin(currentRegion, _login);
} }

View File

@ -10,16 +10,19 @@ namespace OpenSim.Region
{ {
private string httpListenerAddress; private string httpListenerAddress;
private uint httpListenPort; private uint httpListenPort;
private string MainPath = "00334-0000/"; private string capsObjectPath = "00001-";
private string MapLayerPath = "00334-0001/"; private string requestPath = "0000/";
private string mapLayerPath = "0001/";
private BaseHttpServer httpListener; 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; httpListener = httpServer;
httpListenerAddress = httpListen; httpListenerAddress = httpListen;
httpListenPort = httpPort; httpListenPort = httpPort;
agentID = agent;
} }
/// <summary> /// <summary>
@ -28,8 +31,8 @@ namespace OpenSim.Region
public void RegisterHandlers() public void RegisterHandlers()
{ {
Console.WriteLine("registering CAPS handlers"); Console.WriteLine("registering CAPS handlers");
httpListener.AddRestHandler("POST", "/CAPS/" + MainPath, CapsRequest); httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ requestPath, CapsRequest);
httpListener.AddRestHandler("POST", "/CAPS/" + MapLayerPath, MapLayer); httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ mapLayerPath, MapLayer);
} }
/// <summary> /// <summary>
@ -41,6 +44,7 @@ namespace OpenSim.Region
/// <returns></returns> /// <returns></returns>
public string CapsRequest(string request, string path, string param) public string CapsRequest(string request, string path, string param)
{ {
//Console.WriteLine("Caps Request " + request);
string result = "<llsd><map>"; string result = "<llsd><map>";
result += this.GetCapabilities(); result += this.GetCapabilities();
result += "</map></llsd>"; result += "</map></llsd>";
@ -55,7 +59,7 @@ namespace OpenSim.Region
{ {
string capURLS=""; 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; 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> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>8.0.50727</ProductVersion>
@ -6,8 +6,7 @@
<ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid> <ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon> <ApplicationIcon></ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName> <AssemblyKeyContainerName>
</AssemblyKeyContainerName> </AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region</AssemblyName> <AssemblyName>OpenSim.Region</AssemblyName>
@ -16,11 +15,9 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder> <AppDesignerFolder></AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region</RootNamespace> <RootNamespace>OpenSim.Region</RootNamespace>
<StartupObject> <StartupObject></StartupObject>
</StartupObject>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
</PropertyGroup> </PropertyGroup>
@ -31,8 +28,7 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile> <DocumentationFile></DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -41,8 +37,7 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn> <NoWarn></NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -51,8 +46,7 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<DocumentationFile> <DocumentationFile></DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols> <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
@ -61,28 +55,26 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn> <NoWarn></NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Axiom.MathLib.dll"> <Reference Include="Axiom.MathLib.dll" >
<HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Db4objects.Db4o.dll"> <Reference Include="Db4objects.Db4o.dll" >
<HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="libsecondlife.dll"> <Reference Include="libsecondlife.dll" >
<HintPath>..\..\bin\libsecondlife.dll</HintPath> <HintPath>..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System"> <Reference Include="System" >
<HintPath>System.dll</HintPath> <HintPath>System.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Data" /> <Reference Include="System.Xml" >
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath> <HintPath>System.Xml.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
@ -92,59 +84,61 @@
<Name>OpenGrid.Framework.Communications</Name> <Name>OpenGrid.Framework.Communications</Name>
<Project>{683344D5-0000-0000-0000-000000000000}</Project> <Project>{683344D5-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj"> <ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
<Name>OpenSim.Caches</Name> <Name>OpenSim.Caches</Name>
<Project>{1938EB12-0000-0000-0000-000000000000}</Project> <Project>{1938EB12-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name> <Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project> <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name> <Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project> <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
<Name>OpenSim.GenericConfig.Xml</Name> <Name>OpenSim.GenericConfig.Xml</Name>
<Project>{E88EF749-0000-0000-0000-000000000000}</Project> <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Name>OpenSim.Physics.Manager</Name> <Name>OpenSim.Physics.Manager</Name>
<Project>{8BE16150-0000-0000-0000-000000000000}</Project> <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
<Name>OpenSim.Servers</Name> <Name>OpenSim.Servers</Name>
<Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj"> <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
<Name>OpenSim.Terrain.BasicTerrain</Name> <Name>OpenSim.Terrain.BasicTerrain</Name>
<Project>{2270B8FE-0000-0000-0000-000000000000}</Project> <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
<Name>XMLRPC</Name> <Name>XMLRPC</Name>
<Project>{8E81D43C-0000-0000-0000-000000000000}</Project> <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Caps.cs" /> <Compile Include="Caps.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="EstateManager.cs"> <Compile Include="EstateManager.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@ -210,4 +204,4 @@
<PostBuildEvent> <PostBuildEvent>
</PostBuildEvent> </PostBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

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

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.Scenes
protected RegionCommsListener regionCommsHost; protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager; protected CommunicationsManager commsManager;
protected Caps TestCapsHandler; protected List<Caps> capsHandlers = new List<Caps>();
protected BaseHttpServer httpListener; protected BaseHttpServer httpListener;
public ParcelManager parcelManager; public ParcelManager parcelManager;
@ -132,8 +132,7 @@ namespace OpenSim.Region.Scenes
ScenePresence.LoadAnims(); ScenePresence.LoadAnims();
this.httpListener = httpServer; this.httpListener = httpServer;
this.TestCapsHandler = new Caps(httpListener, "127.0.0.1" , 9000);
this.TestCapsHandler.RegisterHandlers();
} }
catch (Exception e) catch (Exception e)
{ {
@ -728,6 +727,13 @@ namespace OpenSim.Region.Scenes
//should just check that its meant for this region //should just check that its meant for this region
if (regionHandle == this.m_regInfo.RegionHandle) 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); this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
} }
} }