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