From 591e1704283330b0120e99819ff68404d1c92d76 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 8 Jun 2007 16:55:44 +0000 Subject: [PATCH] Re-imported OpenGridServices from trunk --- .../GridConfigDb4o/AssemblyInfo.cs | 58 ++ .../GridConfigDb4o/DbGridConfig.cs | 161 +++++ .../OpenGrid.Config.GridConfigDb4o.csproj | 107 +++ ...OpenGrid.Config.GridConfigDb4o.csproj.user | 12 + .../OpenGrid.Config.GridConfigDb4o.dll.build | 46 ++ .../DB4oGridData.cs | 161 +++++ .../DB4oManager.cs | 165 +++++ .../DB4oUserData.cs | 205 ++++++ .../OpenGrid.Framework.Data.DB4o.csproj | 225 ++++++ .../OpenGrid.Framework.Data.DB4o.csproj.mine | 111 +++ .../OpenGrid.Framework.Data.DB4o.csproj.r858 | 111 +++ .../OpenGrid.Framework.Data.DB4o.csproj.r921 | 111 +++ .../OpenGrid.Framework.Data.DB4o.csproj.user | 12 + .../OpenGrid.Framework.Data.DB4o.dll.build | 47 ++ .../Properties/AssemblyInfo.cs | 35 + .../MSSQLGridData.cs | 190 +++++ .../MSSQLManager.cs | 214 ++++++ .../OpenGrid.Framework.Data.MSSQL.csproj | 104 +++ .../OpenGrid.Framework.Data.MSSQL.csproj.user | 12 + .../OpenGrid.Framework.Data.MSSQL.dll.build | 45 ++ .../Properties/AssemblyInfo.cs | 35 + .../MySQLGridData.cs | 258 +++++++ .../MySQLInventoryData.cs | 309 ++++++++ .../MySQLLogData.cs | 107 +++ .../MySQLManager.cs | 581 +++++++++++++++ .../MySQLUserData.cs | 257 +++++++ .../OpenGrid.Framework.Data.MySQL.csproj | 237 +++++++ .../OpenGrid.Framework.Data.MySQL.csproj.mine | 117 ++++ .../OpenGrid.Framework.Data.MySQL.csproj.r858 | 114 +++ .../OpenGrid.Framework.Data.MySQL.csproj.r921 | 117 ++++ .../OpenGrid.Framework.Data.MySQL.csproj.user | 12 + .../OpenGrid.Framework.Data.MySQL.dll.build | 49 ++ .../Properties/AssemblyInfo.cs | 35 + .../OpenGrid.Framework.Data.SQLite.csproj | 219 ++++++ ...OpenGrid.Framework.Data.SQLite.csproj.mine | 108 +++ ...OpenGrid.Framework.Data.SQLite.csproj.r858 | 108 +++ ...OpenGrid.Framework.Data.SQLite.csproj.r921 | 108 +++ ...OpenGrid.Framework.Data.SQLite.csproj.user | 12 + .../OpenGrid.Framework.Data.SQLite.dll.build | 46 ++ .../Properties/AssemblyInfo.cs | 35 + .../SQLiteGridData.cs | 190 +++++ .../SQLiteManager.cs | 209 ++++++ .../OpenGrid.Framework.Data/GridData.cs | 110 +++ .../OpenGrid.Framework.Data/ILogData.cs | 94 +++ .../OpenGrid.Framework.Data/IniConfig.cs | 100 +++ .../OpenGrid.Framework.Data/InventoryData.cs | 187 +++++ .../OpenGrid.Framework.Data.csproj | 229 ++++++ .../OpenGrid.Framework.Data.csproj.mine | 113 +++ .../OpenGrid.Framework.Data.csproj.r858 | 110 +++ .../OpenGrid.Framework.Data.csproj.r921 | 113 +++ .../OpenGrid.Framework.Data.csproj.user | 12 + .../OpenGrid.Framework.Data.dll.build | 49 ++ .../Properties/AssemblyInfo.cs | 35 + .../OpenGrid.Framework.Data/SimProfileData.cs | 114 +++ .../OpenGrid.Framework.Data/UserData.cs | 131 ++++ .../UserProfileData.cs | 182 +++++ .../GridManagementAgent.cs | 140 ++++ .../GridServerManager.cs | 94 +++ .../OpenGrid.Framework.Manager.csproj | 99 +++ .../OpenGrid.Framework.Manager.csproj.user | 12 + .../OpenGrid.Framework.Manager.dll.build | 44 ++ .../AssetHttpServer.cs | 130 ++++ .../OpenGridServices.AssetServer/Main.cs | 338 +++++++++ .../OpenGridServices.AssetServer.csproj | 247 +++++++ .../OpenGridServices.AssetServer.csproj.mine | 122 ++++ .../OpenGridServices.AssetServer.csproj.r858 | 122 ++++ .../OpenGridServices.AssetServer.csproj.r921 | 122 ++++ .../OpenGridServices.AssetServer.csproj.user | 12 + .../OpenGridServices.AssetServer.exe.build | 50 ++ .../OpenGridServices.GridServer.csproj | 126 ++++ .../OpenGridServices.GridServer.exe.build | 49 ++ .../Properties/AssemblyInfo.cs | 33 + .../GridManager.cs | 575 +++++++++++++++ .../OpenGridServices.GridServer/Main.cs | 271 +++++++ .../OpenGridServices.GridServer.csproj | 134 ++++ .../OpenGridServices.GridServer.csproj.user | 12 + .../OpenGridServices.GridServer.exe.build | 52 ++ .../Properties/AssemblyInfo.cs | 33 + .../InventoryManager.cs | 125 ++++ .../OpenGridServices.InventoryServer/Main.cs | 87 +++ .../OpenGridServices.InventoryServer.csproj | 125 ++++ ...OpenGridServices.InventoryServer.exe.build | 50 ++ .../OpenGridServices.Manager.mds | 16 + .../OpenGridServices.Manager.userprefs | 39 ++ .../OpenGridServices.Manager.usertasks | 2 + .../OpenGridServices.Manager/AssemblyInfo.cs | 32 + .../OpenGridServices.Manager/BlockingQueue.cs | 33 + .../Connect to grid server.cs | 16 + .../ConnectToGridServerDialog.cs | 29 + .../GridServerConnectionManager.cs | 106 +++ .../OpenGridServices.Manager/Main.cs | 96 +++ .../OpenGridServices.Manager/MainWindow.cs | 76 ++ .../OpenGridServices.Manager.mdp | 43 ++ .../OpenGridServices.Manager.pidb | Bin 0 -> 12308 bytes .../OpenGridServices.Manager/RegionBlock.cs | 37 + .../OpenGridServices.Manager/Util.cs | 133 ++++ ...vices.Manager.ConnectToGridServerDialog.cs | 226 ++++++ .../OpenGridServices.Manager.MainWindow.cs | 256 +++++++ .../gtk-gui/generated.cs | 35 + .../gtk-gui/gui.stetic | 502 +++++++++++++ .../OpenGridServices.UserServer/Main.cs | 216 ++++++ .../OGS-UserServer.csproj | 63 ++ .../OpenGridServices.UserServer.csproj | 128 ++++ .../OpenGridServices.UserServer.csproj.user | 12 + .../OpenGridServices.UserServer.exe.build | 51 ++ .../Properties/AssemblyInfo.cs | 33 + .../UserManager.cs | 659 ++++++++++++++++++ .../UserConfigDb4o/AssemblyInfo.cs | 58 ++ .../UserConfigDb4o/DbUserConfig.cs | 96 +++ .../OpenUser.Config.UserConfigDb4o.csproj | 107 +++ ...OpenUser.Config.UserConfigDb4o.csproj.user | 12 + .../OpenUser.Config.UserConfigDb4o.dll.build | 46 ++ .../ServiceManager/ServiceManager.cs | 259 +++++++ .../ServiceManager/ServiceManager.csproj | 205 ++++++ .../ServiceManager/ServiceManager.csproj.mine | 103 +++ .../ServiceManager/ServiceManager.csproj.r858 | 96 +++ .../ServiceManager/ServiceManager.csproj.r921 | 100 +++ .../ServiceManager/ServiceManager.csproj.user | 12 + .../ServiceManager/ServiceManager.exe.build | 44 ++ 119 files changed, 14155 insertions(+) create mode 100644 OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs create mode 100644 OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj create mode 100644 OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user create mode 100644 OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.mine create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r858 create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r921 create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858 create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921 create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build create mode 100644 OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.mine create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r858 create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r921 create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/GridData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/ILogData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj create mode 100644 OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.mine create mode 100644 OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r858 create mode 100644 OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r921 create mode 100644 OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user create mode 100644 OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build create mode 100644 OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/UserData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs create mode 100644 OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj create mode 100644 OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user create mode 100644 OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build create mode 100644 OpenGridServices/OpenGridServices.AssetServer/AssetHttpServer.cs create mode 100644 OpenGridServices/OpenGridServices.AssetServer/Main.cs create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.mine create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r858 create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r921 create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj create mode 100644 OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build create mode 100644 OpenGridServices/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGridServices.GridServer/GridManager.cs create mode 100644 OpenGridServices/OpenGridServices.GridServer/Main.cs create mode 100644 OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj create mode 100644 OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user create mode 100644 OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build create mode 100644 OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs create mode 100644 OpenGridServices/OpenGridServices.InventoryServer/Main.cs create mode 100644 OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj create mode 100644 OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.exe.build create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.mds create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.userprefs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.usertasks create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs create mode 100644 OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic create mode 100644 OpenGridServices/OpenGridServices.UserServer/Main.cs create mode 100644 OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj create mode 100644 OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj create mode 100644 OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user create mode 100644 OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build create mode 100644 OpenGridServices/OpenGridServices.UserServer/Properties/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenGridServices.UserServer/UserManager.cs create mode 100644 OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs create mode 100644 OpenGridServices/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs create mode 100644 OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj create mode 100644 OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user create mode 100644 OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build create mode 100644 OpenGridServices/ServiceManager/ServiceManager.cs create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj.mine create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj.r858 create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj.r921 create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj.user create mode 100644 OpenGridServices/ServiceManager/ServiceManager.exe.build diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs new file mode 100644 index 0000000000..c9701d6139 --- /dev/null +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("GridConfig")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GridConfig")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs new file mode 100644 index 0000000000..e69515ae67 --- /dev/null +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs @@ -0,0 +1,161 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using Db4objects.Db4o; + +namespace OpenGrid.Config.GridConfigDb4o +{ + /// + /// A grid configuration interface for returning the DB4o Config Provider + /// + public class Db40ConfigPlugin: IGridConfig + { + /// + /// Loads and returns a configuration objeect + /// + /// A grid configuration object + public GridConfig GetConfigObject() + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Loading Db40Config dll"); + return ( new DbGridConfig()); + } + } + + /// + /// A DB4o based Gridserver configuration object + /// + public class DbGridConfig : GridConfig + { + /// + /// The DB4o Database + /// + private IObjectContainer db; + + /// + /// User configuration for the Grid Config interfaces + /// + public void LoadDefaults() { + OpenSim.Framework.Console.MainConsole.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); + + // About the grid options + this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team"); + + // Asset Options + this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); + this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server","null"); + this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server","null"); + + // User Server Options + this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); + this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server","null"); + this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server","null"); + + // Region Server Options + this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims","null"); + this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims","null"); + } + + /// + /// Initialises a new configuration object + /// + public override void InitConfig() { + try { + // Perform Db4o initialisation + db = Db4oFactory.OpenFile("opengrid.yap"); + + // Locate the grid configuration object + IObjectSet result = db.Get(typeof(DbGridConfig)); + // Found? + if(result.Count==1) { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); + foreach (DbGridConfig cfg in result) { + // Import each setting into this class + // Grid Settings + this.GridOwner=cfg.GridOwner; + // Asset Settings + this.DefaultAssetServer=cfg.DefaultAssetServer; + this.AssetSendKey=cfg.AssetSendKey; + this.AssetRecvKey=cfg.AssetRecvKey; + // User Settings + this.DefaultUserServer=cfg.DefaultUserServer; + this.UserSendKey=cfg.UserSendKey; + this.UserRecvKey=cfg.UserRecvKey; + // Region Settings + this.SimSendKey=cfg.SimSendKey; + this.SimRecvKey=cfg.SimRecvKey; + } + // Create a new configuration object from this class + } else { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); + + // Load default settings into this class + LoadDefaults(); + + // Saves to the database file... + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Writing out default settings to local database"); + db.Set(this); + + // Closes file locks + db.Close(); + } + } catch(Exception e) { + OpenSim.Framework.Console.MainConsole.Instance.Warn("Config.cs:InitConfig() - Exception occured"); + OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); + } + + // Grid Settings + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Grid settings loaded:"); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Grid owner: " + this.GridOwner); + + // Asset Settings + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); + + // User Settings + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Default user server: " + this.DefaultUserServer); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to send to user server: " + this.UserSendKey); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); + + // Region Settings + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to send to sims: " + this.SimSendKey); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); + } + + /// + /// Closes down the database and releases filesystem locks + /// + public void Shutdown() { + db.Close(); + } + } + +} diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj new file mode 100644 index 0000000000..744e1e8749 --- /dev/null +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj @@ -0,0 +1,107 @@ + + + Local + 8.0.50727 + 2.0 + {B0027747-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Config.GridConfigDb4o + JScript + Grid + IE50 + false + Library + + OpenGrid.Config.GridConfigDb4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + ..\..\..\bin\System.Data.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build new file mode 100644 index 0000000000..cbc847909c --- /dev/null +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs new file mode 100644 index 0000000000..2b2313163c --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs @@ -0,0 +1,161 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using OpenGrid.Framework.Data; +using libsecondlife; + + +namespace OpenGrid.Framework.Data.DB4o +{ + /// + /// A grid server storage mechanism employing the DB4o database system + /// + class DB4oGridData : IGridData + { + /// + /// The database manager object + /// + DB4oGridManager manager; + + /// + /// Called when the plugin is first loaded (as constructors are not called) + /// + public void Initialise() { + manager = new DB4oGridManager("gridserver.yap"); + } + + /// + /// Returns a list of regions within the specified ranges + /// + /// minimum X coordinate + /// minimum Y coordinate + /// maximum X coordinate + /// maximum Y coordinate + /// An array of region profiles + public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + { + return null; + } + + /// + /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) + /// + /// The handle to search for + /// A region profile + public SimProfileData GetProfileByHandle(ulong handle) { + lock (manager.simProfiles) + { + foreach (LLUUID UUID in manager.simProfiles.Keys) + { + if (manager.simProfiles[UUID].regionHandle == handle) + { + return manager.simProfiles[UUID]; + } + } + } + throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); + } + + /// + /// Returns a specific region + /// + /// The region ID code + /// A region profile + public SimProfileData GetProfileByLLUUID(LLUUID uuid) + { + lock (manager.simProfiles) + { + if (manager.simProfiles.ContainsKey(uuid)) + return manager.simProfiles[uuid]; + } + throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); + } + + /// + /// Adds a new specified region to the database + /// + /// The profile to add + /// A dataresponse enum indicating success + public DataResponse AddProfile(SimProfileData profile) + { + lock (manager.simProfiles) + { + if (manager.AddRow(profile)) + { + return DataResponse.RESPONSE_OK; + } + else + { + return DataResponse.RESPONSE_ERROR; + } + } + } + + /// + /// Authenticates a new region using the shared secrets. NOT SECURE. + /// + /// The UUID the region is authenticating with + /// The location the region is logging into (unused in Db4o) + /// The shared secret + /// Authenticated? + public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { + if (manager.simProfiles[uuid].regionRecvKey == key) + return true; + return false; + } + + /// + /// Shuts down the database + /// + public void Close() + { + manager = null; + } + + /// + /// Returns the providers name + /// + /// The name of the storage system + public string getName() + { + return "DB4o Grid Provider"; + } + + /// + /// Returns the providers version + /// + /// The version of the storage system + public string getVersion() + { + return "0.1"; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs new file mode 100644 index 0000000000..356a49cbd7 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs @@ -0,0 +1,165 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using Db4objects.Db4o; +using OpenGrid.Framework.Data; +using libsecondlife; + +namespace OpenGrid.Framework.Data.DB4o +{ + /// + /// A Database manager for Db4o + /// + class DB4oGridManager + { + /// + /// A list of the current regions connected (in-memory cache) + /// + public Dictionary simProfiles = new Dictionary(); + /// + /// Database File Name + /// + string dbfl; + + /// + /// Creates a new grid storage manager + /// + /// Filename to the database file + public DB4oGridManager(string db4odb) + { + dbfl = db4odb; + IObjectContainer database; + database = Db4oFactory.OpenFile(dbfl); + IObjectSet result = database.Get(typeof(SimProfileData)); + // Loads the file into the in-memory cache + foreach(SimProfileData row in result) { + simProfiles.Add(row.UUID, row); + } + database.Close(); + } + + /// + /// Adds a new profile to the database (Warning: Probably slow.) + /// + /// The profile to add + /// Successful? + public bool AddRow(SimProfileData row) + { + if (simProfiles.ContainsKey(row.UUID)) + { + simProfiles[row.UUID] = row; + } + else + { + simProfiles.Add(row.UUID, row); + } + + try + { + IObjectContainer database; + database = Db4oFactory.OpenFile(dbfl); + database.Set(row); + database.Close(); + return true; + } + catch (Exception e) + { + return false; + } + } + + + } + + /// + /// A manager for the DB4o database (user profiles) + /// + class DB4oUserManager + { + /// + /// A list of the user profiles (in memory cache) + /// + public Dictionary userProfiles = new Dictionary(); + /// + /// Database filename + /// + string dbfl; + + /// + /// Initialises a new DB manager + /// + /// The filename to the database + public DB4oUserManager(string db4odb) + { + dbfl = db4odb; + IObjectContainer database; + database = Db4oFactory.OpenFile(dbfl); + // Load to cache + IObjectSet result = database.Get(typeof(UserProfileData)); + foreach (UserProfileData row in result) + { + userProfiles.Add(row.UUID, row); + } + database.Close(); + } + + /// + /// Adds a new profile to the database (Warning: Probably slow.) + /// + /// The profile to add + /// Successful? + public bool AddRow(UserProfileData row) + { + if (userProfiles.ContainsKey(row.UUID)) + { + userProfiles[row.UUID] = row; + } + else + { + userProfiles.Add(row.UUID, row); + } + + try + { + IObjectContainer database; + database = Db4oFactory.OpenFile(dbfl); + database.Set(row); + database.Close(); + return true; + } + catch (Exception e) + { + return false; + } + } + + + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs new file mode 100644 index 0000000000..315f48d0ae --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs @@ -0,0 +1,205 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using OpenGrid.Framework.Data; +using libsecondlife; + +namespace OpenGrid.Framework.Data.DB4o +{ + /// + /// A User storage interface for the DB4o database system + /// + public class DB4oUserData : IUserData + { + /// + /// The database manager + /// + DB4oUserManager manager; + + /// + /// Artificial constructor called upon plugin load + /// + public void Initialise() + { + manager = new DB4oUserManager("userprofiles.yap"); + } + + /// + /// Loads a specified user profile from a UUID + /// + /// The users UUID + /// A user profile + public UserProfileData getUserByUUID(LLUUID uuid) + { + if(manager.userProfiles.ContainsKey(uuid)) + return manager.userProfiles[uuid]; + return null; + } + + /// + /// Returns a user by searching for its name + /// + /// The users account name + /// A matching users profile + public UserProfileData getUserByName(string name) + { + return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); + } + + /// + /// Returns a user by searching for its name + /// + /// The first part of the users account name + /// The second part of the users account name + /// A matching users profile + public UserProfileData getUserByName(string fname, string lname) + { + foreach (UserProfileData profile in manager.userProfiles.Values) + { + if (profile.username == fname && profile.surname == lname) + return profile; + } + return null; + } + + /// + /// Returns a user by UUID direct + /// + /// The users account ID + /// A matching users profile + public UserAgentData getAgentByUUID(LLUUID uuid) + { + try + { + return getUserByUUID(uuid).currentAgent; + } + catch (Exception e) + { + return null; + } + } + + /// + /// Returns a session by account name + /// + /// The account name + /// The users session agent + public UserAgentData getAgentByName(string name) + { + return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); + } + + /// + /// Returns a session by account name + /// + /// The first part of the users account name + /// The second part of the users account name + /// A user agent + public UserAgentData getAgentByName(string fname, string lname) + { + try + { + return getUserByName(fname,lname).currentAgent; + } + catch (Exception e) + { + return null; + } + } + + /// + /// Creates a new user profile + /// + /// The profile to add to the database + public void addNewUserProfile(UserProfileData user) + { + try + { + manager.AddRow(user); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + } + + /// + /// Creates a new user agent + /// + /// The agent to add to the database + public void addNewUserAgent(UserAgentData agent) + { + // Do nothing. yet. + } + + /// + /// Transfers money between two user accounts + /// + /// Starting account + /// End account + /// The amount to move + /// Success? + public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) + { + return true; + } + + /// + /// Transfers inventory between two accounts + /// + /// Move to inventory server + /// Senders account + /// Recievers account + /// Inventory item + /// Success? + public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) + { + return true; + } + + /// + /// Returns the name of the storage provider + /// + /// Storage provider name + public string getName() + { + return "DB4o Userdata"; + } + + /// + /// Returns the version of the storage provider + /// + /// Storage provider version + public string getVersion() + { + return "0.1"; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj new file mode 100644 index 0000000000..6ced216340 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj @@ -0,0 +1,225 @@ +<<<<<<< .mine + + + Local + 8.0.50727 + 2.0 + {39BD9497-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.DB4o + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.DB4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + +======= + + + Local + 8.0.50727 + 2.0 + {39BD9497-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.DB4o + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.DB4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + +>>>>>>> .r921 diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.mine b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.mine new file mode 100644 index 0000000000..82d4f5fab5 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.mine @@ -0,0 +1,111 @@ + + + Local + 8.0.50727 + 2.0 + {39BD9497-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.DB4o + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.DB4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r858 b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r858 new file mode 100644 index 0000000000..d6dd03d809 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r858 @@ -0,0 +1,111 @@ + + + Local + 8.0.50727 + 2.0 + {BC0F052F-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.DB4o + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.DB4o + + + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ../../bin/ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ../../bin/ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + + + OpenGrid.Framework.Data + {12DD8EB8-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r921 b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r921 new file mode 100644 index 0000000000..3b783ca607 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.r921 @@ -0,0 +1,111 @@ + + + Local + 8.0.50727 + 2.0 + {39BD9497-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.DB4o + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.DB4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build new file mode 100644 index 0000000000..db8662d7f8 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..dc4a9a1dfd --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("OpenGrid.Framework.Data.DB4o")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Data.DB4o")] +[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("57991e15-79da-41b7-aa06-2e6b49165a63")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs new file mode 100644 index 0000000000..92169c4a08 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs @@ -0,0 +1,190 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using OpenGrid.Framework.Data; + +namespace OpenGrid.Framework.Data.MSSQL +{ + /// + /// A grid data interface for Microsoft SQL Server + /// + public class SqlGridData : IGridData + { + /// + /// Database manager + /// + private MSSqlManager database; + + /// + /// Initialises the Grid Interface + /// + public void Initialise() + { + database = new MSSqlManager("localhost", "db", "user", "password", "false"); + } + + /// + /// Shuts down the grid interface + /// + public void Close() + { + database.Close(); + } + + /// + /// Returns the storage system name + /// + /// A string containing the storage system name + public string getName() + { + return "Sql OpenGridData"; + } + + /// + /// Returns the storage system version + /// + /// A string containing the storage system version + public string getVersion() + { + return "0.1"; + } + + /// + /// Returns a list of regions within the specified ranges + /// + /// minimum X coordinate + /// minimum Y coordinate + /// maximum X coordinate + /// maximum Y coordinate + /// An array of region profiles + public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + { + return null; + } + + /// + /// Returns a sim profile from it's location + /// + /// Region location handle + /// Sim profile + public SimProfileData GetProfileByHandle(ulong handle) + { + Dictionary param = new Dictionary(); + param["handle"] = handle.ToString(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row = database.getRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + + /// + /// Returns a sim profile from it's UUID + /// + /// The region UUID + /// The sim profile + public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) + { + Dictionary param = new Dictionary(); + param["uuid"] = uuid.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row = database.getRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + + /// + /// Adds a new specified region to the database + /// + /// The profile to add + /// A dataresponse enum indicating success + public DataResponse AddProfile(SimProfileData profile) + { + if (database.insertRow(profile)) + { + return DataResponse.RESPONSE_OK; + } + else + { + return DataResponse.RESPONSE_ERROR; + } + } + + /// + /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// + /// The UUID of the challenger + /// The attempted regionHandle of the challenger + /// The secret + /// Whether the secret and regionhandle match the database entry for UUID + public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) + { + bool throwHissyFit = false; // Should be true by 1.0 + + if (throwHissyFit) + throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); + + SimProfileData data = GetProfileByLLUUID(uuid); + + return (handle == data.regionHandle && authkey == data.regionSecret); + } + + /// + /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region + /// + /// This requires a security audit. + /// + /// + /// + /// + /// + public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) + { + System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); + System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); + + byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); + byte[] hash = HashProvider.ComputeHash(stream); + + return false; + } + } + + +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs new file mode 100644 index 0000000000..475a3e7698 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs @@ -0,0 +1,214 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using System.Data; + +using System.Data.SqlClient; + +using OpenGrid.Framework.Data; + +namespace OpenGrid.Framework.Data.MSSQL +{ + /// + /// A management class for the MS SQL Storage Engine + /// + class MSSqlManager + { + /// + /// The database connection object + /// + IDbConnection dbcon; + + /// + /// Initialises and creates a new Sql connection and maintains it. + /// + /// The Sql server being connected to + /// The name of the Sql database being used + /// The username logging into the database + /// The password for the user logging in + /// Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'. + public MSSqlManager(string hostname, string database, string username, string password, string cpooling) + { + try + { + string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; + dbcon = new SqlConnection(connectionString); + + dbcon.Open(); + } + catch (Exception e) + { + throw new Exception("Error initialising Sql Database: " + e.ToString()); + } + } + + /// + /// Shuts down the database connection + /// + public void Close() + { + dbcon.Close(); + dbcon = null; + } + + /// + /// Runs a query with protection against SQL Injection by using parameterised input. + /// + /// The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y + /// The parameters - index so that @y is indexed as 'y' + /// A Sql DB Command + public IDbCommand Query(string sql, Dictionary parameters) + { + SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); + dbcommand.CommandText = sql; + foreach (KeyValuePair param in parameters) + { + dbcommand.Parameters.AddWithValue(param.Key, param.Value); + } + + return (IDbCommand)dbcommand; + } + + /// + /// Runs a database reader object and returns a region row + /// + /// An active database reader + /// A region row + public SimProfileData getRow(IDataReader reader) + { + SimProfileData regionprofile = new SimProfileData(); + + if (reader.Read()) + { + // Region Main + regionprofile.regionHandle = (ulong)reader["regionHandle"]; + regionprofile.regionName = (string)reader["regionName"]; + regionprofile.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); + + // Secrets + regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; + regionprofile.regionSecret = (string)reader["regionSecret"]; + regionprofile.regionSendKey = (string)reader["regionSendKey"]; + + // Region Server + regionprofile.regionDataURI = (string)reader["regionDataURI"]; + regionprofile.regionOnline = false; // Needs to be pinged before this can be set. + regionprofile.serverIP = (string)reader["serverIP"]; + regionprofile.serverPort = (uint)reader["serverPort"]; + regionprofile.serverURI = (string)reader["serverURI"]; + + // Location + regionprofile.regionLocX = (uint)((int)reader["locX"]); + regionprofile.regionLocY = (uint)((int)reader["locY"]); + regionprofile.regionLocZ = (uint)((int)reader["locZ"]); + + // Neighbours - 0 = No Override + regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; + regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; + regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; + regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; + + // Assets + regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; + regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; + regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + + // Userserver + regionprofile.regionUserURI = (string)reader["regionUserURI"]; + regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; + regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; + } + else + { + throw new Exception("No rows to return"); + } + return regionprofile; + } + + /// + /// Creates a new region in the database + /// + /// The region profile to insert + /// Successful? + public bool insertRow(SimProfileData profile) + { + string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; + sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; + sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; + + sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; + sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; + sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; + + Dictionary parameters = new Dictionary(); + + parameters["regionHandle"] = profile.regionHandle.ToString(); + parameters["regionName"] = profile.regionName; + parameters["uuid"] = profile.UUID.ToString(); + parameters["regionRecvKey"] = profile.regionRecvKey; + parameters["regionSendKey"] = profile.regionSendKey; + parameters["regionDataURI"] = profile.regionDataURI; + parameters["serverIP"] = profile.serverIP; + parameters["serverPort"] = profile.serverPort.ToString(); + parameters["serverURI"] = profile.serverURI; + parameters["locX"] = profile.regionLocX.ToString(); + parameters["locY"] = profile.regionLocY.ToString(); + parameters["locZ"] = profile.regionLocZ.ToString(); + parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); + parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); + parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); + parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); + parameters["regionAssetURI"] = profile.regionAssetURI; + parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; + parameters["regionAssetSendKey"] = profile.regionAssetSendKey; + parameters["regionUserURI"] = profile.regionUserURI; + parameters["regionUserRecvKey"] = profile.regionUserRecvKey; + parameters["regionUserSendKey"] = profile.regionUserSendKey; + + bool returnval = false; + + try + { + IDbCommand result = Query(sql, parameters); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + return false; + } + + return returnval; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj new file mode 100644 index 0000000000..8d5369281a --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj @@ -0,0 +1,104 @@ + + + Local + 8.0.50727 + 2.0 + {0A563AC1-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.MSSQL + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.MSSQL + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build new file mode 100644 index 0000000000..5b6b75be35 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..bbe3cdf372 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("OpenGrid.Framework.Data.MSSQL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Data.MSSQL")] +[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("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs new file mode 100644 index 0000000000..d9a517df8c --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs @@ -0,0 +1,258 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using OpenGrid.Framework.Data; + +namespace OpenGrid.Framework.Data.MySQL +{ + /// + /// A MySQL Interface for the Grid Server + /// + public class MySQLGridData : IGridData + { + /// + /// MySQL Database Manager + /// + private MySQLManager database; + + /// + /// Initialises the Grid Interface + /// + public void Initialise() + { + IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); + string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); + string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); + string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); + string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); + string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); + string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); + + database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + } + + /// + /// Shuts down the grid interface + /// + public void Close() + { + database.Close(); + } + + /// + /// Returns the plugin name + /// + /// Plugin name + public string getName() + { + return "MySql OpenGridData"; + } + + /// + /// Returns the plugin version + /// + /// Plugin version + public string getVersion() + { + return "0.1"; + } + + /// + /// Returns all the specified region profiles within coordates -- coordinates are inclusive + /// + /// Minimum X coordinate + /// Minimum Y coordinate + /// Maximum X coordinate + /// Maximum Y coordinate + /// + public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?xmin"] = xmin.ToString(); + param["?ymin"] = ymin.ToString(); + param["?xmax"] = xmax.ToString(); + param["?ymax"] = ymax.ToString(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row; + + List rows = new List(); + + while ((row = database.readSimRow(reader)) != null) + { + rows.Add(row); + } + reader.Close(); + result.Dispose(); + + return rows.ToArray(); + + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a sim profile from it's location + /// + /// Region location handle + /// Sim profile + public SimProfileData GetProfileByHandle(ulong handle) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?handle"] = handle.ToString(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row = database.readSimRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a sim profile from it's UUID + /// + /// The region UUID + /// The sim profile + public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = uuid.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row = database.readSimRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Adds a new profile to the database + /// + /// The profile to add + /// Successful? + public DataResponse AddProfile(SimProfileData profile) + { + lock (database) + { + if (database.insertRegion(profile)) + { + return DataResponse.RESPONSE_OK; + } + else + { + return DataResponse.RESPONSE_ERROR; + } + } + } + + /// + /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// + /// The UUID of the challenger + /// The attempted regionHandle of the challenger + /// The secret + /// Whether the secret and regionhandle match the database entry for UUID + public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) + { + bool throwHissyFit = false; // Should be true by 1.0 + + if (throwHissyFit) + throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); + + SimProfileData data = GetProfileByLLUUID(uuid); + + return (handle == data.regionHandle && authkey == data.regionSecret); + } + + /// + /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region + /// + /// This requires a security audit. + /// + /// + /// + /// + /// + public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) + { + System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); + System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); + + byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); + byte[] hash = HashProvider.ComputeHash(stream); + + return false; + } + } + + +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs new file mode 100644 index 0000000000..fb429e4213 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs @@ -0,0 +1,309 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using libsecondlife; + +namespace OpenGrid.Framework.Data.MySQL +{ + /// + /// A MySQL interface for the inventory server + /// + class MySQLInventoryData : IInventoryData + { + /// + /// The database manager + /// + public MySQLManager database; + + /// + /// Loads and initialises this database plugin + /// + public void Initialise() + { + IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); + string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); + string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); + string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); + string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); + string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); + string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); + + database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + } + + /// + /// The name of this DB provider + /// + /// Name of DB provider + public string getName() + { + return "MySQL Inventory Data Interface"; + } + + /// + /// Closes this DB provider + /// + public void Close() + { + // Do nothing. + } + + /// + /// Returns the version of this DB provider + /// + /// A string containing the DB provider + public string getVersion() + { + return "0.1"; + } + + /// + /// Returns a list of items in a specified folder + /// + /// The folder to search + /// A list containing inventory items + public List getInventoryInFolder(LLUUID folderID) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = folderID.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + List items = database.readInventoryItems(reader); + + reader.Close(); + result.Dispose(); + + return items; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a list of the root folders within a users inventory + /// + /// The user whos inventory is to be searched + /// A list of folder objects + public List getUserRootFolders(LLUUID user) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = user.ToStringHyphenated(); + param["?zero"] = LLUUID.Zero.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + List items = database.readInventoryFolders(reader); + + reader.Close(); + result.Dispose(); + + return items; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a list of folders in a users inventory contained within the specified folder + /// + /// The folder to search + /// A list of inventory folders + public List getInventoryFolders(LLUUID parentID) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = parentID.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + List items = database.readInventoryFolders(reader); + + reader.Close(); + result.Dispose(); + + return items; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a specified inventory item + /// + /// The item to return + /// An inventory item + public InventoryItemBase getInventoryItem(LLUUID item) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = item.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + List items = database.readInventoryItems(reader); + + reader.Close(); + result.Dispose(); + + if (items.Count > 0) + { + return items[0]; + } + else + { + return null; + } + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a specified inventory folder + /// + /// The folder to return + /// A folder class + public InventoryFolderBase getInventoryFolder(LLUUID folder) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = folder.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + List items = database.readInventoryFolders(reader); + + reader.Close(); + result.Dispose(); + + if (items.Count > 0) + { + return items[0]; + } + else + { + return null; + } + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Adds a specified item to the database + /// + /// The inventory item + public void addInventoryItem(InventoryItemBase item) + { + lock (database) + { + database.insertItem(item); + } + } + + /// + /// Updates the specified inventory item + /// + /// Inventory item to update + public void updateInventoryItem(InventoryItemBase item) + { + addInventoryItem(item); + } + + /// + /// Creates a new inventory folder + /// + /// Folder to create + public void addInventoryFolder(InventoryFolderBase folder) + { + lock (database) + { + database.insertFolder(folder); + } + } + + /// + /// Updates an inventory folder + /// + /// Folder to update + public void updateInventoryFolder(InventoryFolderBase folder) + { + addInventoryFolder(folder); + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs new file mode 100644 index 0000000000..c88b39f640 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs @@ -0,0 +1,107 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; + +namespace OpenGrid.Framework.Data.MySQL +{ + /// + /// An interface to the log database for MySQL + /// + class MySQLLogData : ILogData + { + /// + /// The database manager + /// + public MySQLManager database; + + /// + /// Artificial constructor called when the plugin is loaded + /// + public void Initialise() + { + IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); + string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); + string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); + string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); + string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); + string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); + string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); + + database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + } + + /// + /// Saves a log item to the database + /// + /// The daemon triggering the event + /// The target of the action (region / agent UUID, etc) + /// The method call where the problem occured + /// The arguments passed to the method + /// How critical is this? + /// The message to log + public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) + { + try + { + database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage); + } + catch (Exception e) + { + database.Reconnect(); + } + } + + /// + /// Returns the name of this DB provider + /// + /// A string containing the DB provider name + public string getName() + { + return "MySQL Logdata Interface"; + } + + /// + /// Closes the database provider + /// + public void Close() + { + // Do nothing. + } + + /// + /// Returns the version of this DB provider + /// + /// A string containing the provider version + public string getVersion() + { + return "0.1"; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs new file mode 100644 index 0000000000..76d3faf438 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs @@ -0,0 +1,581 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using System.Data; + +// MySQL Native +using MySql; +using MySql.Data; +using MySql.Data.Types; +using MySql.Data.MySqlClient; + +using OpenGrid.Framework.Data; + +namespace OpenGrid.Framework.Data.MySQL +{ + /// + /// A MySQL Database manager + /// + class MySQLManager + { + /// + /// The database connection object + /// + IDbConnection dbcon; + /// + /// Connection string for ADO.net + /// + string connectionString; + + /// + /// Initialises and creates a new MySQL connection and maintains it. + /// + /// The MySQL server being connected to + /// The name of the MySQL database being used + /// The username logging into the database + /// The password for the user logging in + /// Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'. + public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) + { + try + { + connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; + dbcon = new MySqlConnection(connectionString); + + dbcon.Open(); + + System.Console.WriteLine("MySQL connection established"); + } + catch (Exception e) + { + throw new Exception("Error initialising MySql Database: " + e.ToString()); + } + } + + /// + /// Shuts down the database connection + /// + public void Close() + { + dbcon.Close(); + dbcon = null; + } + + /// + /// Reconnects to the database + /// + public void Reconnect() + { + lock (dbcon) + { + try + { + // Close the DB connection + dbcon.Close(); + // Try reopen it + dbcon = new MySqlConnection(connectionString); + dbcon.Open(); + } + catch (Exception e) + { + Console.WriteLine("Unable to reconnect to database " + e.ToString()); + } + } + } + + /// + /// Runs a query with protection against SQL Injection by using parameterised input. + /// + /// The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y + /// The parameters - index so that @y is indexed as 'y' + /// A MySQL DB Command + public IDbCommand Query(string sql, Dictionary parameters) + { + try + { + MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); + dbcommand.CommandText = sql; + foreach (KeyValuePair param in parameters) + { + dbcommand.Parameters.Add(param.Key, param.Value); + } + + return (IDbCommand)dbcommand; + } + catch + { + lock (dbcon) + { + // Close the DB connection + try + { + dbcon.Close(); + } + catch { } + + // Try reopen it + try + { + dbcon = new MySqlConnection(connectionString); + dbcon.Open(); + } + catch (Exception e) + { + Console.WriteLine("Unable to reconnect to database " + e.ToString()); + } + + // Run the query again + try + { + MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); + dbcommand.CommandText = sql; + foreach (KeyValuePair param in parameters) + { + dbcommand.Parameters.Add(param.Key, param.Value); + } + + return (IDbCommand)dbcommand; + } + catch (Exception e) + { + // Return null if it fails. + Console.WriteLine("Failed during Query generation: " + e.ToString()); + return null; + } + } + } + } + + /// + /// Reads a region row from a database reader + /// + /// An active database reader + /// A region profile + public SimProfileData readSimRow(IDataReader reader) + { + SimProfileData retval = new SimProfileData(); + + if (reader.Read()) + { + // Region Main + retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); + retval.regionName = (string)reader["regionName"]; + retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); + + // Secrets + retval.regionRecvKey = (string)reader["regionRecvKey"]; + retval.regionSecret = (string)reader["regionSecret"]; + retval.regionSendKey = (string)reader["regionSendKey"]; + + // Region Server + retval.regionDataURI = (string)reader["regionDataURI"]; + retval.regionOnline = false; // Needs to be pinged before this can be set. + retval.serverIP = (string)reader["serverIP"]; + retval.serverPort = (uint)reader["serverPort"]; + retval.serverURI = (string)reader["serverURI"]; + + // Location + retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString()); + retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString()); + retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString()); + + // Neighbours - 0 = No Override + retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString()); + retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString()); + retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString()); + retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); + + // Assets + retval.regionAssetURI = (string)reader["regionAssetURI"]; + retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; + retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + + // Userserver + retval.regionUserURI = (string)reader["regionUserURI"]; + retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; + retval.regionUserSendKey = (string)reader["regionUserSendKey"]; + + // World Map Addition + string tempRegionMap = reader["regionMapTexture"].ToString(); + if (tempRegionMap != "") + { + retval.regionMapTextureID = new libsecondlife.LLUUID(tempRegionMap); + } + else + { + retval.regionMapTextureID = new libsecondlife.LLUUID(); + } + } + else + { + return null; + } + return retval; + } + + /// + /// Reads an agent row from a database reader + /// + /// An active database reader + /// A user session agent + public UserAgentData readAgentRow(IDataReader reader) + { + UserAgentData retval = new UserAgentData(); + + if (reader.Read()) + { + // Agent IDs + retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]); + retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]); + retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]); + + // Agent Who? + retval.agentIP = (string)reader["agentIP"]; + retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); + retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); + + // Login/Logout times (UNIX Epoch) + retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString()); + retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); + + // Current position + retval.currentRegion = (string)reader["currentRegion"]; + retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); + libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); + } + else + { + return null; + } + return retval; + } + + /// + /// Reads a user profile from an active data reader + /// + /// An active database reader + /// A user profile + public UserProfileData readUserRow(IDataReader reader) + { + UserProfileData retval = new UserProfileData(); + + if (reader.Read()) + { + retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]); + retval.username = (string)reader["username"]; + retval.surname = (string)reader["lastname"]; + + retval.passwordHash = (string)reader["passwordHash"]; + retval.passwordSalt = (string)reader["passwordSalt"]; + + retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); + retval.homeLocation = new libsecondlife.LLVector3( + Convert.ToSingle(reader["homeLocationX"].ToString()), + Convert.ToSingle(reader["homeLocationY"].ToString()), + Convert.ToSingle(reader["homeLocationZ"].ToString())); + retval.homeLookAt = new libsecondlife.LLVector3( + Convert.ToSingle(reader["homeLookAtX"].ToString()), + Convert.ToSingle(reader["homeLookAtY"].ToString()), + Convert.ToSingle(reader["homeLookAtZ"].ToString())); + + retval.created = Convert.ToInt32(reader["created"].ToString()); + retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); + + retval.userInventoryURI = (string)reader["userInventoryURI"]; + retval.userAssetURI = (string)reader["userAssetURI"]; + + retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); + retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); + + retval.profileAboutText = (string)reader["profileAboutText"]; + retval.profileFirstText = (string)reader["profileFirstText"]; + + retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]); + retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]); + + } + else + { + return null; + } + return retval; + } + + /// + /// Reads a list of inventory folders returned by a query. + /// + /// A MySQL Data Reader + /// A List containing inventory folders + public List readInventoryFolders(IDataReader reader) + { + List rows = new List(); + + while(reader.Read()) + { + try + { + InventoryFolderBase folder = new InventoryFolderBase(); + + folder.agentID = new libsecondlife.LLUUID((string)reader["agentID"]); + folder.parentID = new libsecondlife.LLUUID((string)reader["parentFolderID"]); + folder.folderID = new libsecondlife.LLUUID((string)reader["folderID"]); + folder.name = (string)reader["folderName"]; + + rows.Add(folder); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + } + + return rows; + } + + /// + /// Reads a collection of items from an SQL result + /// + /// The SQL Result + /// A List containing Inventory Items + public List readInventoryItems(IDataReader reader) + { + List rows = new List(); + + while (reader.Read()) + { + try + { + InventoryItemBase item = new InventoryItemBase(); + + item.assetID = new libsecondlife.LLUUID((string)reader["assetID"]); + item.avatarID = new libsecondlife.LLUUID((string)reader["avatarID"]); + item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString()); + item.inventoryDescription = (string)reader["inventoryDescription"]; + item.inventoryID = new libsecondlife.LLUUID((string)reader["inventoryID"]); + item.inventoryName = (string)reader["inventoryName"]; + item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString()); + item.parentFolderID = new libsecondlife.LLUUID((string)reader["parentFolderID"]); + item.type = Convert.ToInt32(reader["type"].ToString()); + + rows.Add(item); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + } + + return rows; + } + + /// + /// Inserts a new row into the log database + /// + /// The daemon which triggered this event + /// Who were we operating on when this occured (region UUID, user UUID, etc) + /// The method call where the problem occured + /// The arguments passed to the method + /// How critical is this? + /// Extra message info + /// Saved successfully? + public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) + { + string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; + sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; + + Dictionary parameters = new Dictionary(); + parameters["?server"] = serverDaemon; + parameters["?target"] = target; + parameters["?method"] = methodCall; + parameters["?arguments"] = arguments; + parameters["?priority"] = priority.ToString(); + parameters["?message"] = logMessage; + + bool returnval = false; + + try + { + IDbCommand result = Query(sql, parameters); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return false; + } + + return returnval; + } + + /// + /// Inserts a new item into the database + /// + /// The item + /// Success? + public bool insertItem(InventoryItemBase item) + { + string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES "; + sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)"; + + Dictionary parameters = new Dictionary(); + parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated(); + parameters["?assetID"] = item.assetID.ToStringHyphenated(); + parameters["?type"] = item.type.ToString(); + parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated(); + parameters["?avatarID"] = item.avatarID.ToStringHyphenated(); + parameters["?inventoryName"] = item.inventoryName; + parameters["?inventoryDescription"] = item.inventoryDescription; + parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString(); + parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString(); + + bool returnval = false; + + try + { + IDbCommand result = Query(sql, parameters); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return false; + } + + return returnval; + } + + /// + /// Inserts a new folder into the database + /// + /// The folder + /// Success? + public bool insertFolder(InventoryFolderBase folder) + { + string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; + sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; + + Dictionary parameters = new Dictionary(); + parameters["?folderID"] = folder.folderID.ToStringHyphenated(); + parameters["?agentID"] = folder.agentID.ToStringHyphenated(); + parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); + parameters["?folderName"] = folder.name; + + bool returnval = false; + try + { + IDbCommand result = Query(sql, parameters); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return false; + } + return returnval; + } + + /// + /// Inserts a new region into the database + /// + /// The region to insert + /// Success? + public bool insertRegion(SimProfileData regiondata) + { + string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; + sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; + sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture) VALUES "; + + sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; + sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; + sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture);"; + + Dictionary parameters = new Dictionary(); + + parameters["?regionHandle"] = regiondata.regionHandle.ToString(); + parameters["?regionName"] = regiondata.regionName.ToString(); + parameters["?uuid"] = regiondata.UUID.ToStringHyphenated(); + parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString(); + parameters["?regionSecret"] = regiondata.regionSecret.ToString(); + parameters["?regionSendKey"] = regiondata.regionSendKey.ToString(); + parameters["?regionDataURI"] = regiondata.regionDataURI.ToString(); + parameters["?serverIP"] = regiondata.serverIP.ToString(); + parameters["?serverPort"] = regiondata.serverPort.ToString(); + parameters["?serverURI"] = regiondata.serverURI.ToString(); + parameters["?locX"] = regiondata.regionLocX.ToString(); + parameters["?locY"] = regiondata.regionLocY.ToString(); + parameters["?locZ"] = regiondata.regionLocZ.ToString(); + parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString(); + parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString(); + parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString(); + parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString(); + parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString(); + parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString(); + parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString(); + parameters["?regionUserURI"] = regiondata.regionUserURI.ToString(); + parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString(); + parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString(); + parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated(); + + bool returnval = false; + + try + { + + IDbCommand result = Query(sql, parameters); + + //Console.WriteLine(result.CommandText); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return false; + } + + return returnval; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs new file mode 100644 index 0000000000..032a0e617a --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs @@ -0,0 +1,257 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using OpenGrid.Framework.Data; +using libsecondlife; + +namespace OpenGrid.Framework.Data.MySQL +{ + /// + /// A database interface class to a user profile storage system + /// + class MySQLUserData : IUserData + { + /// + /// Database manager for MySQL + /// + public MySQLManager database; + + /// + /// Loads and initialises the MySQL storage plugin + /// + public void Initialise() + { + // Load from an INI file connection details + // TODO: move this to XML? + IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); + string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); + string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); + string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); + string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); + string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); + string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); + + database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + } + + /// + /// Searches the database for a specified user profile + /// + /// The account name of the user + /// A user profile + public UserProfileData getUserByName(string name) + { + return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); + } + + /// + /// Searches the database for a specified user profile by name components + /// + /// The first part of the account name + /// The second part of the account name + /// A user profile + public UserProfileData getUserByName(string user, string last) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?first"] = user; + param["?second"] = last; + + System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + UserProfileData row = database.readUserRow(reader); + + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Searches the database for a specified user profile by UUID + /// + /// The account ID + /// The users profile + public UserProfileData getUserByUUID(LLUUID uuid) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = uuid.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + UserProfileData row = database.readUserRow(reader); + + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Returns a user session searching by name + /// + /// The account name + /// The users session + public UserAgentData getAgentByName(string name) + { + return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); + } + + /// + /// Returns a user session by account name + /// + /// First part of the users account name + /// Second part of the users account name + /// The users session + public UserAgentData getAgentByName(string user, string last) + { + UserProfileData profile = getUserByName(user, last); + return getAgentByUUID(profile.UUID); + } + + /// + /// Returns an agent session by account UUID + /// + /// The accounts UUID + /// The users session + public UserAgentData getAgentByUUID(LLUUID uuid) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = uuid.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + UserAgentData row = database.readAgentRow(reader); + + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// + /// Creates a new users profile + /// + /// The user profile to create + public void addNewUserProfile(UserProfileData user) + { + } + + /// + /// Creates a new agent + /// + /// The agent to create + public void addNewUserAgent(UserAgentData agent) + { + // Do nothing. + } + + /// + /// Performs a money transfer request between two accounts + /// + /// The senders account ID + /// The recievers account ID + /// The amount to transfer + /// Success? + public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) + { + return false; + } + + /// + /// Performs an inventory transfer request between two accounts + /// + /// TODO: Move to inventory server + /// The senders account ID + /// The recievers account ID + /// The item to transfer + /// Success? + public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) + { + return false; + } + + /// + /// Database provider name + /// + /// Provider name + public string getName() + { + return "MySQL Userdata Interface"; + } + + /// + /// Database provider version + /// + /// provider version + public string getVersion() + { + return "0.1"; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj new file mode 100644 index 0000000000..351de2a65e --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj @@ -0,0 +1,237 @@ +<<<<<<< .mine + + + Local + 8.0.50727 + 2.0 + {0F3C3AC1-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.MySQL + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.MySQL + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\MySql.Data.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + +======= + + + Local + 8.0.50727 + 2.0 + {0F3C3AC1-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.MySQL + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.MySQL + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\MySql.Data.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + +>>>>>>> .r921 diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine new file mode 100644 index 0000000000..75ef149790 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine @@ -0,0 +1,117 @@ + + + Local + 8.0.50727 + 2.0 + {0F3C3AC1-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.MySQL + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.MySQL + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\MySql.Data.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858 b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858 new file mode 100644 index 0000000000..7a36be22c7 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858 @@ -0,0 +1,114 @@ + + + Local + 8.0.50727 + 2.0 + {C669E5AC-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.MySQL + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.MySQL + + + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ../../bin/ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ../../bin/ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\MySql.Data.dll + False + + + + + OpenGrid.Framework.Data + {12DD8EB8-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921 b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921 new file mode 100644 index 0000000000..5fe0cf78b4 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921 @@ -0,0 +1,117 @@ + + + Local + 8.0.50727 + 2.0 + {0F3C3AC1-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.MySQL + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.MySQL + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\MySql.Data.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build new file mode 100644 index 0000000000..84d3d56f4b --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..0bfd1d67bb --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("OpenGrid.Framework.Data.MySQL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Data.MySQL")] +[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("e49826b2-dcef-41be-a5bd-596733fa3304")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj new file mode 100644 index 0000000000..4360031af7 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj @@ -0,0 +1,219 @@ +<<<<<<< .mine + + + Local + 8.0.50727 + 2.0 + {1E3F341A-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.SQLite + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.SQLite + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\System.Data.SQLite.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + +======= + + + Local + 8.0.50727 + 2.0 + {1E3F341A-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.SQLite + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.SQLite + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\System.Data.SQLite.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + +>>>>>>> .r921 diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.mine b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.mine new file mode 100644 index 0000000000..463cf86c2c --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.mine @@ -0,0 +1,108 @@ + + + Local + 8.0.50727 + 2.0 + {1E3F341A-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.SQLite + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.SQLite + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\System.Data.SQLite.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r858 b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r858 new file mode 100644 index 0000000000..a8d0541d38 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r858 @@ -0,0 +1,108 @@ + + + Local + 8.0.50727 + 2.0 + {0ED96822-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.SQLite + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.SQLite + + + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ../../bin/ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ../../bin/ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\System.Data.SQLite.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + OpenGrid.Framework.Data + {12DD8EB8-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r921 b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r921 new file mode 100644 index 0000000000..fa17367954 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.r921 @@ -0,0 +1,108 @@ + + + Local + 8.0.50727 + 2.0 + {1E3F341A-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data.SQLite + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data.SQLite + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\System.Data.SQLite.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build new file mode 100644 index 0000000000..8c0f8fe878 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..57c4baedbb --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("OpenGrid.Framework.Data.SQLite")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Data.SQLite")] +[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("6113d5ce-4547-49f4-9236-0dcc503457b1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs new file mode 100644 index 0000000000..94ed46f6c5 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs @@ -0,0 +1,190 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using OpenGrid.Framework.Data; + +namespace OpenGrid.Framework.Data.SQLite +{ + /// + /// A Grid Interface to the SQLite database + /// + public class SQLiteGridData : IGridData + { + /// + /// A database manager + /// + private SQLiteManager database; + + /// + /// Initialises the Grid Interface + /// + public void Initialise() + { + database = new SQLiteManager("localhost", "db", "user", "password", "false"); + } + + /// + /// Shuts down the grid interface + /// + public void Close() + { + database.Close(); + } + + /// + /// Returns the name of this grid interface + /// + /// A string containing the grid interface + public string getName() + { + return "SQLite OpenGridData"; + } + + /// + /// Returns the version of this grid interface + /// + /// A string containing the version + public string getVersion() + { + return "0.1"; + } + + /// + /// Returns a list of regions within the specified ranges + /// + /// minimum X coordinate + /// minimum Y coordinate + /// maximum X coordinate + /// maximum Y coordinate + /// An array of region profiles + public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + { + return null; + } + + /// + /// Returns a sim profile from it's location + /// + /// Region location handle + /// Sim profile + public SimProfileData GetProfileByHandle(ulong handle) + { + Dictionary param = new Dictionary(); + param["handle"] = handle.ToString(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row = database.getRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + + /// + /// Returns a sim profile from it's UUID + /// + /// The region UUID + /// The sim profile + public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) + { + Dictionary param = new Dictionary(); + param["uuid"] = uuid.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + SimProfileData row = database.getRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + + /// + /// Adds a new specified region to the database + /// + /// The profile to add + /// A dataresponse enum indicating success + public DataResponse AddProfile(SimProfileData profile) + { + if (database.insertRow(profile)) + { + return DataResponse.RESPONSE_OK; + } + else + { + return DataResponse.RESPONSE_ERROR; + } + } + + /// + /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// + /// The UUID of the challenger + /// The attempted regionHandle of the challenger + /// The secret + /// Whether the secret and regionhandle match the database entry for UUID + public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) + { + bool throwHissyFit = false; // Should be true by 1.0 + + if (throwHissyFit) + throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); + + SimProfileData data = GetProfileByLLUUID(uuid); + + return (handle == data.regionHandle && authkey == data.regionSecret); + } + + /// + /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region + /// + /// This requires a security audit. + /// + /// + /// + /// + /// + public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) + { + System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); + System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); + + byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); + byte[] hash = HashProvider.ComputeHash(stream); + + return false; + } + } + + +} diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs new file mode 100644 index 0000000000..968935695a --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs @@ -0,0 +1,209 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using System.Data; + +using System.Data.SQLite; + +using OpenGrid.Framework.Data; + +namespace OpenGrid.Framework.Data.SQLite +{ + class SQLiteManager + { + IDbConnection dbcon; + + /// + /// Initialises and creates a new SQLite connection and maintains it. + /// + /// The SQLite server being connected to + /// The name of the SQLite database being used + /// The username logging into the database + /// The password for the user logging in + /// Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'. + public SQLiteManager(string hostname, string database, string username, string password, string cpooling) + { + try + { + string connectionString = "URI=file:GridServerSqlite.db;"; + dbcon = new SQLiteConnection(connectionString); + + dbcon.Open(); + } + catch (Exception e) + { + throw new Exception("Error initialising SQLite Database: " + e.ToString()); + } + } + + /// + /// Shuts down the database connection + /// + public void Close() + { + dbcon.Close(); + dbcon = null; + } + + /// + /// Runs a query with protection against SQL Injection by using parameterised input. + /// + /// The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y + /// The parameters - index so that @y is indexed as 'y' + /// A SQLite DB Command + public IDbCommand Query(string sql, Dictionary parameters) + { + SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); + dbcommand.CommandText = sql; + foreach (KeyValuePair param in parameters) + { + SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); + dbcommand.Parameters.Add(paramx); + } + + return (IDbCommand)dbcommand; + } + + /// + /// Reads a region row from a database reader + /// + /// An active database reader + /// A region profile + public SimProfileData getRow(IDataReader reader) + { + SimProfileData retval = new SimProfileData(); + + if (reader.Read()) + { + // Region Main + retval.regionHandle = (ulong)reader["regionHandle"]; + retval.regionName = (string)reader["regionName"]; + retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); + + // Secrets + retval.regionRecvKey = (string)reader["regionRecvKey"]; + retval.regionSecret = (string)reader["regionSecret"]; + retval.regionSendKey = (string)reader["regionSendKey"]; + + // Region Server + retval.regionDataURI = (string)reader["regionDataURI"]; + retval.regionOnline = false; // Needs to be pinged before this can be set. + retval.serverIP = (string)reader["serverIP"]; + retval.serverPort = (uint)reader["serverPort"]; + retval.serverURI = (string)reader["serverURI"]; + + // Location + retval.regionLocX = (uint)((int)reader["locX"]); + retval.regionLocY = (uint)((int)reader["locY"]); + retval.regionLocZ = (uint)((int)reader["locZ"]); + + // Neighbours - 0 = No Override + retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; + retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; + retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; + retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; + + // Assets + retval.regionAssetURI = (string)reader["regionAssetURI"]; + retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; + retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + + // Userserver + retval.regionUserURI = (string)reader["regionUserURI"]; + retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; + retval.regionUserSendKey = (string)reader["regionUserSendKey"]; + } + else + { + throw new Exception("No rows to return"); + } + return retval; + } + + /// + /// Inserts a new region into the database + /// + /// The region to insert + /// Success? + public bool insertRow(SimProfileData profile) + { + string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; + sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; + sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; + + sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; + sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; + sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; + + Dictionary parameters = new Dictionary(); + + parameters["regionHandle"] = profile.regionHandle.ToString(); + parameters["regionName"] = profile.regionName; + parameters["uuid"] = profile.UUID.ToString(); + parameters["regionRecvKey"] = profile.regionRecvKey; + parameters["regionSendKey"] = profile.regionSendKey; + parameters["regionDataURI"] = profile.regionDataURI; + parameters["serverIP"] = profile.serverIP; + parameters["serverPort"] = profile.serverPort.ToString(); + parameters["serverURI"] = profile.serverURI; + parameters["locX"] = profile.regionLocX.ToString(); + parameters["locY"] = profile.regionLocY.ToString(); + parameters["locZ"] = profile.regionLocZ.ToString(); + parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); + parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); + parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); + parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); + parameters["regionAssetURI"] = profile.regionAssetURI; + parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; + parameters["regionAssetSendKey"] = profile.regionAssetSendKey; + parameters["regionUserURI"] = profile.regionUserURI; + parameters["regionUserRecvKey"] = profile.regionUserRecvKey; + parameters["regionUserSendKey"] = profile.regionUserSendKey; + + bool returnval = false; + + try + { + IDbCommand result = Query(sql, parameters); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + return false; + } + + return returnval; + } + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/GridData.cs b/OpenGridServices/OpenGrid.Framework.Data/GridData.cs new file mode 100644 index 0000000000..e9fb215ffd --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/GridData.cs @@ -0,0 +1,110 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; + +namespace OpenGrid.Framework.Data +{ + public enum DataResponse + { + RESPONSE_OK, + RESPONSE_AUTHREQUIRED, + RESPONSE_INVALIDCREDENTIALS, + RESPONSE_ERROR + } + + /// + /// A standard grid interface + /// + public interface IGridData + { + /// + /// Returns a sim profile from a regionHandle + /// + /// A 64bit Region Handle + /// A simprofile + SimProfileData GetProfileByHandle(ulong regionHandle); + + /// + /// Returns a sim profile from a UUID + /// + /// A 128bit UUID + /// A sim profile + SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID); + + /// + /// Returns all profiles within the specified range + /// + /// Minimum sim coordinate (X) + /// Minimum sim coordinate (Y) + /// Maximum sim coordinate (X) + /// Maximum sim coordinate (Y) + /// An array containing all the sim profiles in the specified range + SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); + + /// + /// Authenticates a sim by use of it's recv key. + /// WARNING: Insecure + /// + /// The UUID sent by the sim + /// The regionhandle sent by the sim + /// The recieving key sent by the sim + /// Whether the sim has been authenticated + bool AuthenticateSim(libsecondlife.LLUUID UUID, ulong regionHandle, string simrecvkey); + + /// + /// Initialises the interface + /// + void Initialise(); + + /// + /// Closes the interface + /// + void Close(); + + /// + /// The plugin being loaded + /// + /// A string containing the plugin name + string getName(); + + /// + /// The plugins version + /// + /// A string containing the plugin version + string getVersion(); + + /// + /// Adds a new profile to the database + /// + /// The profile to add + /// RESPONSE_OK if successful, error if not. + DataResponse AddProfile(SimProfileData profile); + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs b/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs new file mode 100644 index 0000000000..2ac0bfec0b --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs @@ -0,0 +1,94 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; + +namespace OpenGrid.Framework.Data +{ + /// + /// The severity of an individual log message + /// + public enum LogSeverity : int + { + /// + /// Critical: systems failure + /// + CRITICAL = 1, + /// + /// Major: warning prior to systems failure + /// + MAJOR = 2, + /// + /// Medium: an individual non-critical task failed + /// + MEDIUM = 3, + /// + /// Low: Informational warning + /// + LOW = 4, + /// + /// Info: Information + /// + INFO = 5, + /// + /// Verbose: Debug Information + /// + VERBOSE = 6 + } + + /// + /// An interface to a LogData storage system + /// + public interface ILogData + { + void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); + /// + /// Initialises the interface + /// + void Initialise(); + + /// + /// Closes the interface + /// + void Close(); + + /// + /// The plugin being loaded + /// + /// A string containing the plugin name + string getName(); + + /// + /// The plugins version + /// + /// A string containing the plugin version + string getVersion(); + } + +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs new file mode 100644 index 0000000000..d17afac967 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs @@ -0,0 +1,100 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using System.IO; +using System.Text.RegularExpressions; + +/* + Taken from public code listing at by Alex Pinsker + http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html + */ + +namespace OpenGrid.Framework.Data +{ + /// + /// Parse settings from ini-like files + /// + public class IniFile + { + static IniFile() + { + _iniKeyValuePatternRegex = new Regex( + @"((\s)*(?([^\=^\s^\n]+))[\s^\n]* + # key part (surrounding whitespace stripped) + \= + (\s)*(?([^\n^\s]+(\n){0,1}))) + # value part (surrounding whitespace stripped) + ", + RegexOptions.IgnorePatternWhitespace | + RegexOptions.Compiled | + RegexOptions.CultureInvariant); + } + static private Regex _iniKeyValuePatternRegex; + + public IniFile(string iniFileName) + { + _iniFileName = iniFileName; + } + + public string ParseFileReadValue(string key) + { + using (StreamReader reader = + new StreamReader(_iniFileName)) + { + do + { + string line = reader.ReadLine(); + Match match = + _iniKeyValuePatternRegex.Match(line); + if (match.Success) + { + string currentKey = + match.Groups["Key"].Value as string; + if (currentKey != null && + currentKey.Trim().CompareTo(key) == 0) + { + string value = + match.Groups["Value"].Value as string; + return value; + } + } + + } + while (reader.Peek() != -1); + } + return null; + } + + public string IniFileName + { + get { return _iniFileName; } + } private string _iniFileName; + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs new file mode 100644 index 0000000000..12f559bbf1 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs @@ -0,0 +1,187 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using libsecondlife; + +namespace OpenGrid.Framework.Data +{ + /// + /// Inventory Item - contains all the properties associated with an individual inventory piece. + /// + public class InventoryItemBase + { + /// + /// A UUID containing the ID for the inventory item itself + /// + public LLUUID inventoryID; + /// + /// The UUID of the associated asset on the asset server + /// + public LLUUID assetID; + /// + /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) + /// + public int type; + /// + /// The folder this item is contained in (NULL_KEY = Inventory Root) + /// + public LLUUID parentFolderID; + /// + /// The owner of this inventory item + /// + public LLUUID avatarID; + /// + /// The name of the inventory item (must be less than 64 characters) + /// + public string inventoryName; + /// + /// The description of the inventory item (must be less than 64 characters) + /// + public string inventoryDescription; + /// + /// A mask containing the permissions for the next owner (cannot be enforced) + /// + public uint inventoryNextPermissions; + /// + /// A mask containing permissions for the current owner (cannot be enforced) + /// + public uint inventoryCurrentPermissions; + } + + /// + /// A Class for folders which contain users inventory + /// + public class InventoryFolderBase + { + /// + /// The name of the folder (64 characters or less) + /// + public string name; + /// + /// The agent who's inventory this is contained by + /// + public LLUUID agentID; + /// + /// The folder this folder is contained in (NULL_KEY for root) + /// + public LLUUID parentID; + /// + /// The UUID for this folder + /// + public LLUUID folderID; + } + + /// + /// An interface for accessing inventory data from a storage server + /// + public interface IInventoryData + { + /// + /// Initialises the interface + /// + void Initialise(); + + /// + /// Closes the interface + /// + void Close(); + + /// + /// The plugin being loaded + /// + /// A string containing the plugin name + string getName(); + + /// + /// The plugins version + /// + /// A string containing the plugin version + string getVersion(); + + /// + /// Returns a list of inventory items contained within the specified folder + /// + /// The UUID of the target folder + /// A List of InventoryItemBase items + List getInventoryInFolder(LLUUID folderID); + + /// + /// Returns a list of folders in the users inventory root. + /// + /// The UUID of the user who is having inventory being returned + /// A list of folders + List getUserRootFolders(LLUUID user); + + /// + /// Returns a list of inventory folders contained in the folder 'parentID' + /// + /// The folder to get subfolders for + /// A list of inventory folders + List getInventoryFolders(LLUUID parentID); + + /// + /// Returns an inventory item by its UUID + /// + /// The UUID of the item to be returned + /// A class containing item information + InventoryItemBase getInventoryItem(LLUUID item); + + /// + /// Returns a specified inventory folder by its UUID + /// + /// The UUID of the folder to be returned + /// A class containing folder information + InventoryFolderBase getInventoryFolder(LLUUID folder); + + /// + /// Creates a new inventory item based on item + /// + /// The item to be created + void addInventoryItem(InventoryItemBase item); + + /// + /// Updates an inventory item with item (updates based on ID) + /// + /// The updated item + void updateInventoryItem(InventoryItemBase item); + + /// + /// Adds a new folder specified by folder + /// + /// The inventory folder + void addInventoryFolder(InventoryFolderBase folder); + + /// + /// Updates a folder based on its ID with folder + /// + /// The inventory folder + void updateInventoryFolder(InventoryFolderBase folder); + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj new file mode 100644 index 0000000000..c0684a2ddd --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj @@ -0,0 +1,229 @@ +<<<<<<< .mine + + + Local + 8.0.50727 + 2.0 + {62CDF671-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + +======= + + + Local + 8.0.50727 + 2.0 + {62CDF671-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + +>>>>>>> .r921 diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.mine b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.mine new file mode 100644 index 0000000000..a57220494c --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.mine @@ -0,0 +1,113 @@ + + + Local + 8.0.50727 + 2.0 + {62CDF671-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r858 b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r858 new file mode 100644 index 0000000000..3b6d24d730 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r858 @@ -0,0 +1,110 @@ + + + Local + 8.0.50727 + 2.0 + {12DD8EB8-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data + + + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ../../bin/ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ../../bin/ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r921 b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r921 new file mode 100644 index 0000000000..990cd16292 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.r921 @@ -0,0 +1,113 @@ + + + Local + 8.0.50727 + 2.0 + {62CDF671-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Data + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Data + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + System.Data.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build new file mode 100644 index 0000000000..c993a8d4ba --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..14466732e1 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("OpenGrid.Framework.Data")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Data")] +[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("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs new file mode 100644 index 0000000000..a3e7cb7ce3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs @@ -0,0 +1,114 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; + +namespace OpenGrid.Framework.Data +{ + /// + /// A class which contains information known to the grid server about a region + /// + public class SimProfileData + { + /// + /// The name of the region + /// + public string regionName = ""; + + /// + /// A 64-bit number combining map position into a (mostly) unique ID + /// + public ulong regionHandle; + + /// + /// OGS/OpenSim Specific ID for a region + /// + public libsecondlife.LLUUID UUID; + + /// + /// Coordinates of the region + /// + public uint regionLocX; + public uint regionLocY; + public uint regionLocZ; // Reserved (round-robin, layers, etc) + + /// + /// Authentication secrets + /// + /// Not very secure, needs improvement. + public string regionSendKey = ""; + public string regionRecvKey = ""; + public string regionSecret = ""; + + /// + /// Whether the region is online + /// + public bool regionOnline; + + /// + /// Information about the server that the region is currently hosted on + /// + public string serverIP = ""; + public uint serverPort; + public string serverURI = ""; + + /// + /// Set of optional overrides. Can be used to create non-eulicidean spaces. + /// + public ulong regionNorthOverrideHandle; + public ulong regionSouthOverrideHandle; + public ulong regionEastOverrideHandle; + public ulong regionWestOverrideHandle; + + /// + /// Optional: URI Location of the region database + /// + /// Used for floating sim pools where the region data is not nessecarily coupled to a specific server + public string regionDataURI = ""; + + /// + /// Region Asset Details + /// + public string regionAssetURI = ""; + public string regionAssetSendKey = ""; + public string regionAssetRecvKey = ""; + + /// + /// Region Userserver Details + /// + public string regionUserURI = ""; + public string regionUserSendKey = ""; + public string regionUserRecvKey = ""; + + /// + /// Region Map Texture Asset + /// + public libsecondlife.LLUUID regionMapTextureID = new libsecondlife.LLUUID("00000000-0000-0000-9999-000000000006"); + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs new file mode 100644 index 0000000000..c2d5a7201f --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs @@ -0,0 +1,131 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using libsecondlife; + +namespace OpenGrid.Framework.Data +{ + /// + /// An interface for connecting to user storage servers. + /// + public interface IUserData + { + /// + /// Returns a user profile from a database via their UUID + /// + /// The accounts UUID + /// The user data profile + UserProfileData getUserByUUID(LLUUID user); + + /// + /// Returns a users profile by searching their username + /// + /// The users username + /// The user data profile + UserProfileData getUserByName(string name); + + /// + /// Returns a users profile by searching their username parts + /// + /// Account firstname + /// Account lastname + /// The user data profile + UserProfileData getUserByName(string fname, string lname); + + /// + /// Returns the current agent for a user searching by it's UUID + /// + /// The users UUID + /// The current agent session + UserAgentData getAgentByUUID(LLUUID user); + + /// + /// Returns the current session agent for a user searching by username + /// + /// The users account name + /// The current agent session + UserAgentData getAgentByName(string name); + + /// + /// Returns the current session agent for a user searching by username parts + /// + /// The users first account name + /// The users account surname + /// The current agent session + UserAgentData getAgentByName(string fname, string lname); + + /// + /// Adds a new User profile to the database + /// + /// UserProfile to add + void addNewUserProfile(UserProfileData user); + + /// + /// Adds a new agent to the database + /// + /// The agent to add + void addNewUserAgent(UserAgentData agent); + + /// + /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) + /// + /// The account to transfer from + /// The account to transfer to + /// The amount to transfer + /// Successful? + bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); + + /// + /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. + /// + /// User to transfer from + /// User to transfer to + /// Specified inventory item + /// Successful? + bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); + + /// + /// Returns the plugin version + /// + /// Plugin version in MAJOR.MINOR.REVISION.BUILD format + string getVersion(); + + /// + /// Returns the plugin name + /// + /// Plugin name, eg MySQL User Provider + string getName(); + + /// + /// Initialises the plugin (artificial constructor) + /// + void Initialise(); + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs new file mode 100644 index 0000000000..82633e1344 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs @@ -0,0 +1,182 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Text; +using libsecondlife; + +namespace OpenGrid.Framework.Data +{ + /// + /// Information about a particular user known to the userserver + /// + public class UserProfileData + { + /// + /// The ID value for this user + /// + public LLUUID UUID; + + /// + /// The first component of a users account name + /// + public string username; + /// + /// The second component of a users account name + /// + public string surname; + + /// + /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) + /// + /// This is double MD5'd because the client sends an unsalted MD5 to the loginserver + public string passwordHash; + /// + /// The salt used for the users hash, should be 32 bytes or longer + /// + public string passwordSalt; + + /// + /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into + /// + public ulong homeRegion; + /// + /// The coordinates inside the region of the home location + /// + public LLVector3 homeLocation; + /// + /// Where the user will be looking when they rez. + /// + public LLVector3 homeLookAt; + + /// + /// A UNIX Timestamp (seconds since epoch) for the users creation + /// + public int created; + /// + /// A UNIX Timestamp for the users last login date / time + /// + public int lastLogin; + + /// + /// A URI to the users inventory server, used for foreigners and large grids + /// + public string userInventoryURI; + /// + /// A URI to the users asset server, used for foreigners and large grids. + /// + public string userAssetURI; + + /// + /// A uint mask containing the "I can do" fields of the users profile + /// + public uint profileCanDoMask; + /// + /// A uint mask containing the "I want to do" part of the users profile + /// + public uint profileWantDoMask; // Profile window "I want to" mask + + /// + /// The about text listed in a users profile. + /// + public string profileAboutText; + /// + /// The first life about text listed in a users profile + /// + public string profileFirstText; + + /// + /// The profile image for an avatar stored on the asset server + /// + public LLUUID profileImage; + /// + /// The profile image for the users first life tab + /// + public LLUUID profileFirstImage; + /// + /// The users last registered agent (filled in on the user server) + /// + public UserAgentData currentAgent; + } + + /// + /// Information about a users session + /// + public class UserAgentData + { + /// + /// The UUID of the users avatar (not the agent!) + /// + public LLUUID UUID; + /// + /// The IP address of the user + /// + public string agentIP; + /// + /// The port of the user + /// + public uint agentPort; + /// + /// Is the user online? + /// + public bool agentOnline; + /// + /// The session ID for the user (also the agent ID) + /// + public LLUUID sessionID; + /// + /// The "secure" session ID for the user + /// + /// Not very secure. Dont rely on it for anything more than Linden Lab does. + public LLUUID secureSessionID; + /// + /// The region the user logged into initially + /// + public LLUUID regionID; + /// + /// A unix timestamp from when the user logged in + /// + public int loginTime; + /// + /// When this agent expired and logged out, 0 if still online + /// + public int logoutTime; + /// + /// Current region the user is logged into + /// + public LLUUID currentRegion; + /// + /// Region handle of the current region the user is in + /// + public ulong currentHandle; + /// + /// The position of the user within the region + /// + public LLVector3 currentPos; + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs new file mode 100644 index 0000000000..dfc572ab7f --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs @@ -0,0 +1,140 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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 Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Servers; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; + +namespace OpenGrid.Framework.Manager +{ + /// + /// Used to pass messages to the gridserver + /// + /// Pass this argument + public delegate void GridManagerCallback(string param); + + /// + /// Serverside listener for grid commands + /// + public class GridManagementAgent + { + /// + /// Passes grid server messages + /// + private GridManagerCallback thecallback; + + /// + /// Security keys + /// + private string sendkey; + private string recvkey; + + /// + /// Our component type + /// + private string component_type; + + /// + /// List of active sessions + /// + private static ArrayList Sessions; + + /// + /// Initialises a new GridManagementAgent + /// + /// HTTP Daemon for this server + /// What component type are we? + /// Security send key + /// Security recieve key + /// Message callback + public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) + { + this.sendkey = sendkey; + this.recvkey = recvkey; + this.component_type = component_type; + this.thecallback = thecallback; + Sessions = new ArrayList(); + + app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); + + switch (component_type) + { + case "gridserver": + GridServerManager.sendkey = this.sendkey; + GridServerManager.recvkey = this.recvkey; + GridServerManager.thecallback = thecallback; + app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); + break; + } + } + + /// + /// Checks if a session exists + /// + /// The session ID + /// Exists? + public static bool SessionExists(LLUUID sessionID) + { + return Sessions.Contains(sessionID); + } + + /// + /// Logs a new session to the grid manager + /// + /// the XMLRPC request + /// An XMLRPC reply + public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + // TODO: Switch this over to using OpenGrid.Framework.Data + if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) + { + response.IsFault = false; + LLUUID new_session = LLUUID.Random(); + Sessions.Add(new_session); + responseData["session_id"] = new_session.ToString(); + responseData["msg"] = "Login OK"; + } + else + { + response.IsFault = true; + responseData["error"] = "Invalid username or password"; + } + + response.Value = responseData; + return response; + + } + + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs new file mode 100644 index 0000000000..d665ab4670 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs @@ -0,0 +1,94 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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 Nwc.XmlRpc; +using System.Threading; +using libsecondlife; + +namespace OpenGrid.Framework.Manager { + + /// + /// A remote management system for the grid server + /// + public class GridServerManager + { + /// + /// Triggers events from the grid manager + /// + public static GridManagerCallback thecallback; + + /// + /// Security keys + /// + public static string sendkey; + public static string recvkey; + + /// + /// Disconnects the grid server and shuts it down + /// + /// XmlRpc Request + /// An XmlRpc response containing either a "msg" or an "error" + public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + if(requestData.ContainsKey("session_id")) { + if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { + responseData["msg"]="Shutdown command accepted"; + (new Thread(new ThreadStart(ShutdownServer))).Start(); + } else { + response.IsFault=true; + responseData["error"]="bad session ID"; + } + } else { + response.IsFault=true; + responseData["error"]="no session ID"; + } + + response.Value = responseData; + return response; + } + + /// + /// Shuts down the grid server + /// + public static void ShutdownServer() + { + Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); + Console.WriteLine("Terminating in three seconds..."); + Thread.Sleep(3000); + thecallback("shutdown"); + } + } +} + diff --git a/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj new file mode 100644 index 0000000000..dad56cb803 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj @@ -0,0 +1,99 @@ + + + Local + 8.0.50727 + 2.0 + {7924FD35-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGrid.Framework.Manager + JScript + Grid + IE50 + false + Library + + OpenGrid.Framework.Manager + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + ..\..\bin\OpenSim.Framework.dll + False + + + ..\..\bin\OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + XMLRPC.dll + False + + + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build new file mode 100644 index 0000000000..f8cc80e102 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/AssetHttpServer.cs b/OpenGridServices/OpenGridServices.AssetServer/AssetHttpServer.cs new file mode 100644 index 0000000000..6fc6bf89c4 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/AssetHttpServer.cs @@ -0,0 +1,130 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +//using OpenSim.CAPS; +using Nwc.XmlRpc; +using System.Collections; +using OpenSim.Framework.Console; +using OpenSim.Servers; + +namespace OpenGridServices.AssetServer +{ + /// + /// An HTTP server for sending assets + /// + public class AssetHttpServer :BaseHttpServer + { + /// + /// Creates the new asset server + /// + /// Port to initalise on + public AssetHttpServer(int port) + : base(port) + { + } + + /// + /// Handles an HTTP request + /// + /// HTTP State Info + public override void HandleRequest(Object stateinfo) + { + try + { + 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(); + + //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); + //Console.WriteLine(requestBody); + + string responseString = ""; + switch (request.ContentType) + { + case "text/xml": + // must be XML-RPC, so pass to the XML-RPC parser + + responseString = ParseXMLRPC(requestBody); + responseString = Regex.Replace(responseString, "utf-16", "utf-8"); + + 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 "application/x-www-form-urlencoded": + // a form data POST so send to the REST parser + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "text/plain"); + break; + + case null: + // must be REST or invalid crap, so pass to the REST parser + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "text/plain"); + break; + + } + + Encoding Windows1252Encoding = Encoding.GetEncoding(1252); + byte[] buffer = Windows1252Encoding.GetBytes(responseString); + System.IO.Stream output = response.OutputStream; + response.SendChunked = false; + response.ContentLength64 = buffer.Length; + output.Write(buffer, 0, buffer.Length); + output.Close(); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + } + + } +} diff --git a/OpenGridServices/OpenGridServices.AssetServer/Main.cs b/OpenGridServices/OpenGridServices.AssetServer/Main.cs new file mode 100644 index 0000000000..e9b94ea891 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/Main.cs @@ -0,0 +1,338 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.IO; +using System.Text; +using System.Timers; +using System.Net; +using System.Reflection; +using System.Threading; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Console; +using OpenSim.Framework.Types; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Utilities; +using OpenSim.GridInterfaces.Local; // REFACTORING IS NEEDED!!!!!!!!!!! +using OpenSim.Servers; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; + +namespace OpenGridServices.AssetServer +{ + /// + /// An asset server + /// + public class OpenAsset_Main : BaseServer, conscmd_callback + { + private IObjectContainer db; + + public static OpenAsset_Main assetserver; + + private ConsoleBase m_console; + + [STAThread] + public static void Main(string[] args) + { + Console.WriteLine("Starting...\n"); + + assetserver = new OpenAsset_Main(); + assetserver.Startup(); + + assetserver.Work(); + } + + private void Work() + { + m_console.Notice("Enter help for a list of commands"); + + while (true) + { + m_console.MainConsolePrompt(); + } + } + + private OpenAsset_Main() + { + m_console = new ConsoleBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); + MainConsole.Instance = m_console; + } + + public void Startup() + { + m_console.Verbose( "Main.cs:Startup() - Setting up asset DB"); + setupDB(); + + m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); + AssetHttpServer httpServer = new AssetHttpServer(8003); + + + httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); + httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); + + httpServer.Start(); + + } + + public string assetPostMethod(string requestBody, string path, string param) + { + AssetBase asset = new AssetBase(); + asset.Name = ""; + asset.FullID = new LLUUID(param); + Encoding Windows1252Encoding = Encoding.GetEncoding(1252); + byte[] buffer = Windows1252Encoding.GetBytes(requestBody); + asset.Data = buffer; + AssetStorage store = new AssetStorage(); + store.Data = asset.Data; + store.Name = asset.Name; + store.UUID = asset.FullID; + db.Set(store); + db.Commit(); + return ""; + } + + public string assetGetMethod(string request, string path, string param) + { + Console.WriteLine("got a request " + param); + byte[] assetdata = getAssetData(new LLUUID(param), false); + if (assetdata != null) + { + Encoding Windows1252Encoding = Encoding.GetEncoding(1252); + string ret = Windows1252Encoding.GetString(assetdata); + //string ret = System.Text.Encoding.Unicode.GetString(assetdata); + + return ret; + + } + else + { + return ""; + } + + } + + public byte[] getAssetData(LLUUID assetID, bool isTexture) + { + bool found = false; + AssetStorage foundAsset = null; + + IObjectSet result = db.Get(new AssetStorage(assetID)); + if (result.Count > 0) + { + foundAsset = (AssetStorage)result.Next(); + found = true; + } + + if (found) + { + return foundAsset.Data; + } + else + { + return null; + } + } + + public void setupDB() + { + bool yapfile = System.IO.File.Exists("assets.yap"); + try + { + db = Db4oFactory.OpenFile("assets.yap"); + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Main.cs:setupDB() - creation"); + } + catch (Exception e) + { + db.Close(); + OpenSim.Framework.Console.MainConsole.Instance.Warn("Main.cs:setupDB() - Exception occured"); + OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); + } + if (!yapfile) + { + this.LoadDB(); + } + } + + public void LoadDB() + { + try + { + + Console.WriteLine("setting up Asset database"); + + AssetBase Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); + Image.Name = "Bricks"; + this.LoadAsset(Image, true, "bricks.jp2"); + AssetStorage store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); + Image.Name = "Plywood"; + this.LoadAsset(Image, true, "plywood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); + Image.Name = "Rocks"; + this.LoadAsset(Image, true, "rocks.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); + Image.Name = "Granite"; + this.LoadAsset(Image, true, "granite.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); + Image.Name = "Hardwood"; + this.LoadAsset(Image, true, "hardwood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); + Image.Name = "Prim Base Texture"; + this.LoadAsset(Image, true, "plywood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + Image.Name = "Shape"; + this.LoadAsset(Image, false, "base_shape.dat"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + + private void LoadAsset(AssetBase info, bool image, string filename) + { + + + string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; + string fileName = Path.Combine(dataPath, filename); + FileInfo fInfo = new FileInfo(fileName); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); + byte[] idata = new byte[numBytes]; + BinaryReader br = new BinaryReader(fStream); + idata = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + info.Data = idata; + //info.loaded=true; + } + + /*private GridConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + GridConfig config = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IGridConfig", true); + + if (typeInterface != null) + { + IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + config = plug.GetConfigObject(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return config; + }*/ + + public void RunCmd(string cmd, string[] cmdparams) + { + switch (cmd) + { + case "help": + m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); + break; + + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } + + public void Show(string ShowWhat) + { + } + } +} diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj new file mode 100644 index 0000000000..53afe161a6 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj @@ -0,0 +1,247 @@ +<<<<<<< .mine + + + Local + 8.0.50727 + 2.0 + {0021261B-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.AssetServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.AssetServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GridInterfaces.Local.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + + + Code + + + Code + + + Code + + + + + + + + + + +======= + + + Local + 8.0.50727 + 2.0 + {0021261B-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.AssetServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.AssetServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GridInterfaces.Local.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + + + Code + + + Code + + + Code + + + + + + + + + + +>>>>>>> .r921 diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.mine b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.mine new file mode 100644 index 0000000000..257f6e1c9f --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.mine @@ -0,0 +1,122 @@ + + + Local + 8.0.50727 + 2.0 + {0021261B-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.AssetServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.AssetServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GridInterfaces.Local.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r858 b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r858 new file mode 100644 index 0000000000..2b382c41a8 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r858 @@ -0,0 +1,122 @@ + + + Local + 8.0.50727 + 2.0 + {7CDDE593-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.AssetServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.AssetServer + + + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ../../bin/ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ../../bin/ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GridInterfaces.Local.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r921 b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r921 new file mode 100644 index 0000000000..031e405924 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.r921 @@ -0,0 +1,122 @@ + + + Local + 8.0.50727 + 2.0 + {0021261B-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.AssetServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.AssetServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GridInterfaces.Local.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build new file mode 100644 index 0000000000..0da1d3450b --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj new file mode 100644 index 0000000000..9b8cc87b34 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj @@ -0,0 +1,126 @@ + + + Local + 8.0.50727 + 2.0 + {21BFC8E2-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.GridServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.GridServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + ..\bin\libsecondlife.dll + False + + + ..\bin\Db4objects.Db4o.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Servers + {8BB20F0A-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + XMLRPC + {8E81D43C-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build new file mode 100644 index 0000000000..6bef534866 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..7014284367 --- /dev/null +++ b/OpenGridServices/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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-AssetServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OGS-AssetServer")] +[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("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] + +// 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/OpenGridServices/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs new file mode 100644 index 0000000000..10cbf829c4 --- /dev/null +++ b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs @@ -0,0 +1,575 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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 System.Reflection; +using OpenGrid.Framework.Data; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; +using OpenSim.Framework.Sims; +using libsecondlife; +using Nwc.XmlRpc; +using System.Xml; + +namespace OpenGridServices.GridServer +{ + class GridManager + { + Dictionary _plugins = new Dictionary(); + Dictionary _logplugins = new Dictionary(); + + public OpenSim.Framework.Interfaces.GridConfig config; + + /// + /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. + /// + /// The filename to the grid server plugin DLL + public void AddPlugin(string FileName) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Storage: Attempting to load " + FileName); + Assembly pluginAssembly = Assembly.LoadFrom(FileName); + + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (!pluginType.IsAbstract) + { + // Regions go here + Type typeInterface = pluginType.GetInterface("IGridData", true); + + if (typeInterface != null) + { + IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Initialise(); + this._plugins.Add(plug.getName(), plug); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Storage: Added IGridData Interface"); + } + + typeInterface = null; + + // Logs go here + typeInterface = pluginType.GetInterface("ILogData", true); + + if (typeInterface != null) + { + ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Initialise(); + this._logplugins.Add(plug.getName(), plug); + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Storage: Added ILogData Interface"); + } + + typeInterface = null; + } + } + + pluginAssembly = null; + } + + /// + /// Logs a piece of information to the database + /// + /// What you were operating on (in grid server, this will likely be the region UUIDs) + /// Which method is being called? + /// What arguments are being passed? + /// How high priority is this? 1 = Max, 6 = Verbose + /// The message to log + private void logToDB(string target, string method, string args, int priority, string message) + { + foreach (KeyValuePair kvp in _logplugins) + { + try + { + kvp.Value.saveLog("Gridserver", target, method, args, priority, message); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Warn("Storage: unable to write log via " + kvp.Key); + } + } + } + + /// + /// Returns a region by argument + /// + /// A UUID key of the region to return + /// A SimProfileData for the region + public SimProfileData getRegion(libsecondlife.LLUUID uuid) + { + foreach(KeyValuePair kvp in _plugins) { + try + { + return kvp.Value.GetProfileByLLUUID(uuid); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Warn("Storage: Unable to find region " + uuid.ToStringHyphenated() + " via " + kvp.Key); + } + } + return null; + } + + /// + /// Returns a region by argument + /// + /// A regionHandle of the region to return + /// A SimProfileData for the region + public SimProfileData getRegion(ulong handle) + { + foreach (KeyValuePair kvp in _plugins) + { + try + { + return kvp.Value.GetProfileByHandle(handle); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); + } + } + return null; + } + + public Dictionary getRegions(uint xmin, uint ymin, uint xmax, uint ymax) + { + Dictionary regions = new Dictionary(); + + SimProfileData[] neighbours; + + foreach (KeyValuePair kvp in _plugins) + { + try + { + neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); + foreach (SimProfileData neighbour in neighbours) + { + regions[neighbour.regionHandle] = neighbour; + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); + } + } + + return regions; + } + + /// + /// Returns a XML String containing a list of the neighbouring regions + /// + /// The regionhandle for the center sim + /// An XML string containing neighbour entities + public string GetXMLNeighbours(ulong reqhandle) + { + string response = ""; + SimProfileData central_region = getRegion(reqhandle); + SimProfileData neighbour; + for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) + { + if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) + { + neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); + response += ""; + response += "" + neighbour.serverIP + ""; + response += "" + neighbour.serverPort.ToString() + ""; + response += "" + neighbour.regionLocX.ToString() + ""; + response += "" + neighbour.regionLocY.ToString() + ""; + response += "" + neighbour.regionHandle.ToString() + ""; + response += ""; + + } + } + return response; + } + + /// + /// Performed when a region connects to the grid server initially. + /// + /// The XMLRPC Request + /// Startup parameters + public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable responseData = new Hashtable(); + response.Value = responseData; + + SimProfileData TheSim = null; + Hashtable requestData = (Hashtable)request.Params[0]; + + if (requestData.ContainsKey("UUID")) + { + TheSim = getRegion(new LLUUID((string)requestData["UUID"])); + logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcLoginToSimulatorMethod","", 5,"Region attempting login with UUID."); + } + else if (requestData.ContainsKey("region_handle")) + { + TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); + logToDB((string)requestData["region_handle"], "XmlRpcLoginToSimulatorMethod", "", 5, "Region attempting login with regionHandle."); + } + else + { + responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; + return response; + } + + if (TheSim == null) + { + responseData["error"] = "sim not found"; + return response; + } + else + { + + ArrayList SimNeighboursData = new ArrayList(); + + SimProfileData neighbour; + Hashtable NeighbourBlock; + + bool fastMode = false; // Only compatible with MySQL right now + + if (fastMode) + { + Dictionary neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); + + foreach (KeyValuePair aSim in neighbours) + { + NeighbourBlock = new Hashtable(); + NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); + NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); + NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); + NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); + NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); + + if (aSim.Value.UUID != TheSim.UUID) + SimNeighboursData.Add(NeighbourBlock); + } + } + else + { + for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) + { + if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) + { + neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); + + NeighbourBlock = new Hashtable(); + NeighbourBlock["sim_ip"] = neighbour.serverIP; + NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); + NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); + NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); + NeighbourBlock["UUID"] = neighbour.UUID.ToString(); + + if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); + } + } + } + + responseData["UUID"] = TheSim.UUID.ToString(); + responseData["region_locx"] = TheSim.regionLocX.ToString(); + responseData["region_locy"] = TheSim.regionLocY.ToString(); + responseData["regionname"] = TheSim.regionName; + responseData["estate_id"] = "1"; + responseData["neighbours"] = SimNeighboursData; + + responseData["sim_ip"] = TheSim.serverIP; + responseData["sim_port"] = TheSim.serverPort.ToString(); + responseData["asset_url"] = TheSim.regionAssetURI; + responseData["asset_sendkey"] = TheSim.regionAssetSendKey; + responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; + responseData["user_url"] = TheSim.regionUserURI; + responseData["user_sendkey"] = TheSim.regionUserSendKey; + responseData["user_recvkey"] = TheSim.regionUserRecvKey; + responseData["authkey"] = TheSim.regionSecret; + + // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) + responseData["data_uri"] = TheSim.regionDataURI; + } + + return response; + } + + public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) + { + int xmin=980, ymin=980, xmax=1020, ymax=1020; + + Hashtable requestData = (Hashtable)request.Params[0]; + if (requestData.ContainsKey("xmin")) + { + xmin = (Int32)requestData["xmin"]; + } + if (requestData.ContainsKey("ymin")) + { + ymin = (Int32)requestData["ymin"]; + } + if (requestData.ContainsKey("xmax")) + { + xmax = (Int32)requestData["xmax"]; + } + if (requestData.ContainsKey("ymax")) + { + ymax = (Int32)requestData["ymax"]; + } + + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable responseData = new Hashtable(); + response.Value = responseData; + IList simProfileList = new ArrayList(); + + bool fastMode = true; // MySQL Only + + if (fastMode) + { + Dictionary neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); + + foreach (KeyValuePair aSim in neighbours) + { + Hashtable simProfileBlock = new Hashtable(); + simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); + simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); + simProfileBlock["name"] = aSim.Value.regionName; + simProfileBlock["access"] = 21; + simProfileBlock["region-flags"] = 512; + simProfileBlock["water-height"] = 0; + simProfileBlock["agents"] = 1; + simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); + + simProfileList.Add(simProfileBlock); + } + OpenSim.Framework.Console.MainConsole.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); + } + else + { + SimProfileData simProfile; + for (int x = xmin; x < xmax; x++) + { + for (int y = ymin; y < ymax; y++) + { + simProfile = getRegion(Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256))); + if (simProfile != null) + { + Hashtable simProfileBlock = new Hashtable(); + simProfileBlock["x"] = x; + simProfileBlock["y"] = y; + simProfileBlock["name"] = simProfile.regionName; + simProfileBlock["access"] = 0; + simProfileBlock["region-flags"] = 0; + simProfileBlock["water-height"] = 20; + simProfileBlock["agents"] = 1; + simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); + + simProfileList.Add(simProfileBlock); + } + } + } + OpenSim.Framework.Console.MainConsole.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); + } + + responseData["sim-profiles"] = simProfileList; + + return response; + } + + + + /// + /// Performs a REST Get Operation + /// + /// + /// + /// + /// + public string RestGetRegionMethod(string request, string path, string param) + { + return RestGetSimMethod("", "/sims/", param); + } + + /// + /// Performs a REST Set Operation + /// + /// + /// + /// + /// + public string RestSetRegionMethod(string request, string path, string param) + { + return RestSetSimMethod("", "/sims/", param); + } + + /// + /// Returns information about a sim via a REST Request + /// + /// + /// + /// + /// Information about the sim in XML + public string RestGetSimMethod(string request, string path, string param) + { + string respstring = String.Empty; + + SimProfileData TheSim; + LLUUID UUID = new LLUUID(param); + TheSim = getRegion(UUID); + + if (!(TheSim == null)) + { + respstring = ""; + respstring += "" + TheSim.regionSendKey + ""; + respstring += ""; + respstring += "" + TheSim.UUID.ToString() + ""; + respstring += "" + TheSim.regionName + ""; + respstring += "" + TheSim.serverIP + ""; + respstring += "" + TheSim.serverPort.ToString() + ""; + respstring += "" + TheSim.regionLocX.ToString() + ""; + respstring += "" + TheSim.regionLocY.ToString() + ""; + respstring += "1"; + respstring += ""; + respstring += ""; + } + + return respstring; + } + + /// + /// Creates or updates a sim via a REST Method Request + /// BROKEN with SQL Update + /// + /// + /// + /// + /// "OK" or an error + public string RestSetSimMethod(string request, string path, string param) + { + Console.WriteLine("Processing region update"); + SimProfileData TheSim; + TheSim = getRegion(new LLUUID(param)); + if ((TheSim) == null) + { + TheSim = new SimProfileData(); + LLUUID UUID = new LLUUID(param); + TheSim.UUID = UUID; + TheSim.regionRecvKey = config.SimRecvKey; + } + + XmlDocument doc = new XmlDocument(); + doc.LoadXml(request); + XmlNode rootnode = doc.FirstChild; + XmlNode authkeynode = rootnode.ChildNodes[0]; + if (authkeynode.Name != "authkey") + { + return "ERROR! bad XML - expected authkey tag"; + } + + XmlNode simnode = rootnode.ChildNodes[1]; + if (simnode.Name != "sim") + { + return "ERROR! bad XML - expected sim tag"; + } + + if (authkeynode.InnerText != TheSim.regionRecvKey) + { + return "ERROR! invalid key"; + } + + //TheSim.regionSendKey = Cfg; + TheSim.regionRecvKey = config.SimRecvKey; + TheSim.regionSendKey = config.SimSendKey; + TheSim.regionSecret = config.SimRecvKey; + TheSim.regionDataURI = ""; + TheSim.regionAssetURI = config.DefaultAssetServer; + TheSim.regionAssetRecvKey = config.AssetRecvKey; + TheSim.regionAssetSendKey = config.AssetSendKey; + TheSim.regionUserURI = config.DefaultUserServer; + TheSim.regionUserSendKey = config.UserSendKey; + TheSim.regionUserRecvKey = config.UserRecvKey; + + + for (int i = 0; i < simnode.ChildNodes.Count; i++) + { + switch (simnode.ChildNodes[i].Name) + { + case "regionname": + TheSim.regionName = simnode.ChildNodes[i].InnerText; + break; + + case "sim_ip": + TheSim.serverIP = simnode.ChildNodes[i].InnerText; + break; + + case "sim_port": + TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); + break; + + case "region_locx": + TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); + TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); + break; + + case "region_locy": + TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); + TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); + break; + } + } + + TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; + + bool requirePublic = false; + + if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) + { + return "ERROR! Servers must register with public addresses."; + } + + try + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); + foreach (KeyValuePair kvp in _plugins) + { + try + { + kvp.Value.AddProfile(TheSim); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); + logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); + } + } + return "OK"; + } + catch (Exception e) + { + return "ERROR! Could not save to database! (" + e.ToString() + ")"; + } + } + + } +} diff --git a/OpenGridServices/OpenGridServices.GridServer/Main.cs b/OpenGridServices/OpenGridServices.GridServer/Main.cs new file mode 100644 index 0000000000..9a7eb005bb --- /dev/null +++ b/OpenGridServices/OpenGridServices.GridServer/Main.cs @@ -0,0 +1,271 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.IO; +using System.Text; +using System.Timers; +using System.Net; +using System.Threading; +using System.Reflection; +using libsecondlife; +using OpenGrid.Framework.Manager; +using OpenSim.Framework; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using OpenSim.Servers; +using OpenSim.GenericConfig; + +namespace OpenGridServices.GridServer +{ + /// + /// + public class OpenGrid_Main : BaseServer, conscmd_callback + { + private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; + private string GridDll = "OpenGrid.Framework.Data.MySQL.dll"; + public GridConfig Cfg; + + public static OpenGrid_Main thegrid; + protected IGenericConfig localXMLConfig; + + public static bool setuponly; + + //public LLUUID highestUUID; + + // private SimProfileManager m_simProfileManager; + + private GridManager m_gridManager; + + private ConsoleBase m_console; + + [STAThread] + public static void Main(string[] args) + { + if (args.Length > 0) + { + if (args[0] == "-setuponly") setuponly = true; + } + Console.WriteLine("Starting...\n"); + + thegrid = new OpenGrid_Main(); + thegrid.Startup(); + + thegrid.Work(); + } + + private void Work() + { + while (true) + { + Thread.Sleep(5000); + // should flush the DB etc here + } + } + + private OpenGrid_Main() + { + m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false); + MainConsole.Instance = m_console; + + + } + + public void managercallback(string cmd) + { + switch (cmd) + { + case "shutdown": + RunCmd("shutdown", new string[0]); + break; + } + } + + + public void Startup() + { + this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); + this.localXMLConfig.LoadData(); + this.ConfigDB(this.localXMLConfig); + this.localXMLConfig.Close(); + + m_console.Verbose( "Main.cs:Startup() - Loading configuration"); + Cfg = this.LoadConfigDll(this.ConfigDll); + Cfg.InitConfig(); + if (setuponly) Environment.Exit(0); + + m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); + m_gridManager = new GridManager(); + m_gridManager.AddPlugin(GridDll); // Made of win + m_gridManager.config = Cfg; + + m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); + BaseHttpServer httpServer = new BaseHttpServer(8001); + //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); + + httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod); + httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); + + httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); + httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); + httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); + httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); + + + // lbsa71 : This code snippet taken from old http server. + // I have no idea what this was supposed to do - looks like an infinite recursion to me. + // case "regions": + //// DIRTY HACK ALERT + //Console.Notice("/regions/ accessed"); + //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1])); + //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod); + //break; + + // lbsa71 : I guess these were never used? + //Listener.Prefixes.Add("http://+:8001/gods/"); + //Listener.Prefixes.Add("http://+:8001/highestuuid/"); + //Listener.Prefixes.Add("http://+:8001/uuidblocks/"); + + httpServer.Start(); + + m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); + + System.Timers.Timer simCheckTimer = new System.Timers.Timer(3600000 * 3); // 3 Hours between updates. + simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); + simCheckTimer.Enabled = true; + } + + private GridConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + GridConfig config = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IGridConfig", true); + + if (typeInterface != null) + { + IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + config = plug.GetConfigObject(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return config; + } + + public void CheckSims(object sender, ElapsedEventArgs e) + { + /* + foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) + { + string SimResponse = ""; + try + { + WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); + CheckSim.Method = "GET"; + CheckSim.ContentType = "text/plaintext"; + CheckSim.ContentLength = 0; + + StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); + stOut.Write(""); + stOut.Close(); + + StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); + SimResponse = stIn.ReadToEnd(); + stIn.Close(); + } + catch + { + } + + if (SimResponse == "OK") + { + m_simProfileManager.SimProfiles[sim.UUID].online = true; + } + else + { + m_simProfileManager.SimProfiles[sim.UUID].online = false; + } + } + */ + } + + public void RunCmd(string cmd, string[] cmdparams) + { + switch (cmd) + { + case "help": + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; + + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } + + public void Show(string ShowWhat) + { + } + + private void ConfigDB(IGenericConfig configData) + { + try + { + string attri = ""; + attri = configData.GetAttribute("DataBaseProvider"); + if (attri == "") + { + GridDll = "OpenGrid.Framework.Data.DB4o.dll"; + configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); + } + else + { + GridDll = attri; + } + configData.Commit(); + } + catch (Exception e) + { + + } + } + } +} diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj new file mode 100644 index 0000000000..f4a6ca1994 --- /dev/null +++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj @@ -0,0 +1,134 @@ + + + Local + 8.0.50727 + 2.0 + {21BFC8E2-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.GridServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.GridServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.Servers.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenGrid.Framework.Manager + {7924FD35-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build new file mode 100644 index 0000000000..9d21edd0b3 --- /dev/null +++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..8471e6b067 --- /dev/null +++ b/OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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-GridServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OGS-GridServer")] +[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("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] + +// 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/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs b/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs new file mode 100644 index 0000000000..9ca9b5e749 --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs @@ -0,0 +1,125 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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 OpenGrid.Framework.Data; +using libsecondlife; +using System.Reflection; + +using System.Xml; +using Nwc.XmlRpc; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; + +using System.Security.Cryptography; + +namespace OpenGridServices.InventoryServer +{ + class InventoryManager + { + Dictionary _plugins = new Dictionary(); + + /// + /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. + /// + /// The filename to the inventory server plugin DLL + public void AddPlugin(string FileName) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName); + Assembly pluginAssembly = Assembly.LoadFrom(FileName); + + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IInventoryData", true); + + if (typeInterface != null) + { + IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Initialise(); + this._plugins.Add(plug.getName(), plug); + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface"); + } + + typeInterface = null; + } + } + + pluginAssembly = null; + } + + public List getRootFolders(LLUUID user) + { + foreach (KeyValuePair kvp in _plugins) + { + try + { + return kvp.Value.getUserRootFolders(user); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); + } + } + return null; + } + + public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + + Hashtable responseData = new Hashtable(); + + // Stuff happens here + + if (requestData.ContainsKey("Access-type")) + { + if (requestData["access-type"] == "rootfolders") + { +// responseData["rootfolders"] = + } + } + else + { + responseData["error"] = "No access-type specified."; + } + + + // Stuff stops happening here + + response.Value = responseData; + return response; + } + } +} diff --git a/OpenGridServices/OpenGridServices.InventoryServer/Main.cs b/OpenGridServices/OpenGridServices.InventoryServer/Main.cs new file mode 100644 index 0000000000..f479a79b7c --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/Main.cs @@ -0,0 +1,87 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Reflection; +using System.IO; +using System.Text; +using libsecondlife; +using OpenSim.Framework.User; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Console; +using OpenSim.Servers; +using OpenSim.Framework.Utilities; + +namespace OpenGridServices.InventoryServer +{ + public class OpenInventory_Main : BaseServer, conscmd_callback + { + ConsoleBase m_console; + InventoryManager m_inventoryManager; + + public static void Main(string[] args) + { + } + + public OpenInventory_Main() + { + m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); + MainConsole.Instance = m_console; + } + + public void Startup() + { + MainConsole.Instance.Notice("Initialising inventory manager..."); + m_inventoryManager = new InventoryManager(); + + MainConsole.Instance.Notice("Starting HTTP server"); + BaseHttpServer httpServer = new BaseHttpServer(8004); + + httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); + //httpServer.AddRestHandler("GET","/rootfolders/",Rest + } + + public void RunCmd(string cmd, string[] cmdparams) + { + switch (cmd) + { + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } + + public void Show(string ShowWhat) + { + } + } +} diff --git a/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj b/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj new file mode 100644 index 0000000000..6aec357c19 --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj @@ -0,0 +1,125 @@ + + + Local + 8.0.50727 + 2.0 + {338FA00B-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.InventoryServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.InventoryServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GridInterfaces.Local.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.exe.build b/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.exe.build new file mode 100644 index 0000000000..c23a862adc --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.exe.build @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.mds b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.mds new file mode 100644 index 0000000000..ed7bc24f3a --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.mds @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.userprefs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.userprefs new file mode 100644 index 0000000000..f221509426 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.userprefs @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.usertasks b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.usertasks new file mode 100644 index 0000000000..d887d0ef8d --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.usertasks @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs new file mode 100644 index 0000000000..af4e2756b6 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs @@ -0,0 +1,32 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes specify the key for the sign of your assembly. See the +// .NET Framework documentation for more information about signing. +// This is not required, if you don't want signing let these attributes like they're. +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs new file mode 100644 index 0000000000..83685fc3c9 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading; +using System.Collections.Generic; +using System.Text; + +namespace OpenGridServices.Manager +{ + public class BlockingQueue + { + private Queue _queue = new Queue(); + private object _queueSync = new object(); + + public void Enqueue(T value) + { + lock (_queueSync) + { + _queue.Enqueue(value); + Monitor.Pulse(_queueSync); + } + } + + public T Dequeue() + { + lock (_queueSync) + { + if (_queue.Count < 1) + Monitor.Wait(_queueSync); + + return _queue.Dequeue(); + } + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs new file mode 100644 index 0000000000..0d509ef11e --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs @@ -0,0 +1,16 @@ + +using System; + +namespace OpenGridServices.Manager +{ + + + public partial class Connect to grid server : Gtk.Dialog + { + + public Connect to grid server() + { + this.Build(); + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs new file mode 100644 index 0000000000..8a80b1db2c --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs @@ -0,0 +1,29 @@ +using Gtk; +using System; + +namespace OpenGridServices.Manager { + public partial class ConnectToGridServerDialog : Gtk.Dialog + { + + public ConnectToGridServerDialog() + { + this.Build(); + } + + protected virtual void OnResponse(object o, Gtk.ResponseArgs args) + { + switch(args.ResponseId) { + case Gtk.ResponseType.Ok: + MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text); + break; + + case Gtk.ResponseType.Cancel: + break; + } + this.Hide(); + + } + + } + +} \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs new file mode 100644 index 0000000000..6b632d69e5 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs @@ -0,0 +1,106 @@ +using Nwc.XmlRpc; +using System; +using System.Net; +using System.IO; +using System.Xml; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; + +namespace OpenGridServices.Manager +{ + public class GridServerConnectionManager + { + private string ServerURL; + public LLUUID SessionID; + public bool connected=false; + + public RegionBlock[][] WorldMap; + + public bool Connect(string GridServerURL, string username, string password) + { + try { + this.ServerURL=GridServerURL; + Hashtable LoginParamsHT = new Hashtable(); + LoginParamsHT["username"]=username; + LoginParamsHT["password"]=password; + ArrayList LoginParams = new ArrayList(); + LoginParams.Add(LoginParamsHT); + XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); + XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); + if(GridResp.IsFault) { + connected=false; + return false; + } else { + Hashtable gridrespData = (Hashtable)GridResp.Value; + this.SessionID = new LLUUID((string)gridrespData["session_id"]); + connected=true; + return true; + } + } catch(Exception e) { + Console.WriteLine(e.ToString()); + connected=false; + return false; + } + } + + public void DownloadMap() + { + System.Net.WebClient mapdownloader = new WebClient(); + Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist"); + + RegionBlock TempRegionData; + + XmlDocument doc = new XmlDocument(); + doc.Load(regionliststream); + regionliststream.Close(); + XmlNode rootnode = doc.FirstChild; + if (rootnode.Name != "regions") + { + // TODO - ERROR! + } + + for(int i=0; i<=rootnode.ChildNodes.Count; i++) + { + if(rootnode.ChildNodes.Item(i).Name != "region") { + // TODO - ERROR! + } else { + TempRegionData = new RegionBlock(); + + + } + } + } + + public bool RestartServer() + { + return true; + } + + public bool ShutdownServer() + { + try { + Hashtable ShutdownParamsHT = new Hashtable(); + ArrayList ShutdownParams = new ArrayList(); + ShutdownParamsHT["session_id"]=this.SessionID.ToString(); + ShutdownParams.Add(ShutdownParamsHT); + XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams); + XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL,3000); + if(GridResp.IsFault) { + return false; + } else { + connected=false; + return true; + } + } catch(Exception e) { + Console.WriteLine(e.ToString()); + return false; + } + } + + public void DisconnectServer() + { + this.connected=false; + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs new file mode 100644 index 0000000000..42e09e0990 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs @@ -0,0 +1,96 @@ +// project created on 5/14/2007 at 2:04 PM +using System; +using System.Threading; +using Gtk; + +namespace OpenGridServices.Manager +{ + class MainClass + { + + public static bool QuitReq=false; + public static BlockingQueue PendingOperations = new BlockingQueue(); + + private static Thread OperationsRunner; + + private static GridServerConnectionManager gridserverConn; + + private static MainWindow win; + + public static void DoMainLoop() + { + while(!QuitReq) + { + Application.RunIteration(); + } + } + + public static void RunOperations() + { + string operation; + string cmd; + char[] sep = new char[1]; + sep[0]=' '; + while(!QuitReq) + { + operation=PendingOperations.Dequeue(); + Console.WriteLine(operation); + cmd = operation.Split(sep)[0]; + switch(cmd) { + case "connect_to_gridserver": + win.SetStatus("Connecting to grid server..."); + if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) { + win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); + win.SetGridServerConnected(true); + Thread.Sleep(3000); + win.SetStatus("Downloading region maps..."); + gridserverConn.DownloadMap(); + } else { + win.SetStatus("Could not connect"); + } + break; + + case "restart_gridserver": + win.SetStatus("Restarting grid server..."); + if(gridserverConn.RestartServer()) { + win.SetStatus("Restarted server OK"); + Thread.Sleep(3000); + win.SetStatus(""); + } else { + win.SetStatus("Error restarting grid server!!!"); + } + break; + + case "shutdown_gridserver": + win.SetStatus("Shutting down grid server..."); + if(gridserverConn.ShutdownServer()) { + win.SetStatus("Grid server shutdown"); + win.SetGridServerConnected(false); + Thread.Sleep(3000); + win.SetStatus(""); + } else { + win.SetStatus("Could not shutdown grid server!!!"); + } + break; + + case "disconnect_gridserver": + gridserverConn.DisconnectServer(); + win.SetGridServerConnected(false); + break; + } + } + } + + public static void Main (string[] args) + { + gridserverConn = new GridServerConnectionManager(); + Application.Init (); + win = new MainWindow (); + win.Show (); + OperationsRunner = new Thread(new ThreadStart(RunOperations)); + OperationsRunner.IsBackground=true; + OperationsRunner.Start(); + DoMainLoop(); + } + } +} \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs new file mode 100644 index 0000000000..1db38f05c6 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs @@ -0,0 +1,76 @@ +using System; +using Gtk; + +namespace OpenGridServices.Manager { + public partial class MainWindow: Gtk.Window + { + public MainWindow (): base (Gtk.WindowType.Toplevel) + { + Build (); + } + + public void SetStatus(string statustext) + { + this.statusbar1.Pop(0); + this.statusbar1.Push(0,statustext); + } + + public void DrawGrid(RegionBlock[][] regions) + { + for(int x=0; x<=regions.GetUpperBound(0); x++) { + for(int y=0; y<=regions.GetUpperBound(1); y++) { + Gdk.Image themap = new Gdk.Image(Gdk.ImageType.Fastest,Gdk.Visual.System,256,256); + this.drawingarea1.GdkWindow.DrawImage(new Gdk.GC(this.drawingarea1.GdkWindow),themap,0,0,x*256,y*256,256,256); + } + } + } + + public void SetGridServerConnected(bool connected) + { + if(connected) { + this.ConnectToGridserver.Visible=false; + this.DisconnectFromGridServer.Visible=true; + } else { + this.ConnectToGridserver.Visible=true; + this.DisconnectFromGridServer.Visible=false; + } + } + + protected void OnDeleteEvent (object sender, DeleteEventArgs a) + { + Application.Quit (); + MainClass.QuitReq=true; + a.RetVal = true; + } + + protected virtual void QuitMenu(object sender, System.EventArgs e) + { + MainClass.QuitReq=true; + Application.Quit(); + } + + protected virtual void ConnectToGridServerMenu(object sender, System.EventArgs e) + { + ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog (); + griddialog.Show(); + } + + protected virtual void RestartGridserverMenu(object sender, System.EventArgs e) + { + MainClass.PendingOperations.Enqueue("restart_gridserver"); + } + + protected virtual void ShutdownGridserverMenu(object sender, System.EventArgs e) + { + MainClass.PendingOperations.Enqueue("shutdown_gridserver"); + } + + protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e) + { + MainClass.PendingOperations.Enqueue("disconnect_gridserver"); + } + + } +} + + \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp new file mode 100644 index 0000000000..cfdc085eb8 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb new file mode 100644 index 0000000000000000000000000000000000000000..44e7a619a3168cd0949fe56768cbac1002c4f6bc GIT binary patch literal 12308 zcmc(lOLr8<6~|{_rZqhRGdyf;Y{&S4ZEQS9V1b2AKuAImB!rOwJANoVGbO3R%(T+o zBT!BjPFBe-i+qQCfg~RwC!4HtPF7jvoa6&|nPr^&yWKsSW*!~^B6ZHKuD(_MzqfAP zx>eQPnQSJL`A!m7QjWqaOItx`8s%xPUN_ay^_oHXniH&tPNi-N(x5o+Ikl@!HT3+E zyT%WsMPb@&Y&gF0OSGK!YUY;jZMrq%7ho*8KR3A>W-GAnI`x(bO6F%Rr|yPZ$zz$! zo;{g-e$Qw@1YEwfA1TFA$?ZL4d$})Bq-5nJJ38+Kp`f|7Whb~l?*`$rci%JvD=(Fa zT9zd@M><-riNJp%h zP2m*h!u#bZwSDIUnaqEs@_?`)I{Io-%~QEMf$?DshjUO`LR~odsUR@n@IZ&9DFo0D zc#MQX)@`#U&cW?)Dm^bPA&_D_M@WSw<8QiE6G+97SVyHL1lH?9n$YU-wAXBkV=sHy zT}-yQ6RW)>I1sQ5peA5Tw@nZ_et2))tDBvT=*t2Efq7B^B?I%|(t0Ztk7_;!D6Rnk z`ks&`Ko875bVC$eaGK8APWsM}KtR5$c#;9RZBkrtrzT}|pl*{+RjXdB8LFa8TVxLB zNpDI^sLQ1L=IUO>so(TMai`(&PDoP-Jg%DPdTGWD2#izp`nT1or5i zjk;_ZcDSre%JUF#Zz+~!z#UMaD0=NIDts&m5Rj<=cBH)~DE3Z!eo^osaPebJsQN}5 zHy*PN_^Y0em1#TNtiB{IA*9d?O-MN$g9~EYpQ#)Uc1l`8z@}ETBipdsz9)@_#GRIw zP?u2-Mzf>C6vKngN>d2X)T)->tauOA>)O38u#38T#d`?+c47}TC$|tVuOwBNvLFuC zsyO}`m~Es{kQSuoilZB>jZP?t^zf~wD6y!Jr1 zm+4L(Lbav1L3;lgsX}+zenLQxMeJxQS-PoDBibM?v!*32qbop*QiK3XZ}r@U>?L{t zU56h5BsoBz$_>;9C~bb#s1MMRfIxkK2&LQOI0)#DG=%y9X|QZN#2}!10s{2`BKi)e z(dW_->H~CcXrM2oCDaFqm_3|EUr9r#570+L1Fc9)s1Fcfe>jaCX$W-z*`aUDrfVLg zeR7{Vw^ZGgDx_>D+_EaS5OAqArzm^-uoXyTNaO9->6g@PgHZy|$Q1(cZJ~C;m8AZ= z{FRnl*F`|(;ep)=q%~nfAiYVGgjo?N7@T!`C**v2dfjW7(`#}_57$pGZkT4W#B;1F z$7g~56>H)B57t`l>Fr}~xf<*jc~uclXCUp-vyp@}MAEmxXK!u6F!hR#z{DvhSK8)y zu>p^F9oj23HRgqEA)R{Izmu_7D%uI4{fo^RQ#YZR-HgvJh|nO@ZbyOF2y9ZLM4V0~ zpt4THqI{UXbO2BJYeDJ(Rd-Za5a3f(qb`gCF{4Y}!lx}aWRatFZ)f}-P4#^TPe&59 zlw^oMC^rx=GgKtZBQc{(r=#utQ{t`0-&GZP(F36(%ZjQ9<52X`~e=wtbDR}=<`r5Bs&StGqg9dOpb zIUt@+oi(hwQ!(}QenK~v^YEp0M@k|kqYY4c^DWDZztsb17Jdhc6ahLcSEvhUq|ypQ zubJ+ePUkCH(GB&yuppq03u(eeF;sd>I1uWnJPW0uBEUy-@b5pN-zNK+LH^73=0zbq z2-3m-zX(S7A4LVUp!YTl#dO^X0`6Yvx1Hm$D5?5Aow~CHU^$>+{+g_7KMD|mI7*); z1=uPB20q3%2_h`%K|NtI6<`bwOE;fzchAT(uHLiA}zpxwe28JT~I5wHW6+&kBD zxmru1k+;oMs}7N&dJabN=&0LtLs?_xyIGCreo1zgES0b+-Geap$0k zF-uIjFZw1o=X~ z6fesS#3;6RDllG+8L3f39S{PBlp`0-F9QF zUlI{-2;oq>>Qr5Vv~P(=aV3=~5E8dPc-wl5ZaI9W*Jt@D-*>k7_Dz({uLKe=( zrqeLNhEp}Vv!HpQ>NP{ze*_la|C?d1DNXj~vc1%8|3&cL@G?*qvQfQQ%wd#)*xGK_ z|4<+v#eXQ^)HV)W%<5oCDI@gAQ`1zFf4i*Q2U3pPv5#gW39<_uw>dfRUVrzImPKlUq6I$&z$=;Hzl)Qms5T^uiul_$o=#>!)-j!(;1;g)YMHccz^o%*Tcw_26DTa~|; z^arDhmGkGFiR#3;@yW9vnz4^2vrJ-iwBAd}U?&r-JO0MDm^0-MMbHp3&Q6%|vGK`? zno~Jjot#|F5+hW``)L`qrznFEq%uxP;cnYjYjwBs^g2R_Qz0Kn;a-Ojr)Hj>6k@1K zDW{}tIL$Th=}93-tCZ7H_`Ka0*0%C3FK{1jkNi#?Z0!8mk4$B9b^PoZQ#(I#F3UQg za>i1$dDR0<-Kk%t0;9`o8DiHlgpDU|%)* z$&VicgOMtyWD`hO$nDu*I5|kvvLpWoCO}1e|k5{U=8O9ao=Z~ ztp<&uPgu+(=?}2hMJaVmOkHS;`5y{*Ah5jQVuP;wf;Y0sKe#I^ndcC3Y;XROTm~Ah z-HFuWdw4vPzbx56`JEk00UQ8;ZwFbN59|EM@@aH-sQb5zIX)rCy@Mc%KPBHp1spjPQOerOQH!hXHl8 zzL0|brDWDuu;fii784+gcLk)#+FuLjd);S68X>qilKqKXBEgQ7E(_s4C5(sLS{2Dg z;_u`otO-{&DPcaew5pO}CaWfeR7Xo#mo^<y> 1) - (min >> 2) + (min >> 4)); + //} + + public static string FieldToString(byte[] bytes) + { + return FieldToString(bytes, String.Empty); + } + + /// + /// Convert a variable length field (byte array) to a string, with a + /// field name prepended to each line of the output + /// + /// If the byte array has unprintable characters in it, a + /// hex dump will be put in the string instead + /// The byte array to convert to a string + /// A field name to prepend to each line of output + /// An ASCII string or a string containing a hex dump, minus + /// the null terminator + public static string FieldToString(byte[] bytes, string fieldName) + { + // Check for a common case + if (bytes.Length == 0) return String.Empty; + + StringBuilder output = new StringBuilder(); + bool printable = true; + + for (int i = 0; i < bytes.Length; ++i) + { + // Check if there are any unprintable characters in the array + if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 + && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) + { + printable = false; + break; + } + } + + if (printable) + { + if (fieldName.Length > 0) + { + output.Append(fieldName); + output.Append(": "); + } + + if (bytes[bytes.Length - 1] == 0x00) + output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); + else + output.Append(UTF8Encoding.UTF8.GetString(bytes)); + } + else + { + for (int i = 0; i < bytes.Length; i += 16) + { + if (i != 0) + output.Append(Environment.NewLine); + if (fieldName.Length > 0) + { + output.Append(fieldName); + output.Append(": "); + } + + for (int j = 0; j < 16; j++) + { + if ((i + j) < bytes.Length) + output.Append(String.Format("{0:X2} ", bytes[i + j])); + else + output.Append(" "); + } + + for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) + { + if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) + output.Append((char)bytes[i + j]); + else + output.Append("."); + } + } + } + + return output.ToString(); + } + public Util() + { + + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs new file mode 100644 index 0000000000..da6739e42e --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs @@ -0,0 +1,226 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +namespace OpenGridServices.Manager { + + + public partial class ConnectToGridServerDialog { + + private Gtk.VBox vbox2; + + private Gtk.VBox vbox3; + + private Gtk.HBox hbox1; + + private Gtk.Label label1; + + private Gtk.Entry entry1; + + private Gtk.HBox hbox2; + + private Gtk.Label label2; + + private Gtk.Entry entry2; + + private Gtk.HBox hbox3; + + private Gtk.Label label3; + + private Gtk.Entry entry3; + + private Gtk.Button button2; + + private Gtk.Button button8; + + protected virtual void Build() { + Stetic.Gui.Initialize(); + // Widget OpenGridServices.Manager.ConnectToGridServerDialog + this.Events = ((Gdk.EventMask)(256)); + this.Name = "OpenGridServices.Manager.ConnectToGridServerDialog"; + this.Title = Mono.Unix.Catalog.GetString("Connect to Grid server"); + this.WindowPosition = ((Gtk.WindowPosition)(4)); + this.HasSeparator = false; + // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.VBox + Gtk.VBox w1 = this.VBox; + w1.Events = ((Gdk.EventMask)(256)); + w1.Name = "dialog_VBox"; + w1.BorderWidth = ((uint)(2)); + // Container child dialog_VBox.Gtk.Box+BoxChild + this.vbox2 = new Gtk.VBox(); + this.vbox2.Name = "vbox2"; + // Container child vbox2.Gtk.Box+BoxChild + this.vbox3 = new Gtk.VBox(); + this.vbox3.Name = "vbox3"; + // Container child vbox3.Gtk.Box+BoxChild + this.hbox1 = new Gtk.HBox(); + this.hbox1.Name = "hbox1"; + // Container child hbox1.Gtk.Box+BoxChild + this.label1 = new Gtk.Label(); + this.label1.Name = "label1"; + this.label1.Xalign = 1F; + this.label1.LabelProp = Mono.Unix.Catalog.GetString("Grid server URL: "); + this.label1.Justify = ((Gtk.Justification)(1)); + this.hbox1.Add(this.label1); + Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1])); + w2.Position = 0; + // Container child hbox1.Gtk.Box+BoxChild + this.entry1 = new Gtk.Entry(); + this.entry1.CanFocus = true; + this.entry1.Name = "entry1"; + this.entry1.Text = Mono.Unix.Catalog.GetString("http://gridserver:8001"); + this.entry1.IsEditable = true; + this.entry1.MaxLength = 255; + this.entry1.InvisibleChar = '•'; + this.hbox1.Add(this.entry1); + Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.entry1])); + w3.Position = 1; + this.vbox3.Add(this.hbox1); + Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1])); + w4.Position = 0; + w4.Expand = false; + w4.Fill = false; + // Container child vbox3.Gtk.Box+BoxChild + this.hbox2 = new Gtk.HBox(); + this.hbox2.Name = "hbox2"; + // Container child hbox2.Gtk.Box+BoxChild + this.label2 = new Gtk.Label(); + this.label2.Name = "label2"; + this.label2.Xalign = 1F; + this.label2.LabelProp = Mono.Unix.Catalog.GetString("Username:"); + this.label2.Justify = ((Gtk.Justification)(1)); + this.hbox2.Add(this.label2); + Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2])); + w5.Position = 0; + // Container child hbox2.Gtk.Box+BoxChild + this.entry2 = new Gtk.Entry(); + this.entry2.CanFocus = true; + this.entry2.Name = "entry2"; + this.entry2.IsEditable = true; + this.entry2.InvisibleChar = '•'; + this.hbox2.Add(this.entry2); + Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.entry2])); + w6.Position = 1; + this.vbox3.Add(this.hbox2); + Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2])); + w7.Position = 1; + w7.Expand = false; + w7.Fill = false; + // Container child vbox3.Gtk.Box+BoxChild + this.hbox3 = new Gtk.HBox(); + this.hbox3.Name = "hbox3"; + // Container child hbox3.Gtk.Box+BoxChild + this.label3 = new Gtk.Label(); + this.label3.Name = "label3"; + this.label3.Xalign = 1F; + this.label3.LabelProp = Mono.Unix.Catalog.GetString("Password:"); + this.label3.Justify = ((Gtk.Justification)(1)); + this.hbox3.Add(this.label3); + Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox3[this.label3])); + w8.Position = 0; + // Container child hbox3.Gtk.Box+BoxChild + this.entry3 = new Gtk.Entry(); + this.entry3.CanFocus = true; + this.entry3.Name = "entry3"; + this.entry3.IsEditable = true; + this.entry3.InvisibleChar = '•'; + this.hbox3.Add(this.entry3); + Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox3[this.entry3])); + w9.Position = 1; + this.vbox3.Add(this.hbox3); + Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3])); + w10.Position = 2; + w10.Expand = false; + w10.Fill = false; + this.vbox2.Add(this.vbox3); + Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.vbox3])); + w11.Position = 2; + w11.Expand = false; + w11.Fill = false; + w1.Add(this.vbox2); + Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.vbox2])); + w12.Position = 0; + // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea + Gtk.HButtonBox w13 = this.ActionArea; + w13.Events = ((Gdk.EventMask)(256)); + w13.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea"; + w13.Spacing = 6; + w13.BorderWidth = ((uint)(5)); + w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); + // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.button2 = new Gtk.Button(); + this.button2.CanDefault = true; + this.button2.CanFocus = true; + this.button2.Name = "button2"; + this.button2.UseUnderline = true; + // Container child button2.Gtk.Container+ContainerChild + Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); + w14.Name = "GtkAlignment"; + // Container child GtkAlignment.Gtk.Container+ContainerChild + Gtk.HBox w15 = new Gtk.HBox(); + w15.Name = "GtkHBox"; + w15.Spacing = 2; + // Container child GtkHBox.Gtk.Container+ContainerChild + Gtk.Image w16 = new Gtk.Image(); + w16.Name = "image1"; + w16.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0); + w15.Add(w16); + // Container child GtkHBox.Gtk.Container+ContainerChild + Gtk.Label w18 = new Gtk.Label(); + w18.Name = "GtkLabel"; + w18.LabelProp = Mono.Unix.Catalog.GetString("Connect"); + w18.UseUnderline = true; + w15.Add(w18); + w14.Add(w15); + this.button2.Add(w14); + this.AddActionWidget(this.button2, -5); + Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button2])); + w22.Expand = false; + w22.Fill = false; + // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.button8 = new Gtk.Button(); + this.button8.CanDefault = true; + this.button8.CanFocus = true; + this.button8.Name = "button8"; + this.button8.UseUnderline = true; + // Container child button8.Gtk.Container+ContainerChild + Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); + w23.Name = "GtkAlignment1"; + // Container child GtkAlignment1.Gtk.Container+ContainerChild + Gtk.HBox w24 = new Gtk.HBox(); + w24.Name = "GtkHBox1"; + w24.Spacing = 2; + // Container child GtkHBox1.Gtk.Container+ContainerChild + Gtk.Image w25 = new Gtk.Image(); + w25.Name = "image2"; + w25.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0); + w24.Add(w25); + // Container child GtkHBox1.Gtk.Container+ContainerChild + Gtk.Label w27 = new Gtk.Label(); + w27.Name = "GtkLabel1"; + w27.LabelProp = Mono.Unix.Catalog.GetString("Cancel"); + w27.UseUnderline = true; + w24.Add(w27); + w23.Add(w24); + this.button8.Add(w23); + this.AddActionWidget(this.button8, -6); + Gtk.ButtonBox.ButtonBoxChild w31 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button8])); + w31.Position = 1; + w31.Expand = false; + w31.Fill = false; + if ((this.Child != null)) { + this.Child.ShowAll(); + } + this.DefaultWidth = 476; + this.DefaultHeight = 137; + this.Show(); + this.Response += new Gtk.ResponseHandler(this.OnResponse); + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs new file mode 100644 index 0000000000..8798dac97b --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs @@ -0,0 +1,256 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +namespace OpenGridServices.Manager { + + + public partial class MainWindow { + + private Gtk.Action Grid; + + private Gtk.Action User; + + private Gtk.Action Asset; + + private Gtk.Action Region; + + private Gtk.Action Services; + + private Gtk.Action ConnectToGridserver; + + private Gtk.Action RestartWholeGrid; + + private Gtk.Action ShutdownWholeGrid; + + private Gtk.Action ExitGridManager; + + private Gtk.Action ConnectToUserserver; + + private Gtk.Action AccountManagment; + + private Gtk.Action GlobalNotice; + + private Gtk.Action DisableAllLogins; + + private Gtk.Action DisableNonGodUsersOnly; + + private Gtk.Action ShutdownUserServer; + + private Gtk.Action ShutdownGridserverOnly; + + private Gtk.Action RestartGridserverOnly; + + private Gtk.Action DefaultLocalGridUserserver; + + private Gtk.Action CustomUserserver; + + private Gtk.Action RemoteGridDefaultUserserver; + + private Gtk.Action DisconnectFromGridServer; + + private Gtk.Action UploadAsset; + + private Gtk.Action AssetManagement; + + private Gtk.Action ConnectToAssetServer; + + private Gtk.Action ConnectToDefaultAssetServerForGrid; + + private Gtk.Action DefaultForLocalGrid; + + private Gtk.Action DefaultForRemoteGrid; + + private Gtk.Action CustomAssetServer; + + private Gtk.VBox vbox1; + + private Gtk.MenuBar menubar2; + + private Gtk.HBox hbox1; + + private Gtk.ScrolledWindow scrolledwindow1; + + private Gtk.DrawingArea drawingarea1; + + private Gtk.TreeView treeview1; + + private Gtk.Statusbar statusbar1; + + protected virtual void Build() { + Stetic.Gui.Initialize(); + // Widget OpenGridServices.Manager.MainWindow + Gtk.UIManager w1 = new Gtk.UIManager(); + Gtk.ActionGroup w2 = new Gtk.ActionGroup("Default"); + this.Grid = new Gtk.Action("Grid", Mono.Unix.Catalog.GetString("Grid"), null, null); + this.Grid.HideIfEmpty = false; + this.Grid.ShortLabel = Mono.Unix.Catalog.GetString("Grid"); + w2.Add(this.Grid, "g"); + this.User = new Gtk.Action("User", Mono.Unix.Catalog.GetString("User"), null, null); + this.User.HideIfEmpty = false; + this.User.ShortLabel = Mono.Unix.Catalog.GetString("User"); + w2.Add(this.User, null); + this.Asset = new Gtk.Action("Asset", Mono.Unix.Catalog.GetString("Asset"), null, null); + this.Asset.HideIfEmpty = false; + this.Asset.ShortLabel = Mono.Unix.Catalog.GetString("Asset"); + w2.Add(this.Asset, null); + this.Region = new Gtk.Action("Region", Mono.Unix.Catalog.GetString("Region"), null, null); + this.Region.ShortLabel = Mono.Unix.Catalog.GetString("Region"); + w2.Add(this.Region, null); + this.Services = new Gtk.Action("Services", Mono.Unix.Catalog.GetString("Services"), null, null); + this.Services.ShortLabel = Mono.Unix.Catalog.GetString("Services"); + w2.Add(this.Services, null); + this.ConnectToGridserver = new Gtk.Action("ConnectToGridserver", Mono.Unix.Catalog.GetString("Connect to gridserver..."), null, "gtk-connect"); + this.ConnectToGridserver.HideIfEmpty = false; + this.ConnectToGridserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to gridserver"); + w2.Add(this.ConnectToGridserver, null); + this.RestartWholeGrid = new Gtk.Action("RestartWholeGrid", Mono.Unix.Catalog.GetString("Restart whole grid"), null, "gtk-refresh"); + this.RestartWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Restart whole grid"); + w2.Add(this.RestartWholeGrid, null); + this.ShutdownWholeGrid = new Gtk.Action("ShutdownWholeGrid", Mono.Unix.Catalog.GetString("Shutdown whole grid"), null, "gtk-stop"); + this.ShutdownWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown whole grid"); + w2.Add(this.ShutdownWholeGrid, null); + this.ExitGridManager = new Gtk.Action("ExitGridManager", Mono.Unix.Catalog.GetString("Exit grid manager"), null, "gtk-close"); + this.ExitGridManager.ShortLabel = Mono.Unix.Catalog.GetString("Exit grid manager"); + w2.Add(this.ExitGridManager, null); + this.ConnectToUserserver = new Gtk.Action("ConnectToUserserver", Mono.Unix.Catalog.GetString("Connect to userserver"), null, "gtk-connect"); + this.ConnectToUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to userserver"); + w2.Add(this.ConnectToUserserver, null); + this.AccountManagment = new Gtk.Action("AccountManagment", Mono.Unix.Catalog.GetString("Account managment"), null, "gtk-properties"); + this.AccountManagment.ShortLabel = Mono.Unix.Catalog.GetString("Account managment"); + w2.Add(this.AccountManagment, null); + this.GlobalNotice = new Gtk.Action("GlobalNotice", Mono.Unix.Catalog.GetString("Global notice"), null, "gtk-network"); + this.GlobalNotice.ShortLabel = Mono.Unix.Catalog.GetString("Global notice"); + w2.Add(this.GlobalNotice, null); + this.DisableAllLogins = new Gtk.Action("DisableAllLogins", Mono.Unix.Catalog.GetString("Disable all logins"), null, "gtk-no"); + this.DisableAllLogins.ShortLabel = Mono.Unix.Catalog.GetString("Disable all logins"); + w2.Add(this.DisableAllLogins, null); + this.DisableNonGodUsersOnly = new Gtk.Action("DisableNonGodUsersOnly", Mono.Unix.Catalog.GetString("Disable non-god users only"), null, "gtk-no"); + this.DisableNonGodUsersOnly.ShortLabel = Mono.Unix.Catalog.GetString("Disable non-god users only"); + w2.Add(this.DisableNonGodUsersOnly, null); + this.ShutdownUserServer = new Gtk.Action("ShutdownUserServer", Mono.Unix.Catalog.GetString("Shutdown user server"), null, "gtk-stop"); + this.ShutdownUserServer.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown user server"); + w2.Add(this.ShutdownUserServer, null); + this.ShutdownGridserverOnly = new Gtk.Action("ShutdownGridserverOnly", Mono.Unix.Catalog.GetString("Shutdown gridserver only"), null, "gtk-stop"); + this.ShutdownGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown gridserver only"); + w2.Add(this.ShutdownGridserverOnly, null); + this.RestartGridserverOnly = new Gtk.Action("RestartGridserverOnly", Mono.Unix.Catalog.GetString("Restart gridserver only"), null, "gtk-refresh"); + this.RestartGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Restart gridserver only"); + w2.Add(this.RestartGridserverOnly, null); + this.DefaultLocalGridUserserver = new Gtk.Action("DefaultLocalGridUserserver", Mono.Unix.Catalog.GetString("Default local grid userserver"), null, null); + this.DefaultLocalGridUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Default local grid userserver"); + w2.Add(this.DefaultLocalGridUserserver, null); + this.CustomUserserver = new Gtk.Action("CustomUserserver", Mono.Unix.Catalog.GetString("Custom userserver..."), null, null); + this.CustomUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Custom userserver"); + w2.Add(this.CustomUserserver, null); + this.RemoteGridDefaultUserserver = new Gtk.Action("RemoteGridDefaultUserserver", Mono.Unix.Catalog.GetString("Remote grid default userserver..."), null, null); + this.RemoteGridDefaultUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Remote grid default userserver"); + w2.Add(this.RemoteGridDefaultUserserver, null); + this.DisconnectFromGridServer = new Gtk.Action("DisconnectFromGridServer", Mono.Unix.Catalog.GetString("Disconnect from grid server"), null, "gtk-disconnect"); + this.DisconnectFromGridServer.ShortLabel = Mono.Unix.Catalog.GetString("Disconnect from grid server"); + this.DisconnectFromGridServer.Visible = false; + w2.Add(this.DisconnectFromGridServer, null); + this.UploadAsset = new Gtk.Action("UploadAsset", Mono.Unix.Catalog.GetString("Upload asset"), null, null); + this.UploadAsset.ShortLabel = Mono.Unix.Catalog.GetString("Upload asset"); + w2.Add(this.UploadAsset, null); + this.AssetManagement = new Gtk.Action("AssetManagement", Mono.Unix.Catalog.GetString("Asset management"), null, null); + this.AssetManagement.ShortLabel = Mono.Unix.Catalog.GetString("Asset management"); + w2.Add(this.AssetManagement, null); + this.ConnectToAssetServer = new Gtk.Action("ConnectToAssetServer", Mono.Unix.Catalog.GetString("Connect to asset server"), null, null); + this.ConnectToAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Connect to asset server"); + w2.Add(this.ConnectToAssetServer, null); + this.ConnectToDefaultAssetServerForGrid = new Gtk.Action("ConnectToDefaultAssetServerForGrid", Mono.Unix.Catalog.GetString("Connect to default asset server for grid"), null, null); + this.ConnectToDefaultAssetServerForGrid.ShortLabel = Mono.Unix.Catalog.GetString("Connect to default asset server for grid"); + w2.Add(this.ConnectToDefaultAssetServerForGrid, null); + this.DefaultForLocalGrid = new Gtk.Action("DefaultForLocalGrid", Mono.Unix.Catalog.GetString("Default for local grid"), null, null); + this.DefaultForLocalGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for local grid"); + w2.Add(this.DefaultForLocalGrid, null); + this.DefaultForRemoteGrid = new Gtk.Action("DefaultForRemoteGrid", Mono.Unix.Catalog.GetString("Default for remote grid..."), null, null); + this.DefaultForRemoteGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for remote grid..."); + w2.Add(this.DefaultForRemoteGrid, null); + this.CustomAssetServer = new Gtk.Action("CustomAssetServer", Mono.Unix.Catalog.GetString("Custom asset server..."), null, null); + this.CustomAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Custom asset server..."); + w2.Add(this.CustomAssetServer, null); + w1.InsertActionGroup(w2, 0); + this.AddAccelGroup(w1.AccelGroup); + this.WidthRequest = 800; + this.HeightRequest = 600; + this.Name = "OpenGridServices.Manager.MainWindow"; + this.Title = Mono.Unix.Catalog.GetString("Open Grid Services Manager"); + this.Icon = Gtk.IconTheme.Default.LoadIcon("gtk-network", 48, 0); + // Container child OpenGridServices.Manager.MainWindow.Gtk.Container+ContainerChild + this.vbox1 = new Gtk.VBox(); + this.vbox1.Name = "vbox1"; + // Container child vbox1.Gtk.Box+BoxChild + w1.AddUiFromString(""); + this.menubar2 = ((Gtk.MenuBar)(w1.GetWidget("/menubar2"))); + this.menubar2.HeightRequest = 25; + this.menubar2.Name = "menubar2"; + this.vbox1.Add(this.menubar2); + Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox1[this.menubar2])); + w3.Position = 0; + w3.Expand = false; + w3.Fill = false; + // Container child vbox1.Gtk.Box+BoxChild + this.hbox1 = new Gtk.HBox(); + this.hbox1.Name = "hbox1"; + // Container child hbox1.Gtk.Box+BoxChild + this.scrolledwindow1 = new Gtk.ScrolledWindow(); + this.scrolledwindow1.CanFocus = true; + this.scrolledwindow1.Name = "scrolledwindow1"; + this.scrolledwindow1.VscrollbarPolicy = ((Gtk.PolicyType)(1)); + this.scrolledwindow1.HscrollbarPolicy = ((Gtk.PolicyType)(1)); + // Container child scrolledwindow1.Gtk.Container+ContainerChild + Gtk.Viewport w4 = new Gtk.Viewport(); + w4.Name = "GtkViewport"; + w4.ShadowType = ((Gtk.ShadowType)(0)); + // Container child GtkViewport.Gtk.Container+ContainerChild + this.drawingarea1 = new Gtk.DrawingArea(); + this.drawingarea1.Name = "drawingarea1"; + w4.Add(this.drawingarea1); + this.scrolledwindow1.Add(w4); + this.hbox1.Add(this.scrolledwindow1); + Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox1[this.scrolledwindow1])); + w7.Position = 1; + // Container child hbox1.Gtk.Box+BoxChild + this.treeview1 = new Gtk.TreeView(); + this.treeview1.CanFocus = true; + this.treeview1.Name = "treeview1"; + this.hbox1.Add(this.treeview1); + Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox1[this.treeview1])); + w8.Position = 2; + this.vbox1.Add(this.hbox1); + Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox1])); + w9.Position = 1; + // Container child vbox1.Gtk.Box+BoxChild + this.statusbar1 = new Gtk.Statusbar(); + this.statusbar1.Name = "statusbar1"; + this.statusbar1.Spacing = 5; + this.vbox1.Add(this.statusbar1); + Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1])); + w10.PackType = ((Gtk.PackType)(1)); + w10.Position = 2; + w10.Expand = false; + w10.Fill = false; + this.Add(this.vbox1); + if ((this.Child != null)) { + this.Child.ShowAll(); + } + this.DefaultWidth = 800; + this.DefaultHeight = 800; + this.Show(); + this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent); + this.ConnectToGridserver.Activated += new System.EventHandler(this.ConnectToGridServerMenu); + this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu); + this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu); + this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu); + this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu); + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs new file mode 100644 index 0000000000..dd4abddae9 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs @@ -0,0 +1,35 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +namespace Stetic { + + + internal class Gui { + + private static bool initialized; + + internal static void Initialize() { + if ((Stetic.Gui.initialized == false)) { + Stetic.Gui.initialized = true; + } + } + } + + internal class ActionGroups { + + public static Gtk.ActionGroup GetActionGroup(System.Type type) { + return Stetic.ActionGroups.GetActionGroup(type.FullName); + } + + public static Gtk.ActionGroup GetActionGroup(string name) { + return null; + } + } +} diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic new file mode 100644 index 0000000000..c883f08b63 --- /dev/null +++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic @@ -0,0 +1,502 @@ + + + + + + Action + <Alt><Mod2>g + False + Grid + Grid + + + Action + False + User + User + + + Action + False + Asset + Asset + + + Action + Region + Region + + + Action + Services + Services + + + Action + False + Connect to gridserver... + Connect to gridserver + gtk-connect + + + + Action + Restart whole grid + Restart whole grid + gtk-refresh + + + Action + Shutdown whole grid + Shutdown whole grid + gtk-stop + + + Action + Exit grid manager + Exit grid manager + gtk-close + + + + Action + Connect to userserver + Connect to userserver + gtk-connect + + + Action + Account managment + Account managment + gtk-properties + + + Action + Global notice + Global notice + gtk-network + + + Action + Disable all logins + Disable all logins + gtk-no + + + Action + Disable non-god users only + Disable non-god users only + gtk-no + + + Action + Shutdown user server + Shutdown user server + gtk-stop + + + Action + Shutdown gridserver only + Shutdown gridserver only + gtk-stop + + + + Action + Restart gridserver only + Restart gridserver only + gtk-refresh + + + + Action + Default local grid userserver + Default local grid userserver + + + Action + Custom userserver... + Custom userserver + + + Action + Remote grid default userserver... + Remote grid default userserver + + + Action + Disconnect from grid server + Disconnect from grid server + gtk-disconnect + False + + + + Action + Upload asset + Upload asset + + + Action + Asset management + Asset management + + + Action + Connect to asset server + Connect to asset server + + + Action + Connect to default asset server for grid + Connect to default asset server for grid + + + Action + Default for local grid + Default for local grid + + + Action + Default for remote grid... + Default for remote grid... + + + Action + Custom asset server... + Custom asset server... + + + + 800 + 600 + Open Grid Services Manager + stock:gtk-network Dialog + + + + + + + + 25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + False + False + False + + + + + + + + + + + + True + Automatic + Automatic + + + + None + + + + + + + + + + 1 + True + + + + + + True + + + 2 + True + + + + + 1 + True + + + + + statusBar1 + 5 + + + + + + + + + End + 2 + False + False + False + + + + + + + + ButtonPressMask + Connect to Grid server + CenterOnParent + 2 + False + False + + + + + ButtonPressMask + 2 + + + + + + + + + + + + + + + + + + + 1 + Grid server URL: + Right + + + 0 + False + + + + + + True + http://gridserver:8001 + True + 255 + + + + 1 + False + + + + + + + + 0 + True + False + False + + + + + + + + + 1 + Username: + Right + + + 0 + False + + + + + + True + True + + + + 1 + True + + + + + + + + 1 + False + False + False + + + + + + + + + 1 + Password: + Right + + + 0 + False + + + + + + True + True + + + + 1 + True + + + + + + + + 2 + True + False + False + + + + + 2 + True + False + False + + + + + 0 + True + + + + + + + + ButtonPressMask + 6 + 5 + 2 + End + + + + True + True + TextAndIcon + stock:gtk-apply Menu + Connect + True + True + -5 + + + False + False + + + + + + True + True + TextAndIcon + stock:gtk-cancel Menu + Cancel + True + True + -6 + + + 1 + False + False + + + + + + \ No newline at end of file diff --git a/OpenGridServices/OpenGridServices.UserServer/Main.cs b/OpenGridServices/OpenGridServices.UserServer/Main.cs new file mode 100644 index 0000000000..bb20576f9f --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/Main.cs @@ -0,0 +1,216 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Reflection; +using System.IO; +using System.Text; +using libsecondlife; +using OpenSim.Framework.User; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Console; +using OpenSim.Servers; +using OpenSim.Framework.Utilities; +using OpenSim.GenericConfig; + +namespace OpenGridServices.UserServer +{ + /// + /// + public class OpenUser_Main : BaseServer, conscmd_callback + { + private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; + private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll"; + private UserConfig Cfg; + protected IGenericConfig localXMLConfig; + + public UserManager m_userManager; // Replaces below. + + //private UserProfileManager m_userProfileManager; // Depreciated + + public Dictionary UserSessions = new Dictionary(); + + ConsoleBase m_console; + + [STAThread] + public static void Main(string[] args) + { + Console.WriteLine("Starting...\n"); + + OpenUser_Main userserver = new OpenUser_Main(); + + userserver.Startup(); + userserver.Work(); + } + + private OpenUser_Main() + { + m_console = new ConsoleBase("opengrid-userserver-console.log", "OpenUser", this , false); + MainConsole.Instance = m_console; + } + + private void Work() + { + m_console.Notice("Enter help for a list of commands\n"); + + while (true) + { + m_console.MainConsolePrompt(); + } + } + + public void Startup() + { + this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); + this.localXMLConfig.LoadData(); + this.ConfigDB(this.localXMLConfig); + this.localXMLConfig.Close(); + + MainConsole.Instance.Verbose("Main.cs:Startup() - Loading configuration"); + Cfg = this.LoadConfigDll(this.ConfigDll); + Cfg.InitConfig(); + + MainConsole.Instance.Verbose( "Main.cs:Startup() - Establishing data connection"); + m_userManager = new UserManager(); + m_userManager._config = Cfg; + m_userManager.AddPlugin(StorageDll); + + MainConsole.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); + BaseHttpServer httpServer = new BaseHttpServer(8002); + + httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); + httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod); + + httpServer.Start(); + } + + + public void do_create(string what) + { + switch (what) + { + case "user": + string tempfirstname; + string templastname; + string tempMD5Passwd; + uint regX = 997; + uint regY = 996; + + tempfirstname = m_console.CmdPrompt("First name"); + templastname = m_console.CmdPrompt("Last name"); + tempMD5Passwd = m_console.PasswdPrompt("Password"); + regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); + regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); + + tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); + + m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); + break; + } + } + + public void RunCmd(string cmd, string[] cmdparams) + { + switch (cmd) + { + case "help": + m_console.Notice("create user - create a new user"); + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; + + case "create": + do_create(cmdparams[0]); + break; + + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } + + private void ConfigDB(IGenericConfig configData) + { + try + { + string attri = ""; + attri = configData.GetAttribute("DataBaseProvider"); + if (attri == "") + { + StorageDll = "OpenGrid.Framework.Data.DB4o.dll"; + configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); + } + else + { + StorageDll = attri; + } + configData.Commit(); + } + catch (Exception e) + { + + } + } + + private UserConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + UserConfig config = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IUserConfig", true); + + if (typeInterface != null) + { + IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + config = plug.GetConfigObject(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return config; + } + + public void Show(string ShowWhat) + { + } + } +} diff --git a/OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj b/OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj new file mode 100644 index 0000000000..f4fa8b6403 --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj @@ -0,0 +1,63 @@ + + + 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/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj new file mode 100644 index 0000000000..1bd07fb8c1 --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj @@ -0,0 +1,128 @@ + + + Local + 8.0.50727 + 2.0 + {66591469-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenGridServices.UserServer + JScript + Grid + IE50 + false + Exe + + OpenGridServices.UserServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Data.dll + False + + + System.Xml.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + OpenSim.Servers.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + XMLRPC.dll + False + + + + + OpenGrid.Framework.Data + {62CDF671-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build new file mode 100644 index 0000000000..5275ef4108 --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/OpenGridServices.UserServer/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.UserServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..5d5ce8d1cf --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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/OpenGridServices/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs new file mode 100644 index 0000000000..913d0fcf9f --- /dev/null +++ b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs @@ -0,0 +1,659 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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 OpenGrid.Framework.Data; +using libsecondlife; +using System.Reflection; + +using System.Xml; +using Nwc.XmlRpc; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; + +using System.Security.Cryptography; + +namespace OpenGridServices.UserServer +{ + public class UserManager + { + public OpenSim.Framework.Interfaces.UserConfig _config; + Dictionary _plugins = new Dictionary(); + + /// + /// Adds a new user server plugin - user servers will be requested in the order they were loaded. + /// + /// The filename to the user server plugin DLL + public void AddPlugin(string FileName) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Userstorage: Attempting to load " + FileName); + Assembly pluginAssembly = Assembly.LoadFrom(FileName); + + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IUserData", true); + + if (typeInterface != null) + { + IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Initialise(); + this._plugins.Add(plug.getName(), plug); + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Userstorage: Added IUserData Interface"); + } + + typeInterface = null; + } + } + + pluginAssembly = null; + } + + /// + /// + /// + /// + public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) + { + UserProfileData user = new UserProfileData(); + user.homeLocation = new LLVector3(128, 128, 100); + user.UUID = LLUUID.Random(); + user.username = firstName; + user.surname = lastName; + user.passwordHash = pass; + user.passwordSalt = ""; + user.created = Util.UnixTimeSinceEpoch(); + user.homeLookAt = new LLVector3(100, 100, 100); + user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); + + foreach (KeyValuePair plugin in _plugins) + { + try + { + plugin.Value.addNewUserProfile(user); + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + } + + /// + /// Loads a user profile from a database by UUID + /// + /// The target UUID + /// A user profile + public UserProfileData getUserProfile(LLUUID uuid) + { + foreach (KeyValuePair plugin in _plugins) + { + try + { + UserProfileData profile = plugin.Value.getUserByUUID(uuid); + profile.currentAgent = getUserAgent(profile.UUID); + return profile; + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + + return null; + } + + + /// + /// Loads a user profile by name + /// + /// The target name + /// A user profile + public UserProfileData getUserProfile(string name) + { + foreach (KeyValuePair plugin in _plugins) + { + try + { + UserProfileData profile = plugin.Value.getUserByName(name); + profile.currentAgent = getUserAgent(profile.UUID); + return profile; + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + + return null; + } + + /// + /// Loads a user profile by name + /// + /// First name + /// Last name + /// A user profile + public UserProfileData getUserProfile(string fname, string lname) + { + foreach (KeyValuePair plugin in _plugins) + { + try + { + UserProfileData profile = plugin.Value.getUserByName(fname,lname); + try + { + profile.currentAgent = getUserAgent(profile.UUID); + } + catch (Exception e) + { + // Ignore + } + return profile; + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + + return null; + } + + /// + /// Loads a user agent by uuid (not called directly) + /// + /// The agents UUID + /// Agent profiles + public UserAgentData getUserAgent(LLUUID uuid) + { + foreach (KeyValuePair plugin in _plugins) + { + try + { + return plugin.Value.getAgentByUUID(uuid); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + + return null; + } + + /// + /// Loads a user agent by name (not called directly) + /// + /// The agents name + /// A user agent + public UserAgentData getUserAgent(string name) + { + foreach (KeyValuePair plugin in _plugins) + { + try + { + return plugin.Value.getAgentByName(name); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + + return null; + } + + /// + /// Loads a user agent by name (not called directly) + /// + /// The agents firstname + /// The agents lastname + /// A user agent + public UserAgentData getUserAgent(string fname, string lname) + { + foreach (KeyValuePair plugin in _plugins) + { + try + { + return plugin.Value.getAgentByName(fname,lname); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + + return null; + } + + /// + /// Creates a error response caused by invalid XML + /// + /// An XMLRPC response + private static XmlRpcResponse CreateErrorConnectingToGridResponse() + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable ErrorRespData = new Hashtable(); + ErrorRespData["reason"] = "key"; + ErrorRespData["message"] = "Error connecting to grid. Could not percieve credentials from login XML."; + ErrorRespData["login"] = "false"; + response.Value = ErrorRespData; + return response; + } + + /// + /// Creates an error response caused by bad login credentials + /// + /// An XMLRPC response + private static XmlRpcResponse CreateLoginErrorResponse() + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable ErrorRespData = new Hashtable(); + ErrorRespData["reason"] = "key"; + ErrorRespData["message"] = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist."; + ErrorRespData["login"] = "false"; + response.Value = ErrorRespData; + return response; + } + + /// + /// Creates an error response caused by being logged in already + /// + /// An XMLRPC Response + private static XmlRpcResponse CreateAlreadyLoggedInResponse() + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable PresenceErrorRespData = new Hashtable(); + PresenceErrorRespData["reason"] = "presence"; + PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner"; + PresenceErrorRespData["login"] = "false"; + response.Value = PresenceErrorRespData; + return response; + } + + /// + /// Creates an error response caused by target region being down + /// + /// An XMLRPC Response + private static XmlRpcResponse CreateDeadRegionResponse() + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable PresenceErrorRespData = new Hashtable(); + PresenceErrorRespData["reason"] = "key"; + PresenceErrorRespData["message"] = "The region you are attempting to log into is not responding. Please select another region and try again."; + PresenceErrorRespData["login"] = "false"; + response.Value = PresenceErrorRespData; + return response; + } + + /// + /// Customises the login response and fills in missing values. + /// + /// The existing response + /// The user profile + public virtual void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser) + { + // Load information from the gridserver + SimProfile SimInfo = new SimProfile(); + SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); + + // Customise the response + // Home Location + response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], " + + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; + + // Destination + response["sim_ip"] = SimInfo.sim_ip; + response["sim_port"] = (Int32)SimInfo.sim_port; + response["region_y"] = (Int32)SimInfo.RegionLocY * 256; + response["region_x"] = (Int32)SimInfo.RegionLocX * 256; + + // Notify the target of an incoming user + Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")"); + + // Prepare notification + Hashtable SimParams = new Hashtable(); + SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); + SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); + SimParams["firstname"] = theUser.username; + SimParams["lastname"] = theUser.surname; + SimParams["agent_id"] = theUser.UUID.ToString(); + SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response["circuit_code"]); + SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); + SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); + SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); + ArrayList SendParams = new ArrayList(); + SendParams.Add(SimParams); + + // Update agent with target sim + theUser.currentAgent.currentRegion = SimInfo.UUID; + theUser.currentAgent.currentHandle = SimInfo.regionhandle; + + // Send + XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); + XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); + } + + /// + /// Checks a user against it's password hash + /// + /// The users profile + /// The supplied password + /// Authenticated? + public bool AuthenticateUser(ref UserProfileData profile, string password) + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose( + "Authenticating " + profile.username + " " + profile.surname); + + password = password.Remove(0, 3); //remove $1$ + + string s = Util.Md5Hash(password + ":" + profile.passwordSalt); + + return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); + } + + /// + /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB + /// + /// The users profile + /// The users loginrequest + public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request) + { + Hashtable requestData = (Hashtable)request.Params[0]; + + UserAgentData agent = new UserAgentData(); + + // User connection + agent.agentIP = ""; + agent.agentOnline = true; + agent.agentPort = 0; + + // Generate sessions + RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); + byte[] randDataS = new byte[16]; + byte[] randDataSS = new byte[16]; + rand.GetBytes(randDataS); + rand.GetBytes(randDataSS); + + agent.secureSessionID = new LLUUID(randDataSS, 0); + agent.sessionID = new LLUUID(randDataS, 0); + + // Profile UUID + agent.UUID = profile.UUID; + + // Current position (from Home) + agent.currentHandle = profile.homeRegion; + agent.currentPos = profile.homeLocation; + + // If user specified additional start, use that + if (requestData.ContainsKey("start")) + { + string startLoc = ((string)requestData["start"]).Trim(); + if (!(startLoc == "last" || startLoc == "home")) + { + // Format: uri:Ahern&162&213&34 + try + { + string[] parts = startLoc.Remove(0, 4).Split('&'); + string region = parts[0]; + + //////////////////////////////////////////////////// + //SimProfile SimInfo = new SimProfile(); + //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); + } + catch (Exception e) + { + + } + } + } + + // What time did the user login? + agent.loginTime = Util.UnixTimeSinceEpoch(); + agent.logoutTime = 0; + + // Current location + agent.regionID = new LLUUID(); // Fill in later + agent.currentRegion = new LLUUID(); // Fill in later + + profile.currentAgent = agent; + } + + /// + /// Saves a target agent to the database + /// + /// The users profile + /// Successful? + public bool CommitAgent(ref UserProfileData profile) + { + // Saves the agent to database + return true; + } + + /// + /// Main user login function + /// + /// The XMLRPC request + /// The response to send + public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + + bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); + bool GoodLogin = false; + string firstname = ""; + string lastname = ""; + string passwd = ""; + + UserProfileData TheUser; + + if (GoodXML) + { + firstname = (string)requestData["first"]; + lastname = (string)requestData["last"]; + passwd = (string)requestData["passwd"]; + + TheUser = getUserProfile(firstname, lastname); + if (TheUser == null) + return CreateLoginErrorResponse(); + + GoodLogin = AuthenticateUser(ref TheUser, passwd); + } + else + { + return CreateErrorConnectingToGridResponse(); + } + + if (!GoodLogin) + { + return CreateLoginErrorResponse(); + } + else + { + // If we already have a session... + if (TheUser.currentAgent != null && TheUser.currentAgent.agentOnline) + { + // Reject the login + return CreateAlreadyLoggedInResponse(); + } + // Otherwise... + // Create a new agent session + CreateAgent(ref TheUser, request); + + try + { + Hashtable responseData = new Hashtable(); + + LLUUID AgentID = TheUser.UUID; + + // Global Texture Section + 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); + + // Login Flags Section + Hashtable LoginFlagsHash = new Hashtable(); + LoginFlagsHash["daylight_savings"] = "N"; + LoginFlagsHash["stipend_since_login"] = "N"; + LoginFlagsHash["gendered"] = "Y"; // Needs to be combined with below... + LoginFlagsHash["ever_logged_in"] = "Y"; // Should allow male/female av selection + ArrayList LoginFlags = new ArrayList(); + LoginFlags.Add(LoginFlagsHash); + + // UI Customisation Section + Hashtable uiconfig = new Hashtable(); + uiconfig["allow_first_life"] = "Y"; + ArrayList ui_config = new ArrayList(); + ui_config.Add(uiconfig); + + // Classified Categories Section + Hashtable ClassifiedCategoriesHash = new Hashtable(); + ClassifiedCategoriesHash["category_name"] = "Generic"; + ClassifiedCategoriesHash["category_id"] = (Int32)1; + ArrayList ClassifiedCategories = new ArrayList(); + ClassifiedCategories.Add(ClassifiedCategoriesHash); + + // Inventory Library Section + ArrayList AgentInventoryArray = new ArrayList(); + Hashtable TempHash; + + AgentInventory Library = new AgentInventory(); + Library.CreateRootFolder(AgentID, true); + + foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) + { + TempHash = new Hashtable(); + TempHash["name"] = InvFolder.FolderName; + TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); + TempHash["version"] = (Int32)InvFolder.Version; + TempHash["type_default"] = (Int32)InvFolder.DefaultType; + TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); + AgentInventoryArray.Add(TempHash); + } + + Hashtable InventoryRootHash = new Hashtable(); + InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); + ArrayList InventoryRoot = new ArrayList(); + InventoryRoot.Add(InventoryRootHash); + + Hashtable InitialOutfitHash = new Hashtable(); + InitialOutfitHash["folder_name"] = "Nightclub Female"; + InitialOutfitHash["gender"] = "female"; + ArrayList InitialOutfit = new ArrayList(); + InitialOutfit.Add(InitialOutfitHash); + + // Circuit Code + uint circode = (uint)(Util.RandomClass.Next()); + + // Generics + responseData["last_name"] = TheUser.surname; + responseData["ui-config"] = ui_config; + responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); + responseData["login-flags"] = LoginFlags; + responseData["global-textures"] = GlobalTextures; + responseData["classified_categories"] = ClassifiedCategories; + responseData["event_categories"] = new ArrayList(); + responseData["inventory-skeleton"] = AgentInventoryArray; + responseData["inventory-skel-lib"] = new ArrayList(); + responseData["inventory-root"] = InventoryRoot; + responseData["event_notifications"] = new ArrayList(); + responseData["gestures"] = new ArrayList(); + responseData["inventory-lib-owner"] = new ArrayList(); + responseData["initial-outfit"] = InitialOutfit; + responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + responseData["start_location"] = "last"; + responseData["home"] = "!!null temporary value {home}!!"; // Overwritten + responseData["message"] = _config.DefaultStartupMsg; + responseData["first_name"] = TheUser.username; + responseData["circuit_code"] = (Int32)circode; + responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port; + responseData["secure_session_id"] = TheUser.currentAgent.secureSessionID.ToStringHyphenated(); + responseData["look_at"] = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; + responseData["agent_id"] = AgentID.ToStringHyphenated(); + responseData["region_y"] = (Int32)0; // Overwritten + responseData["region_x"] = (Int32)0; // Overwritten + responseData["seed_capability"] = ""; + responseData["agent_access"] = "M"; + responseData["session_id"] = TheUser.currentAgent.sessionID.ToStringHyphenated(); + responseData["login"] = "true"; + + try + { + this.CustomiseResponse(ref responseData, ref TheUser); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return CreateDeadRegionResponse(); + } + + CommitAgent(ref TheUser); + + response.Value = responseData; + // TheUser.SendDataToSim(SimInfo); + return response; + + } + catch (Exception E) + { + Console.WriteLine(E.ToString()); + } + //} + } + return response; + + } + + /// + /// Deletes an active agent session + /// + /// The request + /// The path (eg /bork/narf/test) + /// Parameters sent + /// Success "OK" else error + public string RestDeleteUserSessionMethod(string request, string path, string param) + { + // TODO! Important! + + return "OK"; + } + + } +} diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs b/OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs new file mode 100644 index 0000000000..25e0211fc3 --- /dev/null +++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("UserConfig")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UserConfig")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs b/OpenGridServices/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs new file mode 100644 index 0000000000..fe0e7aa901 --- /dev/null +++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs @@ -0,0 +1,96 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Generic; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using Db4objects.Db4o; + +namespace OpenUser.Config.UserConfigDb4o +{ + public class Db4oConfigPlugin: IUserConfig + { + public UserConfig GetConfigObject() + { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Loading Db40Config dll"); + return ( new DbUserConfig()); + } + } + + public class DbUserConfig : UserConfig + { + private IObjectContainer db; + + public void LoadDefaults() { + OpenSim.Framework.Console.MainConsole.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); + + this.DefaultStartupMsg = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); + + this.GridServerURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); + this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null"); + this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null"); + } + + public override void InitConfig() { + try { + db = Db4oFactory.OpenFile("openuser.yap"); + IObjectSet result = db.Get(typeof(DbUserConfig)); + if(result.Count==1) { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); + foreach (DbUserConfig cfg in result) { + this.GridServerURL=cfg.GridServerURL; + this.GridSendKey=cfg.GridSendKey; + this.GridRecvKey=cfg.GridRecvKey; + this.DefaultStartupMsg=cfg.DefaultStartupMsg; + } + } else { + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); + LoadDefaults(); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Writing out default settings to local database"); + db.Set(this); + db.Close(); + } + } catch(Exception e) { + OpenSim.Framework.Console.MainConsole.Instance.Warn("Config.cs:InitConfig() - Exception occured"); + OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); + } + + OpenSim.Framework.Console.MainConsole.Instance.Verbose("User settings loaded:"); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Grid server URL: " + this.GridServerURL); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to send to grid: " + this.GridSendKey); + OpenSim.Framework.Console.MainConsole.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); + } + + + public void Shutdown() { + db.Close(); + } + } + +} diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj new file mode 100644 index 0000000000..722b8d4dee --- /dev/null +++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj @@ -0,0 +1,107 @@ + + + Local + 8.0.50727 + 2.0 + {7E494328-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenUser.Config.UserConfigDb4o + JScript + Grid + IE50 + false + Library + + OpenUser.Config.UserConfigDb4o + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + ..\..\..\bin\System.Data.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\libsecondlife.dll + False + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + OpenSim.Framework.dll + False + + + OpenSim.Framework.Console.dll + False + + + + + + + Code + + + Code + + + + + + + + + + diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build new file mode 100644 index 0000000000..2833bce93a --- /dev/null +++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices/ServiceManager/ServiceManager.cs b/OpenGridServices/ServiceManager/ServiceManager.cs new file mode 100644 index 0000000000..8cb9c80e51 --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.cs @@ -0,0 +1,259 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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 OpenSim Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Diagnostics; +using System.Threading; +using System.ServiceProcess; +using System.Xml; +using System.IO; +using libsecondlife; +using OpenSim.GenericConfig; + +public class OpenGridMasterService : System.ServiceProcess.ServiceBase { + + private Thread ServiceWorkerThread; + private static string GridURL; // URL of grid server + private static string GridSimKey; // key sent from Grid>Sim + private static string SimGridKey; // key sent Sim>Grid + private static string AssetURL; // URL of asset server + private static string UserSendKey; // key sent from user>sim + private static string UserRecvKey; // key sent from sim>user + + public OpenGridMasterService() + { + CanPauseAndContinue = false; + ServiceName = "OpenGridServices-master"; + } + + private void InitializeComponent() + { + this.CanPauseAndContinue = false; + this.CanShutdown = true; + this.ServiceName = "OpenGridServices-master"; + } + + protected override void OnStart(string[] args) + { + ServiceWorkerThread = new Thread(new ThreadStart(MainServiceThread)); + ServiceWorkerThread.Start(); + } + + protected override void OnStop() + { + ServiceWorkerThread.Abort(); + } + + private void MainServiceThread() + { + try { + StreamReader reader=new StreamReader("opengrid-master-cfg.xml"); + + string configxml = reader.ReadToEnd(); + XmlDocument doc = new XmlDocument(); + doc.LoadXml(configxml); + XmlNode rootnode = doc.FirstChild; + if (rootnode.Name != "regions") + { + EventLog.WriteEntry("ERROR! bad XML in opengrid-master-cfg.xml - expected regions tag"); + Console.WriteLine("Sorry, could not startup the service - please check your opengrid-master-cfg.xml file: missing regions tag"); + (new ServiceController("OpenGridServices-master")).Stop(); + } + + for(int i=0; i<=rootnode.ChildNodes.Count; i++) + { + if(rootnode.ChildNodes.Item(i).Name != "region") { + EventLog.WriteEntry("nonfatal error - unexpected tag inside regions block of opengrid-master-cfg.xml"); + (new ServiceController("OpenGridServices-master")).Stop(); + } + } + } catch(Exception e) { + Console.WriteLine(e.ToString()); + (new ServiceController("OpenGridServices-master")).Stop(); + } + + } + + private static string SetupGrid() + { + Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server"); + try { + Process p = new Process(); + + p.StartInfo.Arguments = "-setuponly"; + p.StartInfo.FileName = "OpenGridServices.GridServer.exe"; + p.Start(); + + p.StartInfo.Arguments = "-dumpxmlconf"; + p.Start(); + + XmlConfig GridConf = new XmlConfig("opengrid-cfg.xml"); + GridConf.LoadData(); + GridURL="http://" + GridConf.GetAttribute("ListenAddr") + ":" + GridConf.GetAttribute("ListenPort") + "/"; + + StreamReader reader=new StreamReader("opengrid-cfg.xml"); + string configxml = reader.ReadToEnd(); + + return configxml; + } catch(Exception e) { + Console.WriteLine("An error occurred while running the grid server, please rectify it and try again"); + Console.WriteLine(e.ToString()); + Environment.Exit(1); + } + return ""; + } + + private static string SetupUser() + { + return ""; + } + + private static string SetupAsset() + { + return ""; + } + + private static string SetupRegion() + { + string regionname; + ulong regionlocx; + ulong regionlocy; + string default_terrain; + uint terrain_multiplier; + uint baseport; + + string listenaddr; + string simconfigxml; + LLUUID SimUUID; + + Console.WriteLine("Setting up region servers"); + Console.Write("Please specify a path to store your region data (e.g /etc/opensim/regions: "); + string regionpath=Console.ReadLine(); + + Console.Write("How many regions would you like to configure now? "); + int numofregions=Convert.ToInt16(Console.ReadLine()); + + Console.Write("What port should the region servers start listening at (first region is normally 9000, then 9001 the second etc, both TCP+UDP): "); + baseport=Convert.ToUInt16(Console.ReadLine()); + + + listenaddr=Console.ReadLine(); + + Console.WriteLine("Now ready to configure regions, please answer the questions about each region in turn"); + for(int i=0; i<=numofregions; i++) { + Console.WriteLine("Configuring region number " + i.ToString()); + + Console.Write("Region name: "); + regionname=Console.ReadLine(); + + Console.Write("Region location X: "); + regionlocx=(ulong)Convert.ToUInt32(Console.ReadLine()); + + Console.Write("Region location Y: "); + regionlocy=(ulong)Convert.ToUInt32(Console.ReadLine()); + + Console.Write("Default terrain file: "); + default_terrain=Console.ReadLine(); + terrain_multiplier=Convert.ToUInt16(Console.ReadLine()); + + SimUUID=LLUUID.Random(); + + simconfigxml=""; + + } + + return ""; + } + + public static void InitSetup() + { + string choice=""; + + string GridInfo; + string UserInfo; + string AssetInfo; + string RegionInfo; + + bool grid=false; + bool user=false; + bool asset=false; + bool region=false; + while(choice!="OK") + { + Console.Clear(); + Console.WriteLine("Please select the components you would like to run on this server:\n"); + + Console.WriteLine("1 - [" + (grid ? "X" : " ") + "] Grid server - this service handles co-ordinates of regions/sims on the grid"); + Console.WriteLine("2 - [" + (user ? "X" : " ") + "] User server - this service handles user login, profiles, inventory and IM"); + Console.WriteLine("3 - [" + (asset ? "X" : " ") + "] Asset server - this service handles storage of assets such as textures, objects, sounds, scripts"); + Console.WriteLine("4 - [" + (region ? "X" : " ") + "] Region server - this is the main opensim server and can run without the above services, it handles physics simulation, terrain, building and other such features"); + + + Console.Write("Type a number to toggle a choice or type OK to accept your current choices: "); + choice = Console.ReadLine(); + switch(choice) + { + case "1": + grid = (!grid); + break; + + case "2": + user = (!user); + break; + + case "3": + asset = (!asset); + break; + + case "4": + region = (!region); + break; + } + } + + if(grid) GridInfo = SetupGrid(); + if(user) UserInfo = SetupUser(); + if(asset) AssetInfo = SetupAsset(); + if(region) RegionInfo = SetupRegion(); + } + + public static void Main() + { + if(!File.Exists("opengrid-master-cfg.xml")) + { + Console.WriteLine("Could not find a config file, running initial setup"); + InitSetup(); + } + Console.WriteLine("Starting up OGS master service"); + try { + ServiceBase.Run(new OpenGridMasterService()); + } catch(Exception e) { + Console.WriteLine("An error occured while initialising OGS master service."); + Console.WriteLine(e.ToString()); + } + } +} diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj new file mode 100644 index 0000000000..0b896330f9 --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj @@ -0,0 +1,205 @@ +<<<<<<< .mine + + + Local + 8.0.50727 + 2.0 + {E141F4EE-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + ServiceManager + JScript + Grid + IE50 + false + Exe + + + ServiceManager + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + + System.dll + False + + + System.ServiceProcess.dll + False + + + System.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + + + + + Component + + + + + + + + + +======= + + + Local + 8.0.50727 + 2.0 + {E141F4EE-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + ServiceManager + JScript + Grid + IE50 + false + Exe + + ServiceManager + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.ServiceProcess.dll + False + + + System.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + ..\..\bin\OpenSim.Framework.dll + False + + + + + + + Code + + + + + + + + + + +>>>>>>> .r921 diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj.mine b/OpenGridServices/ServiceManager/ServiceManager.csproj.mine new file mode 100644 index 0000000000..f8a492589c --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj.mine @@ -0,0 +1,103 @@ + + + Local + 8.0.50727 + 2.0 + {E141F4EE-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + ServiceManager + JScript + Grid + IE50 + false + Exe + + + ServiceManager + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + + System.dll + False + + + System.ServiceProcess.dll + False + + + System.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + + + + + Component + + + + + + + + + + \ No newline at end of file diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj.r858 b/OpenGridServices/ServiceManager/ServiceManager.csproj.r858 new file mode 100644 index 0000000000..8d6a135b6e --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj.r858 @@ -0,0 +1,96 @@ + + + Local + 8.0.50727 + 2.0 + {7C8EA758-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + ServiceManager + JScript + Grid + IE50 + false + Exe + + ServiceManager + + + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ../../bin/ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ../../bin/ + False + False + False + 4 + + + + + System.dll + False + + + System.ServiceProcess.dll + False + + + System.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + + + + + Code + + + + + + + + + + diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj.r921 b/OpenGridServices/ServiceManager/ServiceManager.csproj.r921 new file mode 100644 index 0000000000..0e7ff5abe9 --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj.r921 @@ -0,0 +1,100 @@ + + + Local + 8.0.50727 + 2.0 + {E141F4EE-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + ServiceManager + JScript + Grid + IE50 + false + Exe + + ServiceManager + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.ServiceProcess.dll + False + + + System.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + OpenSim.GenericConfig.Xml.dll + False + + + ..\..\bin\OpenSim.Framework.dll + False + + + + + + + Code + + + + + + + + + + diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj.user b/OpenGridServices/ServiceManager/ServiceManager.csproj.user new file mode 100644 index 0000000000..1b6b14dcc3 --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenGridServices/ServiceManager/ServiceManager.exe.build b/OpenGridServices/ServiceManager/ServiceManager.exe.build new file mode 100644 index 0000000000..5e1dd72ade --- /dev/null +++ b/OpenGridServices/ServiceManager/ServiceManager.exe.build @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +