aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data/SimProfileData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data/SimProfileData.cs70
1 files changed, 70 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs
index 3dddfb4..9db8574 100644
--- a/OpenSim/Framework/Data/SimProfileData.cs
+++ b/OpenSim/Framework/Data/SimProfileData.cs
@@ -26,6 +26,10 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using Nwc.XmlRpc;
30
31using System;
32using System.Collections;
29 33
30namespace OpenSim.Framework.Data 34namespace OpenSim.Framework.Data
31{ 35{
@@ -108,5 +112,71 @@ namespace OpenSim.Framework.Data
108 /// Region Map Texture Asset 112 /// Region Map Texture Asset
109 /// </summary> 113 /// </summary>
110 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); 114 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006");
115
116 /// <summary>
117 /// Get Sim profile data from grid server when in grid mode
118 /// </summary>
119 /// <param name="region_uuid"></param>
120 /// <param name="gridserver_url"></param>
121 /// <param name="?"></param>
122 /// <returns></returns>
123 public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
124 {
125 Hashtable requestData = new Hashtable();
126 requestData["region_uuid"] = region_uuid.UUID.ToString();
127 requestData["authkey"] = gridserver_sendkey;
128 ArrayList SendParams = new ArrayList();
129 SendParams.Add(requestData);
130 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
131 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
132
133 Hashtable responseData = (Hashtable)GridResp.Value;
134
135 if (responseData.ContainsKey("error"))
136 {
137 return null;
138 }
139
140 SimProfileData simData = new SimProfileData();
141 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
142 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
143 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256));
144 simData.serverIP = (string)responseData["sim_ip"];
145 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
146 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
147 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
148 simData.regionName = (string)responseData["region_name"];
149
150 return simData;
151 }
152 public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
153 {
154 Hashtable requestData = new Hashtable();
155 requestData["region_handle"] = region_handle.ToString();
156 requestData["authkey"] = gridserver_sendkey;
157 ArrayList SendParams = new ArrayList();
158 SendParams.Add(requestData);
159 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
160 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
161
162 Hashtable responseData = (Hashtable)GridResp.Value;
163
164 if (responseData.ContainsKey("error"))
165 {
166 return null;
167 }
168
169 SimProfileData simData = new SimProfileData();
170 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
171 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
172 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256));
173 simData.serverIP = (string)responseData["sim_ip"];
174 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
175 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
176 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
177 simData.regionName = (string)responseData["region_name"];
178
179 return simData;
180 }
111 } 181 }
112} 182}