diff options
author | Diva Canto | 2009-09-26 21:14:41 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-26 21:14:41 -0700 |
commit | 989382352dc5b5b75876607f6fc2f1f753f0fd15 (patch) | |
tree | f643df31517478613ec967d180a0e69f2c925194 /OpenSim/Region | |
parent | Moved all HG1 operations to HGGridConnector.cs and HypergridServerConnector.c... (diff) | |
download | opensim-SC-989382352dc5b5b75876607f6fc2f1f753f0fd15.zip opensim-SC-989382352dc5b5b75876607f6fc2f1f753f0fd15.tar.gz opensim-SC-989382352dc5b5b75876607f6fc2f1f753f0fd15.tar.bz2 opensim-SC-989382352dc5b5b75876607f6fc2f1f753f0fd15.tar.xz |
Poof! on Region.Communications.Hypergrid. Grid code deleted.
Diffstat (limited to 'OpenSim/Region')
5 files changed, 0 insertions, 1456 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 80f2e79..002ea17 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs | |||
@@ -40,21 +40,12 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
40 | { | 40 | { |
41 | public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1 | 41 | public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1 |
42 | { | 42 | { |
43 | IHyperlink m_osw = null; | ||
44 | public IHyperlink HGServices | ||
45 | { | ||
46 | get { return m_osw; } | ||
47 | } | ||
48 | 43 | ||
49 | public HGCommunicationsGridMode( | 44 | public HGCommunicationsGridMode( |
50 | NetworkServersInfo serversInfo, | 45 | NetworkServersInfo serversInfo, |
51 | SceneManager sman, LibraryRootFolder libraryRootFolder) | 46 | SceneManager sman, LibraryRootFolder libraryRootFolder) |
52 | : base(serversInfo, libraryRootFolder) | 47 | : base(serversInfo, libraryRootFolder) |
53 | { | 48 | { |
54 | // From constructor at CommunicationsOGS1 | ||
55 | HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, sman, m_userProfileCacheService); | ||
56 | m_gridService = gridInterComms; | ||
57 | m_osw = gridInterComms; | ||
58 | 49 | ||
59 | HGUserServices userServices = new HGUserServices(this); | 50 | HGUserServices userServices = new HGUserServices(this); |
60 | // This plugin arrangement could eventually be configurable rather than hardcoded here. | 51 | // This plugin arrangement could eventually be configurable rather than hardcoded here. |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index e4e12d4..f5126ca 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs | |||
@@ -44,7 +44,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
44 | ConfigSettings configSettings, | 44 | ConfigSettings configSettings, |
45 | NetworkServersInfo serversInfo, | 45 | NetworkServersInfo serversInfo, |
46 | BaseHttpServer httpServer, | 46 | BaseHttpServer httpServer, |
47 | HGGridServices gridService, | ||
48 | LibraryRootFolder libraryRootFolder, | 47 | LibraryRootFolder libraryRootFolder, |
49 | bool dumpAssetsToFile) | 48 | bool dumpAssetsToFile) |
50 | : base(serversInfo, libraryRootFolder) | 49 | : base(serversInfo, libraryRootFolder) |
@@ -64,8 +63,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
64 | m_avatarService = hgUserService; | 63 | m_avatarService = hgUserService; |
65 | m_messageService = hgUserService; | 64 | m_messageService = hgUserService; |
66 | 65 | ||
67 | gridService.UserProfileCache = m_userProfileCacheService; | ||
68 | m_gridService = gridService; | ||
69 | } | 66 | } |
70 | } | 67 | } |
71 | } | 68 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs deleted file mode 100644 index 85bfab4..0000000 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ /dev/null | |||
@@ -1,1026 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Drawing; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using System.Reflection; | ||
36 | using System.Runtime.Remoting; | ||
37 | using System.Security.Authentication; | ||
38 | using log4net; | ||
39 | using Nwc.XmlRpc; | ||
40 | using OpenMetaverse; | ||
41 | using OpenMetaverse.Imaging; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Communications; | ||
44 | using OpenSim.Framework.Communications.Cache; | ||
45 | using OpenSim.Framework.Servers; | ||
46 | using OpenSim.Framework.Servers.HttpServer; | ||
47 | using OpenSim.Region.Communications.OGS1; | ||
48 | using OpenSim.Region.Framework.Scenes; | ||
49 | using OpenSim.Services.Interfaces; | ||
50 | // using OpenSim.Region.Environment.Modules.Framework; | ||
51 | |||
52 | namespace OpenSim.Region.Communications.Hypergrid | ||
53 | { | ||
54 | /// <summary> | ||
55 | /// This class encapsulates the main hypergrid functions related to creating and managing | ||
56 | /// hyperlinks, as well as processing all the inter-region comms between a region and | ||
57 | /// an hyperlinked region. | ||
58 | /// </summary> | ||
59 | public class HGGridServices : IGridServices, IHyperlink | ||
60 | { | ||
61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
62 | |||
63 | |||
64 | public BaseHttpServer httpListener; | ||
65 | public NetworkServersInfo serversInfo; | ||
66 | |||
67 | protected List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>(); | ||
68 | |||
69 | // Hyperlink regions are hyperlinks on the map | ||
70 | protected List<RegionInfo> m_hyperlinkRegions = new List<RegionInfo>(); | ||
71 | |||
72 | // Known regions are home regions of visiting foreign users. | ||
73 | // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when | ||
74 | // the visitor goes away. They are mapped to X=0 on the map. | ||
75 | // This is key-ed on agent ID | ||
76 | protected Dictionary<UUID, RegionInfo> m_knownRegions = new Dictionary<UUID, RegionInfo>(); | ||
77 | |||
78 | protected UserProfileCacheService m_userProfileCache; | ||
79 | protected SceneManager m_sceneman; | ||
80 | |||
81 | private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); | ||
82 | |||
83 | public virtual string gdebugRegionName | ||
84 | { | ||
85 | get { return "Override me"; } | ||
86 | set { ; } | ||
87 | } | ||
88 | |||
89 | public string rdebugRegionName | ||
90 | { | ||
91 | get { return _rdebugRegionName; } | ||
92 | set { _rdebugRegionName = value; } | ||
93 | } | ||
94 | private string _rdebugRegionName = String.Empty; | ||
95 | |||
96 | public virtual bool RegionLoginsEnabled | ||
97 | { | ||
98 | get { return true; } | ||
99 | set { ; } | ||
100 | } | ||
101 | |||
102 | public UserProfileCacheService UserProfileCache | ||
103 | { | ||
104 | set { m_userProfileCache = value; } | ||
105 | } | ||
106 | |||
107 | private Random random; | ||
108 | |||
109 | /// <summary> | ||
110 | /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers | ||
111 | /// </summary> | ||
112 | /// <param name="servers_info"></param> | ||
113 | public HGGridServices(NetworkServersInfo servers_info, SceneManager sman) | ||
114 | { | ||
115 | serversInfo = servers_info; | ||
116 | m_sceneman = sman; | ||
117 | |||
118 | random = new Random(); | ||
119 | |||
120 | MainServer.Instance.AddXmlRPCHandler("link_region", LinkRegionRequest); | ||
121 | MainServer.Instance.AddXmlRPCHandler("expect_hg_user", ExpectHGUser); | ||
122 | |||
123 | HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL); | ||
124 | } | ||
125 | |||
126 | // see IGridServices | ||
127 | public virtual RegionCommsListener RegisterRegion(RegionInfo regionInfo) | ||
128 | { | ||
129 | // Region doesn't exist here. Trying to link remote region | ||
130 | |||
131 | m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort); | ||
132 | regionInfo.RegionID = LinkRegion(regionInfo); // UUID.Random(); | ||
133 | if (!regionInfo.RegionID.Equals(UUID.Zero)) | ||
134 | { | ||
135 | m_hyperlinkRegions.Add(regionInfo); | ||
136 | m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID); | ||
137 | |||
138 | //Try get the map image | ||
139 | GetMapImage(regionInfo); | ||
140 | } | ||
141 | else | ||
142 | { | ||
143 | m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")"); | ||
144 | } | ||
145 | // Note that these remote regions aren't registered in localBackend, so return null, no local listeners | ||
146 | return null; | ||
147 | } | ||
148 | |||
149 | // see IGridServices | ||
150 | public virtual bool DeregisterRegion(RegionInfo regionInfo) | ||
151 | { | ||
152 | if (m_hyperlinkRegions.Contains(regionInfo)) | ||
153 | { | ||
154 | m_hyperlinkRegions.Remove(regionInfo); | ||
155 | return true; | ||
156 | } | ||
157 | foreach (KeyValuePair<UUID, RegionInfo> kvp in m_knownRegions) | ||
158 | { | ||
159 | if (kvp.Value == regionInfo) | ||
160 | { | ||
161 | m_knownRegions.Remove(kvp.Key); | ||
162 | return true; | ||
163 | } | ||
164 | } | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | public virtual Dictionary<string, string> GetGridSettings() | ||
169 | { | ||
170 | Dictionary<string, string> returnGridSettings = new Dictionary<string, string>(); | ||
171 | lock (m_queuedGridSettings) | ||
172 | { | ||
173 | foreach (string Dictkey in m_queuedGridSettings.Keys) | ||
174 | { | ||
175 | returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); | ||
176 | } | ||
177 | |||
178 | m_queuedGridSettings.Clear(); | ||
179 | } | ||
180 | |||
181 | return returnGridSettings; | ||
182 | } | ||
183 | |||
184 | // see IGridServices | ||
185 | public virtual List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | ||
186 | { | ||
187 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); | ||
188 | foreach (RegionInfo reg in m_hyperlinkRegions) | ||
189 | { | ||
190 | if (reg.RegionLocX != x || reg.RegionLocY != y) | ||
191 | { | ||
192 | //m_log.Debug("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | ||
193 | if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2))) | ||
194 | { | ||
195 | if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2))) | ||
196 | { | ||
197 | neighbours.Add(reg); | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | } | ||
202 | |||
203 | return neighbours; | ||
204 | } | ||
205 | |||
206 | /// <summary> | ||
207 | /// Request information about a region. | ||
208 | /// </summary> | ||
209 | /// <param name="regionHandle"></param> | ||
210 | /// <returns> | ||
211 | /// null on a failure to contact or get a response from the grid server | ||
212 | /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the | ||
213 | /// nature of the faiulre. | ||
214 | /// </returns> | ||
215 | public virtual RegionInfo RequestNeighbourInfo(UUID Region_UUID) | ||
216 | { | ||
217 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
218 | { | ||
219 | if (info.RegionID == Region_UUID) return info; | ||
220 | } | ||
221 | |||
222 | // I don't trust region uuids to be unique... | ||
223 | //foreach (RegionInfo info in m_knownRegions.Values) | ||
224 | //{ | ||
225 | // if (info.RegionID == Region_UUID) return info; | ||
226 | //} | ||
227 | |||
228 | return null; | ||
229 | } | ||
230 | |||
231 | /// <summary> | ||
232 | /// Request information about a region. | ||
233 | /// </summary> | ||
234 | /// <param name="regionHandle"></param> | ||
235 | /// <returns></returns> | ||
236 | public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
237 | { | ||
238 | //m_log.Debug(" >> RequestNeighbourInfo for " + regionHandle); | ||
239 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
240 | { | ||
241 | //m_log.Debug(" .. " + info.RegionHandle); | ||
242 | if (info.RegionHandle == regionHandle) return info; | ||
243 | } | ||
244 | |||
245 | foreach (RegionInfo info in m_knownRegions.Values) | ||
246 | { | ||
247 | if (info.RegionHandle == regionHandle) | ||
248 | { | ||
249 | //m_log.Debug("XXX------ known region " + info.RegionHandle); | ||
250 | return info; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | return null; | ||
255 | } | ||
256 | |||
257 | public virtual RegionInfo RequestNeighbourInfo(string name) | ||
258 | { | ||
259 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
260 | { | ||
261 | //m_log.Debug(" .. " + info.RegionHandle); | ||
262 | if (info.RegionName == name) return info; | ||
263 | } | ||
264 | |||
265 | foreach (RegionInfo info in m_knownRegions.Values) | ||
266 | { | ||
267 | if (info.RegionName == name) | ||
268 | { | ||
269 | //m_log.Debug("XXX------ known region " + info.RegionHandle); | ||
270 | return info; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | return null; | ||
275 | } | ||
276 | |||
277 | public virtual RegionInfo RequestNeighbourInfo(string hostName, uint port) | ||
278 | { | ||
279 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
280 | { | ||
281 | //m_log.Debug(" .. " + info.RegionHandle); | ||
282 | if ((info.ExternalHostName == hostName) && (info.HttpPort == port)) | ||
283 | return info; | ||
284 | } | ||
285 | |||
286 | foreach (RegionInfo info in m_knownRegions.Values) | ||
287 | { | ||
288 | if ((info.ExternalHostName == hostName) && (info.HttpPort == port)) | ||
289 | { | ||
290 | //m_log.Debug("XXX------ known region " + info.RegionHandle); | ||
291 | return info; | ||
292 | } | ||
293 | } | ||
294 | |||
295 | return null; | ||
296 | } | ||
297 | |||
298 | public virtual RegionInfo RequestClosestRegion(string regionName) | ||
299 | { | ||
300 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
301 | { | ||
302 | if (info.RegionName == regionName) return info; | ||
303 | } | ||
304 | |||
305 | return null; | ||
306 | } | ||
307 | |||
308 | /// <summary> | ||
309 | /// | ||
310 | /// </summary> | ||
311 | /// <param name="minX"></param> | ||
312 | /// <param name="minY"></param> | ||
313 | /// <param name="maxX"></param> | ||
314 | /// <param name="maxY"></param> | ||
315 | /// <returns></returns> | ||
316 | public virtual List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | ||
317 | { | ||
318 | List<MapBlockData> neighbours = new List<MapBlockData>(); | ||
319 | |||
320 | foreach (RegionInfo regInfo in m_hyperlinkRegions) | ||
321 | { | ||
322 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && | ||
323 | ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) | ||
324 | { | ||
325 | MapBlockData map = new MapBlockData(); | ||
326 | map.Name = regInfo.RegionName; | ||
327 | map.X = (ushort)regInfo.RegionLocX; | ||
328 | map.Y = (ushort)regInfo.RegionLocY; | ||
329 | map.WaterHeight = (byte)regInfo.RegionSettings.WaterHeight; | ||
330 | map.MapImageId = regInfo.RegionSettings.TerrainImageID; | ||
331 | // m_log.Debug("ImgID: " + map.MapImageId); | ||
332 | map.Agents = 1; | ||
333 | map.RegionFlags = 72458694; | ||
334 | map.Access = regInfo.AccessLevel; | ||
335 | neighbours.Add(map); | ||
336 | } | ||
337 | } | ||
338 | |||
339 | return neighbours; | ||
340 | } | ||
341 | |||
342 | |||
343 | protected virtual void GetMapImage(RegionInfo info) | ||
344 | { | ||
345 | try | ||
346 | { | ||
347 | string regionimage = "regionImage" + info.RegionID.ToString(); | ||
348 | regionimage = regionimage.Replace("-", ""); | ||
349 | |||
350 | WebClient c = new WebClient(); | ||
351 | string uri = "http://" + info.ExternalHostName + ":" + info.HttpPort + "/index.php?method=" + regionimage; | ||
352 | //m_log.Debug("JPEG: " + uri); | ||
353 | c.DownloadFile(uri, info.RegionID.ToString() + ".jpg"); | ||
354 | Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg"); | ||
355 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); | ||
356 | byte[] imageData = OpenJPEG.EncodeFromImage(m, true); | ||
357 | AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); | ||
358 | info.RegionSettings.TerrainImageID = ass.FullID; | ||
359 | ass.Type = (int)AssetType.Texture; | ||
360 | ass.Temporary = false; | ||
361 | ass.Local = true; | ||
362 | ass.Data = imageData; | ||
363 | |||
364 | m_sceneman.CurrentOrFirstScene.AssetService.Store(ass); | ||
365 | |||
366 | } | ||
367 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke | ||
368 | { | ||
369 | m_log.Warn("[HGrid]: Failed getting/storing map image, because it is probably already in the cache"); | ||
370 | } | ||
371 | } | ||
372 | |||
373 | // A little ugly, since this code is exactly the same as OSG1's, and we're already | ||
374 | // calling that for when the region in in grid mode... (for the grid regions) | ||
375 | // | ||
376 | public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y) | ||
377 | { | ||
378 | m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}", | ||
379 | regionHandle, x, y); | ||
380 | |||
381 | // Remote region | ||
382 | |||
383 | Hashtable hash = new Hashtable(); | ||
384 | hash["region_handle"] = regionHandle.ToString(); | ||
385 | hash["x"] = x.ToString(); | ||
386 | hash["y"] = y.ToString(); | ||
387 | |||
388 | IList paramList = new ArrayList(); | ||
389 | paramList.Add(hash); | ||
390 | LandData landData = null; | ||
391 | |||
392 | try | ||
393 | { | ||
394 | RegionInfo info = RequestNeighbourInfo(regionHandle); | ||
395 | if (info != null) // just to be sure | ||
396 | { | ||
397 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | ||
398 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | ||
399 | XmlRpcResponse response = request.Send(uri, 10000); | ||
400 | if (response.IsFault) | ||
401 | { | ||
402 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | hash = (Hashtable)response.Value; | ||
407 | try | ||
408 | { | ||
409 | landData = new LandData(); | ||
410 | landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); | ||
411 | landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); | ||
412 | landData.Area = Convert.ToInt32(hash["Area"]); | ||
413 | landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); | ||
414 | landData.Description = (string)hash["Description"]; | ||
415 | landData.Flags = Convert.ToUInt32(hash["Flags"]); | ||
416 | landData.GlobalID = new UUID((string)hash["GlobalID"]); | ||
417 | landData.Name = (string)hash["Name"]; | ||
418 | landData.OwnerID = new UUID((string)hash["OwnerID"]); | ||
419 | landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); | ||
420 | landData.SnapshotID = new UUID((string)hash["SnapshotID"]); | ||
421 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); | ||
422 | m_log.DebugFormat("[HGrid]: Got land data for parcel {0}", landData.Name); | ||
423 | } | ||
424 | catch (Exception e) | ||
425 | { | ||
426 | m_log.Error("[HGrid]: Got exception while parsing land-data:", e); | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | else m_log.WarnFormat("[HGrid]: Couldn't find region with handle {0}", regionHandle); | ||
431 | } | ||
432 | catch (Exception e) | ||
433 | { | ||
434 | m_log.ErrorFormat("[HGrid]: Couldn't contact region {0}: {1}", regionHandle, e); | ||
435 | } | ||
436 | |||
437 | return landData; | ||
438 | } | ||
439 | |||
440 | // Grid Request Processing | ||
441 | public virtual List<RegionInfo> RequestNamedRegions (string name, int maxNumber) | ||
442 | { | ||
443 | List<RegionInfo> infos = new List<RegionInfo>(); | ||
444 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
445 | { | ||
446 | if (info.RegionName.ToLower().Contains(name)) | ||
447 | { | ||
448 | infos.Add(info); | ||
449 | } | ||
450 | } | ||
451 | return infos; | ||
452 | } | ||
453 | |||
454 | |||
455 | private UUID LinkRegion(RegionInfo info) | ||
456 | { | ||
457 | UUID uuid = UUID.Zero; | ||
458 | |||
459 | Hashtable hash = new Hashtable(); | ||
460 | hash["region_name"] = info.RegionName; | ||
461 | |||
462 | IList paramList = new ArrayList(); | ||
463 | paramList.Add(hash); | ||
464 | |||
465 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); | ||
466 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | ||
467 | m_log.Debug("[HGrid]: Linking to " + uri); | ||
468 | XmlRpcResponse response = request.Send(uri, 10000); | ||
469 | if (response.IsFault) | ||
470 | { | ||
471 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | ||
472 | } | ||
473 | else | ||
474 | { | ||
475 | hash = (Hashtable)response.Value; | ||
476 | //foreach (Object o in hash) | ||
477 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
478 | try | ||
479 | { | ||
480 | UUID.TryParse((string)hash["uuid"], out uuid); | ||
481 | info.RegionID = uuid; | ||
482 | if ((string)hash["handle"] != null) | ||
483 | { | ||
484 | info.regionSecret = (string)hash["handle"]; | ||
485 | //m_log.Debug(">> HERE: " + info.regionSecret); | ||
486 | } | ||
487 | if (hash["region_image"] != null) | ||
488 | { | ||
489 | UUID img = UUID.Zero; | ||
490 | UUID.TryParse((string)hash["region_image"], out img); | ||
491 | info.RegionSettings.TerrainImageID = img; | ||
492 | } | ||
493 | if (hash["region_name"] != null) | ||
494 | { | ||
495 | info.RegionName = (string)hash["region_name"]; | ||
496 | //m_log.Debug(">> " + info.RegionName); | ||
497 | } | ||
498 | if (hash["internal_port"] != null) | ||
499 | { | ||
500 | int port = Convert.ToInt32((string)hash["internal_port"]); | ||
501 | info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
502 | //m_log.Debug(">> " + info.InternalEndPoint.ToString()); | ||
503 | } | ||
504 | if (hash["remoting_port"] != null) | ||
505 | { | ||
506 | info.RemotingPort = Convert.ToUInt32(hash["remoting_port"]); | ||
507 | //m_log.Debug(">> " + info.RemotingPort); | ||
508 | } | ||
509 | |||
510 | } | ||
511 | catch (Exception e) | ||
512 | { | ||
513 | m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace); | ||
514 | } | ||
515 | } | ||
516 | return uuid; | ||
517 | } | ||
518 | |||
519 | /// <summary> | ||
520 | /// Someone wants to link to us | ||
521 | /// </summary> | ||
522 | /// <param name="request"></param> | ||
523 | /// <returns></returns> | ||
524 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
525 | { | ||
526 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
527 | //string host = (string)requestData["host"]; | ||
528 | //string portstr = (string)requestData["port"]; | ||
529 | string name = (string)requestData["region_name"]; | ||
530 | |||
531 | m_log.DebugFormat("[HGrid]: Hyperlink request"); | ||
532 | |||
533 | |||
534 | RegionInfo regInfo = null; | ||
535 | foreach (RegionInfo r in m_regionsOnInstance) | ||
536 | { | ||
537 | if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) | ||
538 | { | ||
539 | regInfo = r; | ||
540 | break; | ||
541 | } | ||
542 | } | ||
543 | |||
544 | if (regInfo == null) | ||
545 | regInfo = m_regionsOnInstance[0]; // Send out the first region | ||
546 | |||
547 | Hashtable hash = new Hashtable(); | ||
548 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
549 | hash["handle"] = regInfo.RegionHandle.ToString(); | ||
550 | //m_log.Debug(">> Here " + regInfo.RegionHandle); | ||
551 | hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); | ||
552 | hash["region_name"] = regInfo.RegionName; | ||
553 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
554 | hash["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString(); | ||
555 | //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port); | ||
556 | |||
557 | |||
558 | XmlRpcResponse response = new XmlRpcResponse(); | ||
559 | response.Value = hash; | ||
560 | return response; | ||
561 | } | ||
562 | |||
563 | public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData) | ||
564 | { | ||
565 | //ulong regionHandle = regInfo.RegionHandle; | ||
566 | try | ||
567 | { | ||
568 | //regionHandle = Convert.ToUInt64(regInfo.regionSecret); | ||
569 | m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret); | ||
570 | } | ||
571 | catch | ||
572 | { | ||
573 | m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret); | ||
574 | } | ||
575 | |||
576 | string capsPath = agentData.CapsPath; | ||
577 | Hashtable loginParams = new Hashtable(); | ||
578 | loginParams["session_id"] = agentData.SessionID.ToString(); | ||
579 | loginParams["secure_session_id"] = agentData.SecureSessionID.ToString(); | ||
580 | |||
581 | loginParams["firstname"] = agentData.firstname; | ||
582 | loginParams["lastname"] = agentData.lastname; | ||
583 | |||
584 | loginParams["agent_id"] = agentData.AgentID.ToString(); | ||
585 | loginParams["circuit_code"] = agentData.circuitcode.ToString(); | ||
586 | loginParams["startpos_x"] = agentData.startpos.X.ToString(); | ||
587 | loginParams["startpos_y"] = agentData.startpos.Y.ToString(); | ||
588 | loginParams["startpos_z"] = agentData.startpos.Z.ToString(); | ||
589 | loginParams["caps_path"] = capsPath; | ||
590 | |||
591 | CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID); | ||
592 | if (u != null && u.UserProfile != null) | ||
593 | { | ||
594 | loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero | ||
595 | //m_log.Debug(" --------- Home Region UUID -------"); | ||
596 | //m_log.Debug(" >> " + loginParams["region_uuid"] + " <<"); | ||
597 | //m_log.Debug(" --------- ---------------- -------"); | ||
598 | |||
599 | //string serverURI = ""; | ||
600 | //if (u.UserProfile is ForeignUserProfileData) | ||
601 | // serverURI = Util.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI); | ||
602 | //loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI; | ||
603 | |||
604 | //serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI); | ||
605 | //loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI; | ||
606 | |||
607 | //serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI); | ||
608 | //loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI; | ||
609 | |||
610 | loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID; | ||
611 | |||
612 | RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion); | ||
613 | if (rinfo != null) | ||
614 | { | ||
615 | loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString(); | ||
616 | if (!IsLocalUser(u)) | ||
617 | { | ||
618 | loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString(); | ||
619 | //m_log.Debug("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret); | ||
620 | |||
621 | loginParams["home_address"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress; | ||
622 | loginParams["home_port"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort; | ||
623 | loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort; | ||
624 | } | ||
625 | else | ||
626 | { | ||
627 | //m_log.Debug("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret); | ||
628 | |||
629 | //// local user about to jump out, let's process the name | ||
630 | // On second thoughts, let's not do this for the *user*; let's only do it for the *agent* | ||
631 | //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname; | ||
632 | //loginParams["lastname"] = serversInfo.UserURL; | ||
633 | |||
634 | // local user, first time out. let's ask the grid about this user's home region | ||
635 | loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString(); | ||
636 | |||
637 | loginParams["home_address"] = rinfo.ExternalHostName; | ||
638 | m_log.Debug(" --------- Home Address -------"); | ||
639 | m_log.Debug(" >> " + loginParams["home_address"] + " <<"); | ||
640 | m_log.Debug(" --------- ------------ -------"); | ||
641 | loginParams["home_port"] = rinfo.HttpPort.ToString(); | ||
642 | loginParams["home_remoting"] = ConfigSettings.DefaultRegionRemotingPort.ToString(); ; | ||
643 | } | ||
644 | } | ||
645 | else | ||
646 | { | ||
647 | m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY); | ||
648 | } | ||
649 | } | ||
650 | |||
651 | ArrayList SendParams = new ArrayList(); | ||
652 | SendParams.Add(loginParams); | ||
653 | |||
654 | // Send | ||
655 | string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/"; | ||
656 | //m_log.Debug("XXX uri: " + uri); | ||
657 | XmlRpcRequest request = new XmlRpcRequest("expect_hg_user", SendParams); | ||
658 | XmlRpcResponse reply; | ||
659 | try | ||
660 | { | ||
661 | reply = request.Send(uri, 6000); | ||
662 | } | ||
663 | catch (Exception e) | ||
664 | { | ||
665 | m_log.Warn("[HGrid]: Failed to notify region about user. Reason: " + e.Message); | ||
666 | return false; | ||
667 | } | ||
668 | |||
669 | if (!reply.IsFault) | ||
670 | { | ||
671 | bool responseSuccess = true; | ||
672 | if (reply.Value != null) | ||
673 | { | ||
674 | Hashtable resp = (Hashtable)reply.Value; | ||
675 | if (resp.ContainsKey("success")) | ||
676 | { | ||
677 | if ((string)resp["success"] == "FALSE") | ||
678 | { | ||
679 | responseSuccess = false; | ||
680 | } | ||
681 | } | ||
682 | } | ||
683 | if (responseSuccess) | ||
684 | { | ||
685 | m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID); | ||
686 | return true; | ||
687 | } | ||
688 | else | ||
689 | { | ||
690 | m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients"); | ||
691 | return false; | ||
692 | } | ||
693 | } | ||
694 | else | ||
695 | { | ||
696 | m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode); | ||
697 | return false; | ||
698 | } | ||
699 | } | ||
700 | |||
701 | |||
702 | /// <summary> | ||
703 | /// Received from other HGrid nodes when a user wants to teleport here. This call allows | ||
704 | /// the region to prepare for direct communication from the client. Sends back an empty | ||
705 | /// xmlrpc response on completion. | ||
706 | /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of | ||
707 | /// registering the user in the local user cache. | ||
708 | /// </summary> | ||
709 | /// <param name="request"></param> | ||
710 | /// <returns></returns> | ||
711 | public XmlRpcResponse ExpectHGUser(XmlRpcRequest request, IPEndPoint remoteClient) | ||
712 | { | ||
713 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
714 | ForeignUserProfileData userData = new ForeignUserProfileData(); | ||
715 | |||
716 | userData.FirstName = (string)requestData["firstname"]; | ||
717 | userData.SurName = (string)requestData["lastname"]; | ||
718 | userData.ID = new UUID((string)requestData["agent_id"]); | ||
719 | userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), | ||
720 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), | ||
721 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); | ||
722 | |||
723 | userData.UserServerURI = (string)requestData["userserver_id"]; | ||
724 | userData.UserAssetURI = (string)requestData["assetserver_id"]; | ||
725 | userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; | ||
726 | |||
727 | UUID rootID = UUID.Zero; | ||
728 | UUID.TryParse((string)requestData["root_folder_id"], out rootID); | ||
729 | userData.RootInventoryFolderID = rootID; | ||
730 | |||
731 | UUID uuid = UUID.Zero; | ||
732 | UUID.TryParse((string)requestData["region_uuid"], out uuid); | ||
733 | userData.HomeRegionID = uuid; // not quite comfortable about this... | ||
734 | ulong userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
735 | //userData.HomeRegion = userRegionHandle; | ||
736 | userData.UserHomeAddress = (string)requestData["home_address"]; | ||
737 | userData.UserHomePort = (string)requestData["home_port"]; | ||
738 | int userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]); | ||
739 | userData.UserHomeRemotingPort = (string)requestData["home_remoting"]; | ||
740 | |||
741 | |||
742 | m_log.DebugFormat("[HGrid]: Prepare for connection from {0} {1} (@{2}) UUID={3}", | ||
743 | userData.FirstName, userData.SurName, userData.UserServerURI, userData.ID); | ||
744 | m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + | ||
745 | "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort); | ||
746 | |||
747 | XmlRpcResponse resp = new XmlRpcResponse(); | ||
748 | |||
749 | // Let's check if someone is trying to get in with a stolen local identity. | ||
750 | // The need for this test is a consequence of not having truly global names :-/ | ||
751 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userData.ID); | ||
752 | if ((uinfo != null) && !(uinfo.UserProfile is ForeignUserProfileData)) | ||
753 | { | ||
754 | m_log.WarnFormat("[HGrid]: Foreign user trying to get in with local identity. Access denied."); | ||
755 | Hashtable respdata = new Hashtable(); | ||
756 | respdata["success"] = "FALSE"; | ||
757 | respdata["reason"] = "Foreign user has the same ID as a local user."; | ||
758 | resp.Value = respdata; | ||
759 | return resp; | ||
760 | } | ||
761 | |||
762 | if (!RegionLoginsEnabled) | ||
763 | { | ||
764 | m_log.InfoFormat( | ||
765 | "[HGrid]: Denying access for user {0} {1} because region login is currently disabled", | ||
766 | userData.FirstName, userData.SurName); | ||
767 | |||
768 | Hashtable respdata = new Hashtable(); | ||
769 | respdata["success"] = "FALSE"; | ||
770 | respdata["reason"] = "region login currently disabled"; | ||
771 | resp.Value = respdata; | ||
772 | } | ||
773 | else | ||
774 | { | ||
775 | // Finally, everything looks ok | ||
776 | //m_log.Debug("XXX---- EVERYTHING OK ---XXX"); | ||
777 | |||
778 | // 1 - Preload the user data | ||
779 | m_userProfileCache.PreloadUserCache(userData); | ||
780 | |||
781 | if (m_knownRegions.ContainsKey(userData.ID)) | ||
782 | { | ||
783 | // This was left here when the user departed | ||
784 | m_knownRegions.Remove(userData.ID); | ||
785 | } | ||
786 | |||
787 | // 2 - Load the region info into list of known regions | ||
788 | RegionInfo rinfo = new RegionInfo(); | ||
789 | rinfo.RegionID = userData.HomeRegionID; | ||
790 | rinfo.ExternalHostName = userData.UserHomeAddress; | ||
791 | rinfo.HttpPort = Convert.ToUInt32(userData.UserHomePort); | ||
792 | rinfo.RemotingPort = Convert.ToUInt32(userData.UserHomeRemotingPort); | ||
793 | rinfo.RegionID = userData.HomeRegionID; | ||
794 | // X=0 on the map | ||
795 | rinfo.RegionLocX = 0; | ||
796 | rinfo.RegionLocY = (uint)(random.Next(0, Int32.MaxValue)); //(uint)m_knownRegions.Count; | ||
797 | rinfo.regionSecret = userRegionHandle.ToString(); | ||
798 | //m_log.Debug("XXX--- Here: handle = " + rinfo.regionSecret); | ||
799 | try | ||
800 | { | ||
801 | rinfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport); | ||
802 | } | ||
803 | catch (Exception e) | ||
804 | { | ||
805 | m_log.Warn("[HGrid]: Exception while constructing internal endpoint: " + e); | ||
806 | } | ||
807 | rinfo.RemotingAddress = rinfo.ExternalEndPoint.Address.ToString(); //userData.UserHomeAddress; | ||
808 | |||
809 | if (!IsComingHome(userData)) | ||
810 | { | ||
811 | // Change the user's home region here!!! | ||
812 | userData.HomeRegion = rinfo.RegionHandle; | ||
813 | } | ||
814 | |||
815 | if (!m_knownRegions.ContainsKey(userData.ID)) | ||
816 | m_knownRegions.Add(userData.ID, rinfo); | ||
817 | |||
818 | // 3 - Send the reply | ||
819 | Hashtable respdata = new Hashtable(); | ||
820 | respdata["success"] = "TRUE"; | ||
821 | resp.Value = respdata; | ||
822 | |||
823 | DumpUserData(userData); | ||
824 | DumpRegionData(rinfo); | ||
825 | |||
826 | } | ||
827 | |||
828 | return resp; | ||
829 | } | ||
830 | |||
831 | public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData) | ||
832 | { | ||
833 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); | ||
834 | |||
835 | if ((IsLocalUser(uinfo) && IsHyperlinkRegion(regInfo.RegionHandle)) || | ||
836 | (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo))) | ||
837 | { | ||
838 | m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere"); | ||
839 | if (!InformRegionOfUser(regInfo, agentData)) | ||
840 | { | ||
841 | m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); | ||
842 | return false; | ||
843 | } | ||
844 | } | ||
845 | //if ((uinfo == null) || !IsGoingHome(uinfo, regInfo)) | ||
846 | //{ | ||
847 | // m_log.Info("[HGrid]: User seems to be going to foreign region."); | ||
848 | // if (!InformRegionOfUser(regInfo, agentData)) | ||
849 | // { | ||
850 | // m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); | ||
851 | // return false; | ||
852 | // } | ||
853 | //} | ||
854 | //else | ||
855 | // m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | ||
856 | |||
857 | // May need to change agent's name | ||
858 | if (IsLocalUser(uinfo) && IsHyperlinkRegion(regInfo.RegionHandle)) | ||
859 | { | ||
860 | agentData.firstname = agentData.firstname + "." + agentData.lastname; | ||
861 | agentData.lastname = "@" + serversInfo.UserURL.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI; | ||
862 | } | ||
863 | |||
864 | return true; | ||
865 | } | ||
866 | |||
867 | |||
868 | #region Methods triggered by calls from external instances | ||
869 | |||
870 | /// <summary> | ||
871 | /// | ||
872 | /// </summary> | ||
873 | /// <param name="regionHandle"></param> | ||
874 | /// <param name="agentData"></param> | ||
875 | /// <returns></returns> | ||
876 | public void AdjustUserInformation(AgentCircuitData agentData) | ||
877 | { | ||
878 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); | ||
879 | if ((uinfo != null) && (uinfo.UserProfile != null) && | ||
880 | (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) | ||
881 | { | ||
882 | //m_log.Debug("---------------> Local User!"); | ||
883 | string[] parts = agentData.firstname.Split(new char[] { '.' }); | ||
884 | if (parts.Length == 2) | ||
885 | { | ||
886 | agentData.firstname = parts[0]; | ||
887 | agentData.lastname = parts[1]; | ||
888 | } | ||
889 | } | ||
890 | //else | ||
891 | // m_log.Debug("---------------> Foreign User!"); | ||
892 | } | ||
893 | #endregion | ||
894 | |||
895 | |||
896 | #region IHyperGrid interface | ||
897 | |||
898 | public virtual bool IsHyperlinkRegion(ulong ihandle) | ||
899 | { | ||
900 | if (GetHyperlinkRegion(ihandle) == null) | ||
901 | return false; | ||
902 | else | ||
903 | return true; | ||
904 | } | ||
905 | |||
906 | public virtual RegionInfo GetHyperlinkRegion(ulong ihandle) | ||
907 | { | ||
908 | foreach (RegionInfo info in m_hyperlinkRegions) | ||
909 | { | ||
910 | if (info.RegionHandle == ihandle) | ||
911 | return info; | ||
912 | } | ||
913 | |||
914 | foreach (RegionInfo info in m_knownRegions.Values) | ||
915 | { | ||
916 | if (info.RegionHandle == ihandle) | ||
917 | return info; | ||
918 | } | ||
919 | |||
920 | return null; | ||
921 | } | ||
922 | |||
923 | public virtual ulong FindRegionHandle(ulong ihandle) | ||
924 | { | ||
925 | long ohandle = -1; | ||
926 | List<RegionInfo> rlist = new List<RegionInfo>(m_hyperlinkRegions); | ||
927 | rlist.AddRange(m_knownRegions.Values); | ||
928 | foreach (RegionInfo info in rlist) | ||
929 | { | ||
930 | if (info.RegionHandle == ihandle) | ||
931 | { | ||
932 | try | ||
933 | { | ||
934 | ohandle = Convert.ToInt64(info.regionSecret); | ||
935 | m_log.Info("[HGrid] remote region " + ohandle); | ||
936 | } | ||
937 | catch | ||
938 | { | ||
939 | m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")"); | ||
940 | } | ||
941 | break; | ||
942 | } | ||
943 | } | ||
944 | return ohandle < 0 ? ihandle : (ulong)ohandle; | ||
945 | } | ||
946 | #endregion | ||
947 | |||
948 | #region Misc | ||
949 | |||
950 | protected bool IsComingHome(ForeignUserProfileData userData) | ||
951 | { | ||
952 | return false; //(userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI); | ||
953 | } | ||
954 | |||
955 | protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo) | ||
956 | { | ||
957 | return false; | ||
958 | //if (uinfo.UserProfile == null) | ||
959 | // return false; | ||
960 | |||
961 | //string userUserServerURI = String.Empty; | ||
962 | //if (uinfo.UserProfile is ForeignUserProfileData) | ||
963 | //{ | ||
964 | // userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); | ||
965 | //} | ||
966 | |||
967 | //return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) && | ||
968 | // (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI)); | ||
969 | } | ||
970 | |||
971 | protected bool IsLocalUser(CachedUserInfo uinfo) | ||
972 | { | ||
973 | return true; | ||
974 | //if (uinfo == null) | ||
975 | // return true; | ||
976 | |||
977 | //if (uinfo.UserProfile is ForeignUserProfileData) | ||
978 | // return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); | ||
979 | //else | ||
980 | // return true; | ||
981 | |||
982 | } | ||
983 | |||
984 | protected bool IsLocalRegion(ulong handle) | ||
985 | { | ||
986 | foreach (RegionInfo reg in m_regionsOnInstance) | ||
987 | if (reg.RegionHandle == handle) | ||
988 | return true; | ||
989 | return false; | ||
990 | } | ||
991 | |||
992 | private void DumpUserData(ForeignUserProfileData userData) | ||
993 | { | ||
994 | m_log.Info(" ------------ User Data Dump ----------"); | ||
995 | m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName); | ||
996 | m_log.Info(" >> HomeID: " + userData.HomeRegionID); | ||
997 | m_log.Info(" >> HomeHandle: " + userData.HomeRegion); | ||
998 | m_log.Info(" >> HomeX: " + userData.HomeRegionX); | ||
999 | m_log.Info(" >> HomeY: " + userData.HomeRegionY); | ||
1000 | m_log.Info(" >> UserServer: " + userData.UserServerURI); | ||
1001 | m_log.Info(" >> InvServer: " + userData.UserInventoryURI); | ||
1002 | m_log.Info(" >> AssetServer: " + userData.UserAssetURI); | ||
1003 | m_log.Info(" ------------ -------------- ----------"); | ||
1004 | } | ||
1005 | |||
1006 | private void DumpRegionData(RegionInfo rinfo) | ||
1007 | { | ||
1008 | m_log.Info(" ------------ Region Data Dump ----------"); | ||
1009 | m_log.Info(" >> handle: " + rinfo.RegionHandle); | ||
1010 | m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY); | ||
1011 | m_log.Info(" >> secret: " + rinfo.regionSecret); | ||
1012 | m_log.Info(" >> remoting address: " + rinfo.RemotingAddress); | ||
1013 | m_log.Info(" >> remoting port: " + rinfo.RemotingPort); | ||
1014 | m_log.Info(" >> external host name: " + rinfo.ExternalHostName); | ||
1015 | m_log.Info(" >> http port: " + rinfo.HttpPort); | ||
1016 | m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address); | ||
1017 | m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port); | ||
1018 | m_log.Info(" ------------ -------------- ----------"); | ||
1019 | } | ||
1020 | |||
1021 | |||
1022 | #endregion | ||
1023 | |||
1024 | |||
1025 | } | ||
1026 | } | ||
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs deleted file mode 100644 index 5ce1e79..0000000 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs +++ /dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Framework.Servers.HttpServer; | ||
36 | using OpenSim.Region.Communications.OGS1; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | |||
39 | namespace OpenSim.Region.Communications.Hypergrid | ||
40 | { | ||
41 | public class HGGridServicesGridMode : HGGridServices | ||
42 | { | ||
43 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Encapsulate remote backend services for manipulation of grid regions | ||
47 | /// </summary> | ||
48 | private OGS1GridServices m_remoteBackend = null; | ||
49 | |||
50 | public OGS1GridServices RemoteBackend | ||
51 | { | ||
52 | get { return m_remoteBackend; } | ||
53 | } | ||
54 | |||
55 | |||
56 | public override string gdebugRegionName | ||
57 | { | ||
58 | get { return m_remoteBackend.gdebugRegionName; } | ||
59 | set { m_remoteBackend.gdebugRegionName = value; } | ||
60 | } | ||
61 | |||
62 | public override bool RegionLoginsEnabled | ||
63 | { | ||
64 | get { return m_remoteBackend.RegionLoginsEnabled; } | ||
65 | set { m_remoteBackend.RegionLoginsEnabled = value; } | ||
66 | } | ||
67 | |||
68 | public HGGridServicesGridMode(NetworkServersInfo servers_info, | ||
69 | SceneManager sman, UserProfileCacheService userv) | ||
70 | : base(servers_info, sman) | ||
71 | { | ||
72 | m_remoteBackend = new OGS1GridServices(servers_info); | ||
73 | m_userProfileCache = userv; | ||
74 | } | ||
75 | |||
76 | #region IGridServices interface | ||
77 | |||
78 | public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) | ||
79 | { | ||
80 | if (!regionInfo.RegionID.Equals(UUID.Zero)) | ||
81 | { | ||
82 | m_regionsOnInstance.Add(regionInfo); | ||
83 | return m_remoteBackend.RegisterRegion(regionInfo); | ||
84 | } | ||
85 | else | ||
86 | return base.RegisterRegion(regionInfo); | ||
87 | } | ||
88 | |||
89 | public override bool DeregisterRegion(RegionInfo regionInfo) | ||
90 | { | ||
91 | bool success = base.DeregisterRegion(regionInfo); | ||
92 | if (!success) | ||
93 | success = m_remoteBackend.DeregisterRegion(regionInfo); | ||
94 | return success; | ||
95 | } | ||
96 | |||
97 | public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | ||
98 | { | ||
99 | List<SimpleRegionInfo> neighbours = m_remoteBackend.RequestNeighbours(x, y); | ||
100 | //List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); | ||
101 | //neighbours.AddRange(remotes); | ||
102 | |||
103 | return neighbours; | ||
104 | } | ||
105 | |||
106 | public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) | ||
107 | { | ||
108 | RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID); | ||
109 | if (info == null) | ||
110 | info = base.RequestNeighbourInfo(Region_UUID); | ||
111 | return info; | ||
112 | } | ||
113 | |||
114 | public override RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
115 | { | ||
116 | RegionInfo info = base.RequestNeighbourInfo(regionHandle); | ||
117 | if (info == null) | ||
118 | info = m_remoteBackend.RequestNeighbourInfo(regionHandle); | ||
119 | return info; | ||
120 | } | ||
121 | |||
122 | public override RegionInfo RequestClosestRegion(string regionName) | ||
123 | { | ||
124 | RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName); | ||
125 | if (info == null) | ||
126 | info = base.RequestClosestRegion(regionName); | ||
127 | return info; | ||
128 | } | ||
129 | |||
130 | public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | ||
131 | { | ||
132 | List<MapBlockData> neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | ||
133 | List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | ||
134 | neighbours.AddRange(remotes); | ||
135 | |||
136 | return neighbours; | ||
137 | } | ||
138 | |||
139 | public override LandData RequestLandData(ulong regionHandle, uint x, uint y) | ||
140 | { | ||
141 | LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y); | ||
142 | if (land == null) | ||
143 | land = base.RequestLandData(regionHandle, x, y); | ||
144 | return land; | ||
145 | } | ||
146 | |||
147 | public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) | ||
148 | { | ||
149 | List<RegionInfo> infos = m_remoteBackend.RequestNamedRegions(name, maxNumber); | ||
150 | List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); | ||
151 | infos.AddRange(remotes); | ||
152 | return infos; | ||
153 | } | ||
154 | |||
155 | #endregion | ||
156 | |||
157 | |||
158 | } | ||
159 | } | ||
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs deleted file mode 100644 index 94cfc49..0000000 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs +++ /dev/null | |||
@@ -1,259 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.Reflection; | ||
34 | using System.Runtime.Remoting; | ||
35 | using System.Runtime.Remoting.Channels; | ||
36 | using System.Runtime.Remoting.Channels.Tcp; | ||
37 | using System.Security.Authentication; | ||
38 | using log4net; | ||
39 | using Nwc.XmlRpc; | ||
40 | using OpenMetaverse; | ||
41 | using OpenSim.Framework; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenSim.Region.Communications.Local; | ||
45 | using OpenSim.Region.Communications.OGS1; | ||
46 | using OpenSim.Region.Framework.Scenes; | ||
47 | |||
48 | namespace OpenSim.Region.Communications.Hypergrid | ||
49 | { | ||
50 | public class HGGridServicesStandalone : HGGridServices | ||
51 | { | ||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Encapsulate local backend services for manipulation of local regions | ||
56 | /// </summary> | ||
57 | protected LocalBackEndServices m_localBackend = new LocalBackEndServices(); | ||
58 | |||
59 | //private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>(); | ||
60 | |||
61 | public LocalBackEndServices LocalBackend | ||
62 | { | ||
63 | get { return m_localBackend; } | ||
64 | } | ||
65 | |||
66 | public override string gdebugRegionName | ||
67 | { | ||
68 | get { return m_localBackend.gdebugRegionName; } | ||
69 | set { m_localBackend.gdebugRegionName = value; } | ||
70 | } | ||
71 | |||
72 | public override bool RegionLoginsEnabled | ||
73 | { | ||
74 | get { return m_localBackend.RegionLoginsEnabled; } | ||
75 | set { m_localBackend.RegionLoginsEnabled = value; } | ||
76 | } | ||
77 | |||
78 | |||
79 | public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, SceneManager sman) | ||
80 | : base(servers_info, sman) | ||
81 | { | ||
82 | //Respond to Grid Services requests | ||
83 | MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser); | ||
84 | MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply); | ||
85 | MainServer.Instance.AddXmlRPCHandler("land_data", LandData); | ||
86 | |||
87 | } | ||
88 | |||
89 | #region IGridServices interface | ||
90 | |||
91 | public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) | ||
92 | { | ||
93 | if (!regionInfo.RegionID.Equals(UUID.Zero)) | ||
94 | { | ||
95 | m_regionsOnInstance.Add(regionInfo); | ||
96 | return m_localBackend.RegisterRegion(regionInfo); | ||
97 | } | ||
98 | else | ||
99 | return base.RegisterRegion(regionInfo); | ||
100 | |||
101 | } | ||
102 | |||
103 | public override bool DeregisterRegion(RegionInfo regionInfo) | ||
104 | { | ||
105 | bool success = m_localBackend.DeregisterRegion(regionInfo); | ||
106 | if (!success) | ||
107 | success = base.DeregisterRegion(regionInfo); | ||
108 | return success; | ||
109 | } | ||
110 | |||
111 | public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | ||
112 | { | ||
113 | List<SimpleRegionInfo> neighbours = m_localBackend.RequestNeighbours(x, y); | ||
114 | //List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); | ||
115 | //neighbours.AddRange(remotes); | ||
116 | |||
117 | return neighbours; | ||
118 | } | ||
119 | |||
120 | public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) | ||
121 | { | ||
122 | RegionInfo info = m_localBackend.RequestNeighbourInfo(Region_UUID); | ||
123 | if (info == null) | ||
124 | info = base.RequestNeighbourInfo(Region_UUID); | ||
125 | return info; | ||
126 | } | ||
127 | |||
128 | public override RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
129 | { | ||
130 | RegionInfo info = m_localBackend.RequestNeighbourInfo(regionHandle); | ||
131 | //m_log.Info("[HGrid] Request neighbor info, local backend returned " + info); | ||
132 | if (info == null) | ||
133 | info = base.RequestNeighbourInfo(regionHandle); | ||
134 | return info; | ||
135 | } | ||
136 | |||
137 | public override RegionInfo RequestClosestRegion(string regionName) | ||
138 | { | ||
139 | RegionInfo info = m_localBackend.RequestClosestRegion(regionName); | ||
140 | if (info == null) | ||
141 | info = base.RequestClosestRegion(regionName); | ||
142 | return info; | ||
143 | } | ||
144 | |||
145 | public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | ||
146 | { | ||
147 | //m_log.Info("[HGrid] Request map blocks " + minX + "-" + minY + "-" + maxX + "-" + maxY); | ||
148 | List<MapBlockData> neighbours = m_localBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | ||
149 | List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | ||
150 | neighbours.AddRange(remotes); | ||
151 | |||
152 | return neighbours; | ||
153 | } | ||
154 | |||
155 | public override LandData RequestLandData(ulong regionHandle, uint x, uint y) | ||
156 | { | ||
157 | LandData land = m_localBackend.RequestLandData(regionHandle, x, y); | ||
158 | if (land == null) | ||
159 | land = base.RequestLandData(regionHandle, x, y); | ||
160 | return land; | ||
161 | } | ||
162 | |||
163 | public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) | ||
164 | { | ||
165 | List<RegionInfo> infos = m_localBackend.RequestNamedRegions(name, maxNumber); | ||
166 | List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); | ||
167 | infos.AddRange(remotes); | ||
168 | return infos; | ||
169 | } | ||
170 | |||
171 | #endregion | ||
172 | |||
173 | #region XML Request Handlers | ||
174 | |||
175 | /// <summary> | ||
176 | /// A ping / version check | ||
177 | /// </summary> | ||
178 | /// <param name="request"></param> | ||
179 | /// <returns></returns> | ||
180 | public virtual XmlRpcResponse PingCheckReply(XmlRpcRequest request, IPEndPoint remoteClient) | ||
181 | { | ||
182 | XmlRpcResponse response = new XmlRpcResponse(); | ||
183 | |||
184 | Hashtable respData = new Hashtable(); | ||
185 | respData["online"] = "true"; | ||
186 | |||
187 | m_localBackend.PingCheckReply(respData); | ||
188 | |||
189 | response.Value = respData; | ||
190 | |||
191 | return response; | ||
192 | } | ||
193 | |||
194 | |||
195 | // Grid Request Processing | ||
196 | /// <summary> | ||
197 | /// Ooops, our Agent must be dead if we're getting this request! | ||
198 | /// </summary> | ||
199 | /// <param name="request"></param> | ||
200 | /// <returns></returns> | ||
201 | public XmlRpcResponse LogOffUser(XmlRpcRequest request, IPEndPoint remoteClient) | ||
202 | { | ||
203 | m_log.Debug("[HGrid]: LogOff User Called"); | ||
204 | |||
205 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
206 | string message = (string)requestData["message"]; | ||
207 | UUID agentID = UUID.Zero; | ||
208 | UUID RegionSecret = UUID.Zero; | ||
209 | UUID.TryParse((string)requestData["agent_id"], out agentID); | ||
210 | UUID.TryParse((string)requestData["region_secret"], out RegionSecret); | ||
211 | |||
212 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
213 | |||
214 | m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret, message); | ||
215 | |||
216 | return new XmlRpcResponse(); | ||
217 | } | ||
218 | |||
219 | /// <summary> | ||
220 | /// Someone asked us about parcel-information | ||
221 | /// </summary> | ||
222 | /// <param name="request"></param> | ||
223 | /// <returns></returns> | ||
224 | public XmlRpcResponse LandData(XmlRpcRequest request, IPEndPoint remoteClient) | ||
225 | { | ||
226 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
227 | ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); | ||
228 | uint x = Convert.ToUInt32(requestData["x"]); | ||
229 | uint y = Convert.ToUInt32(requestData["y"]); | ||
230 | m_log.DebugFormat("[HGrid]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle); | ||
231 | |||
232 | LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); | ||
233 | Hashtable hash = new Hashtable(); | ||
234 | if (landData != null) | ||
235 | { | ||
236 | // for now, only push out the data we need for answering a ParcelInfoReqeust | ||
237 | hash["AABBMax"] = landData.AABBMax.ToString(); | ||
238 | hash["AABBMin"] = landData.AABBMin.ToString(); | ||
239 | hash["Area"] = landData.Area.ToString(); | ||
240 | hash["AuctionID"] = landData.AuctionID.ToString(); | ||
241 | hash["Description"] = landData.Description; | ||
242 | hash["Flags"] = landData.Flags.ToString(); | ||
243 | hash["GlobalID"] = landData.GlobalID.ToString(); | ||
244 | hash["Name"] = landData.Name; | ||
245 | hash["OwnerID"] = landData.OwnerID.ToString(); | ||
246 | hash["SalePrice"] = landData.SalePrice.ToString(); | ||
247 | hash["SnapshotID"] = landData.SnapshotID.ToString(); | ||
248 | hash["UserLocation"] = landData.UserLocation.ToString(); | ||
249 | } | ||
250 | |||
251 | XmlRpcResponse response = new XmlRpcResponse(); | ||
252 | response.Value = hash; | ||
253 | return response; | ||
254 | } | ||
255 | |||
256 | #endregion | ||
257 | |||
258 | } | ||
259 | } | ||