aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
diff options
context:
space:
mode:
authorMW2007-06-11 09:53:34 +0000
committerMW2007-06-11 09:53:34 +0000
commitd93031b2dc2b86c194a12d9170acb9e1d7cb0aff (patch)
treefe02621acd16a6875e4170208cc6e3281c1f9b25 /Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
parentAdded InterSimComms (Likely to be renamed) to the commsManager and moved the ... (diff)
downloadopensim-SC_OLD-d93031b2dc2b86c194a12d9170acb9e1d7cb0aff.zip
opensim-SC_OLD-d93031b2dc2b86c194a12d9170acb9e1d7cb0aff.tar.gz
opensim-SC_OLD-d93031b2dc2b86c194a12d9170acb9e1d7cb0aff.tar.bz2
opensim-SC_OLD-d93031b2dc2b86c194a12d9170acb9e1d7cb0aff.tar.xz
Renamed sandBoxManager to LocalBackEndServices
Diffstat (limited to 'Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs')
-rw-r--r--Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs117
1 files changed, 117 insertions, 0 deletions
diff --git a/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs b/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
new file mode 100644
index 0000000..b213213
--- /dev/null
+++ b/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
@@ -0,0 +1,117 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework;
5using OpenSim.Framework.Types;
6
7using libsecondlife;
8
9namespace OpenGrid.Framework.Communications
10{
11 public class LocalBackEndServices
12 {
13 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>();
14 protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>();
15
16 public LocalBackEndServices()
17 {
18
19 }
20
21 /// <summary>
22 /// Register a region method with the BackEnd Services.
23 /// </summary>
24 /// <param name="regionInfo"></param>
25 /// <returns></returns>
26 public RegionCommsHostBase RegisterRegion(RegionInfo regionInfo)
27 {
28 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
29 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
30 {
31 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
32 this.regions.Add(regionInfo.RegionHandle, regionInfo);
33 RegionCommsHostBase regionHost = new RegionCommsHostBase();
34 this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
35
36 return regionHost;
37 }
38
39 //already in our list of regions so for now lets return null
40 return null;
41 }
42
43 /// <summary>
44 /// </summary>
45 /// <param name="regionInfo"></param>
46 /// <returns></returns>
47 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
48 {
49 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
50 List<RegionInfo> neighbours = new List<RegionInfo>();
51
52 foreach (RegionInfo reg in this.regions.Values)
53 {
54 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
55 if (reg.RegionHandle != regionInfo.RegionHandle)
56 {
57 //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
58 if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
59 {
60 if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
61 {
62 neighbours.Add(reg);
63 }
64 }
65 }
66 }
67 return neighbours;
68 }
69
70 /// <summary>
71 /// </summary>
72 /// <param name="regionHandle"></param>
73 /// <param name="agentData"></param>
74 /// <returns></returns>
75 public bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
76 {
77 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
78 if (this.regionHosts.ContainsKey(regionHandle))
79 {
80 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
81 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData);
82 return true;
83 }
84 return false;
85 }
86
87 /// <summary>
88 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
89 /// </summary>
90 /// <param name="regionHandle"></param>
91 /// <param name="loginData"></param>
92 /// <returns></returns>
93 public bool AddNewSession(ulong regionHandle, Login loginData)
94 {
95 //Console.WriteLine(" comms manager been told to expect new user");
96 AgentCircuitData agent = new AgentCircuitData();
97 agent.AgentID = loginData.Agent;
98 agent.firstname = loginData.First;
99 agent.lastname = loginData.Last;
100 agent.SessionID = loginData.Session;
101 agent.SecureSessionID = loginData.SecureSession;
102 agent.circuitcode = loginData.CircuitCode;
103 agent.BaseFolder = loginData.BaseFolder;
104 agent.InventoryFolder = loginData.InventoryFolder;
105 agent.startpos = new LLVector3(128, 128, 70);
106
107 if (this.regionHosts.ContainsKey(regionHandle))
108 {
109 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
110 return true;
111 }
112
113 // region not found
114 return false;
115 }
116 }
117}