diff options
Diffstat (limited to 'OpenSim/Framework/Data')
-rw-r--r-- | OpenSim/Framework/Data/GridData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/Data/RegionProfileData.cs | 42 |
2 files changed, 49 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 95a568a..5eaa2c4 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs | |||
@@ -69,6 +69,13 @@ namespace OpenSim.Framework.Data | |||
69 | RegionProfileData GetProfileByLLUUID(LLUUID UUID); | 69 | RegionProfileData GetProfileByLLUUID(LLUUID UUID); |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Returns a sim profile from a string match | ||
73 | /// </summary> | ||
74 | /// <param name="regionName">A string for a partial region name match</param> | ||
75 | /// <returns>A sim profile</returns> | ||
76 | RegionProfileData GetProfileByString(string regionName); | ||
77 | |||
78 | /// <summary> | ||
72 | /// Returns all profiles within the specified range | 79 | /// Returns all profiles within the specified range |
73 | /// </summary> | 80 | /// </summary> |
74 | /// <param name="Xmin">Minimum sim coordinate (X)</param> | 81 | /// <param name="Xmin">Minimum sim coordinate (X)</param> |
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index b541116..f736571 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs | |||
@@ -216,5 +216,47 @@ namespace OpenSim.Framework.Data | |||
216 | 216 | ||
217 | return simData; | 217 | return simData; |
218 | } | 218 | } |
219 | |||
220 | /// <summary> | ||
221 | /// Request sim profile information from a grid server | ||
222 | /// </summary> | ||
223 | /// <param name="region_handle"></param> | ||
224 | /// <param name="gridserver_url"></param> | ||
225 | /// <param name="gridserver_sendkey"></param> | ||
226 | /// <param name="gridserver_recvkey"></param> | ||
227 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
228 | public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url, | ||
229 | string gridserver_sendkey, string gridserver_recvkey) | ||
230 | { | ||
231 | Hashtable requestData = new Hashtable(); | ||
232 | requestData["region_name_search"] = regionName; | ||
233 | requestData["authkey"] = gridserver_sendkey; | ||
234 | ArrayList SendParams = new ArrayList(); | ||
235 | SendParams.Add(requestData); | ||
236 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
237 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | ||
238 | |||
239 | Hashtable responseData = (Hashtable)GridResp.Value; | ||
240 | |||
241 | if (responseData.ContainsKey("error")) | ||
242 | { | ||
243 | return null; | ||
244 | } | ||
245 | |||
246 | RegionProfileData simData = new RegionProfileData(); | ||
247 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | ||
248 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | ||
249 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize)); | ||
250 | simData.serverIP = (string)responseData["sim_ip"]; | ||
251 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | ||
252 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | ||
253 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | ||
254 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | ||
255 | simData.serverURI = (string)responseData["server_uri"]; | ||
256 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | ||
257 | simData.regionName = (string)responseData["region_name"]; | ||
258 | |||
259 | return simData; | ||
260 | } | ||
219 | } | 261 | } |
220 | } | 262 | } |