aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
blob: ff3538aada6c00a33371fb829f80b5be4a0e31d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

using OpenSim.Framework;
using OpenSim.Framework.Types;
using OpenGrid.Framework.Communications;

using Nwc.XmlRpc;

namespace OpenGrid.Framework.Communications.OGS1
{
    public class OGS1GridServices : IGridServices
    {
        public RegionCommsListener listener;

        public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo)
        {
            Hashtable GridParams = new Hashtable();

            // Login / Authentication
            GridParams["authkey"] = gridInfo.GridServerSendKey;
            GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated();
            GridParams["sim_ip"] = regionInfo.CommsExternalAddress;
            GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString();

            // Package into an XMLRPC Request
            ArrayList SendParams = new ArrayList();
            SendParams.Add(GridParams);

            // Send Request
            XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
            XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000);
            Hashtable GridRespData = (Hashtable)GridResp.Value;
            Hashtable griddatahash = GridRespData;

            // Process Response
            if (GridRespData.ContainsKey("error"))
            {
                string errorstring = (string)GridRespData["error"];
                OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
                return null;
            }
            //this.neighbours = (ArrayList)GridRespData["neighbours"];

            listener = new RegionCommsListener();

            return listener;
        }

        public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
        {
            return null;
        }
        public RegionInfo RequestNeighbourInfo(ulong regionHandle)
        {
            return null;
        }
        public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
        {
            return null;
        }
    }
}