aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
diff options
context:
space:
mode:
authorMW2009-02-24 15:57:25 +0000
committerMW2009-02-24 15:57:25 +0000
commit021225675f0d1f28daf6c21fe54b4172c7084036 (patch)
tree0c2cd006e07c82ff11ea9277c397067857767c5d /OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
parentFirst step in separating out the Userserver console command handling to a "mo... (diff)
downloadopensim-SC_OLD-021225675f0d1f28daf6c21fe54b4172c7084036.zip
opensim-SC_OLD-021225675f0d1f28daf6c21fe54b4172c7084036.tar.gz
opensim-SC_OLD-021225675f0d1f28daf6c21fe54b4172c7084036.tar.bz2
opensim-SC_OLD-021225675f0d1f28daf6c21fe54b4172c7084036.tar.xz
Added OpenSim.Grid.GridServer.Modules, for the GridServer modules/components.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs (renamed from OpenSim/Grid/GridServer/GridXmlRpcModule.cs)1770
1 files changed, 885 insertions, 885 deletions
diff --git a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
index d69f079..d5af900 100644
--- a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs
+++ b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
@@ -1,885 +1,885 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Xml; 33using System.Xml;
34using log4net; 34using log4net;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Data; 37using OpenSim.Data;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using OpenSim.Grid.Framework; 41using OpenSim.Grid.Framework;
42 42
43namespace OpenSim.Grid.GridServer 43namespace OpenSim.Grid.GridServer.Modules
44{ 44{
45 public class GridXmlRpcModule 45 public class GridXmlRpcModule
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private GridDBService m_gridDBService; 49 private GridDBService m_gridDBService;
50 private IUGAIMCore m_gridCore; 50 private IUGAIMCore m_gridCore;
51 51
52 protected GridConfig m_config; 52 protected GridConfig m_config;
53 53
54 protected IGridMessagingMapper m_messagingServerMapper; 54 protected IGridMessagingMapper m_messagingServerMapper;
55 /// <value> 55 /// <value>
56 /// Used to notify old regions as to which OpenSim version to upgrade to 56 /// Used to notify old regions as to which OpenSim version to upgrade to
57 /// </value> 57 /// </value>
58 private string m_opensimVersion; 58 private string m_opensimVersion;
59 59
60 protected BaseHttpServer m_httpServer; 60 protected BaseHttpServer m_httpServer;
61 61
62 /// <summary> 62 /// <summary>
63 /// Constructor 63 /// Constructor
64 /// </summary> 64 /// </summary>
65 /// <param name="opensimVersion"> 65 /// <param name="opensimVersion">
66 /// Used to notify old regions as to which OpenSim version to upgrade to 66 /// Used to notify old regions as to which OpenSim version to upgrade to
67 /// </param> 67 /// </param>
68 public GridXmlRpcModule() 68 public GridXmlRpcModule()
69 { 69 {
70 } 70 }
71 71
72 public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) 72 public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config)
73 { 73 {
74 m_opensimVersion = opensimVersion; 74 m_opensimVersion = opensimVersion;
75 m_gridDBService = gridDBService; 75 m_gridDBService = gridDBService;
76 m_gridCore = gridCore; 76 m_gridCore = gridCore;
77 m_config = config; 77 m_config = config;
78 RegisterHandlers(); 78 RegisterHandlers();
79 } 79 }
80 80
81 public void PostInitialise() 81 public void PostInitialise()
82 { 82 {
83 IGridMessagingMapper messagingModule; 83 IGridMessagingMapper messagingModule;
84 if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule)) 84 if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule))
85 { 85 {
86 m_messagingServerMapper = messagingModule; 86 m_messagingServerMapper = messagingModule;
87 } 87 }
88 } 88 }
89 89
90 public void RegisterHandlers() 90 public void RegisterHandlers()
91 { 91 {
92 //have these in separate method as some servers restart the http server and reregister all the handlers. 92 //have these in separate method as some servers restart the http server and reregister all the handlers.
93 m_httpServer = m_gridCore.GetHttpServer(); 93 m_httpServer = m_gridCore.GetHttpServer();
94 94
95 m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod); 95 m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod);
96 m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod); 96 m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
97 m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", XmlRpcDeleteRegionMethod); 97 m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", XmlRpcDeleteRegionMethod);
98 m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); 98 m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod);
99 m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); 99 m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
100 } 100 }
101 101
102 /// <summary> 102 /// <summary>
103 /// Returns a XML String containing a list of the neighbouring regions 103 /// Returns a XML String containing a list of the neighbouring regions
104 /// </summary> 104 /// </summary>
105 /// <param name="reqhandle">The regionhandle for the center sim</param> 105 /// <param name="reqhandle">The regionhandle for the center sim</param>
106 /// <returns>An XML string containing neighbour entities</returns> 106 /// <returns>An XML string containing neighbour entities</returns>
107 public string GetXMLNeighbours(ulong reqhandle) 107 public string GetXMLNeighbours(ulong reqhandle)
108 { 108 {
109 string response = String.Empty; 109 string response = String.Empty;
110 RegionProfileData central_region = m_gridDBService.GetRegion(reqhandle); 110 RegionProfileData central_region = m_gridDBService.GetRegion(reqhandle);
111 RegionProfileData neighbour; 111 RegionProfileData neighbour;
112 for (int x = -1; x < 2; x++) 112 for (int x = -1; x < 2; x++)
113 { 113 {
114 for (int y = -1; y < 2; y++) 114 for (int y = -1; y < 2; y++)
115 { 115 {
116 if ( 116 if (
117 m_gridDBService.GetRegion( 117 m_gridDBService.GetRegion(
118 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), 118 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
119 (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) 119 (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null)
120 { 120 {
121 neighbour = 121 neighbour =
122 m_gridDBService.GetRegion( 122 m_gridDBService.GetRegion(
123 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), 123 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
124 (uint)(central_region.regionLocY + y) * Constants.RegionSize)); 124 (uint)(central_region.regionLocY + y) * Constants.RegionSize));
125 125
126 response += "<neighbour>"; 126 response += "<neighbour>";
127 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 127 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
128 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 128 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
129 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; 129 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
130 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; 130 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
131 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; 131 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
132 response += "</neighbour>"; 132 response += "</neighbour>";
133 } 133 }
134 } 134 }
135 } 135 }
136 return response; 136 return response;
137 } 137 }
138 138
139 /// <summary> 139 /// <summary>
140 /// Checks that it's valid to replace the existing region data with new data 140 /// Checks that it's valid to replace the existing region data with new data
141 /// 141 ///
142 /// Currently, this means ensure that the keys passed in by the new region 142 /// Currently, this means ensure that the keys passed in by the new region
143 /// match those in the original region. (XXX Is this correct? Shouldn't we simply check 143 /// match those in the original region. (XXX Is this correct? Shouldn't we simply check
144 /// against the keys in the current configuration?) 144 /// against the keys in the current configuration?)
145 /// </summary> 145 /// </summary>
146 /// <param name="sim"></param> 146 /// <param name="sim"></param>
147 /// <returns></returns> 147 /// <returns></returns>
148 protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim) 148 protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim)
149 { 149 {
150 if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey)) 150 if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey))
151 { 151 {
152 throw new LoginException( 152 throw new LoginException(
153 String.Format( 153 String.Format(
154 "Authentication failed when trying to login existing region {0} at location {1} {2} currently occupied by {3}" 154 "Authentication failed when trying to login existing region {0} at location {1} {2} currently occupied by {3}"
155 + " with the region's send key {4} (expected {5}) and the region's receive key {6} (expected {7})", 155 + " with the region's send key {4} (expected {5}) and the region's receive key {6} (expected {7})",
156 sim.regionName, sim.regionLocX, sim.regionLocY, existingSim.regionName, 156 sim.regionName, sim.regionLocX, sim.regionLocY, existingSim.regionName,
157 sim.regionSendKey, existingSim.regionSendKey, sim.regionRecvKey, existingSim.regionRecvKey), 157 sim.regionSendKey, existingSim.regionSendKey, sim.regionRecvKey, existingSim.regionRecvKey),
158 "The keys required to login your region did not match the grid server keys. Please check your grid send and receive keys."); 158 "The keys required to login your region did not match the grid server keys. Please check your grid send and receive keys.");
159 } 159 }
160 } 160 }
161 161
162 /// <summary> 162 /// <summary>
163 /// Checks that the new region data is valid. 163 /// Checks that the new region data is valid.
164 /// 164 ///
165 /// Currently, this means checking that the keys passed in by the new region 165 /// Currently, this means checking that the keys passed in by the new region
166 /// match those in the grid server's configuration. 166 /// match those in the grid server's configuration.
167 /// </summary> 167 /// </summary>
168 /// 168 ///
169 /// <param name="sim"></param> 169 /// <param name="sim"></param>
170 /// <exception cref="LoginException">Thrown if region login failed</exception> 170 /// <exception cref="LoginException">Thrown if region login failed</exception>
171 protected virtual void ValidateNewRegionKeys(RegionProfileData sim) 171 protected virtual void ValidateNewRegionKeys(RegionProfileData sim)
172 { 172 {
173 if (!(sim.regionRecvKey == m_config.SimSendKey && sim.regionSendKey == m_config.SimRecvKey)) 173 if (!(sim.regionRecvKey == m_config.SimSendKey && sim.regionSendKey == m_config.SimRecvKey))
174 { 174 {
175 throw new LoginException( 175 throw new LoginException(
176 String.Format( 176 String.Format(
177 "Authentication failed when trying to login new region {0} at location {1} {2}" 177 "Authentication failed when trying to login new region {0} at location {1} {2}"
178 + " with the region's send key {3} (expected {4}) and the region's receive key {5} (expected {6})", 178 + " with the region's send key {3} (expected {4}) and the region's receive key {5} (expected {6})",
179 sim.regionName, sim.regionLocX, sim.regionLocY, 179 sim.regionName, sim.regionLocX, sim.regionLocY,
180 sim.regionSendKey, m_config.SimRecvKey, sim.regionRecvKey, m_config.SimSendKey), 180 sim.regionSendKey, m_config.SimRecvKey, sim.regionRecvKey, m_config.SimSendKey),
181 "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys."); 181 "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys.");
182 } 182 }
183 } 183 }
184 184
185 /// <summary> 185 /// <summary>
186 /// Check that a region's http uri is externally contactable. 186 /// Check that a region's http uri is externally contactable.
187 /// </summary> 187 /// </summary>
188 /// <param name="sim"></param> 188 /// <param name="sim"></param>
189 /// <exception cref="LoginException">Thrown if the region is not contactable</exception> 189 /// <exception cref="LoginException">Thrown if the region is not contactable</exception>
190 protected virtual void ValidateRegionContactable(RegionProfileData sim) 190 protected virtual void ValidateRegionContactable(RegionProfileData sim)
191 { 191 {
192 string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/"); 192 string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/");
193 string regionStatusResponse; 193 string regionStatusResponse;
194 194
195 RestClient rc = new RestClient(regionStatusUrl); 195 RestClient rc = new RestClient(regionStatusUrl);
196 rc.RequestMethod = "GET"; 196 rc.RequestMethod = "GET";
197 197
198 m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName); 198 m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName);
199 199
200 try 200 try
201 { 201 {
202 Stream rs = rc.Request(); 202 Stream rs = rc.Request();
203 StreamReader sr = new StreamReader(rs); 203 StreamReader sr = new StreamReader(rs);
204 regionStatusResponse = sr.ReadToEnd(); 204 regionStatusResponse = sr.ReadToEnd();
205 sr.Close(); 205 sr.Close();
206 } 206 }
207 catch (Exception e) 207 catch (Exception e)
208 { 208 {
209 throw new LoginException( 209 throw new LoginException(
210 String.Format("Region status request to {0} failed", regionStatusUrl), 210 String.Format("Region status request to {0} failed", regionStatusUrl),
211 String.Format( 211 String.Format(
212 "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service", 212 "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service",
213 regionStatusUrl), 213 regionStatusUrl),
214 e); 214 e);
215 } 215 }
216 216
217 if (!regionStatusResponse.Equals("OK")) 217 if (!regionStatusResponse.Equals("OK"))
218 { 218 {
219 throw new LoginException( 219 throw new LoginException(
220 String.Format( 220 String.Format(
221 "Region {0} at {1} returned status response {2} rather than {3}", 221 "Region {0} at {1} returned status response {2} rather than {3}",
222 sim.regionName, regionStatusUrl, regionStatusResponse, "OK"), 222 sim.regionName, regionStatusUrl, regionStatusResponse, "OK"),
223 String.Format( 223 String.Format(
224 "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status", 224 "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status",
225 regionStatusResponse, "OK")); 225 regionStatusResponse, "OK"));
226 } 226 }
227 } 227 }
228 228
229 /// <summary> 229 /// <summary>
230 /// Construct an XMLRPC error response 230 /// Construct an XMLRPC error response
231 /// </summary> 231 /// </summary>
232 /// <param name="error"></param> 232 /// <param name="error"></param>
233 /// <returns></returns> 233 /// <returns></returns>
234 public static XmlRpcResponse ErrorResponse(string error) 234 public static XmlRpcResponse ErrorResponse(string error)
235 { 235 {
236 XmlRpcResponse errorResponse = new XmlRpcResponse(); 236 XmlRpcResponse errorResponse = new XmlRpcResponse();
237 Hashtable errorResponseData = new Hashtable(); 237 Hashtable errorResponseData = new Hashtable();
238 errorResponse.Value = errorResponseData; 238 errorResponse.Value = errorResponseData;
239 errorResponseData["error"] = error; 239 errorResponseData["error"] = error;
240 return errorResponse; 240 return errorResponse;
241 } 241 }
242 242
243 /// <summary> 243 /// <summary>
244 /// Performed when a region connects to the grid server initially. 244 /// Performed when a region connects to the grid server initially.
245 /// </summary> 245 /// </summary>
246 /// <param name="request">The XML RPC Request</param> 246 /// <param name="request">The XML RPC Request</param>
247 /// <returns>Startup parameters</returns> 247 /// <returns>Startup parameters</returns>
248 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) 248 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
249 { 249 {
250 RegionProfileData sim; 250 RegionProfileData sim;
251 RegionProfileData existingSim; 251 RegionProfileData existingSim;
252 252
253 Hashtable requestData = (Hashtable)request.Params[0]; 253 Hashtable requestData = (Hashtable)request.Params[0];
254 UUID uuid; 254 UUID uuid;
255 255
256 if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid)) 256 if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid))
257 { 257 {
258 m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response."); 258 m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response.");
259 return ErrorResponse("No UUID passed to grid server - unable to connect you"); 259 return ErrorResponse("No UUID passed to grid server - unable to connect you");
260 } 260 }
261 261
262 try 262 try
263 { 263 {
264 sim = RegionFromRequest(requestData); 264 sim = RegionFromRequest(requestData);
265 } 265 }
266 catch (FormatException e) 266 catch (FormatException e)
267 { 267 {
268 m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); 268 m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
269 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); 269 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
270 } 270 }
271 271
272 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); 272 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
273 273
274 if (!m_config.AllowRegionRegistration) 274 if (!m_config.AllowRegionRegistration)
275 { 275 {
276 m_log.DebugFormat( 276 m_log.DebugFormat(
277 "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}", 277 "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}",
278 sim.regionName); 278 sim.regionName);
279 279
280 return ErrorResponse("This grid is currently not accepting region registrations."); 280 return ErrorResponse("This grid is currently not accepting region registrations.");
281 } 281 }
282 282
283 int majorInterfaceVersion = 0; 283 int majorInterfaceVersion = 0;
284 if (requestData.ContainsKey("major_interface_version")) 284 if (requestData.ContainsKey("major_interface_version"))
285 int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion); 285 int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion);
286 286
287 if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion) 287 if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion)
288 { 288 {
289 return ErrorResponse( 289 return ErrorResponse(
290 String.Format( 290 String.Format(
291 "Your region service implements OGS1 interface version {0}" 291 "Your region service implements OGS1 interface version {0}"
292 + " but this grid requires that the region implement OGS1 interface version {1} to connect." 292 + " but this grid requires that the region implement OGS1 interface version {1} to connect."
293 + " Try changing to OpenSimulator {2}", 293 + " Try changing to OpenSimulator {2}",
294 majorInterfaceVersion, VersionInfo.MajorInterfaceVersion, m_opensimVersion)); 294 majorInterfaceVersion, VersionInfo.MajorInterfaceVersion, m_opensimVersion));
295 } 295 }
296 296
297 existingSim = m_gridDBService.GetRegion(sim.regionHandle); 297 existingSim = m_gridDBService.GetRegion(sim.regionHandle);
298 298
299 if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) 299 if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID)
300 { 300 {
301 try 301 try
302 { 302 {
303 if (existingSim == null) 303 if (existingSim == null)
304 { 304 {
305 ValidateNewRegionKeys(sim); 305 ValidateNewRegionKeys(sim);
306 } 306 }
307 else 307 else
308 { 308 {
309 ValidateOverwriteKeys(sim, existingSim); 309 ValidateOverwriteKeys(sim, existingSim);
310 } 310 }
311 311
312 ValidateRegionContactable(sim); 312 ValidateRegionContactable(sim);
313 } 313 }
314 catch (LoginException e) 314 catch (LoginException e)
315 { 315 {
316 string logMsg = e.Message; 316 string logMsg = e.Message;
317 if (e.InnerException != null) 317 if (e.InnerException != null)
318 logMsg += ", " + e.InnerException.Message; 318 logMsg += ", " + e.InnerException.Message;
319 319
320 m_log.WarnFormat("[LOGIN END]: {0}", logMsg); 320 m_log.WarnFormat("[LOGIN END]: {0}", logMsg);
321 321
322 return e.XmlRpcErrorResponse; 322 return e.XmlRpcErrorResponse;
323 } 323 }
324 324
325 DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim); 325 DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim);
326 326
327 switch (insertResponse) 327 switch (insertResponse)
328 { 328 {
329 case DataResponse.RESPONSE_OK: 329 case DataResponse.RESPONSE_OK:
330 m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName); 330 m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName);
331 break; 331 break;
332 case DataResponse.RESPONSE_ERROR: 332 case DataResponse.RESPONSE_ERROR:
333 m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName); 333 m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName);
334 break; 334 break;
335 case DataResponse.RESPONSE_INVALIDCREDENTIALS: 335 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
336 m_log.Warn("[LOGIN END]: " + 336 m_log.Warn("[LOGIN END]: " +
337 "Sim login failed (Invalid Credentials): " + sim.regionName); 337 "Sim login failed (Invalid Credentials): " + sim.regionName);
338 break; 338 break;
339 case DataResponse.RESPONSE_AUTHREQUIRED: 339 case DataResponse.RESPONSE_AUTHREQUIRED:
340 m_log.Warn("[LOGIN END]: " + 340 m_log.Warn("[LOGIN END]: " +
341 "Sim login failed (Authentication Required): " + 341 "Sim login failed (Authentication Required): " +
342 sim.regionName); 342 sim.regionName);
343 break; 343 break;
344 } 344 }
345 345
346 XmlRpcResponse response = CreateLoginResponse(sim); 346 XmlRpcResponse response = CreateLoginResponse(sim);
347 347
348 return response; 348 return response;
349 } 349 }
350 else 350 else
351 { 351 {
352 m_log.Warn("[LOGIN END]: Failed to login region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); 352 m_log.Warn("[LOGIN END]: Failed to login region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
353 return ErrorResponse("Another region already exists at that location. Please try another."); 353 return ErrorResponse("Another region already exists at that location. Please try another.");
354 } 354 }
355 } 355 }
356 356
357 /// <summary> 357 /// <summary>
358 /// Construct a successful response to a simulator's login attempt. 358 /// Construct a successful response to a simulator's login attempt.
359 /// </summary> 359 /// </summary>
360 /// <param name="sim"></param> 360 /// <param name="sim"></param>
361 /// <returns></returns> 361 /// <returns></returns>
362 private XmlRpcResponse CreateLoginResponse(RegionProfileData sim) 362 private XmlRpcResponse CreateLoginResponse(RegionProfileData sim)
363 { 363 {
364 XmlRpcResponse response = new XmlRpcResponse(); 364 XmlRpcResponse response = new XmlRpcResponse();
365 Hashtable responseData = new Hashtable(); 365 Hashtable responseData = new Hashtable();
366 response.Value = responseData; 366 response.Value = responseData;
367 367
368 ArrayList SimNeighboursData = GetSimNeighboursData(sim); 368 ArrayList SimNeighboursData = GetSimNeighboursData(sim);
369 369
370 responseData["UUID"] = sim.UUID.ToString(); 370 responseData["UUID"] = sim.UUID.ToString();
371 responseData["region_locx"] = sim.regionLocX.ToString(); 371 responseData["region_locx"] = sim.regionLocX.ToString();
372 responseData["region_locy"] = sim.regionLocY.ToString(); 372 responseData["region_locy"] = sim.regionLocY.ToString();
373 responseData["regionname"] = sim.regionName; 373 responseData["regionname"] = sim.regionName;
374 responseData["estate_id"] = "1"; 374 responseData["estate_id"] = "1";
375 responseData["neighbours"] = SimNeighboursData; 375 responseData["neighbours"] = SimNeighboursData;
376 376
377 responseData["sim_ip"] = sim.serverIP; 377 responseData["sim_ip"] = sim.serverIP;
378 responseData["sim_port"] = sim.serverPort.ToString(); 378 responseData["sim_port"] = sim.serverPort.ToString();
379 responseData["asset_url"] = sim.regionAssetURI; 379 responseData["asset_url"] = sim.regionAssetURI;
380 responseData["asset_sendkey"] = sim.regionAssetSendKey; 380 responseData["asset_sendkey"] = sim.regionAssetSendKey;
381 responseData["asset_recvkey"] = sim.regionAssetRecvKey; 381 responseData["asset_recvkey"] = sim.regionAssetRecvKey;
382 responseData["user_url"] = sim.regionUserURI; 382 responseData["user_url"] = sim.regionUserURI;
383 responseData["user_sendkey"] = sim.regionUserSendKey; 383 responseData["user_sendkey"] = sim.regionUserSendKey;
384 responseData["user_recvkey"] = sim.regionUserRecvKey; 384 responseData["user_recvkey"] = sim.regionUserRecvKey;
385 responseData["authkey"] = sim.regionSecret; 385 responseData["authkey"] = sim.regionSecret;
386 386
387 // New! If set, use as URL to local sim storage (ie http://remotehost/region.Yap) 387 // New! If set, use as URL to local sim storage (ie http://remotehost/region.Yap)
388 responseData["data_uri"] = sim.regionDataURI; 388 responseData["data_uri"] = sim.regionDataURI;
389 389
390 responseData["allow_forceful_banlines"] = m_config.AllowForcefulBanlines; 390 responseData["allow_forceful_banlines"] = m_config.AllowForcefulBanlines;
391 391
392 // Instead of sending a multitude of message servers to the registering sim 392 // Instead of sending a multitude of message servers to the registering sim
393 // we should probably be sending a single one and parhaps it's backup 393 // we should probably be sending a single one and parhaps it's backup
394 // that has responsibility over routing it's messages. 394 // that has responsibility over routing it's messages.
395 395
396 // The Sim won't be contacting us again about any of the message server stuff during it's time up. 396 // The Sim won't be contacting us again about any of the message server stuff during it's time up.
397 397
398 responseData["messageserver_count"] = 0; 398 responseData["messageserver_count"] = 0;
399 399
400 // IGridMessagingModule messagingModule; 400 // IGridMessagingModule messagingModule;
401 // if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule)) 401 // if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule))
402 //{ 402 //{
403 if(m_messagingServerMapper != null) 403 if(m_messagingServerMapper != null)
404 { 404 {
405 List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList(); 405 List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList();
406 responseData["messageserver_count"] = messageServers.Count; 406 responseData["messageserver_count"] = messageServers.Count;
407 407
408 for (int i = 0; i < messageServers.Count; i++) 408 for (int i = 0; i < messageServers.Count; i++)
409 { 409 {
410 responseData["messageserver_uri" + i] = messageServers[i].URI; 410 responseData["messageserver_uri" + i] = messageServers[i].URI;
411 responseData["messageserver_sendkey" + i] = messageServers[i].sendkey; 411 responseData["messageserver_sendkey" + i] = messageServers[i].sendkey;
412 responseData["messageserver_recvkey" + i] = messageServers[i].recvkey; 412 responseData["messageserver_recvkey" + i] = messageServers[i].recvkey;
413 } 413 }
414 } 414 }
415 return response; 415 return response;
416 } 416 }
417 417
418 private ArrayList GetSimNeighboursData(RegionProfileData sim) 418 private ArrayList GetSimNeighboursData(RegionProfileData sim)
419 { 419 {
420 ArrayList SimNeighboursData = new ArrayList(); 420 ArrayList SimNeighboursData = new ArrayList();
421 421
422 RegionProfileData neighbour; 422 RegionProfileData neighbour;
423 Hashtable NeighbourBlock; 423 Hashtable NeighbourBlock;
424 424
425 //First use the fast method. (not implemented in SQLLite) 425 //First use the fast method. (not implemented in SQLLite)
426 List<RegionProfileData> neighbours = m_gridDBService.GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1); 426 List<RegionProfileData> neighbours = m_gridDBService.GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1);
427 427
428 if (neighbours.Count > 0) 428 if (neighbours.Count > 0)
429 { 429 {
430 foreach (RegionProfileData aSim in neighbours) 430 foreach (RegionProfileData aSim in neighbours)
431 { 431 {
432 NeighbourBlock = new Hashtable(); 432 NeighbourBlock = new Hashtable();
433 NeighbourBlock["sim_ip"] = aSim.serverIP; 433 NeighbourBlock["sim_ip"] = aSim.serverIP;
434 NeighbourBlock["sim_port"] = aSim.serverPort.ToString(); 434 NeighbourBlock["sim_port"] = aSim.serverPort.ToString();
435 NeighbourBlock["region_locx"] = aSim.regionLocX.ToString(); 435 NeighbourBlock["region_locx"] = aSim.regionLocX.ToString();
436 NeighbourBlock["region_locy"] = aSim.regionLocY.ToString(); 436 NeighbourBlock["region_locy"] = aSim.regionLocY.ToString();
437 NeighbourBlock["UUID"] = aSim.ToString(); 437 NeighbourBlock["UUID"] = aSim.ToString();
438 NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString(); 438 NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString();
439 439
440 if (aSim.UUID != sim.UUID) 440 if (aSim.UUID != sim.UUID)
441 { 441 {
442 SimNeighboursData.Add(NeighbourBlock); 442 SimNeighboursData.Add(NeighbourBlock);
443 } 443 }
444 } 444 }
445 } 445 }
446 else 446 else
447 { 447 {
448 for (int x = -1; x < 2; x++) 448 for (int x = -1; x < 2; x++)
449 { 449 {
450 for (int y = -1; y < 2; y++) 450 for (int y = -1; y < 2; y++)
451 { 451 {
452 if ( 452 if (
453 m_gridDBService.GetRegion( 453 m_gridDBService.GetRegion(
454 Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), 454 Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
455 (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) 455 (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null)
456 { 456 {
457 neighbour = 457 neighbour =
458 m_gridDBService.GetRegion( 458 m_gridDBService.GetRegion(
459 Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), 459 Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
460 (uint)(sim.regionLocY + y) * Constants.RegionSize)); 460 (uint)(sim.regionLocY + y) * Constants.RegionSize));
461 461
462 NeighbourBlock = new Hashtable(); 462 NeighbourBlock = new Hashtable();
463 NeighbourBlock["sim_ip"] = neighbour.serverIP; 463 NeighbourBlock["sim_ip"] = neighbour.serverIP;
464 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); 464 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
465 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); 465 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
466 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); 466 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
467 NeighbourBlock["UUID"] = neighbour.UUID.ToString(); 467 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
468 NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString(); 468 NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString();
469 469
470 if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock); 470 if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock);
471 } 471 }
472 } 472 }
473 } 473 }
474 } 474 }
475 return SimNeighboursData; 475 return SimNeighboursData;
476 } 476 }
477 477
478 /// <summary> 478 /// <summary>
479 /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region 479 /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region
480 /// </summary> 480 /// </summary>
481 /// <param name="requestData"></param> 481 /// <param name="requestData"></param>
482 /// <returns></returns> 482 /// <returns></returns>
483 private RegionProfileData RegionFromRequest(Hashtable requestData) 483 private RegionProfileData RegionFromRequest(Hashtable requestData)
484 { 484 {
485 RegionProfileData sim; 485 RegionProfileData sim;
486 sim = new RegionProfileData(); 486 sim = new RegionProfileData();
487 487
488 sim.UUID = new UUID((string)requestData["UUID"]); 488 sim.UUID = new UUID((string)requestData["UUID"]);
489 sim.originUUID = new UUID((string)requestData["originUUID"]); 489 sim.originUUID = new UUID((string)requestData["originUUID"]);
490 490
491 sim.regionRecvKey = String.Empty; 491 sim.regionRecvKey = String.Empty;
492 sim.regionSendKey = String.Empty; 492 sim.regionSendKey = String.Empty;
493 493
494 if (requestData.ContainsKey("region_secret")) 494 if (requestData.ContainsKey("region_secret"))
495 { 495 {
496 string regionsecret = (string)requestData["region_secret"]; 496 string regionsecret = (string)requestData["region_secret"];
497 if (regionsecret.Length > 0) 497 if (regionsecret.Length > 0)
498 sim.regionSecret = regionsecret; 498 sim.regionSecret = regionsecret;
499 else 499 else
500 sim.regionSecret = m_config.SimRecvKey; 500 sim.regionSecret = m_config.SimRecvKey;
501 501
502 } 502 }
503 else 503 else
504 { 504 {
505 sim.regionSecret = m_config.SimRecvKey; 505 sim.regionSecret = m_config.SimRecvKey;
506 } 506 }
507 507
508 sim.regionDataURI = String.Empty; 508 sim.regionDataURI = String.Empty;
509 sim.regionAssetURI = m_config.DefaultAssetServer; 509 sim.regionAssetURI = m_config.DefaultAssetServer;
510 sim.regionAssetRecvKey = m_config.AssetRecvKey; 510 sim.regionAssetRecvKey = m_config.AssetRecvKey;
511 sim.regionAssetSendKey = m_config.AssetSendKey; 511 sim.regionAssetSendKey = m_config.AssetSendKey;
512 sim.regionUserURI = m_config.DefaultUserServer; 512 sim.regionUserURI = m_config.DefaultUserServer;
513 sim.regionUserSendKey = m_config.UserSendKey; 513 sim.regionUserSendKey = m_config.UserSendKey;
514 sim.regionUserRecvKey = m_config.UserRecvKey; 514 sim.regionUserRecvKey = m_config.UserRecvKey;
515 515
516 sim.serverIP = (string)requestData["sim_ip"]; 516 sim.serverIP = (string)requestData["sim_ip"];
517 sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); 517 sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
518 sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); 518 sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
519 sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); 519 sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
520 sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); 520 sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
521 sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); 521 sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
522 sim.regionLocZ = 0; 522 sim.regionLocZ = 0;
523 523
524 UUID textureID; 524 UUID textureID;
525 if (UUID.TryParse((string)requestData["map-image-id"], out textureID)) 525 if (UUID.TryParse((string)requestData["map-image-id"], out textureID))
526 { 526 {
527 sim.regionMapTextureID = textureID; 527 sim.regionMapTextureID = textureID;
528 } 528 }
529 529
530 // part of an initial brutish effort to provide accurate information (as per the xml region spec) 530 // part of an initial brutish effort to provide accurate information (as per the xml region spec)
531 // wrt the ownership of a given region 531 // wrt the ownership of a given region
532 // the (very bad) assumption is that this value is being read and handled inconsistently or 532 // the (very bad) assumption is that this value is being read and handled inconsistently or
533 // not at all. Current strategy is to put the code in place to support the validity of this information 533 // not at all. Current strategy is to put the code in place to support the validity of this information
534 // and to roll forward debugging any issues from that point 534 // and to roll forward debugging any issues from that point
535 // 535 //
536 // this particular section of the mod attempts to receive a value from the region's xml file by way of 536 // this particular section of the mod attempts to receive a value from the region's xml file by way of
537 // OSG1GridServices for the region's owner 537 // OSG1GridServices for the region's owner
538 sim.owner_uuid = (UUID)(string)requestData["master_avatar_uuid"]; 538 sim.owner_uuid = (UUID)(string)requestData["master_avatar_uuid"];
539 539
540 try 540 try
541 { 541 {
542 sim.regionRecvKey = (string)requestData["recvkey"]; 542 sim.regionRecvKey = (string)requestData["recvkey"];
543 sim.regionSendKey = (string)requestData["authkey"]; 543 sim.regionSendKey = (string)requestData["authkey"];
544 } 544 }
545 catch (KeyNotFoundException) { } 545 catch (KeyNotFoundException) { }
546 546
547 sim.regionHandle = Utils.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); 547 sim.regionHandle = Utils.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
548 sim.serverURI = (string)requestData["server_uri"]; 548 sim.serverURI = (string)requestData["server_uri"];
549 549
550 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; 550 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
551 551
552 sim.regionName = (string)requestData["sim_name"]; 552 sim.regionName = (string)requestData["sim_name"];
553 return sim; 553 return sim;
554 } 554 }
555 555
556 /// <summary> 556 /// <summary>
557 /// Returns an XML RPC response to a simulator profile request 557 /// Returns an XML RPC response to a simulator profile request
558 /// Performed after moving a region. 558 /// Performed after moving a region.
559 /// </summary> 559 /// </summary>
560 /// <param name="request"></param> 560 /// <param name="request"></param>
561 /// <returns></returns> 561 /// <returns></returns>
562 /// <param name="request">The XMLRPC Request</param> 562 /// <param name="request">The XMLRPC Request</param>
563 /// <returns>Processing parameters</returns> 563 /// <returns>Processing parameters</returns>
564 public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) 564 public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request)
565 { 565 {
566 XmlRpcResponse response = new XmlRpcResponse(); 566 XmlRpcResponse response = new XmlRpcResponse();
567 Hashtable responseData = new Hashtable(); 567 Hashtable responseData = new Hashtable();
568 response.Value = responseData; 568 response.Value = responseData;
569 569
570 //RegionProfileData TheSim = null; 570 //RegionProfileData TheSim = null;
571 string uuid; 571 string uuid;
572 Hashtable requestData = (Hashtable)request.Params[0]; 572 Hashtable requestData = (Hashtable)request.Params[0];
573 573
574 if (requestData.ContainsKey("UUID")) 574 if (requestData.ContainsKey("UUID"))
575 { 575 {
576 //TheSim = GetRegion(new UUID((string) requestData["UUID"])); 576 //TheSim = GetRegion(new UUID((string) requestData["UUID"]));
577 uuid = requestData["UUID"].ToString(); 577 uuid = requestData["UUID"].ToString();
578 m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid); 578 m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid);
579 // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); 579 // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID.");
580 } 580 }
581 else 581 else
582 { 582 {
583 responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; 583 responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete";
584 return response; 584 return response;
585 } 585 }
586 586
587 DataResponse insertResponse = m_gridDBService.DeleteRegion(uuid); 587 DataResponse insertResponse = m_gridDBService.DeleteRegion(uuid);
588 588
589 string insertResp = ""; 589 string insertResp = "";
590 switch (insertResponse) 590 switch (insertResponse)
591 { 591 {
592 case DataResponse.RESPONSE_OK: 592 case DataResponse.RESPONSE_OK:
593 //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); 593 //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid);
594 insertResp = "Deleting region successful: " + uuid; 594 insertResp = "Deleting region successful: " + uuid;
595 break; 595 break;
596 case DataResponse.RESPONSE_ERROR: 596 case DataResponse.RESPONSE_ERROR:
597 //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid); 597 //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid);
598 insertResp = "Deleting region failed (Error): " + uuid; 598 insertResp = "Deleting region failed (Error): " + uuid;
599 break; 599 break;
600 case DataResponse.RESPONSE_INVALIDCREDENTIALS: 600 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
601 //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid); 601 //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid);
602 insertResp = "Deleting region (Invalid Credentials): " + uuid; 602 insertResp = "Deleting region (Invalid Credentials): " + uuid;
603 break; 603 break;
604 case DataResponse.RESPONSE_AUTHREQUIRED: 604 case DataResponse.RESPONSE_AUTHREQUIRED:
605 //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid); 605 //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid);
606 insertResp = "Deleting region (Authentication Required): " + uuid; 606 insertResp = "Deleting region (Authentication Required): " + uuid;
607 break; 607 break;
608 } 608 }
609 609
610 responseData["status"] = insertResp; 610 responseData["status"] = insertResp;
611 611
612 return response; 612 return response;
613 } 613 }
614 614
615 /// <summary> 615 /// <summary>
616 /// Returns an XML RPC response to a simulator profile request 616 /// Returns an XML RPC response to a simulator profile request
617 /// </summary> 617 /// </summary>
618 /// <param name="request"></param> 618 /// <param name="request"></param>
619 /// <returns></returns> 619 /// <returns></returns>
620 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 620 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
621 { 621 {
622 Hashtable requestData = (Hashtable)request.Params[0]; 622 Hashtable requestData = (Hashtable)request.Params[0];
623 Hashtable responseData = new Hashtable(); 623 Hashtable responseData = new Hashtable();
624 RegionProfileData simData = null; 624 RegionProfileData simData = null;
625 if (requestData.ContainsKey("region_UUID")) 625 if (requestData.ContainsKey("region_UUID"))
626 { 626 {
627 UUID regionID = new UUID((string)requestData["region_UUID"]); 627 UUID regionID = new UUID((string)requestData["region_UUID"]);
628 simData = m_gridDBService.GetRegion(regionID); 628 simData = m_gridDBService.GetRegion(regionID);
629 if (simData == null) 629 if (simData == null)
630 { 630 {
631 m_log.WarnFormat("[DATA] didn't find region for regionID {0} from {1}", 631 m_log.WarnFormat("[DATA] didn't find region for regionID {0} from {1}",
632 regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); 632 regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
633 } 633 }
634 } 634 }
635 else if (requestData.ContainsKey("region_handle")) 635 else if (requestData.ContainsKey("region_handle"))
636 { 636 {
637 //CFK: The if/else below this makes this message redundant. 637 //CFK: The if/else below this makes this message redundant.
638 //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]); 638 //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]);
639 ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]); 639 ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]);
640 simData = m_gridDBService.GetRegion(regionHandle); 640 simData = m_gridDBService.GetRegion(regionHandle);
641 if (simData == null) 641 if (simData == null)
642 { 642 {
643 m_log.WarnFormat("[DATA] didn't find region for regionHandle {0} from {1}", 643 m_log.WarnFormat("[DATA] didn't find region for regionHandle {0} from {1}",
644 regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); 644 regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
645 } 645 }
646 } 646 }
647 else if (requestData.ContainsKey("region_name_search")) 647 else if (requestData.ContainsKey("region_name_search"))
648 { 648 {
649 string regionName = (string)requestData["region_name_search"]; 649 string regionName = (string)requestData["region_name_search"];
650 simData = m_gridDBService.GetRegion(regionName); 650 simData = m_gridDBService.GetRegion(regionName);
651 if (simData == null) 651 if (simData == null)
652 { 652 {
653 m_log.WarnFormat("[DATA] didn't find region for regionName {0} from {1}", 653 m_log.WarnFormat("[DATA] didn't find region for regionName {0} from {1}",
654 regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); 654 regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
655 } 655 }
656 } 656 }
657 else m_log.Warn("[DATA] regionlookup without regionID, regionHandle or regionHame"); 657 else m_log.Warn("[DATA] regionlookup without regionID, regionHandle or regionHame");
658 658
659 if (simData == null) 659 if (simData == null)
660 { 660 {
661 //Sim does not exist 661 //Sim does not exist
662 responseData["error"] = "Sim does not exist"; 662 responseData["error"] = "Sim does not exist";
663 } 663 }
664 else 664 else
665 { 665 {
666 m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + 666 m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " +
667 (string)requestData["region_handle"]); 667 (string)requestData["region_handle"]);
668 responseData["sim_ip"] = simData.serverIP; 668 responseData["sim_ip"] = simData.serverIP;
669 responseData["sim_port"] = simData.serverPort.ToString(); 669 responseData["sim_port"] = simData.serverPort.ToString();
670 responseData["server_uri"] = simData.serverURI; 670 responseData["server_uri"] = simData.serverURI;
671 responseData["http_port"] = simData.httpPort.ToString(); 671 responseData["http_port"] = simData.httpPort.ToString();
672 responseData["remoting_port"] = simData.remotingPort.ToString(); 672 responseData["remoting_port"] = simData.remotingPort.ToString();
673 responseData["region_locx"] = simData.regionLocX.ToString(); 673 responseData["region_locx"] = simData.regionLocX.ToString();
674 responseData["region_locy"] = simData.regionLocY.ToString(); 674 responseData["region_locy"] = simData.regionLocY.ToString();
675 responseData["region_UUID"] = simData.UUID.Guid.ToString(); 675 responseData["region_UUID"] = simData.UUID.Guid.ToString();
676 responseData["region_name"] = simData.regionName; 676 responseData["region_name"] = simData.regionName;
677 responseData["regionHandle"] = simData.regionHandle.ToString(); 677 responseData["regionHandle"] = simData.regionHandle.ToString();
678 } 678 }
679 679
680 XmlRpcResponse response = new XmlRpcResponse(); 680 XmlRpcResponse response = new XmlRpcResponse();
681 response.Value = responseData; 681 response.Value = responseData;
682 return response; 682 return response;
683 } 683 }
684 684
685 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) 685 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
686 { 686 {
687 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; 687 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
688 688
689 Hashtable requestData = (Hashtable)request.Params[0]; 689 Hashtable requestData = (Hashtable)request.Params[0];
690 if (requestData.ContainsKey("xmin")) 690 if (requestData.ContainsKey("xmin"))
691 { 691 {
692 xmin = (Int32)requestData["xmin"]; 692 xmin = (Int32)requestData["xmin"];
693 } 693 }
694 if (requestData.ContainsKey("ymin")) 694 if (requestData.ContainsKey("ymin"))
695 { 695 {
696 ymin = (Int32)requestData["ymin"]; 696 ymin = (Int32)requestData["ymin"];
697 } 697 }
698 if (requestData.ContainsKey("xmax")) 698 if (requestData.ContainsKey("xmax"))
699 { 699 {
700 xmax = (Int32)requestData["xmax"]; 700 xmax = (Int32)requestData["xmax"];
701 } 701 }
702 if (requestData.ContainsKey("ymax")) 702 if (requestData.ContainsKey("ymax"))
703 { 703 {
704 ymax = (Int32)requestData["ymax"]; 704 ymax = (Int32)requestData["ymax"];
705 } 705 }
706 //CFK: The second log is more meaningful and either standard or fast generally occurs. 706 //CFK: The second log is more meaningful and either standard or fast generally occurs.
707 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 707 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
708 708
709 XmlRpcResponse response = new XmlRpcResponse(); 709 XmlRpcResponse response = new XmlRpcResponse();
710 Hashtable responseData = new Hashtable(); 710 Hashtable responseData = new Hashtable();
711 response.Value = responseData; 711 response.Value = responseData;
712 IList simProfileList = new ArrayList(); 712 IList simProfileList = new ArrayList();
713 713
714 bool fastMode = (m_config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || m_config.DatabaseProvider == "OpenSim.Data.MSSQL.dll"); 714 bool fastMode = (m_config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || m_config.DatabaseProvider == "OpenSim.Data.MSSQL.dll");
715 715
716 if (fastMode) 716 if (fastMode)
717 { 717 {
718 List<RegionProfileData> neighbours = m_gridDBService.GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); 718 List<RegionProfileData> neighbours = m_gridDBService.GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
719 719
720 foreach (RegionProfileData aSim in neighbours) 720 foreach (RegionProfileData aSim in neighbours)
721 { 721 {
722 Hashtable simProfileBlock = new Hashtable(); 722 Hashtable simProfileBlock = new Hashtable();
723 simProfileBlock["x"] = aSim.regionLocX.ToString(); 723 simProfileBlock["x"] = aSim.regionLocX.ToString();
724 simProfileBlock["y"] = aSim.regionLocY.ToString(); 724 simProfileBlock["y"] = aSim.regionLocY.ToString();
725 //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY); 725 //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY);
726 simProfileBlock["name"] = aSim.regionName; 726 simProfileBlock["name"] = aSim.regionName;
727 simProfileBlock["access"] = 21; 727 simProfileBlock["access"] = 21;
728 simProfileBlock["region-flags"] = 512; 728 simProfileBlock["region-flags"] = 512;
729 simProfileBlock["water-height"] = 0; 729 simProfileBlock["water-height"] = 0;
730 simProfileBlock["agents"] = 1; 730 simProfileBlock["agents"] = 1;
731 simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString(); 731 simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString();
732 732
733 // For Sugilite compatibility 733 // For Sugilite compatibility
734 simProfileBlock["regionhandle"] = aSim.regionHandle.ToString(); 734 simProfileBlock["regionhandle"] = aSim.regionHandle.ToString();
735 simProfileBlock["sim_ip"] = aSim.serverIP; 735 simProfileBlock["sim_ip"] = aSim.serverIP;
736 simProfileBlock["sim_port"] = aSim.serverPort.ToString(); 736 simProfileBlock["sim_port"] = aSim.serverPort.ToString();
737 simProfileBlock["sim_uri"] = aSim.serverURI.ToString(); 737 simProfileBlock["sim_uri"] = aSim.serverURI.ToString();
738 simProfileBlock["uuid"] = aSim.UUID.ToString(); 738 simProfileBlock["uuid"] = aSim.UUID.ToString();
739 simProfileBlock["remoting_port"] = aSim.remotingPort.ToString(); 739 simProfileBlock["remoting_port"] = aSim.remotingPort.ToString();
740 simProfileBlock["http_port"] = aSim.httpPort.ToString(); 740 simProfileBlock["http_port"] = aSim.httpPort.ToString();
741 741
742 simProfileList.Add(simProfileBlock); 742 simProfileList.Add(simProfileBlock);
743 } 743 }
744 m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + 744 m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() +
745 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 745 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
746 } 746 }
747 else 747 else
748 { 748 {
749 RegionProfileData simProfile; 749 RegionProfileData simProfile;
750 for (int x = xmin; x < xmax + 1; x++) 750 for (int x = xmin; x < xmax + 1; x++)
751 { 751 {
752 for (int y = ymin; y < ymax + 1; y++) 752 for (int y = ymin; y < ymax + 1; y++)
753 { 753 {
754 ulong regHandle = Utils.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); 754 ulong regHandle = Utils.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
755 simProfile = m_gridDBService.GetRegion(regHandle); 755 simProfile = m_gridDBService.GetRegion(regHandle);
756 if (simProfile != null) 756 if (simProfile != null)
757 { 757 {
758 Hashtable simProfileBlock = new Hashtable(); 758 Hashtable simProfileBlock = new Hashtable();
759 simProfileBlock["x"] = x; 759 simProfileBlock["x"] = x;
760 simProfileBlock["y"] = y; 760 simProfileBlock["y"] = y;
761 simProfileBlock["name"] = simProfile.regionName; 761 simProfileBlock["name"] = simProfile.regionName;
762 simProfileBlock["access"] = 0; 762 simProfileBlock["access"] = 0;
763 simProfileBlock["region-flags"] = 0; 763 simProfileBlock["region-flags"] = 0;
764 simProfileBlock["water-height"] = 20; 764 simProfileBlock["water-height"] = 20;
765 simProfileBlock["agents"] = 1; 765 simProfileBlock["agents"] = 1;
766 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); 766 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString();
767 767
768 // For Sugilite compatibility 768 // For Sugilite compatibility
769 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); 769 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
770 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); 770 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
771 simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); 771 simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
772 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); 772 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
773 simProfileBlock["uuid"] = simProfile.UUID.ToString(); 773 simProfileBlock["uuid"] = simProfile.UUID.ToString();
774 simProfileBlock["remoting_port"] = simProfile.remotingPort.ToString(); 774 simProfileBlock["remoting_port"] = simProfile.remotingPort.ToString();
775 simProfileBlock["http_port"] = simProfile.httpPort; 775 simProfileBlock["http_port"] = simProfile.httpPort;
776 776
777 simProfileList.Add(simProfileBlock); 777 simProfileList.Add(simProfileBlock);
778 } 778 }
779 } 779 }
780 } 780 }
781 m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + 781 m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() +
782 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 782 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
783 } 783 }
784 784
785 responseData["sim-profiles"] = simProfileList; 785 responseData["sim-profiles"] = simProfileList;
786 786
787 return response; 787 return response;
788 } 788 }
789 789
790 /// <summary> 790 /// <summary>
791 /// Returns up to <code>maxNumber</code> profiles of regions that have a name starting with <code>name</code> 791 /// Returns up to <code>maxNumber</code> profiles of regions that have a name starting with <code>name</code>
792 /// </summary> 792 /// </summary>
793 /// <param name="request"></param> 793 /// <param name="request"></param>
794 /// <returns></returns> 794 /// <returns></returns>
795 public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request) 795 public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request)
796 { 796 {
797 Hashtable requestData = (Hashtable)request.Params[0]; 797 Hashtable requestData = (Hashtable)request.Params[0];
798 798
799 if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber")) 799 if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber"))
800 { 800 {
801 m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber"); 801 m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber");
802 return new XmlRpcResponse(500, "Missing name or maxNumber in region search request"); 802 return new XmlRpcResponse(500, "Missing name or maxNumber in region search request");
803 } 803 }
804 804
805 Hashtable responseData = new Hashtable(); 805 Hashtable responseData = new Hashtable();
806 806
807 string name = (string)requestData["name"]; 807 string name = (string)requestData["name"];
808 int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]); 808 int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]);
809 if (maxNumber == 0 || name.Length < 3) 809 if (maxNumber == 0 || name.Length < 3)
810 { 810 {
811 // either we didn't want any, or we were too unspecific 811 // either we didn't want any, or we were too unspecific
812 responseData["numFound"] = 0; 812 responseData["numFound"] = 0;
813 } 813 }
814 else 814 else
815 { 815 {
816 List<RegionProfileData> sims = m_gridDBService.GetRegions(name, maxNumber); 816 List<RegionProfileData> sims = m_gridDBService.GetRegions(name, maxNumber);
817 817
818 responseData["numFound"] = sims.Count; 818 responseData["numFound"] = sims.Count;
819 for (int i = 0; i < sims.Count; ++i) 819 for (int i = 0; i < sims.Count; ++i)
820 { 820 {
821 RegionProfileData sim = sims[i]; 821 RegionProfileData sim = sims[i];
822 string prefix = "region" + i + "."; 822 string prefix = "region" + i + ".";
823 responseData[prefix + "region_name"] = sim.regionName; 823 responseData[prefix + "region_name"] = sim.regionName;
824 responseData[prefix + "region_UUID"] = sim.UUID.ToString(); 824 responseData[prefix + "region_UUID"] = sim.UUID.ToString();
825 responseData[prefix + "region_locx"] = sim.regionLocX.ToString(); 825 responseData[prefix + "region_locx"] = sim.regionLocX.ToString();
826 responseData[prefix + "region_locy"] = sim.regionLocY.ToString(); 826 responseData[prefix + "region_locy"] = sim.regionLocY.ToString();
827 responseData[prefix + "sim_ip"] = sim.serverIP.ToString(); 827 responseData[prefix + "sim_ip"] = sim.serverIP.ToString();
828 responseData[prefix + "sim_port"] = sim.serverPort.ToString(); 828 responseData[prefix + "sim_port"] = sim.serverPort.ToString();
829 responseData[prefix + "remoting_port"] = sim.remotingPort.ToString(); 829 responseData[prefix + "remoting_port"] = sim.remotingPort.ToString();
830 responseData[prefix + "http_port"] = sim.httpPort.ToString(); 830 responseData[prefix + "http_port"] = sim.httpPort.ToString();
831 responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString(); 831 responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString();
832 } 832 }
833 } 833 }
834 834
835 XmlRpcResponse response = new XmlRpcResponse(); 835 XmlRpcResponse response = new XmlRpcResponse();
836 response.Value = responseData; 836 response.Value = responseData;
837 return response; 837 return response;
838 } 838 }
839 839
840 /// <summary> 840 /// <summary>
841 /// Construct an XMLRPC registration disabled response 841 /// Construct an XMLRPC registration disabled response
842 /// </summary> 842 /// </summary>
843 /// <param name="error"></param> 843 /// <param name="error"></param>
844 /// <returns></returns> 844 /// <returns></returns>
845 public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error) 845 public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error)
846 { 846 {
847 XmlRpcResponse errorResponse = new XmlRpcResponse(); 847 XmlRpcResponse errorResponse = new XmlRpcResponse();
848 Hashtable errorResponseData = new Hashtable(); 848 Hashtable errorResponseData = new Hashtable();
849 errorResponse.Value = errorResponseData; 849 errorResponse.Value = errorResponseData;
850 errorResponseData["restricted"] = error; 850 errorResponseData["restricted"] = error;
851 return errorResponse; 851 return errorResponse;
852 } 852 }
853 } 853 }
854 854
855 /// <summary> 855 /// <summary>
856 /// Exception generated when a simulator fails to login to the grid 856 /// Exception generated when a simulator fails to login to the grid
857 /// </summary> 857 /// </summary>
858 public class LoginException : Exception 858 public class LoginException : Exception
859 { 859 {
860 /// <summary> 860 /// <summary>
861 /// Return an XmlRpcResponse version of the exception message suitable for sending to a client 861 /// Return an XmlRpcResponse version of the exception message suitable for sending to a client
862 /// </summary> 862 /// </summary>
863 /// <param name="message"></param> 863 /// <param name="message"></param>
864 /// <param name="xmlRpcMessage"></param> 864 /// <param name="xmlRpcMessage"></param>
865 public XmlRpcResponse XmlRpcErrorResponse 865 public XmlRpcResponse XmlRpcErrorResponse
866 { 866 {
867 get { return m_xmlRpcErrorResponse; } 867 get { return m_xmlRpcErrorResponse; }
868 } 868 }
869 private XmlRpcResponse m_xmlRpcErrorResponse; 869 private XmlRpcResponse m_xmlRpcErrorResponse;
870 870
871 public LoginException(string message, string xmlRpcMessage) 871 public LoginException(string message, string xmlRpcMessage)
872 : base(message) 872 : base(message)
873 { 873 {
874 // FIXME: Might be neater to refactor and put the method inside here 874 // FIXME: Might be neater to refactor and put the method inside here
875 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); 875 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage);
876 } 876 }
877 877
878 public LoginException(string message, string xmlRpcMessage, Exception e) 878 public LoginException(string message, string xmlRpcMessage, Exception e)
879 : base(message, e) 879 : base(message, e)
880 { 880 {
881 // FIXME: Might be neater to refactor and put the method inside here 881 // FIXME: Might be neater to refactor and put the method inside here
882 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); 882 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage);
883 } 883 }
884 } 884 }
885} 885}