merged new OpenSim from branches/ogs-cs

adam
gareth 2007-03-14 03:34:49 +00:00
parent 5d2cadf6de
commit 7a54467bed
17 changed files with 230 additions and 33 deletions

View File

@ -69,6 +69,7 @@
<include name="world/*.cs" />
<include name="GridServers/*.cs" />
<include name="Assets/*.cs" />
<include name="CAPS/*.cs" />
</sources>
</csc>

152
src/CAPS/SimHttp.cs Normal file
View File

@ -0,0 +1,152 @@
/*
Copyright (c) OpenSimCAPS project, http://osgrid.org/
* 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.Text;
using Nwc.XmlRpc;
using System.Threading;
using System.Text.RegularExpressions;
using System.Net;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using ServerConsole;
namespace OpenSim
{
// Dummy HTTP server, does nothing useful for now
public class SimCAPSHTTPServer {
public Thread HTTPD;
public HttpListener Listener;
public SimCAPSHTTPServer() {
ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server");
HTTPD = new Thread(new ThreadStart(StartHTTP));
HTTPD.Start();
}
public void StartHTTP() {
ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
Listener = new HttpListener();
Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/");
Listener.Start();
HttpListenerContext context;
while(true) {
context = Listener.GetContext();
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
}
}
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"]);
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 "";
}
static string ParseREST(string requestBody, string requestURL) {
return "";
}
static string ParseLLSDXML(string requestBody) {
// dummy function for now - IMPLEMENT ME!
return "";
}
static void HandleRequest(Object stateinfo) {
HttpListenerContext context=(HttpListenerContext)stateinfo;
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.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
string requestBody = reader.ReadToEnd();
body.Close();
reader.Close();
string responseString="";
switch(request.ContentType) {
case "text/xml":
// must be XML-RPC, so pass to the XML-RPC parser
responseString=ParseXMLRPC(requestBody);
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;
case null:
// must be REST or invalid crap, so pass to the REST parser
responseString=ParseREST(request.Url.OriginalString,requestBody);
break;
}
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();
}
}
}

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-simconfig")]
[assembly: AssemblyDescriptionAttribute("The default configuration handler")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-gridinterfaces")]
[assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -32,6 +32,7 @@ using System.Net;
using System.Net.Sockets;
using System.IO;
using libsecondlife;
using OpenSim;
namespace OpenSim.GridServers
{
@ -46,6 +47,10 @@ namespace OpenSim.GridServers
public interface IGridServer
{
bool RequestConnection();
Dictionary<uint, agentcircuitdata> agentcircuits {
get;
set;
}
UUIDBlock RequestUUIDBlock();
void RequestNeighbours(); //should return a array of neighbouring regions
AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
@ -91,4 +96,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;
}
}

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-localservers")]
[assembly: AssemblyDescriptionAttribute("local grid servers")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -113,7 +113,14 @@ namespace LocalGridServers
public class LocalGridServer :IGridServer
{
public List<Login> Sessions = new List<Login>();
private Dictionary<uint, agentcircuitdata> AgentCircuits = new Dictionary<uint, agentcircuitdata>();
public Dictionary<uint, agentcircuitdata> agentcircuits {
get {return agentcircuits;}
set {agentcircuits=value;}
}
public LocalGridServer()
{
Sessions = new List<Login>();

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-localstorage")]
[assembly: AssemblyDescriptionAttribute("The local storage handler")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -56,7 +56,8 @@ namespace OpenSim
public static SimConfig cfg;
public static World local_world;
public static Grid gridServers;
public static SimCAPSHTTPServer http_server;
public static Socket Server;
private static IPEndPoint ServerIncoming;
private static byte[] RecvBuffer = new byte[4096];
@ -169,6 +170,9 @@ namespace OpenSim
local_world.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
local_world.LoadPrimsFromStorage();
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
http_server = new SimCAPSHTTPServer();
MainServerListener();
}

View File

@ -175,7 +175,7 @@ namespace OpenSim
break;
case "users":
OpenSim.world.Avatar TempAv;
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar")
{

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-remoteservers")]
[assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -69,7 +69,13 @@ namespace RemoteGridServers
{
private string GridServerUrl;
private string GridSendKey;
private Dictionary<uint, agentcircuitdata> AgentCircuits = new Dictionary<uint, agentcircuitdata>();
public Dictionary<uint, agentcircuitdata> agentcircuits {
get {return AgentCircuits;}
set {AgentCircuits=value;}
}
public RemoteGridServer()
{
ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created");
@ -79,26 +85,21 @@ namespace RemoteGridServers
{
return true;
}
public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
{
agentcircuitdata validcircuit=this.AgentCircuits[circuitcode];
AuthenticateResponse user = new AuthenticateResponse();
WebRequest CheckSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/exists");
WebResponse GridResponse = CheckSession.GetResponse();
StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
String grTest = sr.ReadLine();
sr.Close();
GridResponse.Close();
if(String.IsNullOrEmpty(grTest) || grTest.Equals("1"))
if((sessionID==validcircuit.SessionID) && (agentID==validcircuit.AgentID))
{
// YAY! Valid login
user.Authorised = true;
user.LoginInfo = new Login();
user.LoginInfo.Agent = agentID;
user.LoginInfo.Session = sessionID;
user.LoginInfo.First = "";
user.LoginInfo.Last = "";
user.LoginInfo.First = validcircuit.firstname;
user.LoginInfo.Last = validcircuit.lastname;
}
else
{
@ -111,13 +112,18 @@ namespace RemoteGridServers
public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
{
WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/delete");
WebResponse GridResponse = DeleteSession.GetResponse();
StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
String grTest = sr.ReadLine();
sr.Close();
GridResponse.Close();
ServerConsole.MainConsole.Instance.WriteLine("DEBUG: " + grTest);
WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString());
DeleteSession.Method="DELETE";
DeleteSession.ContentType="text/plaintext";
DeleteSession.ContentLength=0;
StreamWriter stOut = new StreamWriter (DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
stOut.Write("");
stOut.Close();
StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
string GridResponse = stIn.ReadToEnd();
stIn.Close();
return(true);
}
@ -213,7 +219,7 @@ namespace RemoteGridServers
}
}
}
public class BlockingQueue< T > {
private Queue< T > _queue = new Queue< T >();
private object _queueSync = new object();

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-serverconsole")]
[assembly: AssemblyDescriptionAttribute("The default server console")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -59,6 +59,16 @@ 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;
}
public class BlockingQueue< T > {
private Queue< T > _queue = new Queue< T >();

View File

@ -32,6 +32,6 @@ namespace OpenSim
/// </summary>
public class VersionInfo
{
public static string Version = "0.1, Build 1173785234, Revision 192M";
public static string Version = "0.1, Build 1173843165, Revision 193:206M";
}
}

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-physicsmanager")]
[assembly: AssemblyDescriptionAttribute("Handles physics plugins")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyVersionAttribute("0.1.*.192")]
[assembly: AssemblyVersionAttribute("0.1.*.193206")]
[assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")]
[assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")]
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]