diff options
author | MW | 2007-06-10 18:51:45 +0000 |
---|---|---|
committer | MW | 2007-06-10 18:51:45 +0000 |
commit | 453fadd94071545b76706674bb284402c9a065c0 (patch) | |
tree | e971a1970f5926da1a9393b94f9b3e109a8cd14b /Common/OpenGrid.Framework.Communications | |
parent | Added a Couple of summary comments (diff) | |
download | opensim-SC_OLD-453fadd94071545b76706674bb284402c9a065c0.zip opensim-SC_OLD-453fadd94071545b76706674bb284402c9a065c0.tar.gz opensim-SC_OLD-453fadd94071545b76706674bb284402c9a065c0.tar.bz2 opensim-SC_OLD-453fadd94071545b76706674bb284402c9a065c0.tar.xz |
Added SandBoxManager which in sandbox mode, acts as the backend server for the CommsManager interfaces (commsManager.gridServer etc).
Diffstat (limited to '')
9 files changed, 160 insertions, 146 deletions
diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs index eab7bac..6781806 100644 --- a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs | |||
@@ -16,7 +16,7 @@ namespace OpenGrid.Framework.Communications.GridServer | |||
16 | /// </summary> | 16 | /// </summary> |
17 | /// <param name="regionInfo"></param> | 17 | /// <param name="regionInfo"></param> |
18 | /// <returns></returns> | 18 | /// <returns></returns> |
19 | internal virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | 19 | public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) |
20 | { | 20 | { |
21 | return null; | 21 | return null; |
22 | } | 22 | } |
diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs index 9e7f1e5..bf7d5b9 100644 --- a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs | |||
@@ -11,19 +11,21 @@ namespace OpenGrid.Framework.Communications.GridServer | |||
11 | { | 11 | { |
12 | public class GridCommsManagerLocal : GridCommsManagerBase | 12 | public class GridCommsManagerLocal : GridCommsManagerBase |
13 | { | 13 | { |
14 | public GridCommsManagerLocal() | 14 | private SandBoxManager sandBoxManager; |
15 | { | ||
16 | 15 | ||
16 | public GridCommsManagerLocal(SandBoxManager sandManager) | ||
17 | { | ||
18 | sandBoxManager = sandManager; | ||
17 | } | 19 | } |
18 | 20 | ||
19 | internal override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | 21 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) |
20 | { | 22 | { |
21 | return null; | 23 | return sandBoxManager.RegisterRegion(regionInfo); |
22 | } | 24 | } |
23 | 25 | ||
24 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | 26 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) |
25 | { | 27 | { |
26 | return null; | 28 | return sandBoxManager.RequestNeighbours(regionInfo); |
27 | } | 29 | } |
28 | } | 30 | } |
29 | } | 31 | } |
diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs index 1788873..acf8911 100644 --- a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs | |||
@@ -13,7 +13,7 @@ namespace OpenGrid.Framework.Communications.GridServer | |||
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | internal override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | 16 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) |
17 | { | 17 | { |
18 | return null; | 18 | return null; |
19 | } | 19 | } |
diff --git a/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj b/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj index 94682be..21a0cd7 100644 --- a/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj +++ b/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{683344D5-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{683344D5-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenGrid.Framework.Communications</AssemblyName> | 13 | <AssemblyName>OpenGrid.Framework.Communications</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Communications</RootNamespace> | 21 | <RootNamespace>OpenGrid.Framework.Communications</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,18 +61,20 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="System" > | 68 | <Reference Include="System"> |
62 | <HintPath>System.dll</HintPath> | 69 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System.Xml" > | 72 | <Reference Include="System.Data" /> |
73 | <Reference Include="System.Xml"> | ||
66 | <HintPath>System.Xml.dll</HintPath> | 74 | <HintPath>System.Xml.dll</HintPath> |
67 | <Private>False</Private> | 75 | <Private>False</Private> |
68 | </Reference> | 76 | </Reference> |
69 | <Reference Include="libsecondlife.dll" > | 77 | <Reference Include="libsecondlife.dll"> |
70 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 78 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
71 | <Private>False</Private> | 79 | <Private>False</Private> |
72 | </Reference> | 80 | </Reference> |
@@ -76,7 +84,7 @@ | |||
76 | <Name>OpenSim.Framework</Name> | 84 | <Name>OpenSim.Framework</Name> |
77 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | 85 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> |
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
79 | <Private>False</Private> | 87 | <Private>False</Private> |
80 | </ProjectReference> | 88 | </ProjectReference> |
81 | </ItemGroup> | 89 | </ItemGroup> |
82 | <ItemGroup> | 90 | <ItemGroup> |
@@ -101,6 +109,7 @@ | |||
101 | <Compile Include="Properties\AssemblyInfo.cs"> | 109 | <Compile Include="Properties\AssemblyInfo.cs"> |
102 | <SubType>Code</SubType> | 110 | <SubType>Code</SubType> |
103 | </Compile> | 111 | </Compile> |
112 | <Compile Include="SandBoxManager.cs" /> | ||
104 | <Compile Include="UserServer\UserCommsManagerBase.cs"> | 113 | <Compile Include="UserServer\UserCommsManagerBase.cs"> |
105 | <SubType>Code</SubType> | 114 | <SubType>Code</SubType> |
106 | </Compile> | 115 | </Compile> |
@@ -118,4 +127,4 @@ | |||
118 | <PostBuildEvent> | 127 | <PostBuildEvent> |
119 | </PostBuildEvent> | 128 | </PostBuildEvent> |
120 | </PropertyGroup> | 129 | </PropertyGroup> |
121 | </Project> | 130 | </Project> \ No newline at end of file |
diff --git a/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build b/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build index a6616bf..952051b 100644 --- a/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build +++ b/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build | |||
@@ -14,6 +14,7 @@ | |||
14 | <include name="RegionServerCommsLocal.cs" /> | 14 | <include name="RegionServerCommsLocal.cs" /> |
15 | <include name="RegionServerCommsManager.cs" /> | 15 | <include name="RegionServerCommsManager.cs" /> |
16 | <include name="RegionServerCommsOGS.cs" /> | 16 | <include name="RegionServerCommsOGS.cs" /> |
17 | <include name="SandBoxManager.cs" /> | ||
17 | <include name="GridServer/GridCommsManagerBase.cs" /> | 18 | <include name="GridServer/GridCommsManagerBase.cs" /> |
18 | <include name="GridServer/GridCommsManagerLocal.cs" /> | 19 | <include name="GridServer/GridCommsManagerLocal.cs" /> |
19 | <include name="GridServer/GridCommsManagerOGS.cs" /> | 20 | <include name="GridServer/GridCommsManagerOGS.cs" /> |
diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs index fcccb49..bfcd15f 100644 --- a/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs | |||
@@ -11,117 +11,22 @@ namespace OpenGrid.Framework.Communications | |||
11 | { | 11 | { |
12 | public class RegionServerCommsLocal : RegionServerCommsManager | 12 | public class RegionServerCommsLocal : RegionServerCommsManager |
13 | { | 13 | { |
14 | protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); | 14 | public SandBoxManager SandManager = new SandBoxManager(); |
15 | protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>(); | ||
16 | |||
17 | public RegionServerCommsLocal() | 15 | public RegionServerCommsLocal() |
18 | { | 16 | { |
19 | userServer = new UserServer.UserCommsManagerLocal(); //Local User Server | 17 | userServer = new UserServer.UserCommsManagerLocal(); //Local User Server |
20 | gridServer = new GridServer.GridCommsManagerLocal(); //Locl Grid Server | 18 | gridServer = new GridServer.GridCommsManagerLocal(SandManager); //Locl Grid Server |
21 | } | ||
22 | |||
23 | /// <summary> | ||
24 | /// Main Register a region method with the CommsManager. | ||
25 | /// Should do anything that is needed and also call the RegisterRegion method in the gridserver class | ||
26 | /// to inform the grid server (in grid mode). | ||
27 | /// </summary> | ||
28 | /// <param name="regionInfo"></param> | ||
29 | /// <returns></returns> | ||
30 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
31 | { | ||
32 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | ||
33 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) | ||
34 | { | ||
35 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | ||
36 | this.regions.Add(regionInfo.RegionHandle, regionInfo); | ||
37 | RegionCommsHostBase regionHost = new RegionCommsHostBase(); | ||
38 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); | ||
39 | |||
40 | return regionHost; | ||
41 | } | ||
42 | |||
43 | //already in our list of regions so for now lets return null | ||
44 | return null; | ||
45 | } | ||
46 | |||
47 | /// <summary> | ||
48 | /// In the current class structure this shouldn't be here as it should only be in the gridserver class | ||
49 | /// but having it there in sandbox mode makes things very difficult, so for now until something is sorted out | ||
50 | /// it will have to be here as well | ||
51 | /// </summary> | ||
52 | /// <param name="regionInfo"></param> | ||
53 | /// <returns></returns> | ||
54 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
55 | { | ||
56 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); | ||
57 | List<RegionInfo> neighbours = new List<RegionInfo>(); | ||
58 | |||
59 | foreach (RegionInfo reg in this.regions.Values) | ||
60 | { | ||
61 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); | ||
62 | if (reg.RegionHandle != regionInfo.RegionHandle) | ||
63 | { | ||
64 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | ||
65 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) | ||
66 | { | ||
67 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) | ||
68 | { | ||
69 | neighbours.Add(reg); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | return neighbours; | ||
75 | } | 19 | } |
76 | 20 | ||
77 | /// <summary> | 21 | /// <summary> |
78 | /// informs a neighbouring sim to expect a child agent | 22 | /// informs a neighbouring sim to expect a child agent |
79 | /// I guess if we are going to stick with the current class structure then we need a intersim class | ||
80 | /// but think we need to really rethink the class structure as currently it makes things very messy for sandbox mode | ||
81 | /// </summary> | 23 | /// </summary> |
82 | /// <param name="regionHandle"></param> | 24 | /// <param name="regionHandle"></param> |
83 | /// <param name="agentData"></param> | 25 | /// <param name="agentData"></param> |
84 | /// <returns></returns> | 26 | /// <returns></returns> |
85 | public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | 27 | public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData |
86 | { | 28 | { |
87 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | 29 | return SandManager.InformNeighbourOfChildAgent(regionHandle, agentData); |
88 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
89 | { | ||
90 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
91 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
92 | return true; | ||
93 | } | ||
94 | return false; | ||
95 | } | ||
96 | |||
97 | /// <summary> | ||
98 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session | ||
99 | /// </summary> | ||
100 | /// <param name="regionHandle"></param> | ||
101 | /// <param name="loginData"></param> | ||
102 | /// <returns></returns> | ||
103 | public bool AddNewSession(ulong regionHandle, Login loginData) | ||
104 | { | ||
105 | //Console.WriteLine(" comms manager been told to expect new user"); | ||
106 | AgentCircuitData agent = new AgentCircuitData(); | ||
107 | agent.AgentID = loginData.Agent; | ||
108 | agent.firstname = loginData.First; | ||
109 | agent.lastname = loginData.Last; | ||
110 | agent.SessionID = loginData.Session; | ||
111 | agent.SecureSessionID = loginData.SecureSession; | ||
112 | agent.circuitcode = loginData.CircuitCode; | ||
113 | agent.BaseFolder = loginData.BaseFolder; | ||
114 | agent.InventoryFolder = loginData.InventoryFolder; | ||
115 | agent.startpos = new LLVector3(128, 128, 70); | ||
116 | |||
117 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
118 | { | ||
119 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); | ||
120 | return true; | ||
121 | } | ||
122 | |||
123 | // region not found | ||
124 | return false; | ||
125 | } | 30 | } |
126 | } | 31 | } |
127 | } | 32 | } |
diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs index b3a4a8f..810477a 100644 --- a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs | |||
@@ -20,16 +20,6 @@ namespace OpenGrid.Framework.Communications | |||
20 | 20 | ||
21 | } | 21 | } |
22 | 22 | ||
23 | public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
24 | { | ||
25 | return null; | ||
26 | } | ||
27 | |||
28 | public virtual List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
29 | { | ||
30 | return null; | ||
31 | } | ||
32 | |||
33 | public virtual bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | 23 | public virtual bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData |
34 | { | 24 | { |
35 | return false; | 25 | return false; |
diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs index b746f92..75b211d 100644 --- a/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs | |||
@@ -14,27 +14,9 @@ namespace OpenGrid.Framework.Communications | |||
14 | gridServer = new GridServer.GridCommsManagerOGS(); //Remote Grid Server | 14 | gridServer = new GridServer.GridCommsManagerOGS(); //Remote Grid Server |
15 | } | 15 | } |
16 | 16 | ||
17 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
18 | { | ||
19 | return gridServer.RegisterRegion(regionInfo); | ||
20 | } | ||
21 | |||
22 | /// <summary> | ||
23 | /// In the current class structure this shouldn't be here as it should only be in the gridserver class | ||
24 | /// but having it there in sandbox mode makes things very difficult, so for now until something is sorted out | ||
25 | /// it will have to be here as well | ||
26 | /// </summary> | ||
27 | /// <param name="regionInfo"></param> | ||
28 | /// <returns></returns> | ||
29 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
30 | { | ||
31 | return gridServer.RequestNeighbours(regionInfo); | ||
32 | } | ||
33 | 17 | ||
34 | /// <summary> | 18 | /// <summary> |
35 | /// informs a neighbouring sim to expect a child agent | 19 | /// informs a neighbouring sim to expect a child agent |
36 | /// I guess if we are going to stick with the current class structure then we need a intersim class | ||
37 | /// but think we need to really rethink the class structure as currently it makes things very messy for sandbox mode | ||
38 | /// </summary> | 20 | /// </summary> |
39 | /// <param name="regionHandle"></param> | 21 | /// <param name="regionHandle"></param> |
40 | /// <param name="agentData"></param> | 22 | /// <param name="agentData"></param> |
diff --git a/Common/OpenGrid.Framework.Communications/SandBoxManager.cs b/Common/OpenGrid.Framework.Communications/SandBoxManager.cs new file mode 100644 index 0000000..4094658 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/SandBoxManager.cs | |||
@@ -0,0 +1,125 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework; | ||
5 | using OpenSim.Framework.Types; | ||
6 | |||
7 | using libsecondlife; | ||
8 | |||
9 | namespace OpenGrid.Framework.Communications | ||
10 | { | ||
11 | public class SandBoxManager | ||
12 | { | ||
13 | protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); | ||
14 | protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>(); | ||
15 | |||
16 | public SandBoxManager() | ||
17 | { | ||
18 | |||
19 | } | ||
20 | |||
21 | /// <summary> | ||
22 | /// Main Register a region method with the CommsManager. | ||
23 | /// Should do anything that is needed and also call the RegisterRegion method in the gridserver class | ||
24 | /// to inform the grid server (in grid mode). | ||
25 | /// </summary> | ||
26 | /// <param name="regionInfo"></param> | ||
27 | /// <returns></returns> | ||
28 | public RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | ||
29 | { | ||
30 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | ||
31 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) | ||
32 | { | ||
33 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | ||
34 | this.regions.Add(regionInfo.RegionHandle, regionInfo); | ||
35 | RegionCommsHostBase regionHost = new RegionCommsHostBase(); | ||
36 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); | ||
37 | |||
38 | return regionHost; | ||
39 | } | ||
40 | |||
41 | //already in our list of regions so for now lets return null | ||
42 | return null; | ||
43 | } | ||
44 | |||
45 | /// <summary> | ||
46 | /// In the current class structure this shouldn't be here as it should only be in the gridserver class | ||
47 | /// but having it there in sandbox mode makes things very difficult, so for now until something is sorted out | ||
48 | /// it will have to be here as well | ||
49 | /// </summary> | ||
50 | /// <param name="regionInfo"></param> | ||
51 | /// <returns></returns> | ||
52 | public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | ||
53 | { | ||
54 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); | ||
55 | List<RegionInfo> neighbours = new List<RegionInfo>(); | ||
56 | |||
57 | foreach (RegionInfo reg in this.regions.Values) | ||
58 | { | ||
59 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); | ||
60 | if (reg.RegionHandle != regionInfo.RegionHandle) | ||
61 | { | ||
62 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | ||
63 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) | ||
64 | { | ||
65 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) | ||
66 | { | ||
67 | neighbours.Add(reg); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | return neighbours; | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// informs a neighbouring sim to expect a child agent | ||
77 | /// I guess if we are going to stick with the current class structure then we need a intersim class | ||
78 | /// but think we need to really rethink the class structure as currently it makes things very messy for sandbox mode | ||
79 | /// </summary> | ||
80 | /// <param name="regionHandle"></param> | ||
81 | /// <param name="agentData"></param> | ||
82 | /// <returns></returns> | ||
83 | public bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | ||
84 | { | ||
85 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | ||
86 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
87 | { | ||
88 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
89 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
90 | return true; | ||
91 | } | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session | ||
97 | /// </summary> | ||
98 | /// <param name="regionHandle"></param> | ||
99 | /// <param name="loginData"></param> | ||
100 | /// <returns></returns> | ||
101 | public bool AddNewSession(ulong regionHandle, Login loginData) | ||
102 | { | ||
103 | //Console.WriteLine(" comms manager been told to expect new user"); | ||
104 | AgentCircuitData agent = new AgentCircuitData(); | ||
105 | agent.AgentID = loginData.Agent; | ||
106 | agent.firstname = loginData.First; | ||
107 | agent.lastname = loginData.Last; | ||
108 | agent.SessionID = loginData.Session; | ||
109 | agent.SecureSessionID = loginData.SecureSession; | ||
110 | agent.circuitcode = loginData.CircuitCode; | ||
111 | agent.BaseFolder = loginData.BaseFolder; | ||
112 | agent.InventoryFolder = loginData.InventoryFolder; | ||
113 | agent.startpos = new LLVector3(128, 128, 70); | ||
114 | |||
115 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
116 | { | ||
117 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); | ||
118 | return true; | ||
119 | } | ||
120 | |||
121 | // region not found | ||
122 | return false; | ||
123 | } | ||
124 | } | ||
125 | } | ||