aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs')
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs146
1 files changed, 0 insertions, 146 deletions
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs
deleted file mode 100644
index 425a20e..0000000
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs
+++ /dev/null
@@ -1,146 +0,0 @@
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 Nwc.XmlRpc;
29using System;
30using System.Net;
31using System.IO;
32using System.Xml;
33using System.Collections;
34using System.Collections.Generic;
35using libsecondlife;
36
37namespace OpenGridServices.Manager
38{
39 public class GridServerConnectionManager
40 {
41 private string ServerURL;
42 public LLUUID SessionID;
43 public bool connected=false;
44
45 public RegionBlock[][] WorldMap;
46
47 public bool Connect(string GridServerURL, string username, string password)
48 {
49 try
50 {
51 this.ServerURL=GridServerURL;
52 Hashtable LoginParamsHT = new Hashtable();
53 LoginParamsHT["username"]=username;
54 LoginParamsHT["password"]=password;
55 ArrayList LoginParams = new ArrayList();
56 LoginParams.Add(LoginParamsHT);
57 XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
58 XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
59 if (GridResp.IsFault)
60 {
61 connected=false;
62 return false;
63 }
64 else
65 {
66 Hashtable gridrespData = (Hashtable)GridResp.Value;
67 this.SessionID = new LLUUID((string)gridrespData["session_id"]);
68 connected=true;
69 return true;
70 }
71 }
72 catch(Exception e)
73 {
74 Console.WriteLine(e.ToString());
75 connected=false;
76 return false;
77 }
78 }
79
80 public void DownloadMap()
81 {
82 System.Net.WebClient mapdownloader = new WebClient();
83 Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist");
84
85 RegionBlock TempRegionData;
86
87 XmlDocument doc = new XmlDocument();
88 doc.Load(regionliststream);
89 regionliststream.Close();
90 XmlNode rootnode = doc.FirstChild;
91 if (rootnode.Name != "regions")
92 {
93 // TODO - ERROR!
94 }
95
96 for (int i = 0; i <= rootnode.ChildNodes.Count; i++)
97 {
98 if (rootnode.ChildNodes.Item(i).Name != "region")
99 {
100 // TODO - ERROR!
101 }
102 else
103 {
104 TempRegionData = new RegionBlock();
105 }
106 }
107 }
108
109 public bool RestartServer()
110 {
111 return true;
112 }
113
114 public bool ShutdownServer()
115 {
116 try
117 {
118 Hashtable ShutdownParamsHT = new Hashtable();
119 ArrayList ShutdownParams = new ArrayList();
120 ShutdownParamsHT["session_id"]=this.SessionID.ToString();
121 ShutdownParams.Add(ShutdownParamsHT);
122 XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams);
123 XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL, 3000);
124 if (GridResp.IsFault)
125 {
126 return false;
127 }
128 else
129 {
130 connected=false;
131 return true;
132 }
133 }
134 catch(Exception e)
135 {
136 Console.WriteLine(e.ToString());
137 return false;
138 }
139 }
140
141 public void DisconnectServer()
142 {
143 this.connected=false;
144 }
145 }
146}