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