aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices-Source
diff options
context:
space:
mode:
authorMW2007-05-24 12:16:50 +0000
committerMW2007-05-24 12:16:50 +0000
commit3376b82501000692d6dac24b051af738cdaf2737 (patch)
tree90ed0a5d4955236f011fa63fce9d555186b0d179 /OpenGridServices-Source
parentAdded "terrain save grdmap <filename> <gradientmap>" function to console. Gra... (diff)
downloadopensim-SC-3376b82501000692d6dac24b051af738cdaf2737.zip
opensim-SC-3376b82501000692d6dac24b051af738cdaf2737.tar.gz
opensim-SC-3376b82501000692d6dac24b051af738cdaf2737.tar.bz2
opensim-SC-3376b82501000692d6dac24b051af738cdaf2737.tar.xz
Some more code refactoring, plus a restructuring of the directories so that the Grid servers can be a separate solution to the region server.
Diffstat (limited to 'OpenGridServices-Source')
-rw-r--r--OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs31
-rw-r--r--OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs112
-rw-r--r--OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj111
-rw-r--r--OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build46
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs83
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oManager.cs110
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs90
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj111
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build47
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs136
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs171
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj104
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build45
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs193
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLManager.cs269
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs136
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj111
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build47
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj108
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build46
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs136
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs172
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/GridData.cs83
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj104
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build46
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/SimProfileData.cs84
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/UserData.cs89
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data/UserProfileData.cs54
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Manager/GridManagementAgent.cs71
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs50
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj105
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build44
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/AssetHttpServer.cs92
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/Main.cs338
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj132
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build50
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj126
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build49
-rw-r--r--OpenGridServices-Source/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs474
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/Main.cs239
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj138
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build51
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.mds16
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.userprefs39
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.usertasks2
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs32
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs33
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs16
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs29
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs106
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs96
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs76
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp43
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidbbin0 -> 12308 bytes
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs37
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs133
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs226
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs256
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs35
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic502
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/Main.cs197
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/OGS-UserServer.csproj63
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj132
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build50
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenGridServices-Source/OpenGridServices.UserServer/UserManager.cs566
-rw-r--r--OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs31
-rw-r--r--OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs95
-rw-r--r--OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj111
-rw-r--r--OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build46
-rw-r--r--OpenGridServices-Source/SQL/mysql-agents.sql24
-rw-r--r--OpenGridServices-Source/SQL/mysql-regions.sql29
-rw-r--r--OpenGridServices-Source/SQL/mysql-users.sql34
-rw-r--r--OpenGridServices-Source/ServiceManager/ServiceManager.cs160
-rw-r--r--OpenGridServices-Source/ServiceManager/ServiceManager.csproj95
-rw-r--r--OpenGridServices-Source/ServiceManager/ServiceManager.csproj.user12
-rw-r--r--OpenGridServices-Source/ServiceManager/ServiceManager.exe.build41
95 files changed, 8603 insertions, 0 deletions
diff --git a/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..b5065bc
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("GridConfig")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("GridConfig")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
new file mode 100644
index 0000000..2d00ca6
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
@@ -0,0 +1,112 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using OpenSim.Framework.Console;
30using OpenSim.Framework.Interfaces;
31using Db4objects.Db4o;
32
33namespace OpenGrid.Config.GridConfigDb4o
34{
35 public class Db40ConfigPlugin: IGridConfig
36 {
37 public GridConfig GetConfigObject()
38 {
39 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Loading Db40Config dll");
40 return ( new DbGridConfig());
41 }
42 }
43
44 public class DbGridConfig : GridConfig
45 {
46 private IObjectContainer db;
47
48 public void LoadDefaults() {
49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
50
51 this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team");
52
53 this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/");
54 this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server","null");
55 this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server","null");
56
57 this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/");
58 this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server","null");
59 this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server","null");
60
61 this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims","null");
62 this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims","null");
63 }
64
65 public override void InitConfig() {
66 try {
67 db = Db4oFactory.OpenFile("opengrid.yap");
68 IObjectSet result = db.Get(typeof(DbGridConfig));
69 if(result.Count==1) {
70 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
71 foreach (DbGridConfig cfg in result) {
72 this.GridOwner=cfg.GridOwner;
73 this.DefaultAssetServer=cfg.DefaultAssetServer;
74 this.AssetSendKey=cfg.AssetSendKey;
75 this.AssetRecvKey=cfg.AssetRecvKey;
76 this.DefaultUserServer=cfg.DefaultUserServer;
77 this.UserSendKey=cfg.UserSendKey;
78 this.UserRecvKey=cfg.UserRecvKey;
79 this.SimSendKey=cfg.SimSendKey;
80 this.SimRecvKey=cfg.SimRecvKey;
81 }
82 } else {
83 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
84 LoadDefaults();
85 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Writing out default settings to local database");
86 db.Set(this);
87 db.Close();
88 }
89 } catch(Exception e) {
90 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Config.cs:InitConfig() - Exception occured");
91 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString());
92 }
93
94 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid settings loaded:");
95 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid owner: " + this.GridOwner);
96 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default asset server: " + this.DefaultAssetServer);
97 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to asset server: " + this.AssetSendKey);
98 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from asset server: " + this.AssetRecvKey);
99 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default user server: " + this.DefaultUserServer);
100 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to user server: " + this.UserSendKey);
101 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from user server: " + this.UserRecvKey);
102 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to sims: " + this.SimSendKey);
103 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from sims: " + this.SimRecvKey);
104 }
105
106
107 public void Shutdown() {
108 db.Close();
109 }
110 }
111
112}
diff --git a/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
new file mode 100644
index 0000000..00d987b
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
@@ -0,0 +1,111 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{B0027747-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Config.GridConfigDb4o</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Config.GridConfigDb4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data.dll" >
66 <HintPath>..\..\bin\System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 </ItemGroup>
96 <ItemGroup>
97 <Compile Include="AssemblyInfo.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="DbGridConfig.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 </ItemGroup>
104 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
105 <PropertyGroup>
106 <PreBuildEvent>
107 </PreBuildEvent>
108 <PostBuildEvent>
109 </PostBuildEvent>
110 </PropertyGroup>
111</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build
new file mode 100644
index 0000000..61d3efd
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Config.GridConfigDb4o" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Config.GridConfigDb4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="DbGridConfig.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="System.Data.dll.dll" />
24 <include name="System.Xml.dll" />
25 <include name="../../bin/libsecondlife.dll" />
26 <include name="../../bin/Db4objects.Db4o.dll" />
27 <include name="../../bin/OpenSim.Framework.dll" />
28 <include name="../../bin/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
new file mode 100644
index 0000000..546713e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
@@ -0,0 +1,83 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5using libsecondlife;
6
7
8namespace OpenGrid.Framework.Data.DB4o
9{
10 class DB4oGridData : IGridData
11 {
12 DB4oGridManager manager;
13
14 public void Initialise() {
15 manager = new DB4oGridManager("gridserver.yap");
16 }
17
18 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
19 {
20 return null;
21 }
22
23 public SimProfileData GetProfileByHandle(ulong handle) {
24 lock (manager.simProfiles)
25 {
26 foreach (LLUUID UUID in manager.simProfiles.Keys)
27 {
28 if (manager.simProfiles[UUID].regionHandle == handle)
29 {
30 return manager.simProfiles[UUID];
31 }
32 }
33 }
34 throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")");
35 }
36
37 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
38 {
39 lock (manager.simProfiles)
40 {
41 if (manager.simProfiles.ContainsKey(uuid))
42 return manager.simProfiles[uuid];
43 }
44 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")");
45 }
46
47 public DataResponse AddProfile(SimProfileData profile)
48 {
49 lock (manager.simProfiles)
50 {
51 if (manager.AddRow(profile))
52 {
53 return DataResponse.RESPONSE_OK;
54 }
55 else
56 {
57 return DataResponse.RESPONSE_ERROR;
58 }
59 }
60 }
61
62 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
63 if (manager.simProfiles[uuid].regionRecvKey == key)
64 return true;
65 return false;
66 }
67
68 public void Close()
69 {
70 manager = null;
71 }
72
73 public string getName()
74 {
75 return "DB4o Grid Provider";
76 }
77
78 public string getVersion()
79 {
80 return "0.1";
81 }
82 }
83}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
new file mode 100644
index 0000000..aaa6e91
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
@@ -0,0 +1,110 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Db4objects.Db4o;
5using OpenGrid.Framework.Data;
6using libsecondlife;
7
8namespace OpenGrid.Framework.Data.DB4o
9{
10 class DB4oGridManager
11 {
12 public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>();
13 string dbfl;
14
15 public DB4oGridManager(string db4odb)
16 {
17 dbfl = db4odb;
18 IObjectContainer database;
19 database = Db4oFactory.OpenFile(dbfl);
20 IObjectSet result = database.Get(typeof(SimProfileData));
21 foreach(SimProfileData row in result) {
22 simProfiles.Add(row.UUID, row);
23 }
24 database.Close();
25 }
26
27 /// <summary>
28 /// Adds a new profile to the database (Warning: Probably slow.)
29 /// </summary>
30 /// <param name="row">The profile to add</param>
31 /// <returns>Successful?</returns>
32 public bool AddRow(SimProfileData row)
33 {
34 if (simProfiles.ContainsKey(row.UUID))
35 {
36 simProfiles[row.UUID] = row;
37 }
38 else
39 {
40 simProfiles.Add(row.UUID, row);
41 }
42
43 try
44 {
45 IObjectContainer database;
46 database = Db4oFactory.OpenFile(dbfl);
47 database.Set(row);
48 database.Close();
49 return true;
50 }
51 catch (Exception e)
52 {
53 return false;
54 }
55 }
56
57
58 }
59
60 class DB4oUserManager
61 {
62 public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
63 string dbfl;
64
65 public DB4oUserManager(string db4odb)
66 {
67 dbfl = db4odb;
68 IObjectContainer database;
69 database = Db4oFactory.OpenFile(dbfl);
70 IObjectSet result = database.Get(typeof(UserProfileData));
71 foreach (UserProfileData row in result)
72 {
73 userProfiles.Add(row.UUID, row);
74 }
75 database.Close();
76 }
77
78 /// <summary>
79 /// Adds a new profile to the database (Warning: Probably slow.)
80 /// </summary>
81 /// <param name="row">The profile to add</param>
82 /// <returns>Successful?</returns>
83 public bool AddRow(UserProfileData row)
84 {
85 if (userProfiles.ContainsKey(row.UUID))
86 {
87 userProfiles[row.UUID] = row;
88 }
89 else
90 {
91 userProfiles.Add(row.UUID, row);
92 }
93
94 try
95 {
96 IObjectContainer database;
97 database = Db4oFactory.OpenFile(dbfl);
98 database.Set(row);
99 database.Close();
100 return true;
101 }
102 catch (Exception e)
103 {
104 return false;
105 }
106 }
107
108
109 }
110}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
new file mode 100644
index 0000000..7dd4c51
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
@@ -0,0 +1,90 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5using libsecondlife;
6
7namespace OpenGrid.Framework.Data.DB4o
8{
9 public class DB4oUserData : IUserData
10 {
11 DB4oUserManager manager;
12
13 public void Initialise()
14 {
15 manager = new DB4oUserManager("userprofiles.yap");
16 }
17
18 public UserProfileData getUserByUUID(LLUUID uuid)
19 {
20 if(manager.userProfiles.ContainsKey(uuid))
21 return manager.userProfiles[uuid];
22 return null;
23 }
24
25 public UserProfileData getUserByName(string name)
26 {
27 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
28 }
29
30 public UserProfileData getUserByName(string fname, string lname)
31 {
32 foreach (UserProfileData profile in manager.userProfiles.Values)
33 {
34 if (profile.username == fname && profile.surname == lname)
35 return profile;
36 }
37 return null;
38 }
39
40 public UserAgentData getAgentByUUID(LLUUID uuid)
41 {
42 try
43 {
44 return getUserByUUID(uuid).currentAgent;
45 }
46 catch (Exception e)
47 {
48 return null;
49 }
50 }
51
52 public UserAgentData getAgentByName(string name)
53 {
54 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
55 }
56
57 public UserAgentData getAgentByName(string fname, string lname)
58 {
59 try
60 {
61 return getUserByName(fname,lname).currentAgent;
62 }
63 catch (Exception e)
64 {
65 return null;
66 }
67 }
68
69 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
70 {
71 return true;
72 }
73
74 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
75 {
76 return true;
77 }
78
79
80 public string getName()
81 {
82 return "DB4o Userdata";
83 }
84
85 public string getVersion()
86 {
87 return "0.1";
88 }
89 }
90}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj
new file mode 100644
index 0000000..02abc3e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj
@@ -0,0 +1,111 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{39BD9497-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
84 <Name>OpenGrid.Framework.Data</Name>
85 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="DB4oGridData.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="DB4oManager.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="DB4oUserData.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="Properties\AssemblyInfo.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 </ItemGroup>
104 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
105 <PropertyGroup>
106 <PreBuildEvent>
107 </PreBuildEvent>
108 <PostBuildEvent>
109 </PostBuildEvent>
110 </PropertyGroup>
111</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build
new file mode 100644
index 0000000..144813b
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build
@@ -0,0 +1,47 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Data.DB4o" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Data.DB4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="DB4oGridData.cs" />
15 <include name="DB4oManager.cs" />
16 <include name="DB4oUserData.cs" />
17 <include name="Properties/AssemblyInfo.cs" />
18 </sources>
19 <references basedir="${project::get-base-directory()}">
20 <lib>
21 <include name="${project::get-base-directory()}" />
22 <include name="${project::get-base-directory()}/${build.dir}" />
23 </lib>
24 <include name="System.dll" />
25 <include name="System.Xml.dll" />
26 <include name="System.Data.dll" />
27 <include name="../bin/OpenGrid.Framework.Data.dll" />
28 <include name="../bin/libsecondlife.dll" />
29 <include name="../bin/Db4objects.Db4o.dll" />
30 </references>
31 </csc>
32 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
33 <mkdir dir="${project::get-base-directory()}/../bin/"/>
34 <copy todir="${project::get-base-directory()}/../bin/">
35 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
36 <include name="*.dll"/>
37 <include name="*.exe"/>
38 </fileset>
39 </copy>
40 </target>
41 <target name="clean">
42 <delete dir="${bin.dir}" failonerror="false" />
43 <delete dir="${obj.dir}" failonerror="false" />
44 </target>
45 <target name="doc" description="Creates documentation.">
46 </target>
47</project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dc4a9a1
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework.Data.DB4o")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenGrid.Framework.Data.DB4o")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
new file mode 100644
index 0000000..0925df1
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
@@ -0,0 +1,136 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5
6namespace OpenGrid.Framework.Data.MSSQL
7{
8 public class SqlGridData : IGridData
9 {
10 private MSSqlManager database;
11
12 /// <summary>
13 /// Initialises the Grid Interface
14 /// </summary>
15 public void Initialise()
16 {
17 database = new MSSqlManager("localhost", "db", "user", "password", "false");
18 }
19
20 /// <summary>
21 /// Shuts down the grid interface
22 /// </summary>
23 public void Close()
24 {
25 database.Close();
26 }
27
28 public string getName()
29 {
30 return "Sql OpenGridData";
31 }
32
33 public string getVersion()
34 {
35 return "0.1";
36 }
37
38 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
39 {
40 return null;
41 }
42
43 /// <summary>
44 /// Returns a sim profile from it's location
45 /// </summary>
46 /// <param name="handle">Region location handle</param>
47 /// <returns>Sim profile</returns>
48 public SimProfileData GetProfileByHandle(ulong handle)
49 {
50 Dictionary<string, string> param = new Dictionary<string, string>();
51 param["handle"] = handle.ToString();
52
53 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param);
54 System.Data.IDataReader reader = result.ExecuteReader();
55
56 SimProfileData row = database.getRow(reader);
57 reader.Close();
58 result.Dispose();
59
60 return row;
61 }
62
63 /// <summary>
64 /// Returns a sim profile from it's UUID
65 /// </summary>
66 /// <param name="uuid">The region UUID</param>
67 /// <returns>The sim profile</returns>
68 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
69 {
70 Dictionary<string, string> param = new Dictionary<string, string>();
71 param["uuid"] = uuid.ToStringHyphenated();
72
73 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
74 System.Data.IDataReader reader = result.ExecuteReader();
75
76 SimProfileData row = database.getRow(reader);
77 reader.Close();
78 result.Dispose();
79
80 return row;
81 }
82
83 public DataResponse AddProfile(SimProfileData profile)
84 {
85 if (database.insertRow(profile))
86 {
87 return DataResponse.RESPONSE_OK;
88 }
89 else
90 {
91 return DataResponse.RESPONSE_ERROR;
92 }
93 }
94
95 /// <summary>
96 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
97 /// </summary>
98 /// <param name="uuid">The UUID of the challenger</param>
99 /// <param name="handle">The attempted regionHandle of the challenger</param>
100 /// <param name="authkey">The secret</param>
101 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
102 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
103 {
104 bool throwHissyFit = false; // Should be true by 1.0
105
106 if (throwHissyFit)
107 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
108
109 SimProfileData data = GetProfileByLLUUID(uuid);
110
111 return (handle == data.regionHandle && authkey == data.regionSecret);
112 }
113
114 /// <summary>
115 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
116 /// </summary>
117 /// <remarks>This requires a security audit.</remarks>
118 /// <param name="uuid"></param>
119 /// <param name="handle"></param>
120 /// <param name="authhash"></param>
121 /// <param name="challenge"></param>
122 /// <returns></returns>
123 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
124 {
125 System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
126 System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
127
128 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
129 byte[] hash = HashProvider.ComputeHash(stream);
130
131 return false;
132 }
133 }
134
135
136}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
new file mode 100644
index 0000000..12c166c
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
@@ -0,0 +1,171 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Data;
5
6using System.Data.SqlClient;
7
8using OpenGrid.Framework.Data;
9
10namespace OpenGrid.Framework.Data.MSSQL
11{
12 class MSSqlManager
13 {
14 IDbConnection dbcon;
15
16 /// <summary>
17 /// Initialises and creates a new Sql connection and maintains it.
18 /// </summary>
19 /// <param name="hostname">The Sql server being connected to</param>
20 /// <param name="database">The name of the Sql database being used</param>
21 /// <param name="username">The username logging into the database</param>
22 /// <param name="password">The password for the user logging in</param>
23 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
24 public MSSqlManager(string hostname, string database, string username, string password, string cpooling)
25 {
26 try
27 {
28 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
29 dbcon = new SqlConnection(connectionString);
30
31 dbcon.Open();
32 }
33 catch (Exception e)
34 {
35 throw new Exception("Error initialising Sql Database: " + e.ToString());
36 }
37 }
38
39 /// <summary>
40 /// Shuts down the database connection
41 /// </summary>
42 public void Close()
43 {
44 dbcon.Close();
45 dbcon = null;
46 }
47
48 /// <summary>
49 /// Runs a query with protection against SQL Injection by using parameterised input.
50 /// </summary>
51 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
52 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
53 /// <returns>A Sql DB Command</returns>
54 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
55 {
56 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand();
57 dbcommand.CommandText = sql;
58 foreach (KeyValuePair<string, string> param in parameters)
59 {
60 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
61 }
62
63 return (IDbCommand)dbcommand;
64 }
65
66 public SimProfileData getRow(IDataReader reader)
67 {
68 SimProfileData retval = new SimProfileData();
69
70 if (reader.Read())
71 {
72 // Region Main
73 retval.regionHandle = (ulong)reader["regionHandle"];
74 retval.regionName = (string)reader["regionName"];
75 retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
76
77 // Secrets
78 retval.regionRecvKey = (string)reader["regionRecvKey"];
79 retval.regionSecret = (string)reader["regionSecret"];
80 retval.regionSendKey = (string)reader["regionSendKey"];
81
82 // Region Server
83 retval.regionDataURI = (string)reader["regionDataURI"];
84 retval.regionOnline = false; // Needs to be pinged before this can be set.
85 retval.serverIP = (string)reader["serverIP"];
86 retval.serverPort = (uint)reader["serverPort"];
87 retval.serverURI = (string)reader["serverURI"];
88
89 // Location
90 retval.regionLocX = (uint)((int)reader["locX"]);
91 retval.regionLocY = (uint)((int)reader["locY"]);
92 retval.regionLocZ = (uint)((int)reader["locZ"]);
93
94 // Neighbours - 0 = No Override
95 retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"];
96 retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"];
97 retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"];
98 retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"];
99
100 // Assets
101 retval.regionAssetURI = (string)reader["regionAssetURI"];
102 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
103 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
104
105 // Userserver
106 retval.regionUserURI = (string)reader["regionUserURI"];
107 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
108 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
109 }
110 else
111 {
112 throw new Exception("No rows to return");
113 }
114 return retval;
115 }
116
117 public bool insertRow(SimProfileData profile)
118 {
119 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
120 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
121 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
122
123 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
124 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
125 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
126
127 Dictionary<string, string> parameters = new Dictionary<string, string>();
128
129 parameters["regionHandle"] = profile.regionHandle.ToString();
130 parameters["regionName"] = profile.regionName;
131 parameters["uuid"] = profile.UUID.ToString();
132 parameters["regionRecvKey"] = profile.regionRecvKey;
133 parameters["regionSendKey"] = profile.regionSendKey;
134 parameters["regionDataURI"] = profile.regionDataURI;
135 parameters["serverIP"] = profile.serverIP;
136 parameters["serverPort"] = profile.serverPort.ToString();
137 parameters["serverURI"] = profile.serverURI;
138 parameters["locX"] = profile.regionLocX.ToString();
139 parameters["locY"] = profile.regionLocY.ToString();
140 parameters["locZ"] = profile.regionLocZ.ToString();
141 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
142 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
143 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
144 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
145 parameters["regionAssetURI"] = profile.regionAssetURI;
146 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
147 parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
148 parameters["regionUserURI"] = profile.regionUserURI;
149 parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
150 parameters["regionUserSendKey"] = profile.regionUserSendKey;
151
152 bool returnval = false;
153
154 try
155 {
156 IDbCommand result = Query(sql, parameters);
157
158 if (result.ExecuteNonQuery() == 1)
159 returnval = true;
160
161 result.Dispose();
162 }
163 catch (Exception e)
164 {
165 return false;
166 }
167
168 return returnval;
169 }
170 }
171}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj
new file mode 100644
index 0000000..efb6a32
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj
@@ -0,0 +1,104 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{0A563AC1-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.MSSQL</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.MSSQL</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 </ItemGroup>
78 <ItemGroup>
79 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
80 <Name>OpenGrid.Framework.Data</Name>
81 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private>
84 </ProjectReference>
85 </ItemGroup>
86 <ItemGroup>
87 <Compile Include="MSSQLGridData.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="MSSQLManager.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="Properties\AssemblyInfo.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 </ItemGroup>
97 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
98 <PropertyGroup>
99 <PreBuildEvent>
100 </PreBuildEvent>
101 <PostBuildEvent>
102 </PostBuildEvent>
103 </PropertyGroup>
104</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build
new file mode 100644
index 0000000..61b1826
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build
@@ -0,0 +1,45 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Data.MSSQL" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Data.MSSQL" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="MSSQLGridData.cs" />
15 <include name="MSSQLManager.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll" />
25 <include name="System.Data.dll" />
26 <include name="../bin/OpenGrid.Framework.Data.dll" />
27 <include name="../bin/libsecondlife.dll" />
28 </references>
29 </csc>
30 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
31 <mkdir dir="${project::get-base-directory()}/../bin/"/>
32 <copy todir="${project::get-base-directory()}/../bin/">
33 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
34 <include name="*.dll"/>
35 <include name="*.exe"/>
36 </fileset>
37 </copy>
38 </target>
39 <target name="clean">
40 <delete dir="${bin.dir}" failonerror="false" />
41 <delete dir="${obj.dir}" failonerror="false" />
42 </target>
43 <target name="doc" description="Creates documentation.">
44 </target>
45</project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bbe3cdf
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework.Data.MSSQL")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenGrid.Framework.Data.MSSQL")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
new file mode 100644
index 0000000..46183b4
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
@@ -0,0 +1,193 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5
6namespace OpenGrid.Framework.Data.MySQL
7{
8 public class MySQLGridData : IGridData
9 {
10 private MySQLManager database;
11
12 /// <summary>
13 /// Initialises the Grid Interface
14 /// </summary>
15 public void Initialise()
16 {
17 database = new MySQLManager("localhost", "database", "username", "password", "false");
18 }
19
20 /// <summary>
21 /// Shuts down the grid interface
22 /// </summary>
23 public void Close()
24 {
25 database.Close();
26 }
27
28 public string getName()
29 {
30 return "MySql OpenGridData";
31 }
32
33 public string getVersion()
34 {
35 return "0.1";
36 }
37
38 public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
39 {
40 try
41 {
42 lock (database)
43 {
44 Dictionary<string, string> param = new Dictionary<string, string>();
45 param["?xmin"] = xmin.ToString();
46 param["?ymin"] = ymin.ToString();
47 param["?xmax"] = xmax.ToString();
48 param["?ymax"] = ymax.ToString();
49
50 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
51 System.Data.IDataReader reader = result.ExecuteReader();
52
53 SimProfileData row;
54
55 List<SimProfileData> rows = new List<SimProfileData>();
56
57 while ((row = database.getSimRow(reader)) != null)
58 {
59 rows.Add(row);
60 }
61 reader.Close();
62 result.Dispose();
63
64 return rows.ToArray();
65
66 }
67 }
68 catch (Exception e)
69 {
70 Console.WriteLine(e.ToString());
71 return null;
72 }
73 }
74
75 /// <summary>
76 /// Returns a sim profile from it's location
77 /// </summary>
78 /// <param name="handle">Region location handle</param>
79 /// <returns>Sim profile</returns>
80 public SimProfileData GetProfileByHandle(ulong handle)
81 {
82 try
83 {
84 lock (database)
85 {
86 Dictionary<string, string> param = new Dictionary<string, string>();
87 param["?handle"] = handle.ToString();
88
89 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
90 System.Data.IDataReader reader = result.ExecuteReader();
91
92 SimProfileData row = database.getSimRow(reader);
93 reader.Close();
94 result.Dispose();
95
96 return row;
97 }
98 }
99 catch (Exception e)
100 {
101 Console.WriteLine(e.ToString());
102 return null;
103 }
104 }
105
106 /// <summary>
107 /// Returns a sim profile from it's UUID
108 /// </summary>
109 /// <param name="uuid">The region UUID</param>
110 /// <returns>The sim profile</returns>
111 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
112 {
113 try
114 {
115 lock (database)
116 {
117 Dictionary<string, string> param = new Dictionary<string, string>();
118 param["?uuid"] = uuid.ToStringHyphenated();
119
120 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
121 System.Data.IDataReader reader = result.ExecuteReader();
122
123 SimProfileData row = database.getSimRow(reader);
124 reader.Close();
125 result.Dispose();
126
127 return row;
128 }
129 }
130 catch (Exception e)
131 {
132 Console.WriteLine(e.ToString());
133 return null;
134 }
135 }
136
137 public DataResponse AddProfile(SimProfileData profile)
138 {
139 lock (database)
140 {
141 if (database.insertRow(profile))
142 {
143 return DataResponse.RESPONSE_OK;
144 }
145 else
146 {
147 return DataResponse.RESPONSE_ERROR;
148 }
149 }
150 }
151
152 /// <summary>
153 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
154 /// </summary>
155 /// <param name="uuid">The UUID of the challenger</param>
156 /// <param name="handle">The attempted regionHandle of the challenger</param>
157 /// <param name="authkey">The secret</param>
158 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
159 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
160 {
161 bool throwHissyFit = false; // Should be true by 1.0
162
163 if (throwHissyFit)
164 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
165
166 SimProfileData data = GetProfileByLLUUID(uuid);
167
168 return (handle == data.regionHandle && authkey == data.regionSecret);
169 }
170
171 /// <summary>
172 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
173 /// </summary>
174 /// <remarks>This requires a security audit.</remarks>
175 /// <param name="uuid"></param>
176 /// <param name="handle"></param>
177 /// <param name="authhash"></param>
178 /// <param name="challenge"></param>
179 /// <returns></returns>
180 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
181 {
182 System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
183 System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
184
185 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
186 byte[] hash = HashProvider.ComputeHash(stream);
187
188 return false;
189 }
190 }
191
192
193}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
new file mode 100644
index 0000000..a476e97
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -0,0 +1,269 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Data;
5
6// MySQL Native
7using MySql;
8using MySql.Data;
9using MySql.Data.Types;
10using MySql.Data.MySqlClient;
11
12using OpenGrid.Framework.Data;
13
14namespace OpenGrid.Framework.Data.MySQL
15{
16 class MySQLManager
17 {
18 IDbConnection dbcon;
19
20 /// <summary>
21 /// Initialises and creates a new MySQL connection and maintains it.
22 /// </summary>
23 /// <param name="hostname">The MySQL server being connected to</param>
24 /// <param name="database">The name of the MySQL database being used</param>
25 /// <param name="username">The username logging into the database</param>
26 /// <param name="password">The password for the user logging in</param>
27 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
28 public MySQLManager(string hostname, string database, string username, string password, string cpooling)
29 {
30 try
31 {
32 string connectionString = "Server=" + hostname + ";Port=13306;Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
33 dbcon = new MySqlConnection(connectionString);
34
35 dbcon.Open();
36 }
37 catch (Exception e)
38 {
39 throw new Exception("Error initialising MySql Database: " + e.ToString());
40 }
41 }
42
43 /// <summary>
44 /// Shuts down the database connection
45 /// </summary>
46 public void Close()
47 {
48 dbcon.Close();
49 dbcon = null;
50 }
51
52 /// <summary>
53 /// Runs a query with protection against SQL Injection by using parameterised input.
54 /// </summary>
55 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
56 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
57 /// <returns>A MySQL DB Command</returns>
58 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
59 {
60 try
61 {
62 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
63 dbcommand.CommandText = sql;
64 foreach (KeyValuePair<string, string> param in parameters)
65 {
66 dbcommand.Parameters.Add(param.Key, param.Value);
67 }
68
69 return (IDbCommand)dbcommand;
70 }
71 catch (Exception e)
72 {
73 Console.WriteLine("Failed during Query generation: " + e.ToString());
74 return null;
75 }
76 }
77
78 public SimProfileData getSimRow(IDataReader reader)
79 {
80 SimProfileData retval = new SimProfileData();
81
82 if (reader.Read())
83 {
84 // Region Main
85 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
86 retval.regionName = (string)reader["regionName"];
87 retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
88
89 // Secrets
90 retval.regionRecvKey = (string)reader["regionRecvKey"];
91 retval.regionSecret = (string)reader["regionSecret"];
92 retval.regionSendKey = (string)reader["regionSendKey"];
93
94 // Region Server
95 retval.regionDataURI = (string)reader["regionDataURI"];
96 retval.regionOnline = false; // Needs to be pinged before this can be set.
97 retval.serverIP = (string)reader["serverIP"];
98 retval.serverPort = (uint)reader["serverPort"];
99 retval.serverURI = (string)reader["serverURI"];
100
101 // Location
102 retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString());
103 retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString());
104 retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString());
105
106 // Neighbours - 0 = No Override
107 retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString());
108 retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString());
109 retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString());
110 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
111
112 // Assets
113 retval.regionAssetURI = (string)reader["regionAssetURI"];
114 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
115 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
116
117 // Userserver
118 retval.regionUserURI = (string)reader["regionUserURI"];
119 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
120 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
121
122 // World Map Addition
123 retval.regionMapTextureID = new libsecondlife.LLUUID((string)reader["regionMapTexture"]);
124 }
125 else
126 {
127 return null;
128 }
129 return retval;
130 }
131
132 public UserAgentData getAgentRow(IDataReader reader)
133 {
134 UserAgentData retval = new UserAgentData();
135
136 if (reader.Read())
137 {
138 // Agent IDs
139 retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
140 retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]);
141 retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]);
142
143 // Agent Who?
144 retval.agentIP = (string)reader["agentIP"];
145 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
146 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
147
148 // Login/Logout times (UNIX Epoch)
149 retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString());
150 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
151
152 // Current position
153 retval.currentRegion = (string)reader["currentRegion"];
154 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
155 libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
156 }
157 else
158 {
159 return null;
160 }
161 return retval;
162 }
163
164 public UserProfileData getUserRow(IDataReader reader)
165 {
166 UserProfileData retval = new UserProfileData();
167
168 if (reader.Read())
169 {
170 retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
171 retval.username = (string)reader["username"];
172 retval.surname = (string)reader["lastname"];
173
174 retval.passwordHash = (string)reader["passwordHash"];
175 retval.passwordSalt = (string)reader["passwordSalt"];
176
177 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
178 retval.homeLocation = new libsecondlife.LLVector3(
179 Convert.ToSingle(reader["homeLocationX"].ToString()),
180 Convert.ToSingle(reader["homeLocationY"].ToString()),
181 Convert.ToSingle(reader["homeLocationZ"].ToString()));
182 retval.homeLookAt = new libsecondlife.LLVector3(
183 Convert.ToSingle(reader["homeLookAtX"].ToString()),
184 Convert.ToSingle(reader["homeLookAtY"].ToString()),
185 Convert.ToSingle(reader["homeLookAtZ"].ToString()));
186
187 retval.created = Convert.ToInt32(reader["created"].ToString());
188 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
189
190 retval.userInventoryURI = (string)reader["userInventoryURI"];
191 retval.userAssetURI = (string)reader["userAssetURI"];
192
193 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
194 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
195
196 retval.profileAboutText = (string)reader["profileAboutText"];
197 retval.profileFirstText = (string)reader["profileFirstText"];
198
199 retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]);
200 retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]);
201
202 }
203 else
204 {
205 return null;
206 }
207 return retval;
208 }
209
210 public bool insertRow(SimProfileData profile)
211 {
212 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
213 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
214 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
215
216 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
217 sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
218 sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey);";
219
220 Dictionary<string, string> parameters = new Dictionary<string, string>();
221
222 parameters["?regionHandle"] = profile.regionHandle.ToString();
223 parameters["?regionName"] = profile.regionName.ToString();
224 parameters["?uuid"] = profile.UUID.ToStringHyphenated();
225 parameters["?regionRecvKey"] = profile.regionRecvKey.ToString();
226 parameters["?regionSecret"] = profile.regionSecret.ToString();
227 parameters["?regionSendKey"] = profile.regionSendKey.ToString();
228 parameters["?regionDataURI"] = profile.regionDataURI.ToString();
229 parameters["?serverIP"] = profile.serverIP.ToString();
230 parameters["?serverPort"] = profile.serverPort.ToString();
231 parameters["?serverURI"] = profile.serverURI.ToString();
232 parameters["?locX"] = profile.regionLocX.ToString();
233 parameters["?locY"] = profile.regionLocY.ToString();
234 parameters["?locZ"] = profile.regionLocZ.ToString();
235 parameters["?eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
236 parameters["?westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
237 parameters["?northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
238 parameters["?southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
239 parameters["?regionAssetURI"] = profile.regionAssetURI.ToString();
240 parameters["?regionAssetRecvKey"] = profile.regionAssetRecvKey.ToString();
241 parameters["?regionAssetSendKey"] = profile.regionAssetSendKey.ToString();
242 parameters["?regionUserURI"] = profile.regionUserURI.ToString();
243 parameters["?regionUserRecvKey"] = profile.regionUserRecvKey.ToString();
244 parameters["?regionUserSendKey"] = profile.regionUserSendKey.ToString();
245
246 bool returnval = false;
247
248 try
249 {
250
251 IDbCommand result = Query(sql, parameters);
252
253 //Console.WriteLine(result.CommandText);
254
255 if (result.ExecuteNonQuery() == 1)
256 returnval = true;
257
258 result.Dispose();
259 }
260 catch (Exception e)
261 {
262 Console.WriteLine(e.ToString());
263 return false;
264 }
265
266 return returnval;
267 }
268 }
269}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
new file mode 100644
index 0000000..0741272
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
@@ -0,0 +1,136 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5using libsecondlife;
6
7namespace OpenGrid.Framework.Data.MySQL
8{
9 class MySQLUserData : IUserData
10 {
11 public MySQLManager database;
12
13 public void Initialise()
14 {
15 database = new MySQLManager("host", "database", "user", "password", "false");
16 }
17
18 public UserProfileData getUserByName(string name)
19 {
20 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
21 }
22
23 public UserProfileData getUserByName(string user, string last)
24 {
25 try
26 {
27 lock (database)
28 {
29 Dictionary<string, string> param = new Dictionary<string, string>();
30 param["?first"] = user;
31 param["?second"] = last;
32
33 System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
34 System.Data.IDataReader reader = result.ExecuteReader();
35
36 UserProfileData row = database.getUserRow(reader);
37
38 reader.Close();
39 result.Dispose();
40
41 return row;
42 }
43 }
44 catch (Exception e)
45 {
46 Console.WriteLine(e.ToString());
47 return null;
48 }
49 }
50
51 public UserProfileData getUserByUUID(LLUUID uuid)
52 {
53 try
54 {
55 lock (database)
56 {
57 Dictionary<string, string> param = new Dictionary<string, string>();
58 param["?uuid"] = uuid.ToStringHyphenated();
59
60 System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
61 System.Data.IDataReader reader = result.ExecuteReader();
62
63 UserProfileData row = database.getUserRow(reader);
64
65 reader.Close();
66 result.Dispose();
67
68 return row;
69 }
70 }
71 catch (Exception e)
72 {
73 Console.WriteLine(e.ToString());
74 return null;
75 }
76 }
77
78 public UserAgentData getAgentByName(string name)
79 {
80 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
81 }
82
83 public UserAgentData getAgentByName(string user, string last)
84 {
85 UserProfileData profile = getUserByName(user, last);
86 return getAgentByUUID(profile.UUID);
87 }
88
89 public UserAgentData getAgentByUUID(LLUUID uuid)
90 {
91 try
92 {
93 lock (database)
94 {
95 Dictionary<string, string> param = new Dictionary<string, string>();
96 param["?uuid"] = uuid.ToStringHyphenated();
97
98 System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
99 System.Data.IDataReader reader = result.ExecuteReader();
100
101 UserAgentData row = database.getAgentRow(reader);
102
103 reader.Close();
104 result.Dispose();
105
106 return row;
107 }
108 }
109 catch (Exception e)
110 {
111 Console.WriteLine(e.ToString());
112 return null;
113 }
114 }
115
116 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
117 {
118 return false;
119 }
120
121 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
122 {
123 return false;
124 }
125
126 public string getName()
127 {
128 return "MySQL Userdata Interface";
129 }
130
131 public string getVersion()
132 {
133 return "0.1";
134 }
135 }
136}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj
new file mode 100644
index 0000000..ae3d5c5
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj
@@ -0,0 +1,111 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="MySql.Data.dll" >
78 <HintPath>..\bin\MySql.Data.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
84 <Name>OpenGrid.Framework.Data</Name>
85 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="MySQLGridData.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="MySQLManager.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="MySQLUserData.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="Properties\AssemblyInfo.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 </ItemGroup>
104 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
105 <PropertyGroup>
106 <PreBuildEvent>
107 </PreBuildEvent>
108 <PostBuildEvent>
109 </PostBuildEvent>
110 </PropertyGroup>
111</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build
new file mode 100644
index 0000000..a390324
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build
@@ -0,0 +1,47 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Data.MySQL" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Data.MySQL" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="MySQLGridData.cs" />
15 <include name="MySQLManager.cs" />
16 <include name="MySQLUserData.cs" />
17 <include name="Properties/AssemblyInfo.cs" />
18 </sources>
19 <references basedir="${project::get-base-directory()}">
20 <lib>
21 <include name="${project::get-base-directory()}" />
22 <include name="${project::get-base-directory()}/${build.dir}" />
23 </lib>
24 <include name="System.dll" />
25 <include name="System.Xml.dll" />
26 <include name="System.Data.dll" />
27 <include name="../bin/OpenGrid.Framework.Data.dll" />
28 <include name="../bin/libsecondlife.dll" />
29 <include name="../bin/MySql.Data.dll" />
30 </references>
31 </csc>
32 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
33 <mkdir dir="${project::get-base-directory()}/../bin/"/>
34 <copy todir="${project::get-base-directory()}/../bin/">
35 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
36 <include name="*.dll"/>
37 <include name="*.exe"/>
38 </fileset>
39 </copy>
40 </target>
41 <target name="clean">
42 <delete dir="${bin.dir}" failonerror="false" />
43 <delete dir="${obj.dir}" failonerror="false" />
44 </target>
45 <target name="doc" description="Creates documentation.">
46 </target>
47</project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0bfd1d6
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework.Data.MySQL")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenGrid.Framework.Data.MySQL")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj
new file mode 100644
index 0000000..ef2ecaa
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj
@@ -0,0 +1,108 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{1E3F341A-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.SQLite</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.SQLite</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="System.Data.SQLite.dll" >
74 <HintPath>..\bin\System.Data.SQLite.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="libsecondlife.dll" >
78 <HintPath>..\bin\libsecondlife.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
84 <Name>OpenGrid.Framework.Data</Name>
85 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="SQLiteGridData.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="SQLiteManager.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="Properties\AssemblyInfo.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 </ItemGroup>
101 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
102 <PropertyGroup>
103 <PreBuildEvent>
104 </PreBuildEvent>
105 <PostBuildEvent>
106 </PostBuildEvent>
107 </PropertyGroup>
108</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build
new file mode 100644
index 0000000..d9a2369
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Data.SQLite" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Data.SQLite" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="SQLiteGridData.cs" />
15 <include name="SQLiteManager.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll" />
25 <include name="System.Data.dll" />
26 <include name="../bin/System.Data.SQLite.dll" />
27 <include name="../bin/OpenGrid.Framework.Data.dll" />
28 <include name="../bin/libsecondlife.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../bin/"/>
33 <copy todir="${project::get-base-directory()}/../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..57c4bae
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework.Data.SQLite")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenGrid.Framework.Data.SQLite")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs
new file mode 100644
index 0000000..4850f12
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs
@@ -0,0 +1,136 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5
6namespace OpenGrid.Framework.Data.SQLite
7{
8 public class SQLiteGridData : IGridData
9 {
10 private SQLiteManager database;
11
12 /// <summary>
13 /// Initialises the Grid Interface
14 /// </summary>
15 public void Initialise()
16 {
17 database = new SQLiteManager("localhost", "db", "user", "password", "false");
18 }
19
20 /// <summary>
21 /// Shuts down the grid interface
22 /// </summary>
23 public void Close()
24 {
25 database.Close();
26 }
27
28 public string getName()
29 {
30 return "SQLite OpenGridData";
31 }
32
33 public string getVersion()
34 {
35 return "0.1";
36 }
37
38 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
39 {
40 return null;
41 }
42
43 /// <summary>
44 /// Returns a sim profile from it's location
45 /// </summary>
46 /// <param name="handle">Region location handle</param>
47 /// <returns>Sim profile</returns>
48 public SimProfileData GetProfileByHandle(ulong handle)
49 {
50 Dictionary<string, string> param = new Dictionary<string, string>();
51 param["handle"] = handle.ToString();
52
53 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param);
54 System.Data.IDataReader reader = result.ExecuteReader();
55
56 SimProfileData row = database.getRow(reader);
57 reader.Close();
58 result.Dispose();
59
60 return row;
61 }
62
63 /// <summary>
64 /// Returns a sim profile from it's UUID
65 /// </summary>
66 /// <param name="uuid">The region UUID</param>
67 /// <returns>The sim profile</returns>
68 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
69 {
70 Dictionary<string, string> param = new Dictionary<string, string>();
71 param["uuid"] = uuid.ToStringHyphenated();
72
73 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
74 System.Data.IDataReader reader = result.ExecuteReader();
75
76 SimProfileData row = database.getRow(reader);
77 reader.Close();
78 result.Dispose();
79
80 return row;
81 }
82
83 public DataResponse AddProfile(SimProfileData profile)
84 {
85 if (database.insertRow(profile))
86 {
87 return DataResponse.RESPONSE_OK;
88 }
89 else
90 {
91 return DataResponse.RESPONSE_ERROR;
92 }
93 }
94
95 /// <summary>
96 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
97 /// </summary>
98 /// <param name="uuid">The UUID of the challenger</param>
99 /// <param name="handle">The attempted regionHandle of the challenger</param>
100 /// <param name="authkey">The secret</param>
101 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
102 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
103 {
104 bool throwHissyFit = false; // Should be true by 1.0
105
106 if (throwHissyFit)
107 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
108
109 SimProfileData data = GetProfileByLLUUID(uuid);
110
111 return (handle == data.regionHandle && authkey == data.regionSecret);
112 }
113
114 /// <summary>
115 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
116 /// </summary>
117 /// <remarks>This requires a security audit.</remarks>
118 /// <param name="uuid"></param>
119 /// <param name="handle"></param>
120 /// <param name="authhash"></param>
121 /// <param name="challenge"></param>
122 /// <returns></returns>
123 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
124 {
125 System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
126 System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
127
128 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
129 byte[] hash = HashProvider.ComputeHash(stream);
130
131 return false;
132 }
133 }
134
135
136}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs
new file mode 100644
index 0000000..408a582
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs
@@ -0,0 +1,172 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Data;
5
6using System.Data.SQLite;
7
8using OpenGrid.Framework.Data;
9
10namespace OpenGrid.Framework.Data.SQLite
11{
12 class SQLiteManager
13 {
14 IDbConnection dbcon;
15
16 /// <summary>
17 /// Initialises and creates a new SQLite connection and maintains it.
18 /// </summary>
19 /// <param name="hostname">The SQLite server being connected to</param>
20 /// <param name="database">The name of the SQLite database being used</param>
21 /// <param name="username">The username logging into the database</param>
22 /// <param name="password">The password for the user logging in</param>
23 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
24 public SQLiteManager(string hostname, string database, string username, string password, string cpooling)
25 {
26 try
27 {
28 string connectionString = "URI=file:GridServerSqlite.db;";
29 dbcon = new SQLiteConnection(connectionString);
30
31 dbcon.Open();
32 }
33 catch (Exception e)
34 {
35 throw new Exception("Error initialising SQLite Database: " + e.ToString());
36 }
37 }
38
39 /// <summary>
40 /// Shuts down the database connection
41 /// </summary>
42 public void Close()
43 {
44 dbcon.Close();
45 dbcon = null;
46 }
47
48 /// <summary>
49 /// Runs a query with protection against SQL Injection by using parameterised input.
50 /// </summary>
51 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
52 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
53 /// <returns>A SQLite DB Command</returns>
54 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
55 {
56 SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand();
57 dbcommand.CommandText = sql;
58 foreach (KeyValuePair<string, string> param in parameters)
59 {
60 SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value);
61 dbcommand.Parameters.Add(paramx);
62 }
63
64 return (IDbCommand)dbcommand;
65 }
66
67 public SimProfileData getRow(IDataReader reader)
68 {
69 SimProfileData retval = new SimProfileData();
70
71 if (reader.Read())
72 {
73 // Region Main
74 retval.regionHandle = (ulong)reader["regionHandle"];
75 retval.regionName = (string)reader["regionName"];
76 retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
77
78 // Secrets
79 retval.regionRecvKey = (string)reader["regionRecvKey"];
80 retval.regionSecret = (string)reader["regionSecret"];
81 retval.regionSendKey = (string)reader["regionSendKey"];
82
83 // Region Server
84 retval.regionDataURI = (string)reader["regionDataURI"];
85 retval.regionOnline = false; // Needs to be pinged before this can be set.
86 retval.serverIP = (string)reader["serverIP"];
87 retval.serverPort = (uint)reader["serverPort"];
88 retval.serverURI = (string)reader["serverURI"];
89
90 // Location
91 retval.regionLocX = (uint)((int)reader["locX"]);
92 retval.regionLocY = (uint)((int)reader["locY"]);
93 retval.regionLocZ = (uint)((int)reader["locZ"]);
94
95 // Neighbours - 0 = No Override
96 retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"];
97 retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"];
98 retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"];
99 retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"];
100
101 // Assets
102 retval.regionAssetURI = (string)reader["regionAssetURI"];
103 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
104 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
105
106 // Userserver
107 retval.regionUserURI = (string)reader["regionUserURI"];
108 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
109 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
110 }
111 else
112 {
113 throw new Exception("No rows to return");
114 }
115 return retval;
116 }
117
118 public bool insertRow(SimProfileData profile)
119 {
120 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
121 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
122 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
123
124 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
125 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
126 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
127
128 Dictionary<string, string> parameters = new Dictionary<string, string>();
129
130 parameters["regionHandle"] = profile.regionHandle.ToString();
131 parameters["regionName"] = profile.regionName;
132 parameters["uuid"] = profile.UUID.ToString();
133 parameters["regionRecvKey"] = profile.regionRecvKey;
134 parameters["regionSendKey"] = profile.regionSendKey;
135 parameters["regionDataURI"] = profile.regionDataURI;
136 parameters["serverIP"] = profile.serverIP;
137 parameters["serverPort"] = profile.serverPort.ToString();
138 parameters["serverURI"] = profile.serverURI;
139 parameters["locX"] = profile.regionLocX.ToString();
140 parameters["locY"] = profile.regionLocY.ToString();
141 parameters["locZ"] = profile.regionLocZ.ToString();
142 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
143 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
144 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
145 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
146 parameters["regionAssetURI"] = profile.regionAssetURI;
147 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
148 parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
149 parameters["regionUserURI"] = profile.regionUserURI;
150 parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
151 parameters["regionUserSendKey"] = profile.regionUserSendKey;
152
153 bool returnval = false;
154
155 try
156 {
157 IDbCommand result = Query(sql, parameters);
158
159 if (result.ExecuteNonQuery() == 1)
160 returnval = true;
161
162 result.Dispose();
163 }
164 catch (Exception e)
165 {
166 return false;
167 }
168
169 return returnval;
170 }
171 }
172}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/GridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data/GridData.cs
new file mode 100644
index 0000000..6dad37e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/GridData.cs
@@ -0,0 +1,83 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenGrid.Framework.Data
6{
7 public enum DataResponse
8 {
9 RESPONSE_OK,
10 RESPONSE_AUTHREQUIRED,
11 RESPONSE_INVALIDCREDENTIALS,
12 RESPONSE_ERROR
13 }
14
15 /// <summary>
16 /// A standard grid interface
17 /// </summary>
18 public interface IGridData
19 {
20 /// <summary>
21 /// Returns a sim profile from a regionHandle
22 /// </summary>
23 /// <param name="regionHandle">A 64bit Region Handle</param>
24 /// <returns>A simprofile</returns>
25 SimProfileData GetProfileByHandle(ulong regionHandle);
26
27 /// <summary>
28 /// Returns a sim profile from a UUID
29 /// </summary>
30 /// <param name="UUID">A 128bit UUID</param>
31 /// <returns>A sim profile</returns>
32 SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID);
33
34 /// <summary>
35 /// Returns all profiles within the specified range
36 /// </summary>
37 /// <param name="Xmin">Minimum sim coordinate (X)</param>
38 /// <param name="Ymin">Minimum sim coordinate (Y)</param>
39 /// <param name="Xmax">Maximum sim coordinate (X)</param>
40 /// <param name="Ymin">Maximum sim coordinate (Y)</param>
41 /// <returns>An array containing all the sim profiles in the specified range</returns>
42 SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
43
44 /// <summary>
45 /// Authenticates a sim by use of it's recv key.
46 /// WARNING: Insecure
47 /// </summary>
48 /// <param name="UUID">The UUID sent by the sim</param>
49 /// <param name="regionHandle">The regionhandle sent by the sim</param>
50 /// <param name="simrecvkey">The recieving key sent by the sim</param>
51 /// <returns>Whether the sim has been authenticated</returns>
52 bool AuthenticateSim(libsecondlife.LLUUID UUID, ulong regionHandle, string simrecvkey);
53
54 /// <summary>
55 /// Initialises the interface
56 /// </summary>
57 void Initialise();
58
59 /// <summary>
60 /// Closes the interface
61 /// </summary>
62 void Close();
63
64 /// <summary>
65 /// The plugin being loaded
66 /// </summary>
67 /// <returns>A string containing the plugin name</returns>
68 string getName();
69
70 /// <summary>
71 /// The plugins version
72 /// </summary>
73 /// <returns>A string containing the plugin version</returns>
74 string getVersion();
75
76 /// <summary>
77 /// Adds a new profile to the database
78 /// </summary>
79 /// <param name="profile">The profile to add</param>
80 /// <returns>RESPONSE_OK if successful, error if not.</returns>
81 DataResponse AddProfile(SimProfileData profile);
82 }
83}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj b/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj
new file mode 100644
index 0000000..201f7ba
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj
@@ -0,0 +1,104 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{62CDF671-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 </ItemGroup>
78 <ItemGroup>
79 </ItemGroup>
80 <ItemGroup>
81 <Compile Include="GridData.cs">
82 <SubType>Code</SubType>
83 </Compile>
84 <Compile Include="SimProfileData.cs">
85 <SubType>Code</SubType>
86 </Compile>
87 <Compile Include="UserData.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="UserProfileData.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="Properties\AssemblyInfo.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 </ItemGroup>
97 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
98 <PropertyGroup>
99 <PreBuildEvent>
100 </PreBuildEvent>
101 <PostBuildEvent>
102 </PostBuildEvent>
103 </PropertyGroup>
104</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build
new file mode 100644
index 0000000..a3fd771
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Data" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Data" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="GridData.cs" />
15 <include name="SimProfileData.cs" />
16 <include name="UserData.cs" />
17 <include name="UserProfileData.cs" />
18 <include name="Properties/AssemblyInfo.cs" />
19 </sources>
20 <references basedir="${project::get-base-directory()}">
21 <lib>
22 <include name="${project::get-base-directory()}" />
23 <include name="${project::get-base-directory()}/${build.dir}" />
24 </lib>
25 <include name="System.dll" />
26 <include name="System.Xml.dll" />
27 <include name="System.Data.dll" />
28 <include name="../bin/libsecondlife.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../bin/"/>
33 <copy todir="${project::get-base-directory()}/../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1446673
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework.Data")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenGrid.Framework.Data")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/SimProfileData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data/SimProfileData.cs
new file mode 100644
index 0000000..c66610e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/SimProfileData.cs
@@ -0,0 +1,84 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenGrid.Framework.Data
6{
7 public class SimProfileData
8 {
9 /// <summary>
10 /// The name of the region
11 /// </summary>
12 public string regionName = "";
13
14 /// <summary>
15 /// A 64-bit number combining map position into a (mostly) unique ID
16 /// </summary>
17 public ulong regionHandle;
18
19 /// <summary>
20 /// OGS/OpenSim Specific ID for a region
21 /// </summary>
22 public libsecondlife.LLUUID UUID;
23
24 /// <summary>
25 /// Coordinates of the region
26 /// </summary>
27 public uint regionLocX;
28 public uint regionLocY;
29 public uint regionLocZ; // Reserved (round-robin, layers, etc)
30
31 /// <summary>
32 /// Authentication secrets
33 /// </summary>
34 /// <remarks>Not very secure, needs improvement.</remarks>
35 public string regionSendKey = "";
36 public string regionRecvKey = "";
37 public string regionSecret = "";
38
39 /// <summary>
40 /// Whether the region is online
41 /// </summary>
42 public bool regionOnline;
43
44 /// <summary>
45 /// Information about the server that the region is currently hosted on
46 /// </summary>
47 public string serverIP = "";
48 public uint serverPort;
49 public string serverURI = "";
50
51 /// <summary>
52 /// Set of optional overrides. Can be used to create non-eulicidean spaces.
53 /// </summary>
54 public ulong regionNorthOverrideHandle;
55 public ulong regionSouthOverrideHandle;
56 public ulong regionEastOverrideHandle;
57 public ulong regionWestOverrideHandle;
58
59 /// <summary>
60 /// Optional: URI Location of the region database
61 /// </summary>
62 /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
63 public string regionDataURI = "";
64
65 /// <summary>
66 /// Region Asset Details
67 /// </summary>
68 public string regionAssetURI = "";
69 public string regionAssetSendKey = "";
70 public string regionAssetRecvKey = "";
71
72 /// <summary>
73 /// Region Userserver Details
74 /// </summary>
75 public string regionUserURI = "";
76 public string regionUserSendKey = "";
77 public string regionUserRecvKey = "";
78
79 /// <summary>
80 /// Region Map Texture Asset
81 /// </summary>
82 public libsecondlife.LLUUID regionMapTextureID = new libsecondlife.LLUUID("00000000-0000-0000-9999-000000000006");
83 }
84}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/UserData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data/UserData.cs
new file mode 100644
index 0000000..1b37957
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/UserData.cs
@@ -0,0 +1,89 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenGrid.Framework.Data
7{
8 public interface IUserData
9 {
10 /// <summary>
11 /// Returns a user profile from a database via their UUID
12 /// </summary>
13 /// <param name="user">The accounts UUID</param>
14 /// <returns>The user data profile</returns>
15 UserProfileData getUserByUUID(LLUUID user);
16
17 /// <summary>
18 /// Returns a users profile by searching their username
19 /// </summary>
20 /// <param name="name">The users username</param>
21 /// <returns>The user data profile</returns>
22 UserProfileData getUserByName(string name);
23
24 /// <summary>
25 /// Returns a users profile by searching their username parts
26 /// </summary>
27 /// <param name="fname">Account firstname</param>
28 /// <param name="lname">Account lastname</param>
29 /// <returns>The user data profile</returns>
30 UserProfileData getUserByName(string fname, string lname);
31
32 /// <summary>
33 /// Returns the current agent for a user searching by it's UUID
34 /// </summary>
35 /// <param name="user">The users UUID</param>
36 /// <returns>The current agent session</returns>
37 UserAgentData getAgentByUUID(LLUUID user);
38
39 /// <summary>
40 /// Returns the current session agent for a user searching by username
41 /// </summary>
42 /// <param name="name">The users account name</param>
43 /// <returns>The current agent session</returns>
44 UserAgentData getAgentByName(string name);
45
46 /// <summary>
47 /// Returns the current session agent for a user searching by username parts
48 /// </summary>
49 /// <param name="fname">The users first account name</param>
50 /// <param name="lname">The users account surname</param>
51 /// <returns>The current agent session</returns>
52 UserAgentData getAgentByName(string fname, string lname);
53
54 /// <summary>
55 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
56 /// </summary>
57 /// <param name="from">The account to transfer from</param>
58 /// <param name="to">The account to transfer to</param>
59 /// <param name="amount">The amount to transfer</param>
60 /// <returns>Successful?</returns>
61 bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount);
62
63 /// <summary>
64 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
65 /// </summary>
66 /// <param name="from">User to transfer from</param>
67 /// <param name="to">User to transfer to</param>
68 /// <param name="inventory">Specified inventory item</param>
69 /// <returns>Successful?</returns>
70 bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
71
72 /// <summary>
73 /// Returns the plugin version
74 /// </summary>
75 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
76 string getVersion();
77
78 /// <summary>
79 /// Returns the plugin name
80 /// </summary>
81 /// <returns>Plugin name, eg MySQL User Provider</returns>
82 string getName();
83
84 /// <summary>
85 /// Initialises the plugin (artificial constructor)
86 /// </summary>
87 void Initialise();
88 }
89}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data/UserProfileData.cs
new file mode 100644
index 0000000..3f42762
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data/UserProfileData.cs
@@ -0,0 +1,54 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenGrid.Framework.Data
7{
8 public class UserProfileData
9 {
10 public LLUUID UUID;
11 public string username; // The configurable part of the users username
12 public string surname; // The users surname (can be used to indicate user class - eg 'Test User' or 'Test Admin')
13
14 public string passwordHash; // Hash of the users password
15 public string passwordSalt; // Salt for the users password
16
17 public ulong homeRegion; // RegionHandle of home
18 public LLVector3 homeLocation; // Home Location inside the sim
19 public LLVector3 homeLookAt; // Coordinates where the user is looking
20
21
22 public int created; // UNIX Epoch Timestamp (User Creation)
23 public int lastLogin; // UNIX Epoch Timestamp (Last Login Time)
24
25 public string userInventoryURI; // URI to inventory server for this user
26 public string userAssetURI; // URI to asset server for this user
27
28 public uint profileCanDoMask; // Profile window "I can do" mask
29 public uint profileWantDoMask; // Profile window "I want to" mask
30
31 public string profileAboutText; // My about window text
32 public string profileFirstText; // First Life Text
33
34 public LLUUID profileImage; // My avatars profile image
35 public LLUUID profileFirstImage; // First-life image
36 public UserAgentData currentAgent; // The users last agent
37 }
38
39 public class UserAgentData
40 {
41 public LLUUID UUID; // Account ID
42 public string agentIP; // The IP of the agent
43 public uint agentPort; // The port of the agent
44 public bool agentOnline; // The online status of the agent
45 public LLUUID sessionID; // The session ID for the agent (used by client)
46 public LLUUID secureSessionID; // The secure session ID for the agent (used by client)
47 public LLUUID regionID; // The region ID the agent occupies
48 public int loginTime; // EPOCH based Timestamp
49 public int logoutTime; // Timestamp or 0 if N/A
50 public LLUUID currentRegion; // UUID of the users current region
51 public ulong currentHandle; // RegionHandle of the users current region
52 public LLVector3 currentPos; // Current position in the region
53 }
54}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Manager/GridManagementAgent.cs b/OpenGridServices-Source/OpenGrid.Framework.Manager/GridManagementAgent.cs
new file mode 100644
index 0000000..e43ce87
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Manager/GridManagementAgent.cs
@@ -0,0 +1,71 @@
1using Nwc.XmlRpc;
2using OpenSim.Framework;
3using OpenSim.Servers;
4using System.Collections;
5using System.Collections.Generic;
6using libsecondlife;
7
8namespace OpenGrid.Framework.Manager {
9
10 public delegate void GridManagerCallback(string param);
11
12 public class GridManagementAgent {
13
14 private GridManagerCallback thecallback;
15 private string sendkey;
16 private string recvkey;
17 private string component_type;
18
19 private static ArrayList Sessions;
20
21 public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
22 {
23 this.sendkey=sendkey;
24 this.recvkey=recvkey;
25 this.component_type=component_type;
26 this.thecallback=thecallback;
27 Sessions = new ArrayList();
28
29 app_httpd.AddXmlRPCHandler("manager_login",XmlRpcLoginMethod);
30
31 switch(component_type)
32 {
33 case "gridserver":
34 GridServerManager.sendkey=this.sendkey;
35 GridServerManager.recvkey=this.recvkey;
36 GridServerManager.thecallback=thecallback;
37 app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
38 break;
39 }
40 }
41
42 public static bool SessionExists(LLUUID sessionID)
43 {
44 return Sessions.Contains(sessionID);
45 }
46
47 public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
48 {
49 XmlRpcResponse response = new XmlRpcResponse();
50 Hashtable requestData = (Hashtable)request.Params[0];
51 Hashtable responseData = new Hashtable();
52
53 // TODO: Switch this over to using OpenGrid.Framework.Data
54 if( requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) {
55 response.IsFault=false;
56 LLUUID new_session=LLUUID.Random();
57 Sessions.Add(new_session);
58 responseData["session_id"]=new_session.ToString();
59 responseData["msg"]="Login OK";
60 } else {
61 response.IsFault=true;
62 responseData["error"]="Invalid username or password";
63 }
64
65 response.Value = responseData;
66 return response;
67
68 }
69
70 }
71}
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs
new file mode 100644
index 0000000..7ebf66a
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs
@@ -0,0 +1,50 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using Nwc.XmlRpc;
5using System.Threading;
6using libsecondlife;
7
8namespace OpenGrid.Framework.Manager {
9
10 public class GridServerManager
11 {
12 public static GridManagerCallback thecallback;
13
14 public static string sendkey;
15 public static string recvkey;
16
17 public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
18 {
19 XmlRpcResponse response = new XmlRpcResponse();
20 Hashtable requestData = (Hashtable)request.Params[0];
21 Hashtable responseData = new Hashtable();
22
23 if(requestData.ContainsKey("session_id")) {
24 if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) {
25 responseData["msg"]="Shutdown command accepted";
26 (new Thread(new ThreadStart(ZOMGServerIsNowTerminallyIll))).Start();
27 } else {
28 response.IsFault=true;
29 responseData["error"]="bad session ID";
30 }
31 } else {
32 response.IsFault=true;
33 responseData["error"]="no session ID";
34 }
35
36 response.Value = responseData;
37 return response;
38 }
39
40 // Brought to by late-night coding
41 public static void ZOMGServerIsNowTerminallyIll()
42 {
43 Console.WriteLine("ZOMG! THIS SERVER IS TERMINALLY ILL - WE GOT A SHUTDOWN REQUEST FROM A GRID MANAGER!!!!");
44 Console.WriteLine("We have 3 seconds to live...");
45 Thread.Sleep(3000);
46 thecallback("shutdown");
47 }
48 }
49}
50
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj b/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj
new file mode 100644
index 0000000..3122633
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj
@@ -0,0 +1,105 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{7924FD35-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Manager</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Manager</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="libsecondlife.dll" >
66 <HintPath>..\bin\libsecondlife.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 </ItemGroup>
70 <ItemGroup>
71 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
72 <Name>OpenSim.Framework</Name>
73 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
74 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
75 <Private>False</Private>
76 </ProjectReference>
77 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
78 <Name>OpenSim.Servers</Name>
79 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
80 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
81 <Private>False</Private>
82 </ProjectReference>
83 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
84 <Name>XMLRPC</Name>
85 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="GridManagementAgent.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="GridServerManager.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 </ItemGroup>
98 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
99 <PropertyGroup>
100 <PreBuildEvent>
101 </PreBuildEvent>
102 <PostBuildEvent>
103 </PostBuildEvent>
104 </PropertyGroup>
105</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build
new file mode 100644
index 0000000..daee3bf
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build
@@ -0,0 +1,44 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Manager" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Manager" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="GridManagementAgent.cs" />
15 <include name="GridServerManager.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="../bin/OpenSim.Framework.dll" />
24 <include name="../bin/OpenSim.Servers.dll" />
25 <include name="../bin/libsecondlife.dll" />
26 <include name="../bin/XMLRPC.dll" />
27 </references>
28 </csc>
29 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
30 <mkdir dir="${project::get-base-directory()}/../bin/"/>
31 <copy todir="${project::get-base-directory()}/../bin/">
32 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
33 <include name="*.dll"/>
34 <include name="*.exe"/>
35 </fileset>
36 </copy>
37 </target>
38 <target name="clean">
39 <delete dir="${bin.dir}" failonerror="false" />
40 <delete dir="${obj.dir}" failonerror="false" />
41 </target>
42 <target name="doc" description="Creates documentation.">
43 </target>
44</project>
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/AssetHttpServer.cs b/OpenGridServices-Source/OpenGridServices.AssetServer/AssetHttpServer.cs
new file mode 100644
index 0000000..8439e92
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/AssetHttpServer.cs
@@ -0,0 +1,92 @@
1using System;
2using System.Collections.Generic;
3using System.Net;
4using System.Text;
5using System.Text.RegularExpressions;
6using System.Threading;
7//using OpenSim.CAPS;
8using Nwc.XmlRpc;
9using System.Collections;
10using OpenSim.Framework.Console;
11using OpenSim.Servers;
12
13namespace OpenGridServices.AssetServer
14{
15 public class AssetHttpServer :BaseHttpServer
16 {
17 public AssetHttpServer(int port)
18 : base(port)
19 {
20 }
21
22 public override void HandleRequest(Object stateinfo)
23 {
24 try
25 {
26 HttpListenerContext context = (HttpListenerContext)stateinfo;
27
28 HttpListenerRequest request = context.Request;
29 HttpListenerResponse response = context.Response;
30
31 response.KeepAlive = false;
32 response.SendChunked = false;
33
34 System.IO.Stream body = request.InputStream;
35 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
36 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
37
38 string requestBody = reader.ReadToEnd();
39 body.Close();
40 reader.Close();
41
42 //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType);
43 //Console.WriteLine(requestBody);
44
45 string responseString = "";
46 switch (request.ContentType)
47 {
48 case "text/xml":
49 // must be XML-RPC, so pass to the XML-RPC parser
50
51 responseString = ParseXMLRPC(requestBody);
52 responseString = Regex.Replace(responseString, "utf-16", "utf-8");
53
54 response.AddHeader("Content-type", "text/xml");
55 break;
56
57 case "application/xml":
58 // probably LLSD we hope, otherwise it should be ignored by the parser
59 responseString = ParseLLSDXML(requestBody);
60 response.AddHeader("Content-type", "application/xml");
61 break;
62
63 case "application/x-www-form-urlencoded":
64 // a form data POST so send to the REST parser
65 responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
66 response.AddHeader("Content-type", "text/plain");
67 break;
68
69 case null:
70 // must be REST or invalid crap, so pass to the REST parser
71 responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
72 response.AddHeader("Content-type", "text/plain");
73 break;
74
75 }
76
77 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
78 byte[] buffer = Windows1252Encoding.GetBytes(responseString);
79 System.IO.Stream output = response.OutputStream;
80 response.SendChunked = false;
81 response.ContentLength64 = buffer.Length;
82 output.Write(buffer, 0, buffer.Length);
83 output.Close();
84 }
85 catch (Exception e)
86 {
87 Console.WriteLine(e.ToString());
88 }
89 }
90
91 }
92}
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/Main.cs b/OpenGridServices-Source/OpenGridServices.AssetServer/Main.cs
new file mode 100644
index 0000000..684d683
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/Main.cs
@@ -0,0 +1,338 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.IO;
32using System.Text;
33using System.Timers;
34using System.Net;
35using System.Reflection;
36using System.Threading;
37using libsecondlife;
38using OpenSim.Framework;
39using OpenSim.Framework.Sims;
40using OpenSim.Framework.Console;
41using OpenSim.Framework.Types;
42using OpenSim.Framework.Interfaces;
43using OpenSim.Framework.Utilities;
44using OpenSim.GridInterfaces.Local; // REFACTORING IS NEEDED!!!!!!!!!!!
45using OpenSim.Servers;
46using Db4objects.Db4o;
47using Db4objects.Db4o.Query;
48
49namespace OpenGridServices.AssetServer
50{
51 /// <summary>
52 /// </summary>
53 public class OpenAsset_Main : BaseServer, conscmd_callback
54 {
55 private IObjectContainer db;
56
57 public static OpenAsset_Main assetserver;
58
59 private ConsoleBase m_console;
60
61 [STAThread]
62 public static void Main(string[] args)
63 {
64 Console.WriteLine("Starting...\n");
65
66 assetserver = new OpenAsset_Main();
67 assetserver.Startup();
68
69 assetserver.Work();
70 }
71
72 private void Work()
73 {
74 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "\nEnter help for a list of commands\n");
75
76 while (true)
77 {
78 m_console.MainConsolePrompt();
79 }
80 }
81
82 private OpenAsset_Main()
83 {
84 m_console = new ConsoleBase("opengrid-AssetServer-console.log", "OpenGrid", this, false);
85 MainConsole.Instance = m_console;
86 }
87
88 public void Startup()
89 {
90 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Setting up asset DB");
91 setupDB();
92
93 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP process");
94 AssetHttpServer httpServer = new AssetHttpServer(8003);
95
96
97 httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);
98 httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod);
99
100 httpServer.Start();
101
102 }
103
104 public string assetPostMethod(string requestBody, string path, string param)
105 {
106 AssetBase asset = new AssetBase();
107 asset.Name = "";
108 asset.FullID = new LLUUID(param);
109 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
110 byte[] buffer = Windows1252Encoding.GetBytes(requestBody);
111 asset.Data = buffer;
112 AssetStorage store = new AssetStorage();
113 store.Data = asset.Data;
114 store.Name = asset.Name;
115 store.UUID = asset.FullID;
116 db.Set(store);
117 db.Commit();
118 return "";
119 }
120
121 public string assetGetMethod(string request, string path, string param)
122 {
123 Console.WriteLine("got a request " +param);
124 byte[] assetdata = getAssetData(new LLUUID(param), false);
125 if (assetdata != null)
126 {
127 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
128 string ret = Windows1252Encoding.GetString(assetdata);
129 //string ret = System.Text.Encoding.Unicode.GetString(assetdata);
130
131 return ret;
132
133 }
134 else
135 {
136 return "";
137 }
138
139 }
140
141 public byte[] getAssetData(LLUUID assetID, bool isTexture)
142 {
143 bool found = false;
144 AssetStorage foundAsset = null;
145
146 IObjectSet result = db.Get(new AssetStorage(assetID));
147 if (result.Count > 0)
148 {
149 foundAsset = (AssetStorage)result.Next();
150 found = true;
151 }
152
153 if (found)
154 {
155 return foundAsset.Data;
156 }
157 else
158 {
159 return null;
160 }
161 }
162
163 public void setupDB()
164 {
165 bool yapfile = System.IO.File.Exists("assets.yap");
166 try
167 {
168 db = Db4oFactory.OpenFile("assets.yap");
169 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:setupDB() - creation");
170 }
171 catch (Exception e)
172 {
173 db.Close();
174 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Main.cs:setupDB() - Exception occured");
175 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
176 }
177 if (!yapfile)
178 {
179 this.LoadDB();
180 }
181 }
182
183 public void LoadDB()
184 {
185 try
186 {
187
188 Console.WriteLine("setting up Asset database");
189
190 AssetBase Image = new AssetBase();
191 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
192 Image.Name = "Bricks";
193 this.LoadAsset(Image, true, "bricks.jp2");
194 AssetStorage store = new AssetStorage();
195 store.Data = Image.Data;
196 store.Name = Image.Name;
197 store.UUID = Image.FullID;
198 db.Set(store);
199 db.Commit();
200
201 Image = new AssetBase();
202 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
203 Image.Name = "Plywood";
204 this.LoadAsset(Image, true, "plywood.jp2");
205 store = new AssetStorage();
206 store.Data = Image.Data;
207 store.Name = Image.Name;
208 store.UUID = Image.FullID;
209 db.Set(store);
210 db.Commit();
211
212 Image = new AssetBase();
213 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
214 Image.Name = "Rocks";
215 this.LoadAsset(Image, true, "rocks.jp2");
216 store = new AssetStorage();
217 store.Data = Image.Data;
218 store.Name = Image.Name;
219 store.UUID = Image.FullID;
220 db.Set(store);
221 db.Commit();
222
223 Image = new AssetBase();
224 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
225 Image.Name = "Granite";
226 this.LoadAsset(Image, true, "granite.jp2");
227 store = new AssetStorage();
228 store.Data = Image.Data;
229 store.Name = Image.Name;
230 store.UUID = Image.FullID;
231 db.Set(store);
232 db.Commit();
233
234 Image = new AssetBase();
235 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
236 Image.Name = "Hardwood";
237 this.LoadAsset(Image, true, "hardwood.jp2");
238 store = new AssetStorage();
239 store.Data = Image.Data;
240 store.Name = Image.Name;
241 store.UUID = Image.FullID;
242 db.Set(store);
243 db.Commit();
244
245 Image = new AssetBase();
246 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
247 Image.Name = "Prim Base Texture";
248 this.LoadAsset(Image, true, "plywood.jp2");
249 store = new AssetStorage();
250 store.Data = Image.Data;
251 store.Name = Image.Name;
252 store.UUID = Image.FullID;
253 db.Set(store);
254 db.Commit();
255
256 Image = new AssetBase();
257 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
258 Image.Name = "Shape";
259 this.LoadAsset(Image, false, "base_shape.dat");
260 store = new AssetStorage();
261 store.Data = Image.Data;
262 store.Name = Image.Name;
263 store.UUID = Image.FullID;
264 db.Set(store);
265 db.Commit();
266 }
267 catch (Exception e)
268 {
269 Console.WriteLine(e.Message);
270 }
271 }
272
273 private void LoadAsset(AssetBase info, bool image, string filename)
274 {
275
276
277 string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
278 string fileName = Path.Combine(dataPath, filename);
279 FileInfo fInfo = new FileInfo(fileName);
280 long numBytes = fInfo.Length;
281 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
282 byte[] idata = new byte[numBytes];
283 BinaryReader br = new BinaryReader(fStream);
284 idata = br.ReadBytes((int)numBytes);
285 br.Close();
286 fStream.Close();
287 info.Data = idata;
288 //info.loaded=true;
289 }
290
291 /*private GridConfig LoadConfigDll(string dllName)
292 {
293 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
294 GridConfig config = null;
295
296 foreach (Type pluginType in pluginAssembly.GetTypes())
297 {
298 if (pluginType.IsPublic)
299 {
300 if (!pluginType.IsAbstract)
301 {
302 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
303
304 if (typeInterface != null)
305 {
306 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
307 config = plug.GetConfigObject();
308 break;
309 }
310
311 typeInterface = null;
312 }
313 }
314 }
315 pluginAssembly = null;
316 return config;
317 }*/
318
319 public void RunCmd(string cmd, string[] cmdparams)
320 {
321 switch (cmd)
322 {
323 case "help":
324 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - shutdown this asset server (USE CAUTION!)");
325 break;
326
327 case "shutdown":
328 m_console.Close();
329 Environment.Exit(0);
330 break;
331 }
332 }
333
334 public void Show(string ShowWhat)
335 {
336 }
337 }
338}
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj
new file mode 100644
index 0000000..d01a52e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj
@@ -0,0 +1,132 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{0021261B-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGridServices.AssetServer</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGridServices.AssetServer</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data" >
66 <HintPath>System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.GridInterfaces\Local\OpenSim.GridInterfaces.Local.csproj">
96 <Name>OpenSim.GridInterfaces.Local</Name>
97 <Project>{546099CD-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
102 <Name>OpenSim.Servers</Name>
103 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
108 <Name>XMLRPC</Name>
109 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private>
112 </ProjectReference>
113 </ItemGroup>
114 <ItemGroup>
115 <Compile Include="AssetHttpServer.cs">
116 <SubType>Code</SubType>
117 </Compile>
118 <Compile Include="Main.cs">
119 <SubType>Code</SubType>
120 </Compile>
121 <Compile Include="Properties\AssemblyInfo.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 </ItemGroup>
125 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
126 <PropertyGroup>
127 <PreBuildEvent>
128 </PreBuildEvent>
129 <PostBuildEvent>
130 </PostBuildEvent>
131 </PropertyGroup>
132</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build
new file mode 100644
index 0000000..cd76f22
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build
@@ -0,0 +1,50 @@
1<?xml version="1.0" ?>
2<project name="OpenGridServices.AssetServer" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenGridServices.AssetServer" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssetHttpServer.cs" />
15 <include name="Main.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Data.dll" />
25 <include name="System.Xml.dll" />
26 <include name="../bin/OpenSim.Framework.dll" />
27 <include name="../bin/OpenSim.Framework.Console.dll" />
28 <include name="../bin/OpenSim.GridInterfaces.Local.dll" />
29 <include name="../bin/OpenSim.Servers.dll" />
30 <include name="../bin/libsecondlife.dll" />
31 <include name="../bin/Db4objects.Db4o.dll" />
32 <include name="../bin/XMLRPC.dll" />
33 </references>
34 </csc>
35 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
36 <mkdir dir="${project::get-base-directory()}/../bin/"/>
37 <copy todir="${project::get-base-directory()}/../bin/">
38 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
39 <include name="*.dll"/>
40 <include name="*.exe"/>
41 </fileset>
42 </copy>
43 </target>
44 <target name="clean">
45 <delete dir="${bin.dir}" failonerror="false" />
46 <delete dir="${obj.dir}" failonerror="false" />
47 </target>
48 <target name="doc" description="Creates documentation.">
49 </target>
50</project>
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj
new file mode 100644
index 0000000..9b8cc87
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj
@@ -0,0 +1,126 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{21BFC8E2-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGridServices.GridServer</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGridServices.GridServer</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data" >
66 <HintPath>System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
96 <Name>OpenSim.Servers</Name>
97 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
102 <Name>XMLRPC</Name>
103 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 </ItemGroup>
108 <ItemGroup>
109 <Compile Include="Main.cs">
110 <SubType>Code</SubType>
111 </Compile>
112 <Compile Include="SimProfiles.cs">
113 <SubType>Code</SubType>
114 </Compile>
115 <Compile Include="Properties\AssemblyInfo.cs">
116 <SubType>Code</SubType>
117 </Compile>
118 </ItemGroup>
119 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
120 <PropertyGroup>
121 <PreBuildEvent>
122 </PreBuildEvent>
123 <PostBuildEvent>
124 </PostBuildEvent>
125 </PropertyGroup>
126</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build
new file mode 100644
index 0000000..6bef534
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build
@@ -0,0 +1,49 @@
1<?xml version="1.0" ?>
2<project name="OpenGridServices.GridServer" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Main.cs" />
15 <include name="SimProfiles.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Data.dll" />
25 <include name="System.Xml.dll" />
26 <include name="../bin/OpenSim.Framework.dll" />
27 <include name="../bin/OpenSim.Framework.Console.dll" />
28 <include name="../bin/OpenSim.Servers.dll" />
29 <include name="../bin/libsecondlife.dll" />
30 <include name="../bin/Db4objects.Db4o.dll" />
31 <include name="../bin/XMLRPC.dll" />
32 </references>
33 </csc>
34 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
35 <mkdir dir="${project::get-base-directory()}/../bin/"/>
36 <copy todir="${project::get-base-directory()}/../bin/">
37 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
38 <include name="*.dll"/>
39 <include name="*.exe"/>
40 </fileset>
41 </copy>
42 </target>
43 <target name="clean">
44 <delete dir="${bin.dir}" failonerror="false" />
45 <delete dir="${obj.dir}" failonerror="false" />
46 </target>
47 <target name="doc" description="Creates documentation.">
48 </target>
49</project>
diff --git a/OpenGridServices-Source/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7014284
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OGS-AssetServer")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OGS-AssetServer")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs
new file mode 100644
index 0000000..54e4bb7
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs
@@ -0,0 +1,474 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using System.Reflection;
6using OpenGrid.Framework.Data;
7using OpenSim.Framework.Utilities;
8using OpenSim.Framework.Console;
9using OpenSim.Framework.Sims;
10using libsecondlife;
11using Nwc.XmlRpc;
12using System.Xml;
13
14namespace OpenGridServices.GridServer
15{
16 class GridManager
17 {
18 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
19 public OpenSim.Framework.Interfaces.GridConfig config;
20
21 /// <summary>
22 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
23 /// </summary>
24 /// <param name="FileName">The filename to the grid server plugin DLL</param>
25 public void AddPlugin(string FileName)
26 {
27 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Storage: Attempting to load " + FileName);
28 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
29
30 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
31 foreach (Type pluginType in pluginAssembly.GetTypes())
32 {
33 if (!pluginType.IsAbstract)
34 {
35 Type typeInterface = pluginType.GetInterface("IGridData", true);
36
37 if (typeInterface != null)
38 {
39 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
40 plug.Initialise();
41 this._plugins.Add(plug.getName(), plug);
42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Storage: Added IGridData Interface");
43 }
44
45 typeInterface = null;
46 }
47 }
48
49 pluginAssembly = null;
50 }
51
52 /// <summary>
53 /// Returns a region by argument
54 /// </summary>
55 /// <param name="uuid">A UUID key of the region to return</param>
56 /// <returns>A SimProfileData for the region</returns>
57 public SimProfileData getRegion(libsecondlife.LLUUID uuid)
58 {
59 foreach(KeyValuePair<string,IGridData> kvp in _plugins) {
60 try
61 {
62 return kvp.Value.GetProfileByLLUUID(uuid);
63 }
64 catch (Exception e)
65 {
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Storage: Unable to find region " + uuid.ToStringHyphenated() + " via " + kvp.Key);
67 }
68 }
69 return null;
70 }
71
72 /// <summary>
73 /// Returns a region by argument
74 /// </summary>
75 /// <param name="uuid">A regionHandle of the region to return</param>
76 /// <returns>A SimProfileData for the region</returns>
77 public SimProfileData getRegion(ulong handle)
78 {
79 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
80 {
81 try
82 {
83 return kvp.Value.GetProfileByHandle(handle);
84 }
85 catch (Exception e)
86 {
87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
88 }
89 }
90 return null;
91 }
92
93 public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
94 {
95 Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>();
96
97 SimProfileData[] neighbours;
98
99 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
100 {
101 try
102 {
103 neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
104 foreach (SimProfileData neighbour in neighbours)
105 {
106 regions[neighbour.regionHandle] = neighbour;
107 }
108 }
109 catch (Exception e)
110 {
111 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Storage: Unable to query regionblock via " + kvp.Key);
112 }
113 }
114
115 return regions;
116 }
117
118 /// <summary>
119 /// Returns a XML String containing a list of the neighbouring regions
120 /// </summary>
121 /// <param name="reqhandle">The regionhandle for the center sim</param>
122 /// <returns>An XML string containing neighbour entities</returns>
123 public string GetXMLNeighbours(ulong reqhandle)
124 {
125 string response = "";
126 SimProfileData central_region = getRegion(reqhandle);
127 SimProfileData neighbour;
128 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
129 {
130 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null)
131 {
132 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256));
133 response += "<neighbour>";
134 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
135 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
136 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
137 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
138 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
139 response += "</neighbour>";
140
141 }
142 }
143 return response;
144 }
145
146 /// <summary>
147 /// Performed when a region connects to the grid server initially.
148 /// </summary>
149 /// <param name="request">The XMLRPC Request</param>
150 /// <returns>Startup parameters</returns>
151 public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request)
152 {
153 XmlRpcResponse response = new XmlRpcResponse();
154 Hashtable responseData = new Hashtable();
155 response.Value = responseData;
156
157 SimProfileData TheSim = null;
158 Hashtable requestData = (Hashtable)request.Params[0];
159
160 if (requestData.ContainsKey("UUID"))
161 {
162 TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
163 }
164 else if (requestData.ContainsKey("region_handle"))
165 {
166 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
167 }
168
169 if (TheSim == null)
170 {
171 responseData["error"] = "sim not found";
172 }
173 else
174 {
175
176 ArrayList SimNeighboursData = new ArrayList();
177
178 SimProfileData neighbour;
179 Hashtable NeighbourBlock;
180
181 bool fastMode = false; // Only compatible with MySQL right now
182
183 if (fastMode)
184 {
185 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
186
187 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
188 {
189 NeighbourBlock = new Hashtable();
190 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
191 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
192 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
193 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
194 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
195
196 if (aSim.Value.UUID != TheSim.UUID)
197 SimNeighboursData.Add(NeighbourBlock);
198 }
199 }
200 else
201 {
202 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
203 {
204 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
205 {
206 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
207
208 NeighbourBlock = new Hashtable();
209 NeighbourBlock["sim_ip"] = neighbour.serverIP;
210 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
211 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
212 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
213 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
214
215 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
216 }
217 }
218 }
219
220 responseData["UUID"] = TheSim.UUID.ToString();
221 responseData["region_locx"] = TheSim.regionLocX.ToString();
222 responseData["region_locy"] = TheSim.regionLocY.ToString();
223 responseData["regionname"] = TheSim.regionName;
224 responseData["estate_id"] = "1";
225 responseData["neighbours"] = SimNeighboursData;
226
227 responseData["sim_ip"] = TheSim.serverIP;
228 responseData["sim_port"] = TheSim.serverPort.ToString();
229 responseData["asset_url"] = TheSim.regionAssetURI;
230 responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
231 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
232 responseData["user_url"] = TheSim.regionUserURI;
233 responseData["user_sendkey"] = TheSim.regionUserSendKey;
234 responseData["user_recvkey"] = TheSim.regionUserRecvKey;
235 responseData["authkey"] = TheSim.regionSecret;
236
237 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
238 responseData["data_uri"] = TheSim.regionDataURI;
239 }
240
241 return response;
242 }
243
244 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
245 {
246 int xmin=980, ymin=980, xmax=1020, ymax=1020;
247
248 Hashtable requestData = (Hashtable)request.Params[0];
249 if (requestData.ContainsKey("xmin"))
250 {
251 xmin = (Int32)requestData["xmin"];
252 }
253 if (requestData.ContainsKey("ymin"))
254 {
255 ymin = (Int32)requestData["ymin"];
256 }
257 if (requestData.ContainsKey("xmax"))
258 {
259 xmax = (Int32)requestData["xmax"];
260 }
261 if (requestData.ContainsKey("ymax"))
262 {
263 ymax = (Int32)requestData["ymax"];
264 }
265
266 XmlRpcResponse response = new XmlRpcResponse();
267 Hashtable responseData = new Hashtable();
268 response.Value = responseData;
269 IList simProfileList = new ArrayList();
270
271 SimProfileData simProfile;
272 for (int x = xmin; x < xmax; x++)
273 {
274 for (int y = ymin; y < ymax; y++)
275 {
276 simProfile = getRegion(Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)));
277 if (simProfile != null)
278 {
279 Hashtable simProfileBlock = new Hashtable();
280 simProfileBlock["x"] = x;
281 simProfileBlock["y"] = y;
282 simProfileBlock["name"] = simProfile.regionName;
283 simProfileBlock["access"] = 0;
284 simProfileBlock["region-flags"] = 0;
285 simProfileBlock["water-height"] = 20;
286 simProfileBlock["agents"] = 1;
287 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString();
288
289 simProfileList.Add(simProfileBlock);
290 }
291 }
292 }
293
294 responseData["sim-profiles"] = simProfileList;
295
296 return response;
297 }
298
299
300
301 /// <summary>
302 /// Performs a REST Get Operation
303 /// </summary>
304 /// <param name="request"></param>
305 /// <param name="path"></param>
306 /// <param name="param"></param>
307 /// <returns></returns>
308 public string RestGetRegionMethod(string request, string path, string param)
309 {
310 return RestGetSimMethod("", "/sims/", param);
311 }
312
313 /// <summary>
314 /// Performs a REST Set Operation
315 /// </summary>
316 /// <param name="request"></param>
317 /// <param name="path"></param>
318 /// <param name="param"></param>
319 /// <returns></returns>
320 public string RestSetRegionMethod(string request, string path, string param)
321 {
322 return RestSetSimMethod("", "/sims/", param);
323 }
324
325 /// <summary>
326 /// Returns information about a sim via a REST Request
327 /// </summary>
328 /// <param name="request"></param>
329 /// <param name="path"></param>
330 /// <param name="param"></param>
331 /// <returns>Information about the sim in XML</returns>
332 public string RestGetSimMethod(string request, string path, string param)
333 {
334 string respstring = String.Empty;
335
336 SimProfileData TheSim;
337 LLUUID UUID = new LLUUID(param);
338 TheSim = getRegion(UUID);
339
340 if (!(TheSim == null))
341 {
342 respstring = "<Root>";
343 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
344 respstring += "<sim>";
345 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
346 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
347 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>";
348 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
349 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
350 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
351 respstring += "<estate_id>1</estate_id>";
352 respstring += "</sim>";
353 respstring += "</Root>";
354 }
355
356 return respstring;
357 }
358
359 /// <summary>
360 /// Creates or updates a sim via a REST Method Request
361 /// BROKEN with SQL Update
362 /// </summary>
363 /// <param name="request"></param>
364 /// <param name="path"></param>
365 /// <param name="param"></param>
366 /// <returns>"OK" or an error</returns>
367 public string RestSetSimMethod(string request, string path, string param)
368 {
369 Console.WriteLine("SimProfiles.cs:RestSetSimMethod() - processing request......");
370 SimProfileData TheSim;
371 TheSim = getRegion(new LLUUID(param));
372 if ((TheSim) == null)
373 {
374 TheSim = new SimProfileData();
375 LLUUID UUID = new LLUUID(param);
376 TheSim.UUID = UUID;
377 TheSim.regionRecvKey = config.SimRecvKey;
378 }
379
380 XmlDocument doc = new XmlDocument();
381 doc.LoadXml(request);
382 XmlNode rootnode = doc.FirstChild;
383 XmlNode authkeynode = rootnode.ChildNodes[0];
384 if (authkeynode.Name != "authkey")
385 {
386 return "ERROR! bad XML - expected authkey tag";
387 }
388
389 XmlNode simnode = rootnode.ChildNodes[1];
390 if (simnode.Name != "sim")
391 {
392 return "ERROR! bad XML - expected sim tag";
393 }
394
395 if (authkeynode.InnerText != TheSim.regionRecvKey)
396 {
397 return "ERROR! invalid key";
398 }
399
400 //TheSim.regionSendKey = Cfg;
401 TheSim.regionRecvKey = config.SimRecvKey;
402 TheSim.regionSendKey = config.SimSendKey;
403 TheSim.regionSecret = config.SimRecvKey;
404 TheSim.regionDataURI = "";
405 TheSim.regionAssetURI = config.DefaultAssetServer;
406 TheSim.regionAssetRecvKey = config.AssetRecvKey;
407 TheSim.regionAssetSendKey = config.AssetSendKey;
408 TheSim.regionUserURI = config.DefaultUserServer;
409 TheSim.regionUserSendKey = config.UserSendKey;
410 TheSim.regionUserRecvKey = config.UserRecvKey;
411
412
413 for (int i = 0; i < simnode.ChildNodes.Count; i++)
414 {
415 switch (simnode.ChildNodes[i].Name)
416 {
417 case "regionname":
418 TheSim.regionName = simnode.ChildNodes[i].InnerText;
419 break;
420
421 case "sim_ip":
422 TheSim.serverIP = simnode.ChildNodes[i].InnerText;
423 break;
424
425 case "sim_port":
426 TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
427 break;
428
429 case "region_locx":
430 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
431 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
432 break;
433
434 case "region_locy":
435 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
436 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
437 break;
438 }
439 }
440
441 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
442
443 bool requirePublic = false;
444
445 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
446 {
447 return "ERROR! Servers must register with public addresses.";
448 }
449
450 try
451 {
452 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Attempting to add a new region to the grid - " + _plugins.Count + " storage provider(s) registered.");
453 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
454 {
455 try
456 {
457 kvp.Value.AddProfile(TheSim);
458 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"New sim added to grid (" + TheSim.regionName + ")");
459 }
460 catch (Exception e)
461 {
462 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString());
463 }
464 }
465 return "OK";
466 }
467 catch (Exception e)
468 {
469 return "ERROR! Could not save to database! (" + e.ToString() + ")";
470 }
471 }
472
473 }
474}
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/Main.cs b/OpenGridServices-Source/OpenGridServices.GridServer/Main.cs
new file mode 100644
index 0000000..cad5fae
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.GridServer/Main.cs
@@ -0,0 +1,239 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.IO;
32using System.Text;
33using System.Timers;
34using System.Net;
35using System.Threading;
36using System.Reflection;
37using libsecondlife;
38using OpenGrid.Framework.Manager;
39using OpenSim.Framework;
40using OpenSim.Framework.Sims;
41using OpenSim.Framework.Console;
42using OpenSim.Framework.Interfaces;
43using OpenSim.Servers;
44
45namespace OpenGridServices.GridServer
46{
47 /// <summary>
48 /// </summary>
49 public class OpenGrid_Main : BaseServer, conscmd_callback
50 {
51 private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
52 private string GridDll = "OpenGrid.Framework.Data.MySQL.dll";
53 public GridConfig Cfg;
54
55 public static OpenGrid_Main thegrid;
56 public static bool setuponly;
57
58 //public LLUUID highestUUID;
59
60// private SimProfileManager m_simProfileManager;
61
62 private GridManager m_gridManager;
63
64 private ConsoleBase m_console;
65
66 [STAThread]
67 public static void Main(string[] args)
68 {
69 if (args.Length > 0)
70 {
71 if (args[0] == "-setuponly") setuponly = true;
72 }
73 Console.WriteLine("Starting...\n");
74
75 thegrid = new OpenGrid_Main();
76 thegrid.Startup();
77
78 thegrid.Work();
79 }
80
81 private void Work()
82 {
83 while (true)
84 {
85 Thread.Sleep(5000);
86 // should flush the DB etc here
87 }
88 }
89
90 private OpenGrid_Main()
91 {
92 m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
93 MainConsole.Instance = m_console;
94
95
96 }
97
98 public void managercallback(string cmd) {
99 switch(cmd) {
100 case "shutdown":
101 RunCmd("shutdown",new string[0]);
102 break;
103 }
104 }
105
106
107 public void Startup()
108 {
109 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration");
110 Cfg = this.LoadConfigDll(this.ConfigDll);
111 Cfg.InitConfig();
112 if(setuponly) Environment.Exit(0);
113
114 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Connecting to Storage Server");
115 m_gridManager = new GridManager();
116 m_gridManager.AddPlugin(GridDll); // Made of win
117 m_gridManager.config = Cfg;
118
119 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process");
120 BaseHttpServer httpServer = new BaseHttpServer(8001);
121 GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer,"gridserver",Cfg.SimSendKey,Cfg.SimRecvKey,managercallback);
122
123 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod);
124 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
125
126 httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
127 httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
128 httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
129 httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
130
131
132 // lbsa71 : This code snippet taken from old http server.
133 // I have no idea what this was supposed to do - looks like an infinite recursion to me.
134 // case "regions":
135 //// DIRTY HACK ALERT
136 //Console.WriteLine("/regions/ accessed");
137 //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1]));
138 //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod);
139 //break;
140
141 // lbsa71 : I guess these were never used?
142 //Listener.Prefixes.Add("http://+:8001/gods/");
143 //Listener.Prefixes.Add("http://+:8001/highestuuid/");
144 //Listener.Prefixes.Add("http://+:8001/uuidblocks/");
145
146 httpServer.Start();
147
148 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting sim status checker");
149
150 System.Timers.Timer simCheckTimer = new System.Timers.Timer( 300000 ); // 5 minutes
151 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
152 simCheckTimer.Enabled = true;
153 }
154
155 private GridConfig LoadConfigDll(string dllName)
156 {
157 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
158 GridConfig config = null;
159
160 foreach (Type pluginType in pluginAssembly.GetTypes())
161 {
162 if (pluginType.IsPublic)
163 {
164 if (!pluginType.IsAbstract)
165 {
166 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
167
168 if (typeInterface != null)
169 {
170 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
171 config = plug.GetConfigObject();
172 break;
173 }
174
175 typeInterface = null;
176 }
177 }
178 }
179 pluginAssembly = null;
180 return config;
181 }
182
183 public void CheckSims(object sender, ElapsedEventArgs e)
184 {
185 /*
186 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
187 {
188 string SimResponse = "";
189 try
190 {
191 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
192 CheckSim.Method = "GET";
193 CheckSim.ContentType = "text/plaintext";
194 CheckSim.ContentLength = 0;
195
196 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
197 stOut.Write("");
198 stOut.Close();
199
200 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
201 SimResponse = stIn.ReadToEnd();
202 stIn.Close();
203 }
204 catch
205 {
206 }
207
208 if (SimResponse == "OK")
209 {
210 m_simProfileManager.SimProfiles[sim.UUID].online = true;
211 }
212 else
213 {
214 m_simProfileManager.SimProfiles[sim.UUID].online = false;
215 }
216 }
217 */
218 }
219
220 public void RunCmd(string cmd, string[] cmdparams)
221 {
222 switch (cmd)
223 {
224 case "help":
225 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - shutdown the grid (USE CAUTION!)");
226 break;
227
228 case "shutdown":
229 m_console.Close();
230 Environment.Exit(0);
231 break;
232 }
233 }
234
235 public void Show(string ShowWhat)
236 {
237 }
238 }
239}
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj
new file mode 100644
index 0000000..5f3fc6f
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj
@@ -0,0 +1,138 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{21BFC8E2-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGridServices.GridServer</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGridServices.GridServer</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data" >
66 <HintPath>System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
96 <Name>OpenSim.Servers</Name>
97 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
102 <Name>OpenGrid.Framework.Data</Name>
103 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 <ProjectReference Include="..\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj">
108 <Name>OpenGrid.Framework.Manager</Name>
109 <Project>{7924FD35-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private>
112 </ProjectReference>
113 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
114 <Name>XMLRPC</Name>
115 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private>
118 </ProjectReference>
119 </ItemGroup>
120 <ItemGroup>
121 <Compile Include="GridManager.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 <Compile Include="Main.cs">
125 <SubType>Code</SubType>
126 </Compile>
127 <Compile Include="Properties\AssemblyInfo.cs">
128 <SubType>Code</SubType>
129 </Compile>
130 </ItemGroup>
131 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
132 <PropertyGroup>
133 <PreBuildEvent>
134 </PreBuildEvent>
135 <PostBuildEvent>
136 </PostBuildEvent>
137 </PropertyGroup>
138</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build
new file mode 100644
index 0000000..9ca4d4b
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build
@@ -0,0 +1,51 @@
1<?xml version="1.0" ?>
2<project name="OpenGridServices.GridServer" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="GridManager.cs" />
15 <include name="Main.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Data.dll" />
25 <include name="System.Xml.dll" />
26 <include name="../bin/OpenSim.Framework.dll" />
27 <include name="../bin/OpenSim.Framework.Console.dll" />
28 <include name="../bin/OpenSim.Servers.dll" />
29 <include name="../bin/OpenGrid.Framework.Data.dll" />
30 <include name="../bin/OpenGrid.Framework.Manager.dll" />
31 <include name="../bin/libsecondlife.dll" />
32 <include name="../bin/Db4objects.Db4o.dll" />
33 <include name="../bin/XMLRPC.dll" />
34 </references>
35 </csc>
36 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
37 <mkdir dir="${project::get-base-directory()}/../bin/"/>
38 <copy todir="${project::get-base-directory()}/../bin/">
39 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
40 <include name="*.dll"/>
41 <include name="*.exe"/>
42 </fileset>
43 </copy>
44 </target>
45 <target name="clean">
46 <delete dir="${bin.dir}" failonerror="false" />
47 <delete dir="${obj.dir}" failonerror="false" />
48 </target>
49 <target name="doc" description="Creates documentation.">
50 </target>
51</project>
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8471e6b
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OGS-GridServer")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OGS-GridServer")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.mds b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.mds
new file mode 100644
index 0000000..ed7bc24
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.mds
@@ -0,0 +1,16 @@
1<Combine name="OpenGridServices.Manager" fileversion="2.0" outputpath="../../mono-1.2.3.1/lib/monodevelop/bin" MakePkgConfig="False" MakeLibPC="True">
2 <Configurations active="Debug">
3 <Configuration name="Debug" ctype="CombineConfiguration">
4 <Entry build="True" name="OpenGridServices.Manager" configuration="Debug" />
5 </Configuration>
6 <Configuration name="Release" ctype="CombineConfiguration">
7 <Entry build="True" name="OpenGridServices.Manager" configuration="Release" />
8 </Configuration>
9 </Configurations>
10 <StartMode startupentry="OpenGridServices.Manager" single="True">
11 <Execute type="None" entry="OpenGridServices.Manager" />
12 </StartMode>
13 <Entries>
14 <Entry filename="./OpenGridServices.Manager/OpenGridServices.Manager.mdp" />
15 </Entries>
16</Combine> \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.userprefs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.userprefs
new file mode 100644
index 0000000..f221509
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.userprefs
@@ -0,0 +1,39 @@
1<?xml version="1.0"?>
2<UserCombinePreferences filename="/home/gareth/OpenGridServices.Manager/OpenGridServices.Manager.mds">
3 <Files>
4 <File filename="Welcome" />
5 <File filename="./OpenGridServices.Manager/MainWindow.cs" />
6 <File filename="./OpenGridServices.Manager/ConnectToGridServerDialog.cs" />
7 <File filename="./OpenGridServices.Manager/Main.cs" />
8 </Files>
9 <Views>
10 <ViewMemento Id="MonoDevelop.Ide.Gui.Pads.ProjectPad">
11 <TreeView>
12 <Node expanded="True">
13 <Node name="OpenGridServices.Manager" expanded="True">
14 <Node name="References" expanded="True" />
15 <Node name="Resources" expanded="True" />
16 <Node name="UserInterface" expanded="True" />
17 <Node name="ConnectToGridServerDialog.cs" expanded="False" selected="True" />
18 </Node>
19 </Node>
20 </TreeView>
21 </ViewMemento>
22 <ViewMemento Id="MonoDevelop.Ide.Gui.Pads.ClassPad">
23 <TreeView>
24 <Node expanded="True" />
25 </TreeView>
26 </ViewMemento>
27 <ViewMemento Id="MonoDevelop.NUnit.TestPad">
28 <TreeView>
29 <Node expanded="False" />
30 </TreeView>
31 </ViewMemento>
32 </Views>
33 <Properties>
34 <Properties>
35 <Property key="ActiveConfiguration" value="Debug" />
36 <Property key="ActiveWindow" value="/home/gareth/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs" />
37 </Properties>
38 </Properties>
39</UserCombinePreferences> \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.usertasks b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.usertasks
new file mode 100644
index 0000000..d887d0e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager.usertasks
@@ -0,0 +1,2 @@
1<?xml version="1.0" encoding="utf-8"?>
2<ArrayOfUserTask xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs
new file mode 100644
index 0000000..af4e275
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs
@@ -0,0 +1,32 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3
4// Information about this assembly is defined by the following
5// attributes.
6//
7// change them to the information which is associated with the assembly
8// you compile.
9
10[assembly: AssemblyTitle("")]
11[assembly: AssemblyDescription("")]
12[assembly: AssemblyConfiguration("")]
13[assembly: AssemblyCompany("")]
14[assembly: AssemblyProduct("")]
15[assembly: AssemblyCopyright("")]
16[assembly: AssemblyTrademark("")]
17[assembly: AssemblyCulture("")]
18
19// The assembly version has following format :
20//
21// Major.Minor.Build.Revision
22//
23// You can specify all values by your own or you can build default build and revision
24// numbers with the '*' character (the default):
25
26[assembly: AssemblyVersion("1.0.*")]
27
28// The following attributes specify the key for the sign of your assembly. See the
29// .NET Framework documentation for more information about signing.
30// This is not required, if you don't want signing let these attributes like they're.
31[assembly: AssemblyDelaySign(false)]
32[assembly: AssemblyKeyFile("")]
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
new file mode 100644
index 0000000..83685fc
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
@@ -0,0 +1,33 @@
1using System;
2using System.Threading;
3using System.Collections.Generic;
4using System.Text;
5
6namespace OpenGridServices.Manager
7{
8 public class BlockingQueue<T>
9 {
10 private Queue<T> _queue = new Queue<T>();
11 private object _queueSync = new object();
12
13 public void Enqueue(T value)
14 {
15 lock (_queueSync)
16 {
17 _queue.Enqueue(value);
18 Monitor.Pulse(_queueSync);
19 }
20 }
21
22 public T Dequeue()
23 {
24 lock (_queueSync)
25 {
26 if (_queue.Count < 1)
27 Monitor.Wait(_queueSync);
28
29 return _queue.Dequeue();
30 }
31 }
32 }
33}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs
new file mode 100644
index 0000000..0d509ef
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs
@@ -0,0 +1,16 @@
1
2using System;
3
4namespace OpenGridServices.Manager
5{
6
7
8 public partial class Connect to grid server : Gtk.Dialog
9 {
10
11 public Connect to grid server()
12 {
13 this.Build();
14 }
15 }
16}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs
new file mode 100644
index 0000000..8a80b1d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs
@@ -0,0 +1,29 @@
1using Gtk;
2using System;
3
4namespace OpenGridServices.Manager {
5 public partial class ConnectToGridServerDialog : Gtk.Dialog
6 {
7
8 public ConnectToGridServerDialog()
9 {
10 this.Build();
11 }
12
13 protected virtual void OnResponse(object o, Gtk.ResponseArgs args)
14 {
15 switch(args.ResponseId) {
16 case Gtk.ResponseType.Ok:
17 MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text);
18 break;
19
20 case Gtk.ResponseType.Cancel:
21 break;
22 }
23 this.Hide();
24
25 }
26
27 }
28
29} \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs
new file mode 100644
index 0000000..6b632d6
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs
@@ -0,0 +1,106 @@
1using Nwc.XmlRpc;
2using System;
3using System.Net;
4using System.IO;
5using System.Xml;
6using System.Collections;
7using System.Collections.Generic;
8using libsecondlife;
9
10namespace OpenGridServices.Manager
11{
12 public class GridServerConnectionManager
13 {
14 private string ServerURL;
15 public LLUUID SessionID;
16 public bool connected=false;
17
18 public RegionBlock[][] WorldMap;
19
20 public bool Connect(string GridServerURL, string username, string password)
21 {
22 try {
23 this.ServerURL=GridServerURL;
24 Hashtable LoginParamsHT = new Hashtable();
25 LoginParamsHT["username"]=username;
26 LoginParamsHT["password"]=password;
27 ArrayList LoginParams = new ArrayList();
28 LoginParams.Add(LoginParamsHT);
29 XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
30 XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
31 if(GridResp.IsFault) {
32 connected=false;
33 return false;
34 } else {
35 Hashtable gridrespData = (Hashtable)GridResp.Value;
36 this.SessionID = new LLUUID((string)gridrespData["session_id"]);
37 connected=true;
38 return true;
39 }
40 } catch(Exception e) {
41 Console.WriteLine(e.ToString());
42 connected=false;
43 return false;
44 }
45 }
46
47 public void DownloadMap()
48 {
49 System.Net.WebClient mapdownloader = new WebClient();
50 Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist");
51
52 RegionBlock TempRegionData;
53
54 XmlDocument doc = new XmlDocument();
55 doc.Load(regionliststream);
56 regionliststream.Close();
57 XmlNode rootnode = doc.FirstChild;
58 if (rootnode.Name != "regions")
59 {
60 // TODO - ERROR!
61 }
62
63 for(int i=0; i<=rootnode.ChildNodes.Count; i++)
64 {
65 if(rootnode.ChildNodes.Item(i).Name != "region") {
66 // TODO - ERROR!
67 } else {
68 TempRegionData = new RegionBlock();
69
70
71 }
72 }
73 }
74
75 public bool RestartServer()
76 {
77 return true;
78 }
79
80 public bool ShutdownServer()
81 {
82 try {
83 Hashtable ShutdownParamsHT = new Hashtable();
84 ArrayList ShutdownParams = new ArrayList();
85 ShutdownParamsHT["session_id"]=this.SessionID.ToString();
86 ShutdownParams.Add(ShutdownParamsHT);
87 XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams);
88 XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL,3000);
89 if(GridResp.IsFault) {
90 return false;
91 } else {
92 connected=false;
93 return true;
94 }
95 } catch(Exception e) {
96 Console.WriteLine(e.ToString());
97 return false;
98 }
99 }
100
101 public void DisconnectServer()
102 {
103 this.connected=false;
104 }
105 }
106}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs
new file mode 100644
index 0000000..42e09e0
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs
@@ -0,0 +1,96 @@
1// project created on 5/14/2007 at 2:04 PM
2using System;
3using System.Threading;
4using Gtk;
5
6namespace OpenGridServices.Manager
7{
8 class MainClass
9 {
10
11 public static bool QuitReq=false;
12 public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>();
13
14 private static Thread OperationsRunner;
15
16 private static GridServerConnectionManager gridserverConn;
17
18 private static MainWindow win;
19
20 public static void DoMainLoop()
21 {
22 while(!QuitReq)
23 {
24 Application.RunIteration();
25 }
26 }
27
28 public static void RunOperations()
29 {
30 string operation;
31 string cmd;
32 char[] sep = new char[1];
33 sep[0]=' ';
34 while(!QuitReq)
35 {
36 operation=PendingOperations.Dequeue();
37 Console.WriteLine(operation);
38 cmd = operation.Split(sep)[0];
39 switch(cmd) {
40 case "connect_to_gridserver":
41 win.SetStatus("Connecting to grid server...");
42 if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) {
43 win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID);
44 win.SetGridServerConnected(true);
45 Thread.Sleep(3000);
46 win.SetStatus("Downloading region maps...");
47 gridserverConn.DownloadMap();
48 } else {
49 win.SetStatus("Could not connect");
50 }
51 break;
52
53 case "restart_gridserver":
54 win.SetStatus("Restarting grid server...");
55 if(gridserverConn.RestartServer()) {
56 win.SetStatus("Restarted server OK");
57 Thread.Sleep(3000);
58 win.SetStatus("");
59 } else {
60 win.SetStatus("Error restarting grid server!!!");
61 }
62 break;
63
64 case "shutdown_gridserver":
65 win.SetStatus("Shutting down grid server...");
66 if(gridserverConn.ShutdownServer()) {
67 win.SetStatus("Grid server shutdown");
68 win.SetGridServerConnected(false);
69 Thread.Sleep(3000);
70 win.SetStatus("");
71 } else {
72 win.SetStatus("Could not shutdown grid server!!!");
73 }
74 break;
75
76 case "disconnect_gridserver":
77 gridserverConn.DisconnectServer();
78 win.SetGridServerConnected(false);
79 break;
80 }
81 }
82 }
83
84 public static void Main (string[] args)
85 {
86 gridserverConn = new GridServerConnectionManager();
87 Application.Init ();
88 win = new MainWindow ();
89 win.Show ();
90 OperationsRunner = new Thread(new ThreadStart(RunOperations));
91 OperationsRunner.IsBackground=true;
92 OperationsRunner.Start();
93 DoMainLoop();
94 }
95 }
96} \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs
new file mode 100644
index 0000000..1db38f0
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs
@@ -0,0 +1,76 @@
1using System;
2using Gtk;
3
4namespace OpenGridServices.Manager {
5 public partial class MainWindow: Gtk.Window
6 {
7 public MainWindow (): base (Gtk.WindowType.Toplevel)
8 {
9 Build ();
10 }
11
12 public void SetStatus(string statustext)
13 {
14 this.statusbar1.Pop(0);
15 this.statusbar1.Push(0,statustext);
16 }
17
18 public void DrawGrid(RegionBlock[][] regions)
19 {
20 for(int x=0; x<=regions.GetUpperBound(0); x++) {
21 for(int y=0; y<=regions.GetUpperBound(1); y++) {
22 Gdk.Image themap = new Gdk.Image(Gdk.ImageType.Fastest,Gdk.Visual.System,256,256);
23 this.drawingarea1.GdkWindow.DrawImage(new Gdk.GC(this.drawingarea1.GdkWindow),themap,0,0,x*256,y*256,256,256);
24 }
25 }
26 }
27
28 public void SetGridServerConnected(bool connected)
29 {
30 if(connected) {
31 this.ConnectToGridserver.Visible=false;
32 this.DisconnectFromGridServer.Visible=true;
33 } else {
34 this.ConnectToGridserver.Visible=true;
35 this.DisconnectFromGridServer.Visible=false;
36 }
37 }
38
39 protected void OnDeleteEvent (object sender, DeleteEventArgs a)
40 {
41 Application.Quit ();
42 MainClass.QuitReq=true;
43 a.RetVal = true;
44 }
45
46 protected virtual void QuitMenu(object sender, System.EventArgs e)
47 {
48 MainClass.QuitReq=true;
49 Application.Quit();
50 }
51
52 protected virtual void ConnectToGridServerMenu(object sender, System.EventArgs e)
53 {
54 ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog ();
55 griddialog.Show();
56 }
57
58 protected virtual void RestartGridserverMenu(object sender, System.EventArgs e)
59 {
60 MainClass.PendingOperations.Enqueue("restart_gridserver");
61 }
62
63 protected virtual void ShutdownGridserverMenu(object sender, System.EventArgs e)
64 {
65 MainClass.PendingOperations.Enqueue("shutdown_gridserver");
66 }
67
68 protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e)
69 {
70 MainClass.PendingOperations.Enqueue("disconnect_gridserver");
71 }
72
73 }
74}
75
76 \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp
new file mode 100644
index 0000000..cfdc085
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp
@@ -0,0 +1,43 @@
1<Project name="OpenGridServices.Manager" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
2 <Configurations active="Debug">
3 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
4 <Output directory="./bin/Debug" assembly="OpenGridServices.Manager" />
5 <Build debugmode="True" target="Exe" />
6 <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
7 <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
8 </Configuration>
9 <Configuration name="Release" ctype="DotNetProjectConfiguration">
10 <Output directory="./bin/Release" assembly="OpenGridServices.Manager" />
11 <Build debugmode="False" target="Exe" />
12 <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
13 <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
14 </Configuration>
15 </Configurations>
16 <Contents>
17 <File name="./gtk-gui/gui.stetic" subtype="Code" buildaction="EmbedAsResource" />
18 <File name="./gtk-gui/generated.cs" subtype="Code" buildaction="Compile" />
19 <File name="./MainWindow.cs" subtype="Code" buildaction="Compile" />
20 <File name="./Main.cs" subtype="Code" buildaction="Compile" />
21 <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
22 <File name="./ConnectToGridServerDialog.cs" subtype="Code" buildaction="Compile" />
23 <File name="./Util.cs" subtype="Code" buildaction="Compile" />
24 <File name="./gtk-gui/OpenGridServices.Manager.MainWindow.cs" subtype="Code" buildaction="Compile" />
25 <File name="./BlockingQueue.cs" subtype="Code" buildaction="Compile" />
26 <File name="./gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs" subtype="Code" buildaction="Compile" />
27 <File name="./GridServerConnectionManager.cs" subtype="Code" buildaction="Compile" />
28 <File name="./RegionBlock.cs" subtype="Code" buildaction="Compile" />
29 </Contents>
30 <References>
31 <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
32 <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
33 <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
34 <ProjectReference type="Gac" localcopy="True" refto="glade-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
35 <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
36 <ProjectReference type="Assembly" localcopy="True" refto="../../bin/libsecondlife.dll" />
37 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
38 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
39 <ProjectReference type="Assembly" localcopy="True" refto="../../bin/XMLRPC.dll" />
40 <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
41 </References>
42 <GtkDesignInfo partialTypes="True" />
43</Project> \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb
new file mode 100644
index 0000000..44e7a61
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb
Binary files differ
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs
new file mode 100644
index 0000000..00f7c65
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs
@@ -0,0 +1,37 @@
1using System;
2using System.Xml;
3using libsecondlife;
4using OpenSim.Framework.Utilities;
5
6namespace OpenGridServices.Manager
7{
8
9
10 public class RegionBlock
11 {
12 public uint regloc_x;
13 public uint regloc_y;
14
15 public string httpd_url;
16
17 public string region_name;
18
19 public ulong regionhandle {
20 get { return Util.UIntsToLong(regloc_x*256,regloc_y*256); }
21 }
22
23 public Gdk.Pixbuf MiniMap;
24
25 public RegionBlock()
26 {
27 }
28
29 public void LoadFromXmlNode(XmlNode sourcenode)
30 {
31 this.regloc_x=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_x").Value);
32 this.regloc_y=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_y").Value);
33 this.region_name=sourcenode.Attributes.GetNamedItem("region_name").Value;
34 this.httpd_url=sourcenode.Attributes.GetNamedItem("httpd_url").Value;
35 }
36 }
37}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs
new file mode 100644
index 0000000..5bf7ff9
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs
@@ -0,0 +1,133 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace OpenSim.Framework.Utilities
8{
9 public class Util
10 {
11 private static Random randomClass = new Random();
12 private static uint nextXferID = 5000;
13 private static object XferLock = new object();
14
15 public static ulong UIntsToLong(uint X, uint Y)
16 {
17 return Helpers.UIntsToLong(X, Y);
18 }
19
20 public static Random RandomClass
21 {
22 get
23 {
24 return randomClass;
25 }
26 }
27
28 public static uint GetNextXferID()
29 {
30 uint id = 0;
31 lock(XferLock)
32 {
33 id = nextXferID;
34 nextXferID++;
35 }
36 return id;
37 }
38
39 //public static int fast_distance2d(int x, int y)
40 //{
41 // x = System.Math.Abs(x);
42 // y = System.Math.Abs(y);
43
44 // int min = System.Math.Min(x, y);
45
46 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
47 //}
48
49 public static string FieldToString(byte[] bytes)
50 {
51 return FieldToString(bytes, String.Empty);
52 }
53
54 /// <summary>
55 /// Convert a variable length field (byte array) to a string, with a
56 /// field name prepended to each line of the output
57 /// </summary>
58 /// <remarks>If the byte array has unprintable characters in it, a
59 /// hex dump will be put in the string instead</remarks>
60 /// <param name="bytes">The byte array to convert to a string</param>
61 /// <param name="fieldName">A field name to prepend to each line of output</param>
62 /// <returns>An ASCII string or a string containing a hex dump, minus
63 /// the null terminator</returns>
64 public static string FieldToString(byte[] bytes, string fieldName)
65 {
66 // Check for a common case
67 if (bytes.Length == 0) return String.Empty;
68
69 StringBuilder output = new StringBuilder();
70 bool printable = true;
71
72 for (int i = 0; i < bytes.Length; ++i)
73 {
74 // Check if there are any unprintable characters in the array
75 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
76 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
77 {
78 printable = false;
79 break;
80 }
81 }
82
83 if (printable)
84 {
85 if (fieldName.Length > 0)
86 {
87 output.Append(fieldName);
88 output.Append(": ");
89 }
90
91 if (bytes[bytes.Length - 1] == 0x00)
92 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
93 else
94 output.Append(UTF8Encoding.UTF8.GetString(bytes));
95 }
96 else
97 {
98 for (int i = 0; i < bytes.Length; i += 16)
99 {
100 if (i != 0)
101 output.Append(Environment.NewLine);
102 if (fieldName.Length > 0)
103 {
104 output.Append(fieldName);
105 output.Append(": ");
106 }
107
108 for (int j = 0; j < 16; j++)
109 {
110 if ((i + j) < bytes.Length)
111 output.Append(String.Format("{0:X2} ", bytes[i + j]));
112 else
113 output.Append(" ");
114 }
115
116 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
117 {
118 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
119 output.Append((char)bytes[i + j]);
120 else
121 output.Append(".");
122 }
123 }
124 }
125
126 return output.ToString();
127 }
128 public Util()
129 {
130
131 }
132 }
133}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs
new file mode 100644
index 0000000..da6739e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs
@@ -0,0 +1,226 @@
1// ------------------------------------------------------------------------------
2// <autogenerated>
3// This code was generated by a tool.
4// Mono Runtime Version: 2.0.50727.42
5//
6// Changes to this file may cause incorrect behavior and will be lost if
7// the code is regenerated.
8// </autogenerated>
9// ------------------------------------------------------------------------------
10
11namespace OpenGridServices.Manager {
12
13
14 public partial class ConnectToGridServerDialog {
15
16 private Gtk.VBox vbox2;
17
18 private Gtk.VBox vbox3;
19
20 private Gtk.HBox hbox1;
21
22 private Gtk.Label label1;
23
24 private Gtk.Entry entry1;
25
26 private Gtk.HBox hbox2;
27
28 private Gtk.Label label2;
29
30 private Gtk.Entry entry2;
31
32 private Gtk.HBox hbox3;
33
34 private Gtk.Label label3;
35
36 private Gtk.Entry entry3;
37
38 private Gtk.Button button2;
39
40 private Gtk.Button button8;
41
42 protected virtual void Build() {
43 Stetic.Gui.Initialize();
44 // Widget OpenGridServices.Manager.ConnectToGridServerDialog
45 this.Events = ((Gdk.EventMask)(256));
46 this.Name = "OpenGridServices.Manager.ConnectToGridServerDialog";
47 this.Title = Mono.Unix.Catalog.GetString("Connect to Grid server");
48 this.WindowPosition = ((Gtk.WindowPosition)(4));
49 this.HasSeparator = false;
50 // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.VBox
51 Gtk.VBox w1 = this.VBox;
52 w1.Events = ((Gdk.EventMask)(256));
53 w1.Name = "dialog_VBox";
54 w1.BorderWidth = ((uint)(2));
55 // Container child dialog_VBox.Gtk.Box+BoxChild
56 this.vbox2 = new Gtk.VBox();
57 this.vbox2.Name = "vbox2";
58 // Container child vbox2.Gtk.Box+BoxChild
59 this.vbox3 = new Gtk.VBox();
60 this.vbox3.Name = "vbox3";
61 // Container child vbox3.Gtk.Box+BoxChild
62 this.hbox1 = new Gtk.HBox();
63 this.hbox1.Name = "hbox1";
64 // Container child hbox1.Gtk.Box+BoxChild
65 this.label1 = new Gtk.Label();
66 this.label1.Name = "label1";
67 this.label1.Xalign = 1F;
68 this.label1.LabelProp = Mono.Unix.Catalog.GetString("Grid server URL: ");
69 this.label1.Justify = ((Gtk.Justification)(1));
70 this.hbox1.Add(this.label1);
71 Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1]));
72 w2.Position = 0;
73 // Container child hbox1.Gtk.Box+BoxChild
74 this.entry1 = new Gtk.Entry();
75 this.entry1.CanFocus = true;
76 this.entry1.Name = "entry1";
77 this.entry1.Text = Mono.Unix.Catalog.GetString("http://gridserver:8001");
78 this.entry1.IsEditable = true;
79 this.entry1.MaxLength = 255;
80 this.entry1.InvisibleChar = '•';
81 this.hbox1.Add(this.entry1);
82 Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.entry1]));
83 w3.Position = 1;
84 this.vbox3.Add(this.hbox1);
85 Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1]));
86 w4.Position = 0;
87 w4.Expand = false;
88 w4.Fill = false;
89 // Container child vbox3.Gtk.Box+BoxChild
90 this.hbox2 = new Gtk.HBox();
91 this.hbox2.Name = "hbox2";
92 // Container child hbox2.Gtk.Box+BoxChild
93 this.label2 = new Gtk.Label();
94 this.label2.Name = "label2";
95 this.label2.Xalign = 1F;
96 this.label2.LabelProp = Mono.Unix.Catalog.GetString("Username:");
97 this.label2.Justify = ((Gtk.Justification)(1));
98 this.hbox2.Add(this.label2);
99 Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2]));
100 w5.Position = 0;
101 // Container child hbox2.Gtk.Box+BoxChild
102 this.entry2 = new Gtk.Entry();
103 this.entry2.CanFocus = true;
104 this.entry2.Name = "entry2";
105 this.entry2.IsEditable = true;
106 this.entry2.InvisibleChar = '•';
107 this.hbox2.Add(this.entry2);
108 Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.entry2]));
109 w6.Position = 1;
110 this.vbox3.Add(this.hbox2);
111 Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2]));
112 w7.Position = 1;
113 w7.Expand = false;
114 w7.Fill = false;
115 // Container child vbox3.Gtk.Box+BoxChild
116 this.hbox3 = new Gtk.HBox();
117 this.hbox3.Name = "hbox3";
118 // Container child hbox3.Gtk.Box+BoxChild
119 this.label3 = new Gtk.Label();
120 this.label3.Name = "label3";
121 this.label3.Xalign = 1F;
122 this.label3.LabelProp = Mono.Unix.Catalog.GetString("Password:");
123 this.label3.Justify = ((Gtk.Justification)(1));
124 this.hbox3.Add(this.label3);
125 Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox3[this.label3]));
126 w8.Position = 0;
127 // Container child hbox3.Gtk.Box+BoxChild
128 this.entry3 = new Gtk.Entry();
129 this.entry3.CanFocus = true;
130 this.entry3.Name = "entry3";
131 this.entry3.IsEditable = true;
132 this.entry3.InvisibleChar = '•';
133 this.hbox3.Add(this.entry3);
134 Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox3[this.entry3]));
135 w9.Position = 1;
136 this.vbox3.Add(this.hbox3);
137 Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3]));
138 w10.Position = 2;
139 w10.Expand = false;
140 w10.Fill = false;
141 this.vbox2.Add(this.vbox3);
142 Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.vbox3]));
143 w11.Position = 2;
144 w11.Expand = false;
145 w11.Fill = false;
146 w1.Add(this.vbox2);
147 Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
148 w12.Position = 0;
149 // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea
150 Gtk.HButtonBox w13 = this.ActionArea;
151 w13.Events = ((Gdk.EventMask)(256));
152 w13.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea";
153 w13.Spacing = 6;
154 w13.BorderWidth = ((uint)(5));
155 w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
156 // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
157 this.button2 = new Gtk.Button();
158 this.button2.CanDefault = true;
159 this.button2.CanFocus = true;
160 this.button2.Name = "button2";
161 this.button2.UseUnderline = true;
162 // Container child button2.Gtk.Container+ContainerChild
163 Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
164 w14.Name = "GtkAlignment";
165 // Container child GtkAlignment.Gtk.Container+ContainerChild
166 Gtk.HBox w15 = new Gtk.HBox();
167 w15.Name = "GtkHBox";
168 w15.Spacing = 2;
169 // Container child GtkHBox.Gtk.Container+ContainerChild
170 Gtk.Image w16 = new Gtk.Image();
171 w16.Name = "image1";
172 w16.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0);
173 w15.Add(w16);
174 // Container child GtkHBox.Gtk.Container+ContainerChild
175 Gtk.Label w18 = new Gtk.Label();
176 w18.Name = "GtkLabel";
177 w18.LabelProp = Mono.Unix.Catalog.GetString("Connect");
178 w18.UseUnderline = true;
179 w15.Add(w18);
180 w14.Add(w15);
181 this.button2.Add(w14);
182 this.AddActionWidget(this.button2, -5);
183 Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button2]));
184 w22.Expand = false;
185 w22.Fill = false;
186 // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
187 this.button8 = new Gtk.Button();
188 this.button8.CanDefault = true;
189 this.button8.CanFocus = true;
190 this.button8.Name = "button8";
191 this.button8.UseUnderline = true;
192 // Container child button8.Gtk.Container+ContainerChild
193 Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
194 w23.Name = "GtkAlignment1";
195 // Container child GtkAlignment1.Gtk.Container+ContainerChild
196 Gtk.HBox w24 = new Gtk.HBox();
197 w24.Name = "GtkHBox1";
198 w24.Spacing = 2;
199 // Container child GtkHBox1.Gtk.Container+ContainerChild
200 Gtk.Image w25 = new Gtk.Image();
201 w25.Name = "image2";
202 w25.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0);
203 w24.Add(w25);
204 // Container child GtkHBox1.Gtk.Container+ContainerChild
205 Gtk.Label w27 = new Gtk.Label();
206 w27.Name = "GtkLabel1";
207 w27.LabelProp = Mono.Unix.Catalog.GetString("Cancel");
208 w27.UseUnderline = true;
209 w24.Add(w27);
210 w23.Add(w24);
211 this.button8.Add(w23);
212 this.AddActionWidget(this.button8, -6);
213 Gtk.ButtonBox.ButtonBoxChild w31 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button8]));
214 w31.Position = 1;
215 w31.Expand = false;
216 w31.Fill = false;
217 if ((this.Child != null)) {
218 this.Child.ShowAll();
219 }
220 this.DefaultWidth = 476;
221 this.DefaultHeight = 137;
222 this.Show();
223 this.Response += new Gtk.ResponseHandler(this.OnResponse);
224 }
225 }
226}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs
new file mode 100644
index 0000000..8798dac
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs
@@ -0,0 +1,256 @@
1// ------------------------------------------------------------------------------
2// <autogenerated>
3// This code was generated by a tool.
4// Mono Runtime Version: 2.0.50727.42
5//
6// Changes to this file may cause incorrect behavior and will be lost if
7// the code is regenerated.
8// </autogenerated>
9// ------------------------------------------------------------------------------
10
11namespace OpenGridServices.Manager {
12
13
14 public partial class MainWindow {
15
16 private Gtk.Action Grid;
17
18 private Gtk.Action User;
19
20 private Gtk.Action Asset;
21
22 private Gtk.Action Region;
23
24 private Gtk.Action Services;
25
26 private Gtk.Action ConnectToGridserver;
27
28 private Gtk.Action RestartWholeGrid;
29
30 private Gtk.Action ShutdownWholeGrid;
31
32 private Gtk.Action ExitGridManager;
33
34 private Gtk.Action ConnectToUserserver;
35
36 private Gtk.Action AccountManagment;
37
38 private Gtk.Action GlobalNotice;
39
40 private Gtk.Action DisableAllLogins;
41
42 private Gtk.Action DisableNonGodUsersOnly;
43
44 private Gtk.Action ShutdownUserServer;
45
46 private Gtk.Action ShutdownGridserverOnly;
47
48 private Gtk.Action RestartGridserverOnly;
49
50 private Gtk.Action DefaultLocalGridUserserver;
51
52 private Gtk.Action CustomUserserver;
53
54 private Gtk.Action RemoteGridDefaultUserserver;
55
56 private Gtk.Action DisconnectFromGridServer;
57
58 private Gtk.Action UploadAsset;
59
60 private Gtk.Action AssetManagement;
61
62 private Gtk.Action ConnectToAssetServer;
63
64 private Gtk.Action ConnectToDefaultAssetServerForGrid;
65
66 private Gtk.Action DefaultForLocalGrid;
67
68 private Gtk.Action DefaultForRemoteGrid;
69
70 private Gtk.Action CustomAssetServer;
71
72 private Gtk.VBox vbox1;
73
74 private Gtk.MenuBar menubar2;
75
76 private Gtk.HBox hbox1;
77
78 private Gtk.ScrolledWindow scrolledwindow1;
79
80 private Gtk.DrawingArea drawingarea1;
81
82 private Gtk.TreeView treeview1;
83
84 private Gtk.Statusbar statusbar1;
85
86 protected virtual void Build() {
87 Stetic.Gui.Initialize();
88 // Widget OpenGridServices.Manager.MainWindow
89 Gtk.UIManager w1 = new Gtk.UIManager();
90 Gtk.ActionGroup w2 = new Gtk.ActionGroup("Default");
91 this.Grid = new Gtk.Action("Grid", Mono.Unix.Catalog.GetString("Grid"), null, null);
92 this.Grid.HideIfEmpty = false;
93 this.Grid.ShortLabel = Mono.Unix.Catalog.GetString("Grid");
94 w2.Add(this.Grid, "<Alt><Mod2>g");
95 this.User = new Gtk.Action("User", Mono.Unix.Catalog.GetString("User"), null, null);
96 this.User.HideIfEmpty = false;
97 this.User.ShortLabel = Mono.Unix.Catalog.GetString("User");
98 w2.Add(this.User, null);
99 this.Asset = new Gtk.Action("Asset", Mono.Unix.Catalog.GetString("Asset"), null, null);
100 this.Asset.HideIfEmpty = false;
101 this.Asset.ShortLabel = Mono.Unix.Catalog.GetString("Asset");
102 w2.Add(this.Asset, null);
103 this.Region = new Gtk.Action("Region", Mono.Unix.Catalog.GetString("Region"), null, null);
104 this.Region.ShortLabel = Mono.Unix.Catalog.GetString("Region");
105 w2.Add(this.Region, null);
106 this.Services = new Gtk.Action("Services", Mono.Unix.Catalog.GetString("Services"), null, null);
107 this.Services.ShortLabel = Mono.Unix.Catalog.GetString("Services");
108 w2.Add(this.Services, null);
109 this.ConnectToGridserver = new Gtk.Action("ConnectToGridserver", Mono.Unix.Catalog.GetString("Connect to gridserver..."), null, "gtk-connect");
110 this.ConnectToGridserver.HideIfEmpty = false;
111 this.ConnectToGridserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to gridserver");
112 w2.Add(this.ConnectToGridserver, null);
113 this.RestartWholeGrid = new Gtk.Action("RestartWholeGrid", Mono.Unix.Catalog.GetString("Restart whole grid"), null, "gtk-refresh");
114 this.RestartWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Restart whole grid");
115 w2.Add(this.RestartWholeGrid, null);
116 this.ShutdownWholeGrid = new Gtk.Action("ShutdownWholeGrid", Mono.Unix.Catalog.GetString("Shutdown whole grid"), null, "gtk-stop");
117 this.ShutdownWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown whole grid");
118 w2.Add(this.ShutdownWholeGrid, null);
119 this.ExitGridManager = new Gtk.Action("ExitGridManager", Mono.Unix.Catalog.GetString("Exit grid manager"), null, "gtk-close");
120 this.ExitGridManager.ShortLabel = Mono.Unix.Catalog.GetString("Exit grid manager");
121 w2.Add(this.ExitGridManager, null);
122 this.ConnectToUserserver = new Gtk.Action("ConnectToUserserver", Mono.Unix.Catalog.GetString("Connect to userserver"), null, "gtk-connect");
123 this.ConnectToUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to userserver");
124 w2.Add(this.ConnectToUserserver, null);
125 this.AccountManagment = new Gtk.Action("AccountManagment", Mono.Unix.Catalog.GetString("Account managment"), null, "gtk-properties");
126 this.AccountManagment.ShortLabel = Mono.Unix.Catalog.GetString("Account managment");
127 w2.Add(this.AccountManagment, null);
128 this.GlobalNotice = new Gtk.Action("GlobalNotice", Mono.Unix.Catalog.GetString("Global notice"), null, "gtk-network");
129 this.GlobalNotice.ShortLabel = Mono.Unix.Catalog.GetString("Global notice");
130 w2.Add(this.GlobalNotice, null);
131 this.DisableAllLogins = new Gtk.Action("DisableAllLogins", Mono.Unix.Catalog.GetString("Disable all logins"), null, "gtk-no");
132 this.DisableAllLogins.ShortLabel = Mono.Unix.Catalog.GetString("Disable all logins");
133 w2.Add(this.DisableAllLogins, null);
134 this.DisableNonGodUsersOnly = new Gtk.Action("DisableNonGodUsersOnly", Mono.Unix.Catalog.GetString("Disable non-god users only"), null, "gtk-no");
135 this.DisableNonGodUsersOnly.ShortLabel = Mono.Unix.Catalog.GetString("Disable non-god users only");
136 w2.Add(this.DisableNonGodUsersOnly, null);
137 this.ShutdownUserServer = new Gtk.Action("ShutdownUserServer", Mono.Unix.Catalog.GetString("Shutdown user server"), null, "gtk-stop");
138 this.ShutdownUserServer.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown user server");
139 w2.Add(this.ShutdownUserServer, null);
140 this.ShutdownGridserverOnly = new Gtk.Action("ShutdownGridserverOnly", Mono.Unix.Catalog.GetString("Shutdown gridserver only"), null, "gtk-stop");
141 this.ShutdownGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown gridserver only");
142 w2.Add(this.ShutdownGridserverOnly, null);
143 this.RestartGridserverOnly = new Gtk.Action("RestartGridserverOnly", Mono.Unix.Catalog.GetString("Restart gridserver only"), null, "gtk-refresh");
144 this.RestartGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Restart gridserver only");
145 w2.Add(this.RestartGridserverOnly, null);
146 this.DefaultLocalGridUserserver = new Gtk.Action("DefaultLocalGridUserserver", Mono.Unix.Catalog.GetString("Default local grid userserver"), null, null);
147 this.DefaultLocalGridUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Default local grid userserver");
148 w2.Add(this.DefaultLocalGridUserserver, null);
149 this.CustomUserserver = new Gtk.Action("CustomUserserver", Mono.Unix.Catalog.GetString("Custom userserver..."), null, null);
150 this.CustomUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Custom userserver");
151 w2.Add(this.CustomUserserver, null);
152 this.RemoteGridDefaultUserserver = new Gtk.Action("RemoteGridDefaultUserserver", Mono.Unix.Catalog.GetString("Remote grid default userserver..."), null, null);
153 this.RemoteGridDefaultUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Remote grid default userserver");
154 w2.Add(this.RemoteGridDefaultUserserver, null);
155 this.DisconnectFromGridServer = new Gtk.Action("DisconnectFromGridServer", Mono.Unix.Catalog.GetString("Disconnect from grid server"), null, "gtk-disconnect");
156 this.DisconnectFromGridServer.ShortLabel = Mono.Unix.Catalog.GetString("Disconnect from grid server");
157 this.DisconnectFromGridServer.Visible = false;
158 w2.Add(this.DisconnectFromGridServer, null);
159 this.UploadAsset = new Gtk.Action("UploadAsset", Mono.Unix.Catalog.GetString("Upload asset"), null, null);
160 this.UploadAsset.ShortLabel = Mono.Unix.Catalog.GetString("Upload asset");
161 w2.Add(this.UploadAsset, null);
162 this.AssetManagement = new Gtk.Action("AssetManagement", Mono.Unix.Catalog.GetString("Asset management"), null, null);
163 this.AssetManagement.ShortLabel = Mono.Unix.Catalog.GetString("Asset management");
164 w2.Add(this.AssetManagement, null);
165 this.ConnectToAssetServer = new Gtk.Action("ConnectToAssetServer", Mono.Unix.Catalog.GetString("Connect to asset server"), null, null);
166 this.ConnectToAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Connect to asset server");
167 w2.Add(this.ConnectToAssetServer, null);
168 this.ConnectToDefaultAssetServerForGrid = new Gtk.Action("ConnectToDefaultAssetServerForGrid", Mono.Unix.Catalog.GetString("Connect to default asset server for grid"), null, null);
169 this.ConnectToDefaultAssetServerForGrid.ShortLabel = Mono.Unix.Catalog.GetString("Connect to default asset server for grid");
170 w2.Add(this.ConnectToDefaultAssetServerForGrid, null);
171 this.DefaultForLocalGrid = new Gtk.Action("DefaultForLocalGrid", Mono.Unix.Catalog.GetString("Default for local grid"), null, null);
172 this.DefaultForLocalGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for local grid");
173 w2.Add(this.DefaultForLocalGrid, null);
174 this.DefaultForRemoteGrid = new Gtk.Action("DefaultForRemoteGrid", Mono.Unix.Catalog.GetString("Default for remote grid..."), null, null);
175 this.DefaultForRemoteGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for remote grid...");
176 w2.Add(this.DefaultForRemoteGrid, null);
177 this.CustomAssetServer = new Gtk.Action("CustomAssetServer", Mono.Unix.Catalog.GetString("Custom asset server..."), null, null);
178 this.CustomAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Custom asset server...");
179 w2.Add(this.CustomAssetServer, null);
180 w1.InsertActionGroup(w2, 0);
181 this.AddAccelGroup(w1.AccelGroup);
182 this.WidthRequest = 800;
183 this.HeightRequest = 600;
184 this.Name = "OpenGridServices.Manager.MainWindow";
185 this.Title = Mono.Unix.Catalog.GetString("Open Grid Services Manager");
186 this.Icon = Gtk.IconTheme.Default.LoadIcon("gtk-network", 48, 0);
187 // Container child OpenGridServices.Manager.MainWindow.Gtk.Container+ContainerChild
188 this.vbox1 = new Gtk.VBox();
189 this.vbox1.Name = "vbox1";
190 // Container child vbox1.Gtk.Box+BoxChild
191 w1.AddUiFromString("<ui><menubar name='menubar2'><menu action='Grid'><menuitem action='ConnectToGridserver'/><menuitem action='DisconnectFromGridServer'/><separator/><menuitem action='RestartWholeGrid'/><menuitem action='RestartGridserverOnly'/><separator/><menuitem action='ShutdownWholeGrid'/><menuitem action='ShutdownGridserverOnly'/><separator/><menuitem action='ExitGridManager'/></menu><menu action='User'><menu action='ConnectToUserserver'><menuitem action='DefaultLocalGridUserserver'/><menuitem action='CustomUserserver'/><menuitem action='RemoteGridDefaultUserserver'/></menu><separator/><menuitem action='AccountManagment'/><menuitem action='GlobalNotice'/><separator/><menuitem action='DisableAllLogins'/><menuitem action='DisableNonGodUsersOnly'/><separator/><menuitem action='ShutdownUserServer'/></menu><menu action='Asset'><menuitem action='UploadAsset'/><menuitem action='AssetManagement'/><menu action='ConnectToAssetServer'><menuitem action='DefaultForLocalGrid'/><menuitem action='DefaultForRemoteGrid'/><menuitem action='CustomAssetServer'/></menu></menu><menu action='Region'/><menu action='Services'/></menubar></ui>");
192 this.menubar2 = ((Gtk.MenuBar)(w1.GetWidget("/menubar2")));
193 this.menubar2.HeightRequest = 25;
194 this.menubar2.Name = "menubar2";
195 this.vbox1.Add(this.menubar2);
196 Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox1[this.menubar2]));
197 w3.Position = 0;
198 w3.Expand = false;
199 w3.Fill = false;
200 // Container child vbox1.Gtk.Box+BoxChild
201 this.hbox1 = new Gtk.HBox();
202 this.hbox1.Name = "hbox1";
203 // Container child hbox1.Gtk.Box+BoxChild
204 this.scrolledwindow1 = new Gtk.ScrolledWindow();
205 this.scrolledwindow1.CanFocus = true;
206 this.scrolledwindow1.Name = "scrolledwindow1";
207 this.scrolledwindow1.VscrollbarPolicy = ((Gtk.PolicyType)(1));
208 this.scrolledwindow1.HscrollbarPolicy = ((Gtk.PolicyType)(1));
209 // Container child scrolledwindow1.Gtk.Container+ContainerChild
210 Gtk.Viewport w4 = new Gtk.Viewport();
211 w4.Name = "GtkViewport";
212 w4.ShadowType = ((Gtk.ShadowType)(0));
213 // Container child GtkViewport.Gtk.Container+ContainerChild
214 this.drawingarea1 = new Gtk.DrawingArea();
215 this.drawingarea1.Name = "drawingarea1";
216 w4.Add(this.drawingarea1);
217 this.scrolledwindow1.Add(w4);
218 this.hbox1.Add(this.scrolledwindow1);
219 Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox1[this.scrolledwindow1]));
220 w7.Position = 1;
221 // Container child hbox1.Gtk.Box+BoxChild
222 this.treeview1 = new Gtk.TreeView();
223 this.treeview1.CanFocus = true;
224 this.treeview1.Name = "treeview1";
225 this.hbox1.Add(this.treeview1);
226 Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox1[this.treeview1]));
227 w8.Position = 2;
228 this.vbox1.Add(this.hbox1);
229 Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox1]));
230 w9.Position = 1;
231 // Container child vbox1.Gtk.Box+BoxChild
232 this.statusbar1 = new Gtk.Statusbar();
233 this.statusbar1.Name = "statusbar1";
234 this.statusbar1.Spacing = 5;
235 this.vbox1.Add(this.statusbar1);
236 Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
237 w10.PackType = ((Gtk.PackType)(1));
238 w10.Position = 2;
239 w10.Expand = false;
240 w10.Fill = false;
241 this.Add(this.vbox1);
242 if ((this.Child != null)) {
243 this.Child.ShowAll();
244 }
245 this.DefaultWidth = 800;
246 this.DefaultHeight = 800;
247 this.Show();
248 this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent);
249 this.ConnectToGridserver.Activated += new System.EventHandler(this.ConnectToGridServerMenu);
250 this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu);
251 this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu);
252 this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu);
253 this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu);
254 }
255 }
256}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs
new file mode 100644
index 0000000..dd4abdd
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs
@@ -0,0 +1,35 @@
1// ------------------------------------------------------------------------------
2// <autogenerated>
3// This code was generated by a tool.
4// Mono Runtime Version: 2.0.50727.42
5//
6// Changes to this file may cause incorrect behavior and will be lost if
7// the code is regenerated.
8// </autogenerated>
9// ------------------------------------------------------------------------------
10
11namespace Stetic {
12
13
14 internal class Gui {
15
16 private static bool initialized;
17
18 internal static void Initialize() {
19 if ((Stetic.Gui.initialized == false)) {
20 Stetic.Gui.initialized = true;
21 }
22 }
23 }
24
25 internal class ActionGroups {
26
27 public static Gtk.ActionGroup GetActionGroup(System.Type type) {
28 return Stetic.ActionGroups.GetActionGroup(type.FullName);
29 }
30
31 public static Gtk.ActionGroup GetActionGroup(string name) {
32 return null;
33 }
34 }
35}
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic
new file mode 100644
index 0000000..c883f08
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic
@@ -0,0 +1,502 @@
1<?xml version="1.0" encoding="utf-8"?>
2<stetic-interface>
3 <widget class="Gtk.Window" id="OpenGridServices.Manager.MainWindow" design-size="800 800">
4 <action-group name="Default">
5 <action id="Grid">
6 <property name="Type">Action</property>
7 <property name="Accelerator">&lt;Alt&gt;&lt;Mod2&gt;g</property>
8 <property name="HideIfEmpty">False</property>
9 <property name="Label" translatable="yes">Grid</property>
10 <property name="ShortLabel" translatable="yes">Grid</property>
11 </action>
12 <action id="User">
13 <property name="Type">Action</property>
14 <property name="HideIfEmpty">False</property>
15 <property name="Label" translatable="yes">User</property>
16 <property name="ShortLabel" translatable="yes">User</property>
17 </action>
18 <action id="Asset">
19 <property name="Type">Action</property>
20 <property name="HideIfEmpty">False</property>
21 <property name="Label" translatable="yes">Asset</property>
22 <property name="ShortLabel" translatable="yes">Asset</property>
23 </action>
24 <action id="Region">
25 <property name="Type">Action</property>
26 <property name="Label" translatable="yes">Region</property>
27 <property name="ShortLabel" translatable="yes">Region</property>
28 </action>
29 <action id="Services">
30 <property name="Type">Action</property>
31 <property name="Label" translatable="yes">Services</property>
32 <property name="ShortLabel" translatable="yes">Services</property>
33 </action>
34 <action id="ConnectToGridserver">
35 <property name="Type">Action</property>
36 <property name="HideIfEmpty">False</property>
37 <property name="Label" translatable="yes">Connect to gridserver...</property>
38 <property name="ShortLabel" translatable="yes">Connect to gridserver</property>
39 <property name="StockId">gtk-connect</property>
40 <signal name="Activated" handler="ConnectToGridServerMenu" />
41 </action>
42 <action id="RestartWholeGrid">
43 <property name="Type">Action</property>
44 <property name="Label" translatable="yes">Restart whole grid</property>
45 <property name="ShortLabel" translatable="yes">Restart whole grid</property>
46 <property name="StockId">gtk-refresh</property>
47 </action>
48 <action id="ShutdownWholeGrid">
49 <property name="Type">Action</property>
50 <property name="Label" translatable="yes">Shutdown whole grid</property>
51 <property name="ShortLabel" translatable="yes">Shutdown whole grid</property>
52 <property name="StockId">gtk-stop</property>
53 </action>
54 <action id="ExitGridManager">
55 <property name="Type">Action</property>
56 <property name="Label" translatable="yes">Exit grid manager</property>
57 <property name="ShortLabel" translatable="yes">Exit grid manager</property>
58 <property name="StockId">gtk-close</property>
59 <signal name="Activated" handler="QuitMenu" after="yes" />
60 </action>
61 <action id="ConnectToUserserver">
62 <property name="Type">Action</property>
63 <property name="Label" translatable="yes">Connect to userserver</property>
64 <property name="ShortLabel" translatable="yes">Connect to userserver</property>
65 <property name="StockId">gtk-connect</property>
66 </action>
67 <action id="AccountManagment">
68 <property name="Type">Action</property>
69 <property name="Label" translatable="yes">Account managment</property>
70 <property name="ShortLabel" translatable="yes">Account managment</property>
71 <property name="StockId">gtk-properties</property>
72 </action>
73 <action id="GlobalNotice">
74 <property name="Type">Action</property>
75 <property name="Label" translatable="yes">Global notice</property>
76 <property name="ShortLabel" translatable="yes">Global notice</property>
77 <property name="StockId">gtk-network</property>
78 </action>
79 <action id="DisableAllLogins">
80 <property name="Type">Action</property>
81 <property name="Label" translatable="yes">Disable all logins</property>
82 <property name="ShortLabel" translatable="yes">Disable all logins</property>
83 <property name="StockId">gtk-no</property>
84 </action>
85 <action id="DisableNonGodUsersOnly">
86 <property name="Type">Action</property>
87 <property name="Label" translatable="yes">Disable non-god users only</property>
88 <property name="ShortLabel" translatable="yes">Disable non-god users only</property>
89 <property name="StockId">gtk-no</property>
90 </action>
91 <action id="ShutdownUserServer">
92 <property name="Type">Action</property>
93 <property name="Label" translatable="yes">Shutdown user server</property>
94 <property name="ShortLabel" translatable="yes">Shutdown user server</property>
95 <property name="StockId">gtk-stop</property>
96 </action>
97 <action id="ShutdownGridserverOnly">
98 <property name="Type">Action</property>
99 <property name="Label" translatable="yes">Shutdown gridserver only</property>
100 <property name="ShortLabel" translatable="yes">Shutdown gridserver only</property>
101 <property name="StockId">gtk-stop</property>
102 <signal name="Activated" handler="ShutdownGridserverMenu" after="yes" />
103 </action>
104 <action id="RestartGridserverOnly">
105 <property name="Type">Action</property>
106 <property name="Label" translatable="yes">Restart gridserver only</property>
107 <property name="ShortLabel" translatable="yes">Restart gridserver only</property>
108 <property name="StockId">gtk-refresh</property>
109 <signal name="Activated" handler="RestartGridserverMenu" after="yes" />
110 </action>
111 <action id="DefaultLocalGridUserserver">
112 <property name="Type">Action</property>
113 <property name="Label" translatable="yes">Default local grid userserver</property>
114 <property name="ShortLabel" translatable="yes">Default local grid userserver</property>
115 </action>
116 <action id="CustomUserserver">
117 <property name="Type">Action</property>
118 <property name="Label" translatable="yes">Custom userserver...</property>
119 <property name="ShortLabel" translatable="yes">Custom userserver</property>
120 </action>
121 <action id="RemoteGridDefaultUserserver">
122 <property name="Type">Action</property>
123 <property name="Label" translatable="yes">Remote grid default userserver...</property>
124 <property name="ShortLabel" translatable="yes">Remote grid default userserver</property>
125 </action>
126 <action id="DisconnectFromGridServer">
127 <property name="Type">Action</property>
128 <property name="Label" translatable="yes">Disconnect from grid server</property>
129 <property name="ShortLabel" translatable="yes">Disconnect from grid server</property>
130 <property name="StockId">gtk-disconnect</property>
131 <property name="Visible">False</property>
132 <signal name="Activated" handler="DisconnectGridServerMenu" after="yes" />
133 </action>
134 <action id="UploadAsset">
135 <property name="Type">Action</property>
136 <property name="Label" translatable="yes">Upload asset</property>
137 <property name="ShortLabel" translatable="yes">Upload asset</property>
138 </action>
139 <action id="AssetManagement">
140 <property name="Type">Action</property>
141 <property name="Label" translatable="yes">Asset management</property>
142 <property name="ShortLabel" translatable="yes">Asset management</property>
143 </action>
144 <action id="ConnectToAssetServer">
145 <property name="Type">Action</property>
146 <property name="Label" translatable="yes">Connect to asset server</property>
147 <property name="ShortLabel" translatable="yes">Connect to asset server</property>
148 </action>
149 <action id="ConnectToDefaultAssetServerForGrid">
150 <property name="Type">Action</property>
151 <property name="Label" translatable="yes">Connect to default asset server for grid</property>
152 <property name="ShortLabel" translatable="yes">Connect to default asset server for grid</property>
153 </action>
154 <action id="DefaultForLocalGrid">
155 <property name="Type">Action</property>
156 <property name="Label" translatable="yes">Default for local grid</property>
157 <property name="ShortLabel" translatable="yes">Default for local grid</property>
158 </action>
159 <action id="DefaultForRemoteGrid">
160 <property name="Type">Action</property>
161 <property name="Label" translatable="yes">Default for remote grid...</property>
162 <property name="ShortLabel" translatable="yes">Default for remote grid...</property>
163 </action>
164 <action id="CustomAssetServer">
165 <property name="Type">Action</property>
166 <property name="Label" translatable="yes">Custom asset server...</property>
167 <property name="ShortLabel" translatable="yes">Custom asset server...</property>
168 </action>
169 </action-group>
170 <property name="MemberName" />
171 <property name="WidthRequest">800</property>
172 <property name="HeightRequest">600</property>
173 <property name="Title" translatable="yes">Open Grid Services Manager</property>
174 <property name="Icon">stock:gtk-network Dialog</property>
175 <signal name="DeleteEvent" handler="OnDeleteEvent" />
176 <child>
177 <widget class="Gtk.VBox" id="vbox1">
178 <property name="MemberName" />
179 <child>
180 <widget class="Gtk.MenuBar" id="menubar2">
181 <property name="MemberName" />
182 <property name="HeightRequest">25</property>
183 <node name="menubar2" type="Menubar">
184 <node type="Menu" action="Grid">
185 <node type="Menuitem" action="ConnectToGridserver" />
186 <node type="Menuitem" action="DisconnectFromGridServer" />
187 <node type="Separator" />
188 <node type="Menuitem" action="RestartWholeGrid" />
189 <node type="Menuitem" action="RestartGridserverOnly" />
190 <node type="Separator" />
191 <node type="Menuitem" action="ShutdownWholeGrid" />
192 <node type="Menuitem" action="ShutdownGridserverOnly" />
193 <node type="Separator" />
194 <node type="Menuitem" action="ExitGridManager" />
195 </node>
196 <node type="Menu" action="User">
197 <node type="Menu" action="ConnectToUserserver">
198 <node type="Menuitem" action="DefaultLocalGridUserserver" />
199 <node type="Menuitem" action="CustomUserserver" />
200 <node type="Menuitem" action="RemoteGridDefaultUserserver" />
201 </node>
202 <node type="Separator" />
203 <node type="Menuitem" action="AccountManagment" />
204 <node type="Menuitem" action="GlobalNotice" />
205 <node type="Separator" />
206 <node type="Menuitem" action="DisableAllLogins" />
207 <node type="Menuitem" action="DisableNonGodUsersOnly" />
208 <node type="Separator" />
209 <node type="Menuitem" action="ShutdownUserServer" />
210 </node>
211 <node type="Menu" action="Asset">
212 <node type="Menuitem" action="UploadAsset" />
213 <node type="Menuitem" action="AssetManagement" />
214 <node type="Menu" action="ConnectToAssetServer">
215 <node type="Menuitem" action="DefaultForLocalGrid" />
216 <node type="Menuitem" action="DefaultForRemoteGrid" />
217 <node type="Menuitem" action="CustomAssetServer" />
218 </node>
219 </node>
220 <node type="Menu" action="Region" />
221 <node type="Menu" action="Services" />
222 </node>
223 </widget>
224 <packing>
225 <property name="Position">0</property>
226 <property name="AutoSize">False</property>
227 <property name="Expand">False</property>
228 <property name="Fill">False</property>
229 </packing>
230 </child>
231 <child>
232 <widget class="Gtk.HBox" id="hbox1">
233 <property name="MemberName" />
234 <child>
235 <placeholder />
236 </child>
237 <child>
238 <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
239 <property name="MemberName" />
240 <property name="CanFocus">True</property>
241 <property name="VscrollbarPolicy">Automatic</property>
242 <property name="HscrollbarPolicy">Automatic</property>
243 <child>
244 <widget class="Gtk.Viewport" id="GtkViewport">
245 <property name="MemberName" />
246 <property name="ShadowType">None</property>
247 <child>
248 <widget class="Gtk.DrawingArea" id="drawingarea1">
249 <property name="MemberName" />
250 </widget>
251 </child>
252 </widget>
253 </child>
254 </widget>
255 <packing>
256 <property name="Position">1</property>
257 <property name="AutoSize">True</property>
258 </packing>
259 </child>
260 <child>
261 <widget class="Gtk.TreeView" id="treeview1">
262 <property name="MemberName" />
263 <property name="CanFocus">True</property>
264 </widget>
265 <packing>
266 <property name="Position">2</property>
267 <property name="AutoSize">True</property>
268 </packing>
269 </child>
270 </widget>
271 <packing>
272 <property name="Position">1</property>
273 <property name="AutoSize">True</property>
274 </packing>
275 </child>
276 <child>
277 <widget class="Gtk.Statusbar" id="statusbar1">
278 <property name="MemberName">statusBar1</property>
279 <property name="Spacing">5</property>
280 <child>
281 <placeholder />
282 </child>
283 <child>
284 <placeholder />
285 </child>
286 </widget>
287 <packing>
288 <property name="PackType">End</property>
289 <property name="Position">2</property>
290 <property name="AutoSize">False</property>
291 <property name="Expand">False</property>
292 <property name="Fill">False</property>
293 </packing>
294 </child>
295 </widget>
296 </child>
297 </widget>
298 <widget class="Gtk.Dialog" id="OpenGridServices.Manager.ConnectToGridServerDialog" design-size="476 137">
299 <property name="MemberName" />
300 <property name="Events">ButtonPressMask</property>
301 <property name="Title" translatable="yes">Connect to Grid server</property>
302 <property name="WindowPosition">CenterOnParent</property>
303 <property name="Buttons">2</property>
304 <property name="HelpButton">False</property>
305 <property name="HasSeparator">False</property>
306 <signal name="Response" handler="OnResponse" />
307 <child internal-child="VBox">
308 <widget class="Gtk.VBox" id="dialog_VBox">
309 <property name="MemberName" />
310 <property name="Events">ButtonPressMask</property>
311 <property name="BorderWidth">2</property>
312 <child>
313 <widget class="Gtk.VBox" id="vbox2">
314 <property name="MemberName" />
315 <child>
316 <placeholder />
317 </child>
318 <child>
319 <placeholder />
320 </child>
321 <child>
322 <widget class="Gtk.VBox" id="vbox3">
323 <property name="MemberName" />
324 <child>
325 <widget class="Gtk.HBox" id="hbox1">
326 <property name="MemberName" />
327 <child>
328 <widget class="Gtk.Label" id="label1">
329 <property name="MemberName" />
330 <property name="Xalign">1</property>
331 <property name="LabelProp" translatable="yes">Grid server URL: </property>
332 <property name="Justify">Right</property>
333 </widget>
334 <packing>
335 <property name="Position">0</property>
336 <property name="AutoSize">False</property>
337 </packing>
338 </child>
339 <child>
340 <widget class="Gtk.Entry" id="entry1">
341 <property name="MemberName" />
342 <property name="CanFocus">True</property>
343 <property name="Text" translatable="yes">http://gridserver:8001</property>
344 <property name="IsEditable">True</property>
345 <property name="MaxLength">255</property>
346 <property name="InvisibleChar">•</property>
347 </widget>
348 <packing>
349 <property name="Position">1</property>
350 <property name="AutoSize">False</property>
351 </packing>
352 </child>
353 <child>
354 <placeholder />
355 </child>
356 </widget>
357 <packing>
358 <property name="Position">0</property>
359 <property name="AutoSize">True</property>
360 <property name="Expand">False</property>
361 <property name="Fill">False</property>
362 </packing>
363 </child>
364 <child>
365 <widget class="Gtk.HBox" id="hbox2">
366 <property name="MemberName" />
367 <child>
368 <widget class="Gtk.Label" id="label2">
369 <property name="MemberName" />
370 <property name="Xalign">1</property>
371 <property name="LabelProp" translatable="yes">Username:</property>
372 <property name="Justify">Right</property>
373 </widget>
374 <packing>
375 <property name="Position">0</property>
376 <property name="AutoSize">False</property>
377 </packing>
378 </child>
379 <child>
380 <widget class="Gtk.Entry" id="entry2">
381 <property name="MemberName" />
382 <property name="CanFocus">True</property>
383 <property name="IsEditable">True</property>
384 <property name="InvisibleChar">•</property>
385 </widget>
386 <packing>
387 <property name="Position">1</property>
388 <property name="AutoSize">True</property>
389 </packing>
390 </child>
391 <child>
392 <placeholder />
393 </child>
394 </widget>
395 <packing>
396 <property name="Position">1</property>
397 <property name="AutoSize">False</property>
398 <property name="Expand">False</property>
399 <property name="Fill">False</property>
400 </packing>
401 </child>
402 <child>
403 <widget class="Gtk.HBox" id="hbox3">
404 <property name="MemberName" />
405 <child>
406 <widget class="Gtk.Label" id="label3">
407 <property name="MemberName" />
408 <property name="Xalign">1</property>
409 <property name="LabelProp" translatable="yes">Password:</property>
410 <property name="Justify">Right</property>
411 </widget>
412 <packing>
413 <property name="Position">0</property>
414 <property name="AutoSize">False</property>
415 </packing>
416 </child>
417 <child>
418 <widget class="Gtk.Entry" id="entry3">
419 <property name="MemberName" />
420 <property name="CanFocus">True</property>
421 <property name="IsEditable">True</property>
422 <property name="InvisibleChar">•</property>
423 </widget>
424 <packing>
425 <property name="Position">1</property>
426 <property name="AutoSize">True</property>
427 </packing>
428 </child>
429 <child>
430 <placeholder />
431 </child>
432 </widget>
433 <packing>
434 <property name="Position">2</property>
435 <property name="AutoSize">True</property>
436 <property name="Expand">False</property>
437 <property name="Fill">False</property>
438 </packing>
439 </child>
440 </widget>
441 <packing>
442 <property name="Position">2</property>
443 <property name="AutoSize">True</property>
444 <property name="Expand">False</property>
445 <property name="Fill">False</property>
446 </packing>
447 </child>
448 </widget>
449 <packing>
450 <property name="Position">0</property>
451 <property name="AutoSize">True</property>
452 </packing>
453 </child>
454 </widget>
455 </child>
456 <child internal-child="ActionArea">
457 <widget class="Gtk.HButtonBox" id="OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea">
458 <property name="MemberName" />
459 <property name="Events">ButtonPressMask</property>
460 <property name="Spacing">6</property>
461 <property name="BorderWidth">5</property>
462 <property name="Size">2</property>
463 <property name="LayoutStyle">End</property>
464 <child>
465 <widget class="Gtk.Button" id="button2">
466 <property name="MemberName" />
467 <property name="CanDefault">True</property>
468 <property name="CanFocus">True</property>
469 <property name="Type">TextAndIcon</property>
470 <property name="Icon">stock:gtk-apply Menu</property>
471 <property name="Label" translatable="yes">Connect</property>
472 <property name="UseUnderline">True</property>
473 <property name="IsDialogButton">True</property>
474 <property name="ResponseId">-5</property>
475 </widget>
476 <packing>
477 <property name="Expand">False</property>
478 <property name="Fill">False</property>
479 </packing>
480 </child>
481 <child>
482 <widget class="Gtk.Button" id="button8">
483 <property name="MemberName" />
484 <property name="CanDefault">True</property>
485 <property name="CanFocus">True</property>
486 <property name="Type">TextAndIcon</property>
487 <property name="Icon">stock:gtk-cancel Menu</property>
488 <property name="Label" translatable="yes">Cancel</property>
489 <property name="UseUnderline">True</property>
490 <property name="IsDialogButton">True</property>
491 <property name="ResponseId">-6</property>
492 </widget>
493 <packing>
494 <property name="Position">1</property>
495 <property name="Expand">False</property>
496 <property name="Fill">False</property>
497 </packing>
498 </child>
499 </widget>
500 </child>
501 </widget>
502</stetic-interface> \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/Main.cs b/OpenGridServices-Source/OpenGridServices.UserServer/Main.cs
new file mode 100644
index 0000000..0eb314b
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/Main.cs
@@ -0,0 +1,197 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using System.Reflection;
34using System.IO;
35using System.Text;
36using libsecondlife;
37using OpenSim.Framework.User;
38using OpenSim.Framework.Sims;
39using OpenSim.Framework.Inventory;
40using OpenSim.Framework.Interfaces;
41using OpenSim.Framework.Console;
42using OpenSim.Servers;
43
44namespace OpenGridServices.UserServer
45{
46 /// <summary>
47 /// </summary>
48 public class OpenUser_Main : BaseServer, conscmd_callback
49 {
50 private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll";
51 private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll";
52 private UserConfig Cfg;
53
54 public UserManager m_userManager; // Replaces below.
55
56 //private UserProfileManager m_userProfileManager; // Depreciated
57
58 public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
59
60 ConsoleBase m_console;
61
62 [STAThread]
63 public static void Main(string[] args)
64 {
65 Console.WriteLine("Starting...\n");
66
67 OpenUser_Main userserver = new OpenUser_Main();
68
69 userserver.Startup();
70 userserver.Work();
71 }
72
73 private OpenUser_Main()
74 {
75 m_console = new ConsoleBase("opengrid-userserver-console.log", "OpenUser", this , false);
76 MainConsole.Instance = m_console;
77 }
78
79 private void Work()
80 {
81 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"\nEnter help for a list of commands\n");
82
83 while (true)
84 {
85 m_console.MainConsolePrompt();
86 }
87 }
88
89 public void Startup()
90 {
91 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration");
92 Cfg = this.LoadConfigDll(this.ConfigDll);
93 Cfg.InitConfig();
94
95 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Establishing data connection");
96 m_userManager = new UserManager();
97 m_userManager._config = Cfg;
98 m_userManager.AddPlugin(StorageDll);
99
100 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process");
101 BaseHttpServer httpServer = new BaseHttpServer(8002);
102
103 httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod);
104 httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod);
105
106 httpServer.Start();
107 }
108
109
110 public void do_create(string what)
111 {
112 switch (what)
113 {
114 case "user":
115 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Commandline user creation is currently disabled.");
116 break;
117 /*
118 string tempfirstname;
119 string templastname;
120 string tempMD5Passwd;
121
122 tempfirstname = m_console.CmdPrompt("First name");
123 templastname = m_console.CmdPrompt("Last name");
124 tempMD5Passwd = m_console.PasswdPrompt("Password");
125
126 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
127 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
128 bs = x.ComputeHash(bs);
129 System.Text.StringBuilder s = new System.Text.StringBuilder();
130 foreach (byte b in bs)
131 {
132 s.Append(b.ToString("x2").ToLower());
133 }
134 tempMD5Passwd = s.ToString();
135
136 UserProfile newuser = m_userProfileManager.CreateNewProfile(tempfirstname, templastname, tempMD5Passwd);
137 newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
138 newuser.homepos = new LLVector3(128f, 128f, 150f);
139 m_userProfileManager.SaveUserProfiles();
140 break;
141 */
142 }
143 }
144
145 public void RunCmd(string cmd, string[] cmdparams)
146 {
147 switch (cmd)
148 {
149 case "help":
150 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"create user - create a new user");
151 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - shutdown the grid (USE CAUTION!)");
152 break;
153
154 case "create":
155 do_create(cmdparams[0]);
156 break;
157
158 case "shutdown":
159 m_console.Close();
160 Environment.Exit(0);
161 break;
162 }
163 }
164
165 private UserConfig LoadConfigDll(string dllName)
166 {
167 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
168 UserConfig config = null;
169
170 foreach (Type pluginType in pluginAssembly.GetTypes())
171 {
172 if (pluginType.IsPublic)
173 {
174 if (!pluginType.IsAbstract)
175 {
176 Type typeInterface = pluginType.GetInterface("IUserConfig", true);
177
178 if (typeInterface != null)
179 {
180 IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
181 config = plug.GetConfigObject();
182 break;
183 }
184
185 typeInterface = null;
186 }
187 }
188 }
189 pluginAssembly = null;
190 return config;
191 }
192
193 public void Show(string ShowWhat)
194 {
195 }
196 }
197}
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/OGS-UserServer.csproj b/OpenGridServices-Source/OpenGridServices.UserServer/OGS-UserServer.csproj
new file mode 100644
index 0000000..f4fa8b6
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/OGS-UserServer.csproj
@@ -0,0 +1,63 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{D45B6E48-5668-478D-B9CB-6D46E665FACF}</ProjectGuid>
8 <OutputType>Exe</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>OGS_UserServer</RootNamespace>
11 <AssemblyName>OGS-UserServer</AssemblyName>
12 <StartupObject>OpenGridServices.OpenUser_Main</StartupObject>
13 </PropertyGroup>
14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15 <DebugSymbols>true</DebugSymbols>
16 <DebugType>full</DebugType>
17 <Optimize>false</Optimize>
18 <OutputPath>bin\Debug\</OutputPath>
19 <DefineConstants>DEBUG;TRACE</DefineConstants>
20 <ErrorReport>prompt</ErrorReport>
21 <WarningLevel>4</WarningLevel>
22 </PropertyGroup>
23 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24 <DebugType>pdbonly</DebugType>
25 <Optimize>true</Optimize>
26 <OutputPath>bin\Release\</OutputPath>
27 <DefineConstants>TRACE</DefineConstants>
28 <ErrorReport>prompt</ErrorReport>
29 <WarningLevel>4</WarningLevel>
30 </PropertyGroup>
31 <ItemGroup>
32 <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
33 <SpecificVersion>False</SpecificVersion>
34 <HintPath>..\..\common\bin\libsecondlife.dll</HintPath>
35 </Reference>
36 <Reference Include="System" />
37 <Reference Include="System.Data" />
38 <Reference Include="System.Xml" />
39 </ItemGroup>
40 <ItemGroup>
41 <Compile Include="..\..\common\src\OGS-Console.cs">
42 <Link>OGS-Console.cs</Link>
43 </Compile>
44 <Compile Include="..\..\common\VersionInfo\VersionInfo.cs">
45 <Link>VersionInfo.cs</Link>
46 </Compile>
47 <Compile Include="ConsoleCmds.cs" />
48 <Compile Include="Main.cs" />
49 <Compile Include="Properties\AssemblyInfo.cs" />
50 <Compile Include="UserHttp.cs" />
51 </ItemGroup>
52 <ItemGroup>
53 <ProjectReference Include="..\..\..\OpenSim.FrameWork\OpenSim.Framework.csproj">
54 <Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
55 <Name>OpenSim.Framework</Name>
56 </ProjectReference>
57 <ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
58 <Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
59 <Name>ServerConsole</Name>
60 </ProjectReference>
61 </ItemGroup>
62 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
63</Project> \ No newline at end of file
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj
new file mode 100644
index 0000000..9f4da40
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj
@@ -0,0 +1,132 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{66591469-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGridServices.UserServer</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGridServices.UserServer</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data" >
66 <HintPath>System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
96 <Name>OpenGrid.Framework.Data</Name>
97 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
102 <Name>OpenSim.Servers</Name>
103 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
108 <Name>XMLRPC</Name>
109 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private>
112 </ProjectReference>
113 </ItemGroup>
114 <ItemGroup>
115 <Compile Include="Main.cs">
116 <SubType>Code</SubType>
117 </Compile>
118 <Compile Include="UserManager.cs">
119 <SubType>Code</SubType>
120 </Compile>
121 <Compile Include="Properties\AssemblyInfo.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 </ItemGroup>
125 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
126 <PropertyGroup>
127 <PreBuildEvent>
128 </PreBuildEvent>
129 <PostBuildEvent>
130 </PostBuildEvent>
131 </PropertyGroup>
132</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user b/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build b/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build
new file mode 100644
index 0000000..548c3cc
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build
@@ -0,0 +1,50 @@
1<?xml version="1.0" ?>
2<project name="OpenGridServices.UserServer" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenGridServices.UserServer" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Main.cs" />
15 <include name="UserManager.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Data.dll" />
25 <include name="System.Xml.dll" />
26 <include name="../bin/OpenSim.Framework.dll" />
27 <include name="../bin/OpenSim.Framework.Console.dll" />
28 <include name="../bin/OpenGrid.Framework.Data.dll" />
29 <include name="../bin/OpenSim.Servers.dll" />
30 <include name="../bin/libsecondlife.dll" />
31 <include name="../bin/Db4objects.Db4o.dll" />
32 <include name="../bin/XMLRPC.dll" />
33 </references>
34 </csc>
35 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
36 <mkdir dir="${project::get-base-directory()}/../bin/"/>
37 <copy todir="${project::get-base-directory()}/../bin/">
38 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
39 <include name="*.dll"/>
40 <include name="*.exe"/>
41 </fileset>
42 </copy>
43 </target>
44 <target name="clean">
45 <delete dir="${bin.dir}" failonerror="false" />
46 <delete dir="${obj.dir}" failonerror="false" />
47 </target>
48 <target name="doc" description="Creates documentation.">
49 </target>
50</project>
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGridServices.UserServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..5d5ce8d
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OGS-UserServer")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OGS-UserServer")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenGridServices-Source/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices-Source/OpenGridServices.UserServer/UserManager.cs
new file mode 100644
index 0000000..a312445
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.UserServer/UserManager.cs
@@ -0,0 +1,566 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using OpenGrid.Framework.Data;
6using libsecondlife;
7using System.Reflection;
8
9using System.Xml;
10using Nwc.XmlRpc;
11using OpenSim.Framework.Sims;
12using OpenSim.Framework.Inventory;
13using OpenSim.Framework.Utilities;
14
15using System.Security.Cryptography;
16
17namespace OpenGridServices.UserServer
18{
19 public class UserManager
20 {
21 public OpenSim.Framework.Interfaces.UserConfig _config;
22 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
23
24 /// <summary>
25 /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
26 /// </summary>
27 /// <param name="FileName">The filename to the user server plugin DLL</param>
28 public void AddPlugin(string FileName)
29 {
30 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Userstorage: Attempting to load " + FileName);
31 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
32
33 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
34 foreach (Type pluginType in pluginAssembly.GetTypes())
35 {
36 if (!pluginType.IsAbstract)
37 {
38 Type typeInterface = pluginType.GetInterface("IUserData", true);
39
40 if (typeInterface != null)
41 {
42 IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
43 plug.Initialise();
44 this._plugins.Add(plug.getName(), plug);
45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Userstorage: Added IUserData Interface");
46 }
47
48 typeInterface = null;
49 }
50 }
51
52 pluginAssembly = null;
53 }
54
55 /// <summary>
56 /// Loads a user profile from a database by UUID
57 /// </summary>
58 /// <param name="uuid">The target UUID</param>
59 /// <returns>A user profile</returns>
60 public UserProfileData getUserProfile(LLUUID uuid)
61 {
62 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
63 {
64 try
65 {
66 UserProfileData profile = plugin.Value.getUserByUUID(uuid);
67 profile.currentAgent = getUserAgent(profile.UUID);
68 return profile;
69 }
70 catch (Exception e)
71 {
72 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
73 }
74 }
75
76 return null;
77 }
78
79
80 /// <summary>
81 /// Loads a user profile by name
82 /// </summary>
83 /// <param name="name">The target name</param>
84 /// <returns>A user profile</returns>
85 public UserProfileData getUserProfile(string name)
86 {
87 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
88 {
89 try
90 {
91 UserProfileData profile = plugin.Value.getUserByName(name);
92 profile.currentAgent = getUserAgent(profile.UUID);
93 return profile;
94 }
95 catch (Exception e)
96 {
97 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
98 }
99 }
100
101 return null;
102 }
103
104 /// <summary>
105 /// Loads a user profile by name
106 /// </summary>
107 /// <param name="fname">First name</param>
108 /// <param name="lname">Last name</param>
109 /// <returns>A user profile</returns>
110 public UserProfileData getUserProfile(string fname, string lname)
111 {
112 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
113 {
114 try
115 {
116 UserProfileData profile = plugin.Value.getUserByName(fname,lname);
117 try
118 {
119 profile.currentAgent = getUserAgent(profile.UUID);
120 }
121 catch (Exception e)
122 {
123 // Ignore
124 }
125 return profile;
126 }
127 catch (Exception e)
128 {
129 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
130 }
131 }
132
133 return null;
134 }
135
136 /// <summary>
137 /// Loads a user agent by uuid (not called directly)
138 /// </summary>
139 /// <param name="uuid">The agents UUID</param>
140 /// <returns>Agent profiles</returns>
141 public UserAgentData getUserAgent(LLUUID uuid)
142 {
143 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
144 {
145 try
146 {
147 return plugin.Value.getAgentByUUID(uuid);
148 }
149 catch (Exception e)
150 {
151 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
152 }
153 }
154
155 return null;
156 }
157
158 /// <summary>
159 /// Loads a user agent by name (not called directly)
160 /// </summary>
161 /// <param name="name">The agents name</param>
162 /// <returns>A user agent</returns>
163 public UserAgentData getUserAgent(string name)
164 {
165 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
166 {
167 try
168 {
169 return plugin.Value.getAgentByName(name);
170 }
171 catch (Exception e)
172 {
173 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
174 }
175 }
176
177 return null;
178 }
179
180 /// <summary>
181 /// Loads a user agent by name (not called directly)
182 /// </summary>
183 /// <param name="fname">The agents firstname</param>
184 /// <param name="lname">The agents lastname</param>
185 /// <returns>A user agent</returns>
186 public UserAgentData getUserAgent(string fname, string lname)
187 {
188 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
189 {
190 try
191 {
192 return plugin.Value.getAgentByName(fname,lname);
193 }
194 catch (Exception e)
195 {
196 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
197 }
198 }
199
200 return null;
201 }
202
203 /// <summary>
204 /// Creates a error response caused by invalid XML
205 /// </summary>
206 /// <returns>An XMLRPC response</returns>
207 private static XmlRpcResponse CreateErrorConnectingToGridResponse()
208 {
209 XmlRpcResponse response = new XmlRpcResponse();
210 Hashtable ErrorRespData = new Hashtable();
211 ErrorRespData["reason"] = "key";
212 ErrorRespData["message"] = "Error connecting to grid. Could not percieve credentials from login XML.";
213 ErrorRespData["login"] = "false";
214 response.Value = ErrorRespData;
215 return response;
216 }
217
218 /// <summary>
219 /// Creates an error response caused by bad login credentials
220 /// </summary>
221 /// <returns>An XMLRPC response</returns>
222 private static XmlRpcResponse CreateLoginErrorResponse()
223 {
224 XmlRpcResponse response = new XmlRpcResponse();
225 Hashtable ErrorRespData = new Hashtable();
226 ErrorRespData["reason"] = "key";
227 ErrorRespData["message"] = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
228 ErrorRespData["login"] = "false";
229 response.Value = ErrorRespData;
230 return response;
231 }
232
233 /// <summary>
234 /// Creates an error response caused by being logged in already
235 /// </summary>
236 /// <returns>An XMLRPC Response</returns>
237 private static XmlRpcResponse CreateAlreadyLoggedInResponse()
238 {
239 XmlRpcResponse response = new XmlRpcResponse();
240 Hashtable PresenceErrorRespData = new Hashtable();
241 PresenceErrorRespData["reason"] = "presence";
242 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";
243 PresenceErrorRespData["login"] = "false";
244 response.Value = PresenceErrorRespData;
245 return response;
246 }
247
248 /// <summary>
249 /// Customises the login response and fills in missing values.
250 /// </summary>
251 /// <param name="response">The existing response</param>
252 /// <param name="theUser">The user profile</param>
253 public virtual void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser)
254 {
255 // Load information from the gridserver
256 SimProfile SimInfo = new SimProfile();
257 SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
258
259 // Customise the response
260 // Home Location
261 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], " +
262 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
263 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
264
265 // Destination
266 response["sim_ip"] = SimInfo.sim_ip;
267 response["sim_port"] = (Int32)SimInfo.sim_port;
268 response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
269 response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
270
271 // Notify the target of an incoming user
272 Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")");
273
274 // Prepare notification
275 Hashtable SimParams = new Hashtable();
276 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
277 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
278 SimParams["firstname"] = theUser.username;
279 SimParams["lastname"] = theUser.surname;
280 SimParams["agent_id"] = theUser.UUID.ToString();
281 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response["circuit_code"]);
282 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
283 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
284 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
285 ArrayList SendParams = new ArrayList();
286 SendParams.Add(SimParams);
287
288 // Update agent with target sim
289 theUser.currentAgent.currentRegion = SimInfo.UUID;
290 theUser.currentAgent.currentHandle = SimInfo.regionhandle;
291
292 // Send
293 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
294 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
295 }
296
297 /// <summary>
298 /// Checks a user against it's password hash
299 /// </summary>
300 /// <param name="profile">The users profile</param>
301 /// <param name="password">The supplied password</param>
302 /// <returns>Authenticated?</returns>
303 public bool AuthenticateUser(ref UserProfileData profile, string password)
304 {
305 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
306 OpenSim.Framework.Console.LogPriority.LOW,
307 "Authenticating " + profile.username + " " + profile.surname);
308
309 password = password.Remove(0, 3); //remove $1$
310
311 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
312
313 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
314 }
315
316 /// <summary>
317 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
318 /// </summary>
319 /// <param name="profile">The users profile</param>
320 /// <param name="request">The users loginrequest</param>
321 public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request)
322 {
323 Hashtable requestData = (Hashtable)request.Params[0];
324
325 UserAgentData agent = new UserAgentData();
326
327 // User connection
328 agent.agentIP = "";
329 agent.agentOnline = true;
330 agent.agentPort = 0;
331
332 // Generate sessions
333 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
334 byte[] randDataS = new byte[16];
335 byte[] randDataSS = new byte[16];
336 rand.GetBytes(randDataS);
337 rand.GetBytes(randDataSS);
338
339 agent.secureSessionID = new LLUUID(randDataSS, 0);
340 agent.sessionID = new LLUUID(randDataS, 0);
341
342 // Profile UUID
343 agent.UUID = profile.UUID;
344
345 // Current position (from Home)
346 agent.currentHandle = profile.homeRegion;
347 agent.currentPos = profile.homeLocation;
348
349 // If user specified additional start, use that
350 if (requestData.ContainsKey("start"))
351 {
352 string startLoc = (string)requestData["start"];
353 if (!(startLoc == "last" || startLoc == "home"))
354 {
355 // Ignore it! Heh.
356 }
357 }
358
359 // What time did the user login?
360 agent.loginTime = Util.UnixTimeSinceEpoch();
361 agent.logoutTime = 0;
362
363 // Current location
364 agent.regionID = new LLUUID(); // Fill in later
365 agent.currentRegion = new LLUUID(); // Fill in later
366
367 profile.currentAgent = agent;
368 }
369
370 /// <summary>
371 /// Saves a target agent to the database
372 /// </summary>
373 /// <param name="profile">The users profile</param>
374 /// <returns>Successful?</returns>
375 public bool CommitAgent(ref UserProfileData profile)
376 {
377 // Saves the agent to database
378 return true;
379 }
380
381 /// <summary>
382 /// Main user login function
383 /// </summary>
384 /// <param name="request">The XMLRPC request</param>
385 /// <returns>The response to send</returns>
386 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
387 {
388 XmlRpcResponse response = new XmlRpcResponse();
389 Hashtable requestData = (Hashtable)request.Params[0];
390
391 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
392 bool GoodLogin = false;
393 string firstname = "";
394 string lastname = "";
395 string passwd = "";
396
397 UserProfileData TheUser;
398
399 if (GoodXML)
400 {
401 firstname = (string)requestData["first"];
402 lastname = (string)requestData["last"];
403 passwd = (string)requestData["passwd"];
404
405 TheUser = getUserProfile(firstname, lastname);
406 if (TheUser == null)
407 return CreateLoginErrorResponse();
408
409 GoodLogin = AuthenticateUser(ref TheUser, passwd);
410 }
411 else
412 {
413 return CreateErrorConnectingToGridResponse();
414 }
415
416 if (!GoodLogin)
417 {
418 return CreateLoginErrorResponse();
419 }
420 else
421 {
422 // If we already have a session...
423 if (TheUser.currentAgent != null && TheUser.currentAgent.agentOnline)
424 {
425 // Reject the login
426 return CreateAlreadyLoggedInResponse();
427 }
428 // Otherwise...
429 // Create a new agent session
430 CreateAgent(ref TheUser, request);
431
432 try
433 {
434 Hashtable responseData = new Hashtable();
435
436 LLUUID AgentID = TheUser.UUID;
437
438 // Global Texture Section
439 Hashtable GlobalT = new Hashtable();
440 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
441 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
442 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
443 ArrayList GlobalTextures = new ArrayList();
444 GlobalTextures.Add(GlobalT);
445
446 // Login Flags Section
447 Hashtable LoginFlagsHash = new Hashtable();
448 LoginFlagsHash["daylight_savings"] = "N";
449 LoginFlagsHash["stipend_since_login"] = "N";
450 LoginFlagsHash["gendered"] = "Y";
451 LoginFlagsHash["ever_logged_in"] = "N"; // Should allow male/female av selection
452 ArrayList LoginFlags = new ArrayList();
453 LoginFlags.Add(LoginFlagsHash);
454
455 // UI Customisation Section
456 Hashtable uiconfig = new Hashtable();
457 uiconfig["allow_first_life"] = "Y";
458 ArrayList ui_config = new ArrayList();
459 ui_config.Add(uiconfig);
460
461 // Classified Categories Section
462 Hashtable ClassifiedCategoriesHash = new Hashtable();
463 ClassifiedCategoriesHash["category_name"] = "Generic";
464 ClassifiedCategoriesHash["category_id"] = (Int32)1;
465 ArrayList ClassifiedCategories = new ArrayList();
466 ClassifiedCategories.Add(ClassifiedCategoriesHash);
467
468 // Inventory Library Section
469 ArrayList AgentInventoryArray = new ArrayList();
470 Hashtable TempHash;
471
472 AgentInventory Library = new AgentInventory();
473 Library.CreateRootFolder(AgentID, true);
474
475 foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values)
476 {
477 TempHash = new Hashtable();
478 TempHash["name"] = InvFolder.FolderName;
479 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
480 TempHash["version"] = (Int32)InvFolder.Version;
481 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
482 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
483 AgentInventoryArray.Add(TempHash);
484 }
485
486 Hashtable InventoryRootHash = new Hashtable();
487 InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated();
488 ArrayList InventoryRoot = new ArrayList();
489 InventoryRoot.Add(InventoryRootHash);
490
491 Hashtable InitialOutfitHash = new Hashtable();
492 InitialOutfitHash["folder_name"] = "Nightclub Female";
493 InitialOutfitHash["gender"] = "female";
494 ArrayList InitialOutfit = new ArrayList();
495 InitialOutfit.Add(InitialOutfitHash);
496
497 // Circuit Code
498 uint circode = (uint)(Util.RandomClass.Next());
499
500 // Generics
501 responseData["last_name"] = TheUser.surname;
502 responseData["ui-config"] = ui_config;
503 responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
504 responseData["login-flags"] = LoginFlags;
505 responseData["global-textures"] = GlobalTextures;
506 responseData["classified_categories"] = ClassifiedCategories;
507 responseData["event_categories"] = new ArrayList();
508 responseData["inventory-skeleton"] = AgentInventoryArray;
509 responseData["inventory-skel-lib"] = new ArrayList();
510 responseData["inventory-root"] = InventoryRoot;
511 responseData["event_notifications"] = new ArrayList();
512 responseData["gestures"] = new ArrayList();
513 responseData["inventory-lib-owner"] = new ArrayList();
514 responseData["initial-outfit"] = InitialOutfit;
515 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
516 responseData["start_location"] = "last";
517 responseData["home"] = "!!null temporary value {home}!!"; // Overwritten
518 responseData["message"] = _config.DefaultStartupMsg;
519 responseData["first_name"] = TheUser.username;
520 responseData["circuit_code"] = (Int32)circode;
521 responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port;
522 responseData["secure_session_id"] = TheUser.currentAgent.secureSessionID.ToStringHyphenated();
523 responseData["look_at"] = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
524 responseData["agent_id"] = AgentID.ToStringHyphenated();
525 responseData["region_y"] = (Int32)0; // Overwritten
526 responseData["region_x"] = (Int32)0; // Overwritten
527 responseData["seed_capability"] = "";
528 responseData["agent_access"] = "M";
529 responseData["session_id"] = TheUser.currentAgent.sessionID.ToStringHyphenated();
530 responseData["login"] = "true";
531
532 this.CustomiseResponse(ref responseData, ref TheUser);
533
534 CommitAgent(ref TheUser);
535
536 response.Value = responseData;
537 // TheUser.SendDataToSim(SimInfo);
538 return response;
539
540 }
541 catch (Exception E)
542 {
543 Console.WriteLine(E.ToString());
544 }
545 //}
546 }
547 return response;
548
549 }
550
551 /// <summary>
552 /// Deletes an active agent session
553 /// </summary>
554 /// <param name="request">The request</param>
555 /// <param name="path">The path (eg /bork/narf/test)</param>
556 /// <param name="param">Parameters sent</param>
557 /// <returns>Success "OK" else error</returns>
558 public string RestDeleteUserSessionMethod(string request, string path, string param)
559 {
560 // TODO! Important!
561
562 return "OK";
563 }
564
565 }
566}
diff --git a/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..56a5535
--- /dev/null
+++ b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("UserConfig")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("UserConfig")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs
new file mode 100644
index 0000000..a281889
--- /dev/null
+++ b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs
@@ -0,0 +1,95 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using OpenSim.Framework.Console;
30using OpenSim.Framework.Interfaces;
31using Db4objects.Db4o;
32
33namespace OpenUser.Config.UserConfigDb4o
34{
35 public class Db4oConfigPlugin: IUserConfig
36 {
37 public UserConfig GetConfigObject()
38 {
39 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Loading Db40Config dll");
40 return ( new DbUserConfig());
41 }
42 }
43
44 public class DbUserConfig : UserConfig
45 {
46 private IObjectContainer db;
47
48 public void LoadDefaults() {
49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
50
51 this.DefaultStartupMsg = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default startup message", "Welcome to OGS");
52
53 this.GridServerURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/");
54 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null");
55 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null");
56 }
57
58 public override void InitConfig() {
59 try {
60 db = Db4oFactory.OpenFile("openuser.yap");
61 IObjectSet result = db.Get(typeof(DbUserConfig));
62 if(result.Count==1) {
63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Found a UserConfig object in the local database, loading");
64 foreach (DbUserConfig cfg in result) {
65 this.GridServerURL=cfg.GridServerURL;
66 this.GridSendKey=cfg.GridSendKey;
67 this.GridRecvKey=cfg.GridRecvKey;
68 this.DefaultStartupMsg=cfg.DefaultStartupMsg;
69 }
70 } else {
71 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
72 LoadDefaults();
73 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Writing out default settings to local database");
74 db.Set(this);
75 db.Close();
76 }
77 } catch(Exception e) {
78 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Config.cs:InitConfig() - Exception occured");
79 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString());
80 }
81
82 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"User settings loaded:");
83 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default startup message: " + this.DefaultStartupMsg);
84 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid server URL: " + this.GridServerURL);
85 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to grid: " + this.GridSendKey);
86 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from grid: " + this.GridRecvKey);
87 }
88
89
90 public void Shutdown() {
91 db.Close();
92 }
93 }
94
95}
diff --git a/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj
new file mode 100644
index 0000000..8c4fd39
--- /dev/null
+++ b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj
@@ -0,0 +1,111 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{7E494328-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenUser.Config.UserConfigDb4o</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenUser.Config.UserConfigDb4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data.dll" >
66 <HintPath>..\..\bin\System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 </ItemGroup>
96 <ItemGroup>
97 <Compile Include="AssemblyInfo.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="DbUserConfig.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 </ItemGroup>
104 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
105 <PropertyGroup>
106 <PreBuildEvent>
107 </PreBuildEvent>
108 <PostBuildEvent>
109 </PostBuildEvent>
110 </PropertyGroup>
111</Project>
diff --git a/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build
new file mode 100644
index 0000000..8494a0b
--- /dev/null
+++ b/OpenGridServices-Source/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenUser.Config.UserConfigDb4o" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenUser.Config.UserConfigDb4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="DbUserConfig.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="System.Data.dll.dll" />
24 <include name="System.Xml.dll" />
25 <include name="../../bin/libsecondlife.dll" />
26 <include name="../../bin/Db4objects.Db4o.dll" />
27 <include name="../../bin/OpenSim.Framework.dll" />
28 <include name="../../bin/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenGridServices-Source/SQL/mysql-agents.sql b/OpenGridServices-Source/SQL/mysql-agents.sql
new file mode 100644
index 0000000..8194ca9
--- /dev/null
+++ b/OpenGridServices-Source/SQL/mysql-agents.sql
@@ -0,0 +1,24 @@
1SET FOREIGN_KEY_CHECKS=0;
2-- ----------------------------
3-- Table structure for agents
4-- ----------------------------
5CREATE TABLE `agents` (
6 `UUID` varchar(36) NOT NULL,
7 `sessionID` varchar(36) NOT NULL,
8 `secureSessionID` varchar(36) NOT NULL,
9 `agentIP` varchar(16) NOT NULL,
10 `agentPort` int(11) NOT NULL,
11 `agentOnline` tinyint(4) NOT NULL,
12 `loginTime` int(11) NOT NULL,
13 `logoutTime` int(11) NOT NULL,
14 `currentRegion` varchar(36) NOT NULL,
15 `currentHandle` bigint(20) unsigned NOT NULL,
16 `currentPos` varchar(64) NOT NULL,
17 PRIMARY KEY (`UUID`),
18 UNIQUE KEY `session` (`sessionID`),
19 UNIQUE KEY `ssession` (`secureSessionID`)
20) ENGINE=MyISAM DEFAULT CHARSET=utf8;
21
22-- ----------------------------
23-- Records
24-- ----------------------------
diff --git a/OpenGridServices-Source/SQL/mysql-regions.sql b/OpenGridServices-Source/SQL/mysql-regions.sql
new file mode 100644
index 0000000..5392f7f
--- /dev/null
+++ b/OpenGridServices-Source/SQL/mysql-regions.sql
@@ -0,0 +1,29 @@
1CREATE TABLE `regions` (
2 `uuid` varchar(36) NOT NULL,
3 `regionHandle` bigint(20) unsigned NOT NULL,
4 `regionName` varchar(32) default NULL,
5 `regionRecvKey` varchar(128) default NULL,
6 `regionSendKey` varchar(128) default NULL,
7 `regionSecret` varchar(128) default NULL,
8 `regionDataURI` varchar(255) default NULL,
9 `serverIP` varchar(16) default NULL,
10 `serverPort` int(10) unsigned default NULL,
11 `serverURI` varchar(255) default NULL,
12 `locX` int(10) unsigned default NULL,
13 `locY` int(10) unsigned default NULL,
14 `locZ` int(10) unsigned default NULL,
15 `eastOverrideHandle` bigint(20) unsigned default NULL,
16 `westOverrideHandle` bigint(20) unsigned default NULL,
17 `southOverrideHandle` bigint(20) unsigned default NULL,
18 `northOverrideHandle` bigint(20) unsigned default NULL,
19 `regionAssetURI` varchar(255) default NULL,
20 `regionAssetRecvKey` varchar(128) default NULL,
21 `regionAssetSendKey` varchar(128) default NULL,
22 `regionUserURI` varchar(255) default NULL,
23 `regionUserRecvKey` varchar(128) default NULL,
24 `regionUserSendKey` varchar(128) default NULL,
25 PRIMARY KEY (`uuid`),
26 KEY `regionName` (`regionName`),
27 KEY `regionHandle` (`regionHandle`),
28 KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
29) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED \ No newline at end of file
diff --git a/OpenGridServices-Source/SQL/mysql-users.sql b/OpenGridServices-Source/SQL/mysql-users.sql
new file mode 100644
index 0000000..5ce4d1c
--- /dev/null
+++ b/OpenGridServices-Source/SQL/mysql-users.sql
@@ -0,0 +1,34 @@
1SET FOREIGN_KEY_CHECKS=0;
2-- ----------------------------
3-- Table structure for users
4-- ----------------------------
5CREATE TABLE `users` (
6 `UUID` varchar(36) NOT NULL default '',
7 `username` varchar(32) NOT NULL,
8 `lastname` varchar(32) NOT NULL,
9 `passwordHash` varchar(32) NOT NULL,
10 `passwordSalt` varchar(32) NOT NULL,
11 `homeRegion` bigint(20) unsigned default NULL,
12 `homeLocationX` float default NULL,
13 `homeLocationY` float default NULL,
14 `homeLocationZ` float default NULL,
15 `homeLookAtX` float default NULL,
16 `homeLookAtY` float default NULL,
17 `homeLookAtZ` float default NULL,
18 `created` int(11) NOT NULL,
19 `lastLogin` int(11) NOT NULL,
20 `userInventoryURI` varchar(255) default NULL,
21 `userAssetURI` varchar(255) default NULL,
22 `profileCanDoMask` int(10) unsigned default NULL,
23 `profileWantDoMask` int(10) unsigned default NULL,
24 `profileAboutText` text,
25 `profileFirstText` text,
26 `profileImage` varchar(36) default NULL,
27 `profileFirstImage` varchar(36) default NULL,
28 PRIMARY KEY (`UUID`),
29 UNIQUE KEY `usernames` (`username`,`lastname`)
30) ENGINE=MyISAM DEFAULT CHARSET=utf8;
31
32-- ----------------------------
33-- Records
34-- ----------------------------
diff --git a/OpenGridServices-Source/ServiceManager/ServiceManager.cs b/OpenGridServices-Source/ServiceManager/ServiceManager.cs
new file mode 100644
index 0000000..b21a5b1
--- /dev/null
+++ b/OpenGridServices-Source/ServiceManager/ServiceManager.cs
@@ -0,0 +1,160 @@
1using System;
2using System.Diagnostics;
3using System.Threading;
4using System.ServiceProcess;
5using System.Xml;
6using System.IO;
7
8public class OpenGridMasterService : System.ServiceProcess.ServiceBase {
9
10 private Thread ServiceWorkerThread;
11
12 public OpenGridMasterService()
13 {
14 CanPauseAndContinue = false;
15 ServiceName = "OpenGridServices-master";
16 }
17
18 private void InitializeComponent()
19 {
20 this.CanPauseAndContinue = false;
21 this.CanShutdown = true;
22 this.ServiceName = "OpenGridServices-master";
23 }
24
25 protected override void OnStart(string[] args)
26 {
27 ServiceWorkerThread = new Thread(new ThreadStart(MainServiceThread));
28 ServiceWorkerThread.Start();
29 }
30
31 protected override void OnStop()
32 {
33 ServiceWorkerThread.Abort();
34 }
35
36 private void MainServiceThread()
37 {
38 try {
39 StreamReader reader=new StreamReader("opengrid-master-cfg.xml");
40
41 string configxml = reader.ReadToEnd();
42 XmlDocument doc = new XmlDocument();
43 doc.LoadXml(configxml);
44 XmlNode rootnode = doc.FirstChild;
45 if (rootnode.Name != "regions")
46 {
47 EventLog.WriteEntry("ERROR! bad XML in opengrid-master-cfg.xml - expected regions tag");
48 Console.WriteLine("Sorry, could not startup the service - please check your opengrid-master-cfg.xml file: missing regions tag");
49 (new ServiceController("OpenGridServices-master")).Stop();
50 }
51
52 for(int i=0; i<=rootnode.ChildNodes.Count; i++)
53 {
54 if(rootnode.ChildNodes.Item(i).Name != "region") {
55 EventLog.WriteEntry("nonfatal error - unexpected tag inside regions block of opengrid-master-cfg.xml");
56 (new ServiceController("OpenGridServices-master")).Stop();
57 }
58 }
59 } catch(Exception e) {
60 Console.WriteLine(e.ToString());
61 (new ServiceController("OpenGridServices-master")).Stop();
62 }
63
64 }
65
66 private static string SetupGrid()
67 {
68 Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server");
69 Process p = new Process();
70
71 p.StartInfo.Arguments = "-setuponly";
72 p.StartInfo.FileName = "OpenGridServices.GridServer.exe";
73 p.Start();
74
75 return "<gridserver />"; // we let the gridserver handle it's own setup
76 }
77
78 private static string SetupUser()
79 {
80 return "<user></user>";
81 }
82
83 private static string SetupAsset()
84 {
85 return "<asset></asset>";
86 }
87
88 private static string SetupRegion()
89 {
90 return "<regions></regions>";
91 }
92
93 public static void InitSetup()
94 {
95 string choice="";
96
97 string GridInfo;
98 string UserInfo;
99 string AssetInfo;
100 string RegionInfo;
101
102 bool grid=false;
103 bool user=false;
104 bool asset=false;
105 bool region=false;
106 while(choice!="OK")
107 {
108 Console.Clear();
109 Console.WriteLine("Please select the components you would like to run on this server:\n");
110
111 Console.WriteLine("1 - [" + (grid ? "X" : " ") + "] Grid server - this service handles co-ordinates of regions/sims on the grid");
112 Console.WriteLine("2 - [" + (user ? "X" : " ") + "] User server - this service handles user login, profiles, inventory and IM");
113 Console.WriteLine("3 - [" + (asset ? "X" : " ") + "] Asset server - this service handles storage of assets such as textures, objects, sounds, scripts");
114 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");
115
116
117 Console.Write("Type a number to toggle a choice or type OK to accept your current choices: ");
118 choice = Console.ReadLine();
119 switch(choice)
120 {
121 case "1":
122 grid = (!grid);
123 break;
124
125 case "2":
126 user = (!user);
127 break;
128
129 case "3":
130 asset = (!asset);
131 break;
132
133 case "4":
134 region = (!region);
135 break;
136 }
137 }
138
139 if(grid) GridInfo = SetupGrid();
140 if(user) UserInfo = SetupUser();
141 if(asset) AssetInfo = SetupAsset();
142 if(region) RegionInfo = SetupRegion();
143 }
144
145 public static void Main()
146 {
147 if(!File.Exists("opengrid-master-cfg.xml"))
148 {
149 Console.WriteLine("Could not find a config file, running initial setup");
150 InitSetup();
151 }
152 Console.WriteLine("Starting up OGS master service");
153 try {
154 ServiceBase.Run(new OpenGridMasterService());
155 } catch(Exception e) {
156 Console.WriteLine("THIS SHOULD NEVER HAPPEN!!!!!!!!!!!!!!!!!!!!!");
157 Console.WriteLine(e.ToString());
158 }
159 }
160}
diff --git a/OpenGridServices-Source/ServiceManager/ServiceManager.csproj b/OpenGridServices-Source/ServiceManager/ServiceManager.csproj
new file mode 100644
index 0000000..ac118c3
--- /dev/null
+++ b/OpenGridServices-Source/ServiceManager/ServiceManager.csproj
@@ -0,0 +1,95 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon>
10 </ApplicationIcon>
11 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName>
13 <AssemblyName>ServiceManager</AssemblyName>
14 <DefaultClientScript>JScript</DefaultClientScript>
15 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <DelaySign>false</DelaySign>
18 <OutputType>Exe</OutputType>
19 <AppDesignerFolder>
20 </AppDesignerFolder>
21 <RootNamespace>ServiceManager</RootNamespace>
22 <StartupObject>
23 </StartupObject>
24 <FileUpgradeFlags>
25 </FileUpgradeFlags>
26 </PropertyGroup>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
29 <BaseAddress>285212672</BaseAddress>
30 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
31 <ConfigurationOverrideFile>
32 </ConfigurationOverrideFile>
33 <DefineConstants>TRACE;DEBUG</DefineConstants>
34 <DocumentationFile>
35 </DocumentationFile>
36 <DebugSymbols>True</DebugSymbols>
37 <FileAlignment>4096</FileAlignment>
38 <Optimize>False</Optimize>
39 <OutputPath>..\bin\</OutputPath>
40 <RegisterForComInterop>False</RegisterForComInterop>
41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <WarningLevel>4</WarningLevel>
44 <NoWarn>
45 </NoWarn>
46 </PropertyGroup>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
49 <BaseAddress>285212672</BaseAddress>
50 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
51 <ConfigurationOverrideFile>
52 </ConfigurationOverrideFile>
53 <DefineConstants>TRACE</DefineConstants>
54 <DocumentationFile>
55 </DocumentationFile>
56 <DebugSymbols>False</DebugSymbols>
57 <FileAlignment>4096</FileAlignment>
58 <Optimize>True</Optimize>
59 <OutputPath>..\bin\</OutputPath>
60 <RegisterForComInterop>False</RegisterForComInterop>
61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
63 <WarningLevel>4</WarningLevel>
64 <NoWarn>
65 </NoWarn>
66 </PropertyGroup>
67 <ItemGroup>
68 <Reference Include="System">
69 <HintPath>System.dll</HintPath>
70 <Private>False</Private>
71 </Reference>
72 <Reference Include="System.ServiceProcess">
73 <HintPath>System.ServiceProcess.dll</HintPath>
74 <Private>False</Private>
75 </Reference>
76 <Reference Include="System.Xml">
77 <HintPath>System.Xml.dll</HintPath>
78 <Private>False</Private>
79 </Reference>
80 </ItemGroup>
81 <ItemGroup>
82 </ItemGroup>
83 <ItemGroup>
84 <Compile Include="ServiceManager.cs">
85 <SubType>Component</SubType>
86 </Compile>
87 </ItemGroup>
88 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
89 <PropertyGroup>
90 <PreBuildEvent>
91 </PreBuildEvent>
92 <PostBuildEvent>
93 </PostBuildEvent>
94 </PropertyGroup>
95</Project> \ No newline at end of file
diff --git a/OpenGridServices-Source/ServiceManager/ServiceManager.csproj.user b/OpenGridServices-Source/ServiceManager/ServiceManager.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices-Source/ServiceManager/ServiceManager.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/ServiceManager/ServiceManager.exe.build b/OpenGridServices-Source/ServiceManager/ServiceManager.exe.build
new file mode 100644
index 0000000..7397f49
--- /dev/null
+++ b/OpenGridServices-Source/ServiceManager/ServiceManager.exe.build
@@ -0,0 +1,41 @@
1<?xml version="1.0" ?>
2<project name="ServiceManager" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="ServiceManager" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="ServiceManager.cs" />
15 </sources>
16 <references basedir="${project::get-base-directory()}">
17 <lib>
18 <include name="${project::get-base-directory()}" />
19 <include name="${project::get-base-directory()}/${build.dir}" />
20 </lib>
21 <include name="System.dll" />
22 <include name="System.ServiceProcess.dll" />
23 <include name="System.Xml.dll" />
24 </references>
25 </csc>
26 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
27 <mkdir dir="${project::get-base-directory()}/../bin/"/>
28 <copy todir="${project::get-base-directory()}/../bin/">
29 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
30 <include name="*.dll"/>
31 <include name="*.exe"/>
32 </fileset>
33 </copy>
34 </target>
35 <target name="clean">
36 <delete dir="${bin.dir}" failonerror="false" />
37 <delete dir="${obj.dir}" failonerror="false" />
38 </target>
39 <target name="doc" description="Creates documentation.">
40 </target>
41</project>