aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs71
1 files changed, 68 insertions, 3 deletions
diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
index ff3538a..a6301f3 100644
--- a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
+++ b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
@@ -14,11 +14,14 @@ namespace OpenGrid.Framework.Communications.OGS1
14 public class OGS1GridServices : IGridServices 14 public class OGS1GridServices : IGridServices
15 { 15 {
16 public RegionCommsListener listener; 16 public RegionCommsListener listener;
17 public GridInfo grid;
17 18
18 public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) 19 public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo)
19 { 20 {
20 Hashtable GridParams = new Hashtable(); 21 Hashtable GridParams = new Hashtable();
21 22
23 grid = gridInfo;
24
22 // Login / Authentication 25 // Login / Authentication
23 GridParams["authkey"] = gridInfo.GridServerSendKey; 26 GridParams["authkey"] = gridInfo.GridServerSendKey;
24 GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); 27 GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated();
@@ -26,7 +29,7 @@ namespace OpenGrid.Framework.Communications.OGS1
26 GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString(); 29 GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString();
27 30
28 // Package into an XMLRPC Request 31 // Package into an XMLRPC Request
29 ArrayList SendParams = new ArrayList(); 32 ArrayList SendParams = new ArrayList();
30 SendParams.Add(GridParams); 33 SendParams.Add(GridParams);
31 34
32 // Send Request 35 // Send Request
@@ -51,15 +54,77 @@ namespace OpenGrid.Framework.Communications.OGS1
51 54
52 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) 55 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
53 { 56 {
54 return null; 57 Hashtable param = new Hashtable();
58 param["xmin"] = regionInfo.RegionLocX - 1;
59 param["ymin"] = regionInfo.RegionLocY - 1;
60 param["xmax"] = regionInfo.RegionLocX + 1;
61 param["ymax"] = regionInfo.RegionLocY + 1;
62 IList parameters = new ArrayList();
63 parameters.Add(param);
64 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
65 XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000);
66 Hashtable respData = (Hashtable)resp.Value;
67
68 List<RegionInfo> neighbours = new List<RegionInfo>();
69
70 foreach (Hashtable n in (Hashtable)respData.Values)
71 {
72 RegionInfo neighbour = new RegionInfo();
73
74 //OGS1
75 neighbour.RegionHandle = (ulong)n["regionhandle"];
76 neighbour.RegionLocX = (uint)n["x"];
77 neighbour.RegionLocY = (uint)n["y"];
78 neighbour.RegionName = (string)n["name"];
79
80 //OGS1+
81 neighbour.CommsIPListenAddr = (string)n["sim_ip"];
82 neighbour.CommsIPListenPort = (int)n["sim_port"];
83 neighbour.CommsExternalAddress = (string)n["sim_uri"];
84 neighbour.SimUUID = (string)n["uuid"];
85
86 neighbours.Add(neighbour);
87 }
88
89 return neighbours;
55 } 90 }
56 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 91 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
57 { 92 {
93 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()");
58 return null; 94 return null;
59 } 95 }
60 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 96 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
61 { 97 {
62 return null; 98 Hashtable param = new Hashtable();
99 param["xmin"] = minX;
100 param["ymin"] = minY;
101 param["xmax"] = maxX;
102 param["ymax"] = maxY;
103 IList parameters = new ArrayList();
104 parameters.Add(param);
105 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
106 XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000);
107 Hashtable respData = (Hashtable)resp.Value;
108
109 List<MapBlockData> neighbours = new List<MapBlockData>();
110
111 foreach (Hashtable n in (Hashtable)respData.Values)
112 {
113 MapBlockData neighbour = new MapBlockData();
114
115 neighbour.X = (ushort)n["x"];
116 neighbour.Y = (ushort)n["y"];
117
118 neighbour.Name = (string)n["name"];
119 neighbour.Access = (byte)n["access"];
120 neighbour.RegionFlags = (uint)n["region-flags"];
121 neighbour.WaterHeight = (byte)n["water-height"];
122 neighbour.MapImageId = (string)n["map-image-id"];
123
124 neighbours.Add(neighbour);
125 }
126
127 return neighbours;
63 } 128 }
64 } 129 }
65} 130}