aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/RegionProfileData.cs
diff options
context:
space:
mode:
authorSean Dague2008-04-02 15:22:39 +0000
committerSean Dague2008-04-02 15:22:39 +0000
commit35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212 (patch)
treed0ce7aab84032a1daf50aac05a58a8f55a01f301 /OpenSim/Data/RegionProfileData.cs
parent* Add some temporary task inventory item inflation debug messages to investig... (diff)
downloadopensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.zip
opensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.tar.gz
opensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.tar.bz2
opensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.tar.xz
reorganizing namespaces to put all the Data stuff into it's own namespace
/ dir structure. This is coming in over a few changesets so consider trunk broken for the next 30 minutes as these get pulled together.
Diffstat (limited to 'OpenSim/Data/RegionProfileData.cs')
-rw-r--r--OpenSim/Data/RegionProfileData.cs257
1 files changed, 257 insertions, 0 deletions
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs
new file mode 100644
index 0000000..96351e0
--- /dev/null
+++ b/OpenSim/Data/RegionProfileData.cs
@@ -0,0 +1,257 @@
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 OpenSim 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 libsecondlife;
31using Nwc.XmlRpc;
32
33namespace OpenSim.Framework.Data
34{
35 /// <summary>
36 /// A class which contains information known to the grid server about a region
37 /// </summary>
38 public class RegionProfileData
39 {
40 /// <summary>
41 /// The name of the region
42 /// </summary>
43 public string regionName = String.Empty;
44
45 /// <summary>
46 /// A 64-bit number combining map position into a (mostly) unique ID
47 /// </summary>
48 public ulong regionHandle;
49
50 /// <summary>
51 /// OGS/OpenSim Specific ID for a region
52 /// </summary>
53 public LLUUID UUID;
54
55 /// <summary>
56 /// Coordinates of the region
57 /// </summary>
58 public uint regionLocX;
59 public uint regionLocY;
60 public uint regionLocZ; // Reserved (round-robin, layers, etc)
61
62 /// <summary>
63 /// Authentication secrets
64 /// </summary>
65 /// <remarks>Not very secure, needs improvement.</remarks>
66 public string regionSendKey = String.Empty;
67 public string regionRecvKey = String.Empty;
68 public string regionSecret = String.Empty;
69
70 /// <summary>
71 /// Whether the region is online
72 /// </summary>
73 public bool regionOnline;
74
75 /// <summary>
76 /// Information about the server that the region is currently hosted on
77 /// </summary>
78 public string serverIP = String.Empty;
79 public uint serverPort;
80 public string serverURI = String.Empty;
81
82 public uint httpPort;
83 public uint remotingPort;
84 public string httpServerURI = String.Empty;
85
86 /// <summary>
87 /// Set of optional overrides. Can be used to create non-eulicidean spaces.
88 /// </summary>
89 public ulong regionNorthOverrideHandle;
90 public ulong regionSouthOverrideHandle;
91 public ulong regionEastOverrideHandle;
92 public ulong regionWestOverrideHandle;
93
94 /// <summary>
95 /// Optional: URI Location of the region database
96 /// </summary>
97 /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
98 public string regionDataURI = String.Empty;
99
100 /// <summary>
101 /// Region Asset Details
102 /// </summary>
103 public string regionAssetURI = String.Empty;
104
105 public string regionAssetSendKey = String.Empty;
106 public string regionAssetRecvKey = String.Empty;
107
108 /// <summary>
109 /// Region Userserver Details
110 /// </summary>
111 public string regionUserURI = String.Empty;
112
113 public string regionUserSendKey = String.Empty;
114 public string regionUserRecvKey = String.Empty;
115
116 /// <summary>
117 /// Region Map Texture Asset
118 /// </summary>
119 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-1111-9999-000000000006");
120
121 /// <summary>
122 /// this particular mod to the file provides support within the spec for RegionProfileData for the
123 /// owner_uuid for the region
124 /// </summary>
125 public LLUUID owner_uuid = LLUUID.Zero;
126
127 /// <summary>
128 /// OGS/OpenSim Specific original ID for a region after move/split
129 /// </summary>
130 public LLUUID originUUID;
131
132 /// <summary>
133 /// Get Sim profile data from grid server when in grid mode
134 /// </summary>
135 /// <param name="region_uuid"></param>
136 /// <param name="gridserver_url"></param>
137 /// <param name="?"></param>
138 /// <returns></returns>
139 public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
140 string gridserver_sendkey, string gridserver_recvkey)
141 {
142 Hashtable requestData = new Hashtable();
143 requestData["region_uuid"] = region_uuid.UUID.ToString();
144 requestData["authkey"] = gridserver_sendkey;
145 ArrayList SendParams = new ArrayList();
146 SendParams.Add(requestData);
147 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
148 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
149
150 Hashtable responseData = (Hashtable) GridResp.Value;
151
152 if (responseData.ContainsKey("error"))
153 {
154 return null;
155 }
156
157 RegionProfileData simData = new RegionProfileData();
158 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
159 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
160 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
161 simData.serverIP = (string) responseData["sim_ip"];
162 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
163 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
164 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
165 simData.serverURI = (string)responseData["server_uri"];
166 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
167 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
168 simData.regionName = (string) responseData["region_name"];
169
170 return simData;
171 }
172
173 /// <summary>
174 /// Request sim profile information from a grid server
175 /// </summary>
176 /// <param name="region_handle"></param>
177 /// <param name="gridserver_url"></param>
178 /// <param name="gridserver_sendkey"></param>
179 /// <param name="gridserver_recvkey"></param>
180 /// <returns>The sim profile. Null if there was a request failure</returns>
181 public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
182 string gridserver_sendkey, string gridserver_recvkey)
183 {
184 Hashtable requestData = new Hashtable();
185 requestData["region_handle"] = region_handle.ToString();
186 requestData["authkey"] = gridserver_sendkey;
187 ArrayList SendParams = new ArrayList();
188 SendParams.Add(requestData);
189 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
190 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
191
192 Hashtable responseData = (Hashtable) GridResp.Value;
193
194 if (responseData.ContainsKey("error"))
195 {
196 return null;
197 }
198
199 RegionProfileData simData = new RegionProfileData();
200 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
201 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
202 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
203 simData.serverIP = (string) responseData["sim_ip"];
204 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
205 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
206 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
207 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
208 simData.serverURI = (string)responseData["server_uri"];
209 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
210 simData.regionName = (string) responseData["region_name"];
211
212 return simData;
213 }
214
215 /// <summary>
216 /// Request sim profile information from a grid server
217 /// </summary>
218 /// <param name="region_handle"></param>
219 /// <param name="gridserver_url"></param>
220 /// <param name="gridserver_sendkey"></param>
221 /// <param name="gridserver_recvkey"></param>
222 /// <returns>The sim profile. Null if there was a request failure</returns>
223 public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url,
224 string gridserver_sendkey, string gridserver_recvkey)
225 {
226 Hashtable requestData = new Hashtable();
227 requestData["region_name_search"] = regionName;
228 requestData["authkey"] = gridserver_sendkey;
229 ArrayList SendParams = new ArrayList();
230 SendParams.Add(requestData);
231 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
232 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
233
234 Hashtable responseData = (Hashtable)GridResp.Value;
235
236 if (responseData.ContainsKey("error"))
237 {
238 return null;
239 }
240
241 RegionProfileData simData = new RegionProfileData();
242 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
243 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
244 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
245 simData.serverIP = (string)responseData["sim_ip"];
246 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
247 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
248 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
249 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
250 simData.serverURI = (string)responseData["server_uri"];
251 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
252 simData.regionName = (string)responseData["region_name"];
253
254 return simData;
255 }
256 }
257}