diff --git a/opensim/opensim.build b/opensim/opensim.build index d2d20f11e9..a08a486525 100644 --- a/opensim/opensim.build +++ b/opensim/opensim.build @@ -69,6 +69,7 @@ + diff --git a/opensim/src/CAPS/SimHttp.cs b/opensim/src/CAPS/SimHttp.cs new file mode 100644 index 0000000000..9d85baebcc --- /dev/null +++ b/opensim/src/CAPS/SimHttp.cs @@ -0,0 +1,144 @@ +/* +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 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 ``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 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) { + // Eventually will be used for useful things if we actually use XML-RPC + case "": + 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(); + } + } + + +} diff --git a/opensim/src/Config/SimConfig/AssemblyInfo.cs b/opensim/src/Config/SimConfig/AssemblyInfo.cs index c384231374..9c57c2d8c6 100644 --- a/opensim/src/Config/SimConfig/AssemblyInfo.cs +++ b/opensim/src/Config/SimConfig/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-simconfig")] [assembly: AssemblyDescriptionAttribute("The default configuration handler")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/GridInterfaces/AssemblyInfo.cs b/opensim/src/GridInterfaces/AssemblyInfo.cs index d1348ff932..0a41503369 100644 --- a/opensim/src/GridInterfaces/AssemblyInfo.cs +++ b/opensim/src/GridInterfaces/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-gridinterfaces")] [assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/opensim/src/LocalServers/LocalGridServers/AssemblyInfo.cs index 82c8ab6b65..612dd28f24 100644 --- a/opensim/src/LocalServers/LocalGridServers/AssemblyInfo.cs +++ b/opensim/src/LocalServers/LocalGridServers/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-localservers")] [assembly: AssemblyDescriptionAttribute("local grid servers")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs b/opensim/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs index 8c9292d378..f5ee3201ce 100644 --- a/opensim/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs +++ b/opensim/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-localstorage")] [assembly: AssemblyDescriptionAttribute("The local storage handler")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/opensim/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs index b405c178b9..526e59c0d2 100644 --- a/opensim/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs +++ b/opensim/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-remoteservers")] [assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/opensim/src/RemoteServers/RemoteGridServers/RemoteGrid.cs index 428d5f551b..9175d65845 100644 --- a/opensim/src/RemoteServers/RemoteGridServers/RemoteGrid.cs +++ b/opensim/src/RemoteServers/RemoteGridServers/RemoteGrid.cs @@ -69,7 +69,8 @@ namespace RemoteGridServers { private string GridServerUrl; private string GridSendKey; - + private Dictionary AgentCircuits = new Dictionary(); + public RemoteGridServer() { ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); @@ -79,26 +80,20 @@ 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 { @@ -213,6 +208,16 @@ namespace RemoteGridServers } } } + + 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 >(); diff --git a/opensim/src/ServerConsole/ServerConsole/AssemblyInfo.cs b/opensim/src/ServerConsole/ServerConsole/AssemblyInfo.cs index b4a1c886e5..d6929b7ff1 100644 --- a/opensim/src/ServerConsole/ServerConsole/AssemblyInfo.cs +++ b/opensim/src/ServerConsole/ServerConsole/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-serverconsole")] [assembly: AssemblyDescriptionAttribute("The default server console")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/VersionInfo.cs b/opensim/src/VersionInfo.cs index ea96b9cbcf..9ccb1e32fa 100644 --- a/opensim/src/VersionInfo.cs +++ b/opensim/src/VersionInfo.cs @@ -32,6 +32,6 @@ namespace OpenSim /// public class VersionInfo { - public static string Version = "0.1, Build 1173804949, Revision 195"; + public static string Version = "0.1, Build 1173807988, Revision 196M"; } } diff --git a/opensim/src/physics/AssemblyInfo.cs b/opensim/src/physics/AssemblyInfo.cs index 0f662a1e68..e8f0058fac 100644 --- a/opensim/src/physics/AssemblyInfo.cs +++ b/opensim/src/physics/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-physicsmanager")] [assembly: AssemblyDescriptionAttribute("Handles physics plugins")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/opensim/src/physics/plugins/AssemblyInfo.cs b/opensim/src/physics/plugins/AssemblyInfo.cs index 915b62f8a3..3caac3c632 100644 --- a/opensim/src/physics/plugins/AssemblyInfo.cs +++ b/opensim/src/physics/plugins/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.195")] +[assembly: AssemblyVersionAttribute("0.1.*.196")] [assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")] [assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]