From d9dcc6fa8b6b17efbca60d959bcf18d6dc9934ae Mon Sep 17 00:00:00 2001 From: gareth Date: Sat, 24 Mar 2007 18:29:35 +0000 Subject: Moved gridserver into main trunk (but no prebuild yet) --- OGS/userserver/src/ConsoleCmds.cs | 57 ---------- OGS/userserver/src/Main.cs | 118 --------------------- OGS/userserver/src/OGS-UserServer.csproj | 63 ----------- OGS/userserver/src/OGS-UserServer.csproj.user | 8 -- OGS/userserver/src/Properties/AssemblyInfo.cs | 33 ------ OGS/userserver/src/UserHttp.cs | 146 -------------------------- 6 files changed, 425 deletions(-) delete mode 100644 OGS/userserver/src/ConsoleCmds.cs delete mode 100644 OGS/userserver/src/Main.cs delete mode 100644 OGS/userserver/src/OGS-UserServer.csproj delete mode 100644 OGS/userserver/src/OGS-UserServer.csproj.user delete mode 100644 OGS/userserver/src/Properties/AssemblyInfo.cs delete mode 100644 OGS/userserver/src/UserHttp.cs (limited to 'OGS/userserver/src') diff --git a/OGS/userserver/src/ConsoleCmds.cs b/OGS/userserver/src/ConsoleCmds.cs deleted file mode 100644 index f2568fc..0000000 --- a/OGS/userserver/src/ConsoleCmds.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright (c) OpenSim 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 ServerConsole; - -namespace OpenGridServices -{ - - public class UserConsole : conscmd_callback { - public UserConsole() { } - - public override void RunCmd(string cmd, string[] cmdparams) { - switch(cmd) { - case "help": - ServerConsole.MainConsole.Instance.WriteLine("shutdown - shutdown the user server (USE CAUTION!)" -); - break; - - case "shutdown": - ServerConsole.MainConsole.Instance.Close(); - Environment.Exit(0); - break; - } - } - - public override void Show(string ShowWhat) { - } - } -} diff --git a/OGS/userserver/src/Main.cs b/OGS/userserver/src/Main.cs deleted file mode 100644 index 7e5308e..0000000 --- a/OGS/userserver/src/Main.cs +++ /dev/null @@ -1,118 +0,0 @@ -/* -Copyright (c) OpenSim 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.Collections; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using ServerConsole; -using OpenSim.Framework.User; -using OpenSim.Framework.Sims; -using OpenSim.Framework.Inventory; - -namespace OpenGridServices -{ - /// - /// - public class OpenUser_Main - { - - public static OpenUser_Main userserver; - - public UserHTTPServer _httpd; - public UserProfileManager _profilemanager; - public UserProfile GridGod; - public string DefaultStartupMsg; - public string GridURL; - public string GridSendKey; - public string GridRecvKey; - - public Dictionary UserSessions = new Dictionary(); - - [STAThread] - public static void Main( string[] args ) - { - Console.WriteLine("OpenUser " + VersionInfo.Version + "\n"); - Console.WriteLine("Starting...\n"); - ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0, "opengrid-console.log", "OpenUser", new UserConsole()); - - userserver = new OpenUser_Main(); - userserver.Startup(); - - ServerConsole.MainConsole.Instance.WriteLine("\nEnter help for a list of commands\n"); - - while(true) { - ServerConsole.MainConsole.Instance.MainConsolePrompt(); - } - } - - public void Startup() { - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings"); - - this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: "); - this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: "); - this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: "); - - this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!] :","Welcome to OGS!"); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager"); - _profilemanager = new UserProfileManager(); - _profilemanager.InitUserProfiles(); - _profilemanager.SetKeys(GridSendKey, GridRecvKey, GridURL, DefaultStartupMsg); - - - string tempfirstname; - string templastname; - string tempMD5Passwd; - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please configure the grid god user:"); - tempfirstname=ServerConsole.MainConsole.Instance.CmdPrompt("First name: "); - templastname=ServerConsole.MainConsole.Instance.CmdPrompt("Last name: "); - tempMD5Passwd=ServerConsole.MainConsole.Instance.PasswdPrompt("Password: "); - - System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider(); - byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd); - bs = x.ComputeHash(bs); - System.Text.StringBuilder s = new System.Text.StringBuilder(); - foreach (byte b in bs) - { - s.Append(b.ToString("x2").ToLower()); - } - tempMD5Passwd = "$1$" + s.ToString(); - - GridGod=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd); - _profilemanager.SetGod(GridGod.UUID); - GridGod.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f); - GridGod.homepos = new LLVector3(128f,128f,23f); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process"); - _httpd = new UserHTTPServer(); - } - } -} diff --git a/OGS/userserver/src/OGS-UserServer.csproj b/OGS/userserver/src/OGS-UserServer.csproj deleted file mode 100644 index f4fa8b6..0000000 --- a/OGS/userserver/src/OGS-UserServer.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {D45B6E48-5668-478D-B9CB-6D46E665FACF} - Exe - Properties - OGS_UserServer - OGS-UserServer - OpenGridServices.OpenUser_Main - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\common\bin\libsecondlife.dll - - - - - - - - OGS-Console.cs - - - VersionInfo.cs - - - - - - - - - {2E46A825-3168-492F-93BC-637126B5B72B} - OpenSim.Framework - - - {7667E6E2-F227-41A2-B1B2-315613E1BAFC} - ServerConsole - - - - \ No newline at end of file diff --git a/OGS/userserver/src/OGS-UserServer.csproj.user b/OGS/userserver/src/OGS-UserServer.csproj.user deleted file mode 100644 index aa75a3d..0000000 --- a/OGS/userserver/src/OGS-UserServer.csproj.user +++ /dev/null @@ -1,8 +0,0 @@ - - - publish\ - 0 - en-US - false - - \ No newline at end of file diff --git a/OGS/userserver/src/Properties/AssemblyInfo.cs b/OGS/userserver/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 5d5ce8d..0000000 --- a/OGS/userserver/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OGS-UserServer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OGS-UserServer")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OGS/userserver/src/UserHttp.cs b/OGS/userserver/src/UserHttp.cs deleted file mode 100644 index ce3cfcd..0000000 --- a/OGS/userserver/src/UserHttp.cs +++ /dev/null @@ -1,146 +0,0 @@ -/* -Copyright (c) OpenGrid 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; -using OpenSim.Framework.User; -using OpenSim.Framework.Sims; -using OpenSim.Framework.Inventory; - -namespace OpenGridServices -{ - public class UserHTTPServer { - public Thread HTTPD; - public HttpListener Listener; - - public UserHTTPServer() { - ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server"); - HTTPD = new Thread(new ThreadStart(StartHTTP)); - HTTPD.Start(); - } - - public void StartHTTP() { - ServerConsole.MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK"); - Listener = new HttpListener(); - - Listener.Prefixes.Add("http://+:8002/userserver/"); - Listener.Prefixes.Add("http://+:8002/usersessions/"); - Listener.Start(); - - HttpListenerContext context; - while(true) { - context = Listener.GetContext(); - ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); - } - } - - static string ParseXMLRPC(string requestBody) { - return OpenGridServices.OpenUser_Main.userserver._profilemanager.ParseXMLRPC(requestBody); - } - - static string ParseREST(HttpListenerRequest www_req) { - Console.WriteLine("INCOMING REST - " + www_req.RawUrl); - - char[] splitter = {'/'}; - string[] rest_params = www_req.RawUrl.Split(splitter); - string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla - switch(req_type) { - case "usersessions": - LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid - if(www_req.HttpMethod=="DELETE") { - foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) { - if(OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID==sessionid) { - OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID=null; - OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID=null; - OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear(); - } - } - - } - return "OK"; - break; - } - - 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 "text/plaintext": - responseString=ParseREST(request); - response.AddHeader("Content-type","text/plaintext"); - 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(); - } - } - - -} -- cgit v1.1