aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Hypergrid
diff options
context:
space:
mode:
authorDiva Canto2010-01-18 10:37:11 -0800
committerDiva Canto2010-01-18 10:37:11 -0800
commitfd64823466ee667d0d827f95d3001ec8675512b2 (patch)
tree8b5b695da9283a693c29d9d1614e12cfeeaa8d5a /OpenSim/Services/Connectors/Hypergrid
parent* Fixed misspelling of field in GridService (diff)
downloadopensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.zip
opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.tar.gz
opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.tar.bz2
opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.tar.xz
* Added missing GatekeeperServiceConnector
* Added basic machinery for teleporting users home. Untested.
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs119
1 files changed, 119 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
new file mode 100644
index 0000000..a8d9292
--- /dev/null
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -0,0 +1,119 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Net;
5
6using OpenSim.Services.Interfaces;
7using GridRegion = OpenSim.Services.Interfaces.GridRegion;
8
9using OpenMetaverse;
10using Nwc.XmlRpc;
11
12using OpenSim.Services.Connectors.Simulation;
13
14namespace OpenSim.Services.Connectors.Hypergrid
15{
16 public class GatekeeperServiceConnector : SimulationServiceConnector
17 {
18 protected override string AgentPath()
19 {
20 return "/foreignagent/";
21 }
22
23 protected override string ObjectPath()
24 {
25 return "/foreignobject/";
26 }
27
28 public GridRegion GetHomeRegion(GridRegion gatekeeper, UUID userID, out Vector3 position, out Vector3 lookAt)
29 {
30 position = Vector3.UnitY; lookAt = Vector3.UnitY;
31
32 Hashtable hash = new Hashtable();
33 hash["userID"] = userID.ToString();
34
35 IList paramList = new ArrayList();
36 paramList.Add(hash);
37
38 XmlRpcRequest request = new XmlRpcRequest("get_home_region", paramList);
39 string uri = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort + "/";
40 XmlRpcResponse response = null;
41 try
42 {
43 response = request.Send(uri, 10000);
44 }
45 catch (Exception e)
46 {
47 return null;
48 }
49
50 if (response.IsFault)
51 {
52 return null;
53 }
54
55 hash = (Hashtable)response.Value;
56 //foreach (Object o in hash)
57 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
58 try
59 {
60 bool success = false;
61 Boolean.TryParse((string)hash["result"], out success);
62 if (success)
63 {
64 GridRegion region = new GridRegion();
65
66 UUID.TryParse((string)hash["uuid"], out region.RegionID);
67 //m_log.Debug(">> HERE, uuid: " + region.RegionID);
68 int n = 0;
69 if (hash["x"] != null)
70 {
71 Int32.TryParse((string)hash["x"], out n);
72 region.RegionLocX = n;
73 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
74 }
75 if (hash["y"] != null)
76 {
77 Int32.TryParse((string)hash["y"], out n);
78 region.RegionLocY = n;
79 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
80 }
81 if (hash["region_name"] != null)
82 {
83 region.RegionName = (string)hash["region_name"];
84 //m_log.Debug(">> HERE, name: " + region.RegionName);
85 }
86 if (hash["hostname"] != null)
87 region.ExternalHostName = (string)hash["hostname"];
88 if (hash["http_port"] != null)
89 {
90 uint p = 0;
91 UInt32.TryParse((string)hash["http_port"], out p);
92 region.HttpPort = p;
93 }
94 if (hash["internal_port"] != null)
95 {
96 int p = 0;
97 Int32.TryParse((string)hash["internal_port"], out p);
98 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
99 }
100 if (hash["position"] != null)
101 Vector3.TryParse((string)hash["position"], out position);
102 if (hash["lookAt"] != null)
103 Vector3.TryParse((string)hash["lookAt"], out lookAt);
104
105 // Successful return
106 return region;
107 }
108
109 }
110 catch (Exception e)
111 {
112 return null;
113 }
114
115 return null;
116
117 }
118 }
119}