diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/RegionProfileData.cs | 81 | ||||
-rw-r--r-- | OpenSim/Data/RegionProfileService.cs | 94 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 8 |
3 files changed, 98 insertions, 85 deletions
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs index d01aaa0..0b757f3 100644 --- a/OpenSim/Data/RegionProfileData.cs +++ b/OpenSim/Data/RegionProfileData.cs | |||
@@ -131,87 +131,6 @@ namespace OpenSim.Data | |||
131 | /// </summary> | 131 | /// </summary> |
132 | public UUID originUUID; | 132 | public UUID originUUID; |
133 | 133 | ||
134 | /// <summary> | ||
135 | /// Request sim data based on arbitrary key/value | ||
136 | /// </summary> | ||
137 | private static RegionProfileData RequestSimData(Uri gridserver_url, string gridserver_sendkey, string keyField, string keyValue) | ||
138 | { | ||
139 | Hashtable requestData = new Hashtable(); | ||
140 | requestData[keyField] = keyValue; | ||
141 | requestData["authkey"] = gridserver_sendkey; | ||
142 | ArrayList SendParams = new ArrayList(); | ||
143 | SendParams.Add(requestData); | ||
144 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
145 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url.ToString(), 3000); | ||
146 | |||
147 | Hashtable responseData = (Hashtable) GridResp.Value; | ||
148 | |||
149 | RegionProfileData simData = null; | ||
150 | |||
151 | if (!responseData.ContainsKey("error")) | ||
152 | { | ||
153 | simData = new RegionProfileData(); | ||
154 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
155 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
156 | simData.regionHandle = | ||
157 | Utils.UIntsToLong((simData.regionLocX * Constants.RegionSize), | ||
158 | (simData.regionLocY*Constants.RegionSize)); | ||
159 | simData.serverIP = (string) responseData["sim_ip"]; | ||
160 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | ||
161 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | ||
162 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
163 | simData.serverURI = (string) responseData["server_uri"]; | ||
164 | simData.httpServerURI = "http://" + (string)responseData["sim_ip"] + ":" + simData.httpPort.ToString() + "/"; | ||
165 | simData.UUID = new UUID((string) responseData["region_UUID"]); | ||
166 | simData.regionName = (string) responseData["region_name"]; | ||
167 | } | ||
168 | |||
169 | return simData; | ||
170 | } | ||
171 | |||
172 | /// <summary> | ||
173 | /// Request sim profile information from a grid server, by Region UUID | ||
174 | /// </summary> | ||
175 | /// <param name="region_UUID">The region UUID to look for</param> | ||
176 | /// <param name="gridserver_url"></param> | ||
177 | /// <param name="gridserver_sendkey"></param> | ||
178 | /// <param name="gridserver_recvkey"></param> | ||
179 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
180 | /// <remarks>This method should be statics</remarks> | ||
181 | public static RegionProfileData RequestSimProfileData(UUID region_uuid, Uri gridserver_url, | ||
182 | string gridserver_sendkey, string gridserver_recvkey) | ||
183 | { | ||
184 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_UUID", region_uuid.Guid.ToString()); | ||
185 | } | ||
186 | |||
187 | /// <summary> | ||
188 | /// Request sim profile information from a grid server, by Region Handle | ||
189 | /// </summary> | ||
190 | /// <param name="region_handle">the region handle to look for</param> | ||
191 | /// <param name="gridserver_url"></param> | ||
192 | /// <param name="gridserver_sendkey"></param> | ||
193 | /// <param name="gridserver_recvkey"></param> | ||
194 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
195 | public static RegionProfileData RequestSimProfileData(ulong region_handle, Uri gridserver_url, | ||
196 | string gridserver_sendkey, string gridserver_recvkey) | ||
197 | { | ||
198 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_handle", region_handle.ToString()); | ||
199 | } | ||
200 | |||
201 | /// <summary> | ||
202 | /// Request sim profile information from a grid server, by Region Name | ||
203 | /// </summary> | ||
204 | /// <param name="region_handle">the region name to look for</param> | ||
205 | /// <param name="gridserver_url"></param> | ||
206 | /// <param name="gridserver_sendkey"></param> | ||
207 | /// <param name="gridserver_recvkey"></param> | ||
208 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
209 | public static RegionProfileData RequestSimProfileData(string regionName, Uri gridserver_url, | ||
210 | string gridserver_sendkey, string gridserver_recvkey) | ||
211 | { | ||
212 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_name_search", regionName ); | ||
213 | } | ||
214 | |||
215 | 134 | ||
216 | //Data Wrappers | 135 | //Data Wrappers |
217 | public string RegionName | 136 | public string RegionName |
diff --git a/OpenSim/Data/RegionProfileService.cs b/OpenSim/Data/RegionProfileService.cs new file mode 100644 index 0000000..1a73ed1 --- /dev/null +++ b/OpenSim/Data/RegionProfileService.cs | |||
@@ -0,0 +1,94 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using Nwc.XmlRpc; | ||
6 | using OpenMetaverse; | ||
7 | using OpenSim.Framework; | ||
8 | |||
9 | namespace OpenSim.Data | ||
10 | { | ||
11 | public class RegionProfileService | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Request sim data based on arbitrary key/value | ||
15 | /// </summary> | ||
16 | private static RegionProfileData RequestSimData(Uri gridserver_url, string gridserver_sendkey, string keyField, string keyValue) | ||
17 | { | ||
18 | Hashtable requestData = new Hashtable(); | ||
19 | requestData[keyField] = keyValue; | ||
20 | requestData["authkey"] = gridserver_sendkey; | ||
21 | ArrayList SendParams = new ArrayList(); | ||
22 | SendParams.Add(requestData); | ||
23 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
24 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url.ToString(), 3000); | ||
25 | |||
26 | Hashtable responseData = (Hashtable) GridResp.Value; | ||
27 | |||
28 | RegionProfileData simData = null; | ||
29 | |||
30 | if (!responseData.ContainsKey("error")) | ||
31 | { | ||
32 | simData = new RegionProfileData(); | ||
33 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
34 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
35 | simData.regionHandle = | ||
36 | Utils.UIntsToLong((simData.regionLocX * Constants.RegionSize), | ||
37 | (simData.regionLocY*Constants.RegionSize)); | ||
38 | simData.serverIP = (string) responseData["sim_ip"]; | ||
39 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | ||
40 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | ||
41 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
42 | simData.serverURI = (string) responseData["server_uri"]; | ||
43 | simData.httpServerURI = "http://" + (string)responseData["sim_ip"] + ":" + simData.httpPort.ToString() + "/"; | ||
44 | simData.UUID = new UUID((string) responseData["region_UUID"]); | ||
45 | simData.regionName = (string) responseData["region_name"]; | ||
46 | } | ||
47 | |||
48 | return simData; | ||
49 | } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Request sim profile information from a grid server, by Region UUID | ||
53 | /// </summary> | ||
54 | /// <param name="region_UUID">The region UUID to look for</param> | ||
55 | /// <param name="gridserver_url"></param> | ||
56 | /// <param name="gridserver_sendkey"></param> | ||
57 | /// <param name="gridserver_recvkey"></param> | ||
58 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
59 | /// <remarks>This method should be statics</remarks> | ||
60 | public static RegionProfileData RequestSimProfileData(UUID region_uuid, Uri gridserver_url, | ||
61 | string gridserver_sendkey, string gridserver_recvkey) | ||
62 | { | ||
63 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_UUID", region_uuid.Guid.ToString()); | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Request sim profile information from a grid server, by Region Handle | ||
68 | /// </summary> | ||
69 | /// <param name="region_handle">the region handle to look for</param> | ||
70 | /// <param name="gridserver_url"></param> | ||
71 | /// <param name="gridserver_sendkey"></param> | ||
72 | /// <param name="gridserver_recvkey"></param> | ||
73 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
74 | public static RegionProfileData RequestSimProfileData(ulong region_handle, Uri gridserver_url, | ||
75 | string gridserver_sendkey, string gridserver_recvkey) | ||
76 | { | ||
77 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_handle", region_handle.ToString()); | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Request sim profile information from a grid server, by Region Name | ||
82 | /// </summary> | ||
83 | /// <param name="region_handle">the region name to look for</param> | ||
84 | /// <param name="gridserver_url"></param> | ||
85 | /// <param name="gridserver_sendkey"></param> | ||
86 | /// <param name="gridserver_recvkey"></param> | ||
87 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
88 | public static RegionProfileData RequestSimProfileData(string regionName, Uri gridserver_url, | ||
89 | string gridserver_sendkey, string gridserver_recvkey) | ||
90 | { | ||
91 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_name_search", regionName ); | ||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 905f4aa..7dce157 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -86,7 +86,7 @@ namespace OpenSim.Grid.UserServer | |||
86 | RegionProfileData SimInfo; | 86 | RegionProfileData SimInfo; |
87 | try | 87 | try |
88 | { | 88 | { |
89 | SimInfo = RegionProfileData.RequestSimProfileData( | 89 | SimInfo = RegionProfileService.RequestSimProfileData( |
90 | theUser.CurrentAgent.Handle, m_config.GridServerURL, | 90 | theUser.CurrentAgent.Handle, m_config.GridServerURL, |
91 | m_config.GridSendKey, m_config.GridRecvKey); | 91 | m_config.GridSendKey, m_config.GridRecvKey); |
92 | 92 | ||
@@ -302,20 +302,20 @@ namespace OpenSim.Grid.UserServer | |||
302 | 302 | ||
303 | protected RegionProfileData RequestClosestRegion(string region) | 303 | protected RegionProfileData RequestClosestRegion(string region) |
304 | { | 304 | { |
305 | return RegionProfileData.RequestSimProfileData(region, | 305 | return RegionProfileService.RequestSimProfileData(region, |
306 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 306 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); |
307 | } | 307 | } |
308 | 308 | ||
309 | protected RegionProfileData GetRegionInfo(ulong homeRegionHandle) | 309 | protected RegionProfileData GetRegionInfo(ulong homeRegionHandle) |
310 | { | 310 | { |
311 | return RegionProfileData.RequestSimProfileData(homeRegionHandle, | 311 | return RegionProfileService.RequestSimProfileData(homeRegionHandle, |
312 | m_config.GridServerURL, m_config.GridSendKey, | 312 | m_config.GridServerURL, m_config.GridSendKey, |
313 | m_config.GridRecvKey); | 313 | m_config.GridRecvKey); |
314 | } | 314 | } |
315 | 315 | ||
316 | protected RegionProfileData GetRegionInfo(UUID homeRegionId) | 316 | protected RegionProfileData GetRegionInfo(UUID homeRegionId) |
317 | { | 317 | { |
318 | return RegionProfileData.RequestSimProfileData(homeRegionId, | 318 | return RegionProfileService.RequestSimProfileData(homeRegionId, |
319 | m_config.GridServerURL, m_config.GridSendKey, | 319 | m_config.GridServerURL, m_config.GridSendKey, |
320 | m_config.GridRecvKey); | 320 | m_config.GridRecvKey); |
321 | } | 321 | } |