aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/Properties/Settings.Designer.cs30
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs (renamed from OpenSim/Region/Application/OpenSimController.cs)261
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs9
4 files changed, 207 insertions, 126 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..869efe2
--- /dev/null
+++ b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("RemoteController")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("RemoteController")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("a8d10dbc-371b-4514-8d1d-7d3589f658af")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/ApplicationPlugins/RemoteController/Properties/Settings.Designer.cs b/OpenSim/ApplicationPlugins/RemoteController/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..86daae1
--- /dev/null
+++ b/OpenSim/ApplicationPlugins/RemoteController/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
1//------------------------------------------------------------------------------
2// <auto-generated>
3// This code was generated by a tool.
4// Runtime Version:2.0.50727.832
5//
6// Changes to this file may cause incorrect behavior and will be lost if
7// the code is regenerated.
8// </auto-generated>
9//------------------------------------------------------------------------------
10
11namespace RemoteController.Properties
12{
13
14
15 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
17 internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 {
19
20 private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21
22 public static Settings Default
23 {
24 get
25 {
26 return defaultInstance;
27 }
28 }
29 }
30}
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9fae426..2566a6b 100644
--- a/OpenSim/Region/Application/OpenSimController.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -1,122 +1,139 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections.Generic;
3using System.Net; 3using System.Text;
4using System.Timers; 4using System.Net;
5using Nwc.XmlRpc; 5using OpenSim;
6using OpenSim.Framework; 6using OpenSim.Framework.Console;
7using OpenSim.Framework.Console; 7using OpenSim.Framework;
8using OpenSim.Framework.Servers; 8using OpenSim.Framework.Servers;
9 9using Mono.Addins;
10namespace OpenSim 10using Mono.Addins.Description;
11{ 11using Nini;
12 internal class OpenSimController 12using Nini.Config;
13 { 13using Nwc.XmlRpc;
14 private OpenSimMain m_app; 14using System.Collections;
15 private BaseHttpServer m_httpServer; 15using System.Timers;
16 private const bool m_enablexmlrpc = true; 16
17 17[assembly: Addin]
18 public OpenSimController(OpenSimMain core, BaseHttpServer httpd) 18[assembly: AddinDependency("OpenSim", "0.4")]
19 { 19
20 m_app = core; 20namespace OpenSim.ApplicationPlugins.LoadRegions
21 m_httpServer = httpd; 21{
22 22 [Extension("/OpenSim/Startup")]
23 if (m_enablexmlrpc) 23 public class RemoteAdminPlugin : IApplicationPlugin
24 { 24 {
25 m_httpServer.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); 25 private OpenSimMain m_app;
26 m_httpServer.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); 26 private BaseHttpServer m_httpd;
27 } 27
28 } 28 public void Initialise(OpenSimMain openSim)
29 29 {
30 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) 30 if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
31 { 31 {
32 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); 32 System.Console.WriteLine("RADMIN","Remote Admin Plugin Enabled");
33 XmlRpcResponse response = new XmlRpcResponse(); 33
34 Hashtable requestData = (Hashtable) request.Params[0]; 34 m_app = openSim;
35 35 m_httpd = openSim.HttpServer;
36 if ((string) requestData["shutdown"] == "delayed") 36
37 { 37 m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod);
38 int timeout = (Int32)requestData["milliseconds"]; 38 m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod);
39 39 }
40 Hashtable responseData = new Hashtable(); 40 }
41 responseData["accepted"] = "true"; 41
42 response.Value = responseData; 42 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
43 43 {
44 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + 44 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request");
45 " second(s). Please save what you are doing and log out."); 45 XmlRpcResponse response = new XmlRpcResponse();
46 46 Hashtable requestData = (Hashtable)request.Params[0];
47 // Perform shutdown 47
48 Timer shutdownTimer = new Timer(timeout); // Wait before firing 48 if ((string)requestData["shutdown"] == "delayed")
49 shutdownTimer.AutoReset = false; 49 {
50 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); 50 int timeout = (Int32)requestData["milliseconds"];
51 shutdownTimer.Start(); 51
52 52 Hashtable responseData = new Hashtable();
53 return response; 53 responseData["accepted"] = "true";
54 } 54 response.Value = responseData;
55 else 55
56 { 56 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() +
57 Hashtable responseData = new Hashtable(); 57 " second(s). Please save what you are doing and log out.");
58 responseData["accepted"] = "true"; 58
59 response.Value = responseData; 59 // Perform shutdown
60 60 Timer shutdownTimer = new Timer(timeout); // Wait before firing
61 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 61 shutdownTimer.AutoReset = false;
62 62 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
63 // Perform shutdown 63 shutdownTimer.Start();
64 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing 64
65 shutdownTimer.AutoReset = false; 65 return response;
66 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); 66 }
67 shutdownTimer.Start(); 67 else
68 68 {
69 return response; 69 Hashtable responseData = new Hashtable();
70 } 70 responseData["accepted"] = "true";
71 } 71 response.Value = responseData;
72 72
73 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) 73 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
74 { 74
75 m_app.Shutdown(); 75 // Perform shutdown
76 } 76 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
77 77 shutdownTimer.AutoReset = false;
78 public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request) 78 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
79 { 79 shutdownTimer.Start();
80 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); 80
81 XmlRpcResponse response = new XmlRpcResponse(); 81 return response;
82 Hashtable requestData = (Hashtable) request.Params[0]; 82 }
83 83 }
84 RegionInfo newRegionData = new RegionInfo(); 84
85 85 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
86 try 86 {
87 { 87 m_app.Shutdown();
88 newRegionData.RegionID = (string)requestData["region_id"]; 88 }
89 newRegionData.RegionName = (string)requestData["region_name"]; 89
90 newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]); 90 public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request)
91 newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]); 91 {
92 92 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request");
93 // Security risk 93 XmlRpcResponse response = new XmlRpcResponse();
94 newRegionData.DataStore = (string) requestData["datastore"]; 94 Hashtable requestData = (Hashtable)request.Params[0];
95 95
96 newRegionData.InternalEndPoint = new IPEndPoint( 96 RegionInfo newRegionData = new RegionInfo();
97 IPAddress.Parse((string) requestData["listen_ip"]), 0); 97
98 98 try
99 newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"]; 99 {
100 newRegionData.ExternalHostName = (string)requestData["external_address"]; 100 newRegionData.RegionID = (string)requestData["region_id"];
101 101 newRegionData.RegionName = (string)requestData["region_name"];
102 newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; 102 newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]);
103 newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; 103 newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]);
104 104
105 m_app.CreateRegion(newRegionData); 105 // Security risk
106 106 newRegionData.DataStore = (string)requestData["datastore"];
107 Hashtable responseData = new Hashtable(); 107
108 responseData["created"] = "true"; 108 newRegionData.InternalEndPoint = new IPEndPoint(
109 response.Value = responseData; 109 IPAddress.Parse((string)requestData["listen_ip"]), 0);
110 } 110
111 catch (Exception e) 111 newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"];
112 { 112 newRegionData.ExternalHostName = (string)requestData["external_address"];
113 Hashtable responseData = new Hashtable(); 113
114 responseData["created"] = "false"; 114 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"];
115 responseData["error"] = e.ToString(); 115 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"];
116 response.Value = responseData; 116
117 } 117 m_app.CreateRegion(newRegionData);
118 118
119 return response; 119 Hashtable responseData = new Hashtable();
120 } 120 responseData["created"] = "true";
121 } 121 response.Value = responseData;
122} 122 }
123 catch (Exception e)
124 {
125 Hashtable responseData = new Hashtable();
126 responseData["created"] = "false";
127 responseData["error"] = e.ToString();
128 response.Value = responseData;
129 }
130
131 return response;
132 }
133
134 public void Close()
135 {
136
137 }
138 }
139} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 51a647d..9fd5bcc 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -61,8 +61,6 @@ namespace OpenSim
61 public bool m_gridLocalAsset; 61 public bool m_gridLocalAsset;
62 public bool m_SendChildAgentTaskData; 62 public bool m_SendChildAgentTaskData;
63 63
64 private OpenSimController m_controller;
65
66 protected LocalLoginService m_loginService; 64 protected LocalLoginService m_loginService;
67 65
68 protected string m_storageDll; 66 protected string m_storageDll;
@@ -102,6 +100,11 @@ namespace OpenSim
102 set { m_config = value; } 100 set { m_config = value; }
103 } 101 }
104 102
103 public BaseHttpServer HttpServer
104 {
105 get { return m_httpServer; }
106 }
107
105 private ModuleLoader m_moduleLoader; 108 private ModuleLoader m_moduleLoader;
106 109
107 public ModuleLoader ModuleLoader 110 public ModuleLoader ModuleLoader
@@ -279,8 +282,6 @@ namespace OpenSim
279 282
280 base.StartUp(); 283 base.StartUp();
281 284
282 m_controller = new OpenSimController(this, m_httpServer);
283
284 if (m_sandbox) 285 if (m_sandbox)
285 { 286 {
286 LocalInventoryService inventoryService = new LocalInventoryService(); 287 LocalInventoryService inventoryService = new LocalInventoryService();