aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs')
-rw-r--r--Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs177
1 files changed, 0 insertions, 177 deletions
diff --git a/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs b/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
deleted file mode 100644
index 928215e..0000000
--- a/Common/OpenGrid.Framework.Communications/LocalBackEndServices.cs
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework;
33using OpenSim.Framework.Types;
34
35using libsecondlife;
36
37namespace OpenGrid.Framework.Communications
38{
39 public class LocalBackEndServices
40 {
41 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>();
42 protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>();
43
44 public LocalBackEndServices()
45 {
46
47 }
48
49 /// <summary>
50 /// Register a region method with the BackEnd Services.
51 /// </summary>
52 /// <param name="regionInfo"></param>
53 /// <returns></returns>
54 public RegionCommsHostBase RegisterRegion(RegionInfo regionInfo)
55 {
56 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
57 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
58 {
59 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
60 this.regions.Add(regionInfo.RegionHandle, regionInfo);
61 RegionCommsHostBase regionHost = new RegionCommsHostBase();
62 this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
63
64 return regionHost;
65 }
66
67 //already in our list of regions so for now lets return null
68 return null;
69 }
70
71 /// <summary>
72 /// </summary>
73 /// <param name="regionInfo"></param>
74 /// <returns></returns>
75 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
76 {
77 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
78 List<RegionInfo> neighbours = new List<RegionInfo>();
79
80 foreach (RegionInfo reg in this.regions.Values)
81 {
82 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
83 if (reg.RegionHandle != regionInfo.RegionHandle)
84 {
85 //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
86 if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
87 {
88 if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
89 {
90 neighbours.Add(reg);
91 }
92 }
93 }
94 }
95 return neighbours;
96 }
97
98 /// <summary>
99 ///
100 /// </summary>
101 /// <param name="regionHandle"></param>
102 /// <returns></returns>
103 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
104 {
105 if (this.regions.ContainsKey(regionHandle))
106 {
107 return this.regions[regionHandle];
108 }
109 return null;
110 }
111
112 /// <summary>
113 /// </summary>
114 /// <param name="regionHandle"></param>
115 /// <param name="agentData"></param>
116 /// <returns></returns>
117 public bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
118 {
119 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
120 if (this.regionHosts.ContainsKey(regionHandle))
121 {
122 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
123 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData);
124 return true;
125 }
126 return false;
127 }
128
129 /// <summary>
130 ///
131 /// </summary>
132 /// <param name="regionHandle"></param>
133 /// <param name="agentID"></param>
134 /// <param name="position"></param>
135 /// <returns></returns>
136 public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
137 {
138 if (this.regionHosts.ContainsKey(regionHandle))
139 {
140 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
141 this.regionHosts[regionHandle].ExpectAvatarCrossing(regionHandle, agentID, position);
142 return true;
143 }
144 return false;
145 }
146
147 /// <summary>
148 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
149 /// </summary>
150 /// <param name="regionHandle"></param>
151 /// <param name="loginData"></param>
152 /// <returns></returns>
153 public bool AddNewSession(ulong regionHandle, Login loginData)
154 {
155 //Console.WriteLine(" comms manager been told to expect new user");
156 AgentCircuitData agent = new AgentCircuitData();
157 agent.AgentID = loginData.Agent;
158 agent.firstname = loginData.First;
159 agent.lastname = loginData.Last;
160 agent.SessionID = loginData.Session;
161 agent.SecureSessionID = loginData.SecureSession;
162 agent.circuitcode = loginData.CircuitCode;
163 agent.BaseFolder = loginData.BaseFolder;
164 agent.InventoryFolder = loginData.InventoryFolder;
165 agent.startpos = new LLVector3(128, 128, 70);
166
167 if (this.regionHosts.ContainsKey(regionHandle))
168 {
169 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
170 return true;
171 }
172
173 // region not found
174 return false;
175 }
176 }
177}