aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs259
1 files changed, 0 insertions, 259 deletions
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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.Reflection;
34using System.Runtime.Remoting;
35using System.Runtime.Remoting.Channels;
36using System.Runtime.Remoting.Channels.Tcp;
37using System.Security.Authentication;
38using log4net;
39using Nwc.XmlRpc;
40using OpenMetaverse;
41using OpenSim.Framework;
42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1;
46using OpenSim.Region.Framework.Scenes;
47
48namespace 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}