diff options
Diffstat (limited to 'OGS')
24 files changed, 1528 insertions, 0 deletions
diff --git a/OGS/OGS.sln b/OGS/OGS.sln new file mode 100644 index 0000000..20eb03a --- /dev/null +++ b/OGS/OGS.sln | |||
@@ -0,0 +1,38 @@ | |||
1 | | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # Visual C# Express 2005 | ||
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-UserServer", "userserver\src\OGS-UserServer.csproj", "{D45B6E48-5668-478D-B9CB-6D46E665FACF}" | ||
5 | EndProject | ||
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-GridServer", "gridserver\src\OGS-GridServer.csproj", "{FE50A574-C8ED-433B-95F0-213A5EED2AB2}" | ||
7 | EndProject | ||
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole.csproj", "{7667E6E2-F227-41A2-B1B2-315613E1BAFC}" | ||
9 | EndProject | ||
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "..\OpenSim.FrameWork\OpenSim.Framework.csproj", "{2E46A825-3168-492F-93BC-637126B5B72B}" | ||
11 | EndProject | ||
12 | Global | ||
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
14 | Debug|Any CPU = Debug|Any CPU | ||
15 | Release|Any CPU = Release|Any CPU | ||
16 | EndGlobalSection | ||
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
18 | {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
19 | {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
20 | {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
21 | {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
22 | {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
23 | {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
24 | {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
25 | {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.Build.0 = Release|Any CPU | ||
26 | {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
27 | {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
28 | {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
29 | {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
30 | {2E46A825-3168-492F-93BC-637126B5B72B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
31 | {2E46A825-3168-492F-93BC-637126B5B72B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
32 | {2E46A825-3168-492F-93BC-637126B5B72B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
33 | {2E46A825-3168-492F-93BC-637126B5B72B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
34 | EndGlobalSection | ||
35 | GlobalSection(SolutionProperties) = preSolution | ||
36 | HideSolutionNode = FALSE | ||
37 | EndGlobalSection | ||
38 | EndGlobal | ||
diff --git a/OGS/ServerConsole/Properties/AssemblyInfo.cs b/OGS/ServerConsole/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0028e2a --- /dev/null +++ b/OGS/ServerConsole/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using 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("ServerConsole")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("ServerConsole")] | ||
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("c4d85def-4c2e-449d-bf4a-449b8cf03736")] | ||
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/OGS/ServerConsole/ServerConsole.cs b/OGS/ServerConsole/ServerConsole.cs new file mode 100644 index 0000000..d50a7e2 --- /dev/null +++ b/OGS/ServerConsole/ServerConsole.cs | |||
@@ -0,0 +1,98 @@ | |||
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 | */ | ||
27 | using System; | ||
28 | |||
29 | namespace ServerConsole | ||
30 | { | ||
31 | public class MainConsole { | ||
32 | |||
33 | private static ConsoleBase instance; | ||
34 | |||
35 | public static ConsoleBase Instance | ||
36 | { | ||
37 | get | ||
38 | { | ||
39 | return instance; | ||
40 | } | ||
41 | set | ||
42 | { | ||
43 | instance = value; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | public MainConsole() | ||
48 | { | ||
49 | |||
50 | } | ||
51 | } | ||
52 | |||
53 | public abstract class conscmd_callback { | ||
54 | public abstract void RunCmd(string cmd, string[] cmdparams); | ||
55 | public abstract void Show(string ShowWhat); | ||
56 | } | ||
57 | |||
58 | public abstract class ConsoleBase | ||
59 | { | ||
60 | |||
61 | public enum ConsoleType { | ||
62 | Local, // Use stdio | ||
63 | TCP, // Use TCP/telnet | ||
64 | SimChat // Use in-world chat (for gods) | ||
65 | } | ||
66 | |||
67 | public abstract void Close(); | ||
68 | |||
69 | // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here | ||
70 | public abstract void WriteLine(string Line) ; | ||
71 | |||
72 | public abstract string ReadLine(); | ||
73 | |||
74 | public abstract int Read() ; | ||
75 | |||
76 | public abstract void Write(string Line) ; | ||
77 | |||
78 | public abstract string PasswdPrompt(string prompt); | ||
79 | |||
80 | // Displays a command prompt and waits for the user to enter a string, then returns that string | ||
81 | public abstract string CmdPrompt(string prompt) ; | ||
82 | |||
83 | // Displays a command prompt and returns a default value if the user simply presses enter | ||
84 | public abstract string CmdPrompt(string prompt, string defaultresponse); | ||
85 | |||
86 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | ||
87 | public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) ; | ||
88 | |||
89 | // Runs a command with a number of parameters | ||
90 | public abstract Object RunCmd(string Cmd, string[] cmdparams) ; | ||
91 | |||
92 | // Shows data about something | ||
93 | public abstract void ShowCommands(string ShowWhat) ; | ||
94 | |||
95 | // Displays a prompt to the user and then runs the command they entered | ||
96 | public abstract void MainConsolePrompt() ; | ||
97 | } | ||
98 | } | ||
diff --git a/OGS/ServerConsole/ServerConsole.csproj b/OGS/ServerConsole/ServerConsole.csproj new file mode 100644 index 0000000..d23ca52 --- /dev/null +++ b/OGS/ServerConsole/ServerConsole.csproj | |||
@@ -0,0 +1,40 @@ | |||
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>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</ProjectGuid> | ||
8 | <OutputType>Library</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>ServerConsole</RootNamespace> | ||
11 | <AssemblyName>ServerConsole</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>..\common\bin\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="System" /> | ||
32 | <Reference Include="System.Data" /> | ||
33 | <Reference Include="System.Xml" /> | ||
34 | </ItemGroup> | ||
35 | <ItemGroup> | ||
36 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
37 | <Compile Include="ServerConsole.cs" /> | ||
38 | </ItemGroup> | ||
39 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
40 | </Project> \ No newline at end of file | ||
diff --git a/OGS/ServerConsole/default.build b/OGS/ServerConsole/default.build new file mode 100644 index 0000000..64a4f04 --- /dev/null +++ b/OGS/ServerConsole/default.build | |||
@@ -0,0 +1,48 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="ServerConsole" default="build" basedir="."> | ||
3 | <property name="debug" value="true" overwrite="false" /> | ||
4 | <target name="clean" description="remove all generated files"> | ||
5 | <delete file="../common/bin/ServerConsole.dll" failonerror="false" /> | ||
6 | <delete file="../common/bin/ServerConsole.dll.mdb" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="ogs-serverconsole" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="The default server console" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../common/bin/ServerConsole.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references> | ||
40 | <include name="System" /> | ||
41 | <include name="System.Xml" /> | ||
42 | </references> | ||
43 | <sources> | ||
44 | <include name="*.cs" /> | ||
45 | </sources> | ||
46 | </csc> | ||
47 | </target> | ||
48 | </project> | ||
diff --git a/OGS/common/VersionInfo/VersionInfo.cs b/OGS/common/VersionInfo/VersionInfo.cs new file mode 100644 index 0000000..9763e62 --- /dev/null +++ b/OGS/common/VersionInfo/VersionInfo.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.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 | |||
27 | using System; | ||
28 | |||
29 | namespace OpenGridServices | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public static string Version = "0.1, Build 1173843165, Revision 193:206M"; | ||
36 | } | ||
37 | } | ||
diff --git a/OGS/common/bin/ServerConsole.dll b/OGS/common/bin/ServerConsole.dll new file mode 100644 index 0000000..842e0d0 --- /dev/null +++ b/OGS/common/bin/ServerConsole.dll | |||
Binary files differ | |||
diff --git a/OGS/common/bin/ServerConsole.pdb b/OGS/common/bin/ServerConsole.pdb new file mode 100644 index 0000000..b0f3b63 --- /dev/null +++ b/OGS/common/bin/ServerConsole.pdb | |||
Binary files differ | |||
diff --git a/OGS/common/bin/libsecondlife.dll b/OGS/common/bin/libsecondlife.dll new file mode 100644 index 0000000..89d692a --- /dev/null +++ b/OGS/common/bin/libsecondlife.dll | |||
Binary files differ | |||
diff --git a/OGS/common/src/OGS-Console.cs b/OGS/common/src/OGS-Console.cs new file mode 100644 index 0000000..c35c75c --- /dev/null +++ b/OGS/common/src/OGS-Console.cs | |||
@@ -0,0 +1,181 @@ | |||
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 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Threading; | ||
32 | using System.IO; | ||
33 | using System.Net; | ||
34 | using ServerConsole; | ||
35 | |||
36 | namespace OpenGridServices | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Description of ServerConsole. | ||
40 | /// </summary> | ||
41 | public class MServerConsole : ConsoleBase | ||
42 | { | ||
43 | |||
44 | private ConsoleType ConsType; | ||
45 | StreamWriter Log; | ||
46 | public conscmd_callback cmdparser; | ||
47 | public string componentname; | ||
48 | |||
49 | // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! | ||
50 | // constype - the type of console to use (see enum ConsoleType) | ||
51 | // sparam - depending on the console type: | ||
52 | // TCP - the IP to bind to (127.0.0.1 if blank) | ||
53 | // Local - param ignored | ||
54 | // and for the iparam: | ||
55 | // TCP - the port to bind to | ||
56 | // Local - param ignored | ||
57 | // LogFile - duh | ||
58 | // componentname - which component of the OGS system? (user, asset etc) | ||
59 | // cmdparser - a reference to a conscmd_callback object | ||
60 | |||
61 | public MServerConsole(ConsoleType constype, string sparam, int iparam, string LogFile, string componentname, conscmd_callback cmdparser) { | ||
62 | ConsType = constype; | ||
63 | this.componentname = componentname; | ||
64 | this.cmdparser = cmdparser; | ||
65 | switch(constype) { | ||
66 | case ConsoleType.Local: | ||
67 | Console.WriteLine("ServerConsole.cs - creating new local console"); | ||
68 | Console.WriteLine("Logs will be saved to current directory in " + LogFile); | ||
69 | Log=File.AppendText(LogFile); | ||
70 | Log.WriteLine("========================================================================"); | ||
71 | Log.WriteLine(componentname + " " + VersionInfo.Version + " Started at " + DateTime.Now.ToString()); | ||
72 | break; | ||
73 | |||
74 | case ConsoleType.TCP: | ||
75 | break; | ||
76 | |||
77 | default: | ||
78 | Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public override void Close() { | ||
84 | Log.WriteLine("Shutdown at " + DateTime.Now.ToString()); | ||
85 | Log.Close(); | ||
86 | } | ||
87 | |||
88 | // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here | ||
89 | public override void WriteLine(string Line) { | ||
90 | Log.WriteLine(Line); | ||
91 | Console.WriteLine(Line); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | public override string ReadLine() { | ||
96 | string TempStr=Console.ReadLine(); | ||
97 | Log.WriteLine(TempStr); | ||
98 | return TempStr; | ||
99 | } | ||
100 | |||
101 | public override int Read() { | ||
102 | int TempInt= Console.Read(); | ||
103 | Log.Write((char)TempInt); | ||
104 | return TempInt; | ||
105 | } | ||
106 | |||
107 | public override void Write(string Line) { | ||
108 | Console.Write(Line); | ||
109 | Log.Write(Line); | ||
110 | return; | ||
111 | } | ||
112 | |||
113 | |||
114 | // Displays a prompt and waits for the user to enter a string, then returns that string | ||
115 | // Done with no echo and suitable for passwords | ||
116 | public override string PasswdPrompt(string prompt) { | ||
117 | // FIXME: Needs to be better abstracted | ||
118 | Log.WriteLine(prompt); | ||
119 | this.Write(prompt); | ||
120 | ConsoleColor oldfg=Console.ForegroundColor; | ||
121 | Console.ForegroundColor=Console.BackgroundColor; | ||
122 | string temp=Console.ReadLine(); | ||
123 | Console.ForegroundColor=oldfg; | ||
124 | return temp; | ||
125 | } | ||
126 | |||
127 | // Displays a command prompt and waits for the user to enter a string, then returns that string | ||
128 | public override string CmdPrompt(string prompt) { | ||
129 | this.Write(prompt); | ||
130 | return this.ReadLine(); | ||
131 | } | ||
132 | |||
133 | // Displays a command prompt and returns a default value if the user simply presses enter | ||
134 | public override string CmdPrompt(string prompt, string defaultresponse) { | ||
135 | string temp=CmdPrompt(prompt); | ||
136 | if(temp=="") { | ||
137 | return defaultresponse; | ||
138 | } else { | ||
139 | return temp; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | ||
144 | public override string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) { | ||
145 | bool itisdone=false; | ||
146 | string temp=CmdPrompt(prompt,defaultresponse); | ||
147 | while(itisdone==false) { | ||
148 | if((temp==OptionA) || (temp==OptionB)) { | ||
149 | itisdone=true; | ||
150 | } else { | ||
151 | this.WriteLine("Valid options are " + OptionA + " or " + OptionB); | ||
152 | temp=CmdPrompt(prompt,defaultresponse); | ||
153 | } | ||
154 | } | ||
155 | return temp; | ||
156 | } | ||
157 | |||
158 | // Runs a command with a number of parameters | ||
159 | public override Object RunCmd(string Cmd, string[] cmdparams) { | ||
160 | cmdparser.RunCmd(Cmd, cmdparams); | ||
161 | return null; | ||
162 | } | ||
163 | |||
164 | // Shows data about something | ||
165 | public override void ShowCommands(string ShowWhat) { | ||
166 | cmdparser.Show(ShowWhat); | ||
167 | } | ||
168 | |||
169 | public override void MainConsolePrompt() { | ||
170 | string[] tempstrarray; | ||
171 | string tempstr = this.CmdPrompt(this.componentname + "# "); | ||
172 | tempstrarray = tempstr.Split(' '); | ||
173 | string cmd=tempstrarray[0]; | ||
174 | Array.Reverse(tempstrarray); | ||
175 | Array.Resize<string>(ref tempstrarray,tempstrarray.Length-1); | ||
176 | Array.Reverse(tempstrarray); | ||
177 | string[] cmdparams=(string[])tempstrarray; | ||
178 | RunCmd(cmd,cmdparams); | ||
179 | } | ||
180 | } | ||
181 | } | ||
diff --git a/OGS/common/src/VersionInfo.cs.template b/OGS/common/src/VersionInfo.cs.template new file mode 100644 index 0000000..8f73b4b --- /dev/null +++ b/OGS/common/src/VersionInfo.cs.template | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.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 | |||
27 | using System; | ||
28 | |||
29 | namespace OpenGridServices | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public static string Version = "@@VERSION"; | ||
36 | } | ||
37 | } | ||
diff --git a/OGS/gridserver/default.build b/OGS/gridserver/default.build new file mode 100644 index 0000000..b113b83 --- /dev/null +++ b/OGS/gridserver/default.build | |||
@@ -0,0 +1,64 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="GridServer" default="build" basedir="./"> | ||
3 | <property name="debug" value="true" overwrite="false" /> | ||
4 | <target name="clean" description="remove all generated files"> | ||
5 | <delete> | ||
6 | <fileset failonempty="false"> | ||
7 | <include name="bin/*.dll" /> | ||
8 | <include name="bin/*.exe" /> | ||
9 | <include name="bin/*.mdb" /> | ||
10 | </fileset> | ||
11 | </delete> | ||
12 | </target> | ||
13 | |||
14 | <target name="svnupdate" description="updates to latest SVN"> | ||
15 | <exec program="svn"> | ||
16 | <arg value="update" /> | ||
17 | </exec> | ||
18 | </target> | ||
19 | |||
20 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
21 | |||
22 | </target> | ||
23 | |||
24 | <target name="build" description="compiles the source code"> | ||
25 | |||
26 | <loadfile file="../VERSION" property="svnver"/> | ||
27 | <asminfo output="src/AssemblyInfo.cs" language="CSharp"> | ||
28 | <imports> | ||
29 | <import namespace="System" /> | ||
30 | <import namespace="System.Reflection" /> | ||
31 | <import namespace="System.Runtime.InteropServices" /> | ||
32 | </imports> | ||
33 | <attributes> | ||
34 | <attribute type="ComVisibleAttribute" value="false" /> | ||
35 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
36 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
37 | <attribute type="AssemblyTitleAttribute" value="ogs-GridServer" /> | ||
38 | <attribute type="AssemblyDescriptionAttribute" value="The core OGS Grid Server" /> | ||
39 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
40 | </attributes> | ||
41 | </asminfo> | ||
42 | |||
43 | <csc target="exe" output="bin/GridServer.exe" debug="${debug}" verbose="true" warninglevel="4"> | ||
44 | <references failonempty="true"> | ||
45 | <include name="System" /> | ||
46 | <include name="System.Xml" /> | ||
47 | <include name="../common/bin/ServerConsole.dll" /> | ||
48 | <include name="../common/bin/libsecondlife.dll" /> | ||
49 | </references> | ||
50 | <sources> | ||
51 | <include name="../common/src/VersionInfo.cs" /> | ||
52 | <include name="../common/src/OGS-Console.cs" /> | ||
53 | <include name="../common/src/Util.cs" /> | ||
54 | <include name="src/*.cs" /> | ||
55 | </sources> | ||
56 | </csc> | ||
57 | |||
58 | <copy todir="bin/"> | ||
59 | <fileset basedir="../common/bin"> | ||
60 | <include name="*.*" /> | ||
61 | </fileset> | ||
62 | </copy> | ||
63 | </target> | ||
64 | </project> | ||
diff --git a/OGS/gridserver/src/ConsoleCmds.cs b/OGS/gridserver/src/ConsoleCmds.cs new file mode 100644 index 0000000..82a2279 --- /dev/null +++ b/OGS/gridserver/src/ConsoleCmds.cs | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | Copyright (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 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using ServerConsole; | ||
33 | |||
34 | namespace OpenGridServices | ||
35 | { | ||
36 | |||
37 | public class GridConsole : conscmd_callback { | ||
38 | public GridConsole() { } | ||
39 | |||
40 | public override void RunCmd(string cmd, string[] cmdparams) { | ||
41 | switch(cmd) { | ||
42 | case "help": | ||
43 | ServerConsole.MainConsole.Instance.WriteLine("shutdown - shutdown the grid (USE CAUTION!)" | ||
44 | ); | ||
45 | break; | ||
46 | |||
47 | case "shutdown": | ||
48 | ServerConsole.MainConsole.Instance.Close(); | ||
49 | Environment.Exit(0); | ||
50 | break; | ||
51 | } | ||
52 | } | ||
53 | |||
54 | public override void Show(string ShowWhat) { | ||
55 | } | ||
56 | } | ||
57 | } | ||
diff --git a/OGS/gridserver/src/GridHttp.cs b/OGS/gridserver/src/GridHttp.cs new file mode 100644 index 0000000..496a3bc --- /dev/null +++ b/OGS/gridserver/src/GridHttp.cs | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenGrid 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 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using Nwc.XmlRpc; | ||
33 | using System.Threading; | ||
34 | using System.Text.RegularExpressions; | ||
35 | using System.Net; | ||
36 | using System.IO; | ||
37 | using System.Collections; | ||
38 | using System.Collections.Generic; | ||
39 | using libsecondlife; | ||
40 | using ServerConsole; | ||
41 | using OpenSim.Framework.Sims; | ||
42 | |||
43 | namespace OpenGridServices | ||
44 | { | ||
45 | public class GridHTTPServer { | ||
46 | public Thread HTTPD; | ||
47 | public HttpListener Listener; | ||
48 | |||
49 | public GridHTTPServer() { | ||
50 | ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server"); | ||
51 | HTTPD = new Thread(new ThreadStart(StartHTTP)); | ||
52 | HTTPD.Start(); | ||
53 | } | ||
54 | |||
55 | public void StartHTTP() { | ||
56 | ServerConsole.MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Spawned main thread OK"); | ||
57 | Listener = new HttpListener(); | ||
58 | |||
59 | Listener.Prefixes.Add("http://+:8001/gridserver/"); | ||
60 | Listener.Start(); | ||
61 | |||
62 | HttpListenerContext context; | ||
63 | while(true) { | ||
64 | context = Listener.GetContext(); | ||
65 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | static string ParseXMLRPC(string requestBody) { | ||
70 | try{ | ||
71 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | ||
72 | |||
73 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
74 | switch(request.MethodName) { | ||
75 | case "get_sim_info": | ||
76 | ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]); | ||
77 | SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle); | ||
78 | string RecvKey=""; | ||
79 | string caller=(string)requestData["caller"]; | ||
80 | switch(caller) { | ||
81 | case "userserver": | ||
82 | RecvKey=OpenGrid_Main.thegrid.UserRecvKey; | ||
83 | break; | ||
84 | case "assetserver": | ||
85 | RecvKey=OpenGrid_Main.thegrid.AssetRecvKey; | ||
86 | break; | ||
87 | } | ||
88 | if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) { | ||
89 | XmlRpcResponse SimInfoResp = new XmlRpcResponse(); | ||
90 | Hashtable SimInfoData = new Hashtable(); | ||
91 | SimInfoData["UUID"]=TheSim.UUID.ToString(); | ||
92 | SimInfoData["regionhandle"]=TheSim.regionhandle.ToString(); | ||
93 | SimInfoData["regionname"]=TheSim.regionname; | ||
94 | SimInfoData["sim_ip"]=TheSim.sim_ip; | ||
95 | SimInfoData["sim_port"]=TheSim.sim_port.ToString(); | ||
96 | SimInfoData["caps_url"]=TheSim.caps_url; | ||
97 | SimInfoData["RegionLocX"]=TheSim.RegionLocX.ToString(); | ||
98 | SimInfoData["RegionLocY"]=TheSim.RegionLocY.ToString(); | ||
99 | SimInfoData["sendkey"]=TheSim.sendkey; | ||
100 | SimInfoData["recvkey"]=TheSim.recvkey; | ||
101 | SimInfoResp.Value=SimInfoData; | ||
102 | return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp),"utf-16","utf-8")); | ||
103 | } else { | ||
104 | XmlRpcResponse SimErrorResp = new XmlRpcResponse(); | ||
105 | Hashtable SimErrorData = new Hashtable(); | ||
106 | SimErrorData["error"]="sim not found"; | ||
107 | SimErrorResp.Value=SimErrorData; | ||
108 | return(XmlRpcResponseSerializer.Singleton.Serialize(SimErrorResp)); | ||
109 | } | ||
110 | break; | ||
111 | } | ||
112 | } catch(Exception e) { | ||
113 | Console.WriteLine(e.ToString()); | ||
114 | } | ||
115 | return ""; | ||
116 | } | ||
117 | |||
118 | static string ParseREST(string requestBody, string requestURL) { | ||
119 | return ""; | ||
120 | } | ||
121 | |||
122 | |||
123 | static void HandleRequest(Object stateinfo) { | ||
124 | HttpListenerContext context=(HttpListenerContext)stateinfo; | ||
125 | |||
126 | HttpListenerRequest request = context.Request; | ||
127 | HttpListenerResponse response = context.Response; | ||
128 | |||
129 | response.KeepAlive=false; | ||
130 | response.SendChunked=false; | ||
131 | |||
132 | System.IO.Stream body = request.InputStream; | ||
133 | System.Text.Encoding encoding = System.Text.Encoding.UTF8; | ||
134 | System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); | ||
135 | |||
136 | string requestBody = reader.ReadToEnd(); | ||
137 | body.Close(); | ||
138 | reader.Close(); | ||
139 | |||
140 | string responseString=""; | ||
141 | switch(request.ContentType) { | ||
142 | case "text/xml": | ||
143 | // must be XML-RPC, so pass to the XML-RPC parser | ||
144 | |||
145 | responseString=ParseXMLRPC(requestBody); | ||
146 | response.AddHeader("Content-type","text/xml"); | ||
147 | break; | ||
148 | |||
149 | case null: | ||
150 | // must be REST or invalid crap, so pass to the REST parser | ||
151 | responseString=ParseREST(request.Url.OriginalString,requestBody); | ||
152 | break; | ||
153 | } | ||
154 | |||
155 | |||
156 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); | ||
157 | System.IO.Stream output = response.OutputStream; | ||
158 | response.SendChunked=false; | ||
159 | response.ContentLength64=buffer.Length; | ||
160 | output.Write(buffer,0,buffer.Length); | ||
161 | output.Close(); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | |||
166 | } | ||
diff --git a/OGS/gridserver/src/Main.cs b/OGS/gridserver/src/Main.cs new file mode 100644 index 0000000..d29a1ae --- /dev/null +++ b/OGS/gridserver/src/Main.cs | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | Copyright (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 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | using ServerConsole; | ||
34 | |||
35 | namespace OpenGridServices | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// </summary> | ||
39 | public class OpenGrid_Main | ||
40 | { | ||
41 | |||
42 | public static OpenGrid_Main thegrid; | ||
43 | public string GridOwner; | ||
44 | public string DefaultStartupMsg; | ||
45 | public string DefaultAssetServer; | ||
46 | public string AssetSendKey; | ||
47 | public string AssetRecvKey; | ||
48 | public string DefaultUserServer; | ||
49 | public string UserSendKey; | ||
50 | public string UserRecvKey; | ||
51 | |||
52 | public GridHTTPServer _httpd; | ||
53 | public SimProfileManager _regionmanager; | ||
54 | |||
55 | [STAThread] | ||
56 | public static void Main( string[] args ) | ||
57 | { | ||
58 | Console.WriteLine("OpenGrid " + VersionInfo.Version + "\n"); | ||
59 | Console.WriteLine("Starting...\n"); | ||
60 | ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0, "opengrid-console.log", "OpenGrid", new GridConsole()); | ||
61 | |||
62 | thegrid = new OpenGrid_Main(); | ||
63 | thegrid.Startup(); | ||
64 | |||
65 | ServerConsole.MainConsole.Instance.WriteLine("\nEnter help for a list of commands\n"); | ||
66 | |||
67 | while(true) { | ||
68 | ServerConsole.MainConsole.Instance.MainConsolePrompt(); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | public void Startup() { | ||
73 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings"); | ||
74 | |||
75 | this.GridOwner=ServerConsole.MainConsole.Instance.CmdPrompt("Grid owner [OGS development team]: ","OGS development team"); | ||
76 | this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!]: ","Welcome to OGS!"); | ||
77 | |||
78 | this.DefaultAssetServer=ServerConsole.MainConsole.Instance.CmdPrompt("Default asset server [no default]: "); | ||
79 | this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to asset server: "); | ||
80 | this.AssetRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from asset server: "); | ||
81 | |||
82 | this.DefaultUserServer=ServerConsole.MainConsole.Instance.CmdPrompt("Default user server [no default]: "); | ||
83 | this.UserSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to user server: "); | ||
84 | this.UserRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from user server: "); | ||
85 | |||
86 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process"); | ||
87 | _httpd = new GridHTTPServer(); | ||
88 | |||
89 | this._regionmanager=new SimProfileManager(); | ||
90 | _regionmanager.CreateNewProfile("OpenSim Test", "http://there-is-no-caps.com", "4.78.190.75", 9000, 997, 996, this.UserSendKey, this.UserRecvKey); | ||
91 | |||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/OGS/gridserver/src/OGS-GridServer.csproj b/OGS/gridserver/src/OGS-GridServer.csproj new file mode 100644 index 0000000..b957d40 --- /dev/null +++ b/OGS/gridserver/src/OGS-GridServer.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>{FE50A574-C8ED-433B-95F0-213A5EED2AB2}</ProjectGuid> | ||
8 | <OutputType>Exe</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>OGS_GridServer</RootNamespace> | ||
11 | <AssemblyName>OGS-GridServer</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\..\common\bin\libsecondlife.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="System" /> | ||
36 | <Reference Include="System.Data" /> | ||
37 | <Reference Include="System.Xml" /> | ||
38 | </ItemGroup> | ||
39 | <ItemGroup> | ||
40 | <Compile Include="..\..\common\src\OGS-Console.cs"> | ||
41 | <Link>OGS-Console.cs</Link> | ||
42 | </Compile> | ||
43 | <Compile Include="..\..\common\VersionInfo\VersionInfo.cs"> | ||
44 | <Link>VersionInfo.cs</Link> | ||
45 | </Compile> | ||
46 | <Compile Include="ConsoleCmds.cs" /> | ||
47 | <Compile Include="GridHttp.cs" /> | ||
48 | <Compile Include="Main.cs" /> | ||
49 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
50 | <Compile Include="SimProfiles.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/OGS/gridserver/src/Properties/AssemblyInfo.cs b/OGS/gridserver/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8471e6b --- /dev/null +++ b/OGS/gridserver/src/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using 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/OGS/gridserver/src/SimProfiles.cs b/OGS/gridserver/src/SimProfiles.cs new file mode 100644 index 0000000..6db8331 --- /dev/null +++ b/OGS/gridserver/src/SimProfiles.cs | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenGrid 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 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using System.Collections; | ||
33 | using System.Collections.Generic; | ||
34 | using libsecondlife; | ||
35 | using ServerConsole; | ||
36 | using OpenSim.Framework.Utilities; | ||
37 | using OpenSim.Framework.Sims; | ||
38 | |||
39 | namespace OpenGridServices | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// </summary> | ||
43 | public class SimProfileManager { | ||
44 | |||
45 | public Dictionary<LLUUID, SimProfileBase> SimProfiles = new Dictionary<LLUUID, SimProfileBase>(); | ||
46 | |||
47 | public SimProfileManager() { | ||
48 | } | ||
49 | |||
50 | public void InitSimProfiles() { | ||
51 | // TODO: need to load from database | ||
52 | } | ||
53 | |||
54 | public SimProfileBase GetProfileByHandle(ulong reqhandle) { | ||
55 | foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) { | ||
56 | if(SimProfiles[UUID].regionhandle==reqhandle) return SimProfiles[UUID]; | ||
57 | } | ||
58 | return null; | ||
59 | } | ||
60 | |||
61 | public SimProfileBase GetProfileByLLUUID(LLUUID ProfileLLUUID) { | ||
62 | return SimProfiles[ProfileLLUUID]; | ||
63 | } | ||
64 | |||
65 | public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) { | ||
66 | SimProfileBase TheSim=GetProfileByHandle(regionhandle); | ||
67 | if(TheSim != null) | ||
68 | if(TheSim.recvkey==simrecvkey) { | ||
69 | return true; | ||
70 | } else { | ||
71 | return false; | ||
72 | } else return false; | ||
73 | |||
74 | } | ||
75 | |||
76 | public SimProfileBase CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) { | ||
77 | SimProfileBase newprofile = new SimProfileBase(); | ||
78 | newprofile.regionname=regionname; | ||
79 | newprofile.sim_ip=sim_ip; | ||
80 | newprofile.sim_port=sim_port; | ||
81 | newprofile.RegionLocX=RegionLocX; | ||
82 | newprofile.RegionLocY=RegionLocY; | ||
83 | newprofile.caps_url="http://" + sim_ip + ":9000/"; | ||
84 | newprofile.sendkey=sendkey; | ||
85 | newprofile.recvkey=recvkey; | ||
86 | newprofile.regionhandle=Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); | ||
87 | newprofile.UUID=LLUUID.Random(); | ||
88 | this.SimProfiles.Add(newprofile.UUID,newprofile); | ||
89 | return newprofile; | ||
90 | } | ||
91 | |||
92 | } | ||
93 | |||
94 | /* is in OpenSim.Framework | ||
95 | public class SimProfileBase { | ||
96 | public LLUUID UUID; | ||
97 | public ulong regionhandle; | ||
98 | public string regionname; | ||
99 | public string sim_ip; | ||
100 | public uint sim_port; | ||
101 | public string caps_url; | ||
102 | public uint RegionLocX; | ||
103 | public uint RegionLocY; | ||
104 | public string sendkey; | ||
105 | public string recvkey; | ||
106 | |||
107 | |||
108 | public SimProfileBase() { | ||
109 | } | ||
110 | |||
111 | |||
112 | }*/ | ||
113 | |||
114 | } | ||
diff --git a/OGS/userserver/src/ConsoleCmds.cs b/OGS/userserver/src/ConsoleCmds.cs new file mode 100644 index 0000000..f2568fc --- /dev/null +++ b/OGS/userserver/src/ConsoleCmds.cs | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | Copyright (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 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using ServerConsole; | ||
33 | |||
34 | namespace OpenGridServices | ||
35 | { | ||
36 | |||
37 | public class UserConsole : conscmd_callback { | ||
38 | public UserConsole() { } | ||
39 | |||
40 | public override void RunCmd(string cmd, string[] cmdparams) { | ||
41 | switch(cmd) { | ||
42 | case "help": | ||
43 | ServerConsole.MainConsole.Instance.WriteLine("shutdown - shutdown the user server (USE CAUTION!)" | ||
44 | ); | ||
45 | break; | ||
46 | |||
47 | case "shutdown": | ||
48 | ServerConsole.MainConsole.Instance.Close(); | ||
49 | Environment.Exit(0); | ||
50 | break; | ||
51 | } | ||
52 | } | ||
53 | |||
54 | public override void Show(string ShowWhat) { | ||
55 | } | ||
56 | } | ||
57 | } | ||
diff --git a/OGS/userserver/src/Main.cs b/OGS/userserver/src/Main.cs new file mode 100644 index 0000000..7e5308e --- /dev/null +++ b/OGS/userserver/src/Main.cs | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | Copyright (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 | |||
30 | using System; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Text; | ||
34 | using libsecondlife; | ||
35 | using ServerConsole; | ||
36 | using OpenSim.Framework.User; | ||
37 | using OpenSim.Framework.Sims; | ||
38 | using OpenSim.Framework.Inventory; | ||
39 | |||
40 | namespace OpenGridServices | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// </summary> | ||
44 | public class OpenUser_Main | ||
45 | { | ||
46 | |||
47 | public static OpenUser_Main userserver; | ||
48 | |||
49 | public UserHTTPServer _httpd; | ||
50 | public UserProfileManager _profilemanager; | ||
51 | public UserProfile GridGod; | ||
52 | public string DefaultStartupMsg; | ||
53 | public string GridURL; | ||
54 | public string GridSendKey; | ||
55 | public string GridRecvKey; | ||
56 | |||
57 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); | ||
58 | |||
59 | [STAThread] | ||
60 | public static void Main( string[] args ) | ||
61 | { | ||
62 | Console.WriteLine("OpenUser " + VersionInfo.Version + "\n"); | ||
63 | Console.WriteLine("Starting...\n"); | ||
64 | ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0, "opengrid-console.log", "OpenUser", new UserConsole()); | ||
65 | |||
66 | userserver = new OpenUser_Main(); | ||
67 | userserver.Startup(); | ||
68 | |||
69 | ServerConsole.MainConsole.Instance.WriteLine("\nEnter help for a list of commands\n"); | ||
70 | |||
71 | while(true) { | ||
72 | ServerConsole.MainConsole.Instance.MainConsolePrompt(); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | public void Startup() { | ||
77 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings"); | ||
78 | |||
79 | this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: "); | ||
80 | this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: "); | ||
81 | this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: "); | ||
82 | |||
83 | this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!] :","Welcome to OGS!"); | ||
84 | |||
85 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager"); | ||
86 | _profilemanager = new UserProfileManager(); | ||
87 | _profilemanager.InitUserProfiles(); | ||
88 | _profilemanager.SetKeys(GridSendKey, GridRecvKey, GridURL, DefaultStartupMsg); | ||
89 | |||
90 | |||
91 | string tempfirstname; | ||
92 | string templastname; | ||
93 | string tempMD5Passwd; | ||
94 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please configure the grid god user:"); | ||
95 | tempfirstname=ServerConsole.MainConsole.Instance.CmdPrompt("First name: "); | ||
96 | templastname=ServerConsole.MainConsole.Instance.CmdPrompt("Last name: "); | ||
97 | tempMD5Passwd=ServerConsole.MainConsole.Instance.PasswdPrompt("Password: "); | ||
98 | |||
99 | System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider(); | ||
100 | byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd); | ||
101 | bs = x.ComputeHash(bs); | ||
102 | System.Text.StringBuilder s = new System.Text.StringBuilder(); | ||
103 | foreach (byte b in bs) | ||
104 | { | ||
105 | s.Append(b.ToString("x2").ToLower()); | ||
106 | } | ||
107 | tempMD5Passwd = "$1$" + s.ToString(); | ||
108 | |||
109 | GridGod=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd); | ||
110 | _profilemanager.SetGod(GridGod.UUID); | ||
111 | GridGod.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f); | ||
112 | GridGod.homepos = new LLVector3(128f,128f,23f); | ||
113 | |||
114 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process"); | ||
115 | _httpd = new UserHTTPServer(); | ||
116 | } | ||
117 | } | ||
118 | } | ||
diff --git a/OGS/userserver/src/OGS-UserServer.csproj b/OGS/userserver/src/OGS-UserServer.csproj new file mode 100644 index 0000000..f4fa8b6 --- /dev/null +++ b/OGS/userserver/src/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/OGS/userserver/src/OGS-UserServer.csproj.user b/OGS/userserver/src/OGS-UserServer.csproj.user new file mode 100644 index 0000000..aa75a3d --- /dev/null +++ b/OGS/userserver/src/OGS-UserServer.csproj.user | |||
@@ -0,0 +1,8 @@ | |||
1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <PublishUrlHistory>publish\</PublishUrlHistory> | ||
4 | <ApplicationRevision>0</ApplicationRevision> | ||
5 | <FallbackCulture>en-US</FallbackCulture> | ||
6 | <VerifyUploadedFiles>false</VerifyUploadedFiles> | ||
7 | </PropertyGroup> | ||
8 | </Project> \ No newline at end of file | ||
diff --git a/OGS/userserver/src/Properties/AssemblyInfo.cs b/OGS/userserver/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5d5ce8d --- /dev/null +++ b/OGS/userserver/src/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using 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/OGS/userserver/src/UserHttp.cs b/OGS/userserver/src/UserHttp.cs new file mode 100644 index 0000000..ce3cfcd --- /dev/null +++ b/OGS/userserver/src/UserHttp.cs | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenGrid 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 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using Nwc.XmlRpc; | ||
33 | using System.Threading; | ||
34 | using System.Text.RegularExpressions; | ||
35 | using System.Net; | ||
36 | using System.IO; | ||
37 | using System.Collections; | ||
38 | using System.Collections.Generic; | ||
39 | using libsecondlife; | ||
40 | using ServerConsole; | ||
41 | using OpenSim.Framework.User; | ||
42 | using OpenSim.Framework.Sims; | ||
43 | using OpenSim.Framework.Inventory; | ||
44 | |||
45 | namespace OpenGridServices | ||
46 | { | ||
47 | public class UserHTTPServer { | ||
48 | public Thread HTTPD; | ||
49 | public HttpListener Listener; | ||
50 | |||
51 | public UserHTTPServer() { | ||
52 | ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server"); | ||
53 | HTTPD = new Thread(new ThreadStart(StartHTTP)); | ||
54 | HTTPD.Start(); | ||
55 | } | ||
56 | |||
57 | public void StartHTTP() { | ||
58 | ServerConsole.MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK"); | ||
59 | Listener = new HttpListener(); | ||
60 | |||
61 | Listener.Prefixes.Add("http://+:8002/userserver/"); | ||
62 | Listener.Prefixes.Add("http://+:8002/usersessions/"); | ||
63 | Listener.Start(); | ||
64 | |||
65 | HttpListenerContext context; | ||
66 | while(true) { | ||
67 | context = Listener.GetContext(); | ||
68 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | static string ParseXMLRPC(string requestBody) { | ||
73 | return OpenGridServices.OpenUser_Main.userserver._profilemanager.ParseXMLRPC(requestBody); | ||
74 | } | ||
75 | |||
76 | static string ParseREST(HttpListenerRequest www_req) { | ||
77 | Console.WriteLine("INCOMING REST - " + www_req.RawUrl); | ||
78 | |||
79 | char[] splitter = {'/'}; | ||
80 | string[] rest_params = www_req.RawUrl.Split(splitter); | ||
81 | string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla | ||
82 | switch(req_type) { | ||
83 | case "usersessions": | ||
84 | LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid | ||
85 | if(www_req.HttpMethod=="DELETE") { | ||
86 | foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) { | ||
87 | if(OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID==sessionid) { | ||
88 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID=null; | ||
89 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID=null; | ||
90 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear(); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | } | ||
95 | return "OK"; | ||
96 | break; | ||
97 | } | ||
98 | |||
99 | return ""; | ||
100 | } | ||
101 | |||
102 | |||
103 | static void HandleRequest(Object stateinfo) { | ||
104 | HttpListenerContext context=(HttpListenerContext)stateinfo; | ||
105 | |||
106 | HttpListenerRequest request = context.Request; | ||
107 | HttpListenerResponse response = context.Response; | ||
108 | |||
109 | response.KeepAlive=false; | ||
110 | response.SendChunked=false; | ||
111 | |||
112 | System.IO.Stream body = request.InputStream; | ||
113 | System.Text.Encoding encoding = System.Text.Encoding.UTF8; | ||
114 | System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); | ||
115 | |||
116 | string requestBody = reader.ReadToEnd(); | ||
117 | body.Close(); | ||
118 | reader.Close(); | ||
119 | |||
120 | string responseString=""; | ||
121 | switch(request.ContentType) { | ||
122 | case "text/xml": | ||
123 | // must be XML-RPC, so pass to the XML-RPC parser | ||
124 | |||
125 | responseString=ParseXMLRPC(requestBody); | ||
126 | response.AddHeader("Content-type","text/xml"); | ||
127 | break; | ||
128 | |||
129 | case "text/plaintext": | ||
130 | responseString=ParseREST(request); | ||
131 | response.AddHeader("Content-type","text/plaintext"); | ||
132 | break; | ||
133 | } | ||
134 | |||
135 | |||
136 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); | ||
137 | System.IO.Stream output = response.OutputStream; | ||
138 | response.SendChunked=false; | ||
139 | response.ContentLength64=buffer.Length; | ||
140 | output.Write(buffer,0,buffer.Length); | ||
141 | output.Close(); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | |||
146 | } | ||