aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices.build100
-rw-r--r--OpenGridServices.sln85
-rw-r--r--OpenGridServices.suobin0 -> 137216 bytes
-rw-r--r--OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs31
-rw-r--r--OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs112
-rw-r--r--OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj107
-rw-r--r--OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build46
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs83
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs111
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs100
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj111
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build47
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs136
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs171
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj104
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build45
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs201
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs270
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs153
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj111
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build47
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj108
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build46
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs136
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs172
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/GridData.cs83
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs73
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj107
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build47
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs35
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs84
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/UserData.cs101
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs54
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs76
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs50
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj99
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build44
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/AssetHttpServer.cs92
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/Main.cs337
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj125
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user12
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build50
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj126
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build49
-rw-r--r--OpenGridServices/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/GridManager.cs474
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/Main.cs272
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj134
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user12
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build52
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.mds16
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.userprefs39
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.usertasks2
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs32
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs33
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs16
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs29
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs106
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs96
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs76
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp43
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidbbin0 -> 12308 bytes
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs37
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs133
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs226
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs256
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs35
-rw-r--r--OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic502
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/Main.cs217
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj63
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj128
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user12
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build51
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/UserManager.cs597
-rw-r--r--OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs31
-rw-r--r--OpenGridServices/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs95
-rw-r--r--OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj107
-rw-r--r--OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user12
-rw-r--r--OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build46
-rw-r--r--OpenGridServices/SQL/mysql-agents.sql24
-rw-r--r--OpenGridServices/SQL/mysql-regions.sql29
-rw-r--r--OpenGridServices/SQL/mysql-users.sql34
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.cs160
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.csproj95
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.csproj.user12
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.exe.build41
99 files changed, 8975 insertions, 0 deletions
diff --git a/OpenGridServices.build b/OpenGridServices.build
new file mode 100644
index 0000000..d240dc0
--- /dev/null
+++ b/OpenGridServices.build
@@ -0,0 +1,100 @@
1<?xml version="1.0" ?>
2<project name="OpenGridServices" default="build">
3 <echo message="Using '${nant.settings.currentframework}' Framework"/>
4
5 <property name="bin.dir" value="bin" />
6 <property name="obj.dir" value="obj" />
7 <property name="doc.dir" value="doc" />
8 <property name="project.main.dir" value="${project::get-base-directory()}" />
9
10 <target name="Debug" description="">
11 <property name="project.config" value="Debug" />
12 <property name="build.debug" value="true" />
13 </target>
14
15 <property name="project.config" value="Release" />
16
17 <target name="Release" description="">
18 <property name="project.config" value="Release" />
19 <property name="build.debug" value="false" />
20 </target>
21
22 <target name="net-1.1" description="Sets framework to .NET 1.1">
23 <property name="nant.settings.currentframework" value="net-1.1" />
24 </target>
25
26 <target name="net-2.0" description="Sets framework to .NET 2.0">
27 <property name="nant.settings.currentframework" value="net-2.0" />
28 </target>
29
30 <target name="mono-2.0" description="Sets framework to mono 2.0">
31 <property name="nant.settings.currentframework" value="mono-2.0" />
32 </target>
33
34 <target name="mono-1.0" description="Sets framework to mono 1.0">
35 <property name="nant.settings.currentframework" value="mono-1.0" />
36 </target>
37
38 <target name="init" description="">
39 <call target="${project.config}" />
40 <sysinfo />
41 <echo message="Platform ${sys.os.platform}" />
42 <property name="build.dir" value="${bin.dir}/${project.config}" />
43 </target>
44
45 <target name="clean" description="">
46 <echo message="Deleting all builds from all configurations" />
47 <delete dir="${bin.dir}" failonerror="false" />
48 <delete dir="${obj.dir}" failonerror="false" />
49 <nant buildfile="OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="clean" />
50 <nant buildfile="OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="clean" />
51 <nant buildfile="OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="clean" />
52 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build" target="clean" />
53 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build" target="clean" />
54 <nant buildfile="OpenGridServices/ServiceManager/ServiceManager.exe.build" target="clean" />
55 <nant buildfile="OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build" target="clean" />
56 <nant buildfile="OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="clean" />
57 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build" target="clean" />
58 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build" target="clean" />
59 <nant buildfile="OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="clean" />
60 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build" target="clean" />
61 </target>
62
63 <target name="build" depends="init" description="">
64 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build" target="build" />
65 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build" target="build" />
66 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build" target="build" />
67 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build" target="build" />
68 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build" target="build" />
69 <nant buildfile="OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build" target="build" />
70 <nant buildfile="OpenGridServices/ServiceManager/ServiceManager.exe.build" target="build" />
71 <nant buildfile="OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="build" />
72 <nant buildfile="OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="build" />
73 <nant buildfile="OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="build" />
74 <nant buildfile="OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="build" />
75 <nant buildfile="OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="build" />
76 </target>
77
78 <target name="build-release" depends="Release, init, build" description="Builds in Release mode" />
79
80 <target name="build-debug" depends="Debug, init, build" description="Builds in Debug mode" />
81
82 <target name="package" depends="clean, doc" description="Builds all" />
83
84 <target name="doc" depends="build-release">
85 <echo message="Generating all documentation from all builds" />
86 <nant buildfile="OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="doc" />
87 <nant buildfile="OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="doc" />
88 <nant buildfile="OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="doc" />
89 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build" target="doc" />
90 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build" target="doc" />
91 <nant buildfile="OpenGridServices/ServiceManager/ServiceManager.exe.build" target="doc" />
92 <nant buildfile="OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build" target="doc" />
93 <nant buildfile="OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="doc" />
94 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build" target="doc" />
95 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build" target="doc" />
96 <nant buildfile="OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="doc" />
97 <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build" target="doc" />
98 </target>
99
100</project>
diff --git a/OpenGridServices.sln b/OpenGridServices.sln
new file mode 100644
index 0000000..bc21256
--- /dev/null
+++ b/OpenGridServices.sln
@@ -0,0 +1,85 @@
1Microsoft Visual Studio Solution File, Format Version 9.00
2# Visual C# Express 2005
3Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenUser.Config.UserConfigDb4o", "OpenGridServices\OpenUser.Config\UserConfigDb4o\OpenUser.Config.UserConfigDb4o.csproj", "{7E494328-0000-0000-0000-000000000000}"
4EndProject
5Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.AssetServer", "OpenGridServices\OpenGridServices.AssetServer\OpenGridServices.AssetServer.csproj", "{0021261B-0000-0000-0000-000000000000}"
6EndProject
7Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Config.GridConfigDb4o", "OpenGridServices\OpenGrid.Config\GridConfigDb4o\OpenGrid.Config.GridConfigDb4o.csproj", "{B0027747-0000-0000-0000-000000000000}"
8EndProject
9Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.SQLite", "OpenGridServices\OpenGrid.Framework.Data.SQLite\OpenGrid.Framework.Data.SQLite.csproj", "{1E3F341A-0000-0000-0000-000000000000}"
10EndProject
11Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.DB4o", "OpenGridServices\OpenGrid.Framework.Data.DB4o\OpenGrid.Framework.Data.DB4o.csproj", "{39BD9497-0000-0000-0000-000000000000}"
12EndProject
13Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceManager", "OpenGridServices\ServiceManager\ServiceManager.csproj", "{E141F4EE-0000-0000-0000-000000000000}"
14EndProject
15Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Manager", "OpenGridServices\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj", "{7924FD35-0000-0000-0000-000000000000}"
16EndProject
17Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.GridServer", "OpenGridServices\OpenGridServices.GridServer\OpenGridServices.GridServer.csproj", "{21BFC8E2-0000-0000-0000-000000000000}"
18EndProject
19Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.MSSQL", "OpenGridServices\OpenGrid.Framework.Data.MSSQL\OpenGrid.Framework.Data.MSSQL.csproj", "{0A563AC1-0000-0000-0000-000000000000}"
20EndProject
21Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data", "OpenGridServices\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj", "{62CDF671-0000-0000-0000-000000000000}"
22EndProject
23Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.UserServer", "OpenGridServices\OpenGridServices.UserServer\OpenGridServices.UserServer.csproj", "{66591469-0000-0000-0000-000000000000}"
24EndProject
25Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.MySQL", "OpenGridServices\OpenGrid.Framework.Data.MySQL\OpenGrid.Framework.Data.MySQL.csproj", "{0F3C3AC1-0000-0000-0000-000000000000}"
26EndProject
27Global
28 GlobalSection(SolutionConfigurationPlatforms) = preSolution
29 Debug|Any CPU = Debug|Any CPU
30 Release|Any CPU = Release|Any CPU
31 EndGlobalSection
32 GlobalSection(ProjectConfigurationPlatforms) = postSolution
33 {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34 {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
35 {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
36 {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
37 {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38 {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
39 {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
40 {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
41 {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42 {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
43 {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
44 {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
45 {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46 {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
47 {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
48 {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
49 {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50 {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
51 {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
52 {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
53 {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54 {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
55 {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
56 {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
57 {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58 {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
59 {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
60 {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
61 {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62 {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
63 {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
64 {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
65 {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66 {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
67 {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
68 {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
69 {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
70 {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
71 {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
72 {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
73 {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74 {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
75 {66591469-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
76 {66591469-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
77 {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78 {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
79 {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
80 {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
81 EndGlobalSection
82 GlobalSection(SolutionProperties) = preSolution
83 HideSolutionNode = FALSE
84 EndGlobalSection
85EndGlobal
diff --git a/OpenGridServices.suo b/OpenGridServices.suo
new file mode 100644
index 0000000..9a93215
--- /dev/null
+++ b/OpenGridServices.suo
Binary files differ
diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..b5065bc
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
new file mode 100644
index 0000000..2d00ca6
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
new file mode 100644
index 0000000..744e1e8
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
@@ -0,0 +1,107 @@
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 <Reference Include="OpenSim.Framework" >
82 <HintPath>OpenSim.Framework.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 <Reference Include="OpenSim.Framework.Console" >
86 <HintPath>OpenSim.Framework.Console.dll</HintPath>
87 <Private>False</Private>
88 </Reference>
89 </ItemGroup>
90 <ItemGroup>
91 </ItemGroup>
92 <ItemGroup>
93 <Compile Include="AssemblyInfo.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="DbGridConfig.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 </ItemGroup>
100 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
101 <PropertyGroup>
102 <PreBuildEvent>
103 </PreBuildEvent>
104 <PostBuildEvent>
105 </PostBuildEvent>
106 </PropertyGroup>
107</Project>
diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build
new file mode 100644
index 0000000..cbc8479
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
new file mode 100644
index 0000000..546713e
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
new file mode 100644
index 0000000..1606765
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
@@ -0,0 +1,111 @@
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 Console.WriteLine("adding profile to database" + row.username);
86 if (userProfiles.ContainsKey(row.UUID))
87 {
88 userProfiles[row.UUID] = row;
89 }
90 else
91 {
92 userProfiles.Add(row.UUID, row);
93 }
94
95 try
96 {
97 IObjectContainer database;
98 database = Db4oFactory.OpenFile(dbfl);
99 database.Set(row);
100 database.Close();
101 return true;
102 }
103 catch (Exception e)
104 {
105 return false;
106 }
107 }
108
109
110 }
111}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
new file mode 100644
index 0000000..b95219c
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
@@ -0,0 +1,100 @@
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 void addNewUserProfile(UserProfileData user)
70 {
71 manager.AddRow(user);
72 }
73
74 public void addNewUserAgent(UserAgentData agent)
75 {
76 // Do nothing. yet.
77 }
78
79 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
80 {
81 return true;
82 }
83
84 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
85 {
86 return true;
87 }
88
89
90 public string getName()
91 {
92 return "DB4o Userdata";
93 }
94
95 public string getVersion()
96 {
97 return "0.1";
98 }
99 }
100}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj
new file mode 100644
index 0000000..82d4f5f
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build
new file mode 100644
index 0000000..8e0f53a
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dc4a9a1
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
new file mode 100644
index 0000000..0925df1
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
new file mode 100644
index 0000000..12c166c
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj
new file mode 100644
index 0000000..8d53692
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build
new file mode 100644
index 0000000..5b6b75b
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bbe3cdf
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
new file mode 100644
index 0000000..6ac8cc3
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
@@ -0,0 +1,201 @@
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 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
18 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
19 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
20 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
21 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
22 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
23 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
24
25 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
26 }
27
28 /// <summary>
29 /// Shuts down the grid interface
30 /// </summary>
31 public void Close()
32 {
33 database.Close();
34 }
35
36 public string getName()
37 {
38 return "MySql OpenGridData";
39 }
40
41 public string getVersion()
42 {
43 return "0.1";
44 }
45
46 public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
47 {
48 try
49 {
50 lock (database)
51 {
52 Dictionary<string, string> param = new Dictionary<string, string>();
53 param["?xmin"] = xmin.ToString();
54 param["?ymin"] = ymin.ToString();
55 param["?xmax"] = xmax.ToString();
56 param["?ymax"] = ymax.ToString();
57
58 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
59 System.Data.IDataReader reader = result.ExecuteReader();
60
61 SimProfileData row;
62
63 List<SimProfileData> rows = new List<SimProfileData>();
64
65 while ((row = database.getSimRow(reader)) != null)
66 {
67 rows.Add(row);
68 }
69 reader.Close();
70 result.Dispose();
71
72 return rows.ToArray();
73
74 }
75 }
76 catch (Exception e)
77 {
78 Console.WriteLine(e.ToString());
79 return null;
80 }
81 }
82
83 /// <summary>
84 /// Returns a sim profile from it's location
85 /// </summary>
86 /// <param name="handle">Region location handle</param>
87 /// <returns>Sim profile</returns>
88 public SimProfileData GetProfileByHandle(ulong handle)
89 {
90 try
91 {
92 lock (database)
93 {
94 Dictionary<string, string> param = new Dictionary<string, string>();
95 param["?handle"] = handle.ToString();
96
97 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
98 System.Data.IDataReader reader = result.ExecuteReader();
99
100 SimProfileData row = database.getSimRow(reader);
101 reader.Close();
102 result.Dispose();
103
104 return row;
105 }
106 }
107 catch (Exception e)
108 {
109 Console.WriteLine(e.ToString());
110 return null;
111 }
112 }
113
114 /// <summary>
115 /// Returns a sim profile from it's UUID
116 /// </summary>
117 /// <param name="uuid">The region UUID</param>
118 /// <returns>The sim profile</returns>
119 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
120 {
121 try
122 {
123 lock (database)
124 {
125 Dictionary<string, string> param = new Dictionary<string, string>();
126 param["?uuid"] = uuid.ToStringHyphenated();
127
128 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
129 System.Data.IDataReader reader = result.ExecuteReader();
130
131 SimProfileData row = database.getSimRow(reader);
132 reader.Close();
133 result.Dispose();
134
135 return row;
136 }
137 }
138 catch (Exception e)
139 {
140 Console.WriteLine(e.ToString());
141 return null;
142 }
143 }
144
145 public DataResponse AddProfile(SimProfileData profile)
146 {
147 lock (database)
148 {
149 if (database.insertRow(profile))
150 {
151 return DataResponse.RESPONSE_OK;
152 }
153 else
154 {
155 return DataResponse.RESPONSE_ERROR;
156 }
157 }
158 }
159
160 /// <summary>
161 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
162 /// </summary>
163 /// <param name="uuid">The UUID of the challenger</param>
164 /// <param name="handle">The attempted regionHandle of the challenger</param>
165 /// <param name="authkey">The secret</param>
166 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
167 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
168 {
169 bool throwHissyFit = false; // Should be true by 1.0
170
171 if (throwHissyFit)
172 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
173
174 SimProfileData data = GetProfileByLLUUID(uuid);
175
176 return (handle == data.regionHandle && authkey == data.regionSecret);
177 }
178
179 /// <summary>
180 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
181 /// </summary>
182 /// <remarks>This requires a security audit.</remarks>
183 /// <param name="uuid"></param>
184 /// <param name="handle"></param>
185 /// <param name="authhash"></param>
186 /// <param name="challenge"></param>
187 /// <returns></returns>
188 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
189 {
190 System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
191 System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
192
193 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
194 byte[] hash = HashProvider.ComputeHash(stream);
195
196 return false;
197 }
198 }
199
200
201}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
new file mode 100644
index 0000000..ea7e2ac
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -0,0 +1,270 @@
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, string port)
29 {
30 try
31 {
32 string connectionString = "Server=" + hostname + ";Port=" + port + ";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, regionMapTexture) 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, ?regionMapTexture);";
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 parameters["?regionMapTexture"] = profile.regionMapTextureID.ToStringHyphenated();
246
247 bool returnval = false;
248
249 try
250 {
251
252 IDbCommand result = Query(sql, parameters);
253
254 //Console.WriteLine(result.CommandText);
255
256 if (result.ExecuteNonQuery() == 1)
257 returnval = true;
258
259 result.Dispose();
260 }
261 catch (Exception e)
262 {
263 Console.WriteLine(e.ToString());
264 return false;
265 }
266
267 return returnval;
268 }
269 }
270}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
new file mode 100644
index 0000000..57dbfc6
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
@@ -0,0 +1,153 @@
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 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
16 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
17 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
18 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
19 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
20 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
21 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
22
23 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
24 }
25
26 public UserProfileData getUserByName(string name)
27 {
28 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
29 }
30
31 public UserProfileData getUserByName(string user, string last)
32 {
33 try
34 {
35 lock (database)
36 {
37 Dictionary<string, string> param = new Dictionary<string, string>();
38 param["?first"] = user;
39 param["?second"] = last;
40
41 System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
42 System.Data.IDataReader reader = result.ExecuteReader();
43
44 UserProfileData row = database.getUserRow(reader);
45
46 reader.Close();
47 result.Dispose();
48
49 return row;
50 }
51 }
52 catch (Exception e)
53 {
54 Console.WriteLine(e.ToString());
55 return null;
56 }
57 }
58
59 public UserProfileData getUserByUUID(LLUUID uuid)
60 {
61 try
62 {
63 lock (database)
64 {
65 Dictionary<string, string> param = new Dictionary<string, string>();
66 param["?uuid"] = uuid.ToStringHyphenated();
67
68 System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
69 System.Data.IDataReader reader = result.ExecuteReader();
70
71 UserProfileData row = database.getUserRow(reader);
72
73 reader.Close();
74 result.Dispose();
75
76 return row;
77 }
78 }
79 catch (Exception e)
80 {
81 Console.WriteLine(e.ToString());
82 return null;
83 }
84 }
85
86 public UserAgentData getAgentByName(string name)
87 {
88 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
89 }
90
91 public UserAgentData getAgentByName(string user, string last)
92 {
93 UserProfileData profile = getUserByName(user, last);
94 return getAgentByUUID(profile.UUID);
95 }
96
97 public UserAgentData getAgentByUUID(LLUUID uuid)
98 {
99 try
100 {
101 lock (database)
102 {
103 Dictionary<string, string> param = new Dictionary<string, string>();
104 param["?uuid"] = uuid.ToStringHyphenated();
105
106 System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
107 System.Data.IDataReader reader = result.ExecuteReader();
108
109 UserAgentData row = database.getAgentRow(reader);
110
111 reader.Close();
112 result.Dispose();
113
114 return row;
115 }
116 }
117 catch (Exception e)
118 {
119 Console.WriteLine(e.ToString());
120 return null;
121 }
122 }
123
124 public void addNewUserProfile(UserProfileData user)
125 {
126 }
127
128 public void addNewUserAgent(UserAgentData agent)
129 {
130 // Do nothing.
131 }
132
133 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
134 {
135 return false;
136 }
137
138 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
139 {
140 return false;
141 }
142
143 public string getName()
144 {
145 return "MySQL Userdata Interface";
146 }
147
148 public string getVersion()
149 {
150 return "0.1";
151 }
152 }
153}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj
new file mode 100644
index 0000000..9a1703a
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build
new file mode 100644
index 0000000..2d425b4
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0bfd1d6
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj
new file mode 100644
index 0000000..463cf86
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build
new file mode 100644
index 0000000..1be9b43
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..57c4bae
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs
new file mode 100644
index 0000000..4850f12
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs
new file mode 100644
index 0000000..408a582
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data/GridData.cs b/OpenGridServices/OpenGrid.Framework.Data/GridData.cs
new file mode 100644
index 0000000..6dad37e
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data/IniConfig.cs b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs
new file mode 100644
index 0000000..58597d2
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs
@@ -0,0 +1,73 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5using System.Text.RegularExpressions;
6
7/*
8 Taken from public code listing at by Alex Pinsker
9 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
10 */
11
12namespace OpenGrid.Framework.Data
13{
14 /// <summary>
15 /// Parse settings from ini-like files
16 /// </summary>
17 public class IniFile
18 {
19 static IniFile()
20 {
21 _iniKeyValuePatternRegex = new Regex(
22 @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]*
23 # key part (surrounding whitespace stripped)
24 \=
25 (\s)*(?<Value>([^\n^\s]+(\n){0,1})))
26 # value part (surrounding whitespace stripped)
27 ",
28 RegexOptions.IgnorePatternWhitespace |
29 RegexOptions.Compiled |
30 RegexOptions.CultureInvariant);
31 }
32 static private Regex _iniKeyValuePatternRegex;
33
34 public IniFile(string iniFileName)
35 {
36 _iniFileName = iniFileName;
37 }
38
39 public string ParseFileReadValue(string key)
40 {
41 using (StreamReader reader =
42 new StreamReader(_iniFileName))
43 {
44 do
45 {
46 string line = reader.ReadLine();
47 Match match =
48 _iniKeyValuePatternRegex.Match(line);
49 if (match.Success)
50 {
51 string currentKey =
52 match.Groups["Key"].Value as string;
53 if (currentKey != null &&
54 currentKey.Trim().CompareTo(key) == 0)
55 {
56 string value =
57 match.Groups["Value"].Value as string;
58 return value;
59 }
60 }
61
62 }
63 while (reader.Peek() != -1);
64 }
65 return null;
66 }
67
68 public string IniFileName
69 {
70 get { return _iniFileName; }
71 } private string _iniFileName;
72 }
73}
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj
new file mode 100644
index 0000000..b033c6c
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj
@@ -0,0 +1,107 @@
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="IniConfig.cs">
85 <SubType>Code</SubType>
86 </Compile>
87 <Compile Include="SimProfileData.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="UserData.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="UserProfileData.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="Properties\AssemblyInfo.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 </ItemGroup>
100 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
101 <PropertyGroup>
102 <PreBuildEvent>
103 </PreBuildEvent>
104 <PostBuildEvent>
105 </PostBuildEvent>
106 </PropertyGroup>
107</Project>
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build
new file mode 100644
index 0000000..281295f
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build
@@ -0,0 +1,47 @@
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="IniConfig.cs" />
16 <include name="SimProfileData.cs" />
17 <include name="UserData.cs" />
18 <include name="UserProfileData.cs" />
19 <include name="Properties/AssemblyInfo.cs" />
20 </sources>
21 <references basedir="${project::get-base-directory()}">
22 <lib>
23 <include name="${project::get-base-directory()}" />
24 <include name="${project::get-base-directory()}/${build.dir}" />
25 </lib>
26 <include name="System.dll" />
27 <include name="System.Xml.dll" />
28 <include name="System.Data.dll" />
29 <include name="../../bin/libsecondlife.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/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1446673
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data/SimProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs
new file mode 100644
index 0000000..c66610e
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Data/UserData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs
new file mode 100644
index 0000000..4802c5f
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs
@@ -0,0 +1,101 @@
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 /// Adds a new User profile to the database
56 /// </summary>
57 /// <param name="user">UserProfile to add</param>
58 void addNewUserProfile(UserProfileData user);
59
60 /// <summary>
61 /// Adds a new agent to the database
62 /// </summary>
63 /// <param name="agent">The agent to add</param>
64 void addNewUserAgent(UserAgentData agent);
65
66 /// <summary>
67 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
68 /// </summary>
69 /// <param name="from">The account to transfer from</param>
70 /// <param name="to">The account to transfer to</param>
71 /// <param name="amount">The amount to transfer</param>
72 /// <returns>Successful?</returns>
73 bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount);
74
75 /// <summary>
76 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
77 /// </summary>
78 /// <param name="from">User to transfer from</param>
79 /// <param name="to">User to transfer to</param>
80 /// <param name="inventory">Specified inventory item</param>
81 /// <returns>Successful?</returns>
82 bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
83
84 /// <summary>
85 /// Returns the plugin version
86 /// </summary>
87 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
88 string getVersion();
89
90 /// <summary>
91 /// Returns the plugin name
92 /// </summary>
93 /// <returns>Plugin name, eg MySQL User Provider</returns>
94 string getName();
95
96 /// <summary>
97 /// Initialises the plugin (artificial constructor)
98 /// </summary>
99 void Initialise();
100 }
101}
diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs
new file mode 100644
index 0000000..3f42762
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Manager/GridManagementAgent.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
new file mode 100644
index 0000000..f4483fb
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
@@ -0,0 +1,76 @@
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
11 public delegate void GridManagerCallback(string param);
12
13 public class GridManagementAgent
14 {
15
16 private GridManagerCallback thecallback;
17 private string sendkey;
18 private string recvkey;
19 private string component_type;
20
21 private static ArrayList Sessions;
22
23 public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
24 {
25 this.sendkey = sendkey;
26 this.recvkey = recvkey;
27 this.component_type = component_type;
28 this.thecallback = thecallback;
29 Sessions = new ArrayList();
30
31 app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod);
32
33 switch (component_type)
34 {
35 case "gridserver":
36 GridServerManager.sendkey = this.sendkey;
37 GridServerManager.recvkey = this.recvkey;
38 GridServerManager.thecallback = thecallback;
39 app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
40 break;
41 }
42 }
43
44 public static bool SessionExists(LLUUID sessionID)
45 {
46 return Sessions.Contains(sessionID);
47 }
48
49 public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
50 {
51 XmlRpcResponse response = new XmlRpcResponse();
52 Hashtable requestData = (Hashtable)request.Params[0];
53 Hashtable responseData = new Hashtable();
54
55 // TODO: Switch this over to using OpenGrid.Framework.Data
56 if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
57 {
58 response.IsFault = false;
59 LLUUID new_session = LLUUID.Random();
60 Sessions.Add(new_session);
61 responseData["session_id"] = new_session.ToString();
62 responseData["msg"] = "Login OK";
63 }
64 else
65 {
66 response.IsFault = true;
67 responseData["error"] = "Invalid username or password";
68 }
69
70 response.Value = responseData;
71 return response;
72
73 }
74
75 }
76}
diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs
new file mode 100644
index 0000000..7ebf66a
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj
new file mode 100644
index 0000000..ea7548a
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj
@@ -0,0 +1,99 @@
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="OpenSim.Framework" >
66 <HintPath>OpenSim.Framework.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="OpenSim.Servers" >
70 <HintPath>OpenSim.Servers.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="XMLRPC" >
78 <HintPath>XMLRPC.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 </ItemGroup>
84 <ItemGroup>
85 <Compile Include="GridManagementAgent.cs">
86 <SubType>Code</SubType>
87 </Compile>
88 <Compile Include="GridServerManager.cs">
89 <SubType>Code</SubType>
90 </Compile>
91 </ItemGroup>
92 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
93 <PropertyGroup>
94 <PreBuildEvent>
95 </PreBuildEvent>
96 <PostBuildEvent>
97 </PostBuildEvent>
98 </PropertyGroup>
99</Project>
diff --git a/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build
new file mode 100644
index 0000000..f8cc80e
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.AssetServer/AssetHttpServer.cs b/OpenGridServices/OpenGridServices.AssetServer/AssetHttpServer.cs
new file mode 100644
index 0000000..8439e92
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.AssetServer/Main.cs b/OpenGridServices/OpenGridServices.AssetServer/Main.cs
new file mode 100644
index 0000000..adbf18b
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.AssetServer/Main.cs
@@ -0,0 +1,337 @@
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.Servers;
45using Db4objects.Db4o;
46using Db4objects.Db4o.Query;
47
48namespace OpenGridServices.AssetServer
49{
50 /// <summary>
51 /// </summary>
52 public class OpenAsset_Main : BaseServer, conscmd_callback
53 {
54 private IObjectContainer db;
55
56 public static OpenAsset_Main assetserver;
57
58 private ConsoleBase m_console;
59
60 [STAThread]
61 public static void Main(string[] args)
62 {
63 Console.WriteLine("Starting...\n");
64
65 assetserver = new OpenAsset_Main();
66 assetserver.Startup();
67
68 assetserver.Work();
69 }
70
71 private void Work()
72 {
73 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "\nEnter help for a list of commands\n");
74
75 while (true)
76 {
77 m_console.MainConsolePrompt();
78 }
79 }
80
81 private OpenAsset_Main()
82 {
83 m_console = new ConsoleBase("opengrid-AssetServer-console.log", "OpenGrid", this, false);
84 MainConsole.Instance = m_console;
85 }
86
87 public void Startup()
88 {
89 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Setting up asset DB");
90 setupDB();
91
92 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP process");
93 AssetHttpServer httpServer = new AssetHttpServer(8003);
94
95
96 httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);
97 httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod);
98
99 httpServer.Start();
100
101 }
102
103 public string assetPostMethod(string requestBody, string path, string param)
104 {
105 AssetBase asset = new AssetBase();
106 asset.Name = "";
107 asset.FullID = new LLUUID(param);
108 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
109 byte[] buffer = Windows1252Encoding.GetBytes(requestBody);
110 asset.Data = buffer;
111 AssetStorage store = new AssetStorage();
112 store.Data = asset.Data;
113 store.Name = asset.Name;
114 store.UUID = asset.FullID;
115 db.Set(store);
116 db.Commit();
117 return "";
118 }
119
120 public string assetGetMethod(string request, string path, string param)
121 {
122 Console.WriteLine("got a request " +param);
123 byte[] assetdata = getAssetData(new LLUUID(param), false);
124 if (assetdata != null)
125 {
126 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
127 string ret = Windows1252Encoding.GetString(assetdata);
128 //string ret = System.Text.Encoding.Unicode.GetString(assetdata);
129
130 return ret;
131
132 }
133 else
134 {
135 return "";
136 }
137
138 }
139
140 public byte[] getAssetData(LLUUID assetID, bool isTexture)
141 {
142 bool found = false;
143 AssetStorage foundAsset = null;
144
145 IObjectSet result = db.Get(new AssetStorage(assetID));
146 if (result.Count > 0)
147 {
148 foundAsset = (AssetStorage)result.Next();
149 found = true;
150 }
151
152 if (found)
153 {
154 return foundAsset.Data;
155 }
156 else
157 {
158 return null;
159 }
160 }
161
162 public void setupDB()
163 {
164 bool yapfile = System.IO.File.Exists("assets.yap");
165 try
166 {
167 db = Db4oFactory.OpenFile("assets.yap");
168 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:setupDB() - creation");
169 }
170 catch (Exception e)
171 {
172 db.Close();
173 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Main.cs:setupDB() - Exception occured");
174 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
175 }
176 if (!yapfile)
177 {
178 this.LoadDB();
179 }
180 }
181
182 public void LoadDB()
183 {
184 try
185 {
186
187 Console.WriteLine("setting up Asset database");
188
189 AssetBase Image = new AssetBase();
190 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
191 Image.Name = "Bricks";
192 this.LoadAsset(Image, true, "bricks.jp2");
193 AssetStorage store = new AssetStorage();
194 store.Data = Image.Data;
195 store.Name = Image.Name;
196 store.UUID = Image.FullID;
197 db.Set(store);
198 db.Commit();
199
200 Image = new AssetBase();
201 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
202 Image.Name = "Plywood";
203 this.LoadAsset(Image, true, "plywood.jp2");
204 store = new AssetStorage();
205 store.Data = Image.Data;
206 store.Name = Image.Name;
207 store.UUID = Image.FullID;
208 db.Set(store);
209 db.Commit();
210
211 Image = new AssetBase();
212 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
213 Image.Name = "Rocks";
214 this.LoadAsset(Image, true, "rocks.jp2");
215 store = new AssetStorage();
216 store.Data = Image.Data;
217 store.Name = Image.Name;
218 store.UUID = Image.FullID;
219 db.Set(store);
220 db.Commit();
221
222 Image = new AssetBase();
223 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
224 Image.Name = "Granite";
225 this.LoadAsset(Image, true, "granite.jp2");
226 store = new AssetStorage();
227 store.Data = Image.Data;
228 store.Name = Image.Name;
229 store.UUID = Image.FullID;
230 db.Set(store);
231 db.Commit();
232
233 Image = new AssetBase();
234 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
235 Image.Name = "Hardwood";
236 this.LoadAsset(Image, true, "hardwood.jp2");
237 store = new AssetStorage();
238 store.Data = Image.Data;
239 store.Name = Image.Name;
240 store.UUID = Image.FullID;
241 db.Set(store);
242 db.Commit();
243
244 Image = new AssetBase();
245 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
246 Image.Name = "Prim Base Texture";
247 this.LoadAsset(Image, true, "plywood.jp2");
248 store = new AssetStorage();
249 store.Data = Image.Data;
250 store.Name = Image.Name;
251 store.UUID = Image.FullID;
252 db.Set(store);
253 db.Commit();
254
255 Image = new AssetBase();
256 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
257 Image.Name = "Shape";
258 this.LoadAsset(Image, false, "base_shape.dat");
259 store = new AssetStorage();
260 store.Data = Image.Data;
261 store.Name = Image.Name;
262 store.UUID = Image.FullID;
263 db.Set(store);
264 db.Commit();
265 }
266 catch (Exception e)
267 {
268 Console.WriteLine(e.Message);
269 }
270 }
271
272 private void LoadAsset(AssetBase info, bool image, string filename)
273 {
274
275
276 string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
277 string fileName = Path.Combine(dataPath, filename);
278 FileInfo fInfo = new FileInfo(fileName);
279 long numBytes = fInfo.Length;
280 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
281 byte[] idata = new byte[numBytes];
282 BinaryReader br = new BinaryReader(fStream);
283 idata = br.ReadBytes((int)numBytes);
284 br.Close();
285 fStream.Close();
286 info.Data = idata;
287 //info.loaded=true;
288 }
289
290 /*private GridConfig LoadConfigDll(string dllName)
291 {
292 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
293 GridConfig config = null;
294
295 foreach (Type pluginType in pluginAssembly.GetTypes())
296 {
297 if (pluginType.IsPublic)
298 {
299 if (!pluginType.IsAbstract)
300 {
301 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
302
303 if (typeInterface != null)
304 {
305 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
306 config = plug.GetConfigObject();
307 break;
308 }
309
310 typeInterface = null;
311 }
312 }
313 }
314 pluginAssembly = null;
315 return config;
316 }*/
317
318 public void RunCmd(string cmd, string[] cmdparams)
319 {
320 switch (cmd)
321 {
322 case "help":
323 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - shutdown this asset server (USE CAUTION!)");
324 break;
325
326 case "shutdown":
327 m_console.Close();
328 Environment.Exit(0);
329 break;
330 }
331 }
332
333 public void Show(string ShowWhat)
334 {
335 }
336 }
337}
diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj
new file mode 100644
index 0000000..cee7b77
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj
@@ -0,0 +1,125 @@
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>
10 </ApplicationIcon>
11 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName>
13 <AssemblyName>OpenGridServices.AssetServer</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>OpenGridServices.AssetServer</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.Data">
73 <HintPath>System.Data.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 <Reference Include="OpenSim.Framework">
81 <HintPath>OpenSim.Framework.dll</HintPath>
82 <Private>False</Private>
83 </Reference>
84 <Reference Include="OpenSim.Framework.Console">
85 <HintPath>OpenSim.Framework.Console.dll</HintPath>
86 <Private>False</Private>
87 </Reference>
88 <Reference Include="OpenSim.Servers">
89 <HintPath>OpenSim.Servers.dll</HintPath>
90 <Private>False</Private>
91 </Reference>
92 <Reference Include="libsecondlife.dll">
93 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
94 <Private>False</Private>
95 </Reference>
96 <Reference Include="Db4objects.Db4o.dll">
97 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
98 <Private>False</Private>
99 </Reference>
100 <Reference Include="XMLRPC">
101 <HintPath>XMLRPC.dll</HintPath>
102 <Private>False</Private>
103 </Reference>
104 </ItemGroup>
105 <ItemGroup>
106 </ItemGroup>
107 <ItemGroup>
108 <Compile Include="AssetHttpServer.cs">
109 <SubType>Code</SubType>
110 </Compile>
111 <Compile Include="Main.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="Properties\AssemblyInfo.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 </ItemGroup>
118 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
119 <PropertyGroup>
120 <PreBuildEvent>
121 </PreBuildEvent>
122 <PostBuildEvent>
123 </PostBuildEvent>
124 </PropertyGroup>
125</Project> \ No newline at end of file
diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build
new file mode 100644
index 0000000..e889a4d
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.csproj
new file mode 100644
index 0000000..9b8cc87
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.GridServer.exe.build
new file mode 100644
index 0000000..6bef534
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7014284
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs
new file mode 100644
index 0000000..54e4bb7
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.GridServer/Main.cs b/OpenGridServices/OpenGridServices.GridServer/Main.cs
new file mode 100644
index 0000000..8baf293
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.GridServer/Main.cs
@@ -0,0 +1,272 @@
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;
44using OpenSim.GenericConfig;
45
46namespace OpenGridServices.GridServer
47{
48 /// <summary>
49 /// </summary>
50 public class OpenGrid_Main : BaseServer, conscmd_callback
51 {
52 private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
53 private string GridDll = "OpenGrid.Framework.Data.DB4o.dll";
54 public GridConfig Cfg;
55
56 public static OpenGrid_Main thegrid;
57 protected IGenericConfig localXMLConfig;
58
59 public static bool setuponly;
60
61 //public LLUUID highestUUID;
62
63 // private SimProfileManager m_simProfileManager;
64
65 private GridManager m_gridManager;
66
67 private ConsoleBase m_console;
68
69 [STAThread]
70 public static void Main(string[] args)
71 {
72 if (args.Length > 0)
73 {
74 if (args[0] == "-setuponly") setuponly = true;
75 }
76 Console.WriteLine("Starting...\n");
77
78 thegrid = new OpenGrid_Main();
79 thegrid.Startup();
80
81 thegrid.Work();
82 }
83
84 private void Work()
85 {
86 while (true)
87 {
88 Thread.Sleep(5000);
89 // should flush the DB etc here
90 }
91 }
92
93 private OpenGrid_Main()
94 {
95 m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
96 MainConsole.Instance = m_console;
97
98
99 }
100
101 public void managercallback(string cmd)
102 {
103 switch (cmd)
104 {
105 case "shutdown":
106 RunCmd("shutdown", new string[0]);
107 break;
108 }
109 }
110
111
112 public void Startup()
113 {
114 this.localXMLConfig = new XmlConfig("GridServerConfig.xml");
115 this.localXMLConfig.LoadData();
116 this.ConfigDB(this.localXMLConfig);
117 this.localXMLConfig.Close();
118
119 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration");
120 Cfg = this.LoadConfigDll(this.ConfigDll);
121 Cfg.InitConfig();
122 if (setuponly) Environment.Exit(0);
123
124 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Connecting to Storage Server");
125 m_gridManager = new GridManager();
126 m_gridManager.AddPlugin(GridDll); // Made of win
127 m_gridManager.config = Cfg;
128
129 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP process");
130 BaseHttpServer httpServer = new BaseHttpServer(8001);
131 GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
132
133 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod);
134 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
135
136 httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
137 httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
138 httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
139 httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
140
141
142 // lbsa71 : This code snippet taken from old http server.
143 // I have no idea what this was supposed to do - looks like an infinite recursion to me.
144 // case "regions":
145 //// DIRTY HACK ALERT
146 //Console.WriteLine("/regions/ accessed");
147 //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1]));
148 //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod);
149 //break;
150
151 // lbsa71 : I guess these were never used?
152 //Listener.Prefixes.Add("http://+:8001/gods/");
153 //Listener.Prefixes.Add("http://+:8001/highestuuid/");
154 //Listener.Prefixes.Add("http://+:8001/uuidblocks/");
155
156 httpServer.Start();
157
158 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting sim status checker");
159
160 System.Timers.Timer simCheckTimer = new System.Timers.Timer(300000); // 5 minutes
161 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
162 simCheckTimer.Enabled = true;
163 }
164
165 private GridConfig LoadConfigDll(string dllName)
166 {
167 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
168 GridConfig 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("IGridConfig", true);
177
178 if (typeInterface != null)
179 {
180 IGridConfig plug = (IGridConfig)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 CheckSims(object sender, ElapsedEventArgs e)
194 {
195 /*
196 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
197 {
198 string SimResponse = "";
199 try
200 {
201 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
202 CheckSim.Method = "GET";
203 CheckSim.ContentType = "text/plaintext";
204 CheckSim.ContentLength = 0;
205
206 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
207 stOut.Write("");
208 stOut.Close();
209
210 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
211 SimResponse = stIn.ReadToEnd();
212 stIn.Close();
213 }
214 catch
215 {
216 }
217
218 if (SimResponse == "OK")
219 {
220 m_simProfileManager.SimProfiles[sim.UUID].online = true;
221 }
222 else
223 {
224 m_simProfileManager.SimProfiles[sim.UUID].online = false;
225 }
226 }
227 */
228 }
229
230 public void RunCmd(string cmd, string[] cmdparams)
231 {
232 switch (cmd)
233 {
234 case "help":
235 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - shutdown the grid (USE CAUTION!)");
236 break;
237
238 case "shutdown":
239 m_console.Close();
240 Environment.Exit(0);
241 break;
242 }
243 }
244
245 public void Show(string ShowWhat)
246 {
247 }
248
249 private void ConfigDB(IGenericConfig configData)
250 {
251 try
252 {
253 string attri = "";
254 attri = configData.GetAttribute("DataBaseProvider");
255 if (attri == "")
256 {
257 GridDll = "OpenGrid.Framework.Data.DB4o.dll";
258 configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll");
259 }
260 else
261 {
262 GridDll = attri;
263 }
264 configData.Commit();
265 }
266 catch (Exception e)
267 {
268
269 }
270 }
271 }
272}
diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj
new file mode 100644
index 0000000..f4a6ca1
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj
@@ -0,0 +1,134 @@
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="OpenSim.Framework" >
74 <HintPath>OpenSim.Framework.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="OpenSim.Framework.Console" >
78 <HintPath>OpenSim.Framework.Console.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="OpenSim.Servers" >
82 <HintPath>OpenSim.Servers.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 <Reference Include="OpenSim.GenericConfig.Xml" >
86 <HintPath>OpenSim.GenericConfig.Xml.dll</HintPath>
87 <Private>False</Private>
88 </Reference>
89 <Reference Include="libsecondlife.dll" >
90 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
91 <Private>False</Private>
92 </Reference>
93 <Reference Include="Db4objects.Db4o.dll" >
94 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
95 <Private>False</Private>
96 </Reference>
97 <Reference Include="XMLRPC" >
98 <HintPath>XMLRPC.dll</HintPath>
99 <Private>False</Private>
100 </Reference>
101 </ItemGroup>
102 <ItemGroup>
103 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
104 <Name>OpenGrid.Framework.Data</Name>
105 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
107 <Private>False</Private>
108 </ProjectReference>
109 <ProjectReference Include="..\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj">
110 <Name>OpenGrid.Framework.Manager</Name>
111 <Project>{7924FD35-0000-0000-0000-000000000000}</Project>
112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
113 <Private>False</Private>
114 </ProjectReference>
115 </ItemGroup>
116 <ItemGroup>
117 <Compile Include="GridManager.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 <Compile Include="Main.cs">
121 <SubType>Code</SubType>
122 </Compile>
123 <Compile Include="Properties\AssemblyInfo.cs">
124 <SubType>Code</SubType>
125 </Compile>
126 </ItemGroup>
127 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
128 <PropertyGroup>
129 <PreBuildEvent>
130 </PreBuildEvent>
131 <PostBuildEvent>
132 </PostBuildEvent>
133 </PropertyGroup>
134</Project>
diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build
new file mode 100644
index 0000000..9d21edd
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build
@@ -0,0 +1,52 @@
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/OpenSim.GenericConfig.Xml.dll" />
32 <include name="../../bin/libsecondlife.dll" />
33 <include name="../../bin/Db4objects.Db4o.dll" />
34 <include name="../../bin/XMLRPC.dll" />
35 </references>
36 </csc>
37 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
38 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
39 <copy todir="${project::get-base-directory()}/../../bin/">
40 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
41 <include name="*.dll"/>
42 <include name="*.exe"/>
43 </fileset>
44 </copy>
45 </target>
46 <target name="clean">
47 <delete dir="${bin.dir}" failonerror="false" />
48 <delete dir="${obj.dir}" failonerror="false" />
49 </target>
50 <target name="doc" description="Creates documentation.">
51 </target>
52</project>
diff --git a/OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.GridServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8471e6b
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager.mds b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.mds
new file mode 100644
index 0000000..ed7bc24
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager.userprefs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.userprefs
new file mode 100644
index 0000000..f221509
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager.usertasks b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager.usertasks
new file mode 100644
index 0000000..d887d0e
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/AssemblyInfo.cs
new file mode 100644
index 0000000..af4e275
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
new file mode 100644
index 0000000..83685fc
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Connect to grid server.cs
new file mode 100644
index 0000000..0d509ef
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs
new file mode 100644
index 0000000..8a80b1d
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs
new file mode 100644
index 0000000..6b632d6
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs
new file mode 100644
index 0000000..42e09e0
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs
new file mode 100644
index 0000000..1db38f0
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp
new file mode 100644
index 0000000..cfdc085
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb
new file mode 100644
index 0000000..44e7a61
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb
Binary files differ
diff --git a/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/RegionBlock.cs
new file mode 100644
index 0000000..00f7c65
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/Util.cs
new file mode 100644
index 0000000..5bf7ff9
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs
new file mode 100644
index 0000000..da6739e
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs
new file mode 100644
index 0000000..8798dac
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/generated.cs
new file mode 100644
index 0000000..dd4abdd
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic b/OpenGridServices/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic
new file mode 100644
index 0000000..c883f08
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.UserServer/Main.cs b/OpenGridServices/OpenGridServices.UserServer/Main.cs
new file mode 100644
index 0000000..aec80dc
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.UserServer/Main.cs
@@ -0,0 +1,217 @@
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;
43using OpenSim.Framework.Utilities;
44using OpenSim.GenericConfig;
45
46namespace OpenGridServices.UserServer
47{
48 /// <summary>
49 /// </summary>
50 public class OpenUser_Main : BaseServer, conscmd_callback
51 {
52 private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll";
53 private string StorageDll = "OpenGrid.Framework.Data.DB4o.dll";
54 private UserConfig Cfg;
55 protected IGenericConfig localXMLConfig;
56
57 public UserManager m_userManager; // Replaces below.
58
59 //private UserProfileManager m_userProfileManager; // Depreciated
60
61 public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
62
63 ConsoleBase m_console;
64
65 [STAThread]
66 public static void Main(string[] args)
67 {
68 Console.WriteLine("Starting...\n");
69
70 OpenUser_Main userserver = new OpenUser_Main();
71
72 userserver.Startup();
73 userserver.Work();
74 }
75
76 private OpenUser_Main()
77 {
78 m_console = new ConsoleBase("opengrid-userserver-console.log", "OpenUser", this , false);
79 MainConsole.Instance = m_console;
80 }
81
82 private void Work()
83 {
84 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"\nEnter help for a list of commands\n");
85
86 while (true)
87 {
88 m_console.MainConsolePrompt();
89 }
90 }
91
92 public void Startup()
93 {
94 this.localXMLConfig = new XmlConfig("UserServerConfig.xml");
95 this.localXMLConfig.LoadData();
96 this.ConfigDB(this.localXMLConfig);
97 this.localXMLConfig.Close();
98
99 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration");
100 Cfg = this.LoadConfigDll(this.ConfigDll);
101 Cfg.InitConfig();
102
103 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Establishing data connection");
104 m_userManager = new UserManager();
105 m_userManager._config = Cfg;
106 m_userManager.AddPlugin(StorageDll);
107
108 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process");
109 BaseHttpServer httpServer = new BaseHttpServer(8002);
110
111 httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod);
112 httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod);
113
114 httpServer.Start();
115 }
116
117
118 public void do_create(string what)
119 {
120 switch (what)
121 {
122 case "user":
123 string tempfirstname;
124 string templastname;
125 string tempMD5Passwd;
126 uint regX = 997;
127 uint regY = 996;
128
129 tempfirstname = m_console.CmdPrompt("First name");
130 templastname = m_console.CmdPrompt("Last name");
131 tempMD5Passwd = m_console.PasswdPrompt("Password");
132 regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
133 regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
134
135 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
136
137 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
138 break;
139 }
140 }
141
142 public void RunCmd(string cmd, string[] cmdparams)
143 {
144 switch (cmd)
145 {
146 case "help":
147 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"create user - create a new user");
148 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - shutdown the grid (USE CAUTION!)");
149 break;
150
151 case "create":
152 do_create(cmdparams[0]);
153 break;
154
155 case "shutdown":
156 m_console.Close();
157 Environment.Exit(0);
158 break;
159 }
160 }
161
162 private void ConfigDB(IGenericConfig configData)
163 {
164 try
165 {
166 string attri = "";
167 attri = configData.GetAttribute("DataBaseProvider");
168 if (attri == "")
169 {
170 StorageDll = "OpenGrid.Framework.Data.DB4o.dll";
171 configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll");
172 }
173 else
174 {
175 StorageDll = attri;
176 }
177 configData.Commit();
178 }
179 catch (Exception e)
180 {
181
182 }
183 }
184
185 private UserConfig LoadConfigDll(string dllName)
186 {
187 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
188 UserConfig config = null;
189
190 foreach (Type pluginType in pluginAssembly.GetTypes())
191 {
192 if (pluginType.IsPublic)
193 {
194 if (!pluginType.IsAbstract)
195 {
196 Type typeInterface = pluginType.GetInterface("IUserConfig", true);
197
198 if (typeInterface != null)
199 {
200 IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
201 config = plug.GetConfigObject();
202 break;
203 }
204
205 typeInterface = null;
206 }
207 }
208 }
209 pluginAssembly = null;
210 return config;
211 }
212
213 public void Show(string ShowWhat)
214 {
215 }
216 }
217}
diff --git a/OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj b/OpenGridServices/OpenGridServices.UserServer/OGS-UserServer.csproj
new file mode 100644
index 0000000..f4fa8b6
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj
new file mode 100644
index 0000000..1bd07fb
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj
@@ -0,0 +1,128 @@
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="OpenSim.Framework" >
74 <HintPath>OpenSim.Framework.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="OpenSim.Framework.Console" >
78 <HintPath>OpenSim.Framework.Console.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="OpenSim.GenericConfig.Xml" >
82 <HintPath>OpenSim.GenericConfig.Xml.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 <Reference Include="OpenSim.Servers" >
86 <HintPath>OpenSim.Servers.dll</HintPath>
87 <Private>False</Private>
88 </Reference>
89 <Reference Include="libsecondlife.dll" >
90 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
91 <Private>False</Private>
92 </Reference>
93 <Reference Include="Db4objects.Db4o.dll" >
94 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
95 <Private>False</Private>
96 </Reference>
97 <Reference Include="XMLRPC" >
98 <HintPath>XMLRPC.dll</HintPath>
99 <Private>False</Private>
100 </Reference>
101 </ItemGroup>
102 <ItemGroup>
103 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
104 <Name>OpenGrid.Framework.Data</Name>
105 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
107 <Private>False</Private>
108 </ProjectReference>
109 </ItemGroup>
110 <ItemGroup>
111 <Compile Include="Main.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="UserManager.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 <Compile Include="Properties\AssemblyInfo.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 </ItemGroup>
121 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
122 <PropertyGroup>
123 <PreBuildEvent>
124 </PreBuildEvent>
125 <PostBuildEvent>
126 </PostBuildEvent>
127 </PropertyGroup>
128</Project>
diff --git a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build
new file mode 100644
index 0000000..5275ef4
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build
@@ -0,0 +1,51 @@
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.GenericConfig.Xml.dll" />
30 <include name="../../bin/OpenSim.Servers.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/OpenGridServices.UserServer/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGridServices.UserServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..5d5ce8d
--- /dev/null
+++ b/OpenGridServices/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/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs
new file mode 100644
index 0000000..fdda63b
--- /dev/null
+++ b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs
@@ -0,0 +1,597 @@
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 ///
57 /// </summary>
58 /// <param name="user"></param>
59 public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
60 {
61 UserProfileData user = new UserProfileData();
62 user.homeLocation = new LLVector3(128, 128, 100);
63 user.UUID = LLUUID.Random();
64 user.username = firstName;
65 user.surname = lastName;
66 user.passwordHash = pass;
67 user.passwordSalt = "";
68 user.created = Util.UnixTimeSinceEpoch();
69 user.homeLookAt = new LLVector3(100, 100, 100);
70 user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256));
71
72 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
73 {
74 try
75 {
76 plugin.Value.addNewUserProfile(user);
77
78 }
79 catch (Exception e)
80 {
81 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
82 }
83 }
84 }
85
86 /// <summary>
87 /// Loads a user profile from a database by UUID
88 /// </summary>
89 /// <param name="uuid">The target UUID</param>
90 /// <returns>A user profile</returns>
91 public UserProfileData getUserProfile(LLUUID uuid)
92 {
93 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
94 {
95 try
96 {
97 UserProfileData profile = plugin.Value.getUserByUUID(uuid);
98 profile.currentAgent = getUserAgent(profile.UUID);
99 return profile;
100 }
101 catch (Exception e)
102 {
103 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
104 }
105 }
106
107 return null;
108 }
109
110
111 /// <summary>
112 /// Loads a user profile by name
113 /// </summary>
114 /// <param name="name">The target name</param>
115 /// <returns>A user profile</returns>
116 public UserProfileData getUserProfile(string name)
117 {
118 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
119 {
120 try
121 {
122 UserProfileData profile = plugin.Value.getUserByName(name);
123 profile.currentAgent = getUserAgent(profile.UUID);
124 return profile;
125 }
126 catch (Exception e)
127 {
128 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
129 }
130 }
131
132 return null;
133 }
134
135 /// <summary>
136 /// Loads a user profile by name
137 /// </summary>
138 /// <param name="fname">First name</param>
139 /// <param name="lname">Last name</param>
140 /// <returns>A user profile</returns>
141 public UserProfileData getUserProfile(string fname, string lname)
142 {
143 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
144 {
145 try
146 {
147 UserProfileData profile = plugin.Value.getUserByName(fname,lname);
148 try
149 {
150 profile.currentAgent = getUserAgent(profile.UUID);
151 }
152 catch (Exception e)
153 {
154 // Ignore
155 }
156 return profile;
157 }
158 catch (Exception e)
159 {
160 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
161 }
162 }
163
164 return null;
165 }
166
167 /// <summary>
168 /// Loads a user agent by uuid (not called directly)
169 /// </summary>
170 /// <param name="uuid">The agents UUID</param>
171 /// <returns>Agent profiles</returns>
172 public UserAgentData getUserAgent(LLUUID uuid)
173 {
174 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
175 {
176 try
177 {
178 return plugin.Value.getAgentByUUID(uuid);
179 }
180 catch (Exception e)
181 {
182 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
183 }
184 }
185
186 return null;
187 }
188
189 /// <summary>
190 /// Loads a user agent by name (not called directly)
191 /// </summary>
192 /// <param name="name">The agents name</param>
193 /// <returns>A user agent</returns>
194 public UserAgentData getUserAgent(string name)
195 {
196 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
197 {
198 try
199 {
200 return plugin.Value.getAgentByName(name);
201 }
202 catch (Exception e)
203 {
204 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
205 }
206 }
207
208 return null;
209 }
210
211 /// <summary>
212 /// Loads a user agent by name (not called directly)
213 /// </summary>
214 /// <param name="fname">The agents firstname</param>
215 /// <param name="lname">The agents lastname</param>
216 /// <returns>A user agent</returns>
217 public UserAgentData getUserAgent(string fname, string lname)
218 {
219 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
220 {
221 try
222 {
223 return plugin.Value.getAgentByName(fname,lname);
224 }
225 catch (Exception e)
226 {
227 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
228 }
229 }
230
231 return null;
232 }
233
234 /// <summary>
235 /// Creates a error response caused by invalid XML
236 /// </summary>
237 /// <returns>An XMLRPC response</returns>
238 private static XmlRpcResponse CreateErrorConnectingToGridResponse()
239 {
240 XmlRpcResponse response = new XmlRpcResponse();
241 Hashtable ErrorRespData = new Hashtable();
242 ErrorRespData["reason"] = "key";
243 ErrorRespData["message"] = "Error connecting to grid. Could not percieve credentials from login XML.";
244 ErrorRespData["login"] = "false";
245 response.Value = ErrorRespData;
246 return response;
247 }
248
249 /// <summary>
250 /// Creates an error response caused by bad login credentials
251 /// </summary>
252 /// <returns>An XMLRPC response</returns>
253 private static XmlRpcResponse CreateLoginErrorResponse()
254 {
255 XmlRpcResponse response = new XmlRpcResponse();
256 Hashtable ErrorRespData = new Hashtable();
257 ErrorRespData["reason"] = "key";
258 ErrorRespData["message"] = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
259 ErrorRespData["login"] = "false";
260 response.Value = ErrorRespData;
261 return response;
262 }
263
264 /// <summary>
265 /// Creates an error response caused by being logged in already
266 /// </summary>
267 /// <returns>An XMLRPC Response</returns>
268 private static XmlRpcResponse CreateAlreadyLoggedInResponse()
269 {
270 XmlRpcResponse response = new XmlRpcResponse();
271 Hashtable PresenceErrorRespData = new Hashtable();
272 PresenceErrorRespData["reason"] = "presence";
273 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";
274 PresenceErrorRespData["login"] = "false";
275 response.Value = PresenceErrorRespData;
276 return response;
277 }
278
279 /// <summary>
280 /// Customises the login response and fills in missing values.
281 /// </summary>
282 /// <param name="response">The existing response</param>
283 /// <param name="theUser">The user profile</param>
284 public virtual void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser)
285 {
286 // Load information from the gridserver
287 SimProfile SimInfo = new SimProfile();
288 SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
289
290 // Customise the response
291 // Home Location
292 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], " +
293 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
294 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
295
296 // Destination
297 response["sim_ip"] = SimInfo.sim_ip;
298 response["sim_port"] = (Int32)SimInfo.sim_port;
299 response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
300 response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
301
302 // Notify the target of an incoming user
303 Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")");
304
305 // Prepare notification
306 Hashtable SimParams = new Hashtable();
307 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
308 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
309 SimParams["firstname"] = theUser.username;
310 SimParams["lastname"] = theUser.surname;
311 SimParams["agent_id"] = theUser.UUID.ToString();
312 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response["circuit_code"]);
313 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
314 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
315 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
316 ArrayList SendParams = new ArrayList();
317 SendParams.Add(SimParams);
318
319 // Update agent with target sim
320 theUser.currentAgent.currentRegion = SimInfo.UUID;
321 theUser.currentAgent.currentHandle = SimInfo.regionhandle;
322
323 // Send
324 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
325 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
326 }
327
328 /// <summary>
329 /// Checks a user against it's password hash
330 /// </summary>
331 /// <param name="profile">The users profile</param>
332 /// <param name="password">The supplied password</param>
333 /// <returns>Authenticated?</returns>
334 public bool AuthenticateUser(ref UserProfileData profile, string password)
335 {
336 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
337 OpenSim.Framework.Console.LogPriority.LOW,
338 "Authenticating " + profile.username + " " + profile.surname);
339
340 password = password.Remove(0, 3); //remove $1$
341
342 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
343
344 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
345 }
346
347 /// <summary>
348 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
349 /// </summary>
350 /// <param name="profile">The users profile</param>
351 /// <param name="request">The users loginrequest</param>
352 public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request)
353 {
354 Hashtable requestData = (Hashtable)request.Params[0];
355
356 UserAgentData agent = new UserAgentData();
357
358 // User connection
359 agent.agentIP = "";
360 agent.agentOnline = true;
361 agent.agentPort = 0;
362
363 // Generate sessions
364 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
365 byte[] randDataS = new byte[16];
366 byte[] randDataSS = new byte[16];
367 rand.GetBytes(randDataS);
368 rand.GetBytes(randDataSS);
369
370 agent.secureSessionID = new LLUUID(randDataSS, 0);
371 agent.sessionID = new LLUUID(randDataS, 0);
372
373 // Profile UUID
374 agent.UUID = profile.UUID;
375
376 // Current position (from Home)
377 agent.currentHandle = profile.homeRegion;
378 agent.currentPos = profile.homeLocation;
379
380 // If user specified additional start, use that
381 if (requestData.ContainsKey("start"))
382 {
383 string startLoc = (string)requestData["start"];
384 if (!(startLoc == "last" || startLoc == "home"))
385 {
386 // Ignore it! Heh.
387 }
388 }
389
390 // What time did the user login?
391 agent.loginTime = Util.UnixTimeSinceEpoch();
392 agent.logoutTime = 0;
393
394 // Current location
395 agent.regionID = new LLUUID(); // Fill in later
396 agent.currentRegion = new LLUUID(); // Fill in later
397
398 profile.currentAgent = agent;
399 }
400
401 /// <summary>
402 /// Saves a target agent to the database
403 /// </summary>
404 /// <param name="profile">The users profile</param>
405 /// <returns>Successful?</returns>
406 public bool CommitAgent(ref UserProfileData profile)
407 {
408 // Saves the agent to database
409 return true;
410 }
411
412 /// <summary>
413 /// Main user login function
414 /// </summary>
415 /// <param name="request">The XMLRPC request</param>
416 /// <returns>The response to send</returns>
417 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
418 {
419 XmlRpcResponse response = new XmlRpcResponse();
420 Hashtable requestData = (Hashtable)request.Params[0];
421
422 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
423 bool GoodLogin = false;
424 string firstname = "";
425 string lastname = "";
426 string passwd = "";
427
428 UserProfileData TheUser;
429
430 if (GoodXML)
431 {
432 firstname = (string)requestData["first"];
433 lastname = (string)requestData["last"];
434 passwd = (string)requestData["passwd"];
435
436 TheUser = getUserProfile(firstname, lastname);
437 if (TheUser == null)
438 return CreateLoginErrorResponse();
439
440 GoodLogin = AuthenticateUser(ref TheUser, passwd);
441 }
442 else
443 {
444 return CreateErrorConnectingToGridResponse();
445 }
446
447 if (!GoodLogin)
448 {
449 return CreateLoginErrorResponse();
450 }
451 else
452 {
453 // If we already have a session...
454 if (TheUser.currentAgent != null && TheUser.currentAgent.agentOnline)
455 {
456 // Reject the login
457 return CreateAlreadyLoggedInResponse();
458 }
459 // Otherwise...
460 // Create a new agent session
461 CreateAgent(ref TheUser, request);
462
463 try
464 {
465 Hashtable responseData = new Hashtable();
466
467 LLUUID AgentID = TheUser.UUID;
468
469 // Global Texture Section
470 Hashtable GlobalT = new Hashtable();
471 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
472 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
473 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
474 ArrayList GlobalTextures = new ArrayList();
475 GlobalTextures.Add(GlobalT);
476
477 // Login Flags Section
478 Hashtable LoginFlagsHash = new Hashtable();
479 LoginFlagsHash["daylight_savings"] = "N";
480 LoginFlagsHash["stipend_since_login"] = "N";
481 LoginFlagsHash["gendered"] = "Y";
482 LoginFlagsHash["ever_logged_in"] = "N"; // Should allow male/female av selection
483 ArrayList LoginFlags = new ArrayList();
484 LoginFlags.Add(LoginFlagsHash);
485
486 // UI Customisation Section
487 Hashtable uiconfig = new Hashtable();
488 uiconfig["allow_first_life"] = "Y";
489 ArrayList ui_config = new ArrayList();
490 ui_config.Add(uiconfig);
491
492 // Classified Categories Section
493 Hashtable ClassifiedCategoriesHash = new Hashtable();
494 ClassifiedCategoriesHash["category_name"] = "Generic";
495 ClassifiedCategoriesHash["category_id"] = (Int32)1;
496 ArrayList ClassifiedCategories = new ArrayList();
497 ClassifiedCategories.Add(ClassifiedCategoriesHash);
498
499 // Inventory Library Section
500 ArrayList AgentInventoryArray = new ArrayList();
501 Hashtable TempHash;
502
503 AgentInventory Library = new AgentInventory();
504 Library.CreateRootFolder(AgentID, true);
505
506 foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values)
507 {
508 TempHash = new Hashtable();
509 TempHash["name"] = InvFolder.FolderName;
510 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
511 TempHash["version"] = (Int32)InvFolder.Version;
512 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
513 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
514 AgentInventoryArray.Add(TempHash);
515 }
516
517 Hashtable InventoryRootHash = new Hashtable();
518 InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated();
519 ArrayList InventoryRoot = new ArrayList();
520 InventoryRoot.Add(InventoryRootHash);
521
522 Hashtable InitialOutfitHash = new Hashtable();
523 InitialOutfitHash["folder_name"] = "Nightclub Female";
524 InitialOutfitHash["gender"] = "female";
525 ArrayList InitialOutfit = new ArrayList();
526 InitialOutfit.Add(InitialOutfitHash);
527
528 // Circuit Code
529 uint circode = (uint)(Util.RandomClass.Next());
530
531 // Generics
532 responseData["last_name"] = TheUser.surname;
533 responseData["ui-config"] = ui_config;
534 responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
535 responseData["login-flags"] = LoginFlags;
536 responseData["global-textures"] = GlobalTextures;
537 responseData["classified_categories"] = ClassifiedCategories;
538 responseData["event_categories"] = new ArrayList();
539 responseData["inventory-skeleton"] = AgentInventoryArray;
540 responseData["inventory-skel-lib"] = new ArrayList();
541 responseData["inventory-root"] = InventoryRoot;
542 responseData["event_notifications"] = new ArrayList();
543 responseData["gestures"] = new ArrayList();
544 responseData["inventory-lib-owner"] = new ArrayList();
545 responseData["initial-outfit"] = InitialOutfit;
546 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
547 responseData["start_location"] = "last";
548 responseData["home"] = "!!null temporary value {home}!!"; // Overwritten
549 responseData["message"] = _config.DefaultStartupMsg;
550 responseData["first_name"] = TheUser.username;
551 responseData["circuit_code"] = (Int32)circode;
552 responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port;
553 responseData["secure_session_id"] = TheUser.currentAgent.secureSessionID.ToStringHyphenated();
554 responseData["look_at"] = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
555 responseData["agent_id"] = AgentID.ToStringHyphenated();
556 responseData["region_y"] = (Int32)0; // Overwritten
557 responseData["region_x"] = (Int32)0; // Overwritten
558 responseData["seed_capability"] = "";
559 responseData["agent_access"] = "M";
560 responseData["session_id"] = TheUser.currentAgent.sessionID.ToStringHyphenated();
561 responseData["login"] = "true";
562
563 this.CustomiseResponse(ref responseData, ref TheUser);
564
565 CommitAgent(ref TheUser);
566
567 response.Value = responseData;
568 // TheUser.SendDataToSim(SimInfo);
569 return response;
570
571 }
572 catch (Exception E)
573 {
574 Console.WriteLine(E.ToString());
575 }
576 //}
577 }
578 return response;
579
580 }
581
582 /// <summary>
583 /// Deletes an active agent session
584 /// </summary>
585 /// <param name="request">The request</param>
586 /// <param name="path">The path (eg /bork/narf/test)</param>
587 /// <param name="param">Parameters sent</param>
588 /// <returns>Success "OK" else error</returns>
589 public string RestDeleteUserSessionMethod(string request, string path, string param)
590 {
591 // TODO! Important!
592
593 return "OK";
594 }
595
596 }
597}
diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs b/OpenGridServices/OpenUser.Config/UserConfigDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..56a5535
--- /dev/null
+++ b/OpenGridServices/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/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs b/OpenGridServices/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs
new file mode 100644
index 0000000..a281889
--- /dev/null
+++ b/OpenGridServices/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/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj
new file mode 100644
index 0000000..722b8d4
--- /dev/null
+++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj
@@ -0,0 +1,107 @@
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 <Reference Include="OpenSim.Framework" >
82 <HintPath>OpenSim.Framework.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 <Reference Include="OpenSim.Framework.Console" >
86 <HintPath>OpenSim.Framework.Console.dll</HintPath>
87 <Private>False</Private>
88 </Reference>
89 </ItemGroup>
90 <ItemGroup>
91 </ItemGroup>
92 <ItemGroup>
93 <Compile Include="AssemblyInfo.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="DbUserConfig.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 </ItemGroup>
100 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
101 <PropertyGroup>
102 <PreBuildEvent>
103 </PreBuildEvent>
104 <PostBuildEvent>
105 </PostBuildEvent>
106 </PropertyGroup>
107</Project>
diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build
new file mode 100644
index 0000000..2833bce
--- /dev/null
+++ b/OpenGridServices/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/SQL/mysql-agents.sql b/OpenGridServices/SQL/mysql-agents.sql
new file mode 100644
index 0000000..8194ca9
--- /dev/null
+++ b/OpenGridServices/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/SQL/mysql-regions.sql b/OpenGridServices/SQL/mysql-regions.sql
new file mode 100644
index 0000000..4f98826
--- /dev/null
+++ b/OpenGridServices/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, `regionMapTexture` varchar(36) 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/SQL/mysql-users.sql b/OpenGridServices/SQL/mysql-users.sql
new file mode 100644
index 0000000..5ce4d1c
--- /dev/null
+++ b/OpenGridServices/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/ServiceManager/ServiceManager.cs b/OpenGridServices/ServiceManager/ServiceManager.cs
new file mode 100644
index 0000000..b21a5b1
--- /dev/null
+++ b/OpenGridServices/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/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj
new file mode 100644
index 0000000..392f560
--- /dev/null
+++ b/OpenGridServices/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/ServiceManager/ServiceManager.csproj.user b/OpenGridServices/ServiceManager/ServiceManager.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/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/ServiceManager/ServiceManager.exe.build b/OpenGridServices/ServiceManager/ServiceManager.exe.build
new file mode 100644
index 0000000..163e086
--- /dev/null
+++ b/OpenGridServices/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>