aaaaaaaaaarrrrrgggggghhhhhhhhh XML ERRORS!!!!!
parent
5d6d163696
commit
297cef3e18
|
@ -66,13 +66,13 @@ namespace OpenGridServices
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ParseXMLRPC(string requestBody) {
|
static string ParseXMLRPC(string requestBody) {
|
||||||
|
try{
|
||||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||||
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
switch(request.MethodName) {
|
switch(request.MethodName) {
|
||||||
case "get_sim_info":
|
case "get_sim_info":
|
||||||
Console.WriteLine("get_sim_info");
|
ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]);
|
||||||
uint req_handle=(uint)requestData["region_handle"];
|
|
||||||
SimProfile TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
|
SimProfile TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
|
||||||
string RecvKey="";
|
string RecvKey="";
|
||||||
string caller=(string)requestData["caller"];
|
string caller=(string)requestData["caller"];
|
||||||
|
@ -86,7 +86,18 @@ namespace OpenGridServices
|
||||||
}
|
}
|
||||||
if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) {
|
if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) {
|
||||||
XmlRpcResponse SimInfoResp = new XmlRpcResponse();
|
XmlRpcResponse SimInfoResp = new XmlRpcResponse();
|
||||||
SimInfoResp.Value=TheSim;
|
Hashtable SimInfoData = new Hashtable();
|
||||||
|
SimInfoData["UUID"]=TheSim.UUID.ToString();
|
||||||
|
SimInfoData["regionhandle"]=TheSim.regionhandle.ToString();
|
||||||
|
SimInfoData["regionname"]=TheSim.regionname;
|
||||||
|
SimInfoData["sim_ip"]=TheSim.sim_ip;
|
||||||
|
SimInfoData["sim_port"]=TheSim.sim_port.ToString();
|
||||||
|
SimInfoData["caps_url"]=TheSim.caps_url;
|
||||||
|
SimInfoData["RegionLocX"]=TheSim.RegionLocX.ToString();
|
||||||
|
SimInfoData["RegionLocY"]=TheSim.RegionLocY.ToString();
|
||||||
|
SimInfoData["sendkey"]=TheSim.sendkey;
|
||||||
|
SimInfoData["recvkey"]=TheSim.recvkey;
|
||||||
|
SimInfoResp.Value=SimInfoData;
|
||||||
return(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp));
|
return(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp));
|
||||||
} else {
|
} else {
|
||||||
XmlRpcResponse SimErrorResp = new XmlRpcResponse();
|
XmlRpcResponse SimErrorResp = new XmlRpcResponse();
|
||||||
|
@ -97,7 +108,9 @@ namespace OpenGridServices
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +155,7 @@ namespace OpenGridServices
|
||||||
byte[] buffer = System.Text.Encoding.Unicode.GetBytes(responseString);
|
byte[] buffer = System.Text.Encoding.Unicode.GetBytes(responseString);
|
||||||
System.IO.Stream output = response.OutputStream;
|
System.IO.Stream output = response.OutputStream;
|
||||||
response.SendChunked=false;
|
response.SendChunked=false;
|
||||||
encoding = System.Text.Encoding.UTF8;
|
encoding = System.Text.Encoding.Unicode;
|
||||||
response.ContentEncoding = encoding;
|
response.ContentEncoding = encoding;
|
||||||
response.ContentLength64=buffer.Length;
|
response.ContentLength64=buffer.Length;
|
||||||
output.Write(buffer,0,buffer.Length);
|
output.Write(buffer,0,buffer.Length);
|
||||||
|
|
|
@ -85,6 +85,10 @@ namespace OpenGridServices
|
||||||
|
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process");
|
||||||
_httpd = new GridHTTPServer();
|
_httpd = new GridHTTPServer();
|
||||||
|
|
||||||
|
this._regionmanager=new SimProfileManager();
|
||||||
|
_regionmanager.CreateNewProfile("OpenSim Test", "http://there-is-no-caps.com", "4.78.190.75", 9000, 997, 996, this.UserSendKey, this.UserRecvKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,11 @@ namespace OpenGridServices
|
||||||
newprofile.sim_port=sim_port;
|
newprofile.sim_port=sim_port;
|
||||||
newprofile.RegionLocX=RegionLocX;
|
newprofile.RegionLocX=RegionLocX;
|
||||||
newprofile.RegionLocY=RegionLocY;
|
newprofile.RegionLocY=RegionLocY;
|
||||||
|
newprofile.caps_url="http://" + sim_ip + ":12036";
|
||||||
newprofile.sendkey=sendkey;
|
newprofile.sendkey=sendkey;
|
||||||
newprofile.recvkey=recvkey;
|
newprofile.recvkey=recvkey;
|
||||||
newprofile.regionhandle=Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
|
newprofile.regionhandle=Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
|
||||||
|
newprofile.UUID=LLUUID.Random();
|
||||||
this.SimProfiles.Add(newprofile.UUID,newprofile);
|
this.SimProfiles.Add(newprofile.UUID,newprofile);
|
||||||
return newprofile;
|
return newprofile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,9 +140,12 @@ namespace OpenGridServices
|
||||||
LoginGoodData["seed_capability"]="http://" + SimInfo.sim_ip + ":12043" + "/cap/" + TheUser.CurrentSecureSessionID.Combine(TheUser.CurrentSessionID).Combine(AgentID);
|
LoginGoodData["seed_capability"]="http://" + SimInfo.sim_ip + ":12043" + "/cap/" + TheUser.CurrentSecureSessionID.Combine(TheUser.CurrentSessionID).Combine(AgentID);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
LoginGoodResp.Value=LoginGoodData;
|
LoginGoodResp.Value=LoginGoodData;
|
||||||
return(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp));
|
return(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp));
|
||||||
|
} catch (Exception E) {
|
||||||
|
Console.WriteLine(E.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace OpenGridServices
|
||||||
|
|
||||||
public UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) {
|
public UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) {
|
||||||
UserProfile newprofile = new UserProfile();
|
UserProfile newprofile = new UserProfile();
|
||||||
|
newprofile.homeregionhandle=Util.UIntsToLong((997*256), (996*256));
|
||||||
newprofile.firstname=firstname;
|
newprofile.firstname=firstname;
|
||||||
newprofile.lastname=lastname;
|
newprofile.lastname=lastname;
|
||||||
newprofile.MD5passwd=MD5passwd;
|
newprofile.MD5passwd=MD5passwd;
|
||||||
|
@ -92,7 +93,7 @@ namespace OpenGridServices
|
||||||
|
|
||||||
public string firstname;
|
public string firstname;
|
||||||
public string lastname;
|
public string lastname;
|
||||||
public uint homeregionhandle;
|
public ulong homeregionhandle;
|
||||||
public LLVector3 homepos;
|
public LLVector3 homepos;
|
||||||
public LLVector3 homelookat;
|
public LLVector3 homelookat;
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ namespace OpenGridServices
|
||||||
Circuits = new Dictionary<LLUUID, uint>();
|
Circuits = new Dictionary<LLUUID, uint>();
|
||||||
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
|
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
|
||||||
InventoryItems = new Dictionary<LLUUID, InventoryItem>();
|
InventoryItems = new Dictionary<LLUUID, InventoryItem>();
|
||||||
homeregionhandle=0;
|
homeregionhandle=Util.UIntsToLong((997*256), (996*256));;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitSessionData() {
|
public void InitSessionData() {
|
||||||
|
@ -158,20 +159,28 @@ namespace OpenGridServices
|
||||||
public string recvkey;
|
public string recvkey;
|
||||||
|
|
||||||
|
|
||||||
public SimProfile LoadFromGrid(uint region_handle, string GridURL, string SendKey, string RecvKey) {
|
public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey) {
|
||||||
|
try {
|
||||||
Hashtable GridReqParams = new Hashtable();
|
Hashtable GridReqParams = new Hashtable();
|
||||||
GridReqParams["region_handle"]=region_handle;
|
GridReqParams["region_handle"]=region_handle.ToString();
|
||||||
GridReqParams["caller"]="userserver";
|
GridReqParams["caller"]="userserver";
|
||||||
GridReqParams["authkey"]=SendKey;
|
GridReqParams["authkey"]=SendKey;
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(GridReqParams);
|
SendParams.Add(GridReqParams);
|
||||||
XmlRpcResponse GridResp = new XmlRpcRequest("get_sim_info",SendParams).Send(GridURL,3000);
|
XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info",GridReqParams);
|
||||||
|
|
||||||
return (SimProfile)GridResp.Value;
|
XmlRpcResponse GridResp = GridReq.Send(GridURL,3000);
|
||||||
|
|
||||||
|
Hashtable RespData=(Hashtable)GridResp.Value;
|
||||||
|
Console.WriteLine(RespData.ToString());
|
||||||
|
} catch(Exception e) {
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimProfile() {
|
public SimProfile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) OpenSim project, http://osgrid.org/
|
||||||
|
|
||||||
|
* Copyright (c) <year>, <copyright holder>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
|
namespace OpenGridServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
public class Util
|
||||||
|
{
|
||||||
|
public static ulong UIntsToLong(uint X, uint Y)
|
||||||
|
{
|
||||||
|
return Helpers.UIntsToLong(X,Y);
|
||||||
|
}
|
||||||
|
public Util()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QueItem {
|
||||||
|
public QueItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Packet Packet;
|
||||||
|
public bool Incoming;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class BlockingQueue< T > {
|
||||||
|
private Queue< T > _queue = new Queue< T >();
|
||||||
|
private object _queueSync = new object();
|
||||||
|
|
||||||
|
public void Enqueue(T value)
|
||||||
|
{
|
||||||
|
lock(_queueSync)
|
||||||
|
{
|
||||||
|
_queue.Enqueue(value);
|
||||||
|
Monitor.Pulse(_queueSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Dequeue()
|
||||||
|
{
|
||||||
|
lock(_queueSync)
|
||||||
|
{
|
||||||
|
if( _queue.Count < 1)
|
||||||
|
Monitor.Wait(_queueSync);
|
||||||
|
|
||||||
|
return _queue.Dequeue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue