aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimController.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimController.cs264
1 files changed, 132 insertions, 132 deletions
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/Region/Application/OpenSimController.cs
index 14e4a4c..b4e0ee0 100644
--- a/OpenSim/Region/Application/OpenSimController.cs
+++ b/OpenSim/Region/Application/OpenSimController.cs
@@ -1,132 +1,132 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Collections; 3using System.Collections;
4using System.IO; 4using System.IO;
5using System.Text; 5using System.Text;
6using Nini.Config; 6using Nini.Config;
7using OpenSim.Framework.Communications.Cache; 7using OpenSim.Framework.Communications.Cache;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Interfaces; 9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Servers; 10using OpenSim.Framework.Servers;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13using OpenSim.Region.ClientStack; 13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local; 14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.Communications.OGS1; 15using OpenSim.Region.Communications.OGS1;
16using OpenSim.Region.Environment; 16using OpenSim.Region.Environment;
17using OpenSim.Region.Environment.Scenes; 17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Region.Physics.Manager; 18using OpenSim.Region.Physics.Manager;
19using System.Globalization; 19using System.Globalization;
20using Nwc.XmlRpc; 20using Nwc.XmlRpc;
21using RegionInfo = OpenSim.Framework.Types.RegionInfo; 21using RegionInfo = OpenSim.Framework.Types.RegionInfo;
22 22
23namespace OpenSim 23namespace OpenSim
24{ 24{
25 class OpenSimController 25 class OpenSimController
26 { 26 {
27 private OpenSimMain m_app; 27 private OpenSimMain m_app;
28 private BaseHttpServer m_httpServer; 28 private BaseHttpServer m_httpServer;
29 private const bool m_enablexmlrpc = false; 29 private const bool m_enablexmlrpc = false;
30 30
31 public OpenSimController(OpenSimMain core, BaseHttpServer httpd) 31 public OpenSimController(OpenSimMain core, BaseHttpServer httpd)
32 { 32 {
33 m_app = core; 33 m_app = core;
34 m_httpServer = httpd; 34 m_httpServer = httpd;
35 35
36 if (m_enablexmlrpc) 36 if (m_enablexmlrpc)
37 { 37 {
38 m_httpServer.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); 38 m_httpServer.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod);
39 m_httpServer.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); 39 m_httpServer.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod);
40 } 40 }
41 } 41 }
42 42
43 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) 43 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
44 { 44 {
45 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); 45 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request");
46 XmlRpcResponse response = new XmlRpcResponse(); 46 XmlRpcResponse response = new XmlRpcResponse();
47 Hashtable requestData = (Hashtable)request.Params[0]; 47 Hashtable requestData = (Hashtable)request.Params[0];
48 48
49 if ((string)requestData["shutdown"] == "delayed") 49 if ((string)requestData["shutdown"] == "delayed")
50 { 50 {
51 int timeout = Convert.ToInt32((string)requestData["milliseconds"]); 51 int timeout = Convert.ToInt32((string)requestData["milliseconds"]);
52 52
53 Hashtable responseData = new Hashtable(); 53 Hashtable responseData = new Hashtable();
54 responseData["accepted"] = "true"; 54 responseData["accepted"] = "true";
55 response.Value = responseData; 55 response.Value = responseData;
56 56
57 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out."); 57 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out.");
58 58
59 // Perform shutdown 59 // Perform shutdown
60 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 60 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
61 shutdownTimer.AutoReset = false; 61 shutdownTimer.AutoReset = false;
62 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 62 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed);
63 63
64 return response; 64 return response;
65 } 65 }
66 else 66 else
67 { 67 {
68 Hashtable responseData = new Hashtable(); 68 Hashtable responseData = new Hashtable();
69 responseData["accepted"] = "true"; 69 responseData["accepted"] = "true";
70 response.Value = responseData; 70 response.Value = responseData;
71 71
72 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 72 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
73 73
74 // Perform shutdown 74 // Perform shutdown
75 System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing 75 System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing
76 shutdownTimer.AutoReset = false; 76 shutdownTimer.AutoReset = false;
77 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 77 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed);
78 78
79 return response; 79 return response;
80 } 80 }
81 } 81 }
82 82
83 void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 83 void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
84 { 84 {
85 m_app.Shutdown(); 85 m_app.Shutdown();
86 } 86 }
87 87
88 public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request) 88 public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request)
89 { 89 {
90 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); 90 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request");
91 XmlRpcResponse response = new XmlRpcResponse(); 91 XmlRpcResponse response = new XmlRpcResponse();
92 Hashtable requestData = (Hashtable)request.Params[0]; 92 Hashtable requestData = (Hashtable)request.Params[0];
93 93
94 RegionInfo newRegionData = new RegionInfo(); 94 RegionInfo newRegionData = new RegionInfo();
95 95
96 try 96 try
97 { 97 {
98 newRegionData.RegionID = (string)requestData["region_id"]; 98 newRegionData.RegionID = (string)requestData["region_id"];
99 newRegionData.RegionName = (string)requestData["region_name"]; 99 newRegionData.RegionName = (string)requestData["region_name"];
100 newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]); 100 newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]);
101 newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]); 101 newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]);
102 102
103 // Security risk 103 // Security risk
104 newRegionData.DataStore = (string)requestData["datastore"]; 104 newRegionData.DataStore = (string)requestData["datastore"];
105 105
106 newRegionData.InternalEndPoint = new System.Net.IPEndPoint( 106 newRegionData.InternalEndPoint = new System.Net.IPEndPoint(
107 System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0); 107 System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0);
108 108
109 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]); 109 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]);
110 newRegionData.ExternalHostName = (string)requestData["external_address"]; 110 newRegionData.ExternalHostName = (string)requestData["external_address"];
111 111
112 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; 112 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"];
113 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; 113 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"];
114 114
115 m_app.CreateRegion(newRegionData); 115 m_app.CreateRegion(newRegionData);
116 116
117 Hashtable responseData = new Hashtable(); 117 Hashtable responseData = new Hashtable();
118 responseData["created"] = "true"; 118 responseData["created"] = "true";
119 response.Value = responseData; 119 response.Value = responseData;
120 } 120 }
121 catch (Exception e) 121 catch (Exception e)
122 { 122 {
123 Hashtable responseData = new Hashtable(); 123 Hashtable responseData = new Hashtable();
124 responseData["created"] = "false"; 124 responseData["created"] = "false";
125 responseData["error"] = e.ToString(); 125 responseData["error"] = e.ToString();
126 response.Value = responseData; 126 response.Value = responseData;
127 } 127 }
128 128
129 return response; 129 return response;
130 } 130 }
131 } 131 }
132} 132}