diff options
Diffstat (limited to 'OpenSim/Services/Interfaces')
28 files changed, 3354 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IAgentPreferencesService.cs b/OpenSim/Services/Interfaces/IAgentPreferencesService.cs new file mode 100644 index 0000000..3b4fda2 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAgentPreferencesService.cs | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public class AgentPrefs | ||
35 | { | ||
36 | public AgentPrefs(UUID principalID) | ||
37 | { | ||
38 | PrincipalID = principalID; | ||
39 | } | ||
40 | |||
41 | public AgentPrefs(Dictionary<string, string> kvp) | ||
42 | { | ||
43 | if (kvp.ContainsKey("PrincipalID")) | ||
44 | UUID.TryParse(kvp["PrincipalID"], out PrincipalID); | ||
45 | if (kvp.ContainsKey("AccessPrefs")) | ||
46 | AccessPrefs = kvp["AccessPrefs"]; | ||
47 | if (kvp.ContainsKey("HoverHeight")) | ||
48 | HoverHeight = double.Parse(kvp["HoverHeight"]); | ||
49 | if (kvp.ContainsKey("Language")) | ||
50 | Language = kvp["Language"]; | ||
51 | if (kvp.ContainsKey("LanguageIsPublic")) | ||
52 | LanguageIsPublic = bool.Parse(kvp["LanguageIsPublic"]); | ||
53 | if (kvp.ContainsKey("PermEveryone")) | ||
54 | PermEveryone = int.Parse(kvp["PermEveryone"]); | ||
55 | if (kvp.ContainsKey("PermGroup")) | ||
56 | PermGroup = int.Parse(kvp["PermGroup"]); | ||
57 | if (kvp.ContainsKey("PermNextOwner")) | ||
58 | PermNextOwner = int.Parse(kvp["PermNextOwner"]); | ||
59 | } | ||
60 | |||
61 | public AgentPrefs(Dictionary<string, object> kvp) | ||
62 | { | ||
63 | if (kvp.ContainsKey("PrincipalID")) | ||
64 | UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); | ||
65 | if (kvp.ContainsKey("AccessPrefs")) | ||
66 | AccessPrefs = kvp["AccessPrefs"].ToString(); | ||
67 | if (kvp.ContainsKey("HoverHeight")) | ||
68 | HoverHeight = double.Parse(kvp["HoverHeight"].ToString()); | ||
69 | if (kvp.ContainsKey("Language")) | ||
70 | Language = kvp["Language"].ToString(); | ||
71 | if (kvp.ContainsKey("LanguageIsPublic")) | ||
72 | LanguageIsPublic = bool.Parse(kvp["LanguageIsPublic"].ToString()); | ||
73 | if (kvp.ContainsKey("PermEveryone")) | ||
74 | PermEveryone = int.Parse(kvp["PermEveryone"].ToString()); | ||
75 | if (kvp.ContainsKey("PermGroup")) | ||
76 | PermGroup = int.Parse(kvp["PermGroup"].ToString()); | ||
77 | if (kvp.ContainsKey("PermNextOwner")) | ||
78 | PermNextOwner = int.Parse(kvp["PermNextOwner"].ToString()); | ||
79 | } | ||
80 | |||
81 | public Dictionary<string, object> ToKeyValuePairs() | ||
82 | { | ||
83 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
84 | result["PrincipalID"] = PrincipalID.ToString(); | ||
85 | result["AccessPrefs"] = AccessPrefs.ToString(); | ||
86 | result["HoverHeight"] = HoverHeight.ToString(); | ||
87 | result["Language"] = Language.ToString(); | ||
88 | result["LanguageIsPublic"] = LanguageIsPublic.ToString(); | ||
89 | result["PermEveryone"] = PermEveryone.ToString(); | ||
90 | result["PermGroup"] = PermGroup.ToString(); | ||
91 | result["PermNextOwner"] = PermNextOwner.ToString(); | ||
92 | return result; | ||
93 | } | ||
94 | |||
95 | public UUID PrincipalID = UUID.Zero; | ||
96 | public string AccessPrefs = "M"; | ||
97 | //public int GodLevel; // *TODO: Implement GodLevel (Unused by the viewer, afaict - 6/11/2015) | ||
98 | public double HoverHeight = 0.0; | ||
99 | public string Language = "en-us"; | ||
100 | public bool LanguageIsPublic = true; | ||
101 | // DefaultObjectPermMasks | ||
102 | public int PermEveryone = 0; | ||
103 | public int PermGroup = 0; | ||
104 | public int PermNextOwner = 532480; | ||
105 | } | ||
106 | |||
107 | public interface IAgentPreferencesService | ||
108 | { | ||
109 | AgentPrefs GetAgentPreferences(UUID principalID); | ||
110 | bool StoreAgentPreferences(AgentPrefs data); | ||
111 | |||
112 | string GetLang(UUID principalID); | ||
113 | } | ||
114 | } | ||
115 | |||
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs new file mode 100644 index 0000000..28c3315 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAssetService.cs | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Services.Interfaces | ||
32 | { | ||
33 | public delegate void AssetRetrieved(string id, Object sender, AssetBase asset); | ||
34 | |||
35 | public interface IAssetService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Get an asset synchronously. | ||
39 | /// </summary> | ||
40 | /// <param name="id"></param> | ||
41 | /// <returns></returns> | ||
42 | AssetBase Get(string id); | ||
43 | |||
44 | /// <summary> | ||
45 | /// Get an asset's metadata | ||
46 | /// </summary> | ||
47 | /// <param name="id"></param> | ||
48 | /// <returns></returns> | ||
49 | AssetMetadata GetMetadata(string id); | ||
50 | |||
51 | /// <summary> | ||
52 | /// Get an asset's data, ignoring the metadata. | ||
53 | /// </summary> | ||
54 | /// <param name="id"></param> | ||
55 | /// <returns>null if there is no such asset</returns> | ||
56 | byte[] GetData(string id); | ||
57 | |||
58 | /// <summary> | ||
59 | /// Synchronously fetches an asset from the local cache only. | ||
60 | /// </summary> | ||
61 | /// <param name="id">Asset ID</param> | ||
62 | /// <returns>The fetched asset, or null if it did not exist in the local cache</returns> | ||
63 | AssetBase GetCached(string id); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Get an asset synchronously or asynchronously (depending on whether | ||
67 | /// it is locally cached) and fire a callback with the fetched asset | ||
68 | /// </summary> | ||
69 | /// <param name="id">The asset id</param> | ||
70 | /// <param name="sender">Represents the requester. Passed back via the handler</param> | ||
71 | /// <param name="handler"> | ||
72 | /// The handler to call back once the asset has been retrieved. This will be called back with a null AssetBase | ||
73 | /// if the asset could not be found for some reason (e.g. if it does not exist, if a remote asset service | ||
74 | /// was not contactable, if it is not in the database, etc.). | ||
75 | /// </param> | ||
76 | /// <returns>True if the id was parseable, false otherwise</returns> | ||
77 | bool Get(string id, Object sender, AssetRetrieved handler); | ||
78 | |||
79 | /// <summary> | ||
80 | /// Check if assets exist in the database. | ||
81 | /// </summary> | ||
82 | /// <param name="ids">The assets' IDs</param> | ||
83 | /// <returns>For each asset: true if it exists, false otherwise</returns> | ||
84 | bool[] AssetsExist(string[] ids); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Creates a new asset | ||
88 | /// </summary> | ||
89 | /// <remarks> | ||
90 | /// Returns a random ID if none is passed via the asset argument. | ||
91 | /// </remarks> | ||
92 | /// <param name="asset"></param> | ||
93 | /// <returns>The Asset ID, or string.Empty if an error occurred</returns> | ||
94 | string Store(AssetBase asset); | ||
95 | |||
96 | /// <summary> | ||
97 | /// Update an asset's content | ||
98 | /// </summary> | ||
99 | /// <remarks> | ||
100 | /// Attachments and bare scripts need this!! | ||
101 | /// </remarks> | ||
102 | /// <param name="id"> </param> | ||
103 | /// <param name="data"></param> | ||
104 | /// <returns></returns> | ||
105 | bool UpdateContent(string id, byte[] data); | ||
106 | |||
107 | /// <summary> | ||
108 | /// Delete an asset | ||
109 | /// </summary> | ||
110 | /// <param name="id"></param> | ||
111 | /// <returns></returns> | ||
112 | bool Delete(string id); | ||
113 | } | ||
114 | } | ||
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs new file mode 100644 index 0000000..cee8bc0 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public class AuthInfo | ||
35 | { | ||
36 | public UUID PrincipalID { get; set; } | ||
37 | public string AccountType { get; set; } | ||
38 | public string PasswordHash { get; set; } | ||
39 | public string PasswordSalt { get; set; } | ||
40 | public string WebLoginKey { get; set; } | ||
41 | |||
42 | public Dictionary<string, object> ToKeyValuePairs() | ||
43 | { | ||
44 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
45 | result["PrincipalID"] = PrincipalID; | ||
46 | result["AccountType"] = AccountType; | ||
47 | result["PasswordHash"] = PasswordHash; | ||
48 | result["PasswordSalt"] = PasswordSalt; | ||
49 | result["WebLoginKey"] = WebLoginKey; | ||
50 | |||
51 | return result; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | // Generic Authentication service used for identifying | ||
56 | // and authenticating principals. | ||
57 | // Principals may be clients acting on users' behalf, | ||
58 | // or any other components that need | ||
59 | // verifiable identification. | ||
60 | // | ||
61 | public interface IAuthenticationService | ||
62 | { | ||
63 | ////////////////////////////////////////////////////// | ||
64 | // Authentication | ||
65 | // | ||
66 | // These methods will return a token, which can be used to access | ||
67 | // various services. | ||
68 | // | ||
69 | string Authenticate(UUID principalID, string password, int lifetime); | ||
70 | |||
71 | ////////////////////////////////////////////////////// | ||
72 | // Verification | ||
73 | // | ||
74 | // Allows to verify the authenticity of a token | ||
75 | // | ||
76 | // Tokens expire after 30 minutes and can be refreshed by | ||
77 | // re-verifying. | ||
78 | // | ||
79 | bool Verify(UUID principalID, string token, int lifetime); | ||
80 | |||
81 | ////////////////////////////////////////////////////// | ||
82 | // Teardown | ||
83 | // | ||
84 | // A token can be returned before the timeout. This | ||
85 | // invalidates it and it can not subsequently be used | ||
86 | // or refreshed. | ||
87 | // | ||
88 | bool Release(UUID principalID, string token); | ||
89 | |||
90 | ////////////////////////////////////////////////////// | ||
91 | // SetPassword for a principal | ||
92 | // | ||
93 | // This method exists for the service, but may or may not | ||
94 | // be served remotely. That is, the authentication | ||
95 | // handlers may not include one handler for this, | ||
96 | // because it's a bit risky. Such handlers require | ||
97 | // authentication/authorization. | ||
98 | // | ||
99 | bool SetPassword(UUID principalID, string passwd); | ||
100 | |||
101 | AuthInfo GetAuthInfo(UUID principalID); | ||
102 | |||
103 | bool SetAuthInfo(AuthInfo info); | ||
104 | |||
105 | ////////////////////////////////////////////////////// | ||
106 | // Grid | ||
107 | // | ||
108 | // We no longer need a shared secret between grid | ||
109 | // servers. Anything a server requests from another | ||
110 | // server is either done on behalf of a user, in which | ||
111 | // case there is a token, or on behalf of a region, | ||
112 | // which has a session. So, no more keys. | ||
113 | // If sniffing on the local lan is an issue, admins | ||
114 | // need to take approriate action (IPSec is recommended) | ||
115 | // to secure inter-server traffic. | ||
116 | |||
117 | ////////////////////////////////////////////////////// | ||
118 | // NOTE | ||
119 | // | ||
120 | // Session IDs are not handled here. After obtaining | ||
121 | // a token, the session ID regions use can be | ||
122 | // obtained from the presence service. | ||
123 | } | ||
124 | } | ||
diff --git a/OpenSim/Services/Interfaces/IAuthorizationService.cs b/OpenSim/Services/Interfaces/IAuthorizationService.cs new file mode 100644 index 0000000..e5c68f6 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAuthorizationService.cs | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Services.Interfaces | ||
32 | { | ||
33 | // Generic Authorization service used for authorizing principals in a particular region | ||
34 | |||
35 | public interface IAuthorizationService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Check whether the user should be given access to the region. | ||
39 | /// </summary> | ||
40 | /// <remarks> | ||
41 | /// We also supply user first name and last name for situations where the user does not have an account | ||
42 | /// on the region (e.g. they're a visitor via Hypergrid). | ||
43 | /// </remarks> | ||
44 | /// <param name="userID"></param> | ||
45 | /// <param name="firstName">/param> | ||
46 | /// <param name="lastName"></param> | ||
47 | /// <param name="regionID"></param> | ||
48 | /// <param name="message"></param> | ||
49 | /// <returns></returns> | ||
50 | bool IsAuthorizedForRegion( | ||
51 | string userID, string firstName, string lastName, string regionID, out string message); | ||
52 | } | ||
53 | |||
54 | public class AuthorizationRequest | ||
55 | { | ||
56 | private string m_userID; | ||
57 | private string m_firstname; | ||
58 | private string m_surname; | ||
59 | private string m_email; | ||
60 | private string m_regionName; | ||
61 | private string m_regionID; | ||
62 | |||
63 | public AuthorizationRequest() | ||
64 | { | ||
65 | } | ||
66 | |||
67 | public AuthorizationRequest(string ID, string RegionID) | ||
68 | { | ||
69 | m_userID = ID; | ||
70 | m_regionID = RegionID; | ||
71 | } | ||
72 | |||
73 | public AuthorizationRequest( | ||
74 | string ID, string FirstName, string SurName, string Email, string RegionName, string RegionID) | ||
75 | { | ||
76 | m_userID = ID; | ||
77 | m_firstname = FirstName; | ||
78 | m_surname = SurName; | ||
79 | m_email = Email; | ||
80 | m_regionName = RegionName; | ||
81 | m_regionID = RegionID; | ||
82 | } | ||
83 | |||
84 | public string ID | ||
85 | { | ||
86 | get { return m_userID; } | ||
87 | set { m_userID = value; } | ||
88 | } | ||
89 | |||
90 | public string FirstName | ||
91 | { | ||
92 | get { return m_firstname; } | ||
93 | set { m_firstname = value; } | ||
94 | } | ||
95 | |||
96 | public string SurName | ||
97 | { | ||
98 | get { return m_surname; } | ||
99 | set { m_surname = value; } | ||
100 | } | ||
101 | |||
102 | public string Email | ||
103 | { | ||
104 | get { return m_email; } | ||
105 | set { m_email = value; } | ||
106 | } | ||
107 | |||
108 | public string RegionName | ||
109 | { | ||
110 | get { return m_regionName; } | ||
111 | set { m_regionName = value; } | ||
112 | } | ||
113 | |||
114 | public string RegionID | ||
115 | { | ||
116 | get { return m_regionID; } | ||
117 | set { m_regionID = value; } | ||
118 | } | ||
119 | } | ||
120 | |||
121 | public class AuthorizationResponse | ||
122 | { | ||
123 | private bool m_isAuthorized; | ||
124 | private string m_message; | ||
125 | |||
126 | public AuthorizationResponse() | ||
127 | { | ||
128 | } | ||
129 | |||
130 | public AuthorizationResponse(bool isAuthorized, string message) | ||
131 | { | ||
132 | m_isAuthorized = isAuthorized; | ||
133 | m_message = message; | ||
134 | } | ||
135 | |||
136 | public bool IsAuthorized | ||
137 | { | ||
138 | get { return m_isAuthorized; } | ||
139 | set { m_isAuthorized = value; } | ||
140 | } | ||
141 | |||
142 | public string Message | ||
143 | { | ||
144 | get { return m_message; } | ||
145 | set { m_message = value; } | ||
146 | } | ||
147 | } | ||
148 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs new file mode 100644 index 0000000..6ca0b15 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAvatarService.cs | |||
@@ -0,0 +1,356 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | |||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Services.Interfaces | ||
37 | { | ||
38 | public interface IAvatarService | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Called by the login service | ||
42 | /// </summary> | ||
43 | /// <param name="userID"></param> | ||
44 | /// <returns></returns> | ||
45 | AvatarAppearance GetAppearance(UUID userID); | ||
46 | |||
47 | /// <summary> | ||
48 | /// Called by everyone who can change the avatar data (so, regions) | ||
49 | /// </summary> | ||
50 | /// <param name="userID"></param> | ||
51 | /// <param name="appearance"></param> | ||
52 | /// <returns></returns> | ||
53 | bool SetAppearance(UUID userID, AvatarAppearance appearance); | ||
54 | |||
55 | /// <summary> | ||
56 | /// Called by the login service | ||
57 | /// </summary> | ||
58 | /// <param name="userID"></param> | ||
59 | /// <returns></returns> | ||
60 | AvatarData GetAvatar(UUID userID); | ||
61 | |||
62 | /// <summary> | ||
63 | /// Called by everyone who can change the avatar data (so, regions) | ||
64 | /// </summary> | ||
65 | /// <param name="userID"></param> | ||
66 | /// <param name="avatar"></param> | ||
67 | /// <returns></returns> | ||
68 | bool SetAvatar(UUID userID, AvatarData avatar); | ||
69 | |||
70 | /// <summary> | ||
71 | /// Not sure if it's needed | ||
72 | /// </summary> | ||
73 | /// <param name="userID"></param> | ||
74 | /// <returns></returns> | ||
75 | bool ResetAvatar(UUID userID); | ||
76 | |||
77 | /// <summary> | ||
78 | /// These methods raison d'etre: | ||
79 | /// No need to send the entire avatar data (SetAvatar) for changing attachments | ||
80 | /// </summary> | ||
81 | /// <param name="userID"></param> | ||
82 | /// <param name="attach"></param> | ||
83 | /// <returns></returns> | ||
84 | bool SetItems(UUID userID, string[] names, string[] values); | ||
85 | bool RemoveItems(UUID userID, string[] names); | ||
86 | } | ||
87 | |||
88 | /// <summary> | ||
89 | /// Each region/client that uses avatars will have a data structure | ||
90 | /// of this type representing the avatars. | ||
91 | /// </summary> | ||
92 | public class AvatarData | ||
93 | { | ||
94 | // This pretty much determines which name/value pairs will be | ||
95 | // present below. The name/value pair describe a part of | ||
96 | // the avatar. For SL avatars, these would be "shape", "texture1", | ||
97 | // etc. For other avatars, they might be "mesh", "skin", etc. | ||
98 | // The value portion is a URL that is expected to resolve to an | ||
99 | // asset of the type required by the handler for that field. | ||
100 | // It is required that regions can access these URLs. Allowing | ||
101 | // direct access by a viewer is not required, and, if provided, | ||
102 | // may be read-only. A "naked" UUID can be used to refer to an | ||
103 | // asset int he current region's asset service, which is not | ||
104 | // portable, but allows legacy appearance to continue to | ||
105 | // function. Closed, LL-based grids will never need URLs here. | ||
106 | |||
107 | public int AvatarType; | ||
108 | public Dictionary<string,string> Data; | ||
109 | |||
110 | public AvatarData() | ||
111 | { | ||
112 | } | ||
113 | |||
114 | public AvatarData(Dictionary<string, object> kvp) | ||
115 | { | ||
116 | Data = new Dictionary<string, string>(); | ||
117 | |||
118 | if (kvp.ContainsKey("AvatarType")) | ||
119 | Int32.TryParse(kvp["AvatarType"].ToString(), out AvatarType); | ||
120 | |||
121 | foreach (KeyValuePair<string, object> _kvp in kvp) | ||
122 | { | ||
123 | if (_kvp.Value != null) | ||
124 | Data[_kvp.Key] = _kvp.Value.ToString(); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | /// <summary> | ||
129 | /// </summary> | ||
130 | /// <returns></returns> | ||
131 | public Dictionary<string, object> ToKeyValuePairs() | ||
132 | { | ||
133 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
134 | |||
135 | result["AvatarType"] = AvatarType.ToString(); | ||
136 | foreach (KeyValuePair<string, string> _kvp in Data) | ||
137 | { | ||
138 | if (_kvp.Value != null) | ||
139 | result[_kvp.Key] = _kvp.Value; | ||
140 | } | ||
141 | return result; | ||
142 | } | ||
143 | |||
144 | public AvatarData(AvatarAppearance appearance) | ||
145 | { | ||
146 | AvatarType = 1; // SL avatars | ||
147 | Data = new Dictionary<string, string>(); | ||
148 | |||
149 | Data["Serial"] = appearance.Serial.ToString(); | ||
150 | // Wearables | ||
151 | Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); | ||
152 | |||
153 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++) | ||
154 | { | ||
155 | for (int j = 0 ; j < appearance.Wearables[i].Count ; j++) | ||
156 | { | ||
157 | string fieldName = String.Format("Wearable {0}:{1}", i, j); | ||
158 | Data[fieldName] = String.Format("{0}:{1}", | ||
159 | appearance.Wearables[i][j].ItemID.ToString(), | ||
160 | appearance.Wearables[i][j].AssetID.ToString()); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | // Visual Params | ||
165 | string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; | ||
166 | byte[] binary = appearance.VisualParams; | ||
167 | |||
168 | for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) | ||
169 | { | ||
170 | vps[i] = binary[i].ToString(); | ||
171 | } | ||
172 | |||
173 | Data["VisualParams"] = String.Join(",", vps); | ||
174 | |||
175 | // Attachments | ||
176 | List<AvatarAttachment> attachments = appearance.GetAttachments(); | ||
177 | Dictionary<int, List<string>> atts = new Dictionary<int, List<string>>(); | ||
178 | foreach (AvatarAttachment attach in attachments) | ||
179 | { | ||
180 | if (attach.ItemID != UUID.Zero) | ||
181 | { | ||
182 | if (!atts.ContainsKey(attach.AttachPoint)) | ||
183 | atts[attach.AttachPoint] = new List<string>(); | ||
184 | atts[attach.AttachPoint].Add(attach.ItemID.ToString()); | ||
185 | } | ||
186 | } | ||
187 | foreach (KeyValuePair<int, List<string>> kvp in atts) | ||
188 | Data["_ap_" + kvp.Key] = string.Join(",", kvp.Value.ToArray()); | ||
189 | } | ||
190 | |||
191 | public AvatarAppearance ToAvatarAppearance() | ||
192 | { | ||
193 | AvatarAppearance appearance = new AvatarAppearance(); | ||
194 | |||
195 | if (Data.Count == 0) | ||
196 | return appearance; | ||
197 | |||
198 | appearance.ClearWearables(); | ||
199 | try | ||
200 | { | ||
201 | if (Data.ContainsKey("Serial")) | ||
202 | appearance.Serial = Int32.Parse(Data["Serial"]); | ||
203 | |||
204 | if (Data.ContainsKey("AvatarHeight")) | ||
205 | appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); | ||
206 | |||
207 | // Legacy Wearables | ||
208 | if (Data.ContainsKey("BodyItem")) | ||
209 | appearance.Wearables[AvatarWearable.BODY].Wear( | ||
210 | UUID.Parse(Data["BodyItem"]), | ||
211 | UUID.Parse(Data["BodyAsset"])); | ||
212 | |||
213 | if (Data.ContainsKey("SkinItem")) | ||
214 | appearance.Wearables[AvatarWearable.SKIN].Wear( | ||
215 | UUID.Parse(Data["SkinItem"]), | ||
216 | UUID.Parse(Data["SkinAsset"])); | ||
217 | |||
218 | if (Data.ContainsKey("HairItem")) | ||
219 | appearance.Wearables[AvatarWearable.HAIR].Wear( | ||
220 | UUID.Parse(Data["HairItem"]), | ||
221 | UUID.Parse(Data["HairAsset"])); | ||
222 | |||
223 | if (Data.ContainsKey("EyesItem")) | ||
224 | appearance.Wearables[AvatarWearable.EYES].Wear( | ||
225 | UUID.Parse(Data["EyesItem"]), | ||
226 | UUID.Parse(Data["EyesAsset"])); | ||
227 | |||
228 | if (Data.ContainsKey("ShirtItem")) | ||
229 | appearance.Wearables[AvatarWearable.SHIRT].Wear( | ||
230 | UUID.Parse(Data["ShirtItem"]), | ||
231 | UUID.Parse(Data["ShirtAsset"])); | ||
232 | |||
233 | if (Data.ContainsKey("PantsItem")) | ||
234 | appearance.Wearables[AvatarWearable.PANTS].Wear( | ||
235 | UUID.Parse(Data["PantsItem"]), | ||
236 | UUID.Parse(Data["PantsAsset"])); | ||
237 | |||
238 | if (Data.ContainsKey("ShoesItem")) | ||
239 | appearance.Wearables[AvatarWearable.SHOES].Wear( | ||
240 | UUID.Parse(Data["ShoesItem"]), | ||
241 | UUID.Parse(Data["ShoesAsset"])); | ||
242 | |||
243 | if (Data.ContainsKey("SocksItem")) | ||
244 | appearance.Wearables[AvatarWearable.SOCKS].Wear( | ||
245 | UUID.Parse(Data["SocksItem"]), | ||
246 | UUID.Parse(Data["SocksAsset"])); | ||
247 | |||
248 | if (Data.ContainsKey("JacketItem")) | ||
249 | appearance.Wearables[AvatarWearable.JACKET].Wear( | ||
250 | UUID.Parse(Data["JacketItem"]), | ||
251 | UUID.Parse(Data["JacketAsset"])); | ||
252 | |||
253 | if (Data.ContainsKey("GlovesItem")) | ||
254 | appearance.Wearables[AvatarWearable.GLOVES].Wear( | ||
255 | UUID.Parse(Data["GlovesItem"]), | ||
256 | UUID.Parse(Data["GlovesAsset"])); | ||
257 | |||
258 | if (Data.ContainsKey("UnderShirtItem")) | ||
259 | appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear( | ||
260 | UUID.Parse(Data["UnderShirtItem"]), | ||
261 | UUID.Parse(Data["UnderShirtAsset"])); | ||
262 | |||
263 | if (Data.ContainsKey("UnderPantsItem")) | ||
264 | appearance.Wearables[AvatarWearable.UNDERPANTS].Wear( | ||
265 | UUID.Parse(Data["UnderPantsItem"]), | ||
266 | UUID.Parse(Data["UnderPantsAsset"])); | ||
267 | |||
268 | if (Data.ContainsKey("SkirtItem")) | ||
269 | appearance.Wearables[AvatarWearable.SKIRT].Wear( | ||
270 | UUID.Parse(Data["SkirtItem"]), | ||
271 | UUID.Parse(Data["SkirtAsset"])); | ||
272 | |||
273 | if (Data.ContainsKey("VisualParams")) | ||
274 | { | ||
275 | string[] vps = Data["VisualParams"].Split(new char[] {','}); | ||
276 | byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; | ||
277 | |||
278 | for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) | ||
279 | binary[i] = (byte)Convert.ToInt32(vps[i]); | ||
280 | |||
281 | appearance.VisualParams = binary; | ||
282 | } | ||
283 | |||
284 | // New style wearables | ||
285 | foreach (KeyValuePair<string, string> _kvp in Data) | ||
286 | { | ||
287 | if (_kvp.Key.StartsWith("Wearable ")) | ||
288 | { | ||
289 | string wearIndex = _kvp.Key.Substring(9); | ||
290 | string[] wearIndices = wearIndex.Split(new char[] {':'}); | ||
291 | int index = Convert.ToInt32(wearIndices[0]); | ||
292 | |||
293 | string[] ids = _kvp.Value.Split(new char[] {':'}); | ||
294 | UUID itemID = new UUID(ids[0]); | ||
295 | UUID assetID = new UUID(ids[1]); | ||
296 | |||
297 | appearance.Wearables[index].Add(itemID, assetID); | ||
298 | } | ||
299 | } | ||
300 | |||
301 | // Attachments | ||
302 | Dictionary<string, string> attchs = new Dictionary<string, string>(); | ||
303 | foreach (KeyValuePair<string, string> _kvp in Data) | ||
304 | if (_kvp.Key.StartsWith("_ap_")) | ||
305 | attchs[_kvp.Key] = _kvp.Value; | ||
306 | |||
307 | foreach (KeyValuePair<string, string> _kvp in attchs) | ||
308 | { | ||
309 | string pointStr = _kvp.Key.Substring(4); | ||
310 | int point = 0; | ||
311 | if (!Int32.TryParse(pointStr, out point)) | ||
312 | continue; | ||
313 | |||
314 | List<string> idList = new List<string>(_kvp.Value.Split(new char[] {','})); | ||
315 | |||
316 | appearance.SetAttachment(point, UUID.Zero, UUID.Zero); | ||
317 | foreach (string id in idList) | ||
318 | { | ||
319 | UUID uuid = UUID.Zero; | ||
320 | UUID.TryParse(id, out uuid); | ||
321 | |||
322 | appearance.SetAttachment(point | 0x80, uuid, UUID.Zero); | ||
323 | } | ||
324 | } | ||
325 | |||
326 | if (appearance.Wearables[AvatarWearable.BODY].Count == 0) | ||
327 | appearance.Wearables[AvatarWearable.BODY].Wear( | ||
328 | AvatarWearable.DefaultWearables[ | ||
329 | AvatarWearable.BODY][0]); | ||
330 | |||
331 | if (appearance.Wearables[AvatarWearable.SKIN].Count == 0) | ||
332 | appearance.Wearables[AvatarWearable.SKIN].Wear( | ||
333 | AvatarWearable.DefaultWearables[ | ||
334 | AvatarWearable.SKIN][0]); | ||
335 | |||
336 | if (appearance.Wearables[AvatarWearable.HAIR].Count == 0) | ||
337 | appearance.Wearables[AvatarWearable.HAIR].Wear( | ||
338 | AvatarWearable.DefaultWearables[ | ||
339 | AvatarWearable.HAIR][0]); | ||
340 | |||
341 | if (appearance.Wearables[AvatarWearable.EYES].Count == 0) | ||
342 | appearance.Wearables[AvatarWearable.EYES].Wear( | ||
343 | AvatarWearable.DefaultWearables[ | ||
344 | AvatarWearable.EYES][0]); | ||
345 | } | ||
346 | catch | ||
347 | { | ||
348 | // We really should report something here, returning null | ||
349 | // will at least break the wrapper | ||
350 | return null; | ||
351 | } | ||
352 | |||
353 | return appearance; | ||
354 | } | ||
355 | } | ||
356 | } | ||
diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs new file mode 100644 index 0000000..69df4a0 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBakedTextureService.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | |||
31 | namespace OpenSim.Services.Interfaces | ||
32 | { | ||
33 | public interface IBakedTextureService | ||
34 | { | ||
35 | string Get(string id); | ||
36 | void Store(string id, string data); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Services/Interfaces/IBansService.cs b/OpenSim/Services/Interfaces/IBansService.cs new file mode 100644 index 0000000..8fd3521 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBansService.cs | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | |||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IBansService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Are any of the given arguments banned from the grid? | ||
39 | /// </summary> | ||
40 | /// <param name="userID"></param> | ||
41 | /// <param name="ip"></param> | ||
42 | /// <param name="id0"></param> | ||
43 | /// <param name="origin"></param> | ||
44 | /// <returns></returns> | ||
45 | bool IsBanned(string userID, string ip, string id0, string origin); | ||
46 | } | ||
47 | |||
48 | } | ||
diff --git a/OpenSim/Services/Interfaces/IBasicProfileService.cs b/OpenSim/Services/Interfaces/IBasicProfileService.cs new file mode 100644 index 0000000..ecf3d33 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBasicProfileService.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenSim.Framework; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public interface IBasicProfileService | ||
35 | { | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Services/Interfaces/IEstateDataService.cs b/OpenSim/Services/Interfaces/IEstateDataService.cs new file mode 100644 index 0000000..719563d --- /dev/null +++ b/OpenSim/Services/Interfaces/IEstateDataService.cs | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IEstateDataService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Load estate settings for a region. | ||
39 | /// </summary> | ||
40 | /// <param name="regionID"></param> | ||
41 | /// <param name="create">If true, then an estate is created if one is not found.</param> | ||
42 | /// <returns></returns> | ||
43 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Load estate settings for an estate ID. | ||
47 | /// </summary> | ||
48 | /// <param name="estateID"></param> | ||
49 | /// <returns></returns> | ||
50 | EstateSettings LoadEstateSettings(int estateID); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Create a new estate. | ||
54 | /// </summary> | ||
55 | /// <returns> | ||
56 | /// A <see cref="EstateSettings"/> | ||
57 | /// </returns> | ||
58 | EstateSettings CreateNewEstate(); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Load/Get all estate settings. | ||
62 | /// </summary> | ||
63 | /// <returns>An empty list if no estates were found.</returns> | ||
64 | List<EstateSettings> LoadEstateSettingsAll(); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Store estate settings. | ||
68 | /// </summary> | ||
69 | /// <remarks> | ||
70 | /// This is also called by EstateSettings.Save()</remarks> | ||
71 | /// <param name="es"></param> | ||
72 | void StoreEstateSettings(EstateSettings es); | ||
73 | |||
74 | /// <summary> | ||
75 | /// Get estate IDs. | ||
76 | /// </summary> | ||
77 | /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> | ||
78 | /// <returns></returns> | ||
79 | List<int> GetEstates(string search); | ||
80 | |||
81 | /// <summary> | ||
82 | /// Get the IDs of all estates owned by the given user. | ||
83 | /// </summary> | ||
84 | /// <returns>An empty list if no estates were found.</returns> | ||
85 | List<int> GetEstatesByOwner(UUID ownerID); | ||
86 | |||
87 | /// <summary> | ||
88 | /// Get the IDs of all estates. | ||
89 | /// </summary> | ||
90 | /// <returns>An empty list if no estates were found.</returns> | ||
91 | List<int> GetEstatesAll(); | ||
92 | |||
93 | /// <summary> | ||
94 | /// Link a region to an estate. | ||
95 | /// </summary> | ||
96 | /// <param name="regionID"></param> | ||
97 | /// <param name="estateID"></param> | ||
98 | /// <returns>true if the link succeeded, false otherwise</returns> | ||
99 | bool LinkRegion(UUID regionID, int estateID); | ||
100 | |||
101 | /// <summary> | ||
102 | /// Get the UUIDs of all the regions in an estate. | ||
103 | /// </summary> | ||
104 | /// <param name="estateID"></param> | ||
105 | /// <returns></returns> | ||
106 | List<UUID> GetRegions(int estateID); | ||
107 | |||
108 | /// <summary> | ||
109 | /// Delete an estate | ||
110 | /// </summary> | ||
111 | /// <param name="estateID"></param> | ||
112 | /// <returns>true if the delete succeeded, false otherwise</returns> | ||
113 | bool DeleteEstate(int estateID); | ||
114 | } | ||
115 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/IFreeswitchService.cs b/OpenSim/Services/Interfaces/IFreeswitchService.cs new file mode 100644 index 0000000..e7941d5 --- /dev/null +++ b/OpenSim/Services/Interfaces/IFreeswitchService.cs | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using System.Collections; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public interface IFreeswitchService | ||
35 | { | ||
36 | Hashtable HandleDirectoryRequest(Hashtable requestBody); | ||
37 | Hashtable HandleDialplanRequest(Hashtable requestBody); | ||
38 | string GetJsonConfig(); | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs new file mode 100644 index 0000000..d0d3b10 --- /dev/null +++ b/OpenSim/Services/Interfaces/IFriendsService.cs | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using System.Collections.Generic; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public class FriendInfo | ||
36 | { | ||
37 | public UUID PrincipalID; | ||
38 | public string Friend; | ||
39 | |||
40 | /// <summary> | ||
41 | /// The permissions that this user has granted to the friend. | ||
42 | /// </summary> | ||
43 | public int MyFlags; | ||
44 | |||
45 | /// <summary> | ||
46 | /// The permissions that the friend has granted to this user. | ||
47 | /// </summary> | ||
48 | public int TheirFlags; | ||
49 | |||
50 | public FriendInfo() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public FriendInfo(Dictionary<string, object> kvp) | ||
55 | { | ||
56 | PrincipalID = UUID.Zero; | ||
57 | if (kvp.ContainsKey("PrincipalID") && kvp["PrincipalID"] != null) | ||
58 | UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); | ||
59 | Friend = string.Empty; | ||
60 | if (kvp.ContainsKey("Friend") && kvp["Friend"] != null) | ||
61 | Friend = kvp["Friend"].ToString(); | ||
62 | MyFlags = (int)FriendRights.None; | ||
63 | if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null) | ||
64 | Int32.TryParse(kvp["MyFlags"].ToString(), out MyFlags); | ||
65 | TheirFlags = 0; | ||
66 | if (kvp.ContainsKey("TheirFlags") && kvp["TheirFlags"] != null) | ||
67 | Int32.TryParse(kvp["TheirFlags"].ToString(), out TheirFlags); | ||
68 | } | ||
69 | |||
70 | public Dictionary<string, object> ToKeyValuePairs() | ||
71 | { | ||
72 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
73 | result["PrincipalID"] = PrincipalID.ToString(); | ||
74 | result["Friend"] = Friend; | ||
75 | result["MyFlags"] = MyFlags.ToString(); | ||
76 | result["TheirFlags"] = TheirFlags.ToString(); | ||
77 | |||
78 | return result; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | public interface IFriendsService | ||
83 | { | ||
84 | FriendInfo[] GetFriends(UUID PrincipalID); | ||
85 | FriendInfo[] GetFriends(string PrincipalID); | ||
86 | bool StoreFriend(string PrincipalID, string Friend, int flags); | ||
87 | bool Delete(UUID PrincipalID, string Friend); | ||
88 | bool Delete(string PrincipalID, string Friend); | ||
89 | } | ||
90 | } | ||
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs new file mode 100644 index 0000000..f5f1f75 --- /dev/null +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -0,0 +1,529 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.Reflection; | ||
34 | |||
35 | using OpenSim.Framework; | ||
36 | using OpenMetaverse; | ||
37 | |||
38 | using log4net; | ||
39 | |||
40 | namespace OpenSim.Services.Interfaces | ||
41 | { | ||
42 | public interface IGridService | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// Register a region with the grid service. | ||
46 | /// </summary> | ||
47 | /// <param name="regionInfos"> </param> | ||
48 | /// <returns></returns> | ||
49 | /// <exception cref="System.Exception">Thrown if region registration failed</exception> | ||
50 | string RegisterRegion(UUID scopeID, GridRegion regionInfos); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Deregister a region with the grid service. | ||
54 | /// </summary> | ||
55 | /// <param name="regionID"></param> | ||
56 | /// <returns></returns> | ||
57 | /// <exception cref="System.Exception">Thrown if region deregistration failed</exception> | ||
58 | bool DeregisterRegion(UUID regionID); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Get information about the regions neighbouring the given co-ordinates (in meters). | ||
62 | /// </summary> | ||
63 | /// <param name="x"></param> | ||
64 | /// <param name="y"></param> | ||
65 | /// <returns></returns> | ||
66 | List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID); | ||
67 | |||
68 | GridRegion GetRegionByUUID(UUID scopeID, UUID regionID); | ||
69 | |||
70 | /// <summary> | ||
71 | /// Get the region at the given position (in meters) | ||
72 | /// </summary> | ||
73 | /// <param name="scopeID"></param> | ||
74 | /// <param name="x"></param> | ||
75 | /// <param name="y"></param> | ||
76 | /// <returns></returns> | ||
77 | GridRegion GetRegionByPosition(UUID scopeID, int x, int y); | ||
78 | |||
79 | /// <summary> | ||
80 | /// Get information about a region which exactly matches the name given. | ||
81 | /// </summary> | ||
82 | /// <param name="scopeID"></param> | ||
83 | /// <param name="regionName"></param> | ||
84 | /// <returns>Returns the region information if the name matched. Null otherwise.</returns> | ||
85 | GridRegion GetRegionByName(UUID scopeID, string regionName); | ||
86 | |||
87 | /// <summary> | ||
88 | /// Get information about regions starting with the provided name. | ||
89 | /// </summary> | ||
90 | /// <param name="name"> | ||
91 | /// The name to match against. | ||
92 | /// </param> | ||
93 | /// <param name="maxNumber"> | ||
94 | /// The maximum number of results to return. | ||
95 | /// </param> | ||
96 | /// <returns> | ||
97 | /// A list of <see cref="RegionInfo"/>s of regions with matching name. If the | ||
98 | /// grid-server couldn't be contacted or returned an error, return null. | ||
99 | /// </returns> | ||
100 | List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber); | ||
101 | |||
102 | List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); | ||
103 | |||
104 | List<GridRegion> GetDefaultRegions(UUID scopeID); | ||
105 | List<GridRegion> GetDefaultHypergridRegions(UUID scopeID); | ||
106 | List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); | ||
107 | List<GridRegion> GetHyperlinks(UUID scopeID); | ||
108 | |||
109 | /// <summary> | ||
110 | /// Get internal OpenSimulator region flags. | ||
111 | /// </summary> | ||
112 | /// <remarks> | ||
113 | /// See OpenSimulator.Framework.RegionFlags. These are not returned in the GridRegion structure - | ||
114 | /// they currently need to be requested separately. Possibly this should change to avoid multiple service calls | ||
115 | /// in some situations. | ||
116 | /// </remarks> | ||
117 | /// <returns> | ||
118 | /// The region flags. | ||
119 | /// </returns> | ||
120 | /// <param name='scopeID'></param> | ||
121 | /// <param name='regionID'></param> | ||
122 | int GetRegionFlags(UUID scopeID, UUID regionID); | ||
123 | |||
124 | Dictionary<string,object> GetExtraFeatures(); | ||
125 | } | ||
126 | |||
127 | public interface IHypergridLinker | ||
128 | { | ||
129 | GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason); | ||
130 | bool TryUnlinkRegion(string mapName); | ||
131 | } | ||
132 | |||
133 | public class GridRegion | ||
134 | { | ||
135 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
136 | |||
137 | #pragma warning disable 414 | ||
138 | private static readonly string LogHeader = "[GRID REGION]"; | ||
139 | #pragma warning restore 414 | ||
140 | |||
141 | /// <summary> | ||
142 | /// The port by which http communication occurs with the region | ||
143 | /// </summary> | ||
144 | public uint HttpPort { get; set; } | ||
145 | |||
146 | /// <summary> | ||
147 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | ||
148 | /// </summary> | ||
149 | public string ServerURI | ||
150 | { | ||
151 | get { | ||
152 | if (!String.IsNullOrEmpty(m_serverURI)) { | ||
153 | return m_serverURI; | ||
154 | } else { | ||
155 | if (HttpPort == 0) | ||
156 | return "http://" + m_externalHostName + "/"; | ||
157 | else | ||
158 | return "http://" + m_externalHostName + ":" + HttpPort + "/"; | ||
159 | } | ||
160 | } | ||
161 | set { | ||
162 | if (value.EndsWith("/")) { | ||
163 | m_serverURI = value; | ||
164 | } else { | ||
165 | m_serverURI = value + '/'; | ||
166 | } | ||
167 | } | ||
168 | } | ||
169 | protected string m_serverURI; | ||
170 | |||
171 | /// <summary> | ||
172 | /// Provides direct access to the 'm_serverURI' field, without returning a generated URL if m_serverURI is missing. | ||
173 | /// </summary> | ||
174 | public string RawServerURI | ||
175 | { | ||
176 | get { return m_serverURI; } | ||
177 | set { m_serverURI = value; } | ||
178 | } | ||
179 | |||
180 | |||
181 | public string RegionName | ||
182 | { | ||
183 | get { return m_regionName; } | ||
184 | set { m_regionName = value; } | ||
185 | } | ||
186 | protected string m_regionName = String.Empty; | ||
187 | |||
188 | /// <summary> | ||
189 | /// Region flags. | ||
190 | /// </summary> | ||
191 | /// <remarks> | ||
192 | /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and | ||
193 | /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call | ||
194 | /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be | ||
195 | /// used to set flags at this point. | ||
196 | /// </remarks> | ||
197 | public OpenSim.Framework.RegionFlags? RegionFlags { get; set; } | ||
198 | |||
199 | protected string m_externalHostName; | ||
200 | |||
201 | protected IPEndPoint m_internalEndPoint; | ||
202 | |||
203 | /// <summary> | ||
204 | /// The co-ordinate of this region in region units. | ||
205 | /// </summary> | ||
206 | public int RegionCoordX { get { return (int)Util.WorldToRegionLoc((uint)RegionLocX); } } | ||
207 | |||
208 | /// <summary> | ||
209 | /// The co-ordinate of this region in region units | ||
210 | /// </summary> | ||
211 | public int RegionCoordY { get { return (int)Util.WorldToRegionLoc((uint)RegionLocY); } } | ||
212 | |||
213 | /// <summary> | ||
214 | /// The location of this region in meters. | ||
215 | /// DANGER DANGER! Note that this name means something different in RegionInfo. | ||
216 | /// </summary> | ||
217 | public int RegionLocX | ||
218 | { | ||
219 | get { return m_regionLocX; } | ||
220 | set { m_regionLocX = value; } | ||
221 | } | ||
222 | protected int m_regionLocX; | ||
223 | |||
224 | public int RegionSizeX { get; set; } | ||
225 | public int RegionSizeY { get; set; } | ||
226 | |||
227 | /// <summary> | ||
228 | /// The location of this region in meters. | ||
229 | /// DANGER DANGER! Note that this name means something different in RegionInfo. | ||
230 | /// </summary> | ||
231 | public int RegionLocY | ||
232 | { | ||
233 | get { return m_regionLocY; } | ||
234 | set { m_regionLocY = value; } | ||
235 | } | ||
236 | protected int m_regionLocY; | ||
237 | |||
238 | protected UUID m_estateOwner; | ||
239 | |||
240 | public UUID EstateOwner | ||
241 | { | ||
242 | get { return m_estateOwner; } | ||
243 | set { m_estateOwner = value; } | ||
244 | } | ||
245 | |||
246 | public UUID RegionID = UUID.Zero; | ||
247 | public UUID ScopeID = UUID.Zero; | ||
248 | |||
249 | public UUID TerrainImage = UUID.Zero; | ||
250 | public UUID ParcelImage = UUID.Zero; | ||
251 | public byte Access; | ||
252 | public int Maturity; | ||
253 | public string RegionSecret = string.Empty; | ||
254 | public string Token = string.Empty; | ||
255 | |||
256 | public GridRegion() | ||
257 | { | ||
258 | RegionSizeX = (int)Constants.RegionSize; | ||
259 | RegionSizeY = (int)Constants.RegionSize; | ||
260 | m_serverURI = string.Empty; | ||
261 | } | ||
262 | |||
263 | /* | ||
264 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) | ||
265 | { | ||
266 | m_regionLocX = regionLocX; | ||
267 | m_regionLocY = regionLocY; | ||
268 | RegionSizeX = (int)Constants.RegionSize; | ||
269 | RegionSizeY = (int)Constants.RegionSize; | ||
270 | |||
271 | m_internalEndPoint = internalEndPoint; | ||
272 | m_externalHostName = externalUri; | ||
273 | } | ||
274 | |||
275 | public GridRegion(int regionLocX, int regionLocY, string externalUri, uint port) | ||
276 | { | ||
277 | m_regionLocX = regionLocX; | ||
278 | m_regionLocY = regionLocY; | ||
279 | RegionSizeX = (int)Constants.RegionSize; | ||
280 | RegionSizeY = (int)Constants.RegionSize; | ||
281 | |||
282 | m_externalHostName = externalUri; | ||
283 | |||
284 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); | ||
285 | } | ||
286 | */ | ||
287 | |||
288 | public GridRegion(uint xcell, uint ycell) | ||
289 | { | ||
290 | m_regionLocX = (int)Util.RegionToWorldLoc(xcell); | ||
291 | m_regionLocY = (int)Util.RegionToWorldLoc(ycell); | ||
292 | RegionSizeX = (int)Constants.RegionSize; | ||
293 | RegionSizeY = (int)Constants.RegionSize; | ||
294 | } | ||
295 | |||
296 | public GridRegion(RegionInfo ConvertFrom) | ||
297 | { | ||
298 | m_regionName = ConvertFrom.RegionName; | ||
299 | m_regionLocX = (int)(ConvertFrom.WorldLocX); | ||
300 | m_regionLocY = (int)(ConvertFrom.WorldLocY); | ||
301 | RegionSizeX = (int)ConvertFrom.RegionSizeX; | ||
302 | RegionSizeY = (int)ConvertFrom.RegionSizeY; | ||
303 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
304 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
305 | HttpPort = ConvertFrom.HttpPort; | ||
306 | RegionID = ConvertFrom.RegionID; | ||
307 | ServerURI = ConvertFrom.ServerURI; | ||
308 | TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; | ||
309 | ParcelImage = ConvertFrom.RegionSettings.ParcelImageID; | ||
310 | Access = ConvertFrom.AccessLevel; | ||
311 | Maturity = ConvertFrom.RegionSettings.Maturity; | ||
312 | RegionSecret = ConvertFrom.regionSecret; | ||
313 | EstateOwner = ConvertFrom.EstateSettings.EstateOwner; | ||
314 | } | ||
315 | |||
316 | public GridRegion(GridRegion ConvertFrom) | ||
317 | { | ||
318 | m_regionName = ConvertFrom.RegionName; | ||
319 | RegionFlags = ConvertFrom.RegionFlags; | ||
320 | m_regionLocX = ConvertFrom.RegionLocX; | ||
321 | m_regionLocY = ConvertFrom.RegionLocY; | ||
322 | RegionSizeX = ConvertFrom.RegionSizeX; | ||
323 | RegionSizeY = ConvertFrom.RegionSizeY; | ||
324 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
325 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
326 | HttpPort = ConvertFrom.HttpPort; | ||
327 | RegionID = ConvertFrom.RegionID; | ||
328 | ServerURI = ConvertFrom.ServerURI; | ||
329 | TerrainImage = ConvertFrom.TerrainImage; | ||
330 | ParcelImage = ConvertFrom.ParcelImage; | ||
331 | Access = ConvertFrom.Access; | ||
332 | Maturity = ConvertFrom.Maturity; | ||
333 | RegionSecret = ConvertFrom.RegionSecret; | ||
334 | EstateOwner = ConvertFrom.EstateOwner; | ||
335 | } | ||
336 | |||
337 | public GridRegion(Dictionary<string, object> kvp) | ||
338 | { | ||
339 | if (kvp.ContainsKey("uuid")) | ||
340 | RegionID = new UUID((string)kvp["uuid"]); | ||
341 | |||
342 | if (kvp.ContainsKey("locX")) | ||
343 | RegionLocX = Convert.ToInt32((string)kvp["locX"]); | ||
344 | |||
345 | if (kvp.ContainsKey("locY")) | ||
346 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | ||
347 | |||
348 | if (kvp.ContainsKey("sizeX")) | ||
349 | RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); | ||
350 | else | ||
351 | RegionSizeX = (int)Constants.RegionSize; | ||
352 | |||
353 | if (kvp.ContainsKey("sizeY")) | ||
354 | RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); | ||
355 | else | ||
356 | RegionSizeX = (int)Constants.RegionSize; | ||
357 | |||
358 | if (kvp.ContainsKey("regionName")) | ||
359 | RegionName = (string)kvp["regionName"]; | ||
360 | |||
361 | if (kvp.ContainsKey("flags") && kvp["flags"] != null) | ||
362 | RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); | ||
363 | |||
364 | if (kvp.ContainsKey("serverIP")) | ||
365 | { | ||
366 | //int port = 0; | ||
367 | //Int32.TryParse((string)kvp["serverPort"], out port); | ||
368 | //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); | ||
369 | ExternalHostName = (string)kvp["serverIP"]; | ||
370 | } | ||
371 | else | ||
372 | ExternalHostName = "127.0.0.1"; | ||
373 | |||
374 | if (kvp.ContainsKey("serverPort")) | ||
375 | { | ||
376 | Int32 port = 0; | ||
377 | Int32.TryParse((string)kvp["serverPort"], out port); | ||
378 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
379 | } | ||
380 | |||
381 | if (kvp.ContainsKey("serverHttpPort")) | ||
382 | { | ||
383 | UInt32 port = 0; | ||
384 | UInt32.TryParse((string)kvp["serverHttpPort"], out port); | ||
385 | HttpPort = port; | ||
386 | } | ||
387 | |||
388 | if (kvp.ContainsKey("serverURI")) | ||
389 | ServerURI = (string)kvp["serverURI"]; | ||
390 | |||
391 | if (kvp.ContainsKey("regionMapTexture")) | ||
392 | UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); | ||
393 | |||
394 | if (kvp.ContainsKey("parcelMapTexture")) | ||
395 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | ||
396 | |||
397 | if (kvp.ContainsKey("access")) | ||
398 | Access = Byte.Parse((string)kvp["access"]); | ||
399 | |||
400 | if (kvp.ContainsKey("regionSecret")) | ||
401 | RegionSecret =(string)kvp["regionSecret"]; | ||
402 | |||
403 | if (kvp.ContainsKey("owner_uuid")) | ||
404 | EstateOwner = new UUID(kvp["owner_uuid"].ToString()); | ||
405 | |||
406 | if (kvp.ContainsKey("Token")) | ||
407 | Token = kvp["Token"].ToString(); | ||
408 | |||
409 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | ||
410 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | ||
411 | } | ||
412 | |||
413 | public Dictionary<string, object> ToKeyValuePairs() | ||
414 | { | ||
415 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
416 | kvp["uuid"] = RegionID.ToString(); | ||
417 | kvp["locX"] = RegionLocX.ToString(); | ||
418 | kvp["locY"] = RegionLocY.ToString(); | ||
419 | kvp["sizeX"] = RegionSizeX.ToString(); | ||
420 | kvp["sizeY"] = RegionSizeY.ToString(); | ||
421 | kvp["regionName"] = RegionName; | ||
422 | |||
423 | if (RegionFlags != null) | ||
424 | kvp["flags"] = ((int)RegionFlags).ToString(); | ||
425 | |||
426 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | ||
427 | kvp["serverHttpPort"] = HttpPort.ToString(); | ||
428 | kvp["serverURI"] = ServerURI; | ||
429 | kvp["serverPort"] = InternalEndPoint.Port.ToString(); | ||
430 | kvp["regionMapTexture"] = TerrainImage.ToString(); | ||
431 | kvp["parcelMapTexture"] = ParcelImage.ToString(); | ||
432 | kvp["access"] = Access.ToString(); | ||
433 | kvp["regionSecret"] = RegionSecret; | ||
434 | kvp["owner_uuid"] = EstateOwner.ToString(); | ||
435 | kvp["Token"] = Token.ToString(); | ||
436 | // Maturity doesn't seem to exist in the DB | ||
437 | |||
438 | return kvp; | ||
439 | } | ||
440 | |||
441 | #region Definition of equality | ||
442 | |||
443 | /// <summary> | ||
444 | /// Define equality as two regions having the same, non-zero UUID. | ||
445 | /// </summary> | ||
446 | public bool Equals(GridRegion region) | ||
447 | { | ||
448 | if ((object)region == null) | ||
449 | return false; | ||
450 | // Return true if the non-zero UUIDs are equal: | ||
451 | return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID); | ||
452 | } | ||
453 | |||
454 | public override bool Equals(Object obj) | ||
455 | { | ||
456 | if (obj == null) | ||
457 | return false; | ||
458 | return Equals(obj as GridRegion); | ||
459 | } | ||
460 | |||
461 | public override int GetHashCode() | ||
462 | { | ||
463 | return RegionID.GetHashCode() ^ TerrainImage.GetHashCode() ^ ParcelImage.GetHashCode(); | ||
464 | } | ||
465 | |||
466 | #endregion | ||
467 | |||
468 | /// <value> | ||
469 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. | ||
470 | /// | ||
471 | /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? | ||
472 | /// </value> | ||
473 | public IPEndPoint ExternalEndPoint | ||
474 | { | ||
475 | get | ||
476 | { | ||
477 | // Old one defaults to IPv6 | ||
478 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
479 | |||
480 | IPAddress ia = null; | ||
481 | // If it is already an IP, don't resolve it - just return directly | ||
482 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
483 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
484 | |||
485 | // Reset for next check | ||
486 | ia = null; | ||
487 | try | ||
488 | { | ||
489 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
490 | { | ||
491 | if (ia == null) | ||
492 | ia = Adr; | ||
493 | |||
494 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
495 | { | ||
496 | ia = Adr; | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | } | ||
501 | catch (SocketException e) | ||
502 | { | ||
503 | throw new Exception( | ||
504 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
505 | e + "' attached to this exception", e); | ||
506 | } | ||
507 | |||
508 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | public string ExternalHostName | ||
513 | { | ||
514 | get { return m_externalHostName; } | ||
515 | set { m_externalHostName = value; } | ||
516 | } | ||
517 | |||
518 | public IPEndPoint InternalEndPoint | ||
519 | { | ||
520 | get { return m_internalEndPoint; } | ||
521 | set { m_internalEndPoint = value; } | ||
522 | } | ||
523 | |||
524 | public ulong RegionHandle | ||
525 | { | ||
526 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } | ||
527 | } | ||
528 | } | ||
529 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs new file mode 100644 index 0000000..2e7237e --- /dev/null +++ b/OpenSim/Services/Interfaces/IGridUserService.cs | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Records user information specific to a grid but which is not part of a user's account. | ||
36 | /// </summary> | ||
37 | public class GridUserInfo | ||
38 | { | ||
39 | public string UserID; | ||
40 | |||
41 | public UUID HomeRegionID; | ||
42 | public Vector3 HomePosition; | ||
43 | public Vector3 HomeLookAt; | ||
44 | |||
45 | public UUID LastRegionID; | ||
46 | public Vector3 LastPosition; | ||
47 | public Vector3 LastLookAt; | ||
48 | |||
49 | public bool Online; | ||
50 | public DateTime Login; | ||
51 | public DateTime Logout; | ||
52 | |||
53 | public GridUserInfo() {} | ||
54 | |||
55 | public GridUserInfo(Dictionary<string, object> kvp) | ||
56 | { | ||
57 | if (kvp.ContainsKey("UserID")) | ||
58 | UserID = kvp["UserID"].ToString(); | ||
59 | |||
60 | if (kvp.ContainsKey("HomeRegionID")) | ||
61 | UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID); | ||
62 | if (kvp.ContainsKey("HomePosition")) | ||
63 | Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition); | ||
64 | if (kvp.ContainsKey("HomeLookAt")) | ||
65 | Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); | ||
66 | |||
67 | if (kvp.ContainsKey("LastRegionID")) | ||
68 | UUID.TryParse(kvp["LastRegionID"].ToString(), out LastRegionID); | ||
69 | if (kvp.ContainsKey("LastPosition")) | ||
70 | Vector3.TryParse(kvp["LastPosition"].ToString(), out LastPosition); | ||
71 | if (kvp.ContainsKey("LastLookAt")) | ||
72 | Vector3.TryParse(kvp["LastLookAt"].ToString(), out LastLookAt); | ||
73 | |||
74 | if (kvp.ContainsKey("Login")) | ||
75 | DateTime.TryParse(kvp["Login"].ToString(), out Login); | ||
76 | if (kvp.ContainsKey("Logout")) | ||
77 | DateTime.TryParse(kvp["Logout"].ToString(), out Logout); | ||
78 | if (kvp.ContainsKey("Online")) | ||
79 | Boolean.TryParse(kvp["Online"].ToString(), out Online); | ||
80 | |||
81 | } | ||
82 | |||
83 | public virtual Dictionary<string, object> ToKeyValuePairs() | ||
84 | { | ||
85 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
86 | result["UserID"] = UserID; | ||
87 | |||
88 | result["HomeRegionID"] = HomeRegionID.ToString(); | ||
89 | result["HomePosition"] = HomePosition.ToString(); | ||
90 | result["HomeLookAt"] = HomeLookAt.ToString(); | ||
91 | |||
92 | result["LastRegionID"] = LastRegionID.ToString(); | ||
93 | result["LastPosition"] = LastPosition.ToString(); | ||
94 | result["LastLookAt"] = LastLookAt.ToString(); | ||
95 | |||
96 | result["Online"] = Online.ToString(); | ||
97 | result["Login"] = Login.ToString(); | ||
98 | result["Logout"] = Logout.ToString(); | ||
99 | |||
100 | return result; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public interface IGridUserService | ||
105 | { | ||
106 | GridUserInfo LoggedIn(string userID); | ||
107 | |||
108 | /// <summary> | ||
109 | /// Informs the grid that a user is logged out and to remove any session data for them | ||
110 | /// </summary> | ||
111 | /// <param name="userID">Ignore if your connector does not use userID for logouts</param> | ||
112 | /// <param name="sessionID">Ignore if your connector does not use sessionID for logouts</param> | ||
113 | /// <param name="regionID">RegionID where the user was last located</param> | ||
114 | /// <param name="lastPosition">Last region-relative position of the user</param> | ||
115 | /// <param name="lastLookAt">Last normalized look direction for the user</param> | ||
116 | /// <returns>True if the logout request was successfully processed, otherwise false</returns> | ||
117 | bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); | ||
118 | |||
119 | bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt); | ||
120 | |||
121 | /// <summary> | ||
122 | /// Stores the last known user position at the grid level | ||
123 | /// </summary> | ||
124 | /// <param name="userID">Ignore if your connector does not use userID for position updates</param> | ||
125 | /// <param name="sessionID">Ignore if your connector does not use sessionID for position updates</param> | ||
126 | /// <param name="regionID">RegionID where the user is currently located</param> | ||
127 | /// <param name="lastPosition">Region-relative position</param> | ||
128 | /// <param name="lastLookAt">Normalized look direction</param> | ||
129 | /// <returns>True if the user's last position was successfully updated, otherwise false</returns> | ||
130 | bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); | ||
131 | |||
132 | GridUserInfo GetGridUserInfo(string userID); | ||
133 | GridUserInfo[] GetGridUserInfo(string[] userID); | ||
134 | } | ||
135 | } | ||
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs new file mode 100644 index 0000000..5e012fb --- /dev/null +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Net; | ||
30 | using System.Collections.Generic; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | using OpenMetaverse; | ||
34 | |||
35 | namespace OpenSim.Services.Interfaces | ||
36 | { | ||
37 | public interface IGatekeeperService | ||
38 | { | ||
39 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Returns the region a Hypergrid visitor should enter. | ||
43 | /// </summary> | ||
44 | /// <remarks> | ||
45 | /// Usually the returned region will be the requested region. But the grid can choose to | ||
46 | /// redirect the user to another region: e.g., a default gateway region. | ||
47 | /// </remarks> | ||
48 | /// <param name="regionID">The region the visitor *wants* to enter</param> | ||
49 | /// <param name="agentID">The visitor's User ID. Will be missing (UUID.Zero) in older OpenSims.</param> | ||
50 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | ||
51 | /// <param name="message">[out] A message to show to the user (optional, may be null)</param> | ||
52 | /// <returns>The region the visitor should enter, or null if no region can be found / is allowed</returns> | ||
53 | GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message); | ||
54 | |||
55 | bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason); | ||
56 | |||
57 | } | ||
58 | |||
59 | public interface IUserAgentService | ||
60 | { | ||
61 | bool LoginAgentToGrid(GridRegion source, AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); | ||
62 | |||
63 | void LogoutAgent(UUID userID, UUID sessionID); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Returns the home region of a remote user. | ||
67 | /// </summary> | ||
68 | /// <returns>On success: the user's home region. If the user doesn't exist: null.</returns> | ||
69 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
70 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); | ||
71 | |||
72 | /// <summary> | ||
73 | /// Returns the Server URLs of a remote user. | ||
74 | /// </summary> | ||
75 | /// <returns>On success: the user's Server URLs. If the user doesn't exist: an empty dictionary.</returns> | ||
76 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
77 | Dictionary<string, object> GetServerURLs(UUID userID); | ||
78 | |||
79 | /// <summary> | ||
80 | /// Returns the UserInfo of a remote user. | ||
81 | /// </summary> | ||
82 | /// <returns>On success: the user's UserInfo. If the user doesn't exist: an empty dictionary.</returns> | ||
83 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
84 | Dictionary<string, object> GetUserInfo(UUID userID); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Returns the current location of a remote user. | ||
88 | /// </summary> | ||
89 | /// <returns>On success: the user's Server URLs. If the user doesn't exist: "".</returns> | ||
90 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
91 | string LocateUser(UUID userID); | ||
92 | |||
93 | /// <summary> | ||
94 | /// Returns the Universal User Identifier for 'targetUserID' on behalf of 'userID'. | ||
95 | /// </summary> | ||
96 | /// <returns>On success: the user's UUI. If the user doesn't exist: "".</returns> | ||
97 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
98 | string GetUUI(UUID userID, UUID targetUserID); | ||
99 | |||
100 | /// <summary> | ||
101 | /// Returns the remote user that has the given name. | ||
102 | /// </summary> | ||
103 | /// <returns>On success: the user's UUID. If the user doesn't exist: UUID.Zero.</returns> | ||
104 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
105 | UUID GetUUID(String first, String last); | ||
106 | |||
107 | // Returns the local friends online | ||
108 | [Obsolete] | ||
109 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); | ||
110 | |||
111 | bool IsAgentComingHome(UUID sessionID, string thisGridExternalName); | ||
112 | bool VerifyAgent(UUID sessionID, string token); | ||
113 | bool VerifyClient(UUID sessionID, string reportedIP); | ||
114 | } | ||
115 | |||
116 | public interface IInstantMessage | ||
117 | { | ||
118 | bool IncomingInstantMessage(GridInstantMessage im); | ||
119 | bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner); | ||
120 | } | ||
121 | public interface IFriendsSimConnector | ||
122 | { | ||
123 | bool StatusNotify(UUID userID, UUID friendID, bool online); | ||
124 | bool LocalFriendshipOffered(UUID toID, GridInstantMessage im); | ||
125 | bool LocalFriendshipApproved(UUID userID, string userName, UUID friendID); | ||
126 | } | ||
127 | |||
128 | public interface IHGFriendsService | ||
129 | { | ||
130 | int GetFriendPerms(UUID userID, UUID friendID); | ||
131 | bool NewFriendship(FriendInfo finfo, bool verified); | ||
132 | bool DeleteFriendship(FriendInfo finfo, string secret); | ||
133 | bool FriendshipOffered(UUID from, string fromName, UUID to, string message); | ||
134 | bool ValidateFriendshipOffered(UUID fromID, UUID toID); | ||
135 | // Returns the local friends online | ||
136 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); | ||
137 | } | ||
138 | |||
139 | public interface IInstantMessageSimConnector | ||
140 | { | ||
141 | bool SendInstantMessage(GridInstantMessage im); | ||
142 | } | ||
143 | } | ||
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs new file mode 100644 index 0000000..4289bba --- /dev/null +++ b/OpenSim/Services/Interfaces/IInventoryService.cs | |||
@@ -0,0 +1,204 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Callback used when a user's inventory is received from the inventory service | ||
37 | /// </summary> | ||
38 | public delegate void InventoryReceiptCallback( | ||
39 | ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items); | ||
40 | |||
41 | public interface IInventoryService | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// Create the entire inventory for a given user | ||
45 | /// </summary> | ||
46 | /// <param name="user"></param> | ||
47 | /// <returns></returns> | ||
48 | bool CreateUserInventory(UUID user); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Gets the skeleton of the inventory -- folders only | ||
52 | /// </summary> | ||
53 | /// <param name="userId"></param> | ||
54 | /// <returns></returns> | ||
55 | List<InventoryFolderBase> GetInventorySkeleton(UUID userId); | ||
56 | |||
57 | /// <summary> | ||
58 | /// Retrieve the root inventory folder for the given user. | ||
59 | /// </summary> | ||
60 | /// <param name="userID"></param> | ||
61 | /// <returns>null if no root folder was found</returns> | ||
62 | InventoryFolderBase GetRootFolder(UUID userID); | ||
63 | |||
64 | /// <summary> | ||
65 | /// Gets the user folder for the given folder-type | ||
66 | /// </summary> | ||
67 | /// <param name="userID"></param> | ||
68 | /// <param name="type"></param> | ||
69 | /// <returns></returns> | ||
70 | InventoryFolderBase GetFolderForType(UUID userID, FolderType type); | ||
71 | |||
72 | /// <summary> | ||
73 | /// Gets everything (folders and items) inside a folder | ||
74 | /// </summary> | ||
75 | /// <param name="userId"></param> | ||
76 | /// <param name="folderID"></param> | ||
77 | /// <returns>Inventory content. null if the request failed.</returns> | ||
78 | InventoryCollection GetFolderContent(UUID userID, UUID folderID); | ||
79 | |||
80 | /// <summary> | ||
81 | /// Gets everything (folders and items) inside a folder | ||
82 | /// </summary> | ||
83 | /// <param name="userId"></param> | ||
84 | /// <param name="folderIDs"></param> | ||
85 | /// <returns>Inventory content.</returns> | ||
86 | InventoryCollection[] GetMultipleFoldersContent(UUID userID, UUID[] folderIDs); | ||
87 | |||
88 | /// <summary> | ||
89 | /// Gets the items inside a folder | ||
90 | /// </summary> | ||
91 | /// <param name="userID"></param> | ||
92 | /// <param name="folderID"></param> | ||
93 | /// <returns></returns> | ||
94 | List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID); | ||
95 | |||
96 | /// <summary> | ||
97 | /// Add a new folder to the user's inventory | ||
98 | /// </summary> | ||
99 | /// <param name="folder"></param> | ||
100 | /// <returns>true if the folder was successfully added</returns> | ||
101 | bool AddFolder(InventoryFolderBase folder); | ||
102 | |||
103 | /// <summary> | ||
104 | /// Update a folder in the user's inventory | ||
105 | /// </summary> | ||
106 | /// <param name="folder"></param> | ||
107 | /// <returns>true if the folder was successfully updated</returns> | ||
108 | bool UpdateFolder(InventoryFolderBase folder); | ||
109 | |||
110 | /// <summary> | ||
111 | /// Move an inventory folder to a new location | ||
112 | /// </summary> | ||
113 | /// <param name="folder">A folder containing the details of the new location</param> | ||
114 | /// <returns>true if the folder was successfully moved</returns> | ||
115 | bool MoveFolder(InventoryFolderBase folder); | ||
116 | |||
117 | /// <summary> | ||
118 | /// Delete an item from the user's inventory | ||
119 | /// </summary> | ||
120 | /// <param name="item"></param> | ||
121 | /// <returns>true if the item was successfully deleted</returns> | ||
122 | //bool DeleteItem(InventoryItemBase item); | ||
123 | bool DeleteFolders(UUID userID, List<UUID> folderIDs); | ||
124 | |||
125 | /// <summary> | ||
126 | /// Purge an inventory folder of all its items and subfolders. | ||
127 | /// </summary> | ||
128 | /// <param name="folder"></param> | ||
129 | /// <returns>true if the folder was successfully purged</returns> | ||
130 | bool PurgeFolder(InventoryFolderBase folder); | ||
131 | |||
132 | /// <summary> | ||
133 | /// Add a new item to the user's inventory | ||
134 | /// </summary> | ||
135 | /// <param name="item"> | ||
136 | /// The item to be added. If item.FolderID == UUID.Zero then the item is added to the most suitable system | ||
137 | /// folder. If there is no suitable folder then the item is added to the user's root inventory folder. | ||
138 | /// </param> | ||
139 | /// <returns>true if the item was successfully added, false if it was not</returns> | ||
140 | bool AddItem(InventoryItemBase item); | ||
141 | |||
142 | /// <summary> | ||
143 | /// Update an item in the user's inventory | ||
144 | /// </summary> | ||
145 | /// <param name="item"></param> | ||
146 | /// <returns>true if the item was successfully updated</returns> | ||
147 | bool UpdateItem(InventoryItemBase item); | ||
148 | |||
149 | bool MoveItems(UUID ownerID, List<InventoryItemBase> items); | ||
150 | |||
151 | /// <summary> | ||
152 | /// Delete an item from the user's inventory | ||
153 | /// </summary> | ||
154 | /// <param name="item"></param> | ||
155 | /// <returns>true if the item was successfully deleted</returns> | ||
156 | //bool DeleteItem(InventoryItemBase item); | ||
157 | bool DeleteItems(UUID userID, List<UUID> itemIDs); | ||
158 | |||
159 | /// <summary> | ||
160 | /// Get an item, given by its UUID | ||
161 | /// </summary> | ||
162 | /// <param name="item"></param> | ||
163 | /// <returns>null if no item was found, otherwise the found item</returns> | ||
164 | InventoryItemBase GetItem(InventoryItemBase item); | ||
165 | |||
166 | /// <summary> | ||
167 | /// Get multiple items, given by their UUIDs | ||
168 | /// </summary> | ||
169 | /// <param name="item"></param> | ||
170 | /// <returns>null if no item was found, otherwise the found item</returns> | ||
171 | InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids); | ||
172 | |||
173 | /// <summary> | ||
174 | /// Get a folder, given by its UUID | ||
175 | /// </summary> | ||
176 | /// <param name="folder"></param> | ||
177 | /// <returns></returns> | ||
178 | InventoryFolderBase GetFolder(InventoryFolderBase folder); | ||
179 | |||
180 | /// <summary> | ||
181 | /// Does the given user have an inventory structure? | ||
182 | /// </summary> | ||
183 | /// <param name="userID"></param> | ||
184 | /// <returns></returns> | ||
185 | bool HasInventoryForUser(UUID userID); | ||
186 | |||
187 | /// <summary> | ||
188 | /// Get the active gestures of the agent. | ||
189 | /// </summary> | ||
190 | /// <param name="userId"></param> | ||
191 | /// <returns></returns> | ||
192 | List<InventoryItemBase> GetActiveGestures(UUID userId); | ||
193 | |||
194 | /// <summary> | ||
195 | /// Get the union of permissions of all inventory items | ||
196 | /// that hold the given assetID. | ||
197 | /// </summary> | ||
198 | /// <param name="userID"></param> | ||
199 | /// <param name="assetID"></param> | ||
200 | /// <returns>The permissions or 0 if no such asset is found in | ||
201 | /// the user's inventory</returns> | ||
202 | int GetAssetPermissions(UUID userID, UUID assetID); | ||
203 | } | ||
204 | } | ||
diff --git a/OpenSim/Services/Interfaces/ILandService.cs b/OpenSim/Services/Interfaces/ILandService.cs new file mode 100644 index 0000000..63d9a27 --- /dev/null +++ b/OpenSim/Services/Interfaces/ILandService.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public interface ILandService | ||
35 | { | ||
36 | LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Services/Interfaces/ILibraryService.cs b/OpenSim/Services/Interfaces/ILibraryService.cs new file mode 100644 index 0000000..861cf0e --- /dev/null +++ b/OpenSim/Services/Interfaces/ILibraryService.cs | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | using OpenSim.Framework; | ||
32 | using OpenMetaverse; | ||
33 | |||
34 | namespace OpenSim.Services.Interfaces | ||
35 | { | ||
36 | public interface ILibraryService | ||
37 | { | ||
38 | InventoryFolderImpl LibraryRootFolder { get; } | ||
39 | |||
40 | Dictionary<UUID, InventoryFolderImpl> GetAllFolders(); | ||
41 | } | ||
42 | |||
43 | } | ||
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs new file mode 100644 index 0000000..ee9b0b1 --- /dev/null +++ b/OpenSim/Services/Interfaces/ILoginService.cs | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | |||
33 | using OpenMetaverse.StructuredData; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Services.Interfaces | ||
37 | { | ||
38 | public abstract class LoginResponse | ||
39 | { | ||
40 | public abstract Hashtable ToHashtable(); | ||
41 | public abstract OSD ToOSDMap(); | ||
42 | } | ||
43 | |||
44 | public abstract class FailedLoginResponse : LoginResponse | ||
45 | { | ||
46 | } | ||
47 | |||
48 | public interface ILoginService | ||
49 | { | ||
50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, | ||
51 | string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP); | ||
52 | Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP); | ||
53 | } | ||
54 | |||
55 | |||
56 | } | ||
diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs new file mode 100644 index 0000000..78daa5f --- /dev/null +++ b/OpenSim/Services/Interfaces/IMapImageService.cs | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenSim.Framework; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public interface IMapImageService | ||
35 | { | ||
36 | //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); | ||
37 | bool AddMapTile(int x, int y, byte[] imageData, out string reason); | ||
38 | bool RemoveMapTile(int x, int y, out string reason); | ||
39 | byte[] GetMapTile(string fileName, out string format); | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Services/Interfaces/INeighbourService.cs b/OpenSim/Services/Interfaces/INeighbourService.cs new file mode 100644 index 0000000..960e13d --- /dev/null +++ b/OpenSim/Services/Interfaces/INeighbourService.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface INeighbourService | ||
36 | { | ||
37 | GridRegion HelloNeighbour(ulong regionHandle, RegionInfo otherRegion); | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Services/Interfaces/IOfflineIMService.cs b/OpenSim/Services/Interfaces/IOfflineIMService.cs new file mode 100644 index 0000000..588aaaf --- /dev/null +++ b/OpenSim/Services/Interfaces/IOfflineIMService.cs | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | |||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IOfflineIMService | ||
36 | { | ||
37 | List<GridInstantMessage> GetMessages(UUID principalID); | ||
38 | |||
39 | bool StoreMessage(GridInstantMessage im, out string reason); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Delete messages to or from this user (or group). | ||
43 | /// </summary> | ||
44 | /// <param name="userID">A user or group ID</param> | ||
45 | void DeleteMessages(UUID userID); | ||
46 | } | ||
47 | |||
48 | public class OfflineIMDataUtils | ||
49 | { | ||
50 | public static GridInstantMessage GridInstantMessage(Dictionary<string, object> dict) | ||
51 | { | ||
52 | GridInstantMessage im = new GridInstantMessage(); | ||
53 | |||
54 | if (dict.ContainsKey("BinaryBucket") && dict["BinaryBucket"] != null) | ||
55 | im.binaryBucket = OpenMetaverse.Utils.HexStringToBytes(dict["BinaryBucket"].ToString(), true); | ||
56 | |||
57 | if (dict.ContainsKey("Dialog") && dict["Dialog"] != null) | ||
58 | im.dialog = byte.Parse(dict["Dialog"].ToString()); | ||
59 | |||
60 | if (dict.ContainsKey("FromAgentID") && dict["FromAgentID"] != null) | ||
61 | im.fromAgentID = new Guid(dict["FromAgentID"].ToString()); | ||
62 | |||
63 | if (dict.ContainsKey("FromAgentName") && dict["FromAgentName"] != null) | ||
64 | im.fromAgentName = dict["FromAgentName"].ToString(); | ||
65 | else | ||
66 | im.fromAgentName = string.Empty; | ||
67 | |||
68 | if (dict.ContainsKey("FromGroup") && dict["FromGroup"] != null) | ||
69 | im.fromGroup = bool.Parse(dict["FromGroup"].ToString()); | ||
70 | |||
71 | if (dict.ContainsKey("SessionID") && dict["SessionID"] != null) | ||
72 | im.imSessionID = new Guid(dict["SessionID"].ToString()); | ||
73 | |||
74 | if (dict.ContainsKey("Message") && dict["Message"] != null) | ||
75 | im.message = dict["Message"].ToString(); | ||
76 | else | ||
77 | im.message = string.Empty; | ||
78 | |||
79 | if (dict.ContainsKey("Offline") && dict["Offline"] != null) | ||
80 | im.offline = byte.Parse(dict["Offline"].ToString()); | ||
81 | |||
82 | if (dict.ContainsKey("EstateID") && dict["EstateID"] != null) | ||
83 | im.ParentEstateID = UInt32.Parse(dict["EstateID"].ToString()); | ||
84 | |||
85 | if (dict.ContainsKey("Position") && dict["Position"] != null) | ||
86 | im.Position = Vector3.Parse(dict["Position"].ToString()); | ||
87 | |||
88 | if (dict.ContainsKey("RegionID") && dict["RegionID"] != null) | ||
89 | im.RegionID = new Guid(dict["RegionID"].ToString()); | ||
90 | |||
91 | if (dict.ContainsKey("Timestamp") && dict["Timestamp"] != null) | ||
92 | im.timestamp = UInt32.Parse(dict["Timestamp"].ToString()); | ||
93 | |||
94 | if (dict.ContainsKey("ToAgentID") && dict["ToAgentID"] != null) | ||
95 | im.toAgentID = new Guid(dict["ToAgentID"].ToString()); | ||
96 | |||
97 | return im; | ||
98 | } | ||
99 | |||
100 | public static Dictionary<string, object> GridInstantMessage(GridInstantMessage im) | ||
101 | { | ||
102 | Dictionary<string, object> dict = new Dictionary<string, object>(); | ||
103 | |||
104 | dict["BinaryBucket"] = OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, im.binaryBucket.Length, null); | ||
105 | dict["Dialog"] = im.dialog.ToString(); | ||
106 | dict["FromAgentID"] = im.fromAgentID.ToString(); | ||
107 | dict["FromAgentName"] = im.fromAgentName == null ? string.Empty : im.fromAgentName; | ||
108 | dict["FromGroup"] = im.fromGroup.ToString(); | ||
109 | dict["SessionID"] = im.imSessionID.ToString(); | ||
110 | dict["Message"] = im.message == null ? string.Empty : im.message; | ||
111 | dict["Offline"] = im.offline.ToString(); | ||
112 | dict["EstateID"] = im.ParentEstateID.ToString(); | ||
113 | dict["Position"] = im.Position.ToString(); | ||
114 | dict["RegionID"] = im.RegionID.ToString(); | ||
115 | dict["Timestamp"] = im.timestamp.ToString(); | ||
116 | dict["ToAgentID"] = im.toAgentID.ToString(); | ||
117 | |||
118 | return dict; | ||
119 | } | ||
120 | |||
121 | } | ||
122 | } | ||
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs new file mode 100644 index 0000000..90f9842 --- /dev/null +++ b/OpenSim/Services/Interfaces/IPresenceService.cs | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public class PresenceInfo | ||
36 | { | ||
37 | public string UserID; | ||
38 | public UUID RegionID; | ||
39 | |||
40 | public PresenceInfo() | ||
41 | { | ||
42 | } | ||
43 | |||
44 | public PresenceInfo(Dictionary<string, object> kvp) | ||
45 | { | ||
46 | if (kvp.ContainsKey("UserID")) | ||
47 | UserID = kvp["UserID"].ToString(); | ||
48 | if (kvp.ContainsKey("RegionID")) | ||
49 | UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); | ||
50 | } | ||
51 | |||
52 | public Dictionary<string, object> ToKeyValuePairs() | ||
53 | { | ||
54 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
55 | result["UserID"] = UserID; | ||
56 | result["RegionID"] = RegionID.ToString(); | ||
57 | |||
58 | return result; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | public interface IPresenceService | ||
63 | { | ||
64 | /// <summary> | ||
65 | /// Store session information. | ||
66 | /// </summary> | ||
67 | /// <returns>/returns> | ||
68 | /// <param name='userID'></param> | ||
69 | /// <param name='sessionID'></param> | ||
70 | /// <param name='secureSessionID'></param> | ||
71 | bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); | ||
72 | |||
73 | /// <summary> | ||
74 | /// Remove session information. | ||
75 | /// </summary> | ||
76 | /// <returns></returns> | ||
77 | /// <param name='sessionID'></param> | ||
78 | bool LogoutAgent(UUID sessionID); | ||
79 | |||
80 | /// <summary> | ||
81 | /// Remove session information for all agents in the given region. | ||
82 | /// </summary> | ||
83 | /// <returns></returns> | ||
84 | /// <param name='regionID'></param> | ||
85 | bool LogoutRegionAgents(UUID regionID); | ||
86 | |||
87 | /// <summary> | ||
88 | /// Update data for an existing session. | ||
89 | /// </summary> | ||
90 | /// <returns></returns> | ||
91 | /// <param name='sessionID'></param> | ||
92 | /// <param name='regionID'></param> | ||
93 | bool ReportAgent(UUID sessionID, UUID regionID); | ||
94 | |||
95 | /// <summary> | ||
96 | /// Get session information for a given session ID. | ||
97 | /// </summary> | ||
98 | /// <returns></returns> | ||
99 | /// <param name='sessionID'></param> | ||
100 | PresenceInfo GetAgent(UUID sessionID); | ||
101 | |||
102 | /// <summary> | ||
103 | /// Get session information for a collection of users. | ||
104 | /// </summary> | ||
105 | /// <returns>Session information for the users.</returns> | ||
106 | /// <param name='userIDs'></param> | ||
107 | PresenceInfo[] GetAgents(string[] userIDs); | ||
108 | } | ||
109 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs new file mode 100644 index 0000000..42c414d --- /dev/null +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
34 | |||
35 | namespace OpenSim.Services.Interfaces | ||
36 | { | ||
37 | public interface ISimulationService | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Retrieve the scene with the given region ID. | ||
41 | /// </summary> | ||
42 | /// <param name='regionId'> | ||
43 | /// Region identifier. | ||
44 | /// </param> | ||
45 | /// <returns> | ||
46 | /// The scene. | ||
47 | /// </returns> | ||
48 | IScene GetScene(UUID regionId); | ||
49 | |||
50 | ISimulationService GetInnerService(); | ||
51 | |||
52 | #region Agents | ||
53 | |||
54 | /// <summary> | ||
55 | /// Ask the simulator hosting the destination to create an agent on that region. | ||
56 | /// </summary> | ||
57 | /// <param name="source">The region that the user is coming from. Will be null if the user | ||
58 | /// logged-in directly, or arrived from a simulator that doesn't send this parameter.</param> | ||
59 | /// <param name="destination"></param> | ||
60 | /// <param name="aCircuit"></param> | ||
61 | /// <param name="flags"></param> | ||
62 | /// <param name="reason">Reason message in the event of a failure.</param> | ||
63 | bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Full child agent update. | ||
67 | /// </summary> | ||
68 | /// <param name="regionHandle"></param> | ||
69 | /// <param name="data"></param> | ||
70 | /// <returns></returns> | ||
71 | bool UpdateAgent(GridRegion destination, AgentData data); | ||
72 | |||
73 | /// <summary> | ||
74 | /// Short child agent update, mostly for position. | ||
75 | /// </summary> | ||
76 | /// <param name="regionHandle"></param> | ||
77 | /// <param name="data"></param> | ||
78 | /// <returns></returns> | ||
79 | bool UpdateAgent(GridRegion destination, AgentPosition data); | ||
80 | |||
81 | /// <summary> | ||
82 | /// Returns whether a propspective user is allowed to visit the region. | ||
83 | /// </summary> | ||
84 | /// <param name="destination">Desired destination</param> | ||
85 | /// <param name="agentID">The visitor's User ID</param> | ||
86 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | ||
87 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> | ||
88 | /// <param name="position">Position in the region</param> | ||
89 | /// <param name="sversion"> | ||
90 | /// Version that the requesting simulator is runing. If null then no version check is carried out. | ||
91 | /// </param> | ||
92 | /// <param name="version">Version that the target simulator is running</param> | ||
93 | /// <param name="reason">[out] Optional error message</param> | ||
94 | /// <returns>True: ok; False: not allowed</returns> | ||
95 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List<UUID> features, out string version, out string reason); | ||
96 | |||
97 | /// <summary> | ||
98 | /// Message from receiving region to departing region, telling it got contacted by the client. | ||
99 | /// When sent over REST, it invokes the opaque uri. | ||
100 | /// </summary> | ||
101 | /// <param name="regionHandle"></param> | ||
102 | /// <param name="id"></param> | ||
103 | /// <param name="uri"></param> | ||
104 | /// <returns></returns> | ||
105 | bool ReleaseAgent(UUID originRegion, UUID id, string uri); | ||
106 | |||
107 | /// <summary> | ||
108 | /// Close agent. | ||
109 | /// </summary> | ||
110 | /// <param name="regionHandle"></param> | ||
111 | /// <param name="id"></param> | ||
112 | /// <returns></returns> | ||
113 | bool CloseAgent(GridRegion destination, UUID id, string auth_token); | ||
114 | |||
115 | #endregion Agents | ||
116 | |||
117 | #region Objects | ||
118 | |||
119 | /// <summary> | ||
120 | /// Create an object in the destination region. This message is used primarily for prim crossing. | ||
121 | /// </summary> | ||
122 | /// <param name="regionHandle"></param> | ||
123 | /// <param name="sog"></param> | ||
124 | /// <param name="isLocalCall"></param> | ||
125 | /// <returns></returns> | ||
126 | bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall); | ||
127 | |||
128 | #endregion Objects | ||
129 | |||
130 | } | ||
131 | } | ||
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs new file mode 100644 index 0000000..2f7702c --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | |||
34 | namespace OpenSim.Services.Interfaces | ||
35 | { | ||
36 | public class UserAccount | ||
37 | { | ||
38 | public UserAccount() | ||
39 | { | ||
40 | } | ||
41 | |||
42 | public UserAccount(UUID principalID) | ||
43 | { | ||
44 | PrincipalID = principalID; | ||
45 | } | ||
46 | |||
47 | /// <summary> | ||
48 | /// Initializes a new instance of the <see cref="OpenSim.Services.Interfaces.UserAccount"/> class. | ||
49 | /// This method is used by externasl/3rd party management applications that need us to create a | ||
50 | /// random UUID for the new user. | ||
51 | /// </summary> | ||
52 | /// <param name='scopeID'> | ||
53 | /// Scope I. | ||
54 | /// </param> | ||
55 | /// <param name='firstName'> | ||
56 | /// First name. | ||
57 | /// </param> | ||
58 | /// <param name='lastName'> | ||
59 | /// Last name. | ||
60 | /// </param> | ||
61 | /// <param name='email'> | ||
62 | /// Email. | ||
63 | /// </param> | ||
64 | public UserAccount(UUID scopeID, string firstName, string lastName, string email) | ||
65 | { | ||
66 | PrincipalID = UUID.Random(); | ||
67 | ScopeID = scopeID; | ||
68 | FirstName = firstName; | ||
69 | LastName = lastName; | ||
70 | Email = email; | ||
71 | ServiceURLs = new Dictionary<string, object>(); | ||
72 | Created = Util.UnixTimeSinceEpoch(); | ||
73 | } | ||
74 | |||
75 | public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email) | ||
76 | { | ||
77 | PrincipalID = principalID; | ||
78 | ScopeID = scopeID; | ||
79 | FirstName = firstName; | ||
80 | LastName = lastName; | ||
81 | Email = email; | ||
82 | ServiceURLs = new Dictionary<string, object>(); | ||
83 | Created = Util.UnixTimeSinceEpoch(); | ||
84 | } | ||
85 | |||
86 | public string FirstName; | ||
87 | public string LastName; | ||
88 | public string Email; | ||
89 | public UUID PrincipalID; | ||
90 | public UUID ScopeID; | ||
91 | public int UserLevel; | ||
92 | public int UserFlags; | ||
93 | public string UserTitle; | ||
94 | public Boolean LocalToGrid = true; | ||
95 | |||
96 | public Dictionary<string, object> ServiceURLs; | ||
97 | |||
98 | public int Created; | ||
99 | |||
100 | public string Name | ||
101 | { | ||
102 | get { return FirstName + " " + LastName; } | ||
103 | } | ||
104 | |||
105 | public UserAccount(Dictionary<string, object> kvp) | ||
106 | { | ||
107 | if (kvp.ContainsKey("FirstName")) | ||
108 | FirstName = kvp["FirstName"].ToString(); | ||
109 | if (kvp.ContainsKey("LastName")) | ||
110 | LastName = kvp["LastName"].ToString(); | ||
111 | if (kvp.ContainsKey("Email")) | ||
112 | Email = kvp["Email"].ToString(); | ||
113 | if (kvp.ContainsKey("PrincipalID")) | ||
114 | UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); | ||
115 | if (kvp.ContainsKey("ScopeID")) | ||
116 | UUID.TryParse(kvp["ScopeID"].ToString(), out ScopeID); | ||
117 | if (kvp.ContainsKey("UserLevel")) | ||
118 | UserLevel = Convert.ToInt32(kvp["UserLevel"].ToString()); | ||
119 | if (kvp.ContainsKey("UserFlags")) | ||
120 | UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString()); | ||
121 | if (kvp.ContainsKey("UserTitle")) | ||
122 | UserTitle = kvp["UserTitle"].ToString(); | ||
123 | if (kvp.ContainsKey("LocalToGrid")) | ||
124 | Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid); | ||
125 | |||
126 | if (kvp.ContainsKey("Created")) | ||
127 | Created = Convert.ToInt32(kvp["Created"].ToString()); | ||
128 | if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null) | ||
129 | { | ||
130 | ServiceURLs = new Dictionary<string, object>(); | ||
131 | string str = kvp["ServiceURLs"].ToString(); | ||
132 | if (str != string.Empty) | ||
133 | { | ||
134 | string[] parts = str.Split(new char[] { ';' }); | ||
135 | // Dictionary<string, object> dic = new Dictionary<string, object>(); | ||
136 | foreach (string s in parts) | ||
137 | { | ||
138 | string[] parts2 = s.Split(new char[] { '*' }); | ||
139 | if (parts2.Length == 2) | ||
140 | ServiceURLs[parts2[0]] = parts2[1]; | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | |||
146 | public Dictionary<string, object> ToKeyValuePairs() | ||
147 | { | ||
148 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
149 | result["FirstName"] = FirstName; | ||
150 | result["LastName"] = LastName; | ||
151 | result["Email"] = Email; | ||
152 | result["PrincipalID"] = PrincipalID.ToString(); | ||
153 | result["ScopeID"] = ScopeID.ToString(); | ||
154 | result["Created"] = Created.ToString(); | ||
155 | result["UserLevel"] = UserLevel.ToString(); | ||
156 | result["UserFlags"] = UserFlags.ToString(); | ||
157 | result["UserTitle"] = UserTitle; | ||
158 | result["LocalToGrid"] = LocalToGrid.ToString(); | ||
159 | |||
160 | string str = string.Empty; | ||
161 | foreach (KeyValuePair<string, object> kvp in ServiceURLs) | ||
162 | { | ||
163 | str += kvp.Key + "*" + (kvp.Value == null ? "" : kvp.Value) + ";"; | ||
164 | } | ||
165 | result["ServiceURLs"] = str; | ||
166 | |||
167 | return result; | ||
168 | } | ||
169 | |||
170 | }; | ||
171 | |||
172 | public interface IUserAccountService | ||
173 | { | ||
174 | UserAccount GetUserAccount(UUID scopeID, UUID userID); | ||
175 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); | ||
176 | UserAccount GetUserAccount(UUID scopeID, string Email); | ||
177 | |||
178 | /// <summary> | ||
179 | /// Returns the list of avatars that matches both the search criterion and the scope ID passed | ||
180 | /// </summary> | ||
181 | /// <param name="scopeID"></param> | ||
182 | /// <param name="query"></param> | ||
183 | /// <returns></returns> | ||
184 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); | ||
185 | |||
186 | /// <summary> | ||
187 | /// Store the data given, wich replaces the stored data, therefore must be complete. | ||
188 | /// </summary> | ||
189 | /// <param name="data"></param> | ||
190 | /// <returns></returns> | ||
191 | bool StoreUserAccount(UserAccount data); | ||
192 | |||
193 | void InvalidateCache(UUID userID); | ||
194 | } | ||
195 | } | ||
diff --git a/OpenSim/Services/Interfaces/IUserManagement.cs b/OpenSim/Services/Interfaces/IUserManagement.cs new file mode 100644 index 0000000..9e560d5 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserManagement.cs | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// This maintains the relationship between a UUID and a user name. | ||
37 | /// </summary> | ||
38 | public interface IUserManagement | ||
39 | { | ||
40 | string GetUserName(UUID uuid); | ||
41 | string GetUserHomeURL(UUID uuid); | ||
42 | string GetUserUUI(UUID uuid); | ||
43 | bool GetUserUUI(UUID userID, out string uui); | ||
44 | string GetUserServerURL(UUID uuid, string serverType); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Get user ID by the given name. | ||
48 | /// </summary> | ||
49 | /// <param name="name"></param> | ||
50 | /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns> | ||
51 | UUID GetUserIdByName(string name); | ||
52 | |||
53 | /// <summary> | ||
54 | /// Get user ID by the given name. | ||
55 | /// </summary> | ||
56 | /// <param name="firstName"></param> | ||
57 | /// <param name="lastName"></param> | ||
58 | /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns> | ||
59 | UUID GetUserIdByName(string firstName, string lastName); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Add a user. | ||
63 | /// </summary> | ||
64 | /// <remarks> | ||
65 | /// If an account is found for the UUID, then the names in this will be used rather than any information | ||
66 | /// extracted from creatorData. | ||
67 | /// </remarks> | ||
68 | /// <param name="uuid"></param> | ||
69 | /// <param name="creatorData">The creator data for this user.</param> | ||
70 | void AddUser(UUID uuid, string creatorData); | ||
71 | |||
72 | /// <summary> | ||
73 | /// Add a user. | ||
74 | /// </summary> | ||
75 | /// <remarks> | ||
76 | /// The UUID is related to the name without any other checks being performed, such as user account presence. | ||
77 | /// </remarks> | ||
78 | /// <param name="uuid"></param> | ||
79 | /// <param name="firstName"></param> | ||
80 | /// <param name="lastName"></param> | ||
81 | void AddUser(UUID uuid, string firstName, string lastName); | ||
82 | |||
83 | /// <summary> | ||
84 | /// Add a user. | ||
85 | /// </summary> | ||
86 | /// <remarks> | ||
87 | /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the | ||
88 | /// AddUser(UUID uuid, string creatorData) method. | ||
89 | /// </remarks> | ||
90 | /// <param name="uuid"></param> | ||
91 | /// <param name="firstName"></param> | ||
92 | /// <param name="profileURL"></param> | ||
93 | void AddUser(UUID uuid, string firstName, string lastName, string homeURL); | ||
94 | |||
95 | bool IsLocalGridUser(UUID uuid); | ||
96 | } | ||
97 | } | ||
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs new file mode 100644 index 0000000..121baa8 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IUserProfilesService | ||
36 | { | ||
37 | #region Classifieds | ||
38 | OSD AvatarClassifiedsRequest(UUID creatorId); | ||
39 | bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result); | ||
40 | bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result); | ||
41 | bool ClassifiedDelete(UUID recordId); | ||
42 | #endregion Classifieds | ||
43 | |||
44 | #region Picks | ||
45 | OSD AvatarPicksRequest(UUID creatorId); | ||
46 | bool PickInfoRequest(ref UserProfilePick pick, ref string result); | ||
47 | bool PicksUpdate(ref UserProfilePick pick, ref string result); | ||
48 | bool PicksDelete(UUID pickId); | ||
49 | #endregion Picks | ||
50 | |||
51 | #region Notes | ||
52 | bool AvatarNotesRequest(ref UserProfileNotes note); | ||
53 | bool NotesUpdate(ref UserProfileNotes note, ref string result); | ||
54 | #endregion Notes | ||
55 | |||
56 | #region Profile Properties | ||
57 | bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); | ||
58 | bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); | ||
59 | #endregion Profile Properties | ||
60 | |||
61 | #region User Preferences | ||
62 | bool UserPreferencesRequest(ref UserPreferences pref, ref string result); | ||
63 | bool UserPreferencesUpdate(ref UserPreferences pref, ref string result); | ||
64 | #endregion User Preferences | ||
65 | |||
66 | #region Interests | ||
67 | bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); | ||
68 | #endregion Interests | ||
69 | |||
70 | #region Utility | ||
71 | OSD AvatarImageAssetsRequest(UUID avatarId); | ||
72 | #endregion Utility | ||
73 | |||
74 | #region UserData | ||
75 | bool RequestUserAppData(ref UserAppData prop, ref string result); | ||
76 | bool SetUserAppData(UserAppData prop, ref string result); | ||
77 | #endregion UserData | ||
78 | } | ||
79 | } | ||
80 | |||
diff --git a/OpenSim/Services/Interfaces/OpenProfileClient.cs b/OpenSim/Services/Interfaces/OpenProfileClient.cs new file mode 100644 index 0000000..bda8151 --- /dev/null +++ b/OpenSim/Services/Interfaces/OpenProfileClient.cs | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.Reflection; | ||
34 | using System.Text; | ||
35 | using System.Xml; | ||
36 | using log4net; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | |||
40 | namespace OpenSim.Services.UserProfilesService | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// A client for accessing a profile server using the OpenProfile protocol. | ||
44 | /// </summary> | ||
45 | /// <remarks> | ||
46 | /// This class was adapted from the full OpenProfile class. Since it's only a client, and not a server, | ||
47 | /// it's much simpler. | ||
48 | /// </remarks> | ||
49 | public class OpenProfileClient | ||
50 | { | ||
51 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | private string m_serverURI; | ||
54 | |||
55 | /// <summary> | ||
56 | /// Creates a client for accessing a foreign grid's profile server using the OpenProfile protocol. | ||
57 | /// </summary> | ||
58 | /// <param name="serverURI">The grid's profile server URL</param> | ||
59 | public OpenProfileClient(string serverURI) | ||
60 | { | ||
61 | m_serverURI = serverURI; | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Gets an avatar's profile using the OpenProfile protocol. | ||
66 | /// </summary> | ||
67 | /// <param name="props">On success, this will contain the avatar's profile</param> | ||
68 | /// <returns>Success/failure</returns> | ||
69 | /// <remarks> | ||
70 | /// There are two profile modules currently in use in OpenSim: the older one is OpenProfile, and the newer | ||
71 | /// one is UserProfileModule (this file). This method attempts to read an avatar's profile from a foreign | ||
72 | /// grid using the OpenProfile protocol. | ||
73 | /// </remarks> | ||
74 | public bool RequestAvatarPropertiesUsingOpenProfile(ref UserProfileProperties props) | ||
75 | { | ||
76 | Hashtable ReqHash = new Hashtable(); | ||
77 | ReqHash["avatar_id"] = props.UserId.ToString(); | ||
78 | |||
79 | Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI); | ||
80 | |||
81 | if (profileData == null) | ||
82 | return false; | ||
83 | if (!profileData.ContainsKey("data")) | ||
84 | return false; | ||
85 | |||
86 | ArrayList dataArray = (ArrayList)profileData["data"]; | ||
87 | |||
88 | if (dataArray == null || dataArray[0] == null) | ||
89 | return false; | ||
90 | profileData = (Hashtable)dataArray[0]; | ||
91 | |||
92 | props.WebUrl = string.Empty; | ||
93 | props.AboutText = String.Empty; | ||
94 | props.FirstLifeText = String.Empty; | ||
95 | props.ImageId = UUID.Zero; | ||
96 | props.FirstLifeImageId = UUID.Zero; | ||
97 | props.PartnerId = UUID.Zero; | ||
98 | |||
99 | if (profileData["ProfileUrl"] != null) | ||
100 | props.WebUrl = profileData["ProfileUrl"].ToString(); | ||
101 | if (profileData["AboutText"] != null) | ||
102 | props.AboutText = profileData["AboutText"].ToString(); | ||
103 | if (profileData["FirstLifeAboutText"] != null) | ||
104 | props.FirstLifeText = profileData["FirstLifeAboutText"].ToString(); | ||
105 | if (profileData["Image"] != null) | ||
106 | props.ImageId = new UUID(profileData["Image"].ToString()); | ||
107 | if (profileData["FirstLifeImage"] != null) | ||
108 | props.FirstLifeImageId = new UUID(profileData["FirstLifeImage"].ToString()); | ||
109 | if (profileData["Partner"] != null) | ||
110 | props.PartnerId = new UUID(profileData["Partner"].ToString()); | ||
111 | |||
112 | props.WantToMask = 0; | ||
113 | props.WantToText = String.Empty; | ||
114 | props.SkillsMask = 0; | ||
115 | props.SkillsText = String.Empty; | ||
116 | props.Language = String.Empty; | ||
117 | |||
118 | if (profileData["wantmask"] != null) | ||
119 | props.WantToMask = Convert.ToInt32(profileData["wantmask"].ToString()); | ||
120 | if (profileData["wanttext"] != null) | ||
121 | props.WantToText = profileData["wanttext"].ToString(); | ||
122 | |||
123 | if (profileData["skillsmask"] != null) | ||
124 | props.SkillsMask = Convert.ToInt32(profileData["skillsmask"].ToString()); | ||
125 | if (profileData["skillstext"] != null) | ||
126 | props.SkillsText = profileData["skillstext"].ToString(); | ||
127 | |||
128 | if (profileData["languages"] != null) | ||
129 | props.Language = profileData["languages"].ToString(); | ||
130 | |||
131 | return true; | ||
132 | } | ||
133 | } | ||
134 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a2f6c4f --- /dev/null +++ b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Services.Interfaces")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("http://opensimulator.org")] | ||
12 | [assembly: AssemblyProduct("OpenSim")] | ||
13 | [assembly: AssemblyCopyright("OpenSimulator developers")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("39091de1-1c4c-4ebe-bb01-31551ec1749d")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("0.8.2.*")] | ||
33 | |||