diff options
author | gareth | 2007-03-22 10:11:15 +0000 |
---|---|---|
committer | gareth | 2007-03-22 10:11:15 +0000 |
commit | 7daa3955bc3a1918e40962851f9e8d38597a245e (patch) | |
tree | bee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /OpenSim.Framework | |
parent | Load XML for neighbourinfo from grid (diff) | |
download | opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.zip opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2 opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz |
brought zircon branch into trunk
Diffstat (limited to '')
30 files changed, 1432 insertions, 160 deletions
diff --git a/OpenSim.Framework.Console/AssemblyInfo.cs b/OpenSim.Framework.Console/AssemblyInfo.cs new file mode 100644 index 0000000..00a9b7d --- /dev/null +++ b/OpenSim.Framework.Console/AssemblyInfo.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using 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("ServerConsole")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("ServerConsole")] | ||
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/OpenSim.Framework.Console/ConsoleBase.cs b/OpenSim.Framework.Console/ConsoleBase.cs new file mode 100644 index 0000000..5343e71 --- /dev/null +++ b/OpenSim.Framework.Console/ConsoleBase.cs | |||
@@ -0,0 +1,45 @@ | |||
1 | using System; | ||
2 | |||
3 | namespace OpenSim.Framework.Console | ||
4 | { | ||
5 | public abstract class ConsoleBase | ||
6 | { | ||
7 | |||
8 | public enum ConsoleType | ||
9 | { | ||
10 | Local, // Use stdio | ||
11 | TCP, // Use TCP/telnet | ||
12 | SimChat // Use in-world chat (for gods) | ||
13 | } | ||
14 | |||
15 | public abstract void Close(); | ||
16 | |||
17 | public abstract void Write(string format, params object[] args); | ||
18 | |||
19 | public abstract void WriteLine(string format, params object[] args); | ||
20 | |||
21 | public abstract string ReadLine(); | ||
22 | |||
23 | public abstract int Read(); | ||
24 | |||
25 | // Displays a command prompt and waits for the user to enter a string, then returns that string | ||
26 | public abstract string CmdPrompt(string prompt); | ||
27 | |||
28 | // Displays a command prompt and returns a default value if the user simply presses enter | ||
29 | public abstract string CmdPrompt(string prompt, string defaultresponse); | ||
30 | |||
31 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | ||
32 | public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB); | ||
33 | |||
34 | // Runs a command with a number of parameters | ||
35 | public abstract Object RunCmd(string Cmd, string[] cmdparams); | ||
36 | |||
37 | // Shows data about something | ||
38 | public abstract void ShowCommands(string ShowWhat); | ||
39 | |||
40 | // Displays a prompt to the user and then runs the command they entered | ||
41 | public abstract void MainConsolePrompt(); | ||
42 | |||
43 | public abstract void SetStatus(string status); | ||
44 | } | ||
45 | } | ||
diff --git a/src/VersionInfo.cs.template b/OpenSim.Framework.Console/MainConsole.cs index e4e1b95..02c4ae8 100644 --- a/src/VersionInfo.cs.template +++ b/OpenSim.Framework.Console/MainConsole.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) OpenSim project, http://osgrid.org/ | 2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions are met: | 5 | * modification, are permitted provided that the following conditions are met: |
@@ -22,16 +22,27 @@ Copyright (c) OpenSim project, http://osgrid.org/ | |||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | * | ||
25 | */ | 26 | */ |
26 | |||
27 | using System; | 27 | using System; |
28 | 28 | ||
29 | namespace OpenSim | 29 | namespace OpenSim.Framework.Console |
30 | { | 30 | { |
31 | /// <summary> | 31 | public class MainConsole { |
32 | /// </summary> | 32 | |
33 | public class VersionInfo | 33 | private static ConsoleBase instance; |
34 | { | 34 | |
35 | public static string Version = "@@VERSION"; | 35 | public static ConsoleBase Instance |
36 | } | 36 | { |
37 | get | ||
38 | { | ||
39 | return instance; | ||
40 | } | ||
41 | set | ||
42 | { | ||
43 | instance = value; | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
37 | } | 48 | } |
diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj b/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj new file mode 100644 index 0000000..1f0da56 --- /dev/null +++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj | |||
@@ -0,0 +1,85 @@ | |||
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>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Framework.Console</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>OpenSim.Framework.Console</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 | </Reference> | ||
64 | </ItemGroup> | ||
65 | <ItemGroup> | ||
66 | </ItemGroup> | ||
67 | <ItemGroup> | ||
68 | <Compile Include="AssemblyInfo.cs"> | ||
69 | <SubType>Code</SubType> | ||
70 | </Compile> | ||
71 | <Compile Include="ConsoleBase.cs"> | ||
72 | <SubType>Code</SubType> | ||
73 | </Compile> | ||
74 | <Compile Include="MainConsole.cs"> | ||
75 | <SubType>Code</SubType> | ||
76 | </Compile> | ||
77 | </ItemGroup> | ||
78 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
79 | <PropertyGroup> | ||
80 | <PreBuildEvent> | ||
81 | </PreBuildEvent> | ||
82 | <PostBuildEvent> | ||
83 | </PostBuildEvent> | ||
84 | </PropertyGroup> | ||
85 | </Project> | ||
diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build new file mode 100644 index 0000000..9ceaea6 --- /dev/null +++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build | |||
@@ -0,0 +1,41 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Framework.Console" 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="OpenSim.Framework.Console" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="ConsoleBase.cs" /> | ||
16 | <include name="MainConsole.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 | </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> | ||
diff --git a/OpenSim.Framework/AgentCiruitData.cs b/OpenSim.Framework/AgentCiruitData.cs new file mode 100644 index 0000000..3ab8a80 --- /dev/null +++ b/OpenSim.Framework/AgentCiruitData.cs | |||
@@ -0,0 +1,18 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Interfaces | ||
7 | { | ||
8 | public class AgentCircuitData | ||
9 | { | ||
10 | public AgentCircuitData() { } | ||
11 | public LLUUID AgentID; | ||
12 | public LLUUID SessionID; | ||
13 | public LLUUID SecureSessionID; | ||
14 | public string firstname; | ||
15 | public string lastname; | ||
16 | public uint circuitcode; | ||
17 | } | ||
18 | } | ||
diff --git a/OpenSim.Framework/AssetBase.cs b/OpenSim.Framework/AssetBase.cs new file mode 100644 index 0000000..8206b30 --- /dev/null +++ b/OpenSim.Framework/AssetBase.cs | |||
@@ -0,0 +1,22 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Assets | ||
7 | { | ||
8 | public class AssetBase | ||
9 | { | ||
10 | public byte[] Data; | ||
11 | public LLUUID FullID; | ||
12 | public sbyte Type; | ||
13 | public sbyte InvType; | ||
14 | public string Name; | ||
15 | public string Description; | ||
16 | |||
17 | public AssetBase() | ||
18 | { | ||
19 | |||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/OpenSim.Framework/BlockingQueue.cs b/OpenSim.Framework/BlockingQueue.cs new file mode 100644 index 0000000..f840354 --- /dev/null +++ b/OpenSim.Framework/BlockingQueue.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System; | ||
2 | using System.Threading; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | |||
6 | namespace OpenSim.Framework.Utilities | ||
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/src/HeightMapGenHills.cs b/OpenSim.Framework/HeightMapGenHills.cs index e7589af..6a729da 100644 --- a/src/HeightMapGenHills.cs +++ b/OpenSim.Framework/HeightMapGenHills.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | 29 | ||
30 | namespace OpenSim | 30 | namespace OpenSim.Framework.Terrain |
31 | { | 31 | { |
32 | public class HeightmapGenHills | 32 | public class HeightmapGenHills |
33 | { | 33 | { |
diff --git a/src/GridInterfaces/IAssetServer.cs b/OpenSim.Framework/IAssetServer.cs index 6050a6c..a0de548 100644 --- a/src/GridInterfaces/IAssetServer.cs +++ b/OpenSim.Framework/IAssetServer.cs | |||
@@ -30,53 +30,39 @@ using System.Net.Sockets; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Assets; | ||
33 | 34 | ||
34 | 35 | namespace OpenSim.Framework.Interfaces | |
35 | namespace OpenSim.GridServers | ||
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Description of IAssetServer. | 38 | /// Description of IAssetServer. |
39 | /// </summary> | 39 | /// </summary> |
40 | 40 | ||
41 | public interface IAssetServer | 41 | public interface IAssetServer |
42 | { | 42 | { |
43 | void SetReceiver(IAssetReceiver receiver); | 43 | void SetReceiver(IAssetReceiver receiver); |
44 | void RequestAsset(LLUUID assetID, bool isTexture); | 44 | void RequestAsset(LLUUID assetID, bool isTexture); |
45 | void UpdateAsset(AssetBase asset); | 45 | void UpdateAsset(AssetBase asset); |
46 | void UploadNewAsset(AssetBase asset); | 46 | void UploadNewAsset(AssetBase asset); |
47 | void SetServerInfo(string ServerUrl, string ServerKey); | 47 | void SetServerInfo(string ServerUrl, string ServerKey); |
48 | } | 48 | void Close(); |
49 | 49 | } | |
50 | // could change to delegate? | 50 | |
51 | public interface IAssetReceiver | 51 | // could change to delegate? |
52 | { | 52 | public interface IAssetReceiver |
53 | void AssetReceived(AssetBase asset, bool IsTexture); | 53 | { |
54 | void AssetNotFound(AssetBase asset); | 54 | void AssetReceived(AssetBase asset, bool IsTexture); |
55 | } | 55 | void AssetNotFound(AssetBase asset); |
56 | 56 | } | |
57 | public struct ARequest | 57 | |
58 | { | 58 | public interface IAssetPlugin |
59 | public LLUUID AssetID; | 59 | { |
60 | public bool IsTexture; | 60 | IAssetServer GetAssetServer(); |
61 | } | 61 | } |
62 | 62 | ||
63 | public class AssetBase | 63 | public struct ARequest |
64 | { | 64 | { |
65 | public byte[] Data; | 65 | public LLUUID AssetID; |
66 | public LLUUID FullID; | 66 | public bool IsTexture; |
67 | public sbyte Type; | 67 | } |
68 | public sbyte InvType; | ||
69 | public string Name; | ||
70 | public string Description; | ||
71 | |||
72 | public AssetBase() | ||
73 | { | ||
74 | |||
75 | } | ||
76 | } | ||
77 | |||
78 | public interface IAssetPlugin | ||
79 | { | ||
80 | IAssetServer GetAssetServer(); | ||
81 | } | ||
82 | } | 68 | } |
diff --git a/src/Config.cs b/OpenSim.Framework/IConfig.cs index 1c0a6cc..ca7f645 100644 --- a/src/Config.cs +++ b/OpenSim.Framework/IConfig.cs | |||
@@ -31,49 +31,48 @@ using System; | |||
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.IO; | 32 | using System.IO; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.world; | 34 | //using OpenSim.world; |
35 | 35 | ||
36 | namespace OpenSim | 36 | namespace OpenSim.Framework.Interfaces |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// This class handles connection to the underlying database used for configuration of the region. | 39 | /// This class handles connection to the underlying database used for configuration of the region. |
40 | /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate | 40 | /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate |
41 | /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from | 41 | /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from |
42 | /// what is hardcoded here and then saved into opensim.yap for future startups. | 42 | /// what is hardcoded here and then saved into opensim.yap for future startups. |
43 | /// </summary> | 43 | /// </summary> |
44 | 44 | ||
45 | 45 | ||
46 | public abstract class SimConfig | 46 | public abstract class SimConfig |
47 | { | 47 | { |
48 | public string RegionName; | 48 | public string RegionName; |
49 | 49 | ||
50 | public uint RegionLocX; | 50 | public uint RegionLocX; |
51 | public uint RegionLocY; | 51 | public uint RegionLocY; |
52 | public ulong RegionHandle; | 52 | public ulong RegionHandle; |
53 | 53 | ||
54 | public int IPListenPort; | 54 | public int IPListenPort; |
55 | public string IPListenAddr; | 55 | public string IPListenAddr; |
56 | 56 | ||
57 | public string AssetURL; | 57 | public string AssetURL; |
58 | public string AssetSendKey; | 58 | public string AssetSendKey; |
59 | 59 | ||
60 | public string GridURL; | 60 | public string GridURL; |
61 | public string GridSendKey; | 61 | public string GridSendKey; |
62 | public string GridRecvKey; | 62 | public string GridRecvKey; |
63 | public string UserURL; | 63 | public string UserURL; |
64 | public string UserSendKey; | 64 | public string UserSendKey; |
65 | public string UserRecvKey; | 65 | public string UserRecvKey; |
66 | |||
67 | public abstract void InitConfig(bool sandboxMode); | ||
68 | public abstract void LoadFromGrid(); | ||
69 | public abstract float[] LoadWorld(); | ||
70 | public abstract void SaveMap(float[] heightmap); | ||
71 | |||
72 | } | ||
66 | 73 | ||
67 | 74 | public interface ISimConfig | |
68 | public abstract void InitConfig(); | 75 | { |
69 | public abstract void LoadFromGrid(); | 76 | SimConfig GetConfigObject(); |
70 | public abstract World LoadWorld(); | 77 | } |
71 | public abstract void SaveMap(); | ||
72 | |||
73 | } | ||
74 | |||
75 | public interface ISimConfig | ||
76 | { | ||
77 | SimConfig GetConfigObject(); | ||
78 | } | ||
79 | } | 78 | } |
diff --git a/src/GridInterfaces/ILocalStorage.cs b/OpenSim.Framework/IGridServer.cs index 6b7ded6..026dfab 100644 --- a/src/GridInterfaces/ILocalStorage.cs +++ b/OpenSim.Framework/IGridServer.cs | |||
@@ -25,62 +25,54 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | 27 | ||
28 | |||
28 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.IO; | ||
29 | using libsecondlife; | 34 | using libsecondlife; |
35 | using OpenSim; | ||
30 | 36 | ||
31 | namespace GridInterfaces | 37 | namespace OpenSim.Framework.Interfaces |
32 | { | 38 | { |
33 | /// <summary> | 39 | /// <summary> |
34 | /// ILocalStorage. Really hacked together right now needs cleaning up | 40 | /// Handles connection to Grid Servers. |
35 | /// </summary> | 41 | /// also Sim to Sim connections? |
36 | public interface ILocalStorage | 42 | /// </summary> |
37 | { | 43 | |
38 | void StorePrim(PrimData prim); | 44 | public interface IGridServer |
39 | void RemovePrim(LLUUID primID); | 45 | { |
40 | void LoadPrimitives(ILocalStorageReceiver receiver); | 46 | UUIDBlock RequestUUIDBlock(); |
41 | void ShutDown(); | 47 | NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions |
42 | } | 48 | AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); |
43 | 49 | bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | |
44 | public interface ILocalStorageReceiver | 50 | string GetName(); |
45 | { | 51 | bool RequestConnection(); |
46 | void PrimFromStorage(PrimData prim); | 52 | void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); |
47 | } | 53 | void Close(); |
48 | 54 | } | |
49 | 55 | ||
50 | public class PrimData | 56 | public struct UUIDBlock |
51 | { | 57 | { |
52 | public LLUUID OwnerID; | 58 | public LLUUID BlockStart; |
53 | public byte PCode; | 59 | public LLUUID BlockEnd; |
54 | public byte PathBegin; | 60 | } |
55 | public byte PathEnd; | 61 | |
56 | public byte PathScaleX; | 62 | public class AuthenticateResponse |
57 | public byte PathScaleY; | 63 | { |
58 | public byte PathShearX; | 64 | public bool Authorised; |
59 | public byte PathShearY; | 65 | public Login LoginInfo; |
60 | public sbyte PathSkew; | 66 | |
61 | public byte ProfileBegin; | 67 | public AuthenticateResponse() |
62 | public byte ProfileEnd; | 68 | { |
63 | public LLVector3 Scale; | 69 | |
64 | public byte PathCurve; | 70 | } |
65 | public byte ProfileCurve; | 71 | |
66 | public uint ParentID=0; | 72 | } |
67 | public byte ProfileHollow; | 73 | |
68 | public sbyte PathRadiusOffset; | 74 | public interface IGridPlugin |
69 | public byte PathRevolutions; | 75 | { |
70 | public sbyte PathTaperX; | 76 | IGridServer GetGridServer(); |
71 | public sbyte PathTaperY; | 77 | } |
72 | public sbyte PathTwist; | ||
73 | public sbyte PathTwistBegin; | ||
74 | |||
75 | //following only used during prim storage | ||
76 | public LLVector3 Position; | ||
77 | public LLQuaternion Rotation; | ||
78 | public uint LocalID; | ||
79 | public LLUUID FullID; | ||
80 | |||
81 | public PrimData() | ||
82 | { | ||
83 | |||
84 | } | ||
85 | } | ||
86 | } | 78 | } |
diff --git a/OpenSim.Framework/ILocalStorage.cs b/OpenSim.Framework/ILocalStorage.cs new file mode 100644 index 0000000..e9aa1a2 --- /dev/null +++ b/OpenSim.Framework/ILocalStorage.cs | |||
@@ -0,0 +1,51 @@ | |||
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 libsecondlife; | ||
30 | using OpenSim.Framework.Assets; | ||
31 | |||
32 | namespace OpenSim.Framework.Interfaces | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// ILocalStorage. Really hacked together right now needs cleaning up | ||
36 | /// </summary> | ||
37 | public interface ILocalStorage | ||
38 | { | ||
39 | void StorePrim(PrimData prim); | ||
40 | void RemovePrim(LLUUID primID); | ||
41 | void LoadPrimitives(ILocalStorageReceiver receiver); | ||
42 | void ShutDown(); | ||
43 | } | ||
44 | |||
45 | public interface ILocalStorageReceiver | ||
46 | { | ||
47 | void PrimFromStorage(PrimData prim); | ||
48 | } | ||
49 | |||
50 | } | ||
51 | |||
diff --git a/OpenSim.Framework/IUserServer.cs b/OpenSim.Framework/IUserServer.cs new file mode 100644 index 0000000..bb2b668 --- /dev/null +++ b/OpenSim.Framework/IUserServer.cs | |||
@@ -0,0 +1,14 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Inventory; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenSim.Framework.Interfaces | ||
8 | { | ||
9 | public interface IUserServer | ||
10 | { | ||
11 | AgentInventory RequestAgentsInventory(LLUUID agentID); | ||
12 | void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); | ||
13 | } | ||
14 | } | ||
diff --git a/OpenSim.Framework/Inventory.cs b/OpenSim.Framework/Inventory.cs new file mode 100644 index 0000000..e34ea75 --- /dev/null +++ b/OpenSim.Framework/Inventory.cs | |||
@@ -0,0 +1,127 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Assets; | ||
6 | |||
7 | namespace OpenSim.Framework.Inventory | ||
8 | { | ||
9 | public class AgentInventory | ||
10 | { | ||
11 | //Holds the local copy of Inventory info for a agent | ||
12 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; | ||
13 | public Dictionary<LLUUID, InventoryItem> InventoryItems; | ||
14 | public InventoryFolder InventoryRoot; | ||
15 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server | ||
16 | public LLUUID AgentID; | ||
17 | public AvatarWearable[] Wearables; | ||
18 | |||
19 | public AgentInventory() | ||
20 | { | ||
21 | InventoryFolders = new Dictionary<LLUUID, InventoryFolder>(); | ||
22 | InventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
23 | this.Initialise(); | ||
24 | } | ||
25 | |||
26 | public virtual void Initialise() | ||
27 | { | ||
28 | Wearables = new AvatarWearable[2]; //should be 12 of these | ||
29 | for (int i = 0; i < 2; i++) | ||
30 | { | ||
31 | Wearables[i] = new AvatarWearable(); | ||
32 | } | ||
33 | |||
34 | InventoryRoot = new InventoryFolder(); | ||
35 | InventoryRoot.FolderID = LLUUID.Random(); | ||
36 | InventoryRoot.ParentID = new LLUUID(); | ||
37 | InventoryRoot.Version = 1; | ||
38 | InventoryRoot.DefaultType = 8; | ||
39 | InventoryRoot.FolderName = "My Inventory"; | ||
40 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); | ||
41 | } | ||
42 | |||
43 | public bool CreateNewFolder(LLUUID folderID) | ||
44 | { | ||
45 | InventoryFolder Folder = new InventoryFolder(); | ||
46 | Folder.FolderID = folderID; | ||
47 | Folder.OwnerID = this.AgentID; | ||
48 | this.InventoryFolders.Add(Folder.FolderID, Folder); | ||
49 | |||
50 | return (true); | ||
51 | } | ||
52 | |||
53 | public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) | ||
54 | { | ||
55 | if (this.InventoryFolders.ContainsKey(folderID)) | ||
56 | { | ||
57 | LLUUID NewItemID = LLUUID.Random(); | ||
58 | |||
59 | InventoryItem Item = new InventoryItem(); | ||
60 | Item.FolderID = folderID; | ||
61 | Item.OwnerID = AgentID; | ||
62 | Item.AssetID = asset.FullID; | ||
63 | Item.ItemID = NewItemID; | ||
64 | Item.Type = asset.Type; | ||
65 | Item.Name = asset.Name; | ||
66 | Item.Description = asset.Description; | ||
67 | Item.InvType = asset.InvType; | ||
68 | this.InventoryItems.Add(Item.ItemID, Item); | ||
69 | InventoryFolder Folder = InventoryFolders[Item.FolderID]; | ||
70 | Folder.Items.Add(Item); | ||
71 | return (Item.ItemID); | ||
72 | } | ||
73 | else | ||
74 | { | ||
75 | return (null); | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | |||
80 | public class InventoryFolder | ||
81 | { | ||
82 | public List<InventoryItem> Items; | ||
83 | //public List<InventoryFolder> Subfolders; | ||
84 | public LLUUID FolderID; | ||
85 | public LLUUID OwnerID; | ||
86 | public LLUUID ParentID; | ||
87 | public string FolderName; | ||
88 | public ushort DefaultType; | ||
89 | public ushort Version; | ||
90 | |||
91 | public InventoryFolder() | ||
92 | { | ||
93 | Items = new List<InventoryItem>(); | ||
94 | //Subfolders = new List<InventoryFolder>(); | ||
95 | } | ||
96 | |||
97 | } | ||
98 | |||
99 | public class InventoryItem | ||
100 | { | ||
101 | public LLUUID FolderID; | ||
102 | public LLUUID OwnerID; | ||
103 | public LLUUID ItemID; | ||
104 | public LLUUID AssetID; | ||
105 | public LLUUID CreatorID; | ||
106 | public sbyte InvType; | ||
107 | public sbyte Type; | ||
108 | public string Name; | ||
109 | public string Description; | ||
110 | |||
111 | public InventoryItem() | ||
112 | { | ||
113 | this.CreatorID = LLUUID.Zero; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | public class AvatarWearable | ||
118 | { | ||
119 | public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
120 | public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
121 | |||
122 | public AvatarWearable() | ||
123 | { | ||
124 | |||
125 | } | ||
126 | } | ||
127 | } | ||
diff --git a/OpenSim.Framework/LocalGridBase.cs b/OpenSim.Framework/LocalGridBase.cs new file mode 100644 index 0000000..c9b278a --- /dev/null +++ b/OpenSim.Framework/LocalGridBase.cs | |||
@@ -0,0 +1,21 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Interfaces | ||
7 | { | ||
8 | public abstract class LocalGridBase : IGridServer | ||
9 | { | ||
10 | public abstract UUIDBlock RequestUUIDBlock(); | ||
11 | public abstract NeighbourInfo[] RequestNeighbours(); | ||
12 | public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
13 | public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
14 | public abstract string GetName(); | ||
15 | public abstract bool RequestConnection(); | ||
16 | public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); | ||
17 | public abstract void AddNewSession(Login session); | ||
18 | public abstract void Close(); | ||
19 | } | ||
20 | |||
21 | } | ||
diff --git a/OpenSim.Framework/Login.cs b/OpenSim.Framework/Login.cs new file mode 100644 index 0000000..8a67853 --- /dev/null +++ b/OpenSim.Framework/Login.cs | |||
@@ -0,0 +1,22 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Interfaces | ||
7 | { | ||
8 | public class Login | ||
9 | { | ||
10 | public string First = "Test"; | ||
11 | public string Last = "User"; | ||
12 | public LLUUID Agent; | ||
13 | public LLUUID Session; | ||
14 | public LLUUID SecureSession = LLUUID.Zero; | ||
15 | public LLUUID InventoryFolder; | ||
16 | public LLUUID BaseFolder; | ||
17 | public Login() | ||
18 | { | ||
19 | |||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/OpenSim.Framework/LoginService.cs b/OpenSim.Framework/LoginService.cs index 85fe761..eba0281 100644 --- a/src/OpenSim.Framework/LoginService.cs +++ b/OpenSim.Framework/LoginService.cs | |||
@@ -3,13 +3,12 @@ using System.Collections; | |||
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Text; | 4 | using System.Text; |
5 | using Nwc.XmlRpc; | 5 | using Nwc.XmlRpc; |
6 | using OpenSim.GridServers; | ||
7 | using libsecondlife; | 6 | using libsecondlife; |
8 | 7 | ||
9 | namespace OpenSim.Framework | 8 | namespace OpenSim.Framework.Grid |
10 | { | 9 | { |
11 | public abstract class LoginService | 10 | public abstract class LoginService |
12 | { | 11 | { |
13 | 12 | ||
14 | } | 13 | } |
15 | } | 14 | } \ No newline at end of file |
diff --git a/OpenSim.Framework/NeighbourInfo.cs b/OpenSim.Framework/NeighbourInfo.cs new file mode 100644 index 0000000..8b4fa64 --- /dev/null +++ b/OpenSim.Framework/NeighbourInfo.cs | |||
@@ -0,0 +1,19 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Interfaces | ||
6 | { | ||
7 | public class NeighbourInfo | ||
8 | { | ||
9 | public NeighbourInfo() | ||
10 | { | ||
11 | } | ||
12 | |||
13 | public ulong regionhandle; | ||
14 | public uint RegionLocX; | ||
15 | public uint RegionLocY; | ||
16 | public string sim_ip; | ||
17 | public uint sim_port; | ||
18 | } | ||
19 | } | ||
diff --git a/OpenSim.Framework/OpenSim.Framework.csproj b/OpenSim.Framework/OpenSim.Framework.csproj new file mode 100644 index 0000000..7a10319 --- /dev/null +++ b/OpenSim.Framework/OpenSim.Framework.csproj | |||
@@ -0,0 +1,151 @@ | |||
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>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Framework</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>OpenSim.Framework</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.dll" > | ||
62 | <HintPath>\System.dll.dll</HintPath> | ||
63 | </Reference> | ||
64 | <Reference Include="System.Xml.dll" > | ||
65 | <HintPath>\System.Xml.dll.dll</HintPath> | ||
66 | </Reference> | ||
67 | <Reference Include="libsecondlife.dll" > | ||
68 | <HintPath>\libsecondlife.dll.dll</HintPath> | ||
69 | </Reference> | ||
70 | </ItemGroup> | ||
71 | <ItemGroup> | ||
72 | </ItemGroup> | ||
73 | <ItemGroup> | ||
74 | <Compile Include="AgentCiruitData.cs"> | ||
75 | <SubType>Code</SubType> | ||
76 | </Compile> | ||
77 | <Compile Include="AssetBase.cs"> | ||
78 | <SubType>Code</SubType> | ||
79 | </Compile> | ||
80 | <Compile Include="BlockingQueue.cs"> | ||
81 | <SubType>Code</SubType> | ||
82 | </Compile> | ||
83 | <Compile Include="HeightMapGenHills.cs"> | ||
84 | <SubType>Code</SubType> | ||
85 | </Compile> | ||
86 | <Compile Include="IAssetServer.cs"> | ||
87 | <SubType>Code</SubType> | ||
88 | </Compile> | ||
89 | <Compile Include="IConfig.cs"> | ||
90 | <SubType>Code</SubType> | ||
91 | </Compile> | ||
92 | <Compile Include="IGridServer.cs"> | ||
93 | <SubType>Code</SubType> | ||
94 | </Compile> | ||
95 | <Compile Include="ILocalStorage.cs"> | ||
96 | <SubType>Code</SubType> | ||
97 | </Compile> | ||
98 | <Compile Include="Inventory.cs"> | ||
99 | <SubType>Code</SubType> | ||
100 | </Compile> | ||
101 | <Compile Include="IUserServer.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | <Compile Include="LocalGridBase.cs"> | ||
105 | <SubType>Code</SubType> | ||
106 | </Compile> | ||
107 | <Compile Include="Login.cs"> | ||
108 | <SubType>Code</SubType> | ||
109 | </Compile> | ||
110 | <Compile Include="LoginService.cs"> | ||
111 | <SubType>Code</SubType> | ||
112 | </Compile> | ||
113 | <Compile Include="NeighbourInfo.cs"> | ||
114 | <SubType>Code</SubType> | ||
115 | </Compile> | ||
116 | <Compile Include="PrimData.cs"> | ||
117 | <SubType>Code</SubType> | ||
118 | </Compile> | ||
119 | <Compile Include="RemoteGridBase.cs"> | ||
120 | <SubType>Code</SubType> | ||
121 | </Compile> | ||
122 | <Compile Include="SimProfile.cs"> | ||
123 | <SubType>Code</SubType> | ||
124 | </Compile> | ||
125 | <Compile Include="SimProfileBase.cs"> | ||
126 | <SubType>Code</SubType> | ||
127 | </Compile> | ||
128 | <Compile Include="UserProfile.cs"> | ||
129 | <SubType>Code</SubType> | ||
130 | </Compile> | ||
131 | <Compile Include="UserProfileManager.cs"> | ||
132 | <SubType>Code</SubType> | ||
133 | </Compile> | ||
134 | <Compile Include="UserProfileManagerBase.cs"> | ||
135 | <SubType>Code</SubType> | ||
136 | </Compile> | ||
137 | <Compile Include="Util.cs"> | ||
138 | <SubType>Code</SubType> | ||
139 | </Compile> | ||
140 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
141 | <SubType>Code</SubType> | ||
142 | </Compile> | ||
143 | </ItemGroup> | ||
144 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
145 | <PropertyGroup> | ||
146 | <PreBuildEvent> | ||
147 | </PreBuildEvent> | ||
148 | <PostBuildEvent> | ||
149 | </PostBuildEvent> | ||
150 | </PropertyGroup> | ||
151 | </Project> | ||
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build new file mode 100644 index 0000000..1418947 --- /dev/null +++ b/OpenSim.Framework/OpenSim.Framework.dll.build | |||
@@ -0,0 +1,63 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Framework" 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="OpenSim.Framework" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AgentCiruitData.cs" /> | ||
15 | <include name="AssetBase.cs" /> | ||
16 | <include name="BlockingQueue.cs" /> | ||
17 | <include name="HeightMapGenHills.cs" /> | ||
18 | <include name="IAssetServer.cs" /> | ||
19 | <include name="IConfig.cs" /> | ||
20 | <include name="IGridServer.cs" /> | ||
21 | <include name="ILocalStorage.cs" /> | ||
22 | <include name="Inventory.cs" /> | ||
23 | <include name="IUserServer.cs" /> | ||
24 | <include name="LocalGridBase.cs" /> | ||
25 | <include name="Login.cs" /> | ||
26 | <include name="LoginService.cs" /> | ||
27 | <include name="NeighbourInfo.cs" /> | ||
28 | <include name="PrimData.cs" /> | ||
29 | <include name="RemoteGridBase.cs" /> | ||
30 | <include name="SimProfile.cs" /> | ||
31 | <include name="SimProfileBase.cs" /> | ||
32 | <include name="UserProfile.cs" /> | ||
33 | <include name="UserProfileManager.cs" /> | ||
34 | <include name="UserProfileManagerBase.cs" /> | ||
35 | <include name="Util.cs" /> | ||
36 | <include name="Properties/AssemblyInfo.cs" /> | ||
37 | </sources> | ||
38 | <references basedir="${project::get-base-directory()}"> | ||
39 | <lib> | ||
40 | <include name="${project::get-base-directory()}" /> | ||
41 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
42 | </lib> | ||
43 | <include name="System.dll.dll" /> | ||
44 | <include name="System.Xml.dll.dll" /> | ||
45 | <include name="../bin/libsecondlife.dll" /> | ||
46 | </references> | ||
47 | </csc> | ||
48 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | ||
49 | <mkdir dir="${project::get-base-directory()}/../bin/"/> | ||
50 | <copy todir="${project::get-base-directory()}/../bin/"> | ||
51 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
52 | <include name="*.dll"/> | ||
53 | <include name="*.exe"/> | ||
54 | </fileset> | ||
55 | </copy> | ||
56 | </target> | ||
57 | <target name="clean"> | ||
58 | <delete dir="${bin.dir}" failonerror="false" /> | ||
59 | <delete dir="${obj.dir}" failonerror="false" /> | ||
60 | </target> | ||
61 | <target name="doc" description="Creates documentation."> | ||
62 | </target> | ||
63 | </project> | ||
diff --git a/OpenSim.Framework/PrimData.cs b/OpenSim.Framework/PrimData.cs new file mode 100644 index 0000000..175a014 --- /dev/null +++ b/OpenSim.Framework/PrimData.cs | |||
@@ -0,0 +1,45 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Assets | ||
7 | { | ||
8 | public class PrimData | ||
9 | { | ||
10 | public LLUUID OwnerID; | ||
11 | public byte PCode; | ||
12 | public byte PathBegin; | ||
13 | public byte PathEnd; | ||
14 | public byte PathScaleX; | ||
15 | public byte PathScaleY; | ||
16 | public byte PathShearX; | ||
17 | public byte PathShearY; | ||
18 | public sbyte PathSkew; | ||
19 | public byte ProfileBegin; | ||
20 | public byte ProfileEnd; | ||
21 | public LLVector3 Scale; | ||
22 | public byte PathCurve; | ||
23 | public byte ProfileCurve; | ||
24 | public uint ParentID = 0; | ||
25 | public byte ProfileHollow; | ||
26 | public sbyte PathRadiusOffset; | ||
27 | public byte PathRevolutions; | ||
28 | public sbyte PathTaperX; | ||
29 | public sbyte PathTaperY; | ||
30 | public sbyte PathTwist; | ||
31 | public sbyte PathTwistBegin; | ||
32 | public byte[] Texture; | ||
33 | |||
34 | //following only used during prim storage | ||
35 | public LLVector3 Position; | ||
36 | public LLQuaternion Rotation; | ||
37 | public uint LocalID; | ||
38 | public LLUUID FullID; | ||
39 | |||
40 | public PrimData() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/src/Properties/AssemblyInfo.cs b/OpenSim.Framework/Properties/AssemblyInfo.cs index 90fc127..86f5cdb 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/OpenSim.Framework/Properties/AssemblyInfo.cs | |||
@@ -5,12 +5,12 @@ using System.Runtime.InteropServices; | |||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("opensim")] | 8 | [assembly: AssemblyTitle("OpenSim.FrameWork")] |
9 | [assembly: AssemblyDescription("")] | 9 | [assembly: AssemblyDescription("")] |
10 | [assembly: AssemblyConfiguration("")] | 10 | [assembly: AssemblyConfiguration("")] |
11 | [assembly: AssemblyCompany("Playahead AB")] | 11 | [assembly: AssemblyCompany("")] |
12 | [assembly: AssemblyProduct("opensim")] | 12 | [assembly: AssemblyProduct("OpenSim.FrameWork")] |
13 | [assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] | 13 | [assembly: AssemblyCopyright("Copyright © 2007")] |
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices; | |||
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("1d09756b-a461-4302-b6fe-15c455317909")] | 23 | [assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] |
24 | 24 | ||
25 | // Version information for an assembly consists of the following four values: | 25 | // Version information for an assembly consists of the following four values: |
26 | // | 26 | // |
diff --git a/OpenSim.Framework/RemoteGridBase.cs b/OpenSim.Framework/RemoteGridBase.cs new file mode 100644 index 0000000..6ca57df --- /dev/null +++ b/OpenSim.Framework/RemoteGridBase.cs | |||
@@ -0,0 +1,25 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Interfaces | ||
7 | { | ||
8 | public abstract class RemoteGridBase : IGridServer | ||
9 | { | ||
10 | public abstract Dictionary<uint, AgentCircuitData> agentcircuits | ||
11 | { | ||
12 | get; | ||
13 | set; | ||
14 | } | ||
15 | |||
16 | public abstract UUIDBlock RequestUUIDBlock(); | ||
17 | public abstract NeighbourInfo[] RequestNeighbours(); | ||
18 | public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
19 | public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
20 | public abstract string GetName(); | ||
21 | public abstract bool RequestConnection(); | ||
22 | public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); | ||
23 | public abstract void Close(); | ||
24 | } | ||
25 | } | ||
diff --git a/OpenSim.Framework/SimProfile.cs b/OpenSim.Framework/SimProfile.cs new file mode 100644 index 0000000..ac4cf9e --- /dev/null +++ b/OpenSim.Framework/SimProfile.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections; | ||
4 | using System.Xml; | ||
5 | using System.Text; | ||
6 | using libsecondlife; | ||
7 | using Nwc.XmlRpc; | ||
8 | |||
9 | namespace OpenSim.Framework.Sims | ||
10 | { | ||
11 | public class SimProfile : SimProfileBase | ||
12 | { | ||
13 | public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey) | ||
14 | { | ||
15 | try | ||
16 | { | ||
17 | Hashtable GridReqParams = new Hashtable(); | ||
18 | GridReqParams["region_handle"] = region_handle.ToString(); | ||
19 | GridReqParams["caller"] = "userserver"; | ||
20 | GridReqParams["authkey"] = SendKey; | ||
21 | ArrayList SendParams = new ArrayList(); | ||
22 | SendParams.Add(GridReqParams); | ||
23 | XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info", SendParams); | ||
24 | |||
25 | XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); | ||
26 | |||
27 | Hashtable RespData = (Hashtable)GridResp.Value; | ||
28 | this.UUID = new LLUUID((string)RespData["UUID"]); | ||
29 | this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]); | ||
30 | this.regionname = (string)RespData["regionname"]; | ||
31 | this.sim_ip = (string)RespData["sim_ip"]; | ||
32 | this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); | ||
33 | this.caps_url = (string)RespData["caps_url"]; | ||
34 | this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]); | ||
35 | this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]); | ||
36 | this.sendkey = (string)RespData["sendkey"]; | ||
37 | this.recvkey = (string)RespData["recvkey"]; | ||
38 | } | ||
39 | catch (Exception e) | ||
40 | { | ||
41 | Console.WriteLine(e.ToString()); | ||
42 | } | ||
43 | return this; | ||
44 | } | ||
45 | |||
46 | public SimProfile() | ||
47 | { | ||
48 | } | ||
49 | } | ||
50 | |||
51 | } | ||
diff --git a/OpenSim.Framework/SimProfileBase.cs b/OpenSim.Framework/SimProfileBase.cs new file mode 100644 index 0000000..5fe2734 --- /dev/null +++ b/OpenSim.Framework/SimProfileBase.cs | |||
@@ -0,0 +1,25 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Sims | ||
7 | { | ||
8 | public class SimProfileBase | ||
9 | { | ||
10 | public LLUUID UUID; | ||
11 | public ulong regionhandle; | ||
12 | public string regionname; | ||
13 | public string sim_ip; | ||
14 | public uint sim_port; | ||
15 | public string caps_url; | ||
16 | public uint RegionLocX; | ||
17 | public uint RegionLocY; | ||
18 | public string sendkey; | ||
19 | public string recvkey; | ||
20 | |||
21 | public SimProfileBase() | ||
22 | { | ||
23 | } | ||
24 | } | ||
25 | } | ||
diff --git a/OpenSim.Framework/UserProfile.cs b/OpenSim.Framework/UserProfile.cs new file mode 100644 index 0000000..2c264c5 --- /dev/null +++ b/OpenSim.Framework/UserProfile.cs | |||
@@ -0,0 +1,50 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Inventory; | ||
6 | |||
7 | namespace OpenSim.Framework.User | ||
8 | { | ||
9 | public class UserProfile | ||
10 | { | ||
11 | |||
12 | public string firstname; | ||
13 | public string lastname; | ||
14 | public ulong homeregionhandle; | ||
15 | public LLVector3 homepos; | ||
16 | public LLVector3 homelookat; | ||
17 | |||
18 | public bool IsGridGod = false; | ||
19 | public bool IsLocal = true; // will be used in future for visitors from foreign grids | ||
20 | public string AssetURL; | ||
21 | public string MD5passwd; | ||
22 | |||
23 | public LLUUID CurrentSessionID; | ||
24 | public LLUUID CurrentSecureSessionID; | ||
25 | public LLUUID UUID; | ||
26 | public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes | ||
27 | |||
28 | public AgentInventory Inventory; | ||
29 | |||
30 | public UserProfile() | ||
31 | { | ||
32 | Circuits = new Dictionary<LLUUID, uint>(); | ||
33 | Inventory = new AgentInventory(); | ||
34 | homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ; | ||
35 | } | ||
36 | |||
37 | public void InitSessionData() | ||
38 | { | ||
39 | CurrentSessionID = LLUUID.Random(); | ||
40 | CurrentSecureSessionID = LLUUID.Random(); | ||
41 | } | ||
42 | |||
43 | public void AddSimCircuit(uint circuitCode, LLUUID regionUUID) | ||
44 | { | ||
45 | if (this.Circuits.ContainsKey(regionUUID) == false) | ||
46 | this.Circuits.Add(regionUUID, circuitCode); | ||
47 | } | ||
48 | |||
49 | } | ||
50 | } | ||
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs new file mode 100644 index 0000000..f77ca4c --- /dev/null +++ b/OpenSim.Framework/UserProfileManager.cs | |||
@@ -0,0 +1,223 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections; | ||
4 | using System.Text; | ||
5 | using System.Text.RegularExpressions; | ||
6 | using System.Xml; | ||
7 | using libsecondlife; | ||
8 | using Nwc.XmlRpc; | ||
9 | using OpenSim.Framework.Sims; | ||
10 | using OpenSim.Framework.Inventory; | ||
11 | using OpenSim.Framework.Utilities; | ||
12 | |||
13 | namespace OpenSim.Framework.User | ||
14 | { | ||
15 | public class UserProfileManager : UserProfileManagerBase | ||
16 | { | ||
17 | public string GridURL; | ||
18 | public string GridSendKey; | ||
19 | public string GridRecvKey; | ||
20 | public string DefaultStartupMsg; | ||
21 | |||
22 | public UserProfileManager() | ||
23 | { | ||
24 | |||
25 | } | ||
26 | |||
27 | public void SetKeys(string sendKey, string recvKey, string url, string message) | ||
28 | { | ||
29 | GridRecvKey = recvKey; | ||
30 | GridSendKey = sendKey; | ||
31 | GridURL = url; | ||
32 | DefaultStartupMsg = message; | ||
33 | } | ||
34 | |||
35 | public virtual string ParseXMLRPC(string requestBody) | ||
36 | { | ||
37 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | ||
38 | |||
39 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
40 | switch (request.MethodName) | ||
41 | { | ||
42 | case "login_to_simulator": | ||
43 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | ||
44 | bool GoodLogin = false; | ||
45 | string firstname = ""; | ||
46 | string lastname = ""; | ||
47 | string passwd = ""; | ||
48 | |||
49 | if (GoodXML) | ||
50 | { | ||
51 | firstname = (string)requestData["first"]; | ||
52 | lastname = (string)requestData["last"]; | ||
53 | passwd = (string)requestData["passwd"]; | ||
54 | GoodLogin = AuthenticateUser(firstname, lastname, passwd); | ||
55 | } | ||
56 | |||
57 | |||
58 | if (!(GoodXML && GoodLogin)) | ||
59 | { | ||
60 | XmlRpcResponse LoginErrorResp = new XmlRpcResponse(); | ||
61 | Hashtable ErrorRespData = new Hashtable(); | ||
62 | ErrorRespData["reason"] = "key"; | ||
63 | ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct"; | ||
64 | ErrorRespData["login"] = "false"; | ||
65 | LoginErrorResp.Value = ErrorRespData; | ||
66 | return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp), " encoding=\"utf-16\"", "")); | ||
67 | } | ||
68 | |||
69 | UserProfile TheUser = GetProfileByName(firstname, lastname); | ||
70 | |||
71 | if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null))) | ||
72 | { | ||
73 | XmlRpcResponse PresenceErrorResp = new XmlRpcResponse(); | ||
74 | Hashtable PresenceErrorRespData = new Hashtable(); | ||
75 | PresenceErrorRespData["reason"] = "presence"; | ||
76 | 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"; | ||
77 | PresenceErrorRespData["login"] = "false"; | ||
78 | PresenceErrorResp.Value = PresenceErrorRespData; | ||
79 | return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "")); | ||
80 | |||
81 | } | ||
82 | |||
83 | try | ||
84 | { | ||
85 | LLUUID AgentID = TheUser.UUID; | ||
86 | TheUser.InitSessionData(); | ||
87 | // SimProfile SimInfo = new SimProfile(); | ||
88 | // SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); | ||
89 | |||
90 | XmlRpcResponse LoginGoodResp = new XmlRpcResponse(); | ||
91 | Hashtable LoginGoodData = new Hashtable(); | ||
92 | |||
93 | Hashtable GlobalT = new Hashtable(); | ||
94 | GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
95 | GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
96 | GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
97 | ArrayList GlobalTextures = new ArrayList(); | ||
98 | GlobalTextures.Add(GlobalT); | ||
99 | |||
100 | Hashtable LoginFlagsHash = new Hashtable(); | ||
101 | LoginFlagsHash["daylight_savings"] = "N"; | ||
102 | LoginFlagsHash["stipend_since_login"] = "N"; | ||
103 | LoginFlagsHash["gendered"] = "Y"; | ||
104 | LoginFlagsHash["ever_logged_in"] = "Y"; | ||
105 | ArrayList LoginFlags = new ArrayList(); | ||
106 | LoginFlags.Add(LoginFlagsHash); | ||
107 | |||
108 | Hashtable uiconfig = new Hashtable(); | ||
109 | uiconfig["allow_first_life"] = "Y"; | ||
110 | ArrayList ui_config = new ArrayList(); | ||
111 | ui_config.Add(uiconfig); | ||
112 | |||
113 | Hashtable ClassifiedCategoriesHash = new Hashtable(); | ||
114 | ClassifiedCategoriesHash["category_name"] = "bla bla"; | ||
115 | ClassifiedCategoriesHash["category_id"] = (Int32)1; | ||
116 | ArrayList ClassifiedCategories = new ArrayList(); | ||
117 | ClassifiedCategories.Add(ClassifiedCategoriesHash); | ||
118 | |||
119 | ArrayList AgentInventory = new ArrayList(); | ||
120 | foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) | ||
121 | { | ||
122 | Hashtable TempHash = new Hashtable(); | ||
123 | TempHash["name"] = InvFolder.FolderName; | ||
124 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | ||
125 | TempHash["version"] = (Int32)InvFolder.Version; | ||
126 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | ||
127 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | ||
128 | AgentInventory.Add(TempHash); | ||
129 | } | ||
130 | |||
131 | Hashtable InventoryRootHash = new Hashtable(); | ||
132 | InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated(); | ||
133 | ArrayList InventoryRoot = new ArrayList(); | ||
134 | InventoryRoot.Add(InventoryRootHash); | ||
135 | |||
136 | Hashtable InitialOutfitHash = new Hashtable(); | ||
137 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | ||
138 | InitialOutfitHash["gender"] = "female"; | ||
139 | ArrayList InitialOutfit = new ArrayList(); | ||
140 | InitialOutfit.Add(InitialOutfitHash); | ||
141 | |||
142 | uint circode = (uint)(Util.RandomClass.Next()); | ||
143 | //TheUser.AddSimCircuit(circode, SimInfo.UUID); | ||
144 | |||
145 | LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\""; | ||
146 | LoginGoodData["ui-config"] = ui_config; | ||
147 | LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); | ||
148 | LoginGoodData["login-flags"] = LoginFlags; | ||
149 | LoginGoodData["global-textures"] = GlobalTextures; | ||
150 | LoginGoodData["classified_categories"] = ClassifiedCategories; | ||
151 | LoginGoodData["event_categories"] = new ArrayList(); | ||
152 | LoginGoodData["inventory-skeleton"] = AgentInventory; | ||
153 | LoginGoodData["inventory-skel-lib"] = new ArrayList(); | ||
154 | LoginGoodData["inventory-root"] = InventoryRoot; | ||
155 | LoginGoodData["event_notifications"] = new ArrayList(); | ||
156 | LoginGoodData["gestures"] = new ArrayList(); | ||
157 | LoginGoodData["inventory-lib-owner"] = new ArrayList(); | ||
158 | LoginGoodData["initial-outfit"] = InitialOutfit; | ||
159 | LoginGoodData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
160 | LoginGoodData["start_location"] = "last"; | ||
161 | LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}"; | ||
162 | LoginGoodData["message"] = DefaultStartupMsg; | ||
163 | LoginGoodData["first_name"] = "\"" + firstname + "\""; | ||
164 | LoginGoodData["circuit_code"] = (Int32)circode; | ||
165 | LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port; | ||
166 | LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated(); | ||
167 | LoginGoodData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n"; | ||
168 | LoginGoodData["agent_id"] = AgentID.ToStringHyphenated(); | ||
169 | LoginGoodData["region_y"] = (Int32) 996 * 256; // (Int32)SimInfo.RegionLocY * 256; | ||
170 | LoginGoodData["region_x"] = (Int32) 997 * 256; //SimInfo.RegionLocX * 256; | ||
171 | LoginGoodData["seed_capability"] = null; | ||
172 | LoginGoodData["agent_access"] = "M"; | ||
173 | LoginGoodData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated(); | ||
174 | LoginGoodData["login"] = "true"; | ||
175 | |||
176 | this.CustomiseResponse(ref LoginGoodData, TheUser); | ||
177 | LoginGoodResp.Value = LoginGoodData; | ||
178 | //TheUser.SendDataToSim(SimInfo); | ||
179 | return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp), "utf-16", "utf-8")); | ||
180 | |||
181 | } | ||
182 | catch (Exception E) | ||
183 | { | ||
184 | Console.WriteLine(E.ToString()); | ||
185 | } | ||
186 | |||
187 | break; | ||
188 | } | ||
189 | |||
190 | return ""; | ||
191 | } | ||
192 | |||
193 | public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser) | ||
194 | { | ||
195 | //default method set up to act as ogs user server | ||
196 | SimProfile SimInfo = new SimProfile(); | ||
197 | //get siminfo from grid server | ||
198 | SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); | ||
199 | uint circode = (uint)response["circuit_code"]; | ||
200 | theUser.AddSimCircuit(circode, SimInfo.UUID); | ||
201 | response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; | ||
202 | response["sim_ip"] = SimInfo.sim_ip.ToString(); | ||
203 | response["sim_port"] = (Int32)SimInfo.sim_port; | ||
204 | response["region_y"] = (Int32) SimInfo.RegionLocY * 256; | ||
205 | response["region_x"] = (Int32) SimInfo.RegionLocX * 256; | ||
206 | |||
207 | //default is ogs user server, so let the sim know about the user via a XmlRpcRequest | ||
208 | Console.WriteLine(SimInfo.caps_url); | ||
209 | Hashtable SimParams = new Hashtable(); | ||
210 | SimParams["session_id"] = theUser.CurrentSessionID.ToString(); | ||
211 | SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString(); | ||
212 | SimParams["firstname"] = theUser.firstname; | ||
213 | SimParams["lastname"] = theUser.lastname; | ||
214 | SimParams["agent_id"] = theUser.UUID.ToString(); | ||
215 | SimParams["circuit_code"] = (Int32)theUser.Circuits[SimInfo.UUID]; | ||
216 | ArrayList SendParams = new ArrayList(); | ||
217 | SendParams.Add(SimParams); | ||
218 | |||
219 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
220 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); | ||
221 | } | ||
222 | } | ||
223 | } | ||
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs new file mode 100644 index 0000000..ad03bc2 --- /dev/null +++ b/OpenSim.Framework/UserProfileManagerBase.cs | |||
@@ -0,0 +1,91 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Utilities; | ||
6 | using OpenSim.Framework.Inventory; | ||
7 | |||
8 | namespace OpenSim.Framework.User | ||
9 | { | ||
10 | public class UserProfileManagerBase | ||
11 | { | ||
12 | |||
13 | public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); | ||
14 | |||
15 | public UserProfileManagerBase() | ||
16 | { | ||
17 | } | ||
18 | |||
19 | public virtual void InitUserProfiles() | ||
20 | { | ||
21 | // TODO: need to load from database | ||
22 | } | ||
23 | |||
24 | public UserProfile GetProfileByName(string firstname, string lastname) | ||
25 | { | ||
26 | foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) | ||
27 | { | ||
28 | if ((UserProfiles[UUID].firstname == firstname) && (UserProfiles[UUID].lastname == lastname)) | ||
29 | { | ||
30 | return UserProfiles[UUID]; | ||
31 | } | ||
32 | } | ||
33 | return null; | ||
34 | } | ||
35 | |||
36 | public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID) | ||
37 | { | ||
38 | return UserProfiles[ProfileLLUUID]; | ||
39 | } | ||
40 | |||
41 | public virtual bool AuthenticateUser(string firstname, string lastname, string passwd) | ||
42 | { | ||
43 | UserProfile TheUser = GetProfileByName(firstname, lastname); | ||
44 | if (TheUser != null) | ||
45 | { | ||
46 | if (TheUser.MD5passwd == passwd) | ||
47 | { | ||
48 | return true; | ||
49 | } | ||
50 | else | ||
51 | { | ||
52 | return false; | ||
53 | } | ||
54 | } | ||
55 | else | ||
56 | { | ||
57 | return false; | ||
58 | } | ||
59 | |||
60 | } | ||
61 | |||
62 | public void SetGod(LLUUID GodID) | ||
63 | { | ||
64 | this.UserProfiles[GodID].IsGridGod = true; | ||
65 | } | ||
66 | |||
67 | public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) | ||
68 | { | ||
69 | UserProfile newprofile = new UserProfile(); | ||
70 | newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); | ||
71 | newprofile.firstname = firstname; | ||
72 | newprofile.lastname = lastname; | ||
73 | newprofile.MD5passwd = MD5passwd; | ||
74 | newprofile.UUID = LLUUID.Random(); | ||
75 | this.UserProfiles.Add(newprofile.UUID, newprofile); | ||
76 | return newprofile; | ||
77 | } | ||
78 | |||
79 | public virtual AgentInventory GetUsersInventory(LLUUID agentID) | ||
80 | { | ||
81 | UserProfile user = this.GetProfileByLLUUID(agentID); | ||
82 | if (user != null) | ||
83 | { | ||
84 | return user.Inventory; | ||
85 | } | ||
86 | |||
87 | return null; | ||
88 | } | ||
89 | |||
90 | } | ||
91 | } | ||
diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs new file mode 100644 index 0000000..042360d --- /dev/null +++ b/OpenSim.Framework/Util.cs | |||
@@ -0,0 +1,32 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace OpenSim.Framework.Utilities | ||
8 | { | ||
9 | public class Util | ||
10 | { | ||
11 | private static Random randomClass = new Random(); | ||
12 | |||
13 | public static ulong UIntsToLong(uint X, uint Y) | ||
14 | { | ||
15 | return Helpers.UIntsToLong(X, Y); | ||
16 | } | ||
17 | |||
18 | public static Random RandomClass | ||
19 | { | ||
20 | get | ||
21 | { | ||
22 | return randomClass; | ||
23 | } | ||
24 | } | ||
25 | |||
26 | public Util() | ||
27 | { | ||
28 | |||
29 | } | ||
30 | } | ||
31 | |||
32 | } | ||