adam
parent
f58edfb479
commit
1260e35ca8
|
@ -76,27 +76,30 @@ namespace OpenSim
|
|||
}
|
||||
|
||||
static string ParseXMLRPC(string requestBody) {
|
||||
try{
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
switch(request.MethodName) {
|
||||
case "expect_user":
|
||||
GridServers.agentcircuitdata agent_data = new GridServers.agentcircuitdata();
|
||||
agent_data.SessionID = new LLUUID((string)requestData["session_id"]);
|
||||
agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
|
||||
agent_data.firstname = (string)requestData["firstname"];
|
||||
agent_data.lastname = (string)requestData["lastname"];
|
||||
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
|
||||
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||
if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote")
|
||||
{
|
||||
((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data);
|
||||
}
|
||||
return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
|
||||
break;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
try
|
||||
{
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
switch(request.MethodName) {
|
||||
case "expect_user":
|
||||
GridServers.agentcircuitdata agent_data = new GridServers.agentcircuitdata();
|
||||
agent_data.SessionID = new LLUUID((string)requestData["session_id"]);
|
||||
agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
|
||||
agent_data.firstname = (string)requestData["firstname"];
|
||||
agent_data.lastname = (string)requestData["lastname"];
|
||||
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
|
||||
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||
if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote")
|
||||
{
|
||||
((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data);
|
||||
}
|
||||
return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
}
|
||||
return "";
|
||||
|
@ -113,49 +116,48 @@ namespace OpenSim
|
|||
|
||||
static void HandleRequest(Object stateinfo) {
|
||||
HttpListenerContext context=(HttpListenerContext)stateinfo;
|
||||
|
||||
HttpListenerRequest request = context.Request;
|
||||
HttpListenerResponse response = context.Response;
|
||||
|
||||
HttpListenerRequest request = context.Request;
|
||||
HttpListenerResponse response = context.Response;
|
||||
|
||||
response.KeepAlive=false;
|
||||
response.SendChunked=false;
|
||||
|
||||
System.IO.Stream body = request.InputStream;
|
||||
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
|
||||
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
|
||||
System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
|
||||
|
||||
string requestBody = reader.ReadToEnd();
|
||||
|
||||
string requestBody = reader.ReadToEnd();
|
||||
body.Close();
|
||||
reader.Close();
|
||||
reader.Close();
|
||||
|
||||
string responseString="";
|
||||
string responseString="";
|
||||
switch(request.ContentType) {
|
||||
case "text/xml":
|
||||
// must be XML-RPC, so pass to the XML-RPC parser
|
||||
case "text/xml":
|
||||
// must be XML-RPC, so pass to the XML-RPC parser
|
||||
|
||||
responseString=ParseXMLRPC(requestBody);
|
||||
response.AddHeader("Content-type","text/xml");
|
||||
break;
|
||||
|
||||
response.AddHeader("Content-type","text/xml");
|
||||
break;
|
||||
|
||||
case "application/xml":
|
||||
// probably LLSD we hope, otherwise it should be ignored by the parser
|
||||
responseString=ParseLLSDXML(requestBody);
|
||||
response.AddHeader("Content-type","application/xml");
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case null:
|
||||
// must be REST or invalid crap, so pass to the REST parser
|
||||
responseString=ParseREST(request.Url.OriginalString,requestBody);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
|
||||
System.IO.Stream output = response.OutputStream;
|
||||
response.SendChunked=false;
|
||||
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
|
||||
System.IO.Stream output = response.OutputStream;
|
||||
response.SendChunked=false;
|
||||
response.ContentLength64=buffer.Length;
|
||||
output.Write(buffer,0,buffer.Length);
|
||||
output.Close();
|
||||
output.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,15 +120,16 @@ namespace OpenSim.GridServers
|
|||
IGridServer GetGridServer();
|
||||
}
|
||||
|
||||
public class agentcircuitdata {
|
||||
public agentcircuitdata() { }
|
||||
public LLUUID AgentID;
|
||||
public LLUUID SessionID;
|
||||
public LLUUID SecureSessionID;
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public uint circuitcode;
|
||||
}
|
||||
public class agentcircuitdata
|
||||
{
|
||||
public agentcircuitdata() { }
|
||||
public LLUUID AgentID;
|
||||
public LLUUID SessionID;
|
||||
public LLUUID SecureSessionID;
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public uint circuitcode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -216,6 +216,21 @@ namespace OpenSim.GridServers
|
|||
int SessionRand = this.RandomClass.Next(1,999);
|
||||
Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
|
||||
|
||||
//create some login info
|
||||
Hashtable LoginFlagsHash = new Hashtable();
|
||||
LoginFlagsHash["daylight_savings"]="N";
|
||||
LoginFlagsHash["stipend_since_login"]="N";
|
||||
LoginFlagsHash["gendered"]="Y";
|
||||
LoginFlagsHash["ever_logged_in"]="Y";
|
||||
ArrayList LoginFlags=new ArrayList();
|
||||
LoginFlags.Add(LoginFlagsHash);
|
||||
|
||||
Hashtable GlobalT = new Hashtable();
|
||||
GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||
GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
ArrayList GlobalTextures = new ArrayList();
|
||||
GlobalTextures.Add(GlobalT);
|
||||
|
||||
XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
@ -224,6 +239,11 @@ namespace OpenSim.GridServers
|
|||
responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
|
||||
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||
responseData["session_id"] = Session.ToStringHyphenated();
|
||||
responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds;
|
||||
responseData["login-flags"]=LoginFlags;
|
||||
responseData["global-textures"]=GlobalTextures;
|
||||
|
||||
//inventory
|
||||
ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
|
||||
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
|
@ -249,7 +269,7 @@ namespace OpenSim.GridServers
|
|||
_login.BaseFolder = BaseFolderID;
|
||||
_login.InventoryFolder = InventoryFolderID;
|
||||
|
||||
//working on local computer so lets add to the gridserver's list of sessions?
|
||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||
if(OpenSim_Main.gridServers.GridServer.GetName() == "Local")
|
||||
{
|
||||
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
||||
|
|
24
src/Util.cs
24
src/Util.cs
|
@ -59,17 +59,19 @@ namespace OpenSim
|
|||
public bool Incoming;
|
||||
}
|
||||
|
||||
public class agentcircuitdata {
|
||||
public agentcircuitdata() { }
|
||||
public LLUUID AgentID;
|
||||
public LLUUID SessionID;
|
||||
public LLUUID SecureSessionID;
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public uint circuitcode;
|
||||
}
|
||||
|
||||
|
||||
/* this is in IGridServer.cs, so there should be no reason for it to be here as well
|
||||
public class agentcircuitdata
|
||||
{
|
||||
public agentcircuitdata() { }
|
||||
public LLUUID AgentID;
|
||||
public LLUUID SessionID;
|
||||
public LLUUID SecureSessionID;
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public uint circuitcode;
|
||||
}
|
||||
*/
|
||||
|
||||
public class BlockingQueue< T > {
|
||||
private Queue< T > _queue = new Queue< T >();
|
||||
private object _queueSync = new object();
|
||||
|
|
Loading…
Reference in New Issue