diff options
Diffstat (limited to 'OpenSim/Framework/Data/SimProfileData.cs')
-rw-r--r-- | OpenSim/Framework/Data/SimProfileData.cs | 384 |
1 files changed, 192 insertions, 192 deletions
diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs index b920cab..c963455 100644 --- a/OpenSim/Framework/Data/SimProfileData.cs +++ b/OpenSim/Framework/Data/SimProfileData.cs | |||
@@ -1,192 +1,192 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using Nwc.XmlRpc; | 29 | using Nwc.XmlRpc; |
30 | 30 | ||
31 | using System; | 31 | using System; |
32 | using System.Collections; | 32 | using System.Collections; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Data | 34 | namespace OpenSim.Framework.Data |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// A class which contains information known to the grid server about a region | 37 | /// A class which contains information known to the grid server about a region |
38 | /// </summary> | 38 | /// </summary> |
39 | public class SimProfileData | 39 | public class SimProfileData |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// The name of the region | 42 | /// The name of the region |
43 | /// </summary> | 43 | /// </summary> |
44 | public string regionName = ""; | 44 | public string regionName = ""; |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// A 64-bit number combining map position into a (mostly) unique ID | 47 | /// A 64-bit number combining map position into a (mostly) unique ID |
48 | /// </summary> | 48 | /// </summary> |
49 | public ulong regionHandle; | 49 | public ulong regionHandle; |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// OGS/OpenSim Specific ID for a region | 52 | /// OGS/OpenSim Specific ID for a region |
53 | /// </summary> | 53 | /// </summary> |
54 | public LLUUID UUID; | 54 | public LLUUID UUID; |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Coordinates of the region | 57 | /// Coordinates of the region |
58 | /// </summary> | 58 | /// </summary> |
59 | public uint regionLocX; | 59 | public uint regionLocX; |
60 | public uint regionLocY; | 60 | public uint regionLocY; |
61 | public uint regionLocZ; // Reserved (round-robin, layers, etc) | 61 | public uint regionLocZ; // Reserved (round-robin, layers, etc) |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Authentication secrets | 64 | /// Authentication secrets |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <remarks>Not very secure, needs improvement.</remarks> | 66 | /// <remarks>Not very secure, needs improvement.</remarks> |
67 | public string regionSendKey = ""; | 67 | public string regionSendKey = ""; |
68 | public string regionRecvKey = ""; | 68 | public string regionRecvKey = ""; |
69 | public string regionSecret = ""; | 69 | public string regionSecret = ""; |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Whether the region is online | 72 | /// Whether the region is online |
73 | /// </summary> | 73 | /// </summary> |
74 | public bool regionOnline; | 74 | public bool regionOnline; |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Information about the server that the region is currently hosted on | 77 | /// Information about the server that the region is currently hosted on |
78 | /// </summary> | 78 | /// </summary> |
79 | public string serverIP = ""; | 79 | public string serverIP = ""; |
80 | public uint serverPort; | 80 | public uint serverPort; |
81 | public string serverURI = ""; | 81 | public string serverURI = ""; |
82 | 82 | ||
83 | public uint httpPort; | 83 | public uint httpPort; |
84 | public uint remotingPort; | 84 | public uint remotingPort; |
85 | public string httpServerURI = ""; | 85 | public string httpServerURI = ""; |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. | 88 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. |
89 | /// </summary> | 89 | /// </summary> |
90 | public ulong regionNorthOverrideHandle; | 90 | public ulong regionNorthOverrideHandle; |
91 | public ulong regionSouthOverrideHandle; | 91 | public ulong regionSouthOverrideHandle; |
92 | public ulong regionEastOverrideHandle; | 92 | public ulong regionEastOverrideHandle; |
93 | public ulong regionWestOverrideHandle; | 93 | public ulong regionWestOverrideHandle; |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// Optional: URI Location of the region database | 96 | /// Optional: URI Location of the region database |
97 | /// </summary> | 97 | /// </summary> |
98 | /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> | 98 | /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> |
99 | public string regionDataURI = ""; | 99 | public string regionDataURI = ""; |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Region Asset Details | 102 | /// Region Asset Details |
103 | /// </summary> | 103 | /// </summary> |
104 | public string regionAssetURI = ""; | 104 | public string regionAssetURI = ""; |
105 | public string regionAssetSendKey = ""; | 105 | public string regionAssetSendKey = ""; |
106 | public string regionAssetRecvKey = ""; | 106 | public string regionAssetRecvKey = ""; |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
109 | /// Region Userserver Details | 109 | /// Region Userserver Details |
110 | /// </summary> | 110 | /// </summary> |
111 | public string regionUserURI = ""; | 111 | public string regionUserURI = ""; |
112 | public string regionUserSendKey = ""; | 112 | public string regionUserSendKey = ""; |
113 | public string regionUserRecvKey = ""; | 113 | public string regionUserRecvKey = ""; |
114 | 114 | ||
115 | /// <summary> | 115 | /// <summary> |
116 | /// Region Map Texture Asset | 116 | /// Region Map Texture Asset |
117 | /// </summary> | 117 | /// </summary> |
118 | public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 118 | public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Get Sim profile data from grid server when in grid mode | 121 | /// Get Sim profile data from grid server when in grid mode |
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="region_uuid"></param> | 123 | /// <param name="region_uuid"></param> |
124 | /// <param name="gridserver_url"></param> | 124 | /// <param name="gridserver_url"></param> |
125 | /// <param name="?"></param> | 125 | /// <param name="?"></param> |
126 | /// <returns></returns> | 126 | /// <returns></returns> |
127 | public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) | 127 | public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) |
128 | { | 128 | { |
129 | Hashtable requestData = new Hashtable(); | 129 | Hashtable requestData = new Hashtable(); |
130 | requestData["region_uuid"] = region_uuid.UUID.ToString(); | 130 | requestData["region_uuid"] = region_uuid.UUID.ToString(); |
131 | requestData["authkey"] = gridserver_sendkey; | 131 | requestData["authkey"] = gridserver_sendkey; |
132 | ArrayList SendParams = new ArrayList(); | 132 | ArrayList SendParams = new ArrayList(); |
133 | SendParams.Add(requestData); | 133 | SendParams.Add(requestData); |
134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
135 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 135 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); |
136 | 136 | ||
137 | Hashtable responseData = (Hashtable)GridResp.Value; | 137 | Hashtable responseData = (Hashtable)GridResp.Value; |
138 | 138 | ||
139 | if (responseData.ContainsKey("error")) | 139 | if (responseData.ContainsKey("error")) |
140 | { | 140 | { |
141 | return null; | 141 | return null; |
142 | } | 142 | } |
143 | 143 | ||
144 | SimProfileData simData = new SimProfileData(); | 144 | SimProfileData simData = new SimProfileData(); |
145 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | 145 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); |
146 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | 146 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); |
147 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); | 147 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); |
148 | simData.serverIP = (string)responseData["sim_ip"]; | 148 | simData.serverIP = (string)responseData["sim_ip"]; |
149 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | 149 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); |
150 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | 150 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); |
151 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 151 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
152 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 152 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; |
153 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 153 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
154 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | 154 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); |
155 | simData.regionName = (string)responseData["region_name"]; | 155 | simData.regionName = (string)responseData["region_name"]; |
156 | 156 | ||
157 | return simData; | 157 | return simData; |
158 | } | 158 | } |
159 | public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) | 159 | public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) |
160 | { | 160 | { |
161 | Hashtable requestData = new Hashtable(); | 161 | Hashtable requestData = new Hashtable(); |
162 | requestData["region_handle"] = region_handle.ToString(); | 162 | requestData["region_handle"] = region_handle.ToString(); |
163 | requestData["authkey"] = gridserver_sendkey; | 163 | requestData["authkey"] = gridserver_sendkey; |
164 | ArrayList SendParams = new ArrayList(); | 164 | ArrayList SendParams = new ArrayList(); |
165 | SendParams.Add(requestData); | 165 | SendParams.Add(requestData); |
166 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 166 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
167 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 167 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); |
168 | 168 | ||
169 | Hashtable responseData = (Hashtable)GridResp.Value; | 169 | Hashtable responseData = (Hashtable)GridResp.Value; |
170 | 170 | ||
171 | if (responseData.ContainsKey("error")) | 171 | if (responseData.ContainsKey("error")) |
172 | { | 172 | { |
173 | return null; | 173 | return null; |
174 | } | 174 | } |
175 | 175 | ||
176 | SimProfileData simData = new SimProfileData(); | 176 | SimProfileData simData = new SimProfileData(); |
177 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | 177 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); |
178 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | 178 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); |
179 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); | 179 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); |
180 | simData.serverIP = (string)responseData["sim_ip"]; | 180 | simData.serverIP = (string)responseData["sim_ip"]; |
181 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | 181 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); |
182 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | 182 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); |
183 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 183 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
184 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 184 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
185 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 185 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; |
186 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | 186 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); |
187 | simData.regionName = (string)responseData["region_name"]; | 187 | simData.regionName = (string)responseData["region_name"]; |
188 | 188 | ||
189 | return simData; | 189 | return simData; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |