diff options
author | Diva Canto | 2009-09-22 20:25:00 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-22 20:25:00 -0700 |
commit | 882d2c9cc399c4c7d1809702104ce94c9c2c7b17 (patch) | |
tree | 7b79cdd31d5ac659586acc4ae15bfd6519b4565e /OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs | |
parent | Moved RegionName from RegionInfo to SimpleRegionInfo. (diff) | |
download | opensim-SC_OLD-882d2c9cc399c4c7d1809702104ce94c9c2c7b17.zip opensim-SC_OLD-882d2c9cc399c4c7d1809702104ce94c9c2c7b17.tar.gz opensim-SC_OLD-882d2c9cc399c4c7d1809702104ce94c9c2c7b17.tar.bz2 opensim-SC_OLD-882d2c9cc399c4c7d1809702104ce94c9c2c7b17.tar.xz |
Added hg console commands to the module.
Added the IN connector module for link-region and corresponding handler to be used in the regions only. No service as such is needed.
This will replace the current link-region machinery. Compiles but not tested.
Diffstat (limited to 'OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs new file mode 100644 index 0000000..b8d9c7d --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs | |||
@@ -0,0 +1,112 @@ | |||
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.Reflection; | ||
32 | using System.Net; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Server.Handlers.Base; | ||
39 | |||
40 | using log4net; | ||
41 | using Nwc.XmlRpc; | ||
42 | |||
43 | namespace OpenSim.Server.Handlers.Grid | ||
44 | { | ||
45 | public class HypergridServiceInConnector : ServiceConnector | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger( | ||
49 | MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private List<SimpleRegionInfo> m_RegionsOnSim = new List<SimpleRegionInfo>(); | ||
52 | |||
53 | public HypergridServiceInConnector(IConfigSource config, IHttpServer server) : | ||
54 | base(config, server) | ||
55 | { | ||
56 | server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); | ||
57 | } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Someone wants to link to us | ||
61 | /// </summary> | ||
62 | /// <param name="request"></param> | ||
63 | /// <returns></returns> | ||
64 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
65 | { | ||
66 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
67 | //string host = (string)requestData["host"]; | ||
68 | //string portstr = (string)requestData["port"]; | ||
69 | string name = (string)requestData["region_name"]; | ||
70 | |||
71 | m_log.DebugFormat("[HGrid]: Hyperlink request"); | ||
72 | |||
73 | SimpleRegionInfo regInfo = null; | ||
74 | foreach (SimpleRegionInfo r in m_RegionsOnSim) | ||
75 | { | ||
76 | if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) | ||
77 | { | ||
78 | regInfo = r; | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | if (regInfo == null) | ||
84 | regInfo = m_RegionsOnSim[0]; // Send out the first region | ||
85 | |||
86 | Hashtable hash = new Hashtable(); | ||
87 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
88 | hash["handle"] = regInfo.RegionHandle.ToString(); | ||
89 | //m_log.Debug(">> Here " + regInfo.RegionHandle); | ||
90 | //hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); | ||
91 | hash["region_name"] = regInfo.RegionName; | ||
92 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
93 | //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port); | ||
94 | |||
95 | |||
96 | XmlRpcResponse response = new XmlRpcResponse(); | ||
97 | response.Value = hash; | ||
98 | return response; | ||
99 | } | ||
100 | |||
101 | public void AddRegion(SimpleRegionInfo rinfo) | ||
102 | { | ||
103 | m_RegionsOnSim.Add(rinfo); | ||
104 | } | ||
105 | |||
106 | public void RemoveRegion(SimpleRegionInfo rinfo) | ||
107 | { | ||
108 | if (m_RegionsOnSim.Contains(rinfo)) | ||
109 | m_RegionsOnSim.Remove(rinfo); | ||
110 | } | ||
111 | } | ||
112 | } | ||