Implemented more of the grid<->user server XML-RPC protocol

Went to sleep
ogs-cs
gareth 2007-03-11 00:58:28 +00:00
parent e7daed9ec2
commit 5d6d163696
4 changed files with 42 additions and 4 deletions

View File

@ -70,8 +70,31 @@ namespace OpenGridServices
Hashtable requestData = (Hashtable)request.Params[0];
switch(request.MethodName) {
case "get_simulator_info":
case "get_sim_info":
Console.WriteLine("get_sim_info");
uint req_handle=(uint)requestData["region_handle"];
SimProfile TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
string RecvKey="";
string caller=(string)requestData["caller"];
switch(caller) {
case "userserver":
RecvKey=OpenGrid_Main.thegrid.UserRecvKey;
break;
case "assetserver":
RecvKey=OpenGrid_Main.thegrid.AssetRecvKey;
break;
}
if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) {
XmlRpcResponse SimInfoResp = new XmlRpcResponse();
SimInfoResp.Value=TheSim;
return(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp));
} else {
XmlRpcResponse SimErrorResp = new XmlRpcResponse();
Hashtable SimErrorData = new Hashtable();
SimErrorData["error"]="sim not found";
SimErrorResp.Value=SimErrorData;
return(XmlRpcResponseSerializer.Singleton.Serialize(SimErrorResp));
}
break;
}

View File

@ -50,6 +50,7 @@ namespace OpenGridServices
public string UserRecvKey;
public GridHTTPServer _httpd;
public SimProfileManager _regionmanager;
[STAThread]
public static void Main( string[] args )

View File

@ -111,7 +111,7 @@ namespace OpenGridServices
LLUUID AgentID = TheUser.UUID;
TheUser.InitSessionData();
SimProfile SimInfo = new SimProfile();
SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle,OpenUser_Main.userserver.GridURL,OpenUser_Main.userserver.GridSendKey,OpenUser_Main.userserver.GridRecvKey);
XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
Hashtable LoginGoodData = new Hashtable();

View File

@ -32,6 +32,7 @@ using System.Text;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using Nwc.XmlRpc;
using ServerConsole;
namespace OpenGridServices
@ -111,6 +112,7 @@ namespace OpenGridServices
Circuits = new Dictionary<LLUUID, uint>();
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
InventoryItems = new Dictionary<LLUUID, InventoryItem>();
homeregionhandle=0;
}
public void InitSessionData() {
@ -156,7 +158,19 @@ namespace OpenGridServices
public string recvkey;
public SimProfile() {
public SimProfile LoadFromGrid(uint region_handle, string GridURL, string SendKey, string RecvKey) {
Hashtable GridReqParams = new Hashtable();
GridReqParams["region_handle"]=region_handle;
GridReqParams["caller"]="userserver";
GridReqParams["authkey"]=SendKey;
ArrayList SendParams = new ArrayList();
SendParams.Add(GridReqParams);
XmlRpcResponse GridResp = new XmlRpcRequest("get_sim_info",SendParams).Send(GridURL,3000);
return (SimProfile)GridResp.Value;
}
public SimProfile() {
}