aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data
diff options
context:
space:
mode:
authorAdam Frisby2007-07-11 08:10:25 +0000
committerAdam Frisby2007-07-11 08:10:25 +0000
commite2ff441e31328e60c8bb1d4bb32fa4ac64f91978 (patch)
tree8405b6cef57b66a58f31a24c859846085d0b81f7 /OpenSim/Framework/Data
parent* Wiping trunk in prep for Sugilite (diff)
parent* Applying dalien's patches from bug#177 and #179 (diff)
downloadopensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.zip
opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.gz
opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.bz2
opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.xz
* Bringing Sugilite in to trunk
Diffstat (limited to 'OpenSim/Framework/Data')
-rw-r--r--OpenSim/Framework/Data/GridData.cs111
-rw-r--r--OpenSim/Framework/Data/ILogData.cs90
-rw-r--r--OpenSim/Framework/Data/IniConfig.cs96
-rw-r--r--OpenSim/Framework/Data/InventoryData.cs185
-rw-r--r--OpenSim/Framework/Data/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Data/ReservationData.cs47
-rw-r--r--OpenSim/Framework/Data/SimProfileData.cs192
-rw-r--r--OpenSim/Framework/Data/UserData.cs128
-rw-r--r--OpenSim/Framework/Data/UserProfileData.cs180
9 files changed, 1062 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
new file mode 100644
index 0000000..5a17d20
--- /dev/null
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -0,0 +1,111 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using libsecondlife;
29
30namespace OpenSim.Framework.Data
31{
32 public enum DataResponse
33 {
34 RESPONSE_OK,
35 RESPONSE_AUTHREQUIRED,
36 RESPONSE_INVALIDCREDENTIALS,
37 RESPONSE_ERROR
38 }
39
40 /// <summary>
41 /// A standard grid interface
42 /// </summary>
43 public interface IGridData
44 {
45 /// <summary>
46 /// Returns a sim profile from a regionHandle
47 /// </summary>
48 /// <param name="regionHandle">A 64bit Region Handle</param>
49 /// <returns>A simprofile</returns>
50 SimProfileData GetProfileByHandle(ulong regionHandle);
51
52 /// <summary>
53 /// Returns a sim profile from a UUID
54 /// </summary>
55 /// <param name="UUID">A 128bit UUID</param>
56 /// <returns>A sim profile</returns>
57 SimProfileData GetProfileByLLUUID(LLUUID UUID);
58
59 /// <summary>
60 /// Returns all profiles within the specified range
61 /// </summary>
62 /// <param name="Xmin">Minimum sim coordinate (X)</param>
63 /// <param name="Ymin">Minimum sim coordinate (Y)</param>
64 /// <param name="Xmax">Maximum sim coordinate (X)</param>
65 /// <param name="Ymin">Maximum sim coordinate (Y)</param>
66 /// <returns>An array containing all the sim profiles in the specified range</returns>
67 SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
68
69 /// <summary>
70 /// Authenticates a sim by use of it's recv key.
71 /// WARNING: Insecure
72 /// </summary>
73 /// <param name="UUID">The UUID sent by the sim</param>
74 /// <param name="regionHandle">The regionhandle sent by the sim</param>
75 /// <param name="simrecvkey">The recieving key sent by the sim</param>
76 /// <returns>Whether the sim has been authenticated</returns>
77 bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
78
79 /// <summary>
80 /// Initialises the interface
81 /// </summary>
82 void Initialise();
83
84 /// <summary>
85 /// Closes the interface
86 /// </summary>
87 void Close();
88
89 /// <summary>
90 /// The plugin being loaded
91 /// </summary>
92 /// <returns>A string containing the plugin name</returns>
93 string getName();
94
95 /// <summary>
96 /// The plugins version
97 /// </summary>
98 /// <returns>A string containing the plugin version</returns>
99 string getVersion();
100
101 /// <summary>
102 /// Adds a new profile to the database
103 /// </summary>
104 /// <param name="profile">The profile to add</param>
105 /// <returns>RESPONSE_OK if successful, error if not.</returns>
106 DataResponse AddProfile(SimProfileData profile);
107
108 ReservationData GetReservationAtPoint(uint x, uint y);
109
110 }
111}
diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs
new file mode 100644
index 0000000..059fef5
--- /dev/null
+++ b/OpenSim/Framework/Data/ILogData.cs
@@ -0,0 +1,90 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28namespace OpenSim.Framework.Data
29{
30 /// <summary>
31 /// The severity of an individual log message
32 /// </summary>
33 public enum LogSeverity : int
34 {
35 /// <summary>
36 /// Critical: systems failure
37 /// </summary>
38 CRITICAL = 1,
39 /// <summary>
40 /// Major: warning prior to systems failure
41 /// </summary>
42 MAJOR = 2,
43 /// <summary>
44 /// Medium: an individual non-critical task failed
45 /// </summary>
46 MEDIUM = 3,
47 /// <summary>
48 /// Low: Informational warning
49 /// </summary>
50 LOW = 4,
51 /// <summary>
52 /// Info: Information
53 /// </summary>
54 INFO = 5,
55 /// <summary>
56 /// Verbose: Debug Information
57 /// </summary>
58 VERBOSE = 6
59 }
60
61 /// <summary>
62 /// An interface to a LogData storage system
63 /// </summary>
64 public interface ILogData
65 {
66 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage);
67 /// <summary>
68 /// Initialises the interface
69 /// </summary>
70 void Initialise();
71
72 /// <summary>
73 /// Closes the interface
74 /// </summary>
75 void Close();
76
77 /// <summary>
78 /// The plugin being loaded
79 /// </summary>
80 /// <returns>A string containing the plugin name</returns>
81 string getName();
82
83 /// <summary>
84 /// The plugins version
85 /// </summary>
86 /// <returns>A string containing the plugin version</returns>
87 string getVersion();
88 }
89
90}
diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs
new file mode 100644
index 0000000..2b52fd1
--- /dev/null
+++ b/OpenSim/Framework/Data/IniConfig.cs
@@ -0,0 +1,96 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.IO;
29using System.Text.RegularExpressions;
30/*
31 Taken from public code listing at by Alex Pinsker
32 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
33 */
34
35namespace OpenSim.Framework.Data
36{
37 /// <summary>
38 /// Parse settings from ini-like files
39 /// </summary>
40 public class IniFile
41 {
42 static IniFile()
43 {
44 _iniKeyValuePatternRegex = new Regex(
45 @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]*
46 # key part (surrounding whitespace stripped)
47 \=
48 (\s)*(?<Value>([^\n^\s]+(\n){0,1})))
49 # value part (surrounding whitespace stripped)
50 ",
51 RegexOptions.IgnorePatternWhitespace |
52 RegexOptions.Compiled |
53 RegexOptions.CultureInvariant);
54 }
55 static private Regex _iniKeyValuePatternRegex;
56
57 public IniFile(string iniFileName)
58 {
59 _iniFileName = iniFileName;
60 }
61
62 public string ParseFileReadValue(string key)
63 {
64 using (StreamReader reader =
65 new StreamReader(_iniFileName))
66 {
67 do
68 {
69 string line = reader.ReadLine();
70 Match match =
71 _iniKeyValuePatternRegex.Match(line);
72 if (match.Success)
73 {
74 string currentKey =
75 match.Groups["Key"].Value as string;
76 if (currentKey != null &&
77 currentKey.Trim().CompareTo(key) == 0)
78 {
79 string value =
80 match.Groups["Value"].Value as string;
81 return value;
82 }
83 }
84
85 }
86 while (reader.Peek() != -1);
87 }
88 return null;
89 }
90
91 public string IniFileName
92 {
93 get { return _iniFileName; }
94 } private string _iniFileName;
95 }
96}
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
new file mode 100644
index 0000000..c2a1d06
--- /dev/null
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -0,0 +1,185 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.Collections.Generic;
29using libsecondlife;
30
31namespace OpenSim.Framework.Data
32{
33 /// <summary>
34 /// Inventory Item - contains all the properties associated with an individual inventory piece.
35 /// </summary>
36 public class InventoryItemBase
37 {
38 /// <summary>
39 /// A UUID containing the ID for the inventory item itself
40 /// </summary>
41 public LLUUID inventoryID;
42 /// <summary>
43 /// The UUID of the associated asset on the asset server
44 /// </summary>
45 public LLUUID assetID;
46 /// <summary>
47 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
48 /// </summary>
49 public int type;
50 /// <summary>
51 /// The folder this item is contained in (NULL_KEY = Inventory Root)
52 /// </summary>
53 public LLUUID parentFolderID;
54 /// <summary>
55 /// The owner of this inventory item
56 /// </summary>
57 public LLUUID avatarID;
58 /// <summary>
59 /// The name of the inventory item (must be less than 64 characters)
60 /// </summary>
61 public string inventoryName;
62 /// <summary>
63 /// The description of the inventory item (must be less than 64 characters)
64 /// </summary>
65 public string inventoryDescription;
66 /// <summary>
67 /// A mask containing the permissions for the next owner (cannot be enforced)
68 /// </summary>
69 public uint inventoryNextPermissions;
70 /// <summary>
71 /// A mask containing permissions for the current owner (cannot be enforced)
72 /// </summary>
73 public uint inventoryCurrentPermissions;
74 }
75
76 /// <summary>
77 /// A Class for folders which contain users inventory
78 /// </summary>
79 public class InventoryFolderBase
80 {
81 /// <summary>
82 /// The name of the folder (64 characters or less)
83 /// </summary>
84 public string name;
85 /// <summary>
86 /// The agent who's inventory this is contained by
87 /// </summary>
88 public LLUUID agentID;
89 /// <summary>
90 /// The folder this folder is contained in (NULL_KEY for root)
91 /// </summary>
92 public LLUUID parentID;
93 /// <summary>
94 /// The UUID for this folder
95 /// </summary>
96 public LLUUID folderID;
97 }
98
99 /// <summary>
100 /// An interface for accessing inventory data from a storage server
101 /// </summary>
102 public interface IInventoryData
103 {
104 /// <summary>
105 /// Initialises the interface
106 /// </summary>
107 void Initialise();
108
109 /// <summary>
110 /// Closes the interface
111 /// </summary>
112 void Close();
113
114 /// <summary>
115 /// The plugin being loaded
116 /// </summary>
117 /// <returns>A string containing the plugin name</returns>
118 string getName();
119
120 /// <summary>
121 /// The plugins version
122 /// </summary>
123 /// <returns>A string containing the plugin version</returns>
124 string getVersion();
125
126 /// <summary>
127 /// Returns a list of inventory items contained within the specified folder
128 /// </summary>
129 /// <param name="folderID">The UUID of the target folder</param>
130 /// <returns>A List of InventoryItemBase items</returns>
131 List<InventoryItemBase> getInventoryInFolder(LLUUID folderID);
132
133 /// <summary>
134 /// Returns a list of folders in the users inventory root.
135 /// </summary>
136 /// <param name="user">The UUID of the user who is having inventory being returned</param>
137 /// <returns>A list of folders</returns>
138 List<InventoryFolderBase> getUserRootFolders(LLUUID user);
139
140 /// <summary>
141 /// Returns a list of inventory folders contained in the folder 'parentID'
142 /// </summary>
143 /// <param name="parentID">The folder to get subfolders for</param>
144 /// <returns>A list of inventory folders</returns>
145 List<InventoryFolderBase> getInventoryFolders(LLUUID parentID);
146
147 /// <summary>
148 /// Returns an inventory item by its UUID
149 /// </summary>
150 /// <param name="item">The UUID of the item to be returned</param>
151 /// <returns>A class containing item information</returns>
152 InventoryItemBase getInventoryItem(LLUUID item);
153
154 /// <summary>
155 /// Returns a specified inventory folder by its UUID
156 /// </summary>
157 /// <param name="folder">The UUID of the folder to be returned</param>
158 /// <returns>A class containing folder information</returns>
159 InventoryFolderBase getInventoryFolder(LLUUID folder);
160
161 /// <summary>
162 /// Creates a new inventory item based on item
163 /// </summary>
164 /// <param name="item">The item to be created</param>
165 void addInventoryItem(InventoryItemBase item);
166
167 /// <summary>
168 /// Updates an inventory item with item (updates based on ID)
169 /// </summary>
170 /// <param name="item">The updated item</param>
171 void updateInventoryItem(InventoryItemBase item);
172
173 /// <summary>
174 /// Adds a new folder specified by folder
175 /// </summary>
176 /// <param name="folder">The inventory folder</param>
177 void addInventoryFolder(InventoryFolderBase folder);
178
179 /// <summary>
180 /// Updates a folder based on its ID with folder
181 /// </summary>
182 /// <param name="folder">The inventory folder</param>
183 void updateInventoryFolder(InventoryFolderBase folder);
184 }
185}
diff --git a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f9260a1
--- /dev/null
+++ b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data")]
7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data")]
11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")]
14
15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)]
19
20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
22
23// Version information for an assembly consists of the following four values:
24//
25// Major Version
26// Minor Version
27// Build Number
28// Revision
29//
30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs
new file mode 100644
index 0000000..0078df0
--- /dev/null
+++ b/OpenSim/Framework/Data/ReservationData.cs
@@ -0,0 +1,47 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using libsecondlife;
29
30namespace OpenSim.Framework.Data
31{
32 public class ReservationData
33 {
34 public LLUUID userUUID = new LLUUID();
35 public int reservationMinX = 0;
36 public int reservationMinY = 0;
37 public int reservationMaxX = 65536;
38 public int reservationMaxY = 65536;
39
40 public string reservationName = "";
41 public string reservationCompany = "";
42 public bool status = true;
43
44 public string gridSendKey = "";
45 public string gridRecvKey = "";
46 }
47}
diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs
new file mode 100644
index 0000000..b920cab
--- /dev/null
+++ b/OpenSim/Framework/Data/SimProfileData.cs
@@ -0,0 +1,192 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using libsecondlife;
29using Nwc.XmlRpc;
30
31using System;
32using System.Collections;
33
34namespace OpenSim.Framework.Data
35{
36 /// <summary>
37 /// A class which contains information known to the grid server about a region
38 /// </summary>
39 public class SimProfileData
40 {
41 /// <summary>
42 /// The name of the region
43 /// </summary>
44 public string regionName = "";
45
46 /// <summary>
47 /// A 64-bit number combining map position into a (mostly) unique ID
48 /// </summary>
49 public ulong regionHandle;
50
51 /// <summary>
52 /// OGS/OpenSim Specific ID for a region
53 /// </summary>
54 public LLUUID UUID;
55
56 /// <summary>
57 /// Coordinates of the region
58 /// </summary>
59 public uint regionLocX;
60 public uint regionLocY;
61 public uint regionLocZ; // Reserved (round-robin, layers, etc)
62
63 /// <summary>
64 /// Authentication secrets
65 /// </summary>
66 /// <remarks>Not very secure, needs improvement.</remarks>
67 public string regionSendKey = "";
68 public string regionRecvKey = "";
69 public string regionSecret = "";
70
71 /// <summary>
72 /// Whether the region is online
73 /// </summary>
74 public bool regionOnline;
75
76 /// <summary>
77 /// Information about the server that the region is currently hosted on
78 /// </summary>
79 public string serverIP = "";
80 public uint serverPort;
81 public string serverURI = "";
82
83 public uint httpPort;
84 public uint remotingPort;
85 public string httpServerURI = "";
86
87 /// <summary>
88 /// Set of optional overrides. Can be used to create non-eulicidean spaces.
89 /// </summary>
90 public ulong regionNorthOverrideHandle;
91 public ulong regionSouthOverrideHandle;
92 public ulong regionEastOverrideHandle;
93 public ulong regionWestOverrideHandle;
94
95 /// <summary>
96 /// Optional: URI Location of the region database
97 /// </summary>
98 /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
99 public string regionDataURI = "";
100
101 /// <summary>
102 /// Region Asset Details
103 /// </summary>
104 public string regionAssetURI = "";
105 public string regionAssetSendKey = "";
106 public string regionAssetRecvKey = "";
107
108 /// <summary>
109 /// Region Userserver Details
110 /// </summary>
111 public string regionUserURI = "";
112 public string regionUserSendKey = "";
113 public string regionUserRecvKey = "";
114
115 /// <summary>
116 /// Region Map Texture Asset
117 /// </summary>
118 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006");
119
120 /// <summary>
121 /// Get Sim profile data from grid server when in grid mode
122 /// </summary>
123 /// <param name="region_uuid"></param>
124 /// <param name="gridserver_url"></param>
125 /// <param name="?"></param>
126 /// <returns></returns>
127 public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
128 {
129 Hashtable requestData = new Hashtable();
130 requestData["region_uuid"] = region_uuid.UUID.ToString();
131 requestData["authkey"] = gridserver_sendkey;
132 ArrayList SendParams = new ArrayList();
133 SendParams.Add(requestData);
134 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
135 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
136
137 Hashtable responseData = (Hashtable)GridResp.Value;
138
139 if (responseData.ContainsKey("error"))
140 {
141 return null;
142 }
143
144 SimProfileData simData = new SimProfileData();
145 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
146 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
147 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256));
148 simData.serverIP = (string)responseData["sim_ip"];
149 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
150 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
151 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
152 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
153 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
154 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
155 simData.regionName = (string)responseData["region_name"];
156
157 return simData;
158 }
159 public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
160 {
161 Hashtable requestData = new Hashtable();
162 requestData["region_handle"] = region_handle.ToString();
163 requestData["authkey"] = gridserver_sendkey;
164 ArrayList SendParams = new ArrayList();
165 SendParams.Add(requestData);
166 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
167 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
168
169 Hashtable responseData = (Hashtable)GridResp.Value;
170
171 if (responseData.ContainsKey("error"))
172 {
173 return null;
174 }
175
176 SimProfileData simData = new SimProfileData();
177 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
178 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
179 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256));
180 simData.serverIP = (string)responseData["sim_ip"];
181 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
182 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
183 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
184 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
185 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
186 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
187 simData.regionName = (string)responseData["region_name"];
188
189 return simData;
190 }
191 }
192}
diff --git a/OpenSim/Framework/Data/UserData.cs b/OpenSim/Framework/Data/UserData.cs
new file mode 100644
index 0000000..c65f9fd
--- /dev/null
+++ b/OpenSim/Framework/Data/UserData.cs
@@ -0,0 +1,128 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using libsecondlife;
29
30namespace OpenSim.Framework.Data
31{
32 /// <summary>
33 /// An interface for connecting to user storage servers.
34 /// </summary>
35 public interface IUserData
36 {
37 /// <summary>
38 /// Returns a user profile from a database via their UUID
39 /// </summary>
40 /// <param name="user">The accounts UUID</param>
41 /// <returns>The user data profile</returns>
42 UserProfileData getUserByUUID(LLUUID user);
43
44 /// <summary>
45 /// Returns a users profile by searching their username
46 /// </summary>
47 /// <param name="name">The users username</param>
48 /// <returns>The user data profile</returns>
49 UserProfileData getUserByName(string name);
50
51 /// <summary>
52 /// Returns a users profile by searching their username parts
53 /// </summary>
54 /// <param name="fname">Account firstname</param>
55 /// <param name="lname">Account lastname</param>
56 /// <returns>The user data profile</returns>
57 UserProfileData getUserByName(string fname, string lname);
58
59 /// <summary>
60 /// Returns the current agent for a user searching by it's UUID
61 /// </summary>
62 /// <param name="user">The users UUID</param>
63 /// <returns>The current agent session</returns>
64 UserAgentData getAgentByUUID(LLUUID user);
65
66 /// <summary>
67 /// Returns the current session agent for a user searching by username
68 /// </summary>
69 /// <param name="name">The users account name</param>
70 /// <returns>The current agent session</returns>
71 UserAgentData getAgentByName(string name);
72
73 /// <summary>
74 /// Returns the current session agent for a user searching by username parts
75 /// </summary>
76 /// <param name="fname">The users first account name</param>
77 /// <param name="lname">The users account surname</param>
78 /// <returns>The current agent session</returns>
79 UserAgentData getAgentByName(string fname, string lname);
80
81 /// <summary>
82 /// Adds a new User profile to the database
83 /// </summary>
84 /// <param name="user">UserProfile to add</param>
85 void addNewUserProfile(UserProfileData user);
86
87 /// <summary>
88 /// Adds a new agent to the database
89 /// </summary>
90 /// <param name="agent">The agent to add</param>
91 void addNewUserAgent(UserAgentData agent);
92
93 /// <summary>
94 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
95 /// </summary>
96 /// <param name="from">The account to transfer from</param>
97 /// <param name="to">The account to transfer to</param>
98 /// <param name="amount">The amount to transfer</param>
99 /// <returns>Successful?</returns>
100 bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount);
101
102 /// <summary>
103 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
104 /// </summary>
105 /// <param name="from">User to transfer from</param>
106 /// <param name="to">User to transfer to</param>
107 /// <param name="inventory">Specified inventory item</param>
108 /// <returns>Successful?</returns>
109 bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
110
111 /// <summary>
112 /// Returns the plugin version
113 /// </summary>
114 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
115 string getVersion();
116
117 /// <summary>
118 /// Returns the plugin name
119 /// </summary>
120 /// <returns>Plugin name, eg MySQL User Provider</returns>
121 string getName();
122
123 /// <summary>
124 /// Initialises the plugin (artificial constructor)
125 /// </summary>
126 void Initialise();
127 }
128}
diff --git a/OpenSim/Framework/Data/UserProfileData.cs b/OpenSim/Framework/Data/UserProfileData.cs
new file mode 100644
index 0000000..bb7d48c
--- /dev/null
+++ b/OpenSim/Framework/Data/UserProfileData.cs
@@ -0,0 +1,180 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using libsecondlife;
30
31namespace OpenSim.Framework.Data
32{
33 /// <summary>
34 /// Information about a particular user known to the userserver
35 /// </summary>
36 public class UserProfileData
37 {
38 /// <summary>
39 /// The ID value for this user
40 /// </summary>
41 public LLUUID UUID;
42
43 /// <summary>
44 /// The first component of a users account name
45 /// </summary>
46 public string username;
47 /// <summary>
48 /// The second component of a users account name
49 /// </summary>
50 public string surname;
51
52 /// <summary>
53 /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt)
54 /// </summary>
55 /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks>
56 public string passwordHash;
57 /// <summary>
58 /// The salt used for the users hash, should be 32 bytes or longer
59 /// </summary>
60 public string passwordSalt;
61
62 /// <summary>
63 /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
64 /// </summary>
65 public ulong homeRegion;
66 /// <summary>
67 /// The coordinates inside the region of the home location
68 /// </summary>
69 public LLVector3 homeLocation;
70 /// <summary>
71 /// Where the user will be looking when they rez.
72 /// </summary>
73 public LLVector3 homeLookAt;
74
75 /// <summary>
76 /// A UNIX Timestamp (seconds since epoch) for the users creation
77 /// </summary>
78 public int created;
79 /// <summary>
80 /// A UNIX Timestamp for the users last login date / time
81 /// </summary>
82 public int lastLogin;
83
84 /// <summary>
85 /// A URI to the users inventory server, used for foreigners and large grids
86 /// </summary>
87 public string userInventoryURI;
88 /// <summary>
89 /// A URI to the users asset server, used for foreigners and large grids.
90 /// </summary>
91 public string userAssetURI;
92
93 /// <summary>
94 /// A uint mask containing the "I can do" fields of the users profile
95 /// </summary>
96 public uint profileCanDoMask;
97 /// <summary>
98 /// A uint mask containing the "I want to do" part of the users profile
99 /// </summary>
100 public uint profileWantDoMask; // Profile window "I want to" mask
101
102 /// <summary>
103 /// The about text listed in a users profile.
104 /// </summary>
105 public string profileAboutText;
106 /// <summary>
107 /// The first life about text listed in a users profile
108 /// </summary>
109 public string profileFirstText;
110
111 /// <summary>
112 /// The profile image for an avatar stored on the asset server
113 /// </summary>
114 public LLUUID profileImage;
115 /// <summary>
116 /// The profile image for the users first life tab
117 /// </summary>
118 public LLUUID profileFirstImage;
119 /// <summary>
120 /// The users last registered agent (filled in on the user server)
121 /// </summary>
122 public UserAgentData currentAgent;
123 }
124
125 /// <summary>
126 /// Information about a users session
127 /// </summary>
128 public class UserAgentData
129 {
130 /// <summary>
131 /// The UUID of the users avatar (not the agent!)
132 /// </summary>
133 public LLUUID UUID;
134 /// <summary>
135 /// The IP address of the user
136 /// </summary>
137 public string agentIP = String.Empty;
138 /// <summary>
139 /// The port of the user
140 /// </summary>
141 public uint agentPort;
142 /// <summary>
143 /// Is the user online?
144 /// </summary>
145 public bool agentOnline;
146 /// <summary>
147 /// The session ID for the user (also the agent ID)
148 /// </summary>
149 public LLUUID sessionID;
150 /// <summary>
151 /// The "secure" session ID for the user
152 /// </summary>
153 /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
154 public LLUUID secureSessionID;
155 /// <summary>
156 /// The region the user logged into initially
157 /// </summary>
158 public LLUUID regionID;
159 /// <summary>
160 /// A unix timestamp from when the user logged in
161 /// </summary>
162 public int loginTime;
163 /// <summary>
164 /// When this agent expired and logged out, 0 if still online
165 /// </summary>
166 public int logoutTime;
167 /// <summary>
168 /// Current region the user is logged into
169 /// </summary>
170 public LLUUID currentRegion;
171 /// <summary>
172 /// Region handle of the current region the user is in
173 /// </summary>
174 public ulong currentHandle;
175 /// <summary>
176 /// The position of the user within the region
177 /// </summary>
178 public LLVector3 currentPos;
179 }
180}