aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs7
-rw-r--r--OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs112
3 files changed, 117 insertions, 4 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs
index b80c479..7bf2e66 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Server.Handlers.Grid
49 String.Empty); 49 String.Empty);
50 50
51 if (gridService == String.Empty) 51 if (gridService == String.Empty)
52 throw new Exception("No AuthenticationService in config file"); 52 throw new Exception("No GridService in config file");
53 53
54 Object[] args = new Object[] { config }; 54 Object[] args = new Object[] { config };
55 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 55 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 39c0584..e72c2eb 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -38,6 +38,7 @@ using System.Xml.Serialization;
38using System.Collections.Generic; 38using System.Collections.Generic;
39using OpenSim.Server.Base; 39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41using OpenSim.Framework; 42using OpenSim.Framework;
42using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
43using OpenMetaverse; 44using OpenMetaverse;
@@ -117,7 +118,7 @@ namespace OpenSim.Server.Handlers.Grid
117 Dictionary<string, object> rinfoData = new Dictionary<string, object>(); 118 Dictionary<string, object> rinfoData = new Dictionary<string, object>();
118 foreach (KeyValuePair<string, string> kvp in request) 119 foreach (KeyValuePair<string, string> kvp in request)
119 rinfoData[kvp.Key] = kvp.Value; 120 rinfoData[kvp.Key] = kvp.Value;
120 SimpleRegionInfo rinfo = new SimpleRegionInfo(rinfoData); 121 GridRegion rinfo = new GridRegion(rinfoData);
121 122
122 bool result = m_GridService.RegisterRegion(scopeID, rinfo); 123 bool result = m_GridService.RegisterRegion(scopeID, rinfo);
123 124
@@ -158,11 +159,11 @@ namespace OpenSim.Server.Handlers.Grid
158 else 159 else
159 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); 160 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
160 161
161 List<SimpleRegionInfo> rinfos = m_GridService.GetNeighbours(scopeID, regionID); 162 List<GridRegion> rinfos = m_GridService.GetNeighbours(scopeID, regionID);
162 163
163 Dictionary<string, object> result = new Dictionary<string, object>(); 164 Dictionary<string, object> result = new Dictionary<string, object>();
164 int i = 0; 165 int i = 0;
165 foreach (SimpleRegionInfo rinfo in rinfos) 166 foreach (GridRegion rinfo in rinfos)
166 { 167 {
167 Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); 168 Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
168 result["region" + i] = rinfoDict; 169 result["region" + i] = rinfoDict;
diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs
new file mode 100644
index 0000000..ad63485
--- /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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using System.Net;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Server.Handlers.Base;
39
40using log4net;
41using Nwc.XmlRpc;
42
43namespace 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("linkk_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}