From 32cc00ec7b26290e4b65e326164510ad6fc831d3 Mon Sep 17 00:00:00 2001 From: Jeff Lee Date: Tue, 18 Aug 2009 00:41:38 -0400 Subject: osGetLinkPrimitiveParams fix --- .../Shared/Api/Implementation/LSL_Api.cs | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2dbbf70..4e665e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1978,6 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Rotation(q.X, q.Y, q.Z, q.W); } + private LSL_Rotation GetPartRot( SceneObjectPart part ) + { + Quaternion q; + if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim + { + if (part.ParentGroup.RootPart.AttachmentPoint != 0) + { + ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); + if (avatar != null) + if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) + q = avatar.CameraRotation; // Mouselook + else + q = avatar.Rotation; // Currently infrequently updated so may be inaccurate + else + q = part.ParentGroup.GroupRotation; // Likely never get here but just in case + } + else + q = part.ParentGroup.GroupRotation; // just the group rotation + return new LSL_Rotation(q.X, q.Y, q.Z, q.W); + } + q = part.GetWorldRotation(); + return new LSL_Rotation(q.X, q.Y, q.Z, q.W); + } + public LSL_Rotation llGetLocalRot() { m_host.AddScriptLPS(1); @@ -7299,7 +7323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_ROTATION: - res.Add(llGetRot()); + res.Add(GetPartRot(part)); break; case (int)ScriptBaseClass.PRIM_TYPE: -- cgit v1.1 From 99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Aug 2009 04:39:02 +0100 Subject: Add rest console support to the user server. Will ask new questions at startup. To use, run it normally once, answering the questions, then run again with -console=rest. Also now supports -console=basic for a console that reads stdin --- OpenSim/Framework/UserConfig.cs | 14 +++++++++++ OpenSim/Grid/UserServer/Main.cs | 39 ++++++++++++++++++++++++++++++- OpenSim/Server/Base/ServicesServerBase.cs | 28 ++++++++++++++++++++++ prebuild.xml | 1 + 4 files changed, 81 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs index 31838ad..b9e3665 100644 --- a/OpenSim/Framework/UserConfig.cs +++ b/OpenSim/Framework/UserConfig.cs @@ -46,6 +46,8 @@ namespace OpenSim.Framework public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL; public uint DefaultUserLevel = 0; public string LibraryXmlfile = ""; + public string ConsoleUser = String.Empty; + public string ConsolePass = String.Empty; private Uri m_inventoryUrl; @@ -155,6 +157,12 @@ namespace OpenSim.Framework m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Minimum Level a user should have to login [0 default]", "0", false); + m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access user name [Default: disabled]", "0", false); + + m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access password [Default: disabled]", "0", false); + } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -209,6 +217,12 @@ namespace OpenSim.Framework case "library_location": LibraryXmlfile = (string)configuration_result; break; + case "console_user": + ConsoleUser = (string)configuration_result; + break; + case "console_pass": + ConsolePass = (string)configuration_result; + break; } return true; diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 86c2abb..f47a96e 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; using OpenSim.Grid.UserServer.Modules; +using Nini.Config; namespace OpenSim.Grid.UserServer { @@ -73,8 +74,22 @@ namespace OpenSim.Grid.UserServer protected AvatarCreationModule m_appearanceModule; + protected static string m_consoleType = "local"; + protected static IConfigSource m_config = null; + public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + m_consoleType = startupConfig.GetString("console", "local"); + } + + m_config = argvSource; + XmlConfigurator.Configure(); m_log.Info("Launching UserServer..."); @@ -87,7 +102,18 @@ namespace OpenSim.Grid.UserServer public OpenUser_Main() { - m_console = new LocalConsole("User"); + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("User"); + break; + case "basic": + m_console = new CommandConsole("User"); + break; + default: + m_console = new LocalConsole("User"); + break; + } MainConsole.Instance = m_console; } @@ -129,6 +155,17 @@ namespace OpenSim.Grid.UserServer m_httpServer = new BaseHttpServer(Cfg.HttpPort); + if (m_console is RemoteConsole) + { + System.Console.WriteLine("Initialized REST console"); + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_config.AddConfig("Network"); + netConfig.Set("ConsoleUser", Cfg.ConsoleUser); + netConfig.Set("ConsolePass", Cfg.ConsolePass); + c.ReadConfig(m_config); + } + RegisterInterface(m_console); RegisterInterface(Cfg); diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 619c2d1..1d9eb0d 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -65,6 +65,10 @@ namespace OpenSim.Server.Base // private bool m_Running = true; + // PID file + // + private string m_pidFile = String.Empty; + // Handle all the automagical stuff // public ServicesServerBase(string prompt, string[] args) @@ -211,6 +215,11 @@ namespace OpenSim.Server.Base } } + if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty) + { + CreatePIDFile(startupConfig.GetString("PIDFile")); + } + // Register the quit command // MainConsole.Instance.Commands.AddCommand("base", false, "quit", @@ -230,6 +239,8 @@ namespace OpenSim.Server.Base MainConsole.Instance.Prompt(); } + if (m_pidFile != String.Empty) + File.Delete(m_pidFile); return 0; } @@ -246,5 +257,22 @@ namespace OpenSim.Server.Base protected virtual void Initialise() { } + + protected void CreatePIDFile(string path) + { + try + { + string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); + FileStream fs = File.Create(path); + System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + Byte[] buf = enc.GetBytes(pidstring); + fs.Write(buf, 0, buf.Length); + fs.Close(); + m_pidFile = path; + } + catch (Exception) + { + } + } } } diff --git a/prebuild.xml b/prebuild.xml index 5e44169..4f110c4 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1178,6 +1178,7 @@ + -- cgit v1.1 From dd0234f5005127c03760c2b9862ed1672f4a2e91 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Aug 2009 05:15:25 +0100 Subject: Graft the REST console onto the grid server. Same procedure as with the user server. --- OpenSim/Framework/GridConfig.cs | 16 +++++++++++++++- OpenSim/Grid/GridServer/GridServerBase.cs | 27 +++++++++++++++++++++++++-- OpenSim/Grid/GridServer/Program.cs | 12 ++++++++++++ OpenSim/Grid/UserServer/Main.cs | 1 - prebuild.xml | 1 + 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs index a3c1032..87fd3f0 100644 --- a/OpenSim/Framework/GridConfig.cs +++ b/OpenSim/Framework/GridConfig.cs @@ -45,6 +45,8 @@ namespace OpenSim.Framework public string SimSendKey = String.Empty; public string UserRecvKey = String.Empty; public string UserSendKey = String.Empty; + public string ConsoleUser = String.Empty; + public string ConsolePass = String.Empty; public GridConfig(string description, string filename) { @@ -95,6 +97,12 @@ namespace OpenSim.Framework "Allow regions to register immediately upon grid server startup? true/false", "True", false); + m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access user name [Default: disabled]", "0", false); + + m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access password [Default: disabled]", "0", false); + } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -140,9 +148,15 @@ namespace OpenSim.Framework case "allow_region_registration": AllowRegionRegistration = (bool)configuration_result; break; + case "console_user": + ConsoleUser = (string)configuration_result; + break; + case "console_pass": + ConsolePass = (string)configuration_result; + break; } return true; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index c41a728..e3ad52a 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -31,6 +31,7 @@ using System.IO; using System.Reflection; using System.Timers; using log4net; +using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected GridConfig m_config; + public string m_consoleType = "local"; + public IConfigSource m_configSource = null; public GridConfig Config { @@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer public GridServerBase() { - m_console = new LocalConsole("Grid"); - MainConsole.Instance = m_console; } protected override void StartupSpecific() { + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("Grid"); + break; + case "basic": + m_console = new CommandConsole("Grid"); + break; + default: + m_console = new LocalConsole("Grid"); + break; + } + MainConsole.Instance = m_console; m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); m_log.Info("[GRID]: Starting HTTP process"); m_httpServer = new BaseHttpServer(m_config.HttpPort); + if (m_console is RemoteConsole) + { + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_configSource.AddConfig("Network"); + netConfig.Set("ConsoleUser", m_config.ConsoleUser); + netConfig.Set("ConsolePass", m_config.ConsolePass); + c.ReadConfig(m_configSource); + } LoadPlugins(); diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index 9618b85..c7ba897 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs @@ -26,6 +26,7 @@ */ using log4net.Config; +using Nini.Config; namespace OpenSim.Grid.GridServer { @@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer { public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + XmlConfigurator.Configure(); GridServerBase app = new GridServerBase(); + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + app.m_consoleType = startupConfig.GetString("console", "local"); + } + + app.m_configSource = argvSource; + // if (args.Length > 0 && args[0] == "-setuponly") // { // app.Config(); diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index f47a96e..1ee53ef 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -157,7 +157,6 @@ namespace OpenSim.Grid.UserServer if (m_console is RemoteConsole) { - System.Console.WriteLine("Initialized REST console"); RemoteConsole c = (RemoteConsole)m_console; c.SetServer(m_httpServer); IConfig netConfig = m_config.AddConfig("Network"); diff --git a/prebuild.xml b/prebuild.xml index 4f110c4..216a02e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -911,6 +911,7 @@ + -- cgit v1.1 From 2111c66f89033b3426ceedba6a3ec6ed8fb3363f Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Aug 2009 05:40:23 +0100 Subject: Graft the REST console onto the message server as well. What a dirty hack! Works the same as the others. --- OpenSim/Framework/MessageServerConfig.cs | 16 ++++++- OpenSim/Grid/MessagingServer/Main.cs | 79 ++++++++++++++++++++++++-------- prebuild.xml | 1 + 3 files changed, 75 insertions(+), 21 deletions(-) diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs index d0ceebc..61e5ea7 100644 --- a/OpenSim/Framework/MessageServerConfig.cs +++ b/OpenSim/Framework/MessageServerConfig.cs @@ -46,6 +46,8 @@ namespace OpenSim.Framework public string UserRecvKey = String.Empty; public string UserSendKey = String.Empty; public string UserServerURL = String.Empty; + public string ConsoleUser = String.Empty; + public string ConsolePass = String.Empty; public MessageServerConfig(string description, string filename) { @@ -88,6 +90,12 @@ namespace OpenSim.Framework "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false); m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "My Published IP Address", "127.0.0.1", false); + m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access user name [Default: disabled]", "0", false); + + m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access password [Default: disabled]", "0", false); + } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -130,9 +138,15 @@ namespace OpenSim.Framework case "published_ip": MessageServerIP = (string) configuration_result; break; + case "console_user": + ConsoleUser = (string)configuration_result; + break; + case "console_pass": + ConsolePass = (string)configuration_result; + break; } return true; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index dcefeea..654e770 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using log4net; +using Nini.Config; using log4net.Config; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -56,8 +57,22 @@ namespace OpenSim.Grid.MessagingServer // private UUID m_lastCreatedUser = UUID.Random(); + protected static string m_consoleType = "local"; + protected static IConfigSource m_config = null; + public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + m_consoleType = startupConfig.GetString("console", "local"); + } + + m_config = argvSource; + XmlConfigurator.Configure(); m_log.Info("[SERVER]: Launching MessagingServer..."); @@ -70,7 +85,18 @@ namespace OpenSim.Grid.MessagingServer public OpenMessage_Main() { - m_console = new LocalConsole("Messaging"); + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("Messaging"); + break; + case "basic": + m_console = new CommandConsole("Messaging"); + break; + default: + m_console = new LocalConsole("Messaging"); + break; + } MainConsole.Instance = m_console; } @@ -88,20 +114,33 @@ namespace OpenSim.Grid.MessagingServer { if (m_userServerModule.registerWithUserServer()) { - m_log.Info("[SERVER]: Starting HTTP process"); - m_httpServer = new BaseHttpServer(Cfg.HttpPort); - - m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); - m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); - m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); - m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); - m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); - m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); - - m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); - m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); - - m_httpServer.Start(); + if (m_httpServer == null) + { + m_log.Info("[SERVER]: Starting HTTP process"); + m_httpServer = new BaseHttpServer(Cfg.HttpPort); + + if (m_console is RemoteConsole) + { + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_config.AddConfig("Network"); + netConfig.Set("ConsoleUser", Cfg.ConsoleUser); + netConfig.Set("ConsolePass", Cfg.ConsolePass); + c.ReadConfig(m_config); + } + + m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); + m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); + m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); + m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); + m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); + m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); + + m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); + m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); + + m_httpServer.Start(); + } m_log.Info("[SERVER]: Userserver registration was successful"); } else @@ -114,12 +153,12 @@ namespace OpenSim.Grid.MessagingServer private void deregisterFromUserServer() { m_userServerModule.deregisterWithUserServer(); - if (m_httpServer != null) - { +// if (m_httpServer != null) +// { // try a completely fresh registration, with fresh handlers, too - m_httpServer.Stop(); - m_httpServer = null; - } +// m_httpServer.Stop(); +// m_httpServer = null; +// } m_console.Output("[SERVER]: Deregistered from userserver."); } diff --git a/prebuild.xml b/prebuild.xml index 216a02e..ebe5c62 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1281,6 +1281,7 @@ + -- cgit v1.1