aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
diff options
context:
space:
mode:
authorDiva Canto2010-01-17 18:04:55 -0800
committerDiva Canto2010-01-17 18:04:55 -0800
commitb2e6ec9e12ad07eb08496ebe8ca0476b793017d5 (patch)
treeac72f03b9cfca6f344d697f6d7581e5147ccf450 /OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
parentOops, forgot this one. (diff)
downloadopensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.zip
opensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.gz
opensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.bz2
opensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.xz
Agent gets there through the Gatekeeper, but still a few quirks to fix.
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs115
1 files changed, 115 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
new file mode 100644
index 0000000..baafd7d
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.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 */
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32
33using OpenSim.Services.Interfaces;
34using GridRegion = OpenSim.Services.Interfaces.GridRegion;
35
36using log4net;
37using Nwc.XmlRpc;
38using OpenMetaverse;
39
40namespace OpenSim.Server.Handlers.Hypergrid
41{
42 public class HypergridHandlers
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 private IGatekeeperService m_GatekeeperService;
47
48 public HypergridHandlers(IGatekeeperService gatekeeper)
49 {
50 m_GatekeeperService = gatekeeper;
51 }
52
53 /// <summary>
54 /// Someone wants to link to us
55 /// </summary>
56 /// <param name="request"></param>
57 /// <returns></returns>
58 public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient)
59 {
60 Hashtable requestData = (Hashtable)request.Params[0];
61 //string host = (string)requestData["host"];
62 //string portstr = (string)requestData["port"];
63 string name = (string)requestData["region_name"];
64
65 UUID regionID = UUID.Zero;
66 string imageURL = string.Empty;
67 ulong regionHandle = 0;
68 string reason = string.Empty;
69
70 bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason);
71
72 Hashtable hash = new Hashtable();
73 hash["result"] = success.ToString();
74 hash["uuid"] = regionID.ToString();
75 hash["handle"] = regionHandle.ToString();
76 hash["region_image"] = imageURL;
77
78 XmlRpcResponse response = new XmlRpcResponse();
79 response.Value = hash;
80 return response;
81 }
82
83 public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient)
84 {
85 Hashtable requestData = (Hashtable)request.Params[0];
86 //string host = (string)requestData["host"];
87 //string portstr = (string)requestData["port"];
88 string regionID_str = (string)requestData["region_uuid"];
89 UUID regionID = UUID.Zero;
90 UUID.TryParse(regionID_str, out regionID);
91
92 GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID);
93
94 Hashtable hash = new Hashtable();
95 if (regInfo == null)
96 hash["result"] = "false";
97 else
98 {
99 hash["result"] = "true";
100 hash["uuid"] = regInfo.RegionID.ToString();
101 hash["x"] = regInfo.RegionLocX.ToString();
102 hash["y"] = regInfo.RegionLocY.ToString();
103 hash["region_name"] = regInfo.RegionName;
104 hash["hostname"] = regInfo.ExternalHostName;
105 hash["http_port"] = regInfo.HttpPort.ToString();
106 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
107 }
108 XmlRpcResponse response = new XmlRpcResponse();
109 response.Value = hash;
110 return response;
111
112 }
113
114 }
115}