diff options
Diffstat (limited to 'OpenSim/Services/HypergridService/HomeUsersSecurityService.cs')
-rw-r--r-- | OpenSim/Services/HypergridService/HomeUsersSecurityService.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/OpenSim/Services/HypergridService/HomeUsersSecurityService.cs b/OpenSim/Services/HypergridService/HomeUsersSecurityService.cs new file mode 100644 index 0000000..a7adfc1 --- /dev/null +++ b/OpenSim/Services/HypergridService/HomeUsersSecurityService.cs | |||
@@ -0,0 +1,67 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Net; | ||
4 | using System.Reflection; | ||
5 | |||
6 | using OpenSim.Services.Interfaces; | ||
7 | |||
8 | using OpenMetaverse; | ||
9 | using log4net; | ||
10 | using Nini.Config; | ||
11 | |||
12 | namespace OpenSim.Services.HypergridService | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// This service is for HG1.5 only, to make up for the fact that clients don't | ||
16 | /// keep any private information in themselves, and that their 'home service' | ||
17 | /// needs to do it for them. | ||
18 | /// Once we have better clients, this shouldn't be needed. | ||
19 | /// </summary> | ||
20 | public class HomeUsersSecurityService : IHomeUsersSecurityService | ||
21 | { | ||
22 | private static readonly ILog m_log = | ||
23 | LogManager.GetLogger( | ||
24 | MethodBase.GetCurrentMethod().DeclaringType); | ||
25 | |||
26 | // | ||
27 | // This is a persistent storage wannabe for dealing with the | ||
28 | // quirks of HG1.5. We don't really want to store this in a table. | ||
29 | // But this is the necessary information for securing clients | ||
30 | // coming home. | ||
31 | // | ||
32 | protected static Dictionary<UUID, IPEndPoint> m_ClientEndPoints = new Dictionary<UUID, IPEndPoint>(); | ||
33 | |||
34 | public HomeUsersSecurityService(IConfigSource config) | ||
35 | { | ||
36 | m_log.DebugFormat("[HOME USERS SECURITY]: Starting..."); | ||
37 | } | ||
38 | |||
39 | public void SetEndPoint(UUID sessionID, IPEndPoint ep) | ||
40 | { | ||
41 | m_log.DebugFormat("[HOME USERS SECURITY]: Set EndPoint {0} for session {1}", ep.ToString(), sessionID); | ||
42 | |||
43 | lock (m_ClientEndPoints) | ||
44 | m_ClientEndPoints[sessionID] = ep; | ||
45 | } | ||
46 | |||
47 | public IPEndPoint GetEndPoint(UUID sessionID) | ||
48 | { | ||
49 | lock (m_ClientEndPoints) | ||
50 | if (m_ClientEndPoints.ContainsKey(sessionID)) | ||
51 | { | ||
52 | m_log.DebugFormat("[HOME USERS SECURITY]: Get EndPoint {0} for session {1}", m_ClientEndPoints[sessionID].ToString(), sessionID); | ||
53 | return m_ClientEndPoints[sessionID]; | ||
54 | } | ||
55 | |||
56 | return null; | ||
57 | } | ||
58 | |||
59 | public void RemoveEndPoint(UUID sessionID) | ||
60 | { | ||
61 | m_log.DebugFormat("[HOME USERS SECURITY]: Remove EndPoint for session {0}", sessionID); | ||
62 | lock (m_ClientEndPoints) | ||
63 | if (m_ClientEndPoints.ContainsKey(sessionID)) | ||
64 | m_ClientEndPoints.Remove(sessionID); | ||
65 | } | ||
66 | } | ||
67 | } | ||