aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs104
1 files changed, 104 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
new file mode 100644
index 0000000..cf5d521
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
@@ -0,0 +1,104 @@
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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using Nwc.XmlRpc;
36using OpenSim.Server.Base;
37using OpenSim.Server.Handlers.Inventory;
38using OpenSim.Services.Interfaces;
39using OpenSim.Framework;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Server.Handlers.Base;
42using OpenMetaverse;
43
44namespace OpenSim.Server.Handlers.Hypergrid
45{
46 public class HGInventoryServiceInConnector : InventoryServiceInConnector
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 //private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
51 //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
52
53 private IUserAgentService m_UserAgentService;
54
55 public HGInventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
56 base(config, server, configName)
57 {
58 IConfig serverConfig = config.Configs[m_ConfigName];
59 if (serverConfig == null)
60 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
61
62 string userAgentService = serverConfig.GetString("UserAgentService", string.Empty);
63 string m_userserver_url = serverConfig.GetString("UserAgentURI", String.Empty);
64 if (m_userserver_url != string.Empty)
65 {
66 Object[] args = new Object[] { m_userserver_url };
67 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args);
68 }
69
70 AddHttpHandlers(server);
71 m_log.Debug("[HG HG INVENTORY HANDLER]: handlers initialized");
72 }
73
74 /// <summary>
75 /// Check that the source of an inventory request for a particular agent is a current session belonging to
76 /// that agent.
77 /// </summary>
78 /// <param name="session_id"></param>
79 /// <param name="avatar_id"></param>
80 /// <returns></returns>
81 public override bool CheckAuthSession(string session_id, string avatar_id)
82 {
83 m_log.InfoFormat("[HG INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id);
84 // This doesn't work
85
86 // if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
87 // {
88 // //cache miss, ask userserver
89 // m_UserAgentService.VerifyAgent(session_id, ???);
90 // }
91 // else
92 // {
93 // // cache hits
94 // m_log.Info("[HG INVENTORY IN CONNECTOR]: got authed session from cache");
95 // return true;
96 // }
97
98 // m_log.Warn("[HG INVENTORY IN CONNECTOR]: unknown session_id, request rejected");
99 // return false;
100
101 return true;
102 }
103 }
104}