Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim

arthursv
Diva Canto 2009-08-19 00:31:51 -07:00
commit 4818d11b9d
10 changed files with 230 additions and 23 deletions

View File

@ -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,6 +148,12 @@ 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;

View File

@ -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,6 +138,12 @@ 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;

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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);
if (m_httpServer == null)
{
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);
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("region_startup", m_regionModule.RegionStartup);
m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
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.Start();
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.");
}

View File

@ -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,16 @@ namespace OpenSim.Grid.UserServer
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);
}
RegisterInterface<CommandConsole>(m_console);
RegisterInterface<UserConfig>(Cfg);

View File

@ -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:

View File

@ -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)
{
}
}
}
}

View File

@ -911,6 +911,7 @@
<Reference name="OpenMetaverse.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
@ -1178,6 +1179,7 @@
<Reference name="OpenMetaverse.StructuredData.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll"/>
<Reference name="DotNetOpenId.dll"/>
<Files>
@ -1279,6 +1281,7 @@
<Reference name="OpenMetaverse.dll"/>
<Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>