diff options
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data')
9 files changed, 596 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data/GridData.cs b/OpenGridServices/OpenGrid.Framework.Data/GridData.cs new file mode 100644 index 0000000..6dad37e --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/GridData.cs | |||
@@ -0,0 +1,83 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenGrid.Framework.Data | ||
6 | { | ||
7 | public enum DataResponse | ||
8 | { | ||
9 | RESPONSE_OK, | ||
10 | RESPONSE_AUTHREQUIRED, | ||
11 | RESPONSE_INVALIDCREDENTIALS, | ||
12 | RESPONSE_ERROR | ||
13 | } | ||
14 | |||
15 | /// <summary> | ||
16 | /// A standard grid interface | ||
17 | /// </summary> | ||
18 | public interface IGridData | ||
19 | { | ||
20 | /// <summary> | ||
21 | /// Returns a sim profile from a regionHandle | ||
22 | /// </summary> | ||
23 | /// <param name="regionHandle">A 64bit Region Handle</param> | ||
24 | /// <returns>A simprofile</returns> | ||
25 | SimProfileData GetProfileByHandle(ulong regionHandle); | ||
26 | |||
27 | /// <summary> | ||
28 | /// Returns a sim profile from a UUID | ||
29 | /// </summary> | ||
30 | /// <param name="UUID">A 128bit UUID</param> | ||
31 | /// <returns>A sim profile</returns> | ||
32 | SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID); | ||
33 | |||
34 | /// <summary> | ||
35 | /// Returns all profiles within the specified range | ||
36 | /// </summary> | ||
37 | /// <param name="Xmin">Minimum sim coordinate (X)</param> | ||
38 | /// <param name="Ymin">Minimum sim coordinate (Y)</param> | ||
39 | /// <param name="Xmax">Maximum sim coordinate (X)</param> | ||
40 | /// <param name="Ymin">Maximum sim coordinate (Y)</param> | ||
41 | /// <returns>An array containing all the sim profiles in the specified range</returns> | ||
42 | SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); | ||
43 | |||
44 | /// <summary> | ||
45 | /// Authenticates a sim by use of it's recv key. | ||
46 | /// WARNING: Insecure | ||
47 | /// </summary> | ||
48 | /// <param name="UUID">The UUID sent by the sim</param> | ||
49 | /// <param name="regionHandle">The regionhandle sent by the sim</param> | ||
50 | /// <param name="simrecvkey">The recieving key sent by the sim</param> | ||
51 | /// <returns>Whether the sim has been authenticated</returns> | ||
52 | bool AuthenticateSim(libsecondlife.LLUUID UUID, ulong regionHandle, string simrecvkey); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Initialises the interface | ||
56 | /// </summary> | ||
57 | void Initialise(); | ||
58 | |||
59 | /// <summary> | ||
60 | /// Closes the interface | ||
61 | /// </summary> | ||
62 | void Close(); | ||
63 | |||
64 | /// <summary> | ||
65 | /// The plugin being loaded | ||
66 | /// </summary> | ||
67 | /// <returns>A string containing the plugin name</returns> | ||
68 | string getName(); | ||
69 | |||
70 | /// <summary> | ||
71 | /// The plugins version | ||
72 | /// </summary> | ||
73 | /// <returns>A string containing the plugin version</returns> | ||
74 | string getVersion(); | ||
75 | |||
76 | /// <summary> | ||
77 | /// Adds a new profile to the database | ||
78 | /// </summary> | ||
79 | /// <param name="profile">The profile to add</param> | ||
80 | /// <returns>RESPONSE_OK if successful, error if not.</returns> | ||
81 | DataResponse AddProfile(SimProfileData profile); | ||
82 | } | ||
83 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs new file mode 100644 index 0000000..58597d2 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs | |||
@@ -0,0 +1,73 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.IO; | ||
5 | using System.Text.RegularExpressions; | ||
6 | |||
7 | /* | ||
8 | Taken from public code listing at by Alex Pinsker | ||
9 | http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html | ||
10 | */ | ||
11 | |||
12 | namespace OpenGrid.Framework.Data | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Parse settings from ini-like files | ||
16 | /// </summary> | ||
17 | public class IniFile | ||
18 | { | ||
19 | static IniFile() | ||
20 | { | ||
21 | _iniKeyValuePatternRegex = new Regex( | ||
22 | @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]* | ||
23 | # key part (surrounding whitespace stripped) | ||
24 | \= | ||
25 | (\s)*(?<Value>([^\n^\s]+(\n){0,1}))) | ||
26 | # value part (surrounding whitespace stripped) | ||
27 | ", | ||
28 | RegexOptions.IgnorePatternWhitespace | | ||
29 | RegexOptions.Compiled | | ||
30 | RegexOptions.CultureInvariant); | ||
31 | } | ||
32 | static private Regex _iniKeyValuePatternRegex; | ||
33 | |||
34 | public IniFile(string iniFileName) | ||
35 | { | ||
36 | _iniFileName = iniFileName; | ||
37 | } | ||
38 | |||
39 | public string ParseFileReadValue(string key) | ||
40 | { | ||
41 | using (StreamReader reader = | ||
42 | new StreamReader(_iniFileName)) | ||
43 | { | ||
44 | do | ||
45 | { | ||
46 | string line = reader.ReadLine(); | ||
47 | Match match = | ||
48 | _iniKeyValuePatternRegex.Match(line); | ||
49 | if (match.Success) | ||
50 | { | ||
51 | string currentKey = | ||
52 | match.Groups["Key"].Value as string; | ||
53 | if (currentKey != null && | ||
54 | currentKey.Trim().CompareTo(key) == 0) | ||
55 | { | ||
56 | string value = | ||
57 | match.Groups["Value"].Value as string; | ||
58 | return value; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | } | ||
63 | while (reader.Peek() != -1); | ||
64 | } | ||
65 | return null; | ||
66 | } | ||
67 | |||
68 | public string IniFileName | ||
69 | { | ||
70 | get { return _iniFileName; } | ||
71 | } private string _iniFileName; | ||
72 | } | ||
73 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj new file mode 100644 index 0000000..b033c6c --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj | |||
@@ -0,0 +1,107 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{62CDF671-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="System" > | ||
62 | <HintPath>System.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System.Xml" > | ||
66 | <HintPath>System.Xml.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="libsecondlife.dll" > | ||
74 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | </ItemGroup> | ||
80 | <ItemGroup> | ||
81 | <Compile Include="GridData.cs"> | ||
82 | <SubType>Code</SubType> | ||
83 | </Compile> | ||
84 | <Compile Include="IniConfig.cs"> | ||
85 | <SubType>Code</SubType> | ||
86 | </Compile> | ||
87 | <Compile Include="SimProfileData.cs"> | ||
88 | <SubType>Code</SubType> | ||
89 | </Compile> | ||
90 | <Compile Include="UserData.cs"> | ||
91 | <SubType>Code</SubType> | ||
92 | </Compile> | ||
93 | <Compile Include="UserProfileData.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | </ItemGroup> | ||
100 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
101 | <PropertyGroup> | ||
102 | <PreBuildEvent> | ||
103 | </PreBuildEvent> | ||
104 | <PostBuildEvent> | ||
105 | </PostBuildEvent> | ||
106 | </PropertyGroup> | ||
107 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user new file mode 100644 index 0000000..d47d65d --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj.user | |||
@@ -0,0 +1,12 @@ | |||
1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath> | ||
6 | <LastOpenVersion>8.0.50727</LastOpenVersion> | ||
7 | <ProjectView>ProjectFiles</ProjectView> | ||
8 | <ProjectTrust>0</ProjectTrust> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " /> | ||
11 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " /> | ||
12 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build new file mode 100644 index 0000000..281295f --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build | |||
@@ -0,0 +1,47 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="GridData.cs" /> | ||
15 | <include name="IniConfig.cs" /> | ||
16 | <include name="SimProfileData.cs" /> | ||
17 | <include name="UserData.cs" /> | ||
18 | <include name="UserProfileData.cs" /> | ||
19 | <include name="Properties/AssemblyInfo.cs" /> | ||
20 | </sources> | ||
21 | <references basedir="${project::get-base-directory()}"> | ||
22 | <lib> | ||
23 | <include name="${project::get-base-directory()}" /> | ||
24 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
25 | </lib> | ||
26 | <include name="System.dll" /> | ||
27 | <include name="System.Xml.dll" /> | ||
28 | <include name="System.Data.dll" /> | ||
29 | <include name="../../bin/libsecondlife.dll" /> | ||
30 | </references> | ||
31 | </csc> | ||
32 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
33 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
34 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
35 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
36 | <include name="*.dll"/> | ||
37 | <include name="*.exe"/> | ||
38 | </fileset> | ||
39 | </copy> | ||
40 | </target> | ||
41 | <target name="clean"> | ||
42 | <delete dir="${bin.dir}" failonerror="false" /> | ||
43 | <delete dir="${obj.dir}" failonerror="false" /> | ||
44 | </target> | ||
45 | <target name="doc" description="Creates documentation."> | ||
46 | </target> | ||
47 | </project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1446673 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,35 @@ | |||
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("OpenGrid.Framework.Data")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs new file mode 100644 index 0000000..c66610e --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs | |||
@@ -0,0 +1,84 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenGrid.Framework.Data | ||
6 | { | ||
7 | public class SimProfileData | ||
8 | { | ||
9 | /// <summary> | ||
10 | /// The name of the region | ||
11 | /// </summary> | ||
12 | public string regionName = ""; | ||
13 | |||
14 | /// <summary> | ||
15 | /// A 64-bit number combining map position into a (mostly) unique ID | ||
16 | /// </summary> | ||
17 | public ulong regionHandle; | ||
18 | |||
19 | /// <summary> | ||
20 | /// OGS/OpenSim Specific ID for a region | ||
21 | /// </summary> | ||
22 | public libsecondlife.LLUUID UUID; | ||
23 | |||
24 | /// <summary> | ||
25 | /// Coordinates of the region | ||
26 | /// </summary> | ||
27 | public uint regionLocX; | ||
28 | public uint regionLocY; | ||
29 | public uint regionLocZ; // Reserved (round-robin, layers, etc) | ||
30 | |||
31 | /// <summary> | ||
32 | /// Authentication secrets | ||
33 | /// </summary> | ||
34 | /// <remarks>Not very secure, needs improvement.</remarks> | ||
35 | public string regionSendKey = ""; | ||
36 | public string regionRecvKey = ""; | ||
37 | public string regionSecret = ""; | ||
38 | |||
39 | /// <summary> | ||
40 | /// Whether the region is online | ||
41 | /// </summary> | ||
42 | public bool regionOnline; | ||
43 | |||
44 | /// <summary> | ||
45 | /// Information about the server that the region is currently hosted on | ||
46 | /// </summary> | ||
47 | public string serverIP = ""; | ||
48 | public uint serverPort; | ||
49 | public string serverURI = ""; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. | ||
53 | /// </summary> | ||
54 | public ulong regionNorthOverrideHandle; | ||
55 | public ulong regionSouthOverrideHandle; | ||
56 | public ulong regionEastOverrideHandle; | ||
57 | public ulong regionWestOverrideHandle; | ||
58 | |||
59 | /// <summary> | ||
60 | /// Optional: URI Location of the region database | ||
61 | /// </summary> | ||
62 | /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> | ||
63 | public string regionDataURI = ""; | ||
64 | |||
65 | /// <summary> | ||
66 | /// Region Asset Details | ||
67 | /// </summary> | ||
68 | public string regionAssetURI = ""; | ||
69 | public string regionAssetSendKey = ""; | ||
70 | public string regionAssetRecvKey = ""; | ||
71 | |||
72 | /// <summary> | ||
73 | /// Region Userserver Details | ||
74 | /// </summary> | ||
75 | public string regionUserURI = ""; | ||
76 | public string regionUserSendKey = ""; | ||
77 | public string regionUserRecvKey = ""; | ||
78 | |||
79 | /// <summary> | ||
80 | /// Region Map Texture Asset | ||
81 | /// </summary> | ||
82 | public libsecondlife.LLUUID regionMapTextureID = new libsecondlife.LLUUID("00000000-0000-0000-9999-000000000006"); | ||
83 | } | ||
84 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs new file mode 100644 index 0000000..4802c5f --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs | |||
@@ -0,0 +1,101 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenGrid.Framework.Data | ||
7 | { | ||
8 | public interface IUserData | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Returns a user profile from a database via their UUID | ||
12 | /// </summary> | ||
13 | /// <param name="user">The accounts UUID</param> | ||
14 | /// <returns>The user data profile</returns> | ||
15 | UserProfileData getUserByUUID(LLUUID user); | ||
16 | |||
17 | /// <summary> | ||
18 | /// Returns a users profile by searching their username | ||
19 | /// </summary> | ||
20 | /// <param name="name">The users username</param> | ||
21 | /// <returns>The user data profile</returns> | ||
22 | UserProfileData getUserByName(string name); | ||
23 | |||
24 | /// <summary> | ||
25 | /// Returns a users profile by searching their username parts | ||
26 | /// </summary> | ||
27 | /// <param name="fname">Account firstname</param> | ||
28 | /// <param name="lname">Account lastname</param> | ||
29 | /// <returns>The user data profile</returns> | ||
30 | UserProfileData getUserByName(string fname, string lname); | ||
31 | |||
32 | /// <summary> | ||
33 | /// Returns the current agent for a user searching by it's UUID | ||
34 | /// </summary> | ||
35 | /// <param name="user">The users UUID</param> | ||
36 | /// <returns>The current agent session</returns> | ||
37 | UserAgentData getAgentByUUID(LLUUID user); | ||
38 | |||
39 | /// <summary> | ||
40 | /// Returns the current session agent for a user searching by username | ||
41 | /// </summary> | ||
42 | /// <param name="name">The users account name</param> | ||
43 | /// <returns>The current agent session</returns> | ||
44 | UserAgentData getAgentByName(string name); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Returns the current session agent for a user searching by username parts | ||
48 | /// </summary> | ||
49 | /// <param name="fname">The users first account name</param> | ||
50 | /// <param name="lname">The users account surname</param> | ||
51 | /// <returns>The current agent session</returns> | ||
52 | UserAgentData getAgentByName(string fname, string lname); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Adds a new User profile to the database | ||
56 | /// </summary> | ||
57 | /// <param name="user">UserProfile to add</param> | ||
58 | void addNewUserProfile(UserProfileData user); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Adds a new agent to the database | ||
62 | /// </summary> | ||
63 | /// <param name="agent">The agent to add</param> | ||
64 | void addNewUserAgent(UserAgentData agent); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) | ||
68 | /// </summary> | ||
69 | /// <param name="from">The account to transfer from</param> | ||
70 | /// <param name="to">The account to transfer to</param> | ||
71 | /// <param name="amount">The amount to transfer</param> | ||
72 | /// <returns>Successful?</returns> | ||
73 | bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); | ||
74 | |||
75 | /// <summary> | ||
76 | /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. | ||
77 | /// </summary> | ||
78 | /// <param name="from">User to transfer from</param> | ||
79 | /// <param name="to">User to transfer to</param> | ||
80 | /// <param name="inventory">Specified inventory item</param> | ||
81 | /// <returns>Successful?</returns> | ||
82 | bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); | ||
83 | |||
84 | /// <summary> | ||
85 | /// Returns the plugin version | ||
86 | /// </summary> | ||
87 | /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns> | ||
88 | string getVersion(); | ||
89 | |||
90 | /// <summary> | ||
91 | /// Returns the plugin name | ||
92 | /// </summary> | ||
93 | /// <returns>Plugin name, eg MySQL User Provider</returns> | ||
94 | string getName(); | ||
95 | |||
96 | /// <summary> | ||
97 | /// Initialises the plugin (artificial constructor) | ||
98 | /// </summary> | ||
99 | void Initialise(); | ||
100 | } | ||
101 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs new file mode 100644 index 0000000..3f42762 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs | |||
@@ -0,0 +1,54 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenGrid.Framework.Data | ||
7 | { | ||
8 | public class UserProfileData | ||
9 | { | ||
10 | public LLUUID UUID; | ||
11 | public string username; // The configurable part of the users username | ||
12 | public string surname; // The users surname (can be used to indicate user class - eg 'Test User' or 'Test Admin') | ||
13 | |||
14 | public string passwordHash; // Hash of the users password | ||
15 | public string passwordSalt; // Salt for the users password | ||
16 | |||
17 | public ulong homeRegion; // RegionHandle of home | ||
18 | public LLVector3 homeLocation; // Home Location inside the sim | ||
19 | public LLVector3 homeLookAt; // Coordinates where the user is looking | ||
20 | |||
21 | |||
22 | public int created; // UNIX Epoch Timestamp (User Creation) | ||
23 | public int lastLogin; // UNIX Epoch Timestamp (Last Login Time) | ||
24 | |||
25 | public string userInventoryURI; // URI to inventory server for this user | ||
26 | public string userAssetURI; // URI to asset server for this user | ||
27 | |||
28 | public uint profileCanDoMask; // Profile window "I can do" mask | ||
29 | public uint profileWantDoMask; // Profile window "I want to" mask | ||
30 | |||
31 | public string profileAboutText; // My about window text | ||
32 | public string profileFirstText; // First Life Text | ||
33 | |||
34 | public LLUUID profileImage; // My avatars profile image | ||
35 | public LLUUID profileFirstImage; // First-life image | ||
36 | public UserAgentData currentAgent; // The users last agent | ||
37 | } | ||
38 | |||
39 | public class UserAgentData | ||
40 | { | ||
41 | public LLUUID UUID; // Account ID | ||
42 | public string agentIP; // The IP of the agent | ||
43 | public uint agentPort; // The port of the agent | ||
44 | public bool agentOnline; // The online status of the agent | ||
45 | public LLUUID sessionID; // The session ID for the agent (used by client) | ||
46 | public LLUUID secureSessionID; // The secure session ID for the agent (used by client) | ||
47 | public LLUUID regionID; // The region ID the agent occupies | ||
48 | public int loginTime; // EPOCH based Timestamp | ||
49 | public int logoutTime; // Timestamp or 0 if N/A | ||
50 | public LLUUID currentRegion; // UUID of the users current region | ||
51 | public ulong currentHandle; // RegionHandle of the users current region | ||
52 | public LLVector3 currentPos; // Current position in the region | ||
53 | } | ||
54 | } | ||