diff options
Diffstat (limited to '')
25 files changed, 4104 insertions, 4104 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index 5fec367..e57a3aa 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs | |||
@@ -1,162 +1,162 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | 31 | ||
32 | namespace OpenSim.Framework.Data.DB4o | 32 | namespace OpenSim.Framework.Data.DB4o |
33 | { | 33 | { |
34 | /// <summary> | 34 | /// <summary> |
35 | /// A grid server storage mechanism employing the DB4o database system | 35 | /// A grid server storage mechanism employing the DB4o database system |
36 | /// </summary> | 36 | /// </summary> |
37 | class DB4oGridData : IGridData | 37 | class DB4oGridData : IGridData |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// The database manager object | 40 | /// The database manager object |
41 | /// </summary> | 41 | /// </summary> |
42 | DB4oGridManager manager; | 42 | DB4oGridManager manager; |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Called when the plugin is first loaded (as constructors are not called) | 45 | /// Called when the plugin is first loaded (as constructors are not called) |
46 | /// </summary> | 46 | /// </summary> |
47 | public void Initialise() { | 47 | public void Initialise() { |
48 | manager = new DB4oGridManager("gridserver.yap"); | 48 | manager = new DB4oGridManager("gridserver.yap"); |
49 | } | 49 | } |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// Returns a list of regions within the specified ranges | 52 | /// Returns a list of regions within the specified ranges |
53 | /// </summary> | 53 | /// </summary> |
54 | /// <param name="a">minimum X coordinate</param> | 54 | /// <param name="a">minimum X coordinate</param> |
55 | /// <param name="b">minimum Y coordinate</param> | 55 | /// <param name="b">minimum Y coordinate</param> |
56 | /// <param name="c">maximum X coordinate</param> | 56 | /// <param name="c">maximum X coordinate</param> |
57 | /// <param name="d">maximum Y coordinate</param> | 57 | /// <param name="d">maximum Y coordinate</param> |
58 | /// <returns>An array of region profiles</returns> | 58 | /// <returns>An array of region profiles</returns> |
59 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | 59 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) |
60 | { | 60 | { |
61 | return null; | 61 | return null; |
62 | } | 62 | } |
63 | 63 | ||
64 | /// <summary> | 64 | /// <summary> |
65 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) | 65 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) |
66 | /// </summary> | 66 | /// </summary> |
67 | /// <param name="handle">The handle to search for</param> | 67 | /// <param name="handle">The handle to search for</param> |
68 | /// <returns>A region profile</returns> | 68 | /// <returns>A region profile</returns> |
69 | public SimProfileData GetProfileByHandle(ulong handle) { | 69 | public SimProfileData GetProfileByHandle(ulong handle) { |
70 | lock (manager.simProfiles) | 70 | lock (manager.simProfiles) |
71 | { | 71 | { |
72 | foreach (LLUUID UUID in manager.simProfiles.Keys) | 72 | foreach (LLUUID UUID in manager.simProfiles.Keys) |
73 | { | 73 | { |
74 | if (manager.simProfiles[UUID].regionHandle == handle) | 74 | if (manager.simProfiles[UUID].regionHandle == handle) |
75 | { | 75 | { |
76 | return manager.simProfiles[UUID]; | 76 | return manager.simProfiles[UUID]; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); | 80 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); |
81 | } | 81 | } |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Returns a specific region | 84 | /// Returns a specific region |
85 | /// </summary> | 85 | /// </summary> |
86 | /// <param name="uuid">The region ID code</param> | 86 | /// <param name="uuid">The region ID code</param> |
87 | /// <returns>A region profile</returns> | 87 | /// <returns>A region profile</returns> |
88 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | 88 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
89 | { | 89 | { |
90 | lock (manager.simProfiles) | 90 | lock (manager.simProfiles) |
91 | { | 91 | { |
92 | if (manager.simProfiles.ContainsKey(uuid)) | 92 | if (manager.simProfiles.ContainsKey(uuid)) |
93 | return manager.simProfiles[uuid]; | 93 | return manager.simProfiles[uuid]; |
94 | } | 94 | } |
95 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); | 95 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); |
96 | } | 96 | } |
97 | 97 | ||
98 | /// <summary> | 98 | /// <summary> |
99 | /// Adds a new specified region to the database | 99 | /// Adds a new specified region to the database |
100 | /// </summary> | 100 | /// </summary> |
101 | /// <param name="profile">The profile to add</param> | 101 | /// <param name="profile">The profile to add</param> |
102 | /// <returns>A dataresponse enum indicating success</returns> | 102 | /// <returns>A dataresponse enum indicating success</returns> |
103 | public DataResponse AddProfile(SimProfileData profile) | 103 | public DataResponse AddProfile(SimProfileData profile) |
104 | { | 104 | { |
105 | lock (manager.simProfiles) | 105 | lock (manager.simProfiles) |
106 | { | 106 | { |
107 | if (manager.AddRow(profile)) | 107 | if (manager.AddRow(profile)) |
108 | { | 108 | { |
109 | return DataResponse.RESPONSE_OK; | 109 | return DataResponse.RESPONSE_OK; |
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | return DataResponse.RESPONSE_ERROR; | 113 | return DataResponse.RESPONSE_ERROR; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
119 | /// Authenticates a new region using the shared secrets. NOT SECURE. | 119 | /// Authenticates a new region using the shared secrets. NOT SECURE. |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <param name="uuid">The UUID the region is authenticating with</param> | 121 | /// <param name="uuid">The UUID the region is authenticating with</param> |
122 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | 122 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> |
123 | /// <param name="key">The shared secret</param> | 123 | /// <param name="key">The shared secret</param> |
124 | /// <returns>Authenticated?</returns> | 124 | /// <returns>Authenticated?</returns> |
125 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | 125 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { |
126 | if (manager.simProfiles[uuid].regionRecvKey == key) | 126 | if (manager.simProfiles[uuid].regionRecvKey == key) |
127 | return true; | 127 | return true; |
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Shuts down the database | 132 | /// Shuts down the database |
133 | /// </summary> | 133 | /// </summary> |
134 | public void Close() | 134 | public void Close() |
135 | { | 135 | { |
136 | manager = null; | 136 | manager = null; |
137 | } | 137 | } |
138 | 138 | ||
139 | /// <summary> | 139 | /// <summary> |
140 | /// Returns the providers name | 140 | /// Returns the providers name |
141 | /// </summary> | 141 | /// </summary> |
142 | /// <returns>The name of the storage system</returns> | 142 | /// <returns>The name of the storage system</returns> |
143 | public string getName() | 143 | public string getName() |
144 | { | 144 | { |
145 | return "DB4o Grid Provider"; | 145 | return "DB4o Grid Provider"; |
146 | } | 146 | } |
147 | 147 | ||
148 | /// <summary> | 148 | /// <summary> |
149 | /// Returns the providers version | 149 | /// Returns the providers version |
150 | /// </summary> | 150 | /// </summary> |
151 | /// <returns>The version of the storage system</returns> | 151 | /// <returns>The version of the storage system</returns> |
152 | public string getVersion() | 152 | public string getVersion() |
153 | { | 153 | { |
154 | return "0.1"; | 154 | return "0.1"; |
155 | } | 155 | } |
156 | 156 | ||
157 | public ReservationData GetReservationAtPoint(uint x, uint y) | 157 | public ReservationData GetReservationAtPoint(uint x, uint y) |
158 | { | 158 | { |
159 | return null; | 159 | return null; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 0df6350..43f9095 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs | |||
@@ -1,163 +1,163 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Db4objects.Db4o; | 30 | using Db4objects.Db4o; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | 32 | ||
33 | namespace OpenSim.Framework.Data.DB4o | 33 | namespace OpenSim.Framework.Data.DB4o |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// A Database manager for Db4o | 36 | /// A Database manager for Db4o |
37 | /// </summary> | 37 | /// </summary> |
38 | class DB4oGridManager | 38 | class DB4oGridManager |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// A list of the current regions connected (in-memory cache) | 41 | /// A list of the current regions connected (in-memory cache) |
42 | /// </summary> | 42 | /// </summary> |
43 | public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>(); | 43 | public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>(); |
44 | /// <summary> | 44 | /// <summary> |
45 | /// Database File Name | 45 | /// Database File Name |
46 | /// </summary> | 46 | /// </summary> |
47 | string dbfl; | 47 | string dbfl; |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Creates a new grid storage manager | 50 | /// Creates a new grid storage manager |
51 | /// </summary> | 51 | /// </summary> |
52 | /// <param name="db4odb">Filename to the database file</param> | 52 | /// <param name="db4odb">Filename to the database file</param> |
53 | public DB4oGridManager(string db4odb) | 53 | public DB4oGridManager(string db4odb) |
54 | { | 54 | { |
55 | dbfl = db4odb; | 55 | dbfl = db4odb; |
56 | IObjectContainer database; | 56 | IObjectContainer database; |
57 | database = Db4oFactory.OpenFile(dbfl); | 57 | database = Db4oFactory.OpenFile(dbfl); |
58 | IObjectSet result = database.Get(typeof(SimProfileData)); | 58 | IObjectSet result = database.Get(typeof(SimProfileData)); |
59 | // Loads the file into the in-memory cache | 59 | // Loads the file into the in-memory cache |
60 | foreach(SimProfileData row in result) { | 60 | foreach(SimProfileData row in result) { |
61 | simProfiles.Add(row.UUID, row); | 61 | simProfiles.Add(row.UUID, row); |
62 | } | 62 | } |
63 | database.Close(); | 63 | database.Close(); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Adds a new profile to the database (Warning: Probably slow.) | 67 | /// Adds a new profile to the database (Warning: Probably slow.) |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="row">The profile to add</param> | 69 | /// <param name="row">The profile to add</param> |
70 | /// <returns>Successful?</returns> | 70 | /// <returns>Successful?</returns> |
71 | public bool AddRow(SimProfileData row) | 71 | public bool AddRow(SimProfileData row) |
72 | { | 72 | { |
73 | if (simProfiles.ContainsKey(row.UUID)) | 73 | if (simProfiles.ContainsKey(row.UUID)) |
74 | { | 74 | { |
75 | simProfiles[row.UUID] = row; | 75 | simProfiles[row.UUID] = row; |
76 | } | 76 | } |
77 | else | 77 | else |
78 | { | 78 | { |
79 | simProfiles.Add(row.UUID, row); | 79 | simProfiles.Add(row.UUID, row); |
80 | } | 80 | } |
81 | 81 | ||
82 | try | 82 | try |
83 | { | 83 | { |
84 | IObjectContainer database; | 84 | IObjectContainer database; |
85 | database = Db4oFactory.OpenFile(dbfl); | 85 | database = Db4oFactory.OpenFile(dbfl); |
86 | database.Set(row); | 86 | database.Set(row); |
87 | database.Close(); | 87 | database.Close(); |
88 | return true; | 88 | return true; |
89 | } | 89 | } |
90 | catch (Exception) | 90 | catch (Exception) |
91 | { | 91 | { |
92 | return false; | 92 | return false; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | /// <summary> | 99 | /// <summary> |
100 | /// A manager for the DB4o database (user profiles) | 100 | /// A manager for the DB4o database (user profiles) |
101 | /// </summary> | 101 | /// </summary> |
102 | class DB4oUserManager | 102 | class DB4oUserManager |
103 | { | 103 | { |
104 | /// <summary> | 104 | /// <summary> |
105 | /// A list of the user profiles (in memory cache) | 105 | /// A list of the user profiles (in memory cache) |
106 | /// </summary> | 106 | /// </summary> |
107 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); | 107 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); |
108 | /// <summary> | 108 | /// <summary> |
109 | /// Database filename | 109 | /// Database filename |
110 | /// </summary> | 110 | /// </summary> |
111 | string dbfl; | 111 | string dbfl; |
112 | 112 | ||
113 | /// <summary> | 113 | /// <summary> |
114 | /// Initialises a new DB manager | 114 | /// Initialises a new DB manager |
115 | /// </summary> | 115 | /// </summary> |
116 | /// <param name="db4odb">The filename to the database</param> | 116 | /// <param name="db4odb">The filename to the database</param> |
117 | public DB4oUserManager(string db4odb) | 117 | public DB4oUserManager(string db4odb) |
118 | { | 118 | { |
119 | dbfl = db4odb; | 119 | dbfl = db4odb; |
120 | IObjectContainer database; | 120 | IObjectContainer database; |
121 | database = Db4oFactory.OpenFile(dbfl); | 121 | database = Db4oFactory.OpenFile(dbfl); |
122 | // Load to cache | 122 | // Load to cache |
123 | IObjectSet result = database.Get(typeof(UserProfileData)); | 123 | IObjectSet result = database.Get(typeof(UserProfileData)); |
124 | foreach (UserProfileData row in result) | 124 | foreach (UserProfileData row in result) |
125 | { | 125 | { |
126 | userProfiles.Add(row.UUID, row); | 126 | userProfiles.Add(row.UUID, row); |
127 | } | 127 | } |
128 | database.Close(); | 128 | database.Close(); |
129 | } | 129 | } |
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Adds a new profile to the database (Warning: Probably slow.) | 132 | /// Adds a new profile to the database (Warning: Probably slow.) |
133 | /// </summary> | 133 | /// </summary> |
134 | /// <param name="row">The profile to add</param> | 134 | /// <param name="row">The profile to add</param> |
135 | /// <returns>Successful?</returns> | 135 | /// <returns>Successful?</returns> |
136 | public bool AddRow(UserProfileData row) | 136 | public bool AddRow(UserProfileData row) |
137 | { | 137 | { |
138 | if (userProfiles.ContainsKey(row.UUID)) | 138 | if (userProfiles.ContainsKey(row.UUID)) |
139 | { | 139 | { |
140 | userProfiles[row.UUID] = row; | 140 | userProfiles[row.UUID] = row; |
141 | } | 141 | } |
142 | else | 142 | else |
143 | { | 143 | { |
144 | userProfiles.Add(row.UUID, row); | 144 | userProfiles.Add(row.UUID, row); |
145 | } | 145 | } |
146 | 146 | ||
147 | try | 147 | try |
148 | { | 148 | { |
149 | IObjectContainer database; | 149 | IObjectContainer database; |
150 | database = Db4oFactory.OpenFile(dbfl); | 150 | database = Db4oFactory.OpenFile(dbfl); |
151 | database.Set(row); | 151 | database.Set(row); |
152 | database.Close(); | 152 | database.Close(); |
153 | return true; | 153 | return true; |
154 | } | 154 | } |
155 | catch (Exception) | 155 | catch (Exception) |
156 | { | 156 | { |
157 | return false; | 157 | return false; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | } | 162 | } |
163 | } | 163 | } |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 2e33ab0..845b764 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs | |||
@@ -1,202 +1,202 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | 30 | ||
31 | namespace OpenSim.Framework.Data.DB4o | 31 | namespace OpenSim.Framework.Data.DB4o |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// A User storage interface for the DB4o database system | 34 | /// A User storage interface for the DB4o database system |
35 | /// </summary> | 35 | /// </summary> |
36 | public class DB4oUserData : IUserData | 36 | public class DB4oUserData : IUserData |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// The database manager | 39 | /// The database manager |
40 | /// </summary> | 40 | /// </summary> |
41 | DB4oUserManager manager; | 41 | DB4oUserManager manager; |
42 | 42 | ||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Artificial constructor called upon plugin load | 44 | /// Artificial constructor called upon plugin load |
45 | /// </summary> | 45 | /// </summary> |
46 | public void Initialise() | 46 | public void Initialise() |
47 | { | 47 | { |
48 | manager = new DB4oUserManager("userprofiles.yap"); | 48 | manager = new DB4oUserManager("userprofiles.yap"); |
49 | } | 49 | } |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// Loads a specified user profile from a UUID | 52 | /// Loads a specified user profile from a UUID |
53 | /// </summary> | 53 | /// </summary> |
54 | /// <param name="uuid">The users UUID</param> | 54 | /// <param name="uuid">The users UUID</param> |
55 | /// <returns>A user profile</returns> | 55 | /// <returns>A user profile</returns> |
56 | public UserProfileData getUserByUUID(LLUUID uuid) | 56 | public UserProfileData getUserByUUID(LLUUID uuid) |
57 | { | 57 | { |
58 | if(manager.userProfiles.ContainsKey(uuid)) | 58 | if(manager.userProfiles.ContainsKey(uuid)) |
59 | return manager.userProfiles[uuid]; | 59 | return manager.userProfiles[uuid]; |
60 | return null; | 60 | return null; |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Returns a user by searching for its name | 64 | /// Returns a user by searching for its name |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <param name="name">The users account name</param> | 66 | /// <param name="name">The users account name</param> |
67 | /// <returns>A matching users profile</returns> | 67 | /// <returns>A matching users profile</returns> |
68 | public UserProfileData getUserByName(string name) | 68 | public UserProfileData getUserByName(string name) |
69 | { | 69 | { |
70 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | 70 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Returns a user by searching for its name | 74 | /// Returns a user by searching for its name |
75 | /// </summary> | 75 | /// </summary> |
76 | /// <param name="fname">The first part of the users account name</param> | 76 | /// <param name="fname">The first part of the users account name</param> |
77 | /// <param name="lname">The second part of the users account name</param> | 77 | /// <param name="lname">The second part of the users account name</param> |
78 | /// <returns>A matching users profile</returns> | 78 | /// <returns>A matching users profile</returns> |
79 | public UserProfileData getUserByName(string fname, string lname) | 79 | public UserProfileData getUserByName(string fname, string lname) |
80 | { | 80 | { |
81 | foreach (UserProfileData profile in manager.userProfiles.Values) | 81 | foreach (UserProfileData profile in manager.userProfiles.Values) |
82 | { | 82 | { |
83 | if (profile.username == fname && profile.surname == lname) | 83 | if (profile.username == fname && profile.surname == lname) |
84 | return profile; | 84 | return profile; |
85 | } | 85 | } |
86 | return null; | 86 | return null; |
87 | } | 87 | } |
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// Returns a user by UUID direct | 90 | /// Returns a user by UUID direct |
91 | /// </summary> | 91 | /// </summary> |
92 | /// <param name="uuid">The users account ID</param> | 92 | /// <param name="uuid">The users account ID</param> |
93 | /// <returns>A matching users profile</returns> | 93 | /// <returns>A matching users profile</returns> |
94 | public UserAgentData getAgentByUUID(LLUUID uuid) | 94 | public UserAgentData getAgentByUUID(LLUUID uuid) |
95 | { | 95 | { |
96 | try | 96 | try |
97 | { | 97 | { |
98 | return getUserByUUID(uuid).currentAgent; | 98 | return getUserByUUID(uuid).currentAgent; |
99 | } | 99 | } |
100 | catch (Exception) | 100 | catch (Exception) |
101 | { | 101 | { |
102 | return null; | 102 | return null; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | /// <summary> | 106 | /// <summary> |
107 | /// Returns a session by account name | 107 | /// Returns a session by account name |
108 | /// </summary> | 108 | /// </summary> |
109 | /// <param name="name">The account name</param> | 109 | /// <param name="name">The account name</param> |
110 | /// <returns>The users session agent</returns> | 110 | /// <returns>The users session agent</returns> |
111 | public UserAgentData getAgentByName(string name) | 111 | public UserAgentData getAgentByName(string name) |
112 | { | 112 | { |
113 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | 113 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); |
114 | } | 114 | } |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// Returns a session by account name | 117 | /// Returns a session by account name |
118 | /// </summary> | 118 | /// </summary> |
119 | /// <param name="fname">The first part of the users account name</param> | 119 | /// <param name="fname">The first part of the users account name</param> |
120 | /// <param name="lname">The second part of the users account name</param> | 120 | /// <param name="lname">The second part of the users account name</param> |
121 | /// <returns>A user agent</returns> | 121 | /// <returns>A user agent</returns> |
122 | public UserAgentData getAgentByName(string fname, string lname) | 122 | public UserAgentData getAgentByName(string fname, string lname) |
123 | { | 123 | { |
124 | try | 124 | try |
125 | { | 125 | { |
126 | return getUserByName(fname,lname).currentAgent; | 126 | return getUserByName(fname,lname).currentAgent; |
127 | } | 127 | } |
128 | catch (Exception) | 128 | catch (Exception) |
129 | { | 129 | { |
130 | return null; | 130 | return null; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | /// <summary> | 134 | /// <summary> |
135 | /// Creates a new user profile | 135 | /// Creates a new user profile |
136 | /// </summary> | 136 | /// </summary> |
137 | /// <param name="user">The profile to add to the database</param> | 137 | /// <param name="user">The profile to add to the database</param> |
138 | public void addNewUserProfile(UserProfileData user) | 138 | public void addNewUserProfile(UserProfileData user) |
139 | { | 139 | { |
140 | try | 140 | try |
141 | { | 141 | { |
142 | manager.AddRow(user); | 142 | manager.AddRow(user); |
143 | } | 143 | } |
144 | catch (Exception e) | 144 | catch (Exception e) |
145 | { | 145 | { |
146 | Console.WriteLine(e.ToString()); | 146 | Console.WriteLine(e.ToString()); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | /// <summary> | 150 | /// <summary> |
151 | /// Creates a new user agent | 151 | /// Creates a new user agent |
152 | /// </summary> | 152 | /// </summary> |
153 | /// <param name="agent">The agent to add to the database</param> | 153 | /// <param name="agent">The agent to add to the database</param> |
154 | public void addNewUserAgent(UserAgentData agent) | 154 | public void addNewUserAgent(UserAgentData agent) |
155 | { | 155 | { |
156 | // Do nothing. yet. | 156 | // Do nothing. yet. |
157 | } | 157 | } |
158 | 158 | ||
159 | /// <summary> | 159 | /// <summary> |
160 | /// Transfers money between two user accounts | 160 | /// Transfers money between two user accounts |
161 | /// </summary> | 161 | /// </summary> |
162 | /// <param name="from">Starting account</param> | 162 | /// <param name="from">Starting account</param> |
163 | /// <param name="to">End account</param> | 163 | /// <param name="to">End account</param> |
164 | /// <param name="amount">The amount to move</param> | 164 | /// <param name="amount">The amount to move</param> |
165 | /// <returns>Success?</returns> | 165 | /// <returns>Success?</returns> |
166 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 166 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
167 | { | 167 | { |
168 | return true; | 168 | return true; |
169 | } | 169 | } |
170 | 170 | ||
171 | /// <summary> | 171 | /// <summary> |
172 | /// Transfers inventory between two accounts | 172 | /// Transfers inventory between two accounts |
173 | /// </summary> | 173 | /// </summary> |
174 | /// <remarks>Move to inventory server</remarks> | 174 | /// <remarks>Move to inventory server</remarks> |
175 | /// <param name="from">Senders account</param> | 175 | /// <param name="from">Senders account</param> |
176 | /// <param name="to">Recievers account</param> | 176 | /// <param name="to">Recievers account</param> |
177 | /// <param name="item">Inventory item</param> | 177 | /// <param name="item">Inventory item</param> |
178 | /// <returns>Success?</returns> | 178 | /// <returns>Success?</returns> |
179 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 179 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
180 | { | 180 | { |
181 | return true; | 181 | return true; |
182 | } | 182 | } |
183 | 183 | ||
184 | /// <summary> | 184 | /// <summary> |
185 | /// Returns the name of the storage provider | 185 | /// Returns the name of the storage provider |
186 | /// </summary> | 186 | /// </summary> |
187 | /// <returns>Storage provider name</returns> | 187 | /// <returns>Storage provider name</returns> |
188 | public string getName() | 188 | public string getName() |
189 | { | 189 | { |
190 | return "DB4o Userdata"; | 190 | return "DB4o Userdata"; |
191 | } | 191 | } |
192 | 192 | ||
193 | /// <summary> | 193 | /// <summary> |
194 | /// Returns the version of the storage provider | 194 | /// Returns the version of the storage provider |
195 | /// </summary> | 195 | /// </summary> |
196 | /// <returns>Storage provider version</returns> | 196 | /// <returns>Storage provider version</returns> |
197 | public string getVersion() | 197 | public string getVersion() |
198 | { | 198 | { |
199 | return "0.1"; | 199 | return "0.1"; |
200 | } | 200 | } |
201 | } | 201 | } |
202 | } | 202 | } |
diff --git a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs index 905cd9b..52d09fa 100644 --- a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | // General Information about an assembly is controlled through the following | 3 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 4 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 5 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] | 6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] |
7 | [assembly: AssemblyDescription("")] | 7 | [assembly: AssemblyDescription("")] |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyConfiguration("")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyCompany("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] | 10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCopyright("Copyright © 2007")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyTrademark("")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCulture("")] |
14 | 14 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 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 | 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. | 17 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 18 | [assembly: ComVisible(false)] |
19 | 19 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | 21 | [assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] |
22 | 22 | ||
23 | // Version information for an assembly consists of the following four values: | 23 | // Version information for an assembly consists of the following four values: |
24 | // | 24 | // |
25 | // Major Version | 25 | // Major Version |
26 | // Minor Version | 26 | // Minor Version |
27 | // Build Number | 27 | // Build Number |
28 | // Revision | 28 | // Revision |
29 | // | 29 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 30 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 31 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index ca9196a5..dc60ca4 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | |||
@@ -1,194 +1,194 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Security.Cryptography; | 31 | using System.Security.Cryptography; |
32 | using System.Text; | 32 | using System.Text; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Data.MSSQL | 35 | namespace OpenSim.Framework.Data.MSSQL |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// A grid data interface for Microsoft SQL Server | 38 | /// A grid data interface for Microsoft SQL Server |
39 | /// </summary> | 39 | /// </summary> |
40 | public class SqlGridData : IGridData | 40 | public class SqlGridData : IGridData |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// Database manager | 43 | /// Database manager |
44 | /// </summary> | 44 | /// </summary> |
45 | private MSSqlManager database; | 45 | private MSSqlManager database; |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Initialises the Grid Interface | 48 | /// Initialises the Grid Interface |
49 | /// </summary> | 49 | /// </summary> |
50 | public void Initialise() | 50 | public void Initialise() |
51 | { | 51 | { |
52 | database = new MSSqlManager("localhost", "db", "user", "password", "false"); | 52 | database = new MSSqlManager("localhost", "db", "user", "password", "false"); |
53 | } | 53 | } |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Shuts down the grid interface | 56 | /// Shuts down the grid interface |
57 | /// </summary> | 57 | /// </summary> |
58 | public void Close() | 58 | public void Close() |
59 | { | 59 | { |
60 | database.Close(); | 60 | database.Close(); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Returns the storage system name | 64 | /// Returns the storage system name |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <returns>A string containing the storage system name</returns> | 66 | /// <returns>A string containing the storage system name</returns> |
67 | public string getName() | 67 | public string getName() |
68 | { | 68 | { |
69 | return "Sql OpenGridData"; | 69 | return "Sql OpenGridData"; |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Returns the storage system version | 73 | /// Returns the storage system version |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <returns>A string containing the storage system version</returns> | 75 | /// <returns>A string containing the storage system version</returns> |
76 | public string getVersion() | 76 | public string getVersion() |
77 | { | 77 | { |
78 | return "0.1"; | 78 | return "0.1"; |
79 | } | 79 | } |
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// Returns a list of regions within the specified ranges | 82 | /// Returns a list of regions within the specified ranges |
83 | /// </summary> | 83 | /// </summary> |
84 | /// <param name="a">minimum X coordinate</param> | 84 | /// <param name="a">minimum X coordinate</param> |
85 | /// <param name="b">minimum Y coordinate</param> | 85 | /// <param name="b">minimum Y coordinate</param> |
86 | /// <param name="c">maximum X coordinate</param> | 86 | /// <param name="c">maximum X coordinate</param> |
87 | /// <param name="d">maximum Y coordinate</param> | 87 | /// <param name="d">maximum Y coordinate</param> |
88 | /// <returns>An array of region profiles</returns> | 88 | /// <returns>An array of region profiles</returns> |
89 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | 89 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) |
90 | { | 90 | { |
91 | return null; | 91 | return null; |
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
95 | /// Returns a sim profile from it's location | 95 | /// Returns a sim profile from it's location |
96 | /// </summary> | 96 | /// </summary> |
97 | /// <param name="handle">Region location handle</param> | 97 | /// <param name="handle">Region location handle</param> |
98 | /// <returns>Sim profile</returns> | 98 | /// <returns>Sim profile</returns> |
99 | public SimProfileData GetProfileByHandle(ulong handle) | 99 | public SimProfileData GetProfileByHandle(ulong handle) |
100 | { | 100 | { |
101 | Dictionary<string, string> param = new Dictionary<string, string>(); | 101 | Dictionary<string, string> param = new Dictionary<string, string>(); |
102 | param["handle"] = handle.ToString(); | 102 | param["handle"] = handle.ToString(); |
103 | 103 | ||
104 | IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); | 104 | IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); |
105 | IDataReader reader = result.ExecuteReader(); | 105 | IDataReader reader = result.ExecuteReader(); |
106 | 106 | ||
107 | SimProfileData row = database.getRow(reader); | 107 | SimProfileData row = database.getRow(reader); |
108 | reader.Close(); | 108 | reader.Close(); |
109 | result.Dispose(); | 109 | result.Dispose(); |
110 | 110 | ||
111 | return row; | 111 | return row; |
112 | } | 112 | } |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// Returns a sim profile from it's UUID | 115 | /// Returns a sim profile from it's UUID |
116 | /// </summary> | 116 | /// </summary> |
117 | /// <param name="uuid">The region UUID</param> | 117 | /// <param name="uuid">The region UUID</param> |
118 | /// <returns>The sim profile</returns> | 118 | /// <returns>The sim profile</returns> |
119 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | 119 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
120 | { | 120 | { |
121 | Dictionary<string, string> param = new Dictionary<string, string>(); | 121 | Dictionary<string, string> param = new Dictionary<string, string>(); |
122 | param["uuid"] = uuid.ToStringHyphenated(); | 122 | param["uuid"] = uuid.ToStringHyphenated(); |
123 | 123 | ||
124 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); | 124 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); |
125 | IDataReader reader = result.ExecuteReader(); | 125 | IDataReader reader = result.ExecuteReader(); |
126 | 126 | ||
127 | SimProfileData row = database.getRow(reader); | 127 | SimProfileData row = database.getRow(reader); |
128 | reader.Close(); | 128 | reader.Close(); |
129 | result.Dispose(); | 129 | result.Dispose(); |
130 | 130 | ||
131 | return row; | 131 | return row; |
132 | } | 132 | } |
133 | 133 | ||
134 | /// <summary> | 134 | /// <summary> |
135 | /// Adds a new specified region to the database | 135 | /// Adds a new specified region to the database |
136 | /// </summary> | 136 | /// </summary> |
137 | /// <param name="profile">The profile to add</param> | 137 | /// <param name="profile">The profile to add</param> |
138 | /// <returns>A dataresponse enum indicating success</returns> | 138 | /// <returns>A dataresponse enum indicating success</returns> |
139 | public DataResponse AddProfile(SimProfileData profile) | 139 | public DataResponse AddProfile(SimProfileData profile) |
140 | { | 140 | { |
141 | if (database.insertRow(profile)) | 141 | if (database.insertRow(profile)) |
142 | { | 142 | { |
143 | return DataResponse.RESPONSE_OK; | 143 | return DataResponse.RESPONSE_OK; |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | return DataResponse.RESPONSE_ERROR; | 147 | return DataResponse.RESPONSE_ERROR; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | /// <summary> | 151 | /// <summary> |
152 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | 152 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. |
153 | /// </summary> | 153 | /// </summary> |
154 | /// <param name="uuid">The UUID of the challenger</param> | 154 | /// <param name="uuid">The UUID of the challenger</param> |
155 | /// <param name="handle">The attempted regionHandle of the challenger</param> | 155 | /// <param name="handle">The attempted regionHandle of the challenger</param> |
156 | /// <param name="authkey">The secret</param> | 156 | /// <param name="authkey">The secret</param> |
157 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | 157 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> |
158 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) | 158 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) |
159 | { | 159 | { |
160 | bool throwHissyFit = false; // Should be true by 1.0 | 160 | bool throwHissyFit = false; // Should be true by 1.0 |
161 | 161 | ||
162 | if (throwHissyFit) | 162 | if (throwHissyFit) |
163 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | 163 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); |
164 | 164 | ||
165 | SimProfileData data = GetProfileByLLUUID(uuid); | 165 | SimProfileData data = GetProfileByLLUUID(uuid); |
166 | 166 | ||
167 | return (handle == data.regionHandle && authkey == data.regionSecret); | 167 | return (handle == data.regionHandle && authkey == data.regionSecret); |
168 | } | 168 | } |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | 171 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region |
172 | /// </summary> | 172 | /// </summary> |
173 | /// <remarks>This requires a security audit.</remarks> | 173 | /// <remarks>This requires a security audit.</remarks> |
174 | /// <param name="uuid"></param> | 174 | /// <param name="uuid"></param> |
175 | /// <param name="handle"></param> | 175 | /// <param name="handle"></param> |
176 | /// <param name="authhash"></param> | 176 | /// <param name="authhash"></param> |
177 | /// <param name="challenge"></param> | 177 | /// <param name="challenge"></param> |
178 | /// <returns></returns> | 178 | /// <returns></returns> |
179 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) | 179 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) |
180 | { | 180 | { |
181 | SHA512Managed HashProvider = new SHA512Managed(); | 181 | SHA512Managed HashProvider = new SHA512Managed(); |
182 | ASCIIEncoding TextProvider = new ASCIIEncoding(); | 182 | ASCIIEncoding TextProvider = new ASCIIEncoding(); |
183 | 183 | ||
184 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | 184 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); |
185 | byte[] hash = HashProvider.ComputeHash(stream); | 185 | byte[] hash = HashProvider.ComputeHash(stream); |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | public ReservationData GetReservationAtPoint(uint x, uint y) | 188 | public ReservationData GetReservationAtPoint(uint x, uint y) |
189 | { | 189 | { |
190 | return null; | 190 | return null; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | } | 194 | } |
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 49bf31c..26677a5 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | |||
@@ -1,211 +1,211 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Data.SqlClient; | 31 | using System.Data.SqlClient; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Data.MSSQL | 34 | namespace OpenSim.Framework.Data.MSSQL |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// A management class for the MS SQL Storage Engine | 37 | /// A management class for the MS SQL Storage Engine |
38 | /// </summary> | 38 | /// </summary> |
39 | class MSSqlManager | 39 | class MSSqlManager |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// The database connection object | 42 | /// The database connection object |
43 | /// </summary> | 43 | /// </summary> |
44 | IDbConnection dbcon; | 44 | IDbConnection dbcon; |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Initialises and creates a new Sql connection and maintains it. | 47 | /// Initialises and creates a new Sql connection and maintains it. |
48 | /// </summary> | 48 | /// </summary> |
49 | /// <param name="hostname">The Sql server being connected to</param> | 49 | /// <param name="hostname">The Sql server being connected to</param> |
50 | /// <param name="database">The name of the Sql database being used</param> | 50 | /// <param name="database">The name of the Sql database being used</param> |
51 | /// <param name="username">The username logging into the database</param> | 51 | /// <param name="username">The username logging into the database</param> |
52 | /// <param name="password">The password for the user logging in</param> | 52 | /// <param name="password">The password for the user logging in</param> |
53 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | 53 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> |
54 | public MSSqlManager(string hostname, string database, string username, string password, string cpooling) | 54 | public MSSqlManager(string hostname, string database, string username, string password, string cpooling) |
55 | { | 55 | { |
56 | try | 56 | try |
57 | { | 57 | { |
58 | string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | 58 | string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; |
59 | dbcon = new SqlConnection(connectionString); | 59 | dbcon = new SqlConnection(connectionString); |
60 | 60 | ||
61 | dbcon.Open(); | 61 | dbcon.Open(); |
62 | } | 62 | } |
63 | catch (Exception e) | 63 | catch (Exception e) |
64 | { | 64 | { |
65 | throw new Exception("Error initialising Sql Database: " + e.ToString()); | 65 | throw new Exception("Error initialising Sql Database: " + e.ToString()); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Shuts down the database connection | 70 | /// Shuts down the database connection |
71 | /// </summary> | 71 | /// </summary> |
72 | public void Close() | 72 | public void Close() |
73 | { | 73 | { |
74 | dbcon.Close(); | 74 | dbcon.Close(); |
75 | dbcon = null; | 75 | dbcon = null; |
76 | } | 76 | } |
77 | 77 | ||
78 | /// <summary> | 78 | /// <summary> |
79 | /// Runs a query with protection against SQL Injection by using parameterised input. | 79 | /// Runs a query with protection against SQL Injection by using parameterised input. |
80 | /// </summary> | 80 | /// </summary> |
81 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | 81 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> |
82 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | 82 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> |
83 | /// <returns>A Sql DB Command</returns> | 83 | /// <returns>A Sql DB Command</returns> |
84 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 84 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) |
85 | { | 85 | { |
86 | SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); | 86 | SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); |
87 | dbcommand.CommandText = sql; | 87 | dbcommand.CommandText = sql; |
88 | foreach (KeyValuePair<string, string> param in parameters) | 88 | foreach (KeyValuePair<string, string> param in parameters) |
89 | { | 89 | { |
90 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 90 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
91 | } | 91 | } |
92 | 92 | ||
93 | return (IDbCommand)dbcommand; | 93 | return (IDbCommand)dbcommand; |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Runs a database reader object and returns a region row | 97 | /// Runs a database reader object and returns a region row |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="reader">An active database reader</param> | 99 | /// <param name="reader">An active database reader</param> |
100 | /// <returns>A region row</returns> | 100 | /// <returns>A region row</returns> |
101 | public SimProfileData getRow(IDataReader reader) | 101 | public SimProfileData getRow(IDataReader reader) |
102 | { | 102 | { |
103 | SimProfileData regionprofile = new SimProfileData(); | 103 | SimProfileData regionprofile = new SimProfileData(); |
104 | 104 | ||
105 | if (reader.Read()) | 105 | if (reader.Read()) |
106 | { | 106 | { |
107 | // Region Main | 107 | // Region Main |
108 | regionprofile.regionHandle = (ulong)reader["regionHandle"]; | 108 | regionprofile.regionHandle = (ulong)reader["regionHandle"]; |
109 | regionprofile.regionName = (string)reader["regionName"]; | 109 | regionprofile.regionName = (string)reader["regionName"]; |
110 | regionprofile.UUID = new LLUUID((string)reader["uuid"]); | 110 | regionprofile.UUID = new LLUUID((string)reader["uuid"]); |
111 | 111 | ||
112 | // Secrets | 112 | // Secrets |
113 | regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; | 113 | regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; |
114 | regionprofile.regionSecret = (string)reader["regionSecret"]; | 114 | regionprofile.regionSecret = (string)reader["regionSecret"]; |
115 | regionprofile.regionSendKey = (string)reader["regionSendKey"]; | 115 | regionprofile.regionSendKey = (string)reader["regionSendKey"]; |
116 | 116 | ||
117 | // Region Server | 117 | // Region Server |
118 | regionprofile.regionDataURI = (string)reader["regionDataURI"]; | 118 | regionprofile.regionDataURI = (string)reader["regionDataURI"]; |
119 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. | 119 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. |
120 | regionprofile.serverIP = (string)reader["serverIP"]; | 120 | regionprofile.serverIP = (string)reader["serverIP"]; |
121 | regionprofile.serverPort = (uint)reader["serverPort"]; | 121 | regionprofile.serverPort = (uint)reader["serverPort"]; |
122 | regionprofile.serverURI = (string)reader["serverURI"]; | 122 | regionprofile.serverURI = (string)reader["serverURI"]; |
123 | 123 | ||
124 | // Location | 124 | // Location |
125 | regionprofile.regionLocX = (uint)((int)reader["locX"]); | 125 | regionprofile.regionLocX = (uint)((int)reader["locX"]); |
126 | regionprofile.regionLocY = (uint)((int)reader["locY"]); | 126 | regionprofile.regionLocY = (uint)((int)reader["locY"]); |
127 | regionprofile.regionLocZ = (uint)((int)reader["locZ"]); | 127 | regionprofile.regionLocZ = (uint)((int)reader["locZ"]); |
128 | 128 | ||
129 | // Neighbours - 0 = No Override | 129 | // Neighbours - 0 = No Override |
130 | regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | 130 | regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; |
131 | regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | 131 | regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; |
132 | regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | 132 | regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; |
133 | regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | 133 | regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; |
134 | 134 | ||
135 | // Assets | 135 | // Assets |
136 | regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; | 136 | regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; |
137 | regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 137 | regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; |
138 | regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 138 | regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; |
139 | 139 | ||
140 | // Userserver | 140 | // Userserver |
141 | regionprofile.regionUserURI = (string)reader["regionUserURI"]; | 141 | regionprofile.regionUserURI = (string)reader["regionUserURI"]; |
142 | regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 142 | regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; |
143 | regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; | 143 | regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | throw new Exception("No rows to return"); | 147 | throw new Exception("No rows to return"); |
148 | } | 148 | } |
149 | return regionprofile; | 149 | return regionprofile; |
150 | } | 150 | } |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// Creates a new region in the database | 153 | /// Creates a new region in the database |
154 | /// </summary> | 154 | /// </summary> |
155 | /// <param name="profile">The region profile to insert</param> | 155 | /// <param name="profile">The region profile to insert</param> |
156 | /// <returns>Successful?</returns> | 156 | /// <returns>Successful?</returns> |
157 | public bool insertRow(SimProfileData profile) | 157 | public bool insertRow(SimProfileData profile) |
158 | { | 158 | { |
159 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 159 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
160 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | 160 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; |
161 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | 161 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; |
162 | 162 | ||
163 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | 163 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; |
164 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | 164 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; |
165 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | 165 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; |
166 | 166 | ||
167 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 167 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
168 | 168 | ||
169 | parameters["regionHandle"] = profile.regionHandle.ToString(); | 169 | parameters["regionHandle"] = profile.regionHandle.ToString(); |
170 | parameters["regionName"] = profile.regionName; | 170 | parameters["regionName"] = profile.regionName; |
171 | parameters["uuid"] = profile.UUID.ToString(); | 171 | parameters["uuid"] = profile.UUID.ToString(); |
172 | parameters["regionRecvKey"] = profile.regionRecvKey; | 172 | parameters["regionRecvKey"] = profile.regionRecvKey; |
173 | parameters["regionSendKey"] = profile.regionSendKey; | 173 | parameters["regionSendKey"] = profile.regionSendKey; |
174 | parameters["regionDataURI"] = profile.regionDataURI; | 174 | parameters["regionDataURI"] = profile.regionDataURI; |
175 | parameters["serverIP"] = profile.serverIP; | 175 | parameters["serverIP"] = profile.serverIP; |
176 | parameters["serverPort"] = profile.serverPort.ToString(); | 176 | parameters["serverPort"] = profile.serverPort.ToString(); |
177 | parameters["serverURI"] = profile.serverURI; | 177 | parameters["serverURI"] = profile.serverURI; |
178 | parameters["locX"] = profile.regionLocX.ToString(); | 178 | parameters["locX"] = profile.regionLocX.ToString(); |
179 | parameters["locY"] = profile.regionLocY.ToString(); | 179 | parameters["locY"] = profile.regionLocY.ToString(); |
180 | parameters["locZ"] = profile.regionLocZ.ToString(); | 180 | parameters["locZ"] = profile.regionLocZ.ToString(); |
181 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | 181 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); |
182 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | 182 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); |
183 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | 183 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); |
184 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | 184 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); |
185 | parameters["regionAssetURI"] = profile.regionAssetURI; | 185 | parameters["regionAssetURI"] = profile.regionAssetURI; |
186 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | 186 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; |
187 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | 187 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; |
188 | parameters["regionUserURI"] = profile.regionUserURI; | 188 | parameters["regionUserURI"] = profile.regionUserURI; |
189 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | 189 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; |
190 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | 190 | parameters["regionUserSendKey"] = profile.regionUserSendKey; |
191 | 191 | ||
192 | bool returnval = false; | 192 | bool returnval = false; |
193 | 193 | ||
194 | try | 194 | try |
195 | { | 195 | { |
196 | IDbCommand result = Query(sql, parameters); | 196 | IDbCommand result = Query(sql, parameters); |
197 | 197 | ||
198 | if (result.ExecuteNonQuery() == 1) | 198 | if (result.ExecuteNonQuery() == 1) |
199 | returnval = true; | 199 | returnval = true; |
200 | 200 | ||
201 | result.Dispose(); | 201 | result.Dispose(); |
202 | } | 202 | } |
203 | catch (Exception) | 203 | catch (Exception) |
204 | { | 204 | { |
205 | return false; | 205 | return false; |
206 | } | 206 | } |
207 | 207 | ||
208 | return returnval; | 208 | return returnval; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | } | 211 | } |
diff --git a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs index 066c739..eeac06c 100644 --- a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | // General Information about an assembly is controlled through the following | 3 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 4 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 5 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")] | 6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")] |
7 | [assembly: AssemblyDescription("")] | 7 | [assembly: AssemblyDescription("")] |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyConfiguration("")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyCompany("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] | 10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCopyright("Copyright © 2007")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyTrademark("")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCulture("")] |
14 | 14 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 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 | 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. | 17 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 18 | [assembly: ComVisible(false)] |
19 | 19 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] | 21 | [assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] |
22 | 22 | ||
23 | // Version information for an assembly consists of the following four values: | 23 | // Version information for an assembly consists of the following four values: |
24 | // | 24 | // |
25 | // Major Version | 25 | // Major Version |
26 | // Minor Version | 26 | // Minor Version |
27 | // Build Number | 27 | // Build Number |
28 | // Revision | 28 | // Revision |
29 | // | 29 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 30 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 31 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index ef643d2..09f5e83 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -1,287 +1,287 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Security.Cryptography; | 31 | using System.Security.Cryptography; |
32 | using System.Text; | 32 | using System.Text; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Data.MySQL | 35 | namespace OpenSim.Framework.Data.MySQL |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// A MySQL Interface for the Grid Server | 38 | /// A MySQL Interface for the Grid Server |
39 | /// </summary> | 39 | /// </summary> |
40 | public class MySQLGridData : IGridData | 40 | public class MySQLGridData : IGridData |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// MySQL Database Manager | 43 | /// MySQL Database Manager |
44 | /// </summary> | 44 | /// </summary> |
45 | private MySQLManager database; | 45 | private MySQLManager database; |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Initialises the Grid Interface | 48 | /// Initialises the Grid Interface |
49 | /// </summary> | 49 | /// </summary> |
50 | public void Initialise() | 50 | public void Initialise() |
51 | { | 51 | { |
52 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | 52 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); |
53 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | 53 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); |
54 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | 54 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); |
55 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | 55 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); |
56 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 56 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); |
57 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 57 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
58 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 58 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
59 | 59 | ||
60 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 60 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Shuts down the grid interface | 64 | /// Shuts down the grid interface |
65 | /// </summary> | 65 | /// </summary> |
66 | public void Close() | 66 | public void Close() |
67 | { | 67 | { |
68 | database.Close(); | 68 | database.Close(); |
69 | } | 69 | } |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Returns the plugin name | 72 | /// Returns the plugin name |
73 | /// </summary> | 73 | /// </summary> |
74 | /// <returns>Plugin name</returns> | 74 | /// <returns>Plugin name</returns> |
75 | public string getName() | 75 | public string getName() |
76 | { | 76 | { |
77 | return "MySql OpenGridData"; | 77 | return "MySql OpenGridData"; |
78 | } | 78 | } |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// Returns the plugin version | 81 | /// Returns the plugin version |
82 | /// </summary> | 82 | /// </summary> |
83 | /// <returns>Plugin version</returns> | 83 | /// <returns>Plugin version</returns> |
84 | public string getVersion() | 84 | public string getVersion() |
85 | { | 85 | { |
86 | return "0.1"; | 86 | return "0.1"; |
87 | } | 87 | } |
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// Returns all the specified region profiles within coordates -- coordinates are inclusive | 90 | /// Returns all the specified region profiles within coordates -- coordinates are inclusive |
91 | /// </summary> | 91 | /// </summary> |
92 | /// <param name="xmin">Minimum X coordinate</param> | 92 | /// <param name="xmin">Minimum X coordinate</param> |
93 | /// <param name="ymin">Minimum Y coordinate</param> | 93 | /// <param name="ymin">Minimum Y coordinate</param> |
94 | /// <param name="xmax">Maximum X coordinate</param> | 94 | /// <param name="xmax">Maximum X coordinate</param> |
95 | /// <param name="ymax">Maximum Y coordinate</param> | 95 | /// <param name="ymax">Maximum Y coordinate</param> |
96 | /// <returns></returns> | 96 | /// <returns></returns> |
97 | public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) | 97 | public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) |
98 | { | 98 | { |
99 | try | 99 | try |
100 | { | 100 | { |
101 | lock (database) | 101 | lock (database) |
102 | { | 102 | { |
103 | Dictionary<string, string> param = new Dictionary<string, string>(); | 103 | Dictionary<string, string> param = new Dictionary<string, string>(); |
104 | param["?xmin"] = xmin.ToString(); | 104 | param["?xmin"] = xmin.ToString(); |
105 | param["?ymin"] = ymin.ToString(); | 105 | param["?ymin"] = ymin.ToString(); |
106 | param["?xmax"] = xmax.ToString(); | 106 | param["?xmax"] = xmax.ToString(); |
107 | param["?ymax"] = ymax.ToString(); | 107 | param["?ymax"] = ymax.ToString(); |
108 | 108 | ||
109 | IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); | 109 | IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); |
110 | IDataReader reader = result.ExecuteReader(); | 110 | IDataReader reader = result.ExecuteReader(); |
111 | 111 | ||
112 | SimProfileData row; | 112 | SimProfileData row; |
113 | 113 | ||
114 | List<SimProfileData> rows = new List<SimProfileData>(); | 114 | List<SimProfileData> rows = new List<SimProfileData>(); |
115 | 115 | ||
116 | while ((row = database.readSimRow(reader)) != null) | 116 | while ((row = database.readSimRow(reader)) != null) |
117 | { | 117 | { |
118 | rows.Add(row); | 118 | rows.Add(row); |
119 | } | 119 | } |
120 | reader.Close(); | 120 | reader.Close(); |
121 | result.Dispose(); | 121 | result.Dispose(); |
122 | 122 | ||
123 | return rows.ToArray(); | 123 | return rows.ToArray(); |
124 | 124 | ||
125 | } | 125 | } |
126 | } | 126 | } |
127 | catch (Exception e) | 127 | catch (Exception e) |
128 | { | 128 | { |
129 | database.Reconnect(); | 129 | database.Reconnect(); |
130 | Console.WriteLine(e.ToString()); | 130 | Console.WriteLine(e.ToString()); |
131 | return null; | 131 | return null; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | /// <summary> | 135 | /// <summary> |
136 | /// Returns a sim profile from it's location | 136 | /// Returns a sim profile from it's location |
137 | /// </summary> | 137 | /// </summary> |
138 | /// <param name="handle">Region location handle</param> | 138 | /// <param name="handle">Region location handle</param> |
139 | /// <returns>Sim profile</returns> | 139 | /// <returns>Sim profile</returns> |
140 | public SimProfileData GetProfileByHandle(ulong handle) | 140 | public SimProfileData GetProfileByHandle(ulong handle) |
141 | { | 141 | { |
142 | try | 142 | try |
143 | { | 143 | { |
144 | lock (database) | 144 | lock (database) |
145 | { | 145 | { |
146 | Dictionary<string, string> param = new Dictionary<string, string>(); | 146 | Dictionary<string, string> param = new Dictionary<string, string>(); |
147 | param["?handle"] = handle.ToString(); | 147 | param["?handle"] = handle.ToString(); |
148 | 148 | ||
149 | IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); | 149 | IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); |
150 | IDataReader reader = result.ExecuteReader(); | 150 | IDataReader reader = result.ExecuteReader(); |
151 | 151 | ||
152 | SimProfileData row = database.readSimRow(reader); | 152 | SimProfileData row = database.readSimRow(reader); |
153 | reader.Close(); | 153 | reader.Close(); |
154 | result.Dispose(); | 154 | result.Dispose(); |
155 | 155 | ||
156 | return row; | 156 | return row; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | catch (Exception e) | 159 | catch (Exception e) |
160 | { | 160 | { |
161 | database.Reconnect(); | 161 | database.Reconnect(); |
162 | Console.WriteLine(e.ToString()); | 162 | Console.WriteLine(e.ToString()); |
163 | return null; | 163 | return null; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | /// <summary> | 167 | /// <summary> |
168 | /// Returns a sim profile from it's UUID | 168 | /// Returns a sim profile from it's UUID |
169 | /// </summary> | 169 | /// </summary> |
170 | /// <param name="uuid">The region UUID</param> | 170 | /// <param name="uuid">The region UUID</param> |
171 | /// <returns>The sim profile</returns> | 171 | /// <returns>The sim profile</returns> |
172 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | 172 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
173 | { | 173 | { |
174 | try | 174 | try |
175 | { | 175 | { |
176 | lock (database) | 176 | lock (database) |
177 | { | 177 | { |
178 | Dictionary<string, string> param = new Dictionary<string, string>(); | 178 | Dictionary<string, string> param = new Dictionary<string, string>(); |
179 | param["?uuid"] = uuid.ToStringHyphenated(); | 179 | param["?uuid"] = uuid.ToStringHyphenated(); |
180 | 180 | ||
181 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); | 181 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); |
182 | IDataReader reader = result.ExecuteReader(); | 182 | IDataReader reader = result.ExecuteReader(); |
183 | 183 | ||
184 | SimProfileData row = database.readSimRow(reader); | 184 | SimProfileData row = database.readSimRow(reader); |
185 | reader.Close(); | 185 | reader.Close(); |
186 | result.Dispose(); | 186 | result.Dispose(); |
187 | 187 | ||
188 | return row; | 188 | return row; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | catch (Exception e) | 191 | catch (Exception e) |
192 | { | 192 | { |
193 | database.Reconnect(); | 193 | database.Reconnect(); |
194 | Console.WriteLine(e.ToString()); | 194 | Console.WriteLine(e.ToString()); |
195 | return null; | 195 | return null; |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Adds a new profile to the database | 200 | /// Adds a new profile to the database |
201 | /// </summary> | 201 | /// </summary> |
202 | /// <param name="profile">The profile to add</param> | 202 | /// <param name="profile">The profile to add</param> |
203 | /// <returns>Successful?</returns> | 203 | /// <returns>Successful?</returns> |
204 | public DataResponse AddProfile(SimProfileData profile) | 204 | public DataResponse AddProfile(SimProfileData profile) |
205 | { | 205 | { |
206 | lock (database) | 206 | lock (database) |
207 | { | 207 | { |
208 | if (database.insertRegion(profile)) | 208 | if (database.insertRegion(profile)) |
209 | { | 209 | { |
210 | return DataResponse.RESPONSE_OK; | 210 | return DataResponse.RESPONSE_OK; |
211 | } | 211 | } |
212 | else | 212 | else |
213 | { | 213 | { |
214 | return DataResponse.RESPONSE_ERROR; | 214 | return DataResponse.RESPONSE_ERROR; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | /// <summary> | 219 | /// <summary> |
220 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | 220 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. |
221 | /// </summary> | 221 | /// </summary> |
222 | /// <param name="uuid">The UUID of the challenger</param> | 222 | /// <param name="uuid">The UUID of the challenger</param> |
223 | /// <param name="handle">The attempted regionHandle of the challenger</param> | 223 | /// <param name="handle">The attempted regionHandle of the challenger</param> |
224 | /// <param name="authkey">The secret</param> | 224 | /// <param name="authkey">The secret</param> |
225 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | 225 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> |
226 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) | 226 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) |
227 | { | 227 | { |
228 | bool throwHissyFit = false; // Should be true by 1.0 | 228 | bool throwHissyFit = false; // Should be true by 1.0 |
229 | 229 | ||
230 | if (throwHissyFit) | 230 | if (throwHissyFit) |
231 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | 231 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); |
232 | 232 | ||
233 | SimProfileData data = GetProfileByLLUUID(uuid); | 233 | SimProfileData data = GetProfileByLLUUID(uuid); |
234 | 234 | ||
235 | return (handle == data.regionHandle && authkey == data.regionSecret); | 235 | return (handle == data.regionHandle && authkey == data.regionSecret); |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | 239 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region |
240 | /// </summary> | 240 | /// </summary> |
241 | /// <remarks>This requires a security audit.</remarks> | 241 | /// <remarks>This requires a security audit.</remarks> |
242 | /// <param name="uuid"></param> | 242 | /// <param name="uuid"></param> |
243 | /// <param name="handle"></param> | 243 | /// <param name="handle"></param> |
244 | /// <param name="authhash"></param> | 244 | /// <param name="authhash"></param> |
245 | /// <param name="challenge"></param> | 245 | /// <param name="challenge"></param> |
246 | /// <returns></returns> | 246 | /// <returns></returns> |
247 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) | 247 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) |
248 | { | 248 | { |
249 | SHA512Managed HashProvider = new SHA512Managed(); | 249 | SHA512Managed HashProvider = new SHA512Managed(); |
250 | ASCIIEncoding TextProvider = new ASCIIEncoding(); | 250 | ASCIIEncoding TextProvider = new ASCIIEncoding(); |
251 | 251 | ||
252 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | 252 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); |
253 | byte[] hash = HashProvider.ComputeHash(stream); | 253 | byte[] hash = HashProvider.ComputeHash(stream); |
254 | 254 | ||
255 | return false; | 255 | return false; |
256 | } | 256 | } |
257 | 257 | ||
258 | public ReservationData GetReservationAtPoint(uint x, uint y) | 258 | public ReservationData GetReservationAtPoint(uint x, uint y) |
259 | { | 259 | { |
260 | try | 260 | try |
261 | { | 261 | { |
262 | lock (database) | 262 | lock (database) |
263 | { | 263 | { |
264 | Dictionary<string, string> param = new Dictionary<string, string>(); | 264 | Dictionary<string, string> param = new Dictionary<string, string>(); |
265 | param["?x"] = x.ToString(); | 265 | param["?x"] = x.ToString(); |
266 | param["?y"] = y.ToString(); | 266 | param["?y"] = y.ToString(); |
267 | IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); | 267 | IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); |
268 | IDataReader reader = result.ExecuteReader(); | 268 | IDataReader reader = result.ExecuteReader(); |
269 | 269 | ||
270 | ReservationData row = database.readReservationRow(reader); | 270 | ReservationData row = database.readReservationRow(reader); |
271 | reader.Close(); | 271 | reader.Close(); |
272 | result.Dispose(); | 272 | result.Dispose(); |
273 | 273 | ||
274 | return row; | 274 | return row; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | catch (Exception e) | 277 | catch (Exception e) |
278 | { | 278 | { |
279 | database.Reconnect(); | 279 | database.Reconnect(); |
280 | Console.WriteLine(e.ToString()); | 280 | Console.WriteLine(e.ToString()); |
281 | return null; | 281 | return null; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | 286 | ||
287 | } | 287 | } |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index 790759a..d32db1b 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -1,309 +1,309 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | 32 | ||
33 | namespace OpenSim.Framework.Data.MySQL | 33 | namespace OpenSim.Framework.Data.MySQL |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// A MySQL interface for the inventory server | 36 | /// A MySQL interface for the inventory server |
37 | /// </summary> | 37 | /// </summary> |
38 | class MySQLInventoryData : IInventoryData | 38 | class MySQLInventoryData : IInventoryData |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// The database manager | 41 | /// The database manager |
42 | /// </summary> | 42 | /// </summary> |
43 | public MySQLManager database; | 43 | public MySQLManager database; |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Loads and initialises this database plugin | 46 | /// Loads and initialises this database plugin |
47 | /// </summary> | 47 | /// </summary> |
48 | public void Initialise() | 48 | public void Initialise() |
49 | { | 49 | { |
50 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | 50 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); |
51 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | 51 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); |
52 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | 52 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); |
53 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | 53 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); |
54 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 54 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); |
55 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 55 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
56 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 56 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
57 | 57 | ||
58 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 58 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); |
59 | } | 59 | } |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// The name of this DB provider | 62 | /// The name of this DB provider |
63 | /// </summary> | 63 | /// </summary> |
64 | /// <returns>Name of DB provider</returns> | 64 | /// <returns>Name of DB provider</returns> |
65 | public string getName() | 65 | public string getName() |
66 | { | 66 | { |
67 | return "MySQL Inventory Data Interface"; | 67 | return "MySQL Inventory Data Interface"; |
68 | } | 68 | } |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Closes this DB provider | 71 | /// Closes this DB provider |
72 | /// </summary> | 72 | /// </summary> |
73 | public void Close() | 73 | public void Close() |
74 | { | 74 | { |
75 | // Do nothing. | 75 | // Do nothing. |
76 | } | 76 | } |
77 | 77 | ||
78 | /// <summary> | 78 | /// <summary> |
79 | /// Returns the version of this DB provider | 79 | /// Returns the version of this DB provider |
80 | /// </summary> | 80 | /// </summary> |
81 | /// <returns>A string containing the DB provider</returns> | 81 | /// <returns>A string containing the DB provider</returns> |
82 | public string getVersion() | 82 | public string getVersion() |
83 | { | 83 | { |
84 | return "0.1"; | 84 | return "0.1"; |
85 | } | 85 | } |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Returns a list of items in a specified folder | 88 | /// Returns a list of items in a specified folder |
89 | /// </summary> | 89 | /// </summary> |
90 | /// <param name="folderID">The folder to search</param> | 90 | /// <param name="folderID">The folder to search</param> |
91 | /// <returns>A list containing inventory items</returns> | 91 | /// <returns>A list containing inventory items</returns> |
92 | public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) | 92 | public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) |
93 | { | 93 | { |
94 | try | 94 | try |
95 | { | 95 | { |
96 | lock (database) | 96 | lock (database) |
97 | { | 97 | { |
98 | Dictionary<string, string> param = new Dictionary<string, string>(); | 98 | Dictionary<string, string> param = new Dictionary<string, string>(); |
99 | param["?uuid"] = folderID.ToStringHyphenated(); | 99 | param["?uuid"] = folderID.ToStringHyphenated(); |
100 | 100 | ||
101 | IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param); | 101 | IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param); |
102 | IDataReader reader = result.ExecuteReader(); | 102 | IDataReader reader = result.ExecuteReader(); |
103 | 103 | ||
104 | List<InventoryItemBase> items = database.readInventoryItems(reader); | 104 | List<InventoryItemBase> items = database.readInventoryItems(reader); |
105 | 105 | ||
106 | reader.Close(); | 106 | reader.Close(); |
107 | result.Dispose(); | 107 | result.Dispose(); |
108 | 108 | ||
109 | return items; | 109 | return items; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | catch (Exception e) | 112 | catch (Exception e) |
113 | { | 113 | { |
114 | database.Reconnect(); | 114 | database.Reconnect(); |
115 | Console.WriteLine(e.ToString()); | 115 | Console.WriteLine(e.ToString()); |
116 | return null; | 116 | return null; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Returns a list of the root folders within a users inventory | 121 | /// Returns a list of the root folders within a users inventory |
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="user">The user whos inventory is to be searched</param> | 123 | /// <param name="user">The user whos inventory is to be searched</param> |
124 | /// <returns>A list of folder objects</returns> | 124 | /// <returns>A list of folder objects</returns> |
125 | public List<InventoryFolderBase> getUserRootFolders(LLUUID user) | 125 | public List<InventoryFolderBase> getUserRootFolders(LLUUID user) |
126 | { | 126 | { |
127 | try | 127 | try |
128 | { | 128 | { |
129 | lock (database) | 129 | lock (database) |
130 | { | 130 | { |
131 | Dictionary<string, string> param = new Dictionary<string, string>(); | 131 | Dictionary<string, string> param = new Dictionary<string, string>(); |
132 | param["?uuid"] = user.ToStringHyphenated(); | 132 | param["?uuid"] = user.ToStringHyphenated(); |
133 | param["?zero"] = LLUUID.Zero.ToStringHyphenated(); | 133 | param["?zero"] = LLUUID.Zero.ToStringHyphenated(); |
134 | 134 | ||
135 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); | 135 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); |
136 | IDataReader reader = result.ExecuteReader(); | 136 | IDataReader reader = result.ExecuteReader(); |
137 | 137 | ||
138 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | 138 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); |
139 | 139 | ||
140 | reader.Close(); | 140 | reader.Close(); |
141 | result.Dispose(); | 141 | result.Dispose(); |
142 | 142 | ||
143 | return items; | 143 | return items; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | catch (Exception e) | 146 | catch (Exception e) |
147 | { | 147 | { |
148 | database.Reconnect(); | 148 | database.Reconnect(); |
149 | Console.WriteLine(e.ToString()); | 149 | Console.WriteLine(e.ToString()); |
150 | return null; | 150 | return null; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
155 | /// Returns a list of folders in a users inventory contained within the specified folder | 155 | /// Returns a list of folders in a users inventory contained within the specified folder |
156 | /// </summary> | 156 | /// </summary> |
157 | /// <param name="parentID">The folder to search</param> | 157 | /// <param name="parentID">The folder to search</param> |
158 | /// <returns>A list of inventory folders</returns> | 158 | /// <returns>A list of inventory folders</returns> |
159 | public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) | 159 | public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) |
160 | { | 160 | { |
161 | try | 161 | try |
162 | { | 162 | { |
163 | lock (database) | 163 | lock (database) |
164 | { | 164 | { |
165 | Dictionary<string, string> param = new Dictionary<string, string>(); | 165 | Dictionary<string, string> param = new Dictionary<string, string>(); |
166 | param["?uuid"] = parentID.ToStringHyphenated(); | 166 | param["?uuid"] = parentID.ToStringHyphenated(); |
167 | 167 | ||
168 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param); | 168 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param); |
169 | IDataReader reader = result.ExecuteReader(); | 169 | IDataReader reader = result.ExecuteReader(); |
170 | 170 | ||
171 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | 171 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); |
172 | 172 | ||
173 | reader.Close(); | 173 | reader.Close(); |
174 | result.Dispose(); | 174 | result.Dispose(); |
175 | 175 | ||
176 | return items; | 176 | return items; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | catch (Exception e) | 179 | catch (Exception e) |
180 | { | 180 | { |
181 | database.Reconnect(); | 181 | database.Reconnect(); |
182 | Console.WriteLine(e.ToString()); | 182 | Console.WriteLine(e.ToString()); |
183 | return null; | 183 | return null; |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | /// <summary> | 187 | /// <summary> |
188 | /// Returns a specified inventory item | 188 | /// Returns a specified inventory item |
189 | /// </summary> | 189 | /// </summary> |
190 | /// <param name="item">The item to return</param> | 190 | /// <param name="item">The item to return</param> |
191 | /// <returns>An inventory item</returns> | 191 | /// <returns>An inventory item</returns> |
192 | public InventoryItemBase getInventoryItem(LLUUID item) | 192 | public InventoryItemBase getInventoryItem(LLUUID item) |
193 | { | 193 | { |
194 | try | 194 | try |
195 | { | 195 | { |
196 | lock (database) | 196 | lock (database) |
197 | { | 197 | { |
198 | Dictionary<string, string> param = new Dictionary<string, string>(); | 198 | Dictionary<string, string> param = new Dictionary<string, string>(); |
199 | param["?uuid"] = item.ToStringHyphenated(); | 199 | param["?uuid"] = item.ToStringHyphenated(); |
200 | 200 | ||
201 | IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param); | 201 | IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param); |
202 | IDataReader reader = result.ExecuteReader(); | 202 | IDataReader reader = result.ExecuteReader(); |
203 | 203 | ||
204 | List<InventoryItemBase> items = database.readInventoryItems(reader); | 204 | List<InventoryItemBase> items = database.readInventoryItems(reader); |
205 | 205 | ||
206 | reader.Close(); | 206 | reader.Close(); |
207 | result.Dispose(); | 207 | result.Dispose(); |
208 | 208 | ||
209 | if (items.Count > 0) | 209 | if (items.Count > 0) |
210 | { | 210 | { |
211 | return items[0]; | 211 | return items[0]; |
212 | } | 212 | } |
213 | else | 213 | else |
214 | { | 214 | { |
215 | return null; | 215 | return null; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | } | 218 | } |
219 | catch (Exception e) | 219 | catch (Exception e) |
220 | { | 220 | { |
221 | database.Reconnect(); | 221 | database.Reconnect(); |
222 | Console.WriteLine(e.ToString()); | 222 | Console.WriteLine(e.ToString()); |
223 | return null; | 223 | return null; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | /// <summary> | 227 | /// <summary> |
228 | /// Returns a specified inventory folder | 228 | /// Returns a specified inventory folder |
229 | /// </summary> | 229 | /// </summary> |
230 | /// <param name="folder">The folder to return</param> | 230 | /// <param name="folder">The folder to return</param> |
231 | /// <returns>A folder class</returns> | 231 | /// <returns>A folder class</returns> |
232 | public InventoryFolderBase getInventoryFolder(LLUUID folder) | 232 | public InventoryFolderBase getInventoryFolder(LLUUID folder) |
233 | { | 233 | { |
234 | try | 234 | try |
235 | { | 235 | { |
236 | lock (database) | 236 | lock (database) |
237 | { | 237 | { |
238 | Dictionary<string, string> param = new Dictionary<string, string>(); | 238 | Dictionary<string, string> param = new Dictionary<string, string>(); |
239 | param["?uuid"] = folder.ToStringHyphenated(); | 239 | param["?uuid"] = folder.ToStringHyphenated(); |
240 | 240 | ||
241 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param); | 241 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param); |
242 | IDataReader reader = result.ExecuteReader(); | 242 | IDataReader reader = result.ExecuteReader(); |
243 | 243 | ||
244 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | 244 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); |
245 | 245 | ||
246 | reader.Close(); | 246 | reader.Close(); |
247 | result.Dispose(); | 247 | result.Dispose(); |
248 | 248 | ||
249 | if (items.Count > 0) | 249 | if (items.Count > 0) |
250 | { | 250 | { |
251 | return items[0]; | 251 | return items[0]; |
252 | } | 252 | } |
253 | else | 253 | else |
254 | { | 254 | { |
255 | return null; | 255 | return null; |
256 | } | 256 | } |
257 | } | 257 | } |
258 | } | 258 | } |
259 | catch (Exception e) | 259 | catch (Exception e) |
260 | { | 260 | { |
261 | database.Reconnect(); | 261 | database.Reconnect(); |
262 | Console.WriteLine(e.ToString()); | 262 | Console.WriteLine(e.ToString()); |
263 | return null; | 263 | return null; |
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | /// <summary> | 267 | /// <summary> |
268 | /// Adds a specified item to the database | 268 | /// Adds a specified item to the database |
269 | /// </summary> | 269 | /// </summary> |
270 | /// <param name="item">The inventory item</param> | 270 | /// <param name="item">The inventory item</param> |
271 | public void addInventoryItem(InventoryItemBase item) | 271 | public void addInventoryItem(InventoryItemBase item) |
272 | { | 272 | { |
273 | lock (database) | 273 | lock (database) |
274 | { | 274 | { |
275 | database.insertItem(item); | 275 | database.insertItem(item); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | /// <summary> | 279 | /// <summary> |
280 | /// Updates the specified inventory item | 280 | /// Updates the specified inventory item |
281 | /// </summary> | 281 | /// </summary> |
282 | /// <param name="item">Inventory item to update</param> | 282 | /// <param name="item">Inventory item to update</param> |
283 | public void updateInventoryItem(InventoryItemBase item) | 283 | public void updateInventoryItem(InventoryItemBase item) |
284 | { | 284 | { |
285 | addInventoryItem(item); | 285 | addInventoryItem(item); |
286 | } | 286 | } |
287 | 287 | ||
288 | /// <summary> | 288 | /// <summary> |
289 | /// Creates a new inventory folder | 289 | /// Creates a new inventory folder |
290 | /// </summary> | 290 | /// </summary> |
291 | /// <param name="folder">Folder to create</param> | 291 | /// <param name="folder">Folder to create</param> |
292 | public void addInventoryFolder(InventoryFolderBase folder) | 292 | public void addInventoryFolder(InventoryFolderBase folder) |
293 | { | 293 | { |
294 | lock (database) | 294 | lock (database) |
295 | { | 295 | { |
296 | database.insertFolder(folder); | 296 | database.insertFolder(folder); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | 299 | ||
300 | /// <summary> | 300 | /// <summary> |
301 | /// Updates an inventory folder | 301 | /// Updates an inventory folder |
302 | /// </summary> | 302 | /// </summary> |
303 | /// <param name="folder">Folder to update</param> | 303 | /// <param name="folder">Folder to update</param> |
304 | public void updateInventoryFolder(InventoryFolderBase folder) | 304 | public void updateInventoryFolder(InventoryFolderBase folder) |
305 | { | 305 | { |
306 | addInventoryFolder(folder); | 306 | addInventoryFolder(folder); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | } | 309 | } |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs index 38f9fd3..2ba9c3d 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs | |||
@@ -1,105 +1,105 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | 29 | ||
30 | namespace OpenSim.Framework.Data.MySQL | 30 | namespace OpenSim.Framework.Data.MySQL |
31 | { | 31 | { |
32 | /// <summary> | 32 | /// <summary> |
33 | /// An interface to the log database for MySQL | 33 | /// An interface to the log database for MySQL |
34 | /// </summary> | 34 | /// </summary> |
35 | class MySQLLogData : ILogData | 35 | class MySQLLogData : ILogData |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// The database manager | 38 | /// The database manager |
39 | /// </summary> | 39 | /// </summary> |
40 | public MySQLManager database; | 40 | public MySQLManager database; |
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Artificial constructor called when the plugin is loaded | 43 | /// Artificial constructor called when the plugin is loaded |
44 | /// </summary> | 44 | /// </summary> |
45 | public void Initialise() | 45 | public void Initialise() |
46 | { | 46 | { |
47 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | 47 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); |
48 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | 48 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); |
49 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | 49 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); |
50 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | 50 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); |
51 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 51 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); |
52 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 52 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
53 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 53 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
54 | 54 | ||
55 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 55 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); |
56 | } | 56 | } |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Saves a log item to the database | 59 | /// Saves a log item to the database |
60 | /// </summary> | 60 | /// </summary> |
61 | /// <param name="serverDaemon">The daemon triggering the event</param> | 61 | /// <param name="serverDaemon">The daemon triggering the event</param> |
62 | /// <param name="target">The target of the action (region / agent UUID, etc)</param> | 62 | /// <param name="target">The target of the action (region / agent UUID, etc)</param> |
63 | /// <param name="methodCall">The method call where the problem occured</param> | 63 | /// <param name="methodCall">The method call where the problem occured</param> |
64 | /// <param name="arguments">The arguments passed to the method</param> | 64 | /// <param name="arguments">The arguments passed to the method</param> |
65 | /// <param name="priority">How critical is this?</param> | 65 | /// <param name="priority">How critical is this?</param> |
66 | /// <param name="logMessage">The message to log</param> | 66 | /// <param name="logMessage">The message to log</param> |
67 | public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | 67 | public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) |
68 | { | 68 | { |
69 | try | 69 | try |
70 | { | 70 | { |
71 | database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage); | 71 | database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage); |
72 | } | 72 | } |
73 | catch | 73 | catch |
74 | { | 74 | { |
75 | database.Reconnect(); | 75 | database.Reconnect(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | /// <summary> | 79 | /// <summary> |
80 | /// Returns the name of this DB provider | 80 | /// Returns the name of this DB provider |
81 | /// </summary> | 81 | /// </summary> |
82 | /// <returns>A string containing the DB provider name</returns> | 82 | /// <returns>A string containing the DB provider name</returns> |
83 | public string getName() | 83 | public string getName() |
84 | { | 84 | { |
85 | return "MySQL Logdata Interface"; | 85 | return "MySQL Logdata Interface"; |
86 | } | 86 | } |
87 | 87 | ||
88 | /// <summary> | 88 | /// <summary> |
89 | /// Closes the database provider | 89 | /// Closes the database provider |
90 | /// </summary> | 90 | /// </summary> |
91 | public void Close() | 91 | public void Close() |
92 | { | 92 | { |
93 | // Do nothing. | 93 | // Do nothing. |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Returns the version of this DB provider | 97 | /// Returns the version of this DB provider |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <returns>A string containing the provider version</returns> | 99 | /// <returns>A string containing the provider version</returns> |
100 | public string getVersion() | 100 | public string getVersion() |
101 | { | 101 | { |
102 | return "0.1"; | 102 | return "0.1"; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index ab7f277..a5434c8 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs | |||
@@ -1,606 +1,606 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using MySql.Data.MySqlClient; | 32 | using MySql.Data.MySqlClient; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Data.MySQL | 34 | namespace OpenSim.Framework.Data.MySQL |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// A MySQL Database manager | 37 | /// A MySQL Database manager |
38 | /// </summary> | 38 | /// </summary> |
39 | class MySQLManager | 39 | class MySQLManager |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// The database connection object | 42 | /// The database connection object |
43 | /// </summary> | 43 | /// </summary> |
44 | IDbConnection dbcon; | 44 | IDbConnection dbcon; |
45 | /// <summary> | 45 | /// <summary> |
46 | /// Connection string for ADO.net | 46 | /// Connection string for ADO.net |
47 | /// </summary> | 47 | /// </summary> |
48 | string connectionString; | 48 | string connectionString; |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Initialises and creates a new MySQL connection and maintains it. | 51 | /// Initialises and creates a new MySQL connection and maintains it. |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="hostname">The MySQL server being connected to</param> | 53 | /// <param name="hostname">The MySQL server being connected to</param> |
54 | /// <param name="database">The name of the MySQL database being used</param> | 54 | /// <param name="database">The name of the MySQL database being used</param> |
55 | /// <param name="username">The username logging into the database</param> | 55 | /// <param name="username">The username logging into the database</param> |
56 | /// <param name="password">The password for the user logging in</param> | 56 | /// <param name="password">The password for the user logging in</param> |
57 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | 57 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> |
58 | public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) | 58 | public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) |
59 | { | 59 | { |
60 | try | 60 | try |
61 | { | 61 | { |
62 | connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | 62 | connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; |
63 | dbcon = new MySqlConnection(connectionString); | 63 | dbcon = new MySqlConnection(connectionString); |
64 | 64 | ||
65 | dbcon.Open(); | 65 | dbcon.Open(); |
66 | 66 | ||
67 | Console.WriteLine("MySQL connection established"); | 67 | Console.WriteLine("MySQL connection established"); |
68 | } | 68 | } |
69 | catch (Exception e) | 69 | catch (Exception e) |
70 | { | 70 | { |
71 | throw new Exception("Error initialising MySql Database: " + e.ToString()); | 71 | throw new Exception("Error initialising MySql Database: " + e.ToString()); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// Shuts down the database connection | 76 | /// Shuts down the database connection |
77 | /// </summary> | 77 | /// </summary> |
78 | public void Close() | 78 | public void Close() |
79 | { | 79 | { |
80 | dbcon.Close(); | 80 | dbcon.Close(); |
81 | dbcon = null; | 81 | dbcon = null; |
82 | } | 82 | } |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Reconnects to the database | 85 | /// Reconnects to the database |
86 | /// </summary> | 86 | /// </summary> |
87 | public void Reconnect() | 87 | public void Reconnect() |
88 | { | 88 | { |
89 | lock (dbcon) | 89 | lock (dbcon) |
90 | { | 90 | { |
91 | try | 91 | try |
92 | { | 92 | { |
93 | // Close the DB connection | 93 | // Close the DB connection |
94 | dbcon.Close(); | 94 | dbcon.Close(); |
95 | // Try reopen it | 95 | // Try reopen it |
96 | dbcon = new MySqlConnection(connectionString); | 96 | dbcon = new MySqlConnection(connectionString); |
97 | dbcon.Open(); | 97 | dbcon.Open(); |
98 | } | 98 | } |
99 | catch (Exception e) | 99 | catch (Exception e) |
100 | { | 100 | { |
101 | Console.WriteLine("Unable to reconnect to database " + e.ToString()); | 101 | Console.WriteLine("Unable to reconnect to database " + e.ToString()); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | /// <summary> | 106 | /// <summary> |
107 | /// Runs a query with protection against SQL Injection by using parameterised input. | 107 | /// Runs a query with protection against SQL Injection by using parameterised input. |
108 | /// </summary> | 108 | /// </summary> |
109 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | 109 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> |
110 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | 110 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> |
111 | /// <returns>A MySQL DB Command</returns> | 111 | /// <returns>A MySQL DB Command</returns> |
112 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 112 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) |
113 | { | 113 | { |
114 | try | 114 | try |
115 | { | 115 | { |
116 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | 116 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); |
117 | dbcommand.CommandText = sql; | 117 | dbcommand.CommandText = sql; |
118 | foreach (KeyValuePair<string, string> param in parameters) | 118 | foreach (KeyValuePair<string, string> param in parameters) |
119 | { | 119 | { |
120 | dbcommand.Parameters.Add(param.Key, param.Value); | 120 | dbcommand.Parameters.Add(param.Key, param.Value); |
121 | } | 121 | } |
122 | 122 | ||
123 | return (IDbCommand)dbcommand; | 123 | return (IDbCommand)dbcommand; |
124 | } | 124 | } |
125 | catch | 125 | catch |
126 | { | 126 | { |
127 | lock (dbcon) | 127 | lock (dbcon) |
128 | { | 128 | { |
129 | // Close the DB connection | 129 | // Close the DB connection |
130 | try | 130 | try |
131 | { | 131 | { |
132 | dbcon.Close(); | 132 | dbcon.Close(); |
133 | } | 133 | } |
134 | catch { } | 134 | catch { } |
135 | 135 | ||
136 | // Try reopen it | 136 | // Try reopen it |
137 | try | 137 | try |
138 | { | 138 | { |
139 | dbcon = new MySqlConnection(connectionString); | 139 | dbcon = new MySqlConnection(connectionString); |
140 | dbcon.Open(); | 140 | dbcon.Open(); |
141 | } | 141 | } |
142 | catch (Exception e) | 142 | catch (Exception e) |
143 | { | 143 | { |
144 | Console.WriteLine("Unable to reconnect to database " + e.ToString()); | 144 | Console.WriteLine("Unable to reconnect to database " + e.ToString()); |
145 | } | 145 | } |
146 | 146 | ||
147 | // Run the query again | 147 | // Run the query again |
148 | try | 148 | try |
149 | { | 149 | { |
150 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | 150 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); |
151 | dbcommand.CommandText = sql; | 151 | dbcommand.CommandText = sql; |
152 | foreach (KeyValuePair<string, string> param in parameters) | 152 | foreach (KeyValuePair<string, string> param in parameters) |
153 | { | 153 | { |
154 | dbcommand.Parameters.Add(param.Key, param.Value); | 154 | dbcommand.Parameters.Add(param.Key, param.Value); |
155 | } | 155 | } |
156 | 156 | ||
157 | return (IDbCommand)dbcommand; | 157 | return (IDbCommand)dbcommand; |
158 | } | 158 | } |
159 | catch (Exception e) | 159 | catch (Exception e) |
160 | { | 160 | { |
161 | // Return null if it fails. | 161 | // Return null if it fails. |
162 | Console.WriteLine("Failed during Query generation: " + e.ToString()); | 162 | Console.WriteLine("Failed during Query generation: " + e.ToString()); |
163 | return null; | 163 | return null; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | /// <summary> | 169 | /// <summary> |
170 | /// Reads a region row from a database reader | 170 | /// Reads a region row from a database reader |
171 | /// </summary> | 171 | /// </summary> |
172 | /// <param name="reader">An active database reader</param> | 172 | /// <param name="reader">An active database reader</param> |
173 | /// <returns>A region profile</returns> | 173 | /// <returns>A region profile</returns> |
174 | public SimProfileData readSimRow(IDataReader reader) | 174 | public SimProfileData readSimRow(IDataReader reader) |
175 | { | 175 | { |
176 | SimProfileData retval = new SimProfileData(); | 176 | SimProfileData retval = new SimProfileData(); |
177 | 177 | ||
178 | if (reader.Read()) | 178 | if (reader.Read()) |
179 | { | 179 | { |
180 | // Region Main | 180 | // Region Main |
181 | retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); | 181 | retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); |
182 | retval.regionName = (string)reader["regionName"]; | 182 | retval.regionName = (string)reader["regionName"]; |
183 | retval.UUID = new LLUUID((string)reader["uuid"]); | 183 | retval.UUID = new LLUUID((string)reader["uuid"]); |
184 | 184 | ||
185 | // Secrets | 185 | // Secrets |
186 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | 186 | retval.regionRecvKey = (string)reader["regionRecvKey"]; |
187 | retval.regionSecret = (string)reader["regionSecret"]; | 187 | retval.regionSecret = (string)reader["regionSecret"]; |
188 | retval.regionSendKey = (string)reader["regionSendKey"]; | 188 | retval.regionSendKey = (string)reader["regionSendKey"]; |
189 | 189 | ||
190 | // Region Server | 190 | // Region Server |
191 | retval.regionDataURI = (string)reader["regionDataURI"]; | 191 | retval.regionDataURI = (string)reader["regionDataURI"]; |
192 | retval.regionOnline = false; // Needs to be pinged before this can be set. | 192 | retval.regionOnline = false; // Needs to be pinged before this can be set. |
193 | retval.serverIP = (string)reader["serverIP"]; | 193 | retval.serverIP = (string)reader["serverIP"]; |
194 | retval.serverPort = (uint)reader["serverPort"]; | 194 | retval.serverPort = (uint)reader["serverPort"]; |
195 | retval.serverURI = (string)reader["serverURI"]; | 195 | retval.serverURI = (string)reader["serverURI"]; |
196 | retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); | 196 | retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); |
197 | retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); | 197 | retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); |
198 | 198 | ||
199 | // Location | 199 | // Location |
200 | retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString()); | 200 | retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString()); |
201 | retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString()); | 201 | retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString()); |
202 | retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString()); | 202 | retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString()); |
203 | 203 | ||
204 | // Neighbours - 0 = No Override | 204 | // Neighbours - 0 = No Override |
205 | retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString()); | 205 | retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString()); |
206 | retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString()); | 206 | retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString()); |
207 | retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString()); | 207 | retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString()); |
208 | retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); | 208 | retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); |
209 | 209 | ||
210 | // Assets | 210 | // Assets |
211 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | 211 | retval.regionAssetURI = (string)reader["regionAssetURI"]; |
212 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 212 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; |
213 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 213 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; |
214 | 214 | ||
215 | // Userserver | 215 | // Userserver |
216 | retval.regionUserURI = (string)reader["regionUserURI"]; | 216 | retval.regionUserURI = (string)reader["regionUserURI"]; |
217 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 217 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; |
218 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | 218 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; |
219 | 219 | ||
220 | // World Map Addition | 220 | // World Map Addition |
221 | string tempRegionMap = reader["regionMapTexture"].ToString(); | 221 | string tempRegionMap = reader["regionMapTexture"].ToString(); |
222 | if (tempRegionMap != "") | 222 | if (tempRegionMap != "") |
223 | { | 223 | { |
224 | retval.regionMapTextureID = new LLUUID(tempRegionMap); | 224 | retval.regionMapTextureID = new LLUUID(tempRegionMap); |
225 | } | 225 | } |
226 | else | 226 | else |
227 | { | 227 | { |
228 | retval.regionMapTextureID = new LLUUID(); | 228 | retval.regionMapTextureID = new LLUUID(); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | else | 231 | else |
232 | { | 232 | { |
233 | return null; | 233 | return null; |
234 | } | 234 | } |
235 | return retval; | 235 | return retval; |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// Reads a reservation row from a database reader | 239 | /// Reads a reservation row from a database reader |
240 | /// </summary> | 240 | /// </summary> |
241 | /// <param name="reader">An active database reader</param> | 241 | /// <param name="reader">An active database reader</param> |
242 | /// <returns>A reservation data object</returns> | 242 | /// <returns>A reservation data object</returns> |
243 | public ReservationData readReservationRow(IDataReader reader) | 243 | public ReservationData readReservationRow(IDataReader reader) |
244 | { | 244 | { |
245 | ReservationData retval = new ReservationData(); | 245 | ReservationData retval = new ReservationData(); |
246 | if (reader.Read()) | 246 | if (reader.Read()) |
247 | { | 247 | { |
248 | retval.gridRecvKey = (string)reader["gridRecvKey"]; | 248 | retval.gridRecvKey = (string)reader["gridRecvKey"]; |
249 | retval.gridSendKey = (string)reader["gridSendKey"]; | 249 | retval.gridSendKey = (string)reader["gridSendKey"]; |
250 | retval.reservationCompany = (string)reader["resCompany"]; | 250 | retval.reservationCompany = (string)reader["resCompany"]; |
251 | retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); | 251 | retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); |
252 | retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); | 252 | retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); |
253 | retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); | 253 | retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); |
254 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); | 254 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); |
255 | retval.reservationName = (string)reader["resName"]; | 255 | retval.reservationName = (string)reader["resName"]; |
256 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; | 256 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; |
257 | retval.userUUID = new LLUUID((string)reader["userUUID"]); | 257 | retval.userUUID = new LLUUID((string)reader["userUUID"]); |
258 | 258 | ||
259 | } | 259 | } |
260 | else | 260 | else |
261 | { | 261 | { |
262 | return null; | 262 | return null; |
263 | } | 263 | } |
264 | return retval; | 264 | return retval; |
265 | } | 265 | } |
266 | /// <summary> | 266 | /// <summary> |
267 | /// Reads an agent row from a database reader | 267 | /// Reads an agent row from a database reader |
268 | /// </summary> | 268 | /// </summary> |
269 | /// <param name="reader">An active database reader</param> | 269 | /// <param name="reader">An active database reader</param> |
270 | /// <returns>A user session agent</returns> | 270 | /// <returns>A user session agent</returns> |
271 | public UserAgentData readAgentRow(IDataReader reader) | 271 | public UserAgentData readAgentRow(IDataReader reader) |
272 | { | 272 | { |
273 | UserAgentData retval = new UserAgentData(); | 273 | UserAgentData retval = new UserAgentData(); |
274 | 274 | ||
275 | if (reader.Read()) | 275 | if (reader.Read()) |
276 | { | 276 | { |
277 | // Agent IDs | 277 | // Agent IDs |
278 | retval.UUID = new LLUUID((string)reader["UUID"]); | 278 | retval.UUID = new LLUUID((string)reader["UUID"]); |
279 | retval.sessionID = new LLUUID((string)reader["sessionID"]); | 279 | retval.sessionID = new LLUUID((string)reader["sessionID"]); |
280 | retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); | 280 | retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); |
281 | 281 | ||
282 | // Agent Who? | 282 | // Agent Who? |
283 | retval.agentIP = (string)reader["agentIP"]; | 283 | retval.agentIP = (string)reader["agentIP"]; |
284 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); | 284 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); |
285 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); | 285 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); |
286 | 286 | ||
287 | // Login/Logout times (UNIX Epoch) | 287 | // Login/Logout times (UNIX Epoch) |
288 | retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString()); | 288 | retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString()); |
289 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); | 289 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); |
290 | 290 | ||
291 | // Current position | 291 | // Current position |
292 | retval.currentRegion = (string)reader["currentRegion"]; | 292 | retval.currentRegion = (string)reader["currentRegion"]; |
293 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); | 293 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); |
294 | LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); | 294 | LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); |
295 | } | 295 | } |
296 | else | 296 | else |
297 | { | 297 | { |
298 | return null; | 298 | return null; |
299 | } | 299 | } |
300 | return retval; | 300 | return retval; |
301 | } | 301 | } |
302 | 302 | ||
303 | /// <summary> | 303 | /// <summary> |
304 | /// Reads a user profile from an active data reader | 304 | /// Reads a user profile from an active data reader |
305 | /// </summary> | 305 | /// </summary> |
306 | /// <param name="reader">An active database reader</param> | 306 | /// <param name="reader">An active database reader</param> |
307 | /// <returns>A user profile</returns> | 307 | /// <returns>A user profile</returns> |
308 | public UserProfileData readUserRow(IDataReader reader) | 308 | public UserProfileData readUserRow(IDataReader reader) |
309 | { | 309 | { |
310 | UserProfileData retval = new UserProfileData(); | 310 | UserProfileData retval = new UserProfileData(); |
311 | 311 | ||
312 | if (reader.Read()) | 312 | if (reader.Read()) |
313 | { | 313 | { |
314 | retval.UUID = new LLUUID((string)reader["UUID"]); | 314 | retval.UUID = new LLUUID((string)reader["UUID"]); |
315 | retval.username = (string)reader["username"]; | 315 | retval.username = (string)reader["username"]; |
316 | retval.surname = (string)reader["lastname"]; | 316 | retval.surname = (string)reader["lastname"]; |
317 | 317 | ||
318 | retval.passwordHash = (string)reader["passwordHash"]; | 318 | retval.passwordHash = (string)reader["passwordHash"]; |
319 | retval.passwordSalt = (string)reader["passwordSalt"]; | 319 | retval.passwordSalt = (string)reader["passwordSalt"]; |
320 | 320 | ||
321 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); | 321 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); |
322 | retval.homeLocation = new LLVector3( | 322 | retval.homeLocation = new LLVector3( |
323 | Convert.ToSingle(reader["homeLocationX"].ToString()), | 323 | Convert.ToSingle(reader["homeLocationX"].ToString()), |
324 | Convert.ToSingle(reader["homeLocationY"].ToString()), | 324 | Convert.ToSingle(reader["homeLocationY"].ToString()), |
325 | Convert.ToSingle(reader["homeLocationZ"].ToString())); | 325 | Convert.ToSingle(reader["homeLocationZ"].ToString())); |
326 | retval.homeLookAt = new LLVector3( | 326 | retval.homeLookAt = new LLVector3( |
327 | Convert.ToSingle(reader["homeLookAtX"].ToString()), | 327 | Convert.ToSingle(reader["homeLookAtX"].ToString()), |
328 | Convert.ToSingle(reader["homeLookAtY"].ToString()), | 328 | Convert.ToSingle(reader["homeLookAtY"].ToString()), |
329 | Convert.ToSingle(reader["homeLookAtZ"].ToString())); | 329 | Convert.ToSingle(reader["homeLookAtZ"].ToString())); |
330 | 330 | ||
331 | retval.created = Convert.ToInt32(reader["created"].ToString()); | 331 | retval.created = Convert.ToInt32(reader["created"].ToString()); |
332 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); | 332 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); |
333 | 333 | ||
334 | retval.userInventoryURI = (string)reader["userInventoryURI"]; | 334 | retval.userInventoryURI = (string)reader["userInventoryURI"]; |
335 | retval.userAssetURI = (string)reader["userAssetURI"]; | 335 | retval.userAssetURI = (string)reader["userAssetURI"]; |
336 | 336 | ||
337 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); | 337 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); |
338 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); | 338 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); |
339 | 339 | ||
340 | retval.profileAboutText = (string)reader["profileAboutText"]; | 340 | retval.profileAboutText = (string)reader["profileAboutText"]; |
341 | retval.profileFirstText = (string)reader["profileFirstText"]; | 341 | retval.profileFirstText = (string)reader["profileFirstText"]; |
342 | 342 | ||
343 | retval.profileImage = new LLUUID((string)reader["profileImage"]); | 343 | retval.profileImage = new LLUUID((string)reader["profileImage"]); |
344 | retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); | 344 | retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); |
345 | 345 | ||
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
349 | return null; | 349 | return null; |
350 | } | 350 | } |
351 | return retval; | 351 | return retval; |
352 | } | 352 | } |
353 | 353 | ||
354 | /// <summary> | 354 | /// <summary> |
355 | /// Reads a list of inventory folders returned by a query. | 355 | /// Reads a list of inventory folders returned by a query. |
356 | /// </summary> | 356 | /// </summary> |
357 | /// <param name="reader">A MySQL Data Reader</param> | 357 | /// <param name="reader">A MySQL Data Reader</param> |
358 | /// <returns>A List containing inventory folders</returns> | 358 | /// <returns>A List containing inventory folders</returns> |
359 | public List<InventoryFolderBase> readInventoryFolders(IDataReader reader) | 359 | public List<InventoryFolderBase> readInventoryFolders(IDataReader reader) |
360 | { | 360 | { |
361 | List<InventoryFolderBase> rows = new List<InventoryFolderBase>(); | 361 | List<InventoryFolderBase> rows = new List<InventoryFolderBase>(); |
362 | 362 | ||
363 | while(reader.Read()) | 363 | while(reader.Read()) |
364 | { | 364 | { |
365 | try | 365 | try |
366 | { | 366 | { |
367 | InventoryFolderBase folder = new InventoryFolderBase(); | 367 | InventoryFolderBase folder = new InventoryFolderBase(); |
368 | 368 | ||
369 | folder.agentID = new LLUUID((string)reader["agentID"]); | 369 | folder.agentID = new LLUUID((string)reader["agentID"]); |
370 | folder.parentID = new LLUUID((string)reader["parentFolderID"]); | 370 | folder.parentID = new LLUUID((string)reader["parentFolderID"]); |
371 | folder.folderID = new LLUUID((string)reader["folderID"]); | 371 | folder.folderID = new LLUUID((string)reader["folderID"]); |
372 | folder.name = (string)reader["folderName"]; | 372 | folder.name = (string)reader["folderName"]; |
373 | 373 | ||
374 | rows.Add(folder); | 374 | rows.Add(folder); |
375 | } | 375 | } |
376 | catch (Exception e) | 376 | catch (Exception e) |
377 | { | 377 | { |
378 | Console.WriteLine(e.ToString()); | 378 | Console.WriteLine(e.ToString()); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | return rows; | 382 | return rows; |
383 | } | 383 | } |
384 | 384 | ||
385 | /// <summary> | 385 | /// <summary> |
386 | /// Reads a collection of items from an SQL result | 386 | /// Reads a collection of items from an SQL result |
387 | /// </summary> | 387 | /// </summary> |
388 | /// <param name="reader">The SQL Result</param> | 388 | /// <param name="reader">The SQL Result</param> |
389 | /// <returns>A List containing Inventory Items</returns> | 389 | /// <returns>A List containing Inventory Items</returns> |
390 | public List<InventoryItemBase> readInventoryItems(IDataReader reader) | 390 | public List<InventoryItemBase> readInventoryItems(IDataReader reader) |
391 | { | 391 | { |
392 | List<InventoryItemBase> rows = new List<InventoryItemBase>(); | 392 | List<InventoryItemBase> rows = new List<InventoryItemBase>(); |
393 | 393 | ||
394 | while (reader.Read()) | 394 | while (reader.Read()) |
395 | { | 395 | { |
396 | try | 396 | try |
397 | { | 397 | { |
398 | InventoryItemBase item = new InventoryItemBase(); | 398 | InventoryItemBase item = new InventoryItemBase(); |
399 | 399 | ||
400 | item.assetID = new LLUUID((string)reader["assetID"]); | 400 | item.assetID = new LLUUID((string)reader["assetID"]); |
401 | item.avatarID = new LLUUID((string)reader["avatarID"]); | 401 | item.avatarID = new LLUUID((string)reader["avatarID"]); |
402 | item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString()); | 402 | item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString()); |
403 | item.inventoryDescription = (string)reader["inventoryDescription"]; | 403 | item.inventoryDescription = (string)reader["inventoryDescription"]; |
404 | item.inventoryID = new LLUUID((string)reader["inventoryID"]); | 404 | item.inventoryID = new LLUUID((string)reader["inventoryID"]); |
405 | item.inventoryName = (string)reader["inventoryName"]; | 405 | item.inventoryName = (string)reader["inventoryName"]; |
406 | item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString()); | 406 | item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString()); |
407 | item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); | 407 | item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); |
408 | item.type = Convert.ToInt32(reader["type"].ToString()); | 408 | item.type = Convert.ToInt32(reader["type"].ToString()); |
409 | 409 | ||
410 | rows.Add(item); | 410 | rows.Add(item); |
411 | } | 411 | } |
412 | catch (Exception e) | 412 | catch (Exception e) |
413 | { | 413 | { |
414 | Console.WriteLine(e.ToString()); | 414 | Console.WriteLine(e.ToString()); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | return rows; | 418 | return rows; |
419 | } | 419 | } |
420 | 420 | ||
421 | /// <summary> | 421 | /// <summary> |
422 | /// Inserts a new row into the log database | 422 | /// Inserts a new row into the log database |
423 | /// </summary> | 423 | /// </summary> |
424 | /// <param name="serverDaemon">The daemon which triggered this event</param> | 424 | /// <param name="serverDaemon">The daemon which triggered this event</param> |
425 | /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param> | 425 | /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param> |
426 | /// <param name="methodCall">The method call where the problem occured</param> | 426 | /// <param name="methodCall">The method call where the problem occured</param> |
427 | /// <param name="arguments">The arguments passed to the method</param> | 427 | /// <param name="arguments">The arguments passed to the method</param> |
428 | /// <param name="priority">How critical is this?</param> | 428 | /// <param name="priority">How critical is this?</param> |
429 | /// <param name="logMessage">Extra message info</param> | 429 | /// <param name="logMessage">Extra message info</param> |
430 | /// <returns>Saved successfully?</returns> | 430 | /// <returns>Saved successfully?</returns> |
431 | public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | 431 | public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) |
432 | { | 432 | { |
433 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; | 433 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; |
434 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; | 434 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; |
435 | 435 | ||
436 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 436 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
437 | parameters["?server"] = serverDaemon; | 437 | parameters["?server"] = serverDaemon; |
438 | parameters["?target"] = target; | 438 | parameters["?target"] = target; |
439 | parameters["?method"] = methodCall; | 439 | parameters["?method"] = methodCall; |
440 | parameters["?arguments"] = arguments; | 440 | parameters["?arguments"] = arguments; |
441 | parameters["?priority"] = priority.ToString(); | 441 | parameters["?priority"] = priority.ToString(); |
442 | parameters["?message"] = logMessage; | 442 | parameters["?message"] = logMessage; |
443 | 443 | ||
444 | bool returnval = false; | 444 | bool returnval = false; |
445 | 445 | ||
446 | try | 446 | try |
447 | { | 447 | { |
448 | IDbCommand result = Query(sql, parameters); | 448 | IDbCommand result = Query(sql, parameters); |
449 | 449 | ||
450 | if (result.ExecuteNonQuery() == 1) | 450 | if (result.ExecuteNonQuery() == 1) |
451 | returnval = true; | 451 | returnval = true; |
452 | 452 | ||
453 | result.Dispose(); | 453 | result.Dispose(); |
454 | } | 454 | } |
455 | catch (Exception e) | 455 | catch (Exception e) |
456 | { | 456 | { |
457 | Console.WriteLine(e.ToString()); | 457 | Console.WriteLine(e.ToString()); |
458 | return false; | 458 | return false; |
459 | } | 459 | } |
460 | 460 | ||
461 | return returnval; | 461 | return returnval; |
462 | } | 462 | } |
463 | 463 | ||
464 | /// <summary> | 464 | /// <summary> |
465 | /// Inserts a new item into the database | 465 | /// Inserts a new item into the database |
466 | /// </summary> | 466 | /// </summary> |
467 | /// <param name="item">The item</param> | 467 | /// <param name="item">The item</param> |
468 | /// <returns>Success?</returns> | 468 | /// <returns>Success?</returns> |
469 | public bool insertItem(InventoryItemBase item) | 469 | public bool insertItem(InventoryItemBase item) |
470 | { | 470 | { |
471 | string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES "; | 471 | string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES "; |
472 | sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)"; | 472 | sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)"; |
473 | 473 | ||
474 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 474 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
475 | parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated(); | 475 | parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated(); |
476 | parameters["?assetID"] = item.assetID.ToStringHyphenated(); | 476 | parameters["?assetID"] = item.assetID.ToStringHyphenated(); |
477 | parameters["?type"] = item.type.ToString(); | 477 | parameters["?type"] = item.type.ToString(); |
478 | parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated(); | 478 | parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated(); |
479 | parameters["?avatarID"] = item.avatarID.ToStringHyphenated(); | 479 | parameters["?avatarID"] = item.avatarID.ToStringHyphenated(); |
480 | parameters["?inventoryName"] = item.inventoryName; | 480 | parameters["?inventoryName"] = item.inventoryName; |
481 | parameters["?inventoryDescription"] = item.inventoryDescription; | 481 | parameters["?inventoryDescription"] = item.inventoryDescription; |
482 | parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString(); | 482 | parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString(); |
483 | parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString(); | 483 | parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString(); |
484 | 484 | ||
485 | bool returnval = false; | 485 | bool returnval = false; |
486 | 486 | ||
487 | try | 487 | try |
488 | { | 488 | { |
489 | IDbCommand result = Query(sql, parameters); | 489 | IDbCommand result = Query(sql, parameters); |
490 | 490 | ||
491 | if (result.ExecuteNonQuery() == 1) | 491 | if (result.ExecuteNonQuery() == 1) |
492 | returnval = true; | 492 | returnval = true; |
493 | 493 | ||
494 | result.Dispose(); | 494 | result.Dispose(); |
495 | } | 495 | } |
496 | catch (Exception e) | 496 | catch (Exception e) |
497 | { | 497 | { |
498 | Console.WriteLine(e.ToString()); | 498 | Console.WriteLine(e.ToString()); |
499 | return false; | 499 | return false; |
500 | } | 500 | } |
501 | 501 | ||
502 | return returnval; | 502 | return returnval; |
503 | } | 503 | } |
504 | 504 | ||
505 | /// <summary> | 505 | /// <summary> |
506 | /// Inserts a new folder into the database | 506 | /// Inserts a new folder into the database |
507 | /// </summary> | 507 | /// </summary> |
508 | /// <param name="folder">The folder</param> | 508 | /// <param name="folder">The folder</param> |
509 | /// <returns>Success?</returns> | 509 | /// <returns>Success?</returns> |
510 | public bool insertFolder(InventoryFolderBase folder) | 510 | public bool insertFolder(InventoryFolderBase folder) |
511 | { | 511 | { |
512 | string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; | 512 | string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; |
513 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; | 513 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; |
514 | 514 | ||
515 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 515 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
516 | parameters["?folderID"] = folder.folderID.ToStringHyphenated(); | 516 | parameters["?folderID"] = folder.folderID.ToStringHyphenated(); |
517 | parameters["?agentID"] = folder.agentID.ToStringHyphenated(); | 517 | parameters["?agentID"] = folder.agentID.ToStringHyphenated(); |
518 | parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); | 518 | parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); |
519 | parameters["?folderName"] = folder.name; | 519 | parameters["?folderName"] = folder.name; |
520 | 520 | ||
521 | bool returnval = false; | 521 | bool returnval = false; |
522 | try | 522 | try |
523 | { | 523 | { |
524 | IDbCommand result = Query(sql, parameters); | 524 | IDbCommand result = Query(sql, parameters); |
525 | 525 | ||
526 | if (result.ExecuteNonQuery() == 1) | 526 | if (result.ExecuteNonQuery() == 1) |
527 | returnval = true; | 527 | returnval = true; |
528 | 528 | ||
529 | result.Dispose(); | 529 | result.Dispose(); |
530 | } | 530 | } |
531 | catch (Exception e) | 531 | catch (Exception e) |
532 | { | 532 | { |
533 | Console.WriteLine(e.ToString()); | 533 | Console.WriteLine(e.ToString()); |
534 | return false; | 534 | return false; |
535 | } | 535 | } |
536 | return returnval; | 536 | return returnval; |
537 | } | 537 | } |
538 | 538 | ||
539 | /// <summary> | 539 | /// <summary> |
540 | /// Inserts a new region into the database | 540 | /// Inserts a new region into the database |
541 | /// </summary> | 541 | /// </summary> |
542 | /// <param name="profile">The region to insert</param> | 542 | /// <param name="profile">The region to insert</param> |
543 | /// <returns>Success?</returns> | 543 | /// <returns>Success?</returns> |
544 | public bool insertRegion(SimProfileData regiondata) | 544 | public bool insertRegion(SimProfileData regiondata) |
545 | { | 545 | { |
546 | string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 546 | string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
547 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | 547 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; |
548 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; | 548 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; |
549 | 549 | ||
550 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; | 550 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; |
551 | sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; | 551 | sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; |
552 | sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; | 552 | sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; |
553 | 553 | ||
554 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 554 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
555 | 555 | ||
556 | parameters["?regionHandle"] = regiondata.regionHandle.ToString(); | 556 | parameters["?regionHandle"] = regiondata.regionHandle.ToString(); |
557 | parameters["?regionName"] = regiondata.regionName.ToString(); | 557 | parameters["?regionName"] = regiondata.regionName.ToString(); |
558 | parameters["?uuid"] = regiondata.UUID.ToStringHyphenated(); | 558 | parameters["?uuid"] = regiondata.UUID.ToStringHyphenated(); |
559 | parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString(); | 559 | parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString(); |
560 | parameters["?regionSecret"] = regiondata.regionSecret.ToString(); | 560 | parameters["?regionSecret"] = regiondata.regionSecret.ToString(); |
561 | parameters["?regionSendKey"] = regiondata.regionSendKey.ToString(); | 561 | parameters["?regionSendKey"] = regiondata.regionSendKey.ToString(); |
562 | parameters["?regionDataURI"] = regiondata.regionDataURI.ToString(); | 562 | parameters["?regionDataURI"] = regiondata.regionDataURI.ToString(); |
563 | parameters["?serverIP"] = regiondata.serverIP.ToString(); | 563 | parameters["?serverIP"] = regiondata.serverIP.ToString(); |
564 | parameters["?serverPort"] = regiondata.serverPort.ToString(); | 564 | parameters["?serverPort"] = regiondata.serverPort.ToString(); |
565 | parameters["?serverURI"] = regiondata.serverURI.ToString(); | 565 | parameters["?serverURI"] = regiondata.serverURI.ToString(); |
566 | parameters["?locX"] = regiondata.regionLocX.ToString(); | 566 | parameters["?locX"] = regiondata.regionLocX.ToString(); |
567 | parameters["?locY"] = regiondata.regionLocY.ToString(); | 567 | parameters["?locY"] = regiondata.regionLocY.ToString(); |
568 | parameters["?locZ"] = regiondata.regionLocZ.ToString(); | 568 | parameters["?locZ"] = regiondata.regionLocZ.ToString(); |
569 | parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString(); | 569 | parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString(); |
570 | parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString(); | 570 | parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString(); |
571 | parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString(); | 571 | parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString(); |
572 | parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString(); | 572 | parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString(); |
573 | parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString(); | 573 | parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString(); |
574 | parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString(); | 574 | parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString(); |
575 | parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString(); | 575 | parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString(); |
576 | parameters["?regionUserURI"] = regiondata.regionUserURI.ToString(); | 576 | parameters["?regionUserURI"] = regiondata.regionUserURI.ToString(); |
577 | parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString(); | 577 | parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString(); |
578 | parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString(); | 578 | parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString(); |
579 | parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated(); | 579 | parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated(); |
580 | parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); | 580 | parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); |
581 | parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); | 581 | parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); |
582 | 582 | ||
583 | bool returnval = false; | 583 | bool returnval = false; |
584 | 584 | ||
585 | try | 585 | try |
586 | { | 586 | { |
587 | 587 | ||
588 | IDbCommand result = Query(sql, parameters); | 588 | IDbCommand result = Query(sql, parameters); |
589 | 589 | ||
590 | //Console.WriteLine(result.CommandText); | 590 | //Console.WriteLine(result.CommandText); |
591 | 591 | ||
592 | if (result.ExecuteNonQuery() == 1) | 592 | if (result.ExecuteNonQuery() == 1) |
593 | returnval = true; | 593 | returnval = true; |
594 | 594 | ||
595 | result.Dispose(); | 595 | result.Dispose(); |
596 | } | 596 | } |
597 | catch (Exception e) | 597 | catch (Exception e) |
598 | { | 598 | { |
599 | Console.WriteLine(e.ToString()); | 599 | Console.WriteLine(e.ToString()); |
600 | return false; | 600 | return false; |
601 | } | 601 | } |
602 | 602 | ||
603 | return returnval; | 603 | return returnval; |
604 | } | 604 | } |
605 | } | 605 | } |
606 | } | 606 | } |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index c116536..b044bdd 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs | |||
@@ -1,256 +1,256 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | 32 | ||
33 | namespace OpenSim.Framework.Data.MySQL | 33 | namespace OpenSim.Framework.Data.MySQL |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// A database interface class to a user profile storage system | 36 | /// A database interface class to a user profile storage system |
37 | /// </summary> | 37 | /// </summary> |
38 | class MySQLUserData : IUserData | 38 | class MySQLUserData : IUserData |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// Database manager for MySQL | 41 | /// Database manager for MySQL |
42 | /// </summary> | 42 | /// </summary> |
43 | public MySQLManager database; | 43 | public MySQLManager database; |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Loads and initialises the MySQL storage plugin | 46 | /// Loads and initialises the MySQL storage plugin |
47 | /// </summary> | 47 | /// </summary> |
48 | public void Initialise() | 48 | public void Initialise() |
49 | { | 49 | { |
50 | // Load from an INI file connection details | 50 | // Load from an INI file connection details |
51 | // TODO: move this to XML? | 51 | // TODO: move this to XML? |
52 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | 52 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); |
53 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | 53 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); |
54 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | 54 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); |
55 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | 55 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); |
56 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 56 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); |
57 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 57 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
58 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 58 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
59 | 59 | ||
60 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 60 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Searches the database for a specified user profile | 64 | /// Searches the database for a specified user profile |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <param name="name">The account name of the user</param> | 66 | /// <param name="name">The account name of the user</param> |
67 | /// <returns>A user profile</returns> | 67 | /// <returns>A user profile</returns> |
68 | public UserProfileData getUserByName(string name) | 68 | public UserProfileData getUserByName(string name) |
69 | { | 69 | { |
70 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | 70 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Searches the database for a specified user profile by name components | 74 | /// Searches the database for a specified user profile by name components |
75 | /// </summary> | 75 | /// </summary> |
76 | /// <param name="user">The first part of the account name</param> | 76 | /// <param name="user">The first part of the account name</param> |
77 | /// <param name="last">The second part of the account name</param> | 77 | /// <param name="last">The second part of the account name</param> |
78 | /// <returns>A user profile</returns> | 78 | /// <returns>A user profile</returns> |
79 | public UserProfileData getUserByName(string user, string last) | 79 | public UserProfileData getUserByName(string user, string last) |
80 | { | 80 | { |
81 | try | 81 | try |
82 | { | 82 | { |
83 | lock (database) | 83 | lock (database) |
84 | { | 84 | { |
85 | Dictionary<string, string> param = new Dictionary<string, string>(); | 85 | Dictionary<string, string> param = new Dictionary<string, string>(); |
86 | param["?first"] = user; | 86 | param["?first"] = user; |
87 | param["?second"] = last; | 87 | param["?second"] = last; |
88 | 88 | ||
89 | IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); | 89 | IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); |
90 | IDataReader reader = result.ExecuteReader(); | 90 | IDataReader reader = result.ExecuteReader(); |
91 | 91 | ||
92 | UserProfileData row = database.readUserRow(reader); | 92 | UserProfileData row = database.readUserRow(reader); |
93 | 93 | ||
94 | reader.Close(); | 94 | reader.Close(); |
95 | result.Dispose(); | 95 | result.Dispose(); |
96 | 96 | ||
97 | return row; | 97 | return row; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | catch (Exception e) | 100 | catch (Exception e) |
101 | { | 101 | { |
102 | database.Reconnect(); | 102 | database.Reconnect(); |
103 | Console.WriteLine(e.ToString()); | 103 | Console.WriteLine(e.ToString()); |
104 | return null; | 104 | return null; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
109 | /// Searches the database for a specified user profile by UUID | 109 | /// Searches the database for a specified user profile by UUID |
110 | /// </summary> | 110 | /// </summary> |
111 | /// <param name="uuid">The account ID</param> | 111 | /// <param name="uuid">The account ID</param> |
112 | /// <returns>The users profile</returns> | 112 | /// <returns>The users profile</returns> |
113 | public UserProfileData getUserByUUID(LLUUID uuid) | 113 | public UserProfileData getUserByUUID(LLUUID uuid) |
114 | { | 114 | { |
115 | try | 115 | try |
116 | { | 116 | { |
117 | lock (database) | 117 | lock (database) |
118 | { | 118 | { |
119 | Dictionary<string, string> param = new Dictionary<string, string>(); | 119 | Dictionary<string, string> param = new Dictionary<string, string>(); |
120 | param["?uuid"] = uuid.ToStringHyphenated(); | 120 | param["?uuid"] = uuid.ToStringHyphenated(); |
121 | 121 | ||
122 | IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); | 122 | IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); |
123 | IDataReader reader = result.ExecuteReader(); | 123 | IDataReader reader = result.ExecuteReader(); |
124 | 124 | ||
125 | UserProfileData row = database.readUserRow(reader); | 125 | UserProfileData row = database.readUserRow(reader); |
126 | 126 | ||
127 | reader.Close(); | 127 | reader.Close(); |
128 | result.Dispose(); | 128 | result.Dispose(); |
129 | 129 | ||
130 | return row; | 130 | return row; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | catch (Exception e) | 133 | catch (Exception e) |
134 | { | 134 | { |
135 | database.Reconnect(); | 135 | database.Reconnect(); |
136 | Console.WriteLine(e.ToString()); | 136 | Console.WriteLine(e.ToString()); |
137 | return null; | 137 | return null; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
142 | /// Returns a user session searching by name | 142 | /// Returns a user session searching by name |
143 | /// </summary> | 143 | /// </summary> |
144 | /// <param name="name">The account name</param> | 144 | /// <param name="name">The account name</param> |
145 | /// <returns>The users session</returns> | 145 | /// <returns>The users session</returns> |
146 | public UserAgentData getAgentByName(string name) | 146 | public UserAgentData getAgentByName(string name) |
147 | { | 147 | { |
148 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | 148 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); |
149 | } | 149 | } |
150 | 150 | ||
151 | /// <summary> | 151 | /// <summary> |
152 | /// Returns a user session by account name | 152 | /// Returns a user session by account name |
153 | /// </summary> | 153 | /// </summary> |
154 | /// <param name="user">First part of the users account name</param> | 154 | /// <param name="user">First part of the users account name</param> |
155 | /// <param name="last">Second part of the users account name</param> | 155 | /// <param name="last">Second part of the users account name</param> |
156 | /// <returns>The users session</returns> | 156 | /// <returns>The users session</returns> |
157 | public UserAgentData getAgentByName(string user, string last) | 157 | public UserAgentData getAgentByName(string user, string last) |
158 | { | 158 | { |
159 | UserProfileData profile = getUserByName(user, last); | 159 | UserProfileData profile = getUserByName(user, last); |
160 | return getAgentByUUID(profile.UUID); | 160 | return getAgentByUUID(profile.UUID); |
161 | } | 161 | } |
162 | 162 | ||
163 | /// <summary> | 163 | /// <summary> |
164 | /// Returns an agent session by account UUID | 164 | /// Returns an agent session by account UUID |
165 | /// </summary> | 165 | /// </summary> |
166 | /// <param name="uuid">The accounts UUID</param> | 166 | /// <param name="uuid">The accounts UUID</param> |
167 | /// <returns>The users session</returns> | 167 | /// <returns>The users session</returns> |
168 | public UserAgentData getAgentByUUID(LLUUID uuid) | 168 | public UserAgentData getAgentByUUID(LLUUID uuid) |
169 | { | 169 | { |
170 | try | 170 | try |
171 | { | 171 | { |
172 | lock (database) | 172 | lock (database) |
173 | { | 173 | { |
174 | Dictionary<string, string> param = new Dictionary<string, string>(); | 174 | Dictionary<string, string> param = new Dictionary<string, string>(); |
175 | param["?uuid"] = uuid.ToStringHyphenated(); | 175 | param["?uuid"] = uuid.ToStringHyphenated(); |
176 | 176 | ||
177 | IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); | 177 | IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); |
178 | IDataReader reader = result.ExecuteReader(); | 178 | IDataReader reader = result.ExecuteReader(); |
179 | 179 | ||
180 | UserAgentData row = database.readAgentRow(reader); | 180 | UserAgentData row = database.readAgentRow(reader); |
181 | 181 | ||
182 | reader.Close(); | 182 | reader.Close(); |
183 | result.Dispose(); | 183 | result.Dispose(); |
184 | 184 | ||
185 | return row; | 185 | return row; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | catch (Exception e) | 188 | catch (Exception e) |
189 | { | 189 | { |
190 | database.Reconnect(); | 190 | database.Reconnect(); |
191 | Console.WriteLine(e.ToString()); | 191 | Console.WriteLine(e.ToString()); |
192 | return null; | 192 | return null; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | /// <summary> | 196 | /// <summary> |
197 | /// Creates a new users profile | 197 | /// Creates a new users profile |
198 | /// </summary> | 198 | /// </summary> |
199 | /// <param name="user">The user profile to create</param> | 199 | /// <param name="user">The user profile to create</param> |
200 | public void addNewUserProfile(UserProfileData user) | 200 | public void addNewUserProfile(UserProfileData user) |
201 | { | 201 | { |
202 | } | 202 | } |
203 | 203 | ||
204 | /// <summary> | 204 | /// <summary> |
205 | /// Creates a new agent | 205 | /// Creates a new agent |
206 | /// </summary> | 206 | /// </summary> |
207 | /// <param name="agent">The agent to create</param> | 207 | /// <param name="agent">The agent to create</param> |
208 | public void addNewUserAgent(UserAgentData agent) | 208 | public void addNewUserAgent(UserAgentData agent) |
209 | { | 209 | { |
210 | // Do nothing. | 210 | // Do nothing. |
211 | } | 211 | } |
212 | 212 | ||
213 | /// <summary> | 213 | /// <summary> |
214 | /// Performs a money transfer request between two accounts | 214 | /// Performs a money transfer request between two accounts |
215 | /// </summary> | 215 | /// </summary> |
216 | /// <param name="from">The senders account ID</param> | 216 | /// <param name="from">The senders account ID</param> |
217 | /// <param name="to">The recievers account ID</param> | 217 | /// <param name="to">The recievers account ID</param> |
218 | /// <param name="amount">The amount to transfer</param> | 218 | /// <param name="amount">The amount to transfer</param> |
219 | /// <returns>Success?</returns> | 219 | /// <returns>Success?</returns> |
220 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 220 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
221 | { | 221 | { |
222 | return false; | 222 | return false; |
223 | } | 223 | } |
224 | 224 | ||
225 | /// <summary> | 225 | /// <summary> |
226 | /// Performs an inventory transfer request between two accounts | 226 | /// Performs an inventory transfer request between two accounts |
227 | /// </summary> | 227 | /// </summary> |
228 | /// <remarks>TODO: Move to inventory server</remarks> | 228 | /// <remarks>TODO: Move to inventory server</remarks> |
229 | /// <param name="from">The senders account ID</param> | 229 | /// <param name="from">The senders account ID</param> |
230 | /// <param name="to">The recievers account ID</param> | 230 | /// <param name="to">The recievers account ID</param> |
231 | /// <param name="item">The item to transfer</param> | 231 | /// <param name="item">The item to transfer</param> |
232 | /// <returns>Success?</returns> | 232 | /// <returns>Success?</returns> |
233 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 233 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
234 | { | 234 | { |
235 | return false; | 235 | return false; |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// Database provider name | 239 | /// Database provider name |
240 | /// </summary> | 240 | /// </summary> |
241 | /// <returns>Provider name</returns> | 241 | /// <returns>Provider name</returns> |
242 | public string getName() | 242 | public string getName() |
243 | { | 243 | { |
244 | return "MySQL Userdata Interface"; | 244 | return "MySQL Userdata Interface"; |
245 | } | 245 | } |
246 | 246 | ||
247 | /// <summary> | 247 | /// <summary> |
248 | /// Database provider version | 248 | /// Database provider version |
249 | /// </summary> | 249 | /// </summary> |
250 | /// <returns>provider version</returns> | 250 | /// <returns>provider version</returns> |
251 | public string getVersion() | 251 | public string getVersion() |
252 | { | 252 | { |
253 | return "0.1"; | 253 | return "0.1"; |
254 | } | 254 | } |
255 | } | 255 | } |
256 | } | 256 | } |
diff --git a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs index 52d6a54..46c0ae0 100644 --- a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | // General Information about an assembly is controlled through the following | 3 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 4 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 5 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")] | 6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")] |
7 | [assembly: AssemblyDescription("")] | 7 | [assembly: AssemblyDescription("")] |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyConfiguration("")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyCompany("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] | 10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCopyright("Copyright © 2007")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyTrademark("")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCulture("")] |
14 | 14 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 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 | 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. | 17 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 18 | [assembly: ComVisible(false)] |
19 | 19 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] | 21 | [assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] |
22 | 22 | ||
23 | // Version information for an assembly consists of the following four values: | 23 | // Version information for an assembly consists of the following four values: |
24 | // | 24 | // |
25 | // Major Version | 25 | // Major Version |
26 | // Minor Version | 26 | // Minor Version |
27 | // Build Number | 27 | // Build Number |
28 | // Revision | 28 | // Revision |
29 | // | 29 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 30 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 31 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs index 9de5edb..8136bc1 100644 --- a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | // General Information about an assembly is controlled through the following | 3 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 4 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 5 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")] | 6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")] |
7 | [assembly: AssemblyDescription("")] | 7 | [assembly: AssemblyDescription("")] |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyConfiguration("")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyCompany("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] | 10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCopyright("Copyright © 2007")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyTrademark("")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCulture("")] |
14 | 14 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 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 | 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. | 17 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 18 | [assembly: ComVisible(false)] |
19 | 19 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] | 21 | [assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] |
22 | 22 | ||
23 | // Version information for an assembly consists of the following four values: | 23 | // Version information for an assembly consists of the following four values: |
24 | // | 24 | // |
25 | // Major Version | 25 | // Major Version |
26 | // Minor Version | 26 | // Minor Version |
27 | // Build Number | 27 | // Build Number |
28 | // Revision | 28 | // Revision |
29 | // | 29 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 30 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 31 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 511c5f0..c1d74ae 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | |||
@@ -1,197 +1,197 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Security.Cryptography; | 31 | using System.Security.Cryptography; |
32 | using System.Text; | 32 | using System.Text; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Data.SQLite | 35 | namespace OpenSim.Framework.Data.SQLite |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// A Grid Interface to the SQLite database | 38 | /// A Grid Interface to the SQLite database |
39 | /// </summary> | 39 | /// </summary> |
40 | public class SQLiteGridData : IGridData | 40 | public class SQLiteGridData : IGridData |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// A database manager | 43 | /// A database manager |
44 | /// </summary> | 44 | /// </summary> |
45 | private SQLiteManager database; | 45 | private SQLiteManager database; |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Initialises the Grid Interface | 48 | /// Initialises the Grid Interface |
49 | /// </summary> | 49 | /// </summary> |
50 | public void Initialise() | 50 | public void Initialise() |
51 | { | 51 | { |
52 | database = new SQLiteManager("localhost", "db", "user", "password", "false"); | 52 | database = new SQLiteManager("localhost", "db", "user", "password", "false"); |
53 | } | 53 | } |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Shuts down the grid interface | 56 | /// Shuts down the grid interface |
57 | /// </summary> | 57 | /// </summary> |
58 | public void Close() | 58 | public void Close() |
59 | { | 59 | { |
60 | database.Close(); | 60 | database.Close(); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Returns the name of this grid interface | 64 | /// Returns the name of this grid interface |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <returns>A string containing the grid interface</returns> | 66 | /// <returns>A string containing the grid interface</returns> |
67 | public string getName() | 67 | public string getName() |
68 | { | 68 | { |
69 | return "SQLite OpenGridData"; | 69 | return "SQLite OpenGridData"; |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Returns the version of this grid interface | 73 | /// Returns the version of this grid interface |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <returns>A string containing the version</returns> | 75 | /// <returns>A string containing the version</returns> |
76 | public string getVersion() | 76 | public string getVersion() |
77 | { | 77 | { |
78 | return "0.1"; | 78 | return "0.1"; |
79 | } | 79 | } |
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// Returns a list of regions within the specified ranges | 82 | /// Returns a list of regions within the specified ranges |
83 | /// </summary> | 83 | /// </summary> |
84 | /// <param name="a">minimum X coordinate</param> | 84 | /// <param name="a">minimum X coordinate</param> |
85 | /// <param name="b">minimum Y coordinate</param> | 85 | /// <param name="b">minimum Y coordinate</param> |
86 | /// <param name="c">maximum X coordinate</param> | 86 | /// <param name="c">maximum X coordinate</param> |
87 | /// <param name="d">maximum Y coordinate</param> | 87 | /// <param name="d">maximum Y coordinate</param> |
88 | /// <returns>An array of region profiles</returns> | 88 | /// <returns>An array of region profiles</returns> |
89 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | 89 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) |
90 | { | 90 | { |
91 | return null; | 91 | return null; |
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
95 | /// Returns a sim profile from it's location | 95 | /// Returns a sim profile from it's location |
96 | /// </summary> | 96 | /// </summary> |
97 | /// <param name="handle">Region location handle</param> | 97 | /// <param name="handle">Region location handle</param> |
98 | /// <returns>Sim profile</returns> | 98 | /// <returns>Sim profile</returns> |
99 | public SimProfileData GetProfileByHandle(ulong handle) | 99 | public SimProfileData GetProfileByHandle(ulong handle) |
100 | { | 100 | { |
101 | Dictionary<string, string> param = new Dictionary<string, string>(); | 101 | Dictionary<string, string> param = new Dictionary<string, string>(); |
102 | param["handle"] = handle.ToString(); | 102 | param["handle"] = handle.ToString(); |
103 | 103 | ||
104 | IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); | 104 | IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); |
105 | IDataReader reader = result.ExecuteReader(); | 105 | IDataReader reader = result.ExecuteReader(); |
106 | 106 | ||
107 | SimProfileData row = database.getRow(reader); | 107 | SimProfileData row = database.getRow(reader); |
108 | reader.Close(); | 108 | reader.Close(); |
109 | result.Dispose(); | 109 | result.Dispose(); |
110 | 110 | ||
111 | return row; | 111 | return row; |
112 | } | 112 | } |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// Returns a sim profile from it's UUID | 115 | /// Returns a sim profile from it's UUID |
116 | /// </summary> | 116 | /// </summary> |
117 | /// <param name="uuid">The region UUID</param> | 117 | /// <param name="uuid">The region UUID</param> |
118 | /// <returns>The sim profile</returns> | 118 | /// <returns>The sim profile</returns> |
119 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | 119 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
120 | { | 120 | { |
121 | Dictionary<string, string> param = new Dictionary<string, string>(); | 121 | Dictionary<string, string> param = new Dictionary<string, string>(); |
122 | param["uuid"] = uuid.ToStringHyphenated(); | 122 | param["uuid"] = uuid.ToStringHyphenated(); |
123 | 123 | ||
124 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); | 124 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); |
125 | IDataReader reader = result.ExecuteReader(); | 125 | IDataReader reader = result.ExecuteReader(); |
126 | 126 | ||
127 | SimProfileData row = database.getRow(reader); | 127 | SimProfileData row = database.getRow(reader); |
128 | reader.Close(); | 128 | reader.Close(); |
129 | result.Dispose(); | 129 | result.Dispose(); |
130 | 130 | ||
131 | return row; | 131 | return row; |
132 | } | 132 | } |
133 | 133 | ||
134 | /// <summary> | 134 | /// <summary> |
135 | /// Adds a new specified region to the database | 135 | /// Adds a new specified region to the database |
136 | /// </summary> | 136 | /// </summary> |
137 | /// <param name="profile">The profile to add</param> | 137 | /// <param name="profile">The profile to add</param> |
138 | /// <returns>A dataresponse enum indicating success</returns> | 138 | /// <returns>A dataresponse enum indicating success</returns> |
139 | public DataResponse AddProfile(SimProfileData profile) | 139 | public DataResponse AddProfile(SimProfileData profile) |
140 | { | 140 | { |
141 | if (database.insertRow(profile)) | 141 | if (database.insertRow(profile)) |
142 | { | 142 | { |
143 | return DataResponse.RESPONSE_OK; | 143 | return DataResponse.RESPONSE_OK; |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | return DataResponse.RESPONSE_ERROR; | 147 | return DataResponse.RESPONSE_ERROR; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | /// <summary> | 151 | /// <summary> |
152 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | 152 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. |
153 | /// </summary> | 153 | /// </summary> |
154 | /// <param name="uuid">The UUID of the challenger</param> | 154 | /// <param name="uuid">The UUID of the challenger</param> |
155 | /// <param name="handle">The attempted regionHandle of the challenger</param> | 155 | /// <param name="handle">The attempted regionHandle of the challenger</param> |
156 | /// <param name="authkey">The secret</param> | 156 | /// <param name="authkey">The secret</param> |
157 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | 157 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> |
158 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) | 158 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) |
159 | { | 159 | { |
160 | bool throwHissyFit = false; // Should be true by 1.0 | 160 | bool throwHissyFit = false; // Should be true by 1.0 |
161 | 161 | ||
162 | if (throwHissyFit) | 162 | if (throwHissyFit) |
163 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | 163 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); |
164 | 164 | ||
165 | SimProfileData data = GetProfileByLLUUID(uuid); | 165 | SimProfileData data = GetProfileByLLUUID(uuid); |
166 | 166 | ||
167 | return (handle == data.regionHandle && authkey == data.regionSecret); | 167 | return (handle == data.regionHandle && authkey == data.regionSecret); |
168 | } | 168 | } |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | 171 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region |
172 | /// </summary> | 172 | /// </summary> |
173 | /// <remarks>This requires a security audit.</remarks> | 173 | /// <remarks>This requires a security audit.</remarks> |
174 | /// <param name="uuid"></param> | 174 | /// <param name="uuid"></param> |
175 | /// <param name="handle"></param> | 175 | /// <param name="handle"></param> |
176 | /// <param name="authhash"></param> | 176 | /// <param name="authhash"></param> |
177 | /// <param name="challenge"></param> | 177 | /// <param name="challenge"></param> |
178 | /// <returns></returns> | 178 | /// <returns></returns> |
179 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) | 179 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) |
180 | { | 180 | { |
181 | SHA512Managed HashProvider = new SHA512Managed(); | 181 | SHA512Managed HashProvider = new SHA512Managed(); |
182 | ASCIIEncoding TextProvider = new ASCIIEncoding(); | 182 | ASCIIEncoding TextProvider = new ASCIIEncoding(); |
183 | 183 | ||
184 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | 184 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); |
185 | byte[] hash = HashProvider.ComputeHash(stream); | 185 | byte[] hash = HashProvider.ComputeHash(stream); |
186 | 186 | ||
187 | return false; | 187 | return false; |
188 | } | 188 | } |
189 | 189 | ||
190 | public ReservationData GetReservationAtPoint(uint x, uint y) | 190 | public ReservationData GetReservationAtPoint(uint x, uint y) |
191 | { | 191 | { |
192 | return null; | 192 | return null; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | } | 197 | } |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index c9931ab..a69611a 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs | |||
@@ -1,206 +1,206 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Data.SQLite; | 31 | using System.Data.SQLite; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Data.SQLite | 34 | namespace OpenSim.Framework.Data.SQLite |
35 | { | 35 | { |
36 | class SQLiteManager | 36 | class SQLiteManager |
37 | { | 37 | { |
38 | IDbConnection dbcon; | 38 | IDbConnection dbcon; |
39 | 39 | ||
40 | /// <summary> | 40 | /// <summary> |
41 | /// Initialises and creates a new SQLite connection and maintains it. | 41 | /// Initialises and creates a new SQLite connection and maintains it. |
42 | /// </summary> | 42 | /// </summary> |
43 | /// <param name="hostname">The SQLite server being connected to</param> | 43 | /// <param name="hostname">The SQLite server being connected to</param> |
44 | /// <param name="database">The name of the SQLite database being used</param> | 44 | /// <param name="database">The name of the SQLite database being used</param> |
45 | /// <param name="username">The username logging into the database</param> | 45 | /// <param name="username">The username logging into the database</param> |
46 | /// <param name="password">The password for the user logging in</param> | 46 | /// <param name="password">The password for the user logging in</param> |
47 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | 47 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> |
48 | public SQLiteManager(string hostname, string database, string username, string password, string cpooling) | 48 | public SQLiteManager(string hostname, string database, string username, string password, string cpooling) |
49 | { | 49 | { |
50 | try | 50 | try |
51 | { | 51 | { |
52 | string connectionString = "URI=file:GridServerSqlite.db;"; | 52 | string connectionString = "URI=file:GridServerSqlite.db;"; |
53 | dbcon = new SQLiteConnection(connectionString); | 53 | dbcon = new SQLiteConnection(connectionString); |
54 | 54 | ||
55 | dbcon.Open(); | 55 | dbcon.Open(); |
56 | } | 56 | } |
57 | catch (Exception e) | 57 | catch (Exception e) |
58 | { | 58 | { |
59 | throw new Exception("Error initialising SQLite Database: " + e.ToString()); | 59 | throw new Exception("Error initialising SQLite Database: " + e.ToString()); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Shuts down the database connection | 64 | /// Shuts down the database connection |
65 | /// </summary> | 65 | /// </summary> |
66 | public void Close() | 66 | public void Close() |
67 | { | 67 | { |
68 | dbcon.Close(); | 68 | dbcon.Close(); |
69 | dbcon = null; | 69 | dbcon = null; |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Runs a query with protection against SQL Injection by using parameterised input. | 73 | /// Runs a query with protection against SQL Injection by using parameterised input. |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | 75 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> |
76 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | 76 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> |
77 | /// <returns>A SQLite DB Command</returns> | 77 | /// <returns>A SQLite DB Command</returns> |
78 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 78 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) |
79 | { | 79 | { |
80 | SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); | 80 | SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); |
81 | dbcommand.CommandText = sql; | 81 | dbcommand.CommandText = sql; |
82 | foreach (KeyValuePair<string, string> param in parameters) | 82 | foreach (KeyValuePair<string, string> param in parameters) |
83 | { | 83 | { |
84 | SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); | 84 | SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); |
85 | dbcommand.Parameters.Add(paramx); | 85 | dbcommand.Parameters.Add(paramx); |
86 | } | 86 | } |
87 | 87 | ||
88 | return (IDbCommand)dbcommand; | 88 | return (IDbCommand)dbcommand; |
89 | } | 89 | } |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Reads a region row from a database reader | 92 | /// Reads a region row from a database reader |
93 | /// </summary> | 93 | /// </summary> |
94 | /// <param name="reader">An active database reader</param> | 94 | /// <param name="reader">An active database reader</param> |
95 | /// <returns>A region profile</returns> | 95 | /// <returns>A region profile</returns> |
96 | public SimProfileData getRow(IDataReader reader) | 96 | public SimProfileData getRow(IDataReader reader) |
97 | { | 97 | { |
98 | SimProfileData retval = new SimProfileData(); | 98 | SimProfileData retval = new SimProfileData(); |
99 | 99 | ||
100 | if (reader.Read()) | 100 | if (reader.Read()) |
101 | { | 101 | { |
102 | // Region Main | 102 | // Region Main |
103 | retval.regionHandle = (ulong)reader["regionHandle"]; | 103 | retval.regionHandle = (ulong)reader["regionHandle"]; |
104 | retval.regionName = (string)reader["regionName"]; | 104 | retval.regionName = (string)reader["regionName"]; |
105 | retval.UUID = new LLUUID((string)reader["uuid"]); | 105 | retval.UUID = new LLUUID((string)reader["uuid"]); |
106 | 106 | ||
107 | // Secrets | 107 | // Secrets |
108 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | 108 | retval.regionRecvKey = (string)reader["regionRecvKey"]; |
109 | retval.regionSecret = (string)reader["regionSecret"]; | 109 | retval.regionSecret = (string)reader["regionSecret"]; |
110 | retval.regionSendKey = (string)reader["regionSendKey"]; | 110 | retval.regionSendKey = (string)reader["regionSendKey"]; |
111 | 111 | ||
112 | // Region Server | 112 | // Region Server |
113 | retval.regionDataURI = (string)reader["regionDataURI"]; | 113 | retval.regionDataURI = (string)reader["regionDataURI"]; |
114 | retval.regionOnline = false; // Needs to be pinged before this can be set. | 114 | retval.regionOnline = false; // Needs to be pinged before this can be set. |
115 | retval.serverIP = (string)reader["serverIP"]; | 115 | retval.serverIP = (string)reader["serverIP"]; |
116 | retval.serverPort = (uint)reader["serverPort"]; | 116 | retval.serverPort = (uint)reader["serverPort"]; |
117 | retval.serverURI = (string)reader["serverURI"]; | 117 | retval.serverURI = (string)reader["serverURI"]; |
118 | 118 | ||
119 | // Location | 119 | // Location |
120 | retval.regionLocX = (uint)((int)reader["locX"]); | 120 | retval.regionLocX = (uint)((int)reader["locX"]); |
121 | retval.regionLocY = (uint)((int)reader["locY"]); | 121 | retval.regionLocY = (uint)((int)reader["locY"]); |
122 | retval.regionLocZ = (uint)((int)reader["locZ"]); | 122 | retval.regionLocZ = (uint)((int)reader["locZ"]); |
123 | 123 | ||
124 | // Neighbours - 0 = No Override | 124 | // Neighbours - 0 = No Override |
125 | retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | 125 | retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; |
126 | retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | 126 | retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; |
127 | retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | 127 | retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; |
128 | retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | 128 | retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; |
129 | 129 | ||
130 | // Assets | 130 | // Assets |
131 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | 131 | retval.regionAssetURI = (string)reader["regionAssetURI"]; |
132 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 132 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; |
133 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 133 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; |
134 | 134 | ||
135 | // Userserver | 135 | // Userserver |
136 | retval.regionUserURI = (string)reader["regionUserURI"]; | 136 | retval.regionUserURI = (string)reader["regionUserURI"]; |
137 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 137 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; |
138 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | 138 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; |
139 | } | 139 | } |
140 | else | 140 | else |
141 | { | 141 | { |
142 | throw new Exception("No rows to return"); | 142 | throw new Exception("No rows to return"); |
143 | } | 143 | } |
144 | return retval; | 144 | return retval; |
145 | } | 145 | } |
146 | 146 | ||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Inserts a new region into the database | 148 | /// Inserts a new region into the database |
149 | /// </summary> | 149 | /// </summary> |
150 | /// <param name="profile">The region to insert</param> | 150 | /// <param name="profile">The region to insert</param> |
151 | /// <returns>Success?</returns> | 151 | /// <returns>Success?</returns> |
152 | public bool insertRow(SimProfileData profile) | 152 | public bool insertRow(SimProfileData profile) |
153 | { | 153 | { |
154 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 154 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
155 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | 155 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; |
156 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | 156 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; |
157 | 157 | ||
158 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | 158 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; |
159 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | 159 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; |
160 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | 160 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; |
161 | 161 | ||
162 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 162 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
163 | 163 | ||
164 | parameters["regionHandle"] = profile.regionHandle.ToString(); | 164 | parameters["regionHandle"] = profile.regionHandle.ToString(); |
165 | parameters["regionName"] = profile.regionName; | 165 | parameters["regionName"] = profile.regionName; |
166 | parameters["uuid"] = profile.UUID.ToString(); | 166 | parameters["uuid"] = profile.UUID.ToString(); |
167 | parameters["regionRecvKey"] = profile.regionRecvKey; | 167 | parameters["regionRecvKey"] = profile.regionRecvKey; |
168 | parameters["regionSendKey"] = profile.regionSendKey; | 168 | parameters["regionSendKey"] = profile.regionSendKey; |
169 | parameters["regionDataURI"] = profile.regionDataURI; | 169 | parameters["regionDataURI"] = profile.regionDataURI; |
170 | parameters["serverIP"] = profile.serverIP; | 170 | parameters["serverIP"] = profile.serverIP; |
171 | parameters["serverPort"] = profile.serverPort.ToString(); | 171 | parameters["serverPort"] = profile.serverPort.ToString(); |
172 | parameters["serverURI"] = profile.serverURI; | 172 | parameters["serverURI"] = profile.serverURI; |
173 | parameters["locX"] = profile.regionLocX.ToString(); | 173 | parameters["locX"] = profile.regionLocX.ToString(); |
174 | parameters["locY"] = profile.regionLocY.ToString(); | 174 | parameters["locY"] = profile.regionLocY.ToString(); |
175 | parameters["locZ"] = profile.regionLocZ.ToString(); | 175 | parameters["locZ"] = profile.regionLocZ.ToString(); |
176 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | 176 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); |
177 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | 177 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); |
178 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | 178 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); |
179 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | 179 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); |
180 | parameters["regionAssetURI"] = profile.regionAssetURI; | 180 | parameters["regionAssetURI"] = profile.regionAssetURI; |
181 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | 181 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; |
182 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | 182 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; |
183 | parameters["regionUserURI"] = profile.regionUserURI; | 183 | parameters["regionUserURI"] = profile.regionUserURI; |
184 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | 184 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; |
185 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | 185 | parameters["regionUserSendKey"] = profile.regionUserSendKey; |
186 | 186 | ||
187 | bool returnval = false; | 187 | bool returnval = false; |
188 | 188 | ||
189 | try | 189 | try |
190 | { | 190 | { |
191 | IDbCommand result = Query(sql, parameters); | 191 | IDbCommand result = Query(sql, parameters); |
192 | 192 | ||
193 | if (result.ExecuteNonQuery() == 1) | 193 | if (result.ExecuteNonQuery() == 1) |
194 | returnval = true; | 194 | returnval = true; |
195 | 195 | ||
196 | result.Dispose(); | 196 | result.Dispose(); |
197 | } | 197 | } |
198 | catch (Exception) | 198 | catch (Exception) |
199 | { | 199 | { |
200 | return false; | 200 | return false; |
201 | } | 201 | } |
202 | 202 | ||
203 | return returnval; | 203 | return returnval; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | } | 206 | } |
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 5a17d20..c96353b 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs | |||
@@ -1,111 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Framework.Data | 30 | namespace OpenSim.Framework.Data |
31 | { | 31 | { |
32 | public enum DataResponse | 32 | public enum DataResponse |
33 | { | 33 | { |
34 | RESPONSE_OK, | 34 | RESPONSE_OK, |
35 | RESPONSE_AUTHREQUIRED, | 35 | RESPONSE_AUTHREQUIRED, |
36 | RESPONSE_INVALIDCREDENTIALS, | 36 | RESPONSE_INVALIDCREDENTIALS, |
37 | RESPONSE_ERROR | 37 | RESPONSE_ERROR |
38 | } | 38 | } |
39 | 39 | ||
40 | /// <summary> | 40 | /// <summary> |
41 | /// A standard grid interface | 41 | /// A standard grid interface |
42 | /// </summary> | 42 | /// </summary> |
43 | public interface IGridData | 43 | public interface IGridData |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// Returns a sim profile from a regionHandle | 46 | /// Returns a sim profile from a regionHandle |
47 | /// </summary> | 47 | /// </summary> |
48 | /// <param name="regionHandle">A 64bit Region Handle</param> | 48 | /// <param name="regionHandle">A 64bit Region Handle</param> |
49 | /// <returns>A simprofile</returns> | 49 | /// <returns>A simprofile</returns> |
50 | SimProfileData GetProfileByHandle(ulong regionHandle); | 50 | SimProfileData GetProfileByHandle(ulong regionHandle); |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// Returns a sim profile from a UUID | 53 | /// Returns a sim profile from a UUID |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <param name="UUID">A 128bit UUID</param> | 55 | /// <param name="UUID">A 128bit UUID</param> |
56 | /// <returns>A sim profile</returns> | 56 | /// <returns>A sim profile</returns> |
57 | SimProfileData GetProfileByLLUUID(LLUUID UUID); | 57 | SimProfileData GetProfileByLLUUID(LLUUID UUID); |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Returns all profiles within the specified range | 60 | /// Returns all profiles within the specified range |
61 | /// </summary> | 61 | /// </summary> |
62 | /// <param name="Xmin">Minimum sim coordinate (X)</param> | 62 | /// <param name="Xmin">Minimum sim coordinate (X)</param> |
63 | /// <param name="Ymin">Minimum sim coordinate (Y)</param> | 63 | /// <param name="Ymin">Minimum sim coordinate (Y)</param> |
64 | /// <param name="Xmax">Maximum sim coordinate (X)</param> | 64 | /// <param name="Xmax">Maximum sim coordinate (X)</param> |
65 | /// <param name="Ymin">Maximum sim coordinate (Y)</param> | 65 | /// <param name="Ymin">Maximum sim coordinate (Y)</param> |
66 | /// <returns>An array containing all the sim profiles in the specified range</returns> | 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); | 67 | SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Authenticates a sim by use of it's recv key. | 70 | /// Authenticates a sim by use of it's recv key. |
71 | /// WARNING: Insecure | 71 | /// WARNING: Insecure |
72 | /// </summary> | 72 | /// </summary> |
73 | /// <param name="UUID">The UUID sent by the sim</param> | 73 | /// <param name="UUID">The UUID sent by the sim</param> |
74 | /// <param name="regionHandle">The regionhandle 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> | 75 | /// <param name="simrecvkey">The recieving key sent by the sim</param> |
76 | /// <returns>Whether the sim has been authenticated</returns> | 76 | /// <returns>Whether the sim has been authenticated</returns> |
77 | bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey); | 77 | bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey); |
78 | 78 | ||
79 | /// <summary> | 79 | /// <summary> |
80 | /// Initialises the interface | 80 | /// Initialises the interface |
81 | /// </summary> | 81 | /// </summary> |
82 | void Initialise(); | 82 | void Initialise(); |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Closes the interface | 85 | /// Closes the interface |
86 | /// </summary> | 86 | /// </summary> |
87 | void Close(); | 87 | void Close(); |
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// The plugin being loaded | 90 | /// The plugin being loaded |
91 | /// </summary> | 91 | /// </summary> |
92 | /// <returns>A string containing the plugin name</returns> | 92 | /// <returns>A string containing the plugin name</returns> |
93 | string getName(); | 93 | string getName(); |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// The plugins version | 96 | /// The plugins version |
97 | /// </summary> | 97 | /// </summary> |
98 | /// <returns>A string containing the plugin version</returns> | 98 | /// <returns>A string containing the plugin version</returns> |
99 | string getVersion(); | 99 | string getVersion(); |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Adds a new profile to the database | 102 | /// Adds a new profile to the database |
103 | /// </summary> | 103 | /// </summary> |
104 | /// <param name="profile">The profile to add</param> | 104 | /// <param name="profile">The profile to add</param> |
105 | /// <returns>RESPONSE_OK if successful, error if not.</returns> | 105 | /// <returns>RESPONSE_OK if successful, error if not.</returns> |
106 | DataResponse AddProfile(SimProfileData profile); | 106 | DataResponse AddProfile(SimProfileData profile); |
107 | 107 | ||
108 | ReservationData GetReservationAtPoint(uint x, uint y); | 108 | ReservationData GetReservationAtPoint(uint x, uint y); |
109 | 109 | ||
110 | } | 110 | } |
111 | } | 111 | } |
diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs index 059fef5..a827c0c 100644 --- a/OpenSim/Framework/Data/ILogData.cs +++ b/OpenSim/Framework/Data/ILogData.cs | |||
@@ -1,90 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Framework.Data | 28 | namespace OpenSim.Framework.Data |
29 | { | 29 | { |
30 | /// <summary> | 30 | /// <summary> |
31 | /// The severity of an individual log message | 31 | /// The severity of an individual log message |
32 | /// </summary> | 32 | /// </summary> |
33 | public enum LogSeverity : int | 33 | public enum LogSeverity : int |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// Critical: systems failure | 36 | /// Critical: systems failure |
37 | /// </summary> | 37 | /// </summary> |
38 | CRITICAL = 1, | 38 | CRITICAL = 1, |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Major: warning prior to systems failure | 40 | /// Major: warning prior to systems failure |
41 | /// </summary> | 41 | /// </summary> |
42 | MAJOR = 2, | 42 | MAJOR = 2, |
43 | /// <summary> | 43 | /// <summary> |
44 | /// Medium: an individual non-critical task failed | 44 | /// Medium: an individual non-critical task failed |
45 | /// </summary> | 45 | /// </summary> |
46 | MEDIUM = 3, | 46 | MEDIUM = 3, |
47 | /// <summary> | 47 | /// <summary> |
48 | /// Low: Informational warning | 48 | /// Low: Informational warning |
49 | /// </summary> | 49 | /// </summary> |
50 | LOW = 4, | 50 | LOW = 4, |
51 | /// <summary> | 51 | /// <summary> |
52 | /// Info: Information | 52 | /// Info: Information |
53 | /// </summary> | 53 | /// </summary> |
54 | INFO = 5, | 54 | INFO = 5, |
55 | /// <summary> | 55 | /// <summary> |
56 | /// Verbose: Debug Information | 56 | /// Verbose: Debug Information |
57 | /// </summary> | 57 | /// </summary> |
58 | VERBOSE = 6 | 58 | VERBOSE = 6 |
59 | } | 59 | } |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// An interface to a LogData storage system | 62 | /// An interface to a LogData storage system |
63 | /// </summary> | 63 | /// </summary> |
64 | public interface ILogData | 64 | public interface ILogData |
65 | { | 65 | { |
66 | void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); | 66 | void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); |
67 | /// <summary> | 67 | /// <summary> |
68 | /// Initialises the interface | 68 | /// Initialises the interface |
69 | /// </summary> | 69 | /// </summary> |
70 | void Initialise(); | 70 | void Initialise(); |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Closes the interface | 73 | /// Closes the interface |
74 | /// </summary> | 74 | /// </summary> |
75 | void Close(); | 75 | void Close(); |
76 | 76 | ||
77 | /// <summary> | 77 | /// <summary> |
78 | /// The plugin being loaded | 78 | /// The plugin being loaded |
79 | /// </summary> | 79 | /// </summary> |
80 | /// <returns>A string containing the plugin name</returns> | 80 | /// <returns>A string containing the plugin name</returns> |
81 | string getName(); | 81 | string getName(); |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// The plugins version | 84 | /// The plugins version |
85 | /// </summary> | 85 | /// </summary> |
86 | /// <returns>A string containing the plugin version</returns> | 86 | /// <returns>A string containing the plugin version</returns> |
87 | string getVersion(); | 87 | string getVersion(); |
88 | } | 88 | } |
89 | 89 | ||
90 | } | 90 | } |
diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs index 2b52fd1..5dcb2fd 100644 --- a/OpenSim/Framework/Data/IniConfig.cs +++ b/OpenSim/Framework/Data/IniConfig.cs | |||
@@ -1,96 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Text.RegularExpressions; | 29 | using System.Text.RegularExpressions; |
30 | /* | 30 | /* |
31 | Taken from public code listing at by Alex Pinsker | 31 | Taken from public code listing at by Alex Pinsker |
32 | http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html | 32 | http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html |
33 | */ | 33 | */ |
34 | 34 | ||
35 | namespace OpenSim.Framework.Data | 35 | namespace OpenSim.Framework.Data |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Parse settings from ini-like files | 38 | /// Parse settings from ini-like files |
39 | /// </summary> | 39 | /// </summary> |
40 | public class IniFile | 40 | public class IniFile |
41 | { | 41 | { |
42 | static IniFile() | 42 | static IniFile() |
43 | { | 43 | { |
44 | _iniKeyValuePatternRegex = new Regex( | 44 | _iniKeyValuePatternRegex = new Regex( |
45 | @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]* | 45 | @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]* |
46 | # key part (surrounding whitespace stripped) | 46 | # key part (surrounding whitespace stripped) |
47 | \= | 47 | \= |
48 | (\s)*(?<Value>([^\n^\s]+(\n){0,1}))) | 48 | (\s)*(?<Value>([^\n^\s]+(\n){0,1}))) |
49 | # value part (surrounding whitespace stripped) | 49 | # value part (surrounding whitespace stripped) |
50 | ", | 50 | ", |
51 | RegexOptions.IgnorePatternWhitespace | | 51 | RegexOptions.IgnorePatternWhitespace | |
52 | RegexOptions.Compiled | | 52 | RegexOptions.Compiled | |
53 | RegexOptions.CultureInvariant); | 53 | RegexOptions.CultureInvariant); |
54 | } | 54 | } |
55 | static private Regex _iniKeyValuePatternRegex; | 55 | static private Regex _iniKeyValuePatternRegex; |
56 | 56 | ||
57 | public IniFile(string iniFileName) | 57 | public IniFile(string iniFileName) |
58 | { | 58 | { |
59 | _iniFileName = iniFileName; | 59 | _iniFileName = iniFileName; |
60 | } | 60 | } |
61 | 61 | ||
62 | public string ParseFileReadValue(string key) | 62 | public string ParseFileReadValue(string key) |
63 | { | 63 | { |
64 | using (StreamReader reader = | 64 | using (StreamReader reader = |
65 | new StreamReader(_iniFileName)) | 65 | new StreamReader(_iniFileName)) |
66 | { | 66 | { |
67 | do | 67 | do |
68 | { | 68 | { |
69 | string line = reader.ReadLine(); | 69 | string line = reader.ReadLine(); |
70 | Match match = | 70 | Match match = |
71 | _iniKeyValuePatternRegex.Match(line); | 71 | _iniKeyValuePatternRegex.Match(line); |
72 | if (match.Success) | 72 | if (match.Success) |
73 | { | 73 | { |
74 | string currentKey = | 74 | string currentKey = |
75 | match.Groups["Key"].Value as string; | 75 | match.Groups["Key"].Value as string; |
76 | if (currentKey != null && | 76 | if (currentKey != null && |
77 | currentKey.Trim().CompareTo(key) == 0) | 77 | currentKey.Trim().CompareTo(key) == 0) |
78 | { | 78 | { |
79 | string value = | 79 | string value = |
80 | match.Groups["Value"].Value as string; | 80 | match.Groups["Value"].Value as string; |
81 | return value; | 81 | return value; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | } | 85 | } |
86 | while (reader.Peek() != -1); | 86 | while (reader.Peek() != -1); |
87 | } | 87 | } |
88 | return null; | 88 | return null; |
89 | } | 89 | } |
90 | 90 | ||
91 | public string IniFileName | 91 | public string IniFileName |
92 | { | 92 | { |
93 | get { return _iniFileName; } | 93 | get { return _iniFileName; } |
94 | } private string _iniFileName; | 94 | } private string _iniFileName; |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs index 7253cc7..f6aeb58 100644 --- a/OpenSim/Framework/Data/InventoryData.cs +++ b/OpenSim/Framework/Data/InventoryData.cs | |||
@@ -1,197 +1,197 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | 30 | ||
31 | namespace OpenSim.Framework.Data | 31 | namespace OpenSim.Framework.Data |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// Inventory Item - contains all the properties associated with an individual inventory piece. | 34 | /// Inventory Item - contains all the properties associated with an individual inventory piece. |
35 | /// </summary> | 35 | /// </summary> |
36 | public class InventoryItemBase | 36 | public class InventoryItemBase |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// A UUID containing the ID for the inventory item itself | 39 | /// A UUID containing the ID for the inventory item itself |
40 | /// </summary> | 40 | /// </summary> |
41 | public LLUUID inventoryID; | 41 | public LLUUID inventoryID; |
42 | /// <summary> | 42 | /// <summary> |
43 | /// The UUID of the associated asset on the asset server | 43 | /// The UUID of the associated asset on the asset server |
44 | /// </summary> | 44 | /// </summary> |
45 | public LLUUID assetID; | 45 | public LLUUID assetID; |
46 | /// <summary> | 46 | /// <summary> |
47 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | 47 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) |
48 | /// </summary> | 48 | /// </summary> |
49 | public int type; | 49 | public int type; |
50 | /// <summary> | 50 | /// <summary> |
51 | /// The folder this item is contained in | 51 | /// The folder this item is contained in |
52 | /// </summary> | 52 | /// </summary> |
53 | public LLUUID parentFolderID; | 53 | public LLUUID parentFolderID; |
54 | /// <summary> | 54 | /// <summary> |
55 | /// The owner of this inventory item | 55 | /// The owner of this inventory item |
56 | /// </summary> | 56 | /// </summary> |
57 | public LLUUID avatarID; | 57 | public LLUUID avatarID; |
58 | /// <summary> | 58 | /// <summary> |
59 | /// The creator of this item | 59 | /// The creator of this item |
60 | /// </summary> | 60 | /// </summary> |
61 | public LLUUID creatorsID; | 61 | public LLUUID creatorsID; |
62 | /// <summary> | 62 | /// <summary> |
63 | /// The name of the inventory item (must be less than 64 characters) | 63 | /// The name of the inventory item (must be less than 64 characters) |
64 | /// </summary> | 64 | /// </summary> |
65 | public string inventoryName; | 65 | public string inventoryName; |
66 | /// <summary> | 66 | /// <summary> |
67 | /// The description of the inventory item (must be less than 64 characters) | 67 | /// The description of the inventory item (must be less than 64 characters) |
68 | /// </summary> | 68 | /// </summary> |
69 | public string inventoryDescription; | 69 | public string inventoryDescription; |
70 | /// <summary> | 70 | /// <summary> |
71 | /// A mask containing the permissions for the next owner (cannot be enforced) | 71 | /// A mask containing the permissions for the next owner (cannot be enforced) |
72 | /// </summary> | 72 | /// </summary> |
73 | public uint inventoryNextPermissions; | 73 | public uint inventoryNextPermissions; |
74 | /// <summary> | 74 | /// <summary> |
75 | /// A mask containing permissions for the current owner (cannot be enforced) | 75 | /// A mask containing permissions for the current owner (cannot be enforced) |
76 | /// </summary> | 76 | /// </summary> |
77 | public uint inventoryCurrentPermissions; | 77 | public uint inventoryCurrentPermissions; |
78 | } | 78 | } |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// A Class for folders which contain users inventory | 81 | /// A Class for folders which contain users inventory |
82 | /// </summary> | 82 | /// </summary> |
83 | public class InventoryFolderBase | 83 | public class InventoryFolderBase |
84 | { | 84 | { |
85 | /// <summary> | 85 | /// <summary> |
86 | /// The name of the folder (64 characters or less) | 86 | /// The name of the folder (64 characters or less) |
87 | /// </summary> | 87 | /// </summary> |
88 | public string name; | 88 | public string name; |
89 | /// <summary> | 89 | /// <summary> |
90 | /// The agent who's inventory this is contained by | 90 | /// The agent who's inventory this is contained by |
91 | /// </summary> | 91 | /// </summary> |
92 | public LLUUID agentID; | 92 | public LLUUID agentID; |
93 | /// <summary> | 93 | /// <summary> |
94 | /// The folder this folder is contained in | 94 | /// The folder this folder is contained in |
95 | /// </summary> | 95 | /// </summary> |
96 | public LLUUID parentID; | 96 | public LLUUID parentID; |
97 | /// <summary> | 97 | /// <summary> |
98 | /// The UUID for this folder | 98 | /// The UUID for this folder |
99 | /// </summary> | 99 | /// </summary> |
100 | public LLUUID folderID; | 100 | public LLUUID folderID; |
101 | /// <summary> | 101 | /// <summary> |
102 | /// Tyep of Items normally stored in this folder | 102 | /// Tyep of Items normally stored in this folder |
103 | /// </summary> | 103 | /// </summary> |
104 | public ushort type; | 104 | public ushort type; |
105 | /// <summary> | 105 | /// <summary> |
106 | /// | 106 | /// |
107 | /// </summary> | 107 | /// </summary> |
108 | public ushort version; | 108 | public ushort version; |
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// An interface for accessing inventory data from a storage server | 112 | /// An interface for accessing inventory data from a storage server |
113 | /// </summary> | 113 | /// </summary> |
114 | public interface IInventoryData | 114 | public interface IInventoryData |
115 | { | 115 | { |
116 | /// <summary> | 116 | /// <summary> |
117 | /// Initialises the interface | 117 | /// Initialises the interface |
118 | /// </summary> | 118 | /// </summary> |
119 | void Initialise(); | 119 | void Initialise(); |
120 | 120 | ||
121 | /// <summary> | 121 | /// <summary> |
122 | /// Closes the interface | 122 | /// Closes the interface |
123 | /// </summary> | 123 | /// </summary> |
124 | void Close(); | 124 | void Close(); |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// The plugin being loaded | 127 | /// The plugin being loaded |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <returns>A string containing the plugin name</returns> | 129 | /// <returns>A string containing the plugin name</returns> |
130 | string getName(); | 130 | string getName(); |
131 | 131 | ||
132 | /// <summary> | 132 | /// <summary> |
133 | /// The plugins version | 133 | /// The plugins version |
134 | /// </summary> | 134 | /// </summary> |
135 | /// <returns>A string containing the plugin version</returns> | 135 | /// <returns>A string containing the plugin version</returns> |
136 | string getVersion(); | 136 | string getVersion(); |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// Returns a list of inventory items contained within the specified folder | 139 | /// Returns a list of inventory items contained within the specified folder |
140 | /// </summary> | 140 | /// </summary> |
141 | /// <param name="folderID">The UUID of the target folder</param> | 141 | /// <param name="folderID">The UUID of the target folder</param> |
142 | /// <returns>A List of InventoryItemBase items</returns> | 142 | /// <returns>A List of InventoryItemBase items</returns> |
143 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); | 143 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); |
144 | 144 | ||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Returns a list of folders in the users inventory root. | 146 | /// Returns a list of folders in the users inventory root. |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | 148 | /// <param name="user">The UUID of the user who is having inventory being returned</param> |
149 | /// <returns>A list of folders</returns> | 149 | /// <returns>A list of folders</returns> |
150 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); | 150 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// Returns a list of inventory folders contained in the folder 'parentID' | 153 | /// Returns a list of inventory folders contained in the folder 'parentID' |
154 | /// </summary> | 154 | /// </summary> |
155 | /// <param name="parentID">The folder to get subfolders for</param> | 155 | /// <param name="parentID">The folder to get subfolders for</param> |
156 | /// <returns>A list of inventory folders</returns> | 156 | /// <returns>A list of inventory folders</returns> |
157 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); | 157 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); |
158 | 158 | ||
159 | /// <summary> | 159 | /// <summary> |
160 | /// Returns an inventory item by its UUID | 160 | /// Returns an inventory item by its UUID |
161 | /// </summary> | 161 | /// </summary> |
162 | /// <param name="item">The UUID of the item to be returned</param> | 162 | /// <param name="item">The UUID of the item to be returned</param> |
163 | /// <returns>A class containing item information</returns> | 163 | /// <returns>A class containing item information</returns> |
164 | InventoryItemBase getInventoryItem(LLUUID item); | 164 | InventoryItemBase getInventoryItem(LLUUID item); |
165 | 165 | ||
166 | /// <summary> | 166 | /// <summary> |
167 | /// Returns a specified inventory folder by its UUID | 167 | /// Returns a specified inventory folder by its UUID |
168 | /// </summary> | 168 | /// </summary> |
169 | /// <param name="folder">The UUID of the folder to be returned</param> | 169 | /// <param name="folder">The UUID of the folder to be returned</param> |
170 | /// <returns>A class containing folder information</returns> | 170 | /// <returns>A class containing folder information</returns> |
171 | InventoryFolderBase getInventoryFolder(LLUUID folder); | 171 | InventoryFolderBase getInventoryFolder(LLUUID folder); |
172 | 172 | ||
173 | /// <summary> | 173 | /// <summary> |
174 | /// Creates a new inventory item based on item | 174 | /// Creates a new inventory item based on item |
175 | /// </summary> | 175 | /// </summary> |
176 | /// <param name="item">The item to be created</param> | 176 | /// <param name="item">The item to be created</param> |
177 | void addInventoryItem(InventoryItemBase item); | 177 | void addInventoryItem(InventoryItemBase item); |
178 | 178 | ||
179 | /// <summary> | 179 | /// <summary> |
180 | /// Updates an inventory item with item (updates based on ID) | 180 | /// Updates an inventory item with item (updates based on ID) |
181 | /// </summary> | 181 | /// </summary> |
182 | /// <param name="item">The updated item</param> | 182 | /// <param name="item">The updated item</param> |
183 | void updateInventoryItem(InventoryItemBase item); | 183 | void updateInventoryItem(InventoryItemBase item); |
184 | 184 | ||
185 | /// <summary> | 185 | /// <summary> |
186 | /// Adds a new folder specified by folder | 186 | /// Adds a new folder specified by folder |
187 | /// </summary> | 187 | /// </summary> |
188 | /// <param name="folder">The inventory folder</param> | 188 | /// <param name="folder">The inventory folder</param> |
189 | void addInventoryFolder(InventoryFolderBase folder); | 189 | void addInventoryFolder(InventoryFolderBase folder); |
190 | 190 | ||
191 | /// <summary> | 191 | /// <summary> |
192 | /// Updates a folder based on its ID with folder | 192 | /// Updates a folder based on its ID with folder |
193 | /// </summary> | 193 | /// </summary> |
194 | /// <param name="folder">The inventory folder</param> | 194 | /// <param name="folder">The inventory folder</param> |
195 | void updateInventoryFolder(InventoryFolderBase folder); | 195 | void updateInventoryFolder(InventoryFolderBase folder); |
196 | } | 196 | } |
197 | } | 197 | } |
diff --git a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs index f9260a1..556d589 100644 --- a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | // General Information about an assembly is controlled through the following | 3 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 4 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 5 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data")] | 6 | [assembly: AssemblyTitle("OpenSim.Framework.Data")] |
7 | [assembly: AssemblyDescription("")] | 7 | [assembly: AssemblyDescription("")] |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyConfiguration("")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyCompany("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data")] | 10 | [assembly: AssemblyProduct("OpenSim.Framework.Data")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCopyright("Copyright © 2007")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyTrademark("")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCulture("")] |
14 | 14 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 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 | 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. | 17 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 18 | [assembly: ComVisible(false)] |
19 | 19 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 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")] | 21 | [assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] |
22 | 22 | ||
23 | // Version information for an assembly consists of the following four values: | 23 | // Version information for an assembly consists of the following four values: |
24 | // | 24 | // |
25 | // Major Version | 25 | // Major Version |
26 | // Minor Version | 26 | // Minor Version |
27 | // Build Number | 27 | // Build Number |
28 | // Revision | 28 | // Revision |
29 | // | 29 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 30 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 31 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("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 index 0078df0..8344d6c 100644 --- a/OpenSim/Framework/Data/ReservationData.cs +++ b/OpenSim/Framework/Data/ReservationData.cs | |||
@@ -1,47 +1,47 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Framework.Data | 30 | namespace OpenSim.Framework.Data |
31 | { | 31 | { |
32 | public class ReservationData | 32 | public class ReservationData |
33 | { | 33 | { |
34 | public LLUUID userUUID = new LLUUID(); | 34 | public LLUUID userUUID = new LLUUID(); |
35 | public int reservationMinX = 0; | 35 | public int reservationMinX = 0; |
36 | public int reservationMinY = 0; | 36 | public int reservationMinY = 0; |
37 | public int reservationMaxX = 65536; | 37 | public int reservationMaxX = 65536; |
38 | public int reservationMaxY = 65536; | 38 | public int reservationMaxY = 65536; |
39 | 39 | ||
40 | public string reservationName = ""; | 40 | public string reservationName = ""; |
41 | public string reservationCompany = ""; | 41 | public string reservationCompany = ""; |
42 | public bool status = true; | 42 | public bool status = true; |
43 | 43 | ||
44 | public string gridSendKey = ""; | 44 | public string gridSendKey = ""; |
45 | public string gridRecvKey = ""; | 45 | public string gridRecvKey = ""; |
46 | } | 46 | } |
47 | } | 47 | } |
diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs index b920cab..c963455 100644 --- a/OpenSim/Framework/Data/SimProfileData.cs +++ b/OpenSim/Framework/Data/SimProfileData.cs | |||
@@ -1,192 +1,192 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using Nwc.XmlRpc; | 29 | using Nwc.XmlRpc; |
30 | 30 | ||
31 | using System; | 31 | using System; |
32 | using System.Collections; | 32 | using System.Collections; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Data | 34 | namespace OpenSim.Framework.Data |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// A class which contains information known to the grid server about a region | 37 | /// A class which contains information known to the grid server about a region |
38 | /// </summary> | 38 | /// </summary> |
39 | public class SimProfileData | 39 | public class SimProfileData |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// The name of the region | 42 | /// The name of the region |
43 | /// </summary> | 43 | /// </summary> |
44 | public string regionName = ""; | 44 | public string regionName = ""; |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// A 64-bit number combining map position into a (mostly) unique ID | 47 | /// A 64-bit number combining map position into a (mostly) unique ID |
48 | /// </summary> | 48 | /// </summary> |
49 | public ulong regionHandle; | 49 | public ulong regionHandle; |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// OGS/OpenSim Specific ID for a region | 52 | /// OGS/OpenSim Specific ID for a region |
53 | /// </summary> | 53 | /// </summary> |
54 | public LLUUID UUID; | 54 | public LLUUID UUID; |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Coordinates of the region | 57 | /// Coordinates of the region |
58 | /// </summary> | 58 | /// </summary> |
59 | public uint regionLocX; | 59 | public uint regionLocX; |
60 | public uint regionLocY; | 60 | public uint regionLocY; |
61 | public uint regionLocZ; // Reserved (round-robin, layers, etc) | 61 | public uint regionLocZ; // Reserved (round-robin, layers, etc) |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// Authentication secrets | 64 | /// Authentication secrets |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <remarks>Not very secure, needs improvement.</remarks> | 66 | /// <remarks>Not very secure, needs improvement.</remarks> |
67 | public string regionSendKey = ""; | 67 | public string regionSendKey = ""; |
68 | public string regionRecvKey = ""; | 68 | public string regionRecvKey = ""; |
69 | public string regionSecret = ""; | 69 | public string regionSecret = ""; |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Whether the region is online | 72 | /// Whether the region is online |
73 | /// </summary> | 73 | /// </summary> |
74 | public bool regionOnline; | 74 | public bool regionOnline; |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Information about the server that the region is currently hosted on | 77 | /// Information about the server that the region is currently hosted on |
78 | /// </summary> | 78 | /// </summary> |
79 | public string serverIP = ""; | 79 | public string serverIP = ""; |
80 | public uint serverPort; | 80 | public uint serverPort; |
81 | public string serverURI = ""; | 81 | public string serverURI = ""; |
82 | 82 | ||
83 | public uint httpPort; | 83 | public uint httpPort; |
84 | public uint remotingPort; | 84 | public uint remotingPort; |
85 | public string httpServerURI = ""; | 85 | public string httpServerURI = ""; |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. | 88 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. |
89 | /// </summary> | 89 | /// </summary> |
90 | public ulong regionNorthOverrideHandle; | 90 | public ulong regionNorthOverrideHandle; |
91 | public ulong regionSouthOverrideHandle; | 91 | public ulong regionSouthOverrideHandle; |
92 | public ulong regionEastOverrideHandle; | 92 | public ulong regionEastOverrideHandle; |
93 | public ulong regionWestOverrideHandle; | 93 | public ulong regionWestOverrideHandle; |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// Optional: URI Location of the region database | 96 | /// Optional: URI Location of the region database |
97 | /// </summary> | 97 | /// </summary> |
98 | /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> | 98 | /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> |
99 | public string regionDataURI = ""; | 99 | public string regionDataURI = ""; |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Region Asset Details | 102 | /// Region Asset Details |
103 | /// </summary> | 103 | /// </summary> |
104 | public string regionAssetURI = ""; | 104 | public string regionAssetURI = ""; |
105 | public string regionAssetSendKey = ""; | 105 | public string regionAssetSendKey = ""; |
106 | public string regionAssetRecvKey = ""; | 106 | public string regionAssetRecvKey = ""; |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
109 | /// Region Userserver Details | 109 | /// Region Userserver Details |
110 | /// </summary> | 110 | /// </summary> |
111 | public string regionUserURI = ""; | 111 | public string regionUserURI = ""; |
112 | public string regionUserSendKey = ""; | 112 | public string regionUserSendKey = ""; |
113 | public string regionUserRecvKey = ""; | 113 | public string regionUserRecvKey = ""; |
114 | 114 | ||
115 | /// <summary> | 115 | /// <summary> |
116 | /// Region Map Texture Asset | 116 | /// Region Map Texture Asset |
117 | /// </summary> | 117 | /// </summary> |
118 | public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 118 | public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Get Sim profile data from grid server when in grid mode | 121 | /// Get Sim profile data from grid server when in grid mode |
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="region_uuid"></param> | 123 | /// <param name="region_uuid"></param> |
124 | /// <param name="gridserver_url"></param> | 124 | /// <param name="gridserver_url"></param> |
125 | /// <param name="?"></param> | 125 | /// <param name="?"></param> |
126 | /// <returns></returns> | 126 | /// <returns></returns> |
127 | public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) | 127 | public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) |
128 | { | 128 | { |
129 | Hashtable requestData = new Hashtable(); | 129 | Hashtable requestData = new Hashtable(); |
130 | requestData["region_uuid"] = region_uuid.UUID.ToString(); | 130 | requestData["region_uuid"] = region_uuid.UUID.ToString(); |
131 | requestData["authkey"] = gridserver_sendkey; | 131 | requestData["authkey"] = gridserver_sendkey; |
132 | ArrayList SendParams = new ArrayList(); | 132 | ArrayList SendParams = new ArrayList(); |
133 | SendParams.Add(requestData); | 133 | SendParams.Add(requestData); |
134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
135 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 135 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); |
136 | 136 | ||
137 | Hashtable responseData = (Hashtable)GridResp.Value; | 137 | Hashtable responseData = (Hashtable)GridResp.Value; |
138 | 138 | ||
139 | if (responseData.ContainsKey("error")) | 139 | if (responseData.ContainsKey("error")) |
140 | { | 140 | { |
141 | return null; | 141 | return null; |
142 | } | 142 | } |
143 | 143 | ||
144 | SimProfileData simData = new SimProfileData(); | 144 | SimProfileData simData = new SimProfileData(); |
145 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | 145 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); |
146 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | 146 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); |
147 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); | 147 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); |
148 | simData.serverIP = (string)responseData["sim_ip"]; | 148 | simData.serverIP = (string)responseData["sim_ip"]; |
149 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | 149 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); |
150 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | 150 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); |
151 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 151 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
152 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 152 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; |
153 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 153 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
154 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | 154 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); |
155 | simData.regionName = (string)responseData["region_name"]; | 155 | simData.regionName = (string)responseData["region_name"]; |
156 | 156 | ||
157 | return simData; | 157 | return simData; |
158 | } | 158 | } |
159 | public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) | 159 | public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) |
160 | { | 160 | { |
161 | Hashtable requestData = new Hashtable(); | 161 | Hashtable requestData = new Hashtable(); |
162 | requestData["region_handle"] = region_handle.ToString(); | 162 | requestData["region_handle"] = region_handle.ToString(); |
163 | requestData["authkey"] = gridserver_sendkey; | 163 | requestData["authkey"] = gridserver_sendkey; |
164 | ArrayList SendParams = new ArrayList(); | 164 | ArrayList SendParams = new ArrayList(); |
165 | SendParams.Add(requestData); | 165 | SendParams.Add(requestData); |
166 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 166 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
167 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 167 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); |
168 | 168 | ||
169 | Hashtable responseData = (Hashtable)GridResp.Value; | 169 | Hashtable responseData = (Hashtable)GridResp.Value; |
170 | 170 | ||
171 | if (responseData.ContainsKey("error")) | 171 | if (responseData.ContainsKey("error")) |
172 | { | 172 | { |
173 | return null; | 173 | return null; |
174 | } | 174 | } |
175 | 175 | ||
176 | SimProfileData simData = new SimProfileData(); | 176 | SimProfileData simData = new SimProfileData(); |
177 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | 177 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); |
178 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | 178 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); |
179 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); | 179 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); |
180 | simData.serverIP = (string)responseData["sim_ip"]; | 180 | simData.serverIP = (string)responseData["sim_ip"]; |
181 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | 181 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); |
182 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | 182 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); |
183 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 183 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
184 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 184 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
185 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 185 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; |
186 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | 186 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); |
187 | simData.regionName = (string)responseData["region_name"]; | 187 | simData.regionName = (string)responseData["region_name"]; |
188 | 188 | ||
189 | return simData; | 189 | return simData; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |
diff --git a/OpenSim/Framework/Data/UserData.cs b/OpenSim/Framework/Data/UserData.cs index c65f9fd..d849e12 100644 --- a/OpenSim/Framework/Data/UserData.cs +++ b/OpenSim/Framework/Data/UserData.cs | |||
@@ -1,128 +1,128 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Framework.Data | 30 | namespace OpenSim.Framework.Data |
31 | { | 31 | { |
32 | /// <summary> | 32 | /// <summary> |
33 | /// An interface for connecting to user storage servers. | 33 | /// An interface for connecting to user storage servers. |
34 | /// </summary> | 34 | /// </summary> |
35 | public interface IUserData | 35 | public interface IUserData |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Returns a user profile from a database via their UUID | 38 | /// Returns a user profile from a database via their UUID |
39 | /// </summary> | 39 | /// </summary> |
40 | /// <param name="user">The accounts UUID</param> | 40 | /// <param name="user">The accounts UUID</param> |
41 | /// <returns>The user data profile</returns> | 41 | /// <returns>The user data profile</returns> |
42 | UserProfileData getUserByUUID(LLUUID user); | 42 | UserProfileData getUserByUUID(LLUUID user); |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Returns a users profile by searching their username | 45 | /// Returns a users profile by searching their username |
46 | /// </summary> | 46 | /// </summary> |
47 | /// <param name="name">The users username</param> | 47 | /// <param name="name">The users username</param> |
48 | /// <returns>The user data profile</returns> | 48 | /// <returns>The user data profile</returns> |
49 | UserProfileData getUserByName(string name); | 49 | UserProfileData getUserByName(string name); |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// Returns a users profile by searching their username parts | 52 | /// Returns a users profile by searching their username parts |
53 | /// </summary> | 53 | /// </summary> |
54 | /// <param name="fname">Account firstname</param> | 54 | /// <param name="fname">Account firstname</param> |
55 | /// <param name="lname">Account lastname</param> | 55 | /// <param name="lname">Account lastname</param> |
56 | /// <returns>The user data profile</returns> | 56 | /// <returns>The user data profile</returns> |
57 | UserProfileData getUserByName(string fname, string lname); | 57 | UserProfileData getUserByName(string fname, string lname); |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Returns the current agent for a user searching by it's UUID | 60 | /// Returns the current agent for a user searching by it's UUID |
61 | /// </summary> | 61 | /// </summary> |
62 | /// <param name="user">The users UUID</param> | 62 | /// <param name="user">The users UUID</param> |
63 | /// <returns>The current agent session</returns> | 63 | /// <returns>The current agent session</returns> |
64 | UserAgentData getAgentByUUID(LLUUID user); | 64 | UserAgentData getAgentByUUID(LLUUID user); |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Returns the current session agent for a user searching by username | 67 | /// Returns the current session agent for a user searching by username |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="name">The users account name</param> | 69 | /// <param name="name">The users account name</param> |
70 | /// <returns>The current agent session</returns> | 70 | /// <returns>The current agent session</returns> |
71 | UserAgentData getAgentByName(string name); | 71 | UserAgentData getAgentByName(string name); |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Returns the current session agent for a user searching by username parts | 74 | /// Returns the current session agent for a user searching by username parts |
75 | /// </summary> | 75 | /// </summary> |
76 | /// <param name="fname">The users first account name</param> | 76 | /// <param name="fname">The users first account name</param> |
77 | /// <param name="lname">The users account surname</param> | 77 | /// <param name="lname">The users account surname</param> |
78 | /// <returns>The current agent session</returns> | 78 | /// <returns>The current agent session</returns> |
79 | UserAgentData getAgentByName(string fname, string lname); | 79 | UserAgentData getAgentByName(string fname, string lname); |
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// Adds a new User profile to the database | 82 | /// Adds a new User profile to the database |
83 | /// </summary> | 83 | /// </summary> |
84 | /// <param name="user">UserProfile to add</param> | 84 | /// <param name="user">UserProfile to add</param> |
85 | void addNewUserProfile(UserProfileData user); | 85 | void addNewUserProfile(UserProfileData user); |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Adds a new agent to the database | 88 | /// Adds a new agent to the database |
89 | /// </summary> | 89 | /// </summary> |
90 | /// <param name="agent">The agent to add</param> | 90 | /// <param name="agent">The agent to add</param> |
91 | void addNewUserAgent(UserAgentData agent); | 91 | void addNewUserAgent(UserAgentData agent); |
92 | 92 | ||
93 | /// <summary> | 93 | /// <summary> |
94 | /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) | 94 | /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) |
95 | /// </summary> | 95 | /// </summary> |
96 | /// <param name="from">The account to transfer from</param> | 96 | /// <param name="from">The account to transfer from</param> |
97 | /// <param name="to">The account to transfer to</param> | 97 | /// <param name="to">The account to transfer to</param> |
98 | /// <param name="amount">The amount to transfer</param> | 98 | /// <param name="amount">The amount to transfer</param> |
99 | /// <returns>Successful?</returns> | 99 | /// <returns>Successful?</returns> |
100 | bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); | 100 | bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. | 103 | /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. |
104 | /// </summary> | 104 | /// </summary> |
105 | /// <param name="from">User to transfer from</param> | 105 | /// <param name="from">User to transfer from</param> |
106 | /// <param name="to">User to transfer to</param> | 106 | /// <param name="to">User to transfer to</param> |
107 | /// <param name="inventory">Specified inventory item</param> | 107 | /// <param name="inventory">Specified inventory item</param> |
108 | /// <returns>Successful?</returns> | 108 | /// <returns>Successful?</returns> |
109 | bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); | 109 | bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Returns the plugin version | 112 | /// Returns the plugin version |
113 | /// </summary> | 113 | /// </summary> |
114 | /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns> | 114 | /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns> |
115 | string getVersion(); | 115 | string getVersion(); |
116 | 116 | ||
117 | /// <summary> | 117 | /// <summary> |
118 | /// Returns the plugin name | 118 | /// Returns the plugin name |
119 | /// </summary> | 119 | /// </summary> |
120 | /// <returns>Plugin name, eg MySQL User Provider</returns> | 120 | /// <returns>Plugin name, eg MySQL User Provider</returns> |
121 | string getName(); | 121 | string getName(); |
122 | 122 | ||
123 | /// <summary> | 123 | /// <summary> |
124 | /// Initialises the plugin (artificial constructor) | 124 | /// Initialises the plugin (artificial constructor) |
125 | /// </summary> | 125 | /// </summary> |
126 | void Initialise(); | 126 | void Initialise(); |
127 | } | 127 | } |
128 | } | 128 | } |
diff --git a/OpenSim/Framework/Data/UserProfileData.cs b/OpenSim/Framework/Data/UserProfileData.cs index bb7d48c..88f956f 100644 --- a/OpenSim/Framework/Data/UserProfileData.cs +++ b/OpenSim/Framework/Data/UserProfileData.cs | |||
@@ -1,180 +1,180 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | 30 | ||
31 | namespace OpenSim.Framework.Data | 31 | namespace OpenSim.Framework.Data |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// Information about a particular user known to the userserver | 34 | /// Information about a particular user known to the userserver |
35 | /// </summary> | 35 | /// </summary> |
36 | public class UserProfileData | 36 | public class UserProfileData |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// The ID value for this user | 39 | /// The ID value for this user |
40 | /// </summary> | 40 | /// </summary> |
41 | public LLUUID UUID; | 41 | public LLUUID UUID; |
42 | 42 | ||
43 | /// <summary> | 43 | /// <summary> |
44 | /// The first component of a users account name | 44 | /// The first component of a users account name |
45 | /// </summary> | 45 | /// </summary> |
46 | public string username; | 46 | public string username; |
47 | /// <summary> | 47 | /// <summary> |
48 | /// The second component of a users account name | 48 | /// The second component of a users account name |
49 | /// </summary> | 49 | /// </summary> |
50 | public string surname; | 50 | public string surname; |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) | 53 | /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> | 55 | /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> |
56 | public string passwordHash; | 56 | public string passwordHash; |
57 | /// <summary> | 57 | /// <summary> |
58 | /// The salt used for the users hash, should be 32 bytes or longer | 58 | /// The salt used for the users hash, should be 32 bytes or longer |
59 | /// </summary> | 59 | /// </summary> |
60 | public string passwordSalt; | 60 | public string passwordSalt; |
61 | 61 | ||
62 | /// <summary> | 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 | 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> | 64 | /// </summary> |
65 | public ulong homeRegion; | 65 | public ulong homeRegion; |
66 | /// <summary> | 66 | /// <summary> |
67 | /// The coordinates inside the region of the home location | 67 | /// The coordinates inside the region of the home location |
68 | /// </summary> | 68 | /// </summary> |
69 | public LLVector3 homeLocation; | 69 | public LLVector3 homeLocation; |
70 | /// <summary> | 70 | /// <summary> |
71 | /// Where the user will be looking when they rez. | 71 | /// Where the user will be looking when they rez. |
72 | /// </summary> | 72 | /// </summary> |
73 | public LLVector3 homeLookAt; | 73 | public LLVector3 homeLookAt; |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// A UNIX Timestamp (seconds since epoch) for the users creation | 76 | /// A UNIX Timestamp (seconds since epoch) for the users creation |
77 | /// </summary> | 77 | /// </summary> |
78 | public int created; | 78 | public int created; |
79 | /// <summary> | 79 | /// <summary> |
80 | /// A UNIX Timestamp for the users last login date / time | 80 | /// A UNIX Timestamp for the users last login date / time |
81 | /// </summary> | 81 | /// </summary> |
82 | public int lastLogin; | 82 | public int lastLogin; |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// A URI to the users inventory server, used for foreigners and large grids | 85 | /// A URI to the users inventory server, used for foreigners and large grids |
86 | /// </summary> | 86 | /// </summary> |
87 | public string userInventoryURI; | 87 | public string userInventoryURI; |
88 | /// <summary> | 88 | /// <summary> |
89 | /// A URI to the users asset server, used for foreigners and large grids. | 89 | /// A URI to the users asset server, used for foreigners and large grids. |
90 | /// </summary> | 90 | /// </summary> |
91 | public string userAssetURI; | 91 | public string userAssetURI; |
92 | 92 | ||
93 | /// <summary> | 93 | /// <summary> |
94 | /// A uint mask containing the "I can do" fields of the users profile | 94 | /// A uint mask containing the "I can do" fields of the users profile |
95 | /// </summary> | 95 | /// </summary> |
96 | public uint profileCanDoMask; | 96 | public uint profileCanDoMask; |
97 | /// <summary> | 97 | /// <summary> |
98 | /// A uint mask containing the "I want to do" part of the users profile | 98 | /// A uint mask containing the "I want to do" part of the users profile |
99 | /// </summary> | 99 | /// </summary> |
100 | public uint profileWantDoMask; // Profile window "I want to" mask | 100 | public uint profileWantDoMask; // Profile window "I want to" mask |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// The about text listed in a users profile. | 103 | /// The about text listed in a users profile. |
104 | /// </summary> | 104 | /// </summary> |
105 | public string profileAboutText; | 105 | public string profileAboutText; |
106 | /// <summary> | 106 | /// <summary> |
107 | /// The first life about text listed in a users profile | 107 | /// The first life about text listed in a users profile |
108 | /// </summary> | 108 | /// </summary> |
109 | public string profileFirstText; | 109 | public string profileFirstText; |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// The profile image for an avatar stored on the asset server | 112 | /// The profile image for an avatar stored on the asset server |
113 | /// </summary> | 113 | /// </summary> |
114 | public LLUUID profileImage; | 114 | public LLUUID profileImage; |
115 | /// <summary> | 115 | /// <summary> |
116 | /// The profile image for the users first life tab | 116 | /// The profile image for the users first life tab |
117 | /// </summary> | 117 | /// </summary> |
118 | public LLUUID profileFirstImage; | 118 | public LLUUID profileFirstImage; |
119 | /// <summary> | 119 | /// <summary> |
120 | /// The users last registered agent (filled in on the user server) | 120 | /// The users last registered agent (filled in on the user server) |
121 | /// </summary> | 121 | /// </summary> |
122 | public UserAgentData currentAgent; | 122 | public UserAgentData currentAgent; |
123 | } | 123 | } |
124 | 124 | ||
125 | /// <summary> | 125 | /// <summary> |
126 | /// Information about a users session | 126 | /// Information about a users session |
127 | /// </summary> | 127 | /// </summary> |
128 | public class UserAgentData | 128 | public class UserAgentData |
129 | { | 129 | { |
130 | /// <summary> | 130 | /// <summary> |
131 | /// The UUID of the users avatar (not the agent!) | 131 | /// The UUID of the users avatar (not the agent!) |
132 | /// </summary> | 132 | /// </summary> |
133 | public LLUUID UUID; | 133 | public LLUUID UUID; |
134 | /// <summary> | 134 | /// <summary> |
135 | /// The IP address of the user | 135 | /// The IP address of the user |
136 | /// </summary> | 136 | /// </summary> |
137 | public string agentIP = String.Empty; | 137 | public string agentIP = String.Empty; |
138 | /// <summary> | 138 | /// <summary> |
139 | /// The port of the user | 139 | /// The port of the user |
140 | /// </summary> | 140 | /// </summary> |
141 | public uint agentPort; | 141 | public uint agentPort; |
142 | /// <summary> | 142 | /// <summary> |
143 | /// Is the user online? | 143 | /// Is the user online? |
144 | /// </summary> | 144 | /// </summary> |
145 | public bool agentOnline; | 145 | public bool agentOnline; |
146 | /// <summary> | 146 | /// <summary> |
147 | /// The session ID for the user (also the agent ID) | 147 | /// The session ID for the user (also the agent ID) |
148 | /// </summary> | 148 | /// </summary> |
149 | public LLUUID sessionID; | 149 | public LLUUID sessionID; |
150 | /// <summary> | 150 | /// <summary> |
151 | /// The "secure" session ID for the user | 151 | /// The "secure" session ID for the user |
152 | /// </summary> | 152 | /// </summary> |
153 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> | 153 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> |
154 | public LLUUID secureSessionID; | 154 | public LLUUID secureSessionID; |
155 | /// <summary> | 155 | /// <summary> |
156 | /// The region the user logged into initially | 156 | /// The region the user logged into initially |
157 | /// </summary> | 157 | /// </summary> |
158 | public LLUUID regionID; | 158 | public LLUUID regionID; |
159 | /// <summary> | 159 | /// <summary> |
160 | /// A unix timestamp from when the user logged in | 160 | /// A unix timestamp from when the user logged in |
161 | /// </summary> | 161 | /// </summary> |
162 | public int loginTime; | 162 | public int loginTime; |
163 | /// <summary> | 163 | /// <summary> |
164 | /// When this agent expired and logged out, 0 if still online | 164 | /// When this agent expired and logged out, 0 if still online |
165 | /// </summary> | 165 | /// </summary> |
166 | public int logoutTime; | 166 | public int logoutTime; |
167 | /// <summary> | 167 | /// <summary> |
168 | /// Current region the user is logged into | 168 | /// Current region the user is logged into |
169 | /// </summary> | 169 | /// </summary> |
170 | public LLUUID currentRegion; | 170 | public LLUUID currentRegion; |
171 | /// <summary> | 171 | /// <summary> |
172 | /// Region handle of the current region the user is in | 172 | /// Region handle of the current region the user is in |
173 | /// </summary> | 173 | /// </summary> |
174 | public ulong currentHandle; | 174 | public ulong currentHandle; |
175 | /// <summary> | 175 | /// <summary> |
176 | /// The position of the user within the region | 176 | /// The position of the user within the region |
177 | /// </summary> | 177 | /// </summary> |
178 | public LLVector3 currentPos; | 178 | public LLVector3 currentPos; |
179 | } | 179 | } |
180 | } | 180 | } |