From 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Mon, 16 Jul 2007 15:40:11 +0000
Subject: changed to native line ending encoding
---
OpenSim/Grid/AssetServer/Main.cs | 812 +++++------
.../Grid/AssetServer/Properties/AssemblyInfo.cs | 116 +-
.../Grid/Framework.Manager/GridManagementAgent.cs | 276 ++--
.../Grid/Framework.Manager/GridServerManager.cs | 186 +--
OpenSim/Grid/GridServer.Config/AssemblyInfo.cs | 112 +-
OpenSim/Grid/GridServer.Config/DbGridConfig.cs | 320 ++---
OpenSim/Grid/GridServer/GridManager.cs | 1420 ++++++++++----------
OpenSim/Grid/GridServer/Main.cs | 516 +++----
OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | 116 +-
OpenSim/Grid/InventoryServer/InventoryManager.cs | 250 ++--
OpenSim/Grid/InventoryServer/Main.cs | 174 +--
.../OpenGridServices.Manager/BlockingQueue.cs | 66 +-
.../Grid/Manager/OpenGridServices.Manager/Util.cs | 266 ++--
OpenSim/Grid/UserServer.Config/AssemblyInfo.cs | 112 +-
OpenSim/Grid/UserServer.Config/DbUserConfig.cs | 190 +--
OpenSim/Grid/UserServer/Main.cs | 428 +++---
OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | 62 +-
OpenSim/Grid/UserServer/UserManager.cs | 200 +--
18 files changed, 2811 insertions(+), 2811 deletions(-)
(limited to 'OpenSim/Grid')
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 4126ff4..5093f4d 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -1,406 +1,406 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-using System;
-using System.IO;
-using System.Text;
-using Db4objects.Db4o;
-using libsecondlife;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Types;
-using OpenSim.Framework.Servers;
-
-namespace OpenSim.Grid.AssetServer
-{
- ///
- /// An asset server
- ///
- public class OpenAsset_Main : conscmd_callback
- {
- private IObjectContainer db;
-
- public static OpenAsset_Main assetserver;
-
- private LogBase m_console;
-
- [STAThread]
- public static void Main(string[] args)
- {
- Console.WriteLine("Starting...\n");
-
- assetserver = new OpenAsset_Main();
- assetserver.Startup();
-
- assetserver.Work();
- }
-
- private void Work()
- {
- m_console.Notice("Enter help for a list of commands");
-
- while (true)
- {
- m_console.MainLogPrompt();
- }
- }
-
- private OpenAsset_Main()
- {
- m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false);
- MainLog.Instance = m_console;
- }
-
- public void Startup()
- {
- m_console.Verbose("Main.cs:Startup() - Setting up asset DB");
- setupDB();
-
- m_console.Verbose("Main.cs:Startup() - Starting HTTP process");
- BaseHttpServer httpServer = new BaseHttpServer(8003);
-
- httpServer.AddStreamHandler( new GetAssetStreamHandler(this));
- httpServer.AddStreamHandler(new PostAssetStreamHandler( this ));
-
- //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);
- //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod);
-
- httpServer.Start();
-
- }
-
- //public string AssetPostMethod(string requestBody, string path, string param)
- //{
- // AssetBase asset = new AssetBase();
- // asset.Name = "";
- // asset.FullID = new LLUUID(param);
- // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
- // byte[] buffer = Windows1252Encoding.GetBytes(requestBody);
- // asset.Data = buffer;
- // AssetStorage store = new AssetStorage();
- // store.Data = asset.Data;
- // store.Name = asset.Name;
- // store.UUID = asset.FullID;
- // db.Set(store);
- // db.Commit();
- // return "";
- //}
-
- //public string AssetGetMethod(string request, string path, string param)
- //{
- // Console.WriteLine("got a request " + param);
- // byte[] assetdata = GetAssetData(new LLUUID(param), false);
- // if (assetdata != null)
- // {
- // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
- // string ret = Windows1252Encoding.GetString(assetdata);
- // //string ret = System.Text.Encoding.Unicode.GetString(assetdata);
-
- // return ret;
-
- // }
- // else
- // {
- // return "";
- // }
-
- //}
-
- public byte[] GetAssetData(LLUUID assetID, bool isTexture)
- {
- bool found = false;
- AssetStorage foundAsset = null;
-
- IObjectSet result = db.Get(new AssetStorage(assetID));
- if (result.Count > 0)
- {
- foundAsset = (AssetStorage)result.Next();
- found = true;
- }
-
- if (found)
- {
- return foundAsset.Data;
- }
- else
- {
- return null;
- }
- }
-
- public void setupDB()
- {
- bool yapfile = File.Exists("gridassets.yap");
- try
- {
- db = Db4oFactory.OpenFile("gridassets.yap");
- MainLog.Instance.Verbose("Main.cs:setupDB() - creation");
- }
- catch (Exception e)
- {
- db.Close();
- MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured");
- MainLog.Instance.Warn(e.ToString());
- }
- if (!yapfile)
- {
- this.LoadDB();
- }
- }
-
- public void LoadDB()
- {
- try
- {
-
- Console.WriteLine("setting up Asset database");
-
- AssetBase Image = new AssetBase();
- Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
- Image.Name = "Bricks";
- this.LoadAsset(Image, true, "bricks.jp2");
- AssetStorage store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
-
- Image = new AssetBase();
- Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
- Image.Name = "Plywood";
- this.LoadAsset(Image, true, "plywood.jp2");
- store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
-
- Image = new AssetBase();
- Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
- Image.Name = "Rocks";
- this.LoadAsset(Image, true, "rocks.jp2");
- store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
-
- Image = new AssetBase();
- Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
- Image.Name = "Granite";
- this.LoadAsset(Image, true, "granite.jp2");
- store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
-
- Image = new AssetBase();
- Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
- Image.Name = "Hardwood";
- this.LoadAsset(Image, true, "hardwood.jp2");
- store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
-
- Image = new AssetBase();
- Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
- Image.Name = "Prim Base Texture";
- this.LoadAsset(Image, true, "plywood.jp2");
- store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
-
- Image = new AssetBase();
- Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
- Image.Name = "Shape";
- this.LoadAsset(Image, false, "base_shape.dat");
- store = new AssetStorage();
- store.Data = Image.Data;
- store.Name = Image.Name;
- store.UUID = Image.FullID;
- db.Set(store);
- db.Commit();
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- }
-
- private void LoadAsset(AssetBase info, bool image, string filename)
- {
-
-
- string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
- string fileName = Path.Combine(dataPath, filename);
- FileInfo fInfo = new FileInfo(fileName);
- long numBytes = fInfo.Length;
- FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- byte[] idata = new byte[numBytes];
- BinaryReader br = new BinaryReader(fStream);
- idata = br.ReadBytes((int)numBytes);
- br.Close();
- fStream.Close();
- info.Data = idata;
- //info.loaded=true;
- }
-
- /*private GridConfig LoadConfigDll(string dllName)
- {
- Assembly pluginAssembly = Assembly.LoadFrom(dllName);
- GridConfig config = null;
-
- foreach (Type pluginType in pluginAssembly.GetTypes())
- {
- if (pluginType.IsPublic)
- {
- if (!pluginType.IsAbstract)
- {
- Type typeInterface = pluginType.GetInterface("IGridConfig", true);
-
- if (typeInterface != null)
- {
- IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- config = plug.GetConfigObject();
- break;
- }
-
- typeInterface = null;
- }
- }
- }
- pluginAssembly = null;
- return config;
- }*/
-
- public void CreateAsset(LLUUID assetId, byte[] assetData)
- {
- AssetBase asset = new AssetBase();
- asset.Name = "";
- asset.FullID = assetId;
- asset.Data = assetData;
-
- AssetStorage store = new AssetStorage();
- store.Data = asset.Data;
- store.Name = asset.Name;
- store.UUID = asset.FullID;
- db.Set(store);
- db.Commit();
- }
-
- public void RunCmd(string cmd, string[] cmdparams)
- {
- switch (cmd)
- {
- case "help":
- m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)");
- break;
-
- case "shutdown":
- m_console.Close();
- Environment.Exit(0);
- break;
- }
- }
-
- public void Show(string ShowWhat)
- {
- }
- }
-
- public class GetAssetStreamHandler : BaseStreamHandler
- {
- OpenAsset_Main m_assetManager;
-
- override public byte[] Handle(string path, Stream request)
- {
- string param = GetParam(path);
-
- byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false);
- if (assetdata != null)
- {
- return assetdata;
- }
- else
- {
- return new byte[]{};
- }
- }
-
- public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET")
- {
- m_assetManager = assetManager;
- }
- }
-
- public class PostAssetStreamHandler : BaseStreamHandler
- {
- OpenAsset_Main m_assetManager;
-
- override public byte[] Handle(string path, Stream request)
- {
- string param = GetParam(path);
- LLUUID assetId = new LLUUID(param);
- byte[] txBuffer = new byte[4096];
-
- using( BinaryReader binReader = new BinaryReader( request ) )
- {
- using (MemoryStream memoryStream = new MemoryStream(4096))
- {
- int count;
- while ((count = binReader.Read(txBuffer, 0, 4096)) > 0)
- {
- memoryStream.Write(txBuffer, 0, count);
- }
-
- byte[] assetData = memoryStream.ToArray();
-
- m_assetManager.CreateAsset(assetId, assetData);
- }
- }
-
- return new byte[]{};
- }
-
- public PostAssetStreamHandler( OpenAsset_Main assetManager )
- : base("/assets/", "POST")
- {
- m_assetManager = assetManager;
- }
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+using System;
+using System.IO;
+using System.Text;
+using Db4objects.Db4o;
+using libsecondlife;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Types;
+using OpenSim.Framework.Servers;
+
+namespace OpenSim.Grid.AssetServer
+{
+ ///
+ /// An asset server
+ ///
+ public class OpenAsset_Main : conscmd_callback
+ {
+ private IObjectContainer db;
+
+ public static OpenAsset_Main assetserver;
+
+ private LogBase m_console;
+
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ Console.WriteLine("Starting...\n");
+
+ assetserver = new OpenAsset_Main();
+ assetserver.Startup();
+
+ assetserver.Work();
+ }
+
+ private void Work()
+ {
+ m_console.Notice("Enter help for a list of commands");
+
+ while (true)
+ {
+ m_console.MainLogPrompt();
+ }
+ }
+
+ private OpenAsset_Main()
+ {
+ m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false);
+ MainLog.Instance = m_console;
+ }
+
+ public void Startup()
+ {
+ m_console.Verbose("Main.cs:Startup() - Setting up asset DB");
+ setupDB();
+
+ m_console.Verbose("Main.cs:Startup() - Starting HTTP process");
+ BaseHttpServer httpServer = new BaseHttpServer(8003);
+
+ httpServer.AddStreamHandler( new GetAssetStreamHandler(this));
+ httpServer.AddStreamHandler(new PostAssetStreamHandler( this ));
+
+ //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);
+ //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod);
+
+ httpServer.Start();
+
+ }
+
+ //public string AssetPostMethod(string requestBody, string path, string param)
+ //{
+ // AssetBase asset = new AssetBase();
+ // asset.Name = "";
+ // asset.FullID = new LLUUID(param);
+ // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
+ // byte[] buffer = Windows1252Encoding.GetBytes(requestBody);
+ // asset.Data = buffer;
+ // AssetStorage store = new AssetStorage();
+ // store.Data = asset.Data;
+ // store.Name = asset.Name;
+ // store.UUID = asset.FullID;
+ // db.Set(store);
+ // db.Commit();
+ // return "";
+ //}
+
+ //public string AssetGetMethod(string request, string path, string param)
+ //{
+ // Console.WriteLine("got a request " + param);
+ // byte[] assetdata = GetAssetData(new LLUUID(param), false);
+ // if (assetdata != null)
+ // {
+ // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
+ // string ret = Windows1252Encoding.GetString(assetdata);
+ // //string ret = System.Text.Encoding.Unicode.GetString(assetdata);
+
+ // return ret;
+
+ // }
+ // else
+ // {
+ // return "";
+ // }
+
+ //}
+
+ public byte[] GetAssetData(LLUUID assetID, bool isTexture)
+ {
+ bool found = false;
+ AssetStorage foundAsset = null;
+
+ IObjectSet result = db.Get(new AssetStorage(assetID));
+ if (result.Count > 0)
+ {
+ foundAsset = (AssetStorage)result.Next();
+ found = true;
+ }
+
+ if (found)
+ {
+ return foundAsset.Data;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void setupDB()
+ {
+ bool yapfile = File.Exists("gridassets.yap");
+ try
+ {
+ db = Db4oFactory.OpenFile("gridassets.yap");
+ MainLog.Instance.Verbose("Main.cs:setupDB() - creation");
+ }
+ catch (Exception e)
+ {
+ db.Close();
+ MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured");
+ MainLog.Instance.Warn(e.ToString());
+ }
+ if (!yapfile)
+ {
+ this.LoadDB();
+ }
+ }
+
+ public void LoadDB()
+ {
+ try
+ {
+
+ Console.WriteLine("setting up Asset database");
+
+ AssetBase Image = new AssetBase();
+ Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
+ Image.Name = "Bricks";
+ this.LoadAsset(Image, true, "bricks.jp2");
+ AssetStorage store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+
+ Image = new AssetBase();
+ Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
+ Image.Name = "Plywood";
+ this.LoadAsset(Image, true, "plywood.jp2");
+ store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+
+ Image = new AssetBase();
+ Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
+ Image.Name = "Rocks";
+ this.LoadAsset(Image, true, "rocks.jp2");
+ store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+
+ Image = new AssetBase();
+ Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
+ Image.Name = "Granite";
+ this.LoadAsset(Image, true, "granite.jp2");
+ store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+
+ Image = new AssetBase();
+ Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
+ Image.Name = "Hardwood";
+ this.LoadAsset(Image, true, "hardwood.jp2");
+ store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+
+ Image = new AssetBase();
+ Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
+ Image.Name = "Prim Base Texture";
+ this.LoadAsset(Image, true, "plywood.jp2");
+ store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+
+ Image = new AssetBase();
+ Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
+ Image.Name = "Shape";
+ this.LoadAsset(Image, false, "base_shape.dat");
+ store = new AssetStorage();
+ store.Data = Image.Data;
+ store.Name = Image.Name;
+ store.UUID = Image.FullID;
+ db.Set(store);
+ db.Commit();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message);
+ }
+ }
+
+ private void LoadAsset(AssetBase info, bool image, string filename)
+ {
+
+
+ string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
+ string fileName = Path.Combine(dataPath, filename);
+ FileInfo fInfo = new FileInfo(fileName);
+ long numBytes = fInfo.Length;
+ FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+ byte[] idata = new byte[numBytes];
+ BinaryReader br = new BinaryReader(fStream);
+ idata = br.ReadBytes((int)numBytes);
+ br.Close();
+ fStream.Close();
+ info.Data = idata;
+ //info.loaded=true;
+ }
+
+ /*private GridConfig LoadConfigDll(string dllName)
+ {
+ Assembly pluginAssembly = Assembly.LoadFrom(dllName);
+ GridConfig config = null;
+
+ foreach (Type pluginType in pluginAssembly.GetTypes())
+ {
+ if (pluginType.IsPublic)
+ {
+ if (!pluginType.IsAbstract)
+ {
+ Type typeInterface = pluginType.GetInterface("IGridConfig", true);
+
+ if (typeInterface != null)
+ {
+ IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ config = plug.GetConfigObject();
+ break;
+ }
+
+ typeInterface = null;
+ }
+ }
+ }
+ pluginAssembly = null;
+ return config;
+ }*/
+
+ public void CreateAsset(LLUUID assetId, byte[] assetData)
+ {
+ AssetBase asset = new AssetBase();
+ asset.Name = "";
+ asset.FullID = assetId;
+ asset.Data = assetData;
+
+ AssetStorage store = new AssetStorage();
+ store.Data = asset.Data;
+ store.Name = asset.Name;
+ store.UUID = asset.FullID;
+ db.Set(store);
+ db.Commit();
+ }
+
+ public void RunCmd(string cmd, string[] cmdparams)
+ {
+ switch (cmd)
+ {
+ case "help":
+ m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)");
+ break;
+
+ case "shutdown":
+ m_console.Close();
+ Environment.Exit(0);
+ break;
+ }
+ }
+
+ public void Show(string ShowWhat)
+ {
+ }
+ }
+
+ public class GetAssetStreamHandler : BaseStreamHandler
+ {
+ OpenAsset_Main m_assetManager;
+
+ override public byte[] Handle(string path, Stream request)
+ {
+ string param = GetParam(path);
+
+ byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false);
+ if (assetdata != null)
+ {
+ return assetdata;
+ }
+ else
+ {
+ return new byte[]{};
+ }
+ }
+
+ public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET")
+ {
+ m_assetManager = assetManager;
+ }
+ }
+
+ public class PostAssetStreamHandler : BaseStreamHandler
+ {
+ OpenAsset_Main m_assetManager;
+
+ override public byte[] Handle(string path, Stream request)
+ {
+ string param = GetParam(path);
+ LLUUID assetId = new LLUUID(param);
+ byte[] txBuffer = new byte[4096];
+
+ using( BinaryReader binReader = new BinaryReader( request ) )
+ {
+ using (MemoryStream memoryStream = new MemoryStream(4096))
+ {
+ int count;
+ while ((count = binReader.Read(txBuffer, 0, 4096)) > 0)
+ {
+ memoryStream.Write(txBuffer, 0, count);
+ }
+
+ byte[] assetData = memoryStream.ToArray();
+
+ m_assetManager.CreateAsset(assetId, assetData);
+ }
+ }
+
+ return new byte[]{};
+ }
+
+ public PostAssetStreamHandler( OpenAsset_Main assetManager )
+ : base("/assets/", "POST")
+ {
+ m_assetManager = assetManager;
+ }
+ }
+}
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
index dc39ce2..f9b48d5 100644
--- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
@@ -1,58 +1,58 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System.Reflection;
-using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OGS-AssetServer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("OGS-AssetServer")]
-[assembly: AssemblyCopyright("Copyright © 2007")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System.Reflection;
+using System.Runtime.InteropServices;
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OGS-AssetServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OGS-AssetServer")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs
index 6c916a2..989df26 100644
--- a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs
+++ b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs
@@ -1,138 +1,138 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System.Collections;
-using libsecondlife;
-using Nwc.XmlRpc;
-using OpenSim.Framework.Servers;
-
-namespace OpenSim.Framework.Manager
-{
- ///
- /// Used to pass messages to the gridserver
- ///
- /// Pass this argument
- public delegate void GridManagerCallback(string param);
-
- ///
- /// Serverside listener for grid commands
- ///
- public class GridManagementAgent
- {
- ///
- /// Passes grid server messages
- ///
- private GridManagerCallback thecallback;
-
- ///
- /// Security keys
- ///
- private string sendkey;
- private string recvkey;
-
- ///
- /// Our component type
- ///
- private string component_type;
-
- ///
- /// List of active sessions
- ///
- private static ArrayList Sessions;
-
- ///
- /// Initialises a new GridManagementAgent
- ///
- /// HTTP Daemon for this server
- /// What component type are we?
- /// Security send key
- /// Security recieve key
- /// Message callback
- public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
- {
- this.sendkey = sendkey;
- this.recvkey = recvkey;
- this.component_type = component_type;
- this.thecallback = thecallback;
- Sessions = new ArrayList();
-
- app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod);
-
- switch (component_type)
- {
- case "gridserver":
- GridServerManager.sendkey = this.sendkey;
- GridServerManager.recvkey = this.recvkey;
- GridServerManager.thecallback = thecallback;
- app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
- break;
- }
- }
-
- ///
- /// Checks if a session exists
- ///
- /// The session ID
- /// Exists?
- public static bool SessionExists(LLUUID sessionID)
- {
- return Sessions.Contains(sessionID);
- }
-
- ///
- /// Logs a new session to the grid manager
- ///
- /// the XMLRPC request
- /// An XMLRPC reply
- public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
- {
- XmlRpcResponse response = new XmlRpcResponse();
- Hashtable requestData = (Hashtable)request.Params[0];
- Hashtable responseData = new Hashtable();
-
- // TODO: Switch this over to using OpenSim.Framework.Data
- if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
- {
- response.IsFault = false;
- LLUUID new_session = LLUUID.Random();
- Sessions.Add(new_session);
- responseData["session_id"] = new_session.ToString();
- responseData["msg"] = "Login OK";
- }
- else
- {
- response.IsFault = true;
- responseData["error"] = "Invalid username or password";
- }
-
- response.Value = responseData;
- return response;
-
- }
-
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System.Collections;
+using libsecondlife;
+using Nwc.XmlRpc;
+using OpenSim.Framework.Servers;
+
+namespace OpenSim.Framework.Manager
+{
+ ///
+ /// Used to pass messages to the gridserver
+ ///
+ /// Pass this argument
+ public delegate void GridManagerCallback(string param);
+
+ ///
+ /// Serverside listener for grid commands
+ ///
+ public class GridManagementAgent
+ {
+ ///
+ /// Passes grid server messages
+ ///
+ private GridManagerCallback thecallback;
+
+ ///
+ /// Security keys
+ ///
+ private string sendkey;
+ private string recvkey;
+
+ ///
+ /// Our component type
+ ///
+ private string component_type;
+
+ ///
+ /// List of active sessions
+ ///
+ private static ArrayList Sessions;
+
+ ///
+ /// Initialises a new GridManagementAgent
+ ///
+ /// HTTP Daemon for this server
+ /// What component type are we?
+ /// Security send key
+ /// Security recieve key
+ /// Message callback
+ public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
+ {
+ this.sendkey = sendkey;
+ this.recvkey = recvkey;
+ this.component_type = component_type;
+ this.thecallback = thecallback;
+ Sessions = new ArrayList();
+
+ app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod);
+
+ switch (component_type)
+ {
+ case "gridserver":
+ GridServerManager.sendkey = this.sendkey;
+ GridServerManager.recvkey = this.recvkey;
+ GridServerManager.thecallback = thecallback;
+ app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
+ break;
+ }
+ }
+
+ ///
+ /// Checks if a session exists
+ ///
+ /// The session ID
+ /// Exists?
+ public static bool SessionExists(LLUUID sessionID)
+ {
+ return Sessions.Contains(sessionID);
+ }
+
+ ///
+ /// Logs a new session to the grid manager
+ ///
+ /// the XMLRPC request
+ /// An XMLRPC reply
+ public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
+ {
+ XmlRpcResponse response = new XmlRpcResponse();
+ Hashtable requestData = (Hashtable)request.Params[0];
+ Hashtable responseData = new Hashtable();
+
+ // TODO: Switch this over to using OpenSim.Framework.Data
+ if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
+ {
+ response.IsFault = false;
+ LLUUID new_session = LLUUID.Random();
+ Sessions.Add(new_session);
+ responseData["session_id"] = new_session.ToString();
+ responseData["msg"] = "Login OK";
+ }
+ else
+ {
+ response.IsFault = true;
+ responseData["error"] = "Invalid username or password";
+ }
+
+ response.Value = responseData;
+ return response;
+
+ }
+
+ }
+}
diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs
index 67cd35d..729e42b 100644
--- a/OpenSim/Grid/Framework.Manager/GridServerManager.cs
+++ b/OpenSim/Grid/Framework.Manager/GridServerManager.cs
@@ -1,93 +1,93 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-using System;
-using System.Collections;
-using System.Threading;
-using libsecondlife;
-using Nwc.XmlRpc;
-
-namespace OpenSim.Framework.Manager {
-
- ///
- /// A remote management system for the grid server
- ///
- public class GridServerManager
- {
- ///
- /// Triggers events from the grid manager
- ///
- public static GridManagerCallback thecallback;
-
- ///
- /// Security keys
- ///
- public static string sendkey;
- public static string recvkey;
-
- ///
- /// Disconnects the grid server and shuts it down
- ///
- /// XmlRpc Request
- /// An XmlRpc response containing either a "msg" or an "error"
- public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
- {
- XmlRpcResponse response = new XmlRpcResponse();
- Hashtable requestData = (Hashtable)request.Params[0];
- Hashtable responseData = new Hashtable();
-
- if(requestData.ContainsKey("session_id")) {
- if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) {
- responseData["msg"]="Shutdown command accepted";
- (new Thread(new ThreadStart(ShutdownServer))).Start();
- } else {
- response.IsFault=true;
- responseData["error"]="bad session ID";
- }
- } else {
- response.IsFault=true;
- responseData["error"]="no session ID";
- }
-
- response.Value = responseData;
- return response;
- }
-
- ///
- /// Shuts down the grid server
- ///
- public static void ShutdownServer()
- {
- Console.WriteLine("Shutting down the grid server - recieved a grid manager request");
- Console.WriteLine("Terminating in three seconds...");
- Thread.Sleep(3000);
- thecallback("shutdown");
- }
- }
-}
-
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+using System;
+using System.Collections;
+using System.Threading;
+using libsecondlife;
+using Nwc.XmlRpc;
+
+namespace OpenSim.Framework.Manager {
+
+ ///
+ /// A remote management system for the grid server
+ ///
+ public class GridServerManager
+ {
+ ///
+ /// Triggers events from the grid manager
+ ///
+ public static GridManagerCallback thecallback;
+
+ ///
+ /// Security keys
+ ///
+ public static string sendkey;
+ public static string recvkey;
+
+ ///
+ /// Disconnects the grid server and shuts it down
+ ///
+ /// XmlRpc Request
+ /// An XmlRpc response containing either a "msg" or an "error"
+ public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
+ {
+ XmlRpcResponse response = new XmlRpcResponse();
+ Hashtable requestData = (Hashtable)request.Params[0];
+ Hashtable responseData = new Hashtable();
+
+ if(requestData.ContainsKey("session_id")) {
+ if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) {
+ responseData["msg"]="Shutdown command accepted";
+ (new Thread(new ThreadStart(ShutdownServer))).Start();
+ } else {
+ response.IsFault=true;
+ responseData["error"]="bad session ID";
+ }
+ } else {
+ response.IsFault=true;
+ responseData["error"]="no session ID";
+ }
+
+ response.Value = responseData;
+ return response;
+ }
+
+ ///
+ /// Shuts down the grid server
+ ///
+ public static void ShutdownServer()
+ {
+ Console.WriteLine("Shutting down the grid server - recieved a grid manager request");
+ Console.WriteLine("Terminating in three seconds...");
+ Thread.Sleep(3000);
+ thecallback("shutdown");
+ }
+ }
+}
+
diff --git a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs
index 39c9e8f..4aa58f8 100644
--- a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs
@@ -1,56 +1,56 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System.Reflection;
-using System.Runtime.InteropServices;
-// Information about this assembly is defined by the following
-// attributes.
-//
-// change them to the information which is associated with the assembly
-// you compile.
-
-[assembly: AssemblyTitle("GridConfig")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("GridConfig")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// This sets the default COM visibility of types in the assembly to invisible.
-// If you need to expose a type to COM, use [ComVisible(true)] on that type.
-[assembly: ComVisible(false)]
-
-// The assembly version has following format :
-//
-// Major.Minor.Build.Revision
-//
-// You can specify all values by your own or you can build default build and revision
-// numbers with the '*' character (the default):
-
-[assembly: AssemblyVersion("1.0.*")]
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System.Reflection;
+using System.Runtime.InteropServices;
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("GridConfig")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("GridConfig")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
index 4acf81d..7d7690b 100644
--- a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
+++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
@@ -1,160 +1,160 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using Db4objects.Db4o;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Interfaces;
-
-namespace OpenGrid.Config.GridConfigDb4o
-{
- ///
- /// A grid configuration interface for returning the DB4o Config Provider
- ///
- public class Db40ConfigPlugin: IGridConfig
- {
- ///
- /// Loads and returns a configuration objeect
- ///
- /// A grid configuration object
- public GridConfig GetConfigObject()
- {
- MainLog.Instance.Verbose("Loading Db40Config dll");
- return ( new DbGridConfig());
- }
- }
-
- ///
- /// A DB4o based Gridserver configuration object
- ///
- public class DbGridConfig : GridConfig
- {
- ///
- /// The DB4o Database
- ///
- private IObjectContainer db;
-
- ///
- /// User configuration for the Grid Config interfaces
- ///
- public void LoadDefaults() {
- MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
-
- // About the grid options
- this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team");
-
- // Asset Options
- this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/");
- this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null");
- this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null");
-
- // User Server Options
- this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/");
- this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null");
- this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null");
-
- // Region Server Options
- this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null");
- this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null");
- }
-
- ///
- /// Initialises a new configuration object
- ///
- public override void InitConfig() {
- try {
- // Perform Db4o initialisation
- db = Db4oFactory.OpenFile("opengrid.yap");
-
- // Locate the grid configuration object
- IObjectSet result = db.Get(typeof(DbGridConfig));
- // Found?
- if(result.Count==1) {
- MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
- foreach (DbGridConfig cfg in result) {
- // Import each setting into this class
- // Grid Settings
- this.GridOwner=cfg.GridOwner;
- // Asset Settings
- this.DefaultAssetServer=cfg.DefaultAssetServer;
- this.AssetSendKey=cfg.AssetSendKey;
- this.AssetRecvKey=cfg.AssetRecvKey;
- // User Settings
- this.DefaultUserServer=cfg.DefaultUserServer;
- this.UserSendKey=cfg.UserSendKey;
- this.UserRecvKey=cfg.UserRecvKey;
- // Region Settings
- this.SimSendKey=cfg.SimSendKey;
- this.SimRecvKey=cfg.SimRecvKey;
- }
- // Create a new configuration object from this class
- } else {
- MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
-
- // Load default settings into this class
- LoadDefaults();
-
- // Saves to the database file...
- MainLog.Instance.Verbose( "Writing out default settings to local database");
- db.Set(this);
-
- // Closes file locks
- db.Close();
- }
- } catch(Exception e) {
- MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
- MainLog.Instance.Warn(e.ToString());
- }
-
- // Grid Settings
- MainLog.Instance.Verbose("Grid settings loaded:");
- MainLog.Instance.Verbose("Grid owner: " + this.GridOwner);
-
- // Asset Settings
- MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer);
- MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey);
- MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey);
-
- // User Settings
- MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer);
- MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey);
- MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey);
-
- // Region Settings
- MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey);
- MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey);
- }
-
- ///
- /// Closes down the database and releases filesystem locks
- ///
- public void Shutdown() {
- db.Close();
- }
- }
-
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using Db4objects.Db4o;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Interfaces;
+
+namespace OpenGrid.Config.GridConfigDb4o
+{
+ ///
+ /// A grid configuration interface for returning the DB4o Config Provider
+ ///
+ public class Db40ConfigPlugin: IGridConfig
+ {
+ ///
+ /// Loads and returns a configuration objeect
+ ///
+ /// A grid configuration object
+ public GridConfig GetConfigObject()
+ {
+ MainLog.Instance.Verbose("Loading Db40Config dll");
+ return ( new DbGridConfig());
+ }
+ }
+
+ ///
+ /// A DB4o based Gridserver configuration object
+ ///
+ public class DbGridConfig : GridConfig
+ {
+ ///
+ /// The DB4o Database
+ ///
+ private IObjectContainer db;
+
+ ///
+ /// User configuration for the Grid Config interfaces
+ ///
+ public void LoadDefaults() {
+ MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
+
+ // About the grid options
+ this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team");
+
+ // Asset Options
+ this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/");
+ this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null");
+ this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null");
+
+ // User Server Options
+ this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/");
+ this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null");
+ this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null");
+
+ // Region Server Options
+ this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null");
+ this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null");
+ }
+
+ ///
+ /// Initialises a new configuration object
+ ///
+ public override void InitConfig() {
+ try {
+ // Perform Db4o initialisation
+ db = Db4oFactory.OpenFile("opengrid.yap");
+
+ // Locate the grid configuration object
+ IObjectSet result = db.Get(typeof(DbGridConfig));
+ // Found?
+ if(result.Count==1) {
+ MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
+ foreach (DbGridConfig cfg in result) {
+ // Import each setting into this class
+ // Grid Settings
+ this.GridOwner=cfg.GridOwner;
+ // Asset Settings
+ this.DefaultAssetServer=cfg.DefaultAssetServer;
+ this.AssetSendKey=cfg.AssetSendKey;
+ this.AssetRecvKey=cfg.AssetRecvKey;
+ // User Settings
+ this.DefaultUserServer=cfg.DefaultUserServer;
+ this.UserSendKey=cfg.UserSendKey;
+ this.UserRecvKey=cfg.UserRecvKey;
+ // Region Settings
+ this.SimSendKey=cfg.SimSendKey;
+ this.SimRecvKey=cfg.SimRecvKey;
+ }
+ // Create a new configuration object from this class
+ } else {
+ MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
+
+ // Load default settings into this class
+ LoadDefaults();
+
+ // Saves to the database file...
+ MainLog.Instance.Verbose( "Writing out default settings to local database");
+ db.Set(this);
+
+ // Closes file locks
+ db.Close();
+ }
+ } catch(Exception e) {
+ MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
+ MainLog.Instance.Warn(e.ToString());
+ }
+
+ // Grid Settings
+ MainLog.Instance.Verbose("Grid settings loaded:");
+ MainLog.Instance.Verbose("Grid owner: " + this.GridOwner);
+
+ // Asset Settings
+ MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer);
+ MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey);
+ MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey);
+
+ // User Settings
+ MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer);
+ MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey);
+ MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey);
+
+ // Region Settings
+ MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey);
+ MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey);
+ }
+
+ ///
+ /// Closes down the database and releases filesystem locks
+ ///
+ public void Shutdown() {
+ db.Close();
+ }
+ }
+
+}
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 64b51b4..22bffa0 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -1,710 +1,710 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Xml;
-using libsecondlife;
-using Nwc.XmlRpc;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Data;
-using OpenSim.Framework.Interfaces;
-using OpenSim.Framework.Utilities;
-
-namespace OpenSim.Grid.GridServer
-{
- class GridManager
- {
- Dictionary _plugins = new Dictionary();
- Dictionary _logplugins = new Dictionary();
-
- public GridConfig config;
-
- ///
- /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
- ///
- /// The filename to the grid server plugin DLL
- public void AddPlugin(string FileName)
- {
- MainLog.Instance.Verbose("Storage: Attempting to load " + FileName);
- Assembly pluginAssembly = Assembly.LoadFrom(FileName);
-
- MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
- foreach (Type pluginType in pluginAssembly.GetTypes())
- {
- if (!pluginType.IsAbstract)
- {
- // Regions go here
- Type typeInterface = pluginType.GetInterface("IGridData", true);
-
- if (typeInterface != null)
- {
- IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- plug.Initialise();
- this._plugins.Add(plug.getName(), plug);
- MainLog.Instance.Verbose("Storage: Added IGridData Interface");
- }
-
- typeInterface = null;
-
- // Logs go here
- typeInterface = pluginType.GetInterface("ILogData", true);
-
- if (typeInterface != null)
- {
- ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- plug.Initialise();
- this._logplugins.Add(plug.getName(), plug);
- MainLog.Instance.Verbose( "Storage: Added ILogData Interface");
- }
-
- typeInterface = null;
- }
- }
-
- pluginAssembly = null;
- }
-
- ///
- /// Logs a piece of information to the database
- ///
- /// What you were operating on (in grid server, this will likely be the region UUIDs)
- /// Which method is being called?
- /// What arguments are being passed?
- /// How high priority is this? 1 = Max, 6 = Verbose
- /// The message to log
- private void logToDB(string target, string method, string args, int priority, string message)
- {
- foreach (KeyValuePair kvp in _logplugins)
- {
- try
- {
- kvp.Value.saveLog("Gridserver", target, method, args, priority, message);
- }
- catch (Exception)
- {
- MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key);
- }
- }
- }
-
- ///
- /// Returns a region by argument
- ///
- /// A UUID key of the region to return
- /// A SimProfileData for the region
- public SimProfileData getRegion(LLUUID uuid)
- {
- foreach(KeyValuePair kvp in _plugins) {
- try
- {
- return kvp.Value.GetProfileByLLUUID(uuid);
- }
- catch (Exception e)
- {
- MainLog.Instance.Warn("Message from Storage: " + e.Message);
- }
- }
- return null;
- }
-
- ///
- /// Returns a region by argument
- ///
- /// A regionHandle of the region to return
- /// A SimProfileData for the region
- public SimProfileData getRegion(ulong handle)
- {
- foreach (KeyValuePair kvp in _plugins)
- {
- try
- {
- return kvp.Value.GetProfileByHandle(handle);
- }
- catch
- {
- MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
- }
- }
- return null;
- }
-
- public Dictionary getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
- {
- Dictionary regions = new Dictionary();
-
- SimProfileData[] neighbours;
-
- foreach (KeyValuePair kvp in _plugins)
- {
- try
- {
- neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
- foreach (SimProfileData neighbour in neighbours)
- {
- regions[neighbour.regionHandle] = neighbour;
- }
- }
- catch
- {
- MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key);
- }
- }
-
- return regions;
- }
-
-
-
- ///
- /// Returns a XML String containing a list of the neighbouring regions
- ///
- /// The regionhandle for the center sim
- /// An XML string containing neighbour entities
- public string GetXMLNeighbours(ulong reqhandle)
- {
- string response = "";
- SimProfileData central_region = getRegion(reqhandle);
- SimProfileData neighbour;
- for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
- {
- if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null)
- {
- neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256));
- response += "";
- response += "" + neighbour.serverIP + "";
- response += "" + neighbour.serverPort.ToString() + "";
- response += "" + neighbour.regionLocX.ToString() + "";
- response += "" + neighbour.regionLocY.ToString() + "";
- response += "" + neighbour.regionHandle.ToString() + "";
- response += "";
-
- }
- }
- return response;
- }
-
- ///
- /// Performed when a region connects to the grid server initially.
- ///
- /// The XMLRPC Request
- /// Startup parameters
- public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
- {
-
- XmlRpcResponse response = new XmlRpcResponse();
- Hashtable responseData = new Hashtable();
- response.Value = responseData;
-
- SimProfileData TheSim = null;
- Hashtable requestData = (Hashtable)request.Params[0];
-
- if (requestData.ContainsKey("UUID"))
- {
- TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
-
- logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
- }
- else if (requestData.ContainsKey("region_handle"))
- {
-
- TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
- logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
- }
- else
- {
- responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you";
- return response;
- }
-
- if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
- {
- //NEW REGION
- TheSim = new SimProfileData();
-
- TheSim.regionRecvKey = config.SimRecvKey;
- TheSim.regionSendKey = config.SimSendKey;
- TheSim.regionSecret = config.SimRecvKey;
- TheSim.regionDataURI = "";
- TheSim.regionAssetURI = config.DefaultAssetServer;
- TheSim.regionAssetRecvKey = config.AssetRecvKey;
- TheSim.regionAssetSendKey = config.AssetSendKey;
- TheSim.regionUserURI = config.DefaultUserServer;
- TheSim.regionUserSendKey = config.UserSendKey;
- TheSim.regionUserRecvKey = config.UserRecvKey;
-
- TheSim.serverIP = (string)requestData["sim_ip"];
- TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
- TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
- TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
- TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
- TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
- TheSim.regionLocZ = 0;
- TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
-
- TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
- System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
- TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
- TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
-
- Console.WriteLine("NEW SIM: " + TheSim.serverURI);
- TheSim.regionName = (string)requestData["sim_name"];
- TheSim.UUID = new LLUUID((string)requestData["UUID"]);
-
- foreach (KeyValuePair kvp in _plugins)
- {
- try
- {
- DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
- switch(insertResponse)
- {
- case DataResponse.RESPONSE_OK:
- OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName);
- break;
- case DataResponse.RESPONSE_ERROR:
- OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName);
- break;
- case DataResponse.RESPONSE_INVALIDCREDENTIALS:
- OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName);
- break;
- case DataResponse.RESPONSE_AUTHREQUIRED:
- OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName);
- break;
- }
-
- }
- catch (Exception e)
- {
- OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
- OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
- }
- }
-
-
- if (getRegion(TheSim.regionHandle) == null)
- {
- responseData["error"] = "Unable to add new region";
- return response;
- }
- }
-
-
- ArrayList SimNeighboursData = new ArrayList();
-
- SimProfileData neighbour;
- Hashtable NeighbourBlock;
-
- bool fastMode = false; // Only compatible with MySQL right now
-
- if (fastMode)
- {
- Dictionary neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
-
- foreach (KeyValuePair aSim in neighbours)
- {
- NeighbourBlock = new Hashtable();
- NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
- NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
- NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
- NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
- NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
-
- if (aSim.Value.UUID != TheSim.UUID)
- SimNeighboursData.Add(NeighbourBlock);
- }
- }
- else
- {
- for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
- {
- if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
- {
- neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
-
- NeighbourBlock = new Hashtable();
- NeighbourBlock["sim_ip"] = neighbour.serverIP;
- NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
- NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
- NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
- NeighbourBlock["UUID"] = neighbour.UUID.ToString();
-
- if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
- }
- }
- }
-
- responseData["UUID"] = TheSim.UUID.ToString();
- responseData["region_locx"] = TheSim.regionLocX.ToString();
- responseData["region_locy"] = TheSim.regionLocY.ToString();
- responseData["regionname"] = TheSim.regionName;
- responseData["estate_id"] = "1";
- responseData["neighbours"] = SimNeighboursData;
-
- responseData["sim_ip"] = TheSim.serverIP;
- responseData["sim_port"] = TheSim.serverPort.ToString();
- responseData["asset_url"] = TheSim.regionAssetURI;
- responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
- responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
- responseData["user_url"] = TheSim.regionUserURI;
- responseData["user_sendkey"] = TheSim.regionUserSendKey;
- responseData["user_recvkey"] = TheSim.regionUserRecvKey;
- responseData["authkey"] = TheSim.regionSecret;
-
- // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
- responseData["data_uri"] = TheSim.regionDataURI;
-
-
- return response;
- }
-
- public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
- {
- Hashtable requestData = (Hashtable)request.Params[0];
- Hashtable responseData = new Hashtable();
- SimProfileData simData = null;
- if (requestData.ContainsKey("region_UUID"))
- {
- simData = getRegion(new LLUUID((string)requestData["region_UUID"]));
- }
- else if (requestData.ContainsKey("region_handle"))
- {
- Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]);
- simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
- }
-
- if (simData == null)
- {
- //Sim does not exist
- Console.WriteLine("region not found");
- responseData["error"] = "Sim does not exist";
- }
- else
- {
- Console.WriteLine("found region");
- responseData["sim_ip"] = simData.serverIP;
- responseData["sim_port"] = simData.serverPort.ToString();
- responseData["http_port"] = simData.httpPort.ToString();
- responseData["remoting_port"] = simData.remotingPort.ToString();
- responseData["region_locx"] = simData.regionLocX.ToString() ;
- responseData["region_locy"] = simData.regionLocY.ToString();
- responseData["region_UUID"] = simData.UUID.UUID.ToString();
- responseData["region_name"] = simData.regionName;
- }
-
- XmlRpcResponse response = new XmlRpcResponse();
- response.Value = responseData;
- return response;
- }
-
- public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
- {
- int xmin=980, ymin=980, xmax=1020, ymax=1020;
-
- Hashtable requestData = (Hashtable)request.Params[0];
- if (requestData.ContainsKey("xmin"))
- {
- xmin = (Int32)requestData["xmin"];
- }
- if (requestData.ContainsKey("ymin"))
- {
- ymin = (Int32)requestData["ymin"];
- }
- if (requestData.ContainsKey("xmax"))
- {
- xmax = (Int32)requestData["xmax"];
- }
- if (requestData.ContainsKey("ymax"))
- {
- ymax = (Int32)requestData["ymax"];
- }
-
- XmlRpcResponse response = new XmlRpcResponse();
- Hashtable responseData = new Hashtable();
- response.Value = responseData;
- IList simProfileList = new ArrayList();
-
- bool fastMode = false; // MySQL Only
-
- if (fastMode)
- {
- Dictionary neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
-
- foreach (KeyValuePair aSim in neighbours)
- {
- Hashtable simProfileBlock = new Hashtable();
- simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
- simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
- System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString());
- simProfileBlock["name"] = aSim.Value.regionName;
- simProfileBlock["access"] = 21;
- simProfileBlock["region-flags"] = 512;
- simProfileBlock["water-height"] = 0;
- simProfileBlock["agents"] = 1;
- simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString();
-
- // For Sugilite compatibility
- simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
- simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
- simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
- simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
- simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated();
-
- simProfileList.Add(simProfileBlock);
- }
- MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode");
- }
- else
- {
- SimProfileData simProfile;
- for (int x = xmin; x < xmax+1; x++)
- {
- for (int y = ymin; y < ymax+1; y++)
- {
- ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256));
- simProfile = getRegion(regHandle);
- if (simProfile != null)
- {
- Hashtable simProfileBlock = new Hashtable();
- simProfileBlock["x"] = x;
- simProfileBlock["y"] = y;
- simProfileBlock["name"] = simProfile.regionName;
- simProfileBlock["access"] = 0;
- simProfileBlock["region-flags"] = 0;
- simProfileBlock["water-height"] = 20;
- simProfileBlock["agents"] = 1;
- simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated();
-
- // For Sugilite compatibility
- simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
- simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
- simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
- simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
- simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated();
-
- simProfileList.Add(simProfileBlock);
- }
- }
- }
- MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode");
- }
-
- responseData["sim-profiles"] = simProfileList;
-
- return response;
- }
-
-
-
- ///
- /// Performs a REST Get Operation
- ///
- ///
- ///
- ///
- ///
- public string RestGetRegionMethod(string request, string path, string param)
- {
- return RestGetSimMethod("", "/sims/", param);
- }
-
- ///
- /// Performs a REST Set Operation
- ///
- ///
- ///
- ///
- ///
- public string RestSetRegionMethod(string request, string path, string param)
- {
- return RestSetSimMethod("", "/sims/", param);
- }
-
- ///
- /// Returns information about a sim via a REST Request
- ///
- ///
- ///
- ///
- /// Information about the sim in XML
- public string RestGetSimMethod(string request, string path, string param)
- {
- string respstring = String.Empty;
-
- SimProfileData TheSim;
- LLUUID UUID = new LLUUID(param);
- TheSim = getRegion(UUID);
-
- if (!(TheSim == null))
- {
- respstring = "";
- respstring += "" + TheSim.regionSendKey + "";
- respstring += "";
- respstring += "" + TheSim.UUID.ToString() + "";
- respstring += "" + TheSim.regionName + "";
- respstring += "" + TheSim.serverIP + "";
- respstring += "" + TheSim.serverPort.ToString() + "";
- respstring += "" + TheSim.regionLocX.ToString() + "";
- respstring += "" + TheSim.regionLocY.ToString() + "";
- respstring += "1";
- respstring += "";
- respstring += "";
- }
-
- return respstring;
- }
-
- ///
- /// Creates or updates a sim via a REST Method Request
- /// BROKEN with SQL Update
- ///
- ///
- ///
- ///
- /// "OK" or an error
- public string RestSetSimMethod(string request, string path, string param)
- {
- Console.WriteLine("Processing region update via REST method");
- SimProfileData TheSim;
- TheSim = getRegion(new LLUUID(param));
- if ((TheSim) == null)
- {
- TheSim = new SimProfileData();
- LLUUID UUID = new LLUUID(param);
- TheSim.UUID = UUID;
- TheSim.regionRecvKey = config.SimRecvKey;
- }
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(request);
- XmlNode rootnode = doc.FirstChild;
- XmlNode authkeynode = rootnode.ChildNodes[0];
- if (authkeynode.Name != "authkey")
- {
- return "ERROR! bad XML - expected authkey tag";
- }
-
- XmlNode simnode = rootnode.ChildNodes[1];
- if (simnode.Name != "sim")
- {
- return "ERROR! bad XML - expected sim tag";
- }
-
- //TheSim.regionSendKey = Cfg;
- TheSim.regionRecvKey = config.SimRecvKey;
- TheSim.regionSendKey = config.SimSendKey;
- TheSim.regionSecret = config.SimRecvKey;
- TheSim.regionDataURI = "";
- TheSim.regionAssetURI = config.DefaultAssetServer;
- TheSim.regionAssetRecvKey = config.AssetRecvKey;
- TheSim.regionAssetSendKey = config.AssetSendKey;
- TheSim.regionUserURI = config.DefaultUserServer;
- TheSim.regionUserSendKey = config.UserSendKey;
- TheSim.regionUserRecvKey = config.UserRecvKey;
-
-
- for (int i = 0; i < simnode.ChildNodes.Count; i++)
- {
- switch (simnode.ChildNodes[i].Name)
- {
- case "regionname":
- TheSim.regionName = simnode.ChildNodes[i].InnerText;
- break;
-
- case "sim_ip":
- TheSim.serverIP = simnode.ChildNodes[i].InnerText;
- break;
-
- case "sim_port":
- TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
- break;
-
- case "region_locx":
- TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
- TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
- break;
-
- case "region_locy":
- TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
- TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
- break;
- }
- }
-
- TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
-
- bool requirePublic = false;
- bool requireValid = true;
-
- if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
- {
- return "ERROR! Servers must register with public addresses.";
- }
-
- if (requireValid && (TheSim.serverIP.StartsWith("0.")))
- {
- return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
- }
-
-
- try
- {
- MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
- foreach (KeyValuePair kvp in _plugins)
- {
- try
- {
- //Check reservations
- ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY);
- if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
- {
- kvp.Value.AddProfile(TheSim);
- MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")");
- logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid.");
- }
- else
- {
- MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
- return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
- }
- }
- catch (Exception e)
- {
- MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString());
- }
- }
- return "OK";
- }
- catch (Exception e)
- {
- return "ERROR! Could not save to database! (" + e.ToString() + ")";
- }
- }
-
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Xml;
+using libsecondlife;
+using Nwc.XmlRpc;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Data;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Utilities;
+
+namespace OpenSim.Grid.GridServer
+{
+ class GridManager
+ {
+ Dictionary _plugins = new Dictionary();
+ Dictionary _logplugins = new Dictionary();
+
+ public GridConfig config;
+
+ ///
+ /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
+ ///
+ /// The filename to the grid server plugin DLL
+ public void AddPlugin(string FileName)
+ {
+ MainLog.Instance.Verbose("Storage: Attempting to load " + FileName);
+ Assembly pluginAssembly = Assembly.LoadFrom(FileName);
+
+ MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
+ foreach (Type pluginType in pluginAssembly.GetTypes())
+ {
+ if (!pluginType.IsAbstract)
+ {
+ // Regions go here
+ Type typeInterface = pluginType.GetInterface("IGridData", true);
+
+ if (typeInterface != null)
+ {
+ IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ plug.Initialise();
+ this._plugins.Add(plug.getName(), plug);
+ MainLog.Instance.Verbose("Storage: Added IGridData Interface");
+ }
+
+ typeInterface = null;
+
+ // Logs go here
+ typeInterface = pluginType.GetInterface("ILogData", true);
+
+ if (typeInterface != null)
+ {
+ ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ plug.Initialise();
+ this._logplugins.Add(plug.getName(), plug);
+ MainLog.Instance.Verbose( "Storage: Added ILogData Interface");
+ }
+
+ typeInterface = null;
+ }
+ }
+
+ pluginAssembly = null;
+ }
+
+ ///
+ /// Logs a piece of information to the database
+ ///
+ /// What you were operating on (in grid server, this will likely be the region UUIDs)
+ /// Which method is being called?
+ /// What arguments are being passed?
+ /// How high priority is this? 1 = Max, 6 = Verbose
+ /// The message to log
+ private void logToDB(string target, string method, string args, int priority, string message)
+ {
+ foreach (KeyValuePair kvp in _logplugins)
+ {
+ try
+ {
+ kvp.Value.saveLog("Gridserver", target, method, args, priority, message);
+ }
+ catch (Exception)
+ {
+ MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key);
+ }
+ }
+ }
+
+ ///
+ /// Returns a region by argument
+ ///
+ /// A UUID key of the region to return
+ /// A SimProfileData for the region
+ public SimProfileData getRegion(LLUUID uuid)
+ {
+ foreach(KeyValuePair kvp in _plugins) {
+ try
+ {
+ return kvp.Value.GetProfileByLLUUID(uuid);
+ }
+ catch (Exception e)
+ {
+ MainLog.Instance.Warn("Message from Storage: " + e.Message);
+ }
+ }
+ return null;
+ }
+
+ ///
+ /// Returns a region by argument
+ ///
+ /// A regionHandle of the region to return
+ /// A SimProfileData for the region
+ public SimProfileData getRegion(ulong handle)
+ {
+ foreach (KeyValuePair kvp in _plugins)
+ {
+ try
+ {
+ return kvp.Value.GetProfileByHandle(handle);
+ }
+ catch
+ {
+ MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
+ }
+ }
+ return null;
+ }
+
+ public Dictionary getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
+ {
+ Dictionary regions = new Dictionary();
+
+ SimProfileData[] neighbours;
+
+ foreach (KeyValuePair kvp in _plugins)
+ {
+ try
+ {
+ neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
+ foreach (SimProfileData neighbour in neighbours)
+ {
+ regions[neighbour.regionHandle] = neighbour;
+ }
+ }
+ catch
+ {
+ MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key);
+ }
+ }
+
+ return regions;
+ }
+
+
+
+ ///
+ /// Returns a XML String containing a list of the neighbouring regions
+ ///
+ /// The regionhandle for the center sim
+ /// An XML string containing neighbour entities
+ public string GetXMLNeighbours(ulong reqhandle)
+ {
+ string response = "";
+ SimProfileData central_region = getRegion(reqhandle);
+ SimProfileData neighbour;
+ for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
+ {
+ if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null)
+ {
+ neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256));
+ response += "";
+ response += "" + neighbour.serverIP + "";
+ response += "" + neighbour.serverPort.ToString() + "";
+ response += "" + neighbour.regionLocX.ToString() + "";
+ response += "" + neighbour.regionLocY.ToString() + "";
+ response += "" + neighbour.regionHandle.ToString() + "";
+ response += "";
+
+ }
+ }
+ return response;
+ }
+
+ ///
+ /// Performed when a region connects to the grid server initially.
+ ///
+ /// The XMLRPC Request
+ /// Startup parameters
+ public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
+ {
+
+ XmlRpcResponse response = new XmlRpcResponse();
+ Hashtable responseData = new Hashtable();
+ response.Value = responseData;
+
+ SimProfileData TheSim = null;
+ Hashtable requestData = (Hashtable)request.Params[0];
+
+ if (requestData.ContainsKey("UUID"))
+ {
+ TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
+
+ logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
+ }
+ else if (requestData.ContainsKey("region_handle"))
+ {
+
+ TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
+ logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
+ }
+ else
+ {
+ responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you";
+ return response;
+ }
+
+ if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
+ {
+ //NEW REGION
+ TheSim = new SimProfileData();
+
+ TheSim.regionRecvKey = config.SimRecvKey;
+ TheSim.regionSendKey = config.SimSendKey;
+ TheSim.regionSecret = config.SimRecvKey;
+ TheSim.regionDataURI = "";
+ TheSim.regionAssetURI = config.DefaultAssetServer;
+ TheSim.regionAssetRecvKey = config.AssetRecvKey;
+ TheSim.regionAssetSendKey = config.AssetSendKey;
+ TheSim.regionUserURI = config.DefaultUserServer;
+ TheSim.regionUserSendKey = config.UserSendKey;
+ TheSim.regionUserRecvKey = config.UserRecvKey;
+
+ TheSim.serverIP = (string)requestData["sim_ip"];
+ TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
+ TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
+ TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
+ TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
+ TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
+ TheSim.regionLocZ = 0;
+ TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
+
+ TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
+ System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
+ TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
+ TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
+
+ Console.WriteLine("NEW SIM: " + TheSim.serverURI);
+ TheSim.regionName = (string)requestData["sim_name"];
+ TheSim.UUID = new LLUUID((string)requestData["UUID"]);
+
+ foreach (KeyValuePair kvp in _plugins)
+ {
+ try
+ {
+ DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
+ switch(insertResponse)
+ {
+ case DataResponse.RESPONSE_OK:
+ OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName);
+ break;
+ case DataResponse.RESPONSE_ERROR:
+ OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName);
+ break;
+ case DataResponse.RESPONSE_INVALIDCREDENTIALS:
+ OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName);
+ break;
+ case DataResponse.RESPONSE_AUTHREQUIRED:
+ OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName);
+ break;
+ }
+
+ }
+ catch (Exception e)
+ {
+ OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
+ OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
+ }
+ }
+
+
+ if (getRegion(TheSim.regionHandle) == null)
+ {
+ responseData["error"] = "Unable to add new region";
+ return response;
+ }
+ }
+
+
+ ArrayList SimNeighboursData = new ArrayList();
+
+ SimProfileData neighbour;
+ Hashtable NeighbourBlock;
+
+ bool fastMode = false; // Only compatible with MySQL right now
+
+ if (fastMode)
+ {
+ Dictionary neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
+
+ foreach (KeyValuePair aSim in neighbours)
+ {
+ NeighbourBlock = new Hashtable();
+ NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
+ NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
+ NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
+ NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
+ NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
+
+ if (aSim.Value.UUID != TheSim.UUID)
+ SimNeighboursData.Add(NeighbourBlock);
+ }
+ }
+ else
+ {
+ for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
+ {
+ if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
+ {
+ neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
+
+ NeighbourBlock = new Hashtable();
+ NeighbourBlock["sim_ip"] = neighbour.serverIP;
+ NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
+ NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
+ NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
+ NeighbourBlock["UUID"] = neighbour.UUID.ToString();
+
+ if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
+ }
+ }
+ }
+
+ responseData["UUID"] = TheSim.UUID.ToString();
+ responseData["region_locx"] = TheSim.regionLocX.ToString();
+ responseData["region_locy"] = TheSim.regionLocY.ToString();
+ responseData["regionname"] = TheSim.regionName;
+ responseData["estate_id"] = "1";
+ responseData["neighbours"] = SimNeighboursData;
+
+ responseData["sim_ip"] = TheSim.serverIP;
+ responseData["sim_port"] = TheSim.serverPort.ToString();
+ responseData["asset_url"] = TheSim.regionAssetURI;
+ responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
+ responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
+ responseData["user_url"] = TheSim.regionUserURI;
+ responseData["user_sendkey"] = TheSim.regionUserSendKey;
+ responseData["user_recvkey"] = TheSim.regionUserRecvKey;
+ responseData["authkey"] = TheSim.regionSecret;
+
+ // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
+ responseData["data_uri"] = TheSim.regionDataURI;
+
+
+ return response;
+ }
+
+ public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
+ {
+ Hashtable requestData = (Hashtable)request.Params[0];
+ Hashtable responseData = new Hashtable();
+ SimProfileData simData = null;
+ if (requestData.ContainsKey("region_UUID"))
+ {
+ simData = getRegion(new LLUUID((string)requestData["region_UUID"]));
+ }
+ else if (requestData.ContainsKey("region_handle"))
+ {
+ Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]);
+ simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
+ }
+
+ if (simData == null)
+ {
+ //Sim does not exist
+ Console.WriteLine("region not found");
+ responseData["error"] = "Sim does not exist";
+ }
+ else
+ {
+ Console.WriteLine("found region");
+ responseData["sim_ip"] = simData.serverIP;
+ responseData["sim_port"] = simData.serverPort.ToString();
+ responseData["http_port"] = simData.httpPort.ToString();
+ responseData["remoting_port"] = simData.remotingPort.ToString();
+ responseData["region_locx"] = simData.regionLocX.ToString() ;
+ responseData["region_locy"] = simData.regionLocY.ToString();
+ responseData["region_UUID"] = simData.UUID.UUID.ToString();
+ responseData["region_name"] = simData.regionName;
+ }
+
+ XmlRpcResponse response = new XmlRpcResponse();
+ response.Value = responseData;
+ return response;
+ }
+
+ public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
+ {
+ int xmin=980, ymin=980, xmax=1020, ymax=1020;
+
+ Hashtable requestData = (Hashtable)request.Params[0];
+ if (requestData.ContainsKey("xmin"))
+ {
+ xmin = (Int32)requestData["xmin"];
+ }
+ if (requestData.ContainsKey("ymin"))
+ {
+ ymin = (Int32)requestData["ymin"];
+ }
+ if (requestData.ContainsKey("xmax"))
+ {
+ xmax = (Int32)requestData["xmax"];
+ }
+ if (requestData.ContainsKey("ymax"))
+ {
+ ymax = (Int32)requestData["ymax"];
+ }
+
+ XmlRpcResponse response = new XmlRpcResponse();
+ Hashtable responseData = new Hashtable();
+ response.Value = responseData;
+ IList simProfileList = new ArrayList();
+
+ bool fastMode = false; // MySQL Only
+
+ if (fastMode)
+ {
+ Dictionary neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
+
+ foreach (KeyValuePair aSim in neighbours)
+ {
+ Hashtable simProfileBlock = new Hashtable();
+ simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
+ simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
+ System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString());
+ simProfileBlock["name"] = aSim.Value.regionName;
+ simProfileBlock["access"] = 21;
+ simProfileBlock["region-flags"] = 512;
+ simProfileBlock["water-height"] = 0;
+ simProfileBlock["agents"] = 1;
+ simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString();
+
+ // For Sugilite compatibility
+ simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
+ simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
+ simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
+ simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
+ simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated();
+
+ simProfileList.Add(simProfileBlock);
+ }
+ MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode");
+ }
+ else
+ {
+ SimProfileData simProfile;
+ for (int x = xmin; x < xmax+1; x++)
+ {
+ for (int y = ymin; y < ymax+1; y++)
+ {
+ ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256));
+ simProfile = getRegion(regHandle);
+ if (simProfile != null)
+ {
+ Hashtable simProfileBlock = new Hashtable();
+ simProfileBlock["x"] = x;
+ simProfileBlock["y"] = y;
+ simProfileBlock["name"] = simProfile.regionName;
+ simProfileBlock["access"] = 0;
+ simProfileBlock["region-flags"] = 0;
+ simProfileBlock["water-height"] = 20;
+ simProfileBlock["agents"] = 1;
+ simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated();
+
+ // For Sugilite compatibility
+ simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
+ simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
+ simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
+ simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
+ simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated();
+
+ simProfileList.Add(simProfileBlock);
+ }
+ }
+ }
+ MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode");
+ }
+
+ responseData["sim-profiles"] = simProfileList;
+
+ return response;
+ }
+
+
+
+ ///
+ /// Performs a REST Get Operation
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string RestGetRegionMethod(string request, string path, string param)
+ {
+ return RestGetSimMethod("", "/sims/", param);
+ }
+
+ ///
+ /// Performs a REST Set Operation
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string RestSetRegionMethod(string request, string path, string param)
+ {
+ return RestSetSimMethod("", "/sims/", param);
+ }
+
+ ///
+ /// Returns information about a sim via a REST Request
+ ///
+ ///
+ ///
+ ///
+ /// Information about the sim in XML
+ public string RestGetSimMethod(string request, string path, string param)
+ {
+ string respstring = String.Empty;
+
+ SimProfileData TheSim;
+ LLUUID UUID = new LLUUID(param);
+ TheSim = getRegion(UUID);
+
+ if (!(TheSim == null))
+ {
+ respstring = "";
+ respstring += "" + TheSim.regionSendKey + "";
+ respstring += "";
+ respstring += "" + TheSim.UUID.ToString() + "";
+ respstring += "" + TheSim.regionName + "";
+ respstring += "" + TheSim.serverIP + "";
+ respstring += "" + TheSim.serverPort.ToString() + "";
+ respstring += "" + TheSim.regionLocX.ToString() + "";
+ respstring += "" + TheSim.regionLocY.ToString() + "";
+ respstring += "1";
+ respstring += "";
+ respstring += "";
+ }
+
+ return respstring;
+ }
+
+ ///
+ /// Creates or updates a sim via a REST Method Request
+ /// BROKEN with SQL Update
+ ///
+ ///
+ ///
+ ///
+ /// "OK" or an error
+ public string RestSetSimMethod(string request, string path, string param)
+ {
+ Console.WriteLine("Processing region update via REST method");
+ SimProfileData TheSim;
+ TheSim = getRegion(new LLUUID(param));
+ if ((TheSim) == null)
+ {
+ TheSim = new SimProfileData();
+ LLUUID UUID = new LLUUID(param);
+ TheSim.UUID = UUID;
+ TheSim.regionRecvKey = config.SimRecvKey;
+ }
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(request);
+ XmlNode rootnode = doc.FirstChild;
+ XmlNode authkeynode = rootnode.ChildNodes[0];
+ if (authkeynode.Name != "authkey")
+ {
+ return "ERROR! bad XML - expected authkey tag";
+ }
+
+ XmlNode simnode = rootnode.ChildNodes[1];
+ if (simnode.Name != "sim")
+ {
+ return "ERROR! bad XML - expected sim tag";
+ }
+
+ //TheSim.regionSendKey = Cfg;
+ TheSim.regionRecvKey = config.SimRecvKey;
+ TheSim.regionSendKey = config.SimSendKey;
+ TheSim.regionSecret = config.SimRecvKey;
+ TheSim.regionDataURI = "";
+ TheSim.regionAssetURI = config.DefaultAssetServer;
+ TheSim.regionAssetRecvKey = config.AssetRecvKey;
+ TheSim.regionAssetSendKey = config.AssetSendKey;
+ TheSim.regionUserURI = config.DefaultUserServer;
+ TheSim.regionUserSendKey = config.UserSendKey;
+ TheSim.regionUserRecvKey = config.UserRecvKey;
+
+
+ for (int i = 0; i < simnode.ChildNodes.Count; i++)
+ {
+ switch (simnode.ChildNodes[i].Name)
+ {
+ case "regionname":
+ TheSim.regionName = simnode.ChildNodes[i].InnerText;
+ break;
+
+ case "sim_ip":
+ TheSim.serverIP = simnode.ChildNodes[i].InnerText;
+ break;
+
+ case "sim_port":
+ TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
+ break;
+
+ case "region_locx":
+ TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
+ TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
+ break;
+
+ case "region_locy":
+ TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
+ TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
+ break;
+ }
+ }
+
+ TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
+
+ bool requirePublic = false;
+ bool requireValid = true;
+
+ if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
+ {
+ return "ERROR! Servers must register with public addresses.";
+ }
+
+ if (requireValid && (TheSim.serverIP.StartsWith("0.")))
+ {
+ return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
+ }
+
+
+ try
+ {
+ MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
+ foreach (KeyValuePair kvp in _plugins)
+ {
+ try
+ {
+ //Check reservations
+ ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY);
+ if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
+ {
+ kvp.Value.AddProfile(TheSim);
+ MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")");
+ logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid.");
+ }
+ else
+ {
+ MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
+ return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
+ }
+ }
+ catch (Exception e)
+ {
+ MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString());
+ }
+ }
+ return "OK";
+ }
+ catch (Exception e)
+ {
+ return "ERROR! Could not save to database! (" + e.ToString() + ")";
+ }
+ }
+
+ }
+}
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index dc5e4fa..09aeab5 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -1,258 +1,258 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-using System;
-using System.Reflection;
-using System.Threading;
-using System.Timers;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Interfaces;
-using OpenSim.Framework.Servers;
-using OpenSim.GenericConfig;
-using Timer=System.Timers.Timer;
-
-namespace OpenSim.Grid.GridServer
-{
- ///
- ///
- public class OpenGrid_Main : conscmd_callback
- {
- private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll";
- private string GridDll = "OpenSim.Framework.Data.MySQL.dll";
- public GridConfig Cfg;
-
- public static OpenGrid_Main thegrid;
- protected IGenericConfig localXMLConfig;
-
- public static bool setuponly;
-
- //public LLUUID highestUUID;
-
- // private SimProfileManager m_simProfileManager;
-
- private GridManager m_gridManager;
-
- private LogBase m_console;
-
- [STAThread]
- public static void Main(string[] args)
- {
- if (args.Length > 0)
- {
- if (args[0] == "-setuponly") setuponly = true;
- }
- Console.WriteLine("Starting...\n");
-
- thegrid = new OpenGrid_Main();
- thegrid.Startup();
-
- thegrid.Work();
- }
-
- private void Work()
- {
- m_console.Notice("Enter help for a list of commands\n");
-
- while (true)
- {
- m_console.MainLogPrompt();
- }
- }
-
- private OpenGrid_Main()
- {
- m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
- MainLog.Instance = m_console;
-
-
- }
-
- public void managercallback(string cmd)
- {
- switch (cmd)
- {
- case "shutdown":
- RunCmd("shutdown", new string[0]);
- break;
- }
- }
-
-
- public void Startup()
- {
- this.localXMLConfig = new XmlConfig("GridServerConfig.xml");
- this.localXMLConfig.LoadData();
- this.ConfigDB(this.localXMLConfig);
- this.localXMLConfig.Close();
-
- m_console.Verbose( "Main.cs:Startup() - Loading configuration");
- Cfg = this.LoadConfigDll(this.ConfigDll);
- Cfg.InitConfig();
- if (setuponly) Environment.Exit(0);
-
- m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server");
- m_gridManager = new GridManager();
- m_gridManager.AddPlugin(GridDll); // Made of win
- m_gridManager.config = Cfg;
-
- m_console.Verbose( "Main.cs:Startup() - Starting HTTP process");
- BaseHttpServer httpServer = new BaseHttpServer(8001);
- //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
-
- httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
- httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod);
- httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
-
- httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod ));
- httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod ));
-
- httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod ));
- httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod ));
-
- //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
- //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
- //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
- //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
-
- httpServer.Start();
-
- m_console.Verbose( "Main.cs:Startup() - Starting sim status checker");
-
- Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
- simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
- simCheckTimer.Enabled = true;
- }
-
- private GridConfig LoadConfigDll(string dllName)
- {
- Assembly pluginAssembly = Assembly.LoadFrom(dllName);
- GridConfig config = null;
-
- foreach (Type pluginType in pluginAssembly.GetTypes())
- {
- if (pluginType.IsPublic)
- {
- if (!pluginType.IsAbstract)
- {
- Type typeInterface = pluginType.GetInterface("IGridConfig", true);
-
- if (typeInterface != null)
- {
- IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- config = plug.GetConfigObject();
- break;
- }
-
- typeInterface = null;
- }
- }
- }
- pluginAssembly = null;
- return config;
- }
-
- public void CheckSims(object sender, ElapsedEventArgs e)
- {
- /*
- foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
- {
- string SimResponse = "";
- try
- {
- WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
- CheckSim.Method = "GET";
- CheckSim.ContentType = "text/plaintext";
- CheckSim.ContentLength = 0;
-
- StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
- stOut.Write("");
- stOut.Close();
-
- StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
- SimResponse = stIn.ReadToEnd();
- stIn.Close();
- }
- catch
- {
- }
-
- if (SimResponse == "OK")
- {
- m_simProfileManager.SimProfiles[sim.UUID].online = true;
- }
- else
- {
- m_simProfileManager.SimProfiles[sim.UUID].online = false;
- }
- }
- */
- }
-
- public void RunCmd(string cmd, string[] cmdparams)
- {
- switch (cmd)
- {
- case "help":
- m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
- break;
-
- case "shutdown":
- m_console.Close();
- Environment.Exit(0);
- break;
- }
- }
-
- public void Show(string ShowWhat)
- {
- }
-
- private void ConfigDB(IGenericConfig configData)
- {
- try
- {
- string attri = "";
- attri = configData.GetAttribute("DataBaseProvider");
- if (attri == "")
- {
- GridDll = "OpenSim.Framework.Data.DB4o.dll";
- configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
- }
- else
- {
- GridDll = attri;
- }
- configData.Commit();
- }
- catch
- {
-
- }
- }
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+using System;
+using System.Reflection;
+using System.Threading;
+using System.Timers;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Servers;
+using OpenSim.GenericConfig;
+using Timer=System.Timers.Timer;
+
+namespace OpenSim.Grid.GridServer
+{
+ ///
+ ///
+ public class OpenGrid_Main : conscmd_callback
+ {
+ private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll";
+ private string GridDll = "OpenSim.Framework.Data.MySQL.dll";
+ public GridConfig Cfg;
+
+ public static OpenGrid_Main thegrid;
+ protected IGenericConfig localXMLConfig;
+
+ public static bool setuponly;
+
+ //public LLUUID highestUUID;
+
+ // private SimProfileManager m_simProfileManager;
+
+ private GridManager m_gridManager;
+
+ private LogBase m_console;
+
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ if (args.Length > 0)
+ {
+ if (args[0] == "-setuponly") setuponly = true;
+ }
+ Console.WriteLine("Starting...\n");
+
+ thegrid = new OpenGrid_Main();
+ thegrid.Startup();
+
+ thegrid.Work();
+ }
+
+ private void Work()
+ {
+ m_console.Notice("Enter help for a list of commands\n");
+
+ while (true)
+ {
+ m_console.MainLogPrompt();
+ }
+ }
+
+ private OpenGrid_Main()
+ {
+ m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
+ MainLog.Instance = m_console;
+
+
+ }
+
+ public void managercallback(string cmd)
+ {
+ switch (cmd)
+ {
+ case "shutdown":
+ RunCmd("shutdown", new string[0]);
+ break;
+ }
+ }
+
+
+ public void Startup()
+ {
+ this.localXMLConfig = new XmlConfig("GridServerConfig.xml");
+ this.localXMLConfig.LoadData();
+ this.ConfigDB(this.localXMLConfig);
+ this.localXMLConfig.Close();
+
+ m_console.Verbose( "Main.cs:Startup() - Loading configuration");
+ Cfg = this.LoadConfigDll(this.ConfigDll);
+ Cfg.InitConfig();
+ if (setuponly) Environment.Exit(0);
+
+ m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server");
+ m_gridManager = new GridManager();
+ m_gridManager.AddPlugin(GridDll); // Made of win
+ m_gridManager.config = Cfg;
+
+ m_console.Verbose( "Main.cs:Startup() - Starting HTTP process");
+ BaseHttpServer httpServer = new BaseHttpServer(8001);
+ //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
+
+ httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
+ httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod);
+ httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
+
+ httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod ));
+ httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod ));
+
+ httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod ));
+ httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod ));
+
+ //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
+ //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
+ //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
+ //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
+
+ httpServer.Start();
+
+ m_console.Verbose( "Main.cs:Startup() - Starting sim status checker");
+
+ Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
+ simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
+ simCheckTimer.Enabled = true;
+ }
+
+ private GridConfig LoadConfigDll(string dllName)
+ {
+ Assembly pluginAssembly = Assembly.LoadFrom(dllName);
+ GridConfig config = null;
+
+ foreach (Type pluginType in pluginAssembly.GetTypes())
+ {
+ if (pluginType.IsPublic)
+ {
+ if (!pluginType.IsAbstract)
+ {
+ Type typeInterface = pluginType.GetInterface("IGridConfig", true);
+
+ if (typeInterface != null)
+ {
+ IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ config = plug.GetConfigObject();
+ break;
+ }
+
+ typeInterface = null;
+ }
+ }
+ }
+ pluginAssembly = null;
+ return config;
+ }
+
+ public void CheckSims(object sender, ElapsedEventArgs e)
+ {
+ /*
+ foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
+ {
+ string SimResponse = "";
+ try
+ {
+ WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
+ CheckSim.Method = "GET";
+ CheckSim.ContentType = "text/plaintext";
+ CheckSim.ContentLength = 0;
+
+ StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
+ stOut.Write("");
+ stOut.Close();
+
+ StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
+ SimResponse = stIn.ReadToEnd();
+ stIn.Close();
+ }
+ catch
+ {
+ }
+
+ if (SimResponse == "OK")
+ {
+ m_simProfileManager.SimProfiles[sim.UUID].online = true;
+ }
+ else
+ {
+ m_simProfileManager.SimProfiles[sim.UUID].online = false;
+ }
+ }
+ */
+ }
+
+ public void RunCmd(string cmd, string[] cmdparams)
+ {
+ switch (cmd)
+ {
+ case "help":
+ m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
+ break;
+
+ case "shutdown":
+ m_console.Close();
+ Environment.Exit(0);
+ break;
+ }
+ }
+
+ public void Show(string ShowWhat)
+ {
+ }
+
+ private void ConfigDB(IGenericConfig configData)
+ {
+ try
+ {
+ string attri = "";
+ attri = configData.GetAttribute("DataBaseProvider");
+ if (attri == "")
+ {
+ GridDll = "OpenSim.Framework.Data.DB4o.dll";
+ configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
+ }
+ else
+ {
+ GridDll = attri;
+ }
+ configData.Commit();
+ }
+ catch
+ {
+
+ }
+ }
+ }
+}
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 62a68a8..1eeac93 100644
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
@@ -1,58 +1,58 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System.Reflection;
-using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OGS-GridServer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("OGS-GridServer")]
-[assembly: AssemblyCopyright("Copyright © 2007")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System.Reflection;
+using System.Runtime.InteropServices;
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OGS-GridServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OGS-GridServer")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index 9ca9b5e..0685088 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -1,125 +1,125 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
-using OpenGrid.Framework.Data;
-using libsecondlife;
-using System.Reflection;
-
-using System.Xml;
-using Nwc.XmlRpc;
-using OpenSim.Framework.Sims;
-using OpenSim.Framework.Inventory;
-using OpenSim.Framework.Utilities;
-
-using System.Security.Cryptography;
-
-namespace OpenGridServices.InventoryServer
-{
- class InventoryManager
- {
- Dictionary _plugins = new Dictionary();
-
- ///
- /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
- ///
- /// The filename to the inventory server plugin DLL
- public void AddPlugin(string FileName)
- {
- OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
- Assembly pluginAssembly = Assembly.LoadFrom(FileName);
-
- OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
- foreach (Type pluginType in pluginAssembly.GetTypes())
- {
- if (!pluginType.IsAbstract)
- {
- Type typeInterface = pluginType.GetInterface("IInventoryData", true);
-
- if (typeInterface != null)
- {
- IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- plug.Initialise();
- this._plugins.Add(plug.getName(), plug);
- OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
- }
-
- typeInterface = null;
- }
- }
-
- pluginAssembly = null;
- }
-
- public List getRootFolders(LLUUID user)
- {
- foreach (KeyValuePair kvp in _plugins)
- {
- try
- {
- return kvp.Value.getUserRootFolders(user);
- }
- catch (Exception e)
- {
- OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
- }
- }
- return null;
- }
-
- public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
- {
- XmlRpcResponse response = new XmlRpcResponse();
- Hashtable requestData = (Hashtable)request.Params[0];
-
- Hashtable responseData = new Hashtable();
-
- // Stuff happens here
-
- if (requestData.ContainsKey("Access-type"))
- {
- if (requestData["access-type"] == "rootfolders")
- {
-// responseData["rootfolders"] =
- }
- }
- else
- {
- responseData["error"] = "No access-type specified.";
- }
-
-
- // Stuff stops happening here
-
- response.Value = responseData;
- return response;
- }
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using OpenGrid.Framework.Data;
+using libsecondlife;
+using System.Reflection;
+
+using System.Xml;
+using Nwc.XmlRpc;
+using OpenSim.Framework.Sims;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.Utilities;
+
+using System.Security.Cryptography;
+
+namespace OpenGridServices.InventoryServer
+{
+ class InventoryManager
+ {
+ Dictionary _plugins = new Dictionary();
+
+ ///
+ /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
+ ///
+ /// The filename to the inventory server plugin DLL
+ public void AddPlugin(string FileName)
+ {
+ OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
+ Assembly pluginAssembly = Assembly.LoadFrom(FileName);
+
+ OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
+ foreach (Type pluginType in pluginAssembly.GetTypes())
+ {
+ if (!pluginType.IsAbstract)
+ {
+ Type typeInterface = pluginType.GetInterface("IInventoryData", true);
+
+ if (typeInterface != null)
+ {
+ IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ plug.Initialise();
+ this._plugins.Add(plug.getName(), plug);
+ OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
+ }
+
+ typeInterface = null;
+ }
+ }
+
+ pluginAssembly = null;
+ }
+
+ public List getRootFolders(LLUUID user)
+ {
+ foreach (KeyValuePair kvp in _plugins)
+ {
+ try
+ {
+ return kvp.Value.getUserRootFolders(user);
+ }
+ catch (Exception e)
+ {
+ OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
+ }
+ }
+ return null;
+ }
+
+ public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
+ {
+ XmlRpcResponse response = new XmlRpcResponse();
+ Hashtable requestData = (Hashtable)request.Params[0];
+
+ Hashtable responseData = new Hashtable();
+
+ // Stuff happens here
+
+ if (requestData.ContainsKey("Access-type"))
+ {
+ if (requestData["access-type"] == "rootfolders")
+ {
+// responseData["rootfolders"] =
+ }
+ }
+ else
+ {
+ responseData["error"] = "No access-type specified.";
+ }
+
+
+ // Stuff stops happening here
+
+ response.Value = responseData;
+ return response;
+ }
+ }
+}
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index f479a79..e1276a9 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -1,87 +1,87 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection;
-using System.IO;
-using System.Text;
-using libsecondlife;
-using OpenSim.Framework.User;
-using OpenSim.Framework.Sims;
-using OpenSim.Framework.Inventory;
-using OpenSim.Framework.Interfaces;
-using OpenSim.Framework.Console;
-using OpenSim.Servers;
-using OpenSim.Framework.Utilities;
-
-namespace OpenGridServices.InventoryServer
-{
- public class OpenInventory_Main : BaseServer, conscmd_callback
- {
- ConsoleBase m_console;
- InventoryManager m_inventoryManager;
-
- public static void Main(string[] args)
- {
- }
-
- public OpenInventory_Main()
- {
- m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
- MainConsole.Instance = m_console;
- }
-
- public void Startup()
- {
- MainConsole.Instance.Notice("Initialising inventory manager...");
- m_inventoryManager = new InventoryManager();
-
- MainConsole.Instance.Notice("Starting HTTP server");
- BaseHttpServer httpServer = new BaseHttpServer(8004);
-
- httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
- //httpServer.AddRestHandler("GET","/rootfolders/",Rest
- }
-
- public void RunCmd(string cmd, string[] cmdparams)
- {
- switch (cmd)
- {
- case "shutdown":
- m_console.Close();
- Environment.Exit(0);
- break;
- }
- }
-
- public void Show(string ShowWhat)
- {
- }
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using System.IO;
+using System.Text;
+using libsecondlife;
+using OpenSim.Framework.User;
+using OpenSim.Framework.Sims;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Console;
+using OpenSim.Servers;
+using OpenSim.Framework.Utilities;
+
+namespace OpenGridServices.InventoryServer
+{
+ public class OpenInventory_Main : BaseServer, conscmd_callback
+ {
+ ConsoleBase m_console;
+ InventoryManager m_inventoryManager;
+
+ public static void Main(string[] args)
+ {
+ }
+
+ public OpenInventory_Main()
+ {
+ m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
+ MainConsole.Instance = m_console;
+ }
+
+ public void Startup()
+ {
+ MainConsole.Instance.Notice("Initialising inventory manager...");
+ m_inventoryManager = new InventoryManager();
+
+ MainConsole.Instance.Notice("Starting HTTP server");
+ BaseHttpServer httpServer = new BaseHttpServer(8004);
+
+ httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
+ //httpServer.AddRestHandler("GET","/rootfolders/",Rest
+ }
+
+ public void RunCmd(string cmd, string[] cmdparams)
+ {
+ switch (cmd)
+ {
+ case "shutdown":
+ m_console.Close();
+ Environment.Exit(0);
+ break;
+ }
+ }
+
+ public void Show(string ShowWhat)
+ {
+ }
+ }
+}
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
index 83685fc..be47385 100644
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
+++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
@@ -1,33 +1,33 @@
-using System;
-using System.Threading;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenGridServices.Manager
-{
- public class BlockingQueue
- {
- private Queue _queue = new Queue();
- private object _queueSync = new object();
-
- public void Enqueue(T value)
- {
- lock (_queueSync)
- {
- _queue.Enqueue(value);
- Monitor.Pulse(_queueSync);
- }
- }
-
- public T Dequeue()
- {
- lock (_queueSync)
- {
- if (_queue.Count < 1)
- Monitor.Wait(_queueSync);
-
- return _queue.Dequeue();
- }
- }
- }
-}
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenGridServices.Manager
+{
+ public class BlockingQueue
+ {
+ private Queue _queue = new Queue();
+ private object _queueSync = new object();
+
+ public void Enqueue(T value)
+ {
+ lock (_queueSync)
+ {
+ _queue.Enqueue(value);
+ Monitor.Pulse(_queueSync);
+ }
+ }
+
+ public T Dequeue()
+ {
+ lock (_queueSync)
+ {
+ if (_queue.Count < 1)
+ Monitor.Wait(_queueSync);
+
+ return _queue.Dequeue();
+ }
+ }
+ }
+}
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs
index 5bf7ff9..5646be4 100644
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs
+++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs
@@ -1,133 +1,133 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using libsecondlife;
-using libsecondlife.Packets;
-
-namespace OpenSim.Framework.Utilities
-{
- public class Util
- {
- private static Random randomClass = new Random();
- private static uint nextXferID = 5000;
- private static object XferLock = new object();
-
- public static ulong UIntsToLong(uint X, uint Y)
- {
- return Helpers.UIntsToLong(X, Y);
- }
-
- public static Random RandomClass
- {
- get
- {
- return randomClass;
- }
- }
-
- public static uint GetNextXferID()
- {
- uint id = 0;
- lock(XferLock)
- {
- id = nextXferID;
- nextXferID++;
- }
- return id;
- }
-
- //public static int fast_distance2d(int x, int y)
- //{
- // x = System.Math.Abs(x);
- // y = System.Math.Abs(y);
-
- // int min = System.Math.Min(x, y);
-
- // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
- //}
-
- public static string FieldToString(byte[] bytes)
- {
- return FieldToString(bytes, String.Empty);
- }
-
- ///
- /// Convert a variable length field (byte array) to a string, with a
- /// field name prepended to each line of the output
- ///
- /// If the byte array has unprintable characters in it, a
- /// hex dump will be put in the string instead
- /// The byte array to convert to a string
- /// A field name to prepend to each line of output
- /// An ASCII string or a string containing a hex dump, minus
- /// the null terminator
- public static string FieldToString(byte[] bytes, string fieldName)
- {
- // Check for a common case
- if (bytes.Length == 0) return String.Empty;
-
- StringBuilder output = new StringBuilder();
- bool printable = true;
-
- for (int i = 0; i < bytes.Length; ++i)
- {
- // Check if there are any unprintable characters in the array
- if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
- && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
- {
- printable = false;
- break;
- }
- }
-
- if (printable)
- {
- if (fieldName.Length > 0)
- {
- output.Append(fieldName);
- output.Append(": ");
- }
-
- if (bytes[bytes.Length - 1] == 0x00)
- output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
- else
- output.Append(UTF8Encoding.UTF8.GetString(bytes));
- }
- else
- {
- for (int i = 0; i < bytes.Length; i += 16)
- {
- if (i != 0)
- output.Append(Environment.NewLine);
- if (fieldName.Length > 0)
- {
- output.Append(fieldName);
- output.Append(": ");
- }
-
- for (int j = 0; j < 16; j++)
- {
- if ((i + j) < bytes.Length)
- output.Append(String.Format("{0:X2} ", bytes[i + j]));
- else
- output.Append(" ");
- }
-
- for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
- {
- if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
- output.Append((char)bytes[i + j]);
- else
- output.Append(".");
- }
- }
- }
-
- return output.ToString();
- }
- public Util()
- {
-
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using libsecondlife.Packets;
+
+namespace OpenSim.Framework.Utilities
+{
+ public class Util
+ {
+ private static Random randomClass = new Random();
+ private static uint nextXferID = 5000;
+ private static object XferLock = new object();
+
+ public static ulong UIntsToLong(uint X, uint Y)
+ {
+ return Helpers.UIntsToLong(X, Y);
+ }
+
+ public static Random RandomClass
+ {
+ get
+ {
+ return randomClass;
+ }
+ }
+
+ public static uint GetNextXferID()
+ {
+ uint id = 0;
+ lock(XferLock)
+ {
+ id = nextXferID;
+ nextXferID++;
+ }
+ return id;
+ }
+
+ //public static int fast_distance2d(int x, int y)
+ //{
+ // x = System.Math.Abs(x);
+ // y = System.Math.Abs(y);
+
+ // int min = System.Math.Min(x, y);
+
+ // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
+ //}
+
+ public static string FieldToString(byte[] bytes)
+ {
+ return FieldToString(bytes, String.Empty);
+ }
+
+ ///
+ /// Convert a variable length field (byte array) to a string, with a
+ /// field name prepended to each line of the output
+ ///
+ /// If the byte array has unprintable characters in it, a
+ /// hex dump will be put in the string instead
+ /// The byte array to convert to a string
+ /// A field name to prepend to each line of output
+ /// An ASCII string or a string containing a hex dump, minus
+ /// the null terminator
+ public static string FieldToString(byte[] bytes, string fieldName)
+ {
+ // Check for a common case
+ if (bytes.Length == 0) return String.Empty;
+
+ StringBuilder output = new StringBuilder();
+ bool printable = true;
+
+ for (int i = 0; i < bytes.Length; ++i)
+ {
+ // Check if there are any unprintable characters in the array
+ if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
+ && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
+ {
+ printable = false;
+ break;
+ }
+ }
+
+ if (printable)
+ {
+ if (fieldName.Length > 0)
+ {
+ output.Append(fieldName);
+ output.Append(": ");
+ }
+
+ if (bytes[bytes.Length - 1] == 0x00)
+ output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
+ else
+ output.Append(UTF8Encoding.UTF8.GetString(bytes));
+ }
+ else
+ {
+ for (int i = 0; i < bytes.Length; i += 16)
+ {
+ if (i != 0)
+ output.Append(Environment.NewLine);
+ if (fieldName.Length > 0)
+ {
+ output.Append(fieldName);
+ output.Append(": ");
+ }
+
+ for (int j = 0; j < 16; j++)
+ {
+ if ((i + j) < bytes.Length)
+ output.Append(String.Format("{0:X2} ", bytes[i + j]));
+ else
+ output.Append(" ");
+ }
+
+ for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
+ {
+ if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
+ output.Append((char)bytes[i + j]);
+ else
+ output.Append(".");
+ }
+ }
+ }
+
+ return output.ToString();
+ }
+ public Util()
+ {
+
+ }
+ }
+}
diff --git a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs
index 15298e8..885bada 100644
--- a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs
@@ -1,56 +1,56 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System.Reflection;
-using System.Runtime.InteropServices;
-// Information about this assembly is defined by the following
-// attributes.
-//
-// change them to the information which is associated with the assembly
-// you compile.
-
-[assembly: AssemblyTitle("UserConfig")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UserConfig")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// This sets the default COM visibility of types in the assembly to invisible.
-// If you need to expose a type to COM, use [ComVisible(true)] on that type.
-[assembly: ComVisible(false)]
-
-// The assembly version has following format :
-//
-// Major.Minor.Build.Revision
-//
-// You can specify all values by your own or you can build default build and revision
-// numbers with the '*' character (the default):
-
-[assembly: AssemblyVersion("1.0.*")]
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System.Reflection;
+using System.Runtime.InteropServices;
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("UserConfig")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UserConfig")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
index c7f8255..170f34b 100644
--- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
+++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
@@ -1,95 +1,95 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using Db4objects.Db4o;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Interfaces;
-
-namespace OpenUser.Config.UserConfigDb4o
-{
- public class Db4oConfigPlugin: IUserConfig
- {
- public UserConfig GetConfigObject()
- {
- MainLog.Instance.Verbose("Loading Db40Config dll");
- return ( new DbUserConfig());
- }
- }
-
- public class DbUserConfig : UserConfig
- {
- private IObjectContainer db;
-
- public void LoadDefaults() {
- MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
-
- this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS");
-
- this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/");
- this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null");
- this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null");
- }
-
- public override void InitConfig() {
- try {
- db = Db4oFactory.OpenFile("openuser.yap");
- IObjectSet result = db.Get(typeof(DbUserConfig));
- if(result.Count==1) {
- MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading");
- foreach (DbUserConfig cfg in result) {
- this.GridServerURL=cfg.GridServerURL;
- this.GridSendKey=cfg.GridSendKey;
- this.GridRecvKey=cfg.GridRecvKey;
- this.DefaultStartupMsg=cfg.DefaultStartupMsg;
- }
- } else {
- MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
- LoadDefaults();
- MainLog.Instance.Verbose("Writing out default settings to local database");
- db.Set(this);
- db.Close();
- }
- } catch(Exception e) {
- MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
- MainLog.Instance.Warn(e.ToString());
- }
-
- MainLog.Instance.Verbose("User settings loaded:");
- MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg);
- MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL);
- MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey);
- MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey);
- }
-
-
- public void Shutdown() {
- db.Close();
- }
- }
-
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using Db4objects.Db4o;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Interfaces;
+
+namespace OpenUser.Config.UserConfigDb4o
+{
+ public class Db4oConfigPlugin: IUserConfig
+ {
+ public UserConfig GetConfigObject()
+ {
+ MainLog.Instance.Verbose("Loading Db40Config dll");
+ return ( new DbUserConfig());
+ }
+ }
+
+ public class DbUserConfig : UserConfig
+ {
+ private IObjectContainer db;
+
+ public void LoadDefaults() {
+ MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
+
+ this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS");
+
+ this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/");
+ this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null");
+ this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null");
+ }
+
+ public override void InitConfig() {
+ try {
+ db = Db4oFactory.OpenFile("openuser.yap");
+ IObjectSet result = db.Get(typeof(DbUserConfig));
+ if(result.Count==1) {
+ MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading");
+ foreach (DbUserConfig cfg in result) {
+ this.GridServerURL=cfg.GridServerURL;
+ this.GridSendKey=cfg.GridSendKey;
+ this.GridRecvKey=cfg.GridRecvKey;
+ this.DefaultStartupMsg=cfg.DefaultStartupMsg;
+ }
+ } else {
+ MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
+ LoadDefaults();
+ MainLog.Instance.Verbose("Writing out default settings to local database");
+ db.Set(this);
+ db.Close();
+ }
+ } catch(Exception e) {
+ MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
+ MainLog.Instance.Warn(e.ToString());
+ }
+
+ MainLog.Instance.Verbose("User settings loaded:");
+ MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg);
+ MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL);
+ MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey);
+ MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey);
+ }
+
+
+ public void Shutdown() {
+ db.Close();
+ }
+ }
+
+}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index c792918..9bdf8d7 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -1,214 +1,214 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using libsecondlife;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Interfaces;
-using OpenSim.Framework.Servers;
-using OpenSim.Framework.User;
-using OpenSim.Framework.Utilities;
-using OpenSim.GenericConfig;
-
-namespace OpenSim.Grid.UserServer
-{
- ///
- ///
- public class OpenUser_Main : conscmd_callback
- {
- private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll";
- private string StorageDll = "OpenSim.Framework.Data.MySQL.dll";
- private UserConfig Cfg;
- protected IGenericConfig localXMLConfig;
-
- public UserManager m_userManager;
-
- public Dictionary UserSessions = new Dictionary();
-
- LogBase m_console;
-
- [STAThread]
- public static void Main(string[] args)
- {
- Console.WriteLine("Launching UserServer...");
-
- OpenUser_Main userserver = new OpenUser_Main();
-
- userserver.Startup();
- userserver.Work();
- }
-
- private OpenUser_Main()
- {
- m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false);
- MainLog.Instance = m_console;
- }
-
- private void Work()
- {
- m_console.Notice("Enter help for a list of commands\n");
-
- while (true)
- {
- m_console.MainLogPrompt();
- }
- }
-
- public void Startup()
- {
- this.localXMLConfig = new XmlConfig("UserServerConfig.xml");
- this.localXMLConfig.LoadData();
- this.ConfigDB(this.localXMLConfig);
- this.localXMLConfig.Close();
-
- MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration");
- Cfg = this.LoadConfigDll(this.ConfigDll);
- Cfg.InitConfig();
-
- MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection");
- m_userManager = new UserManager();
- m_userManager._config = Cfg;
- m_userManager.AddPlugin(StorageDll);
-
- MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
- BaseHttpServer httpServer = new BaseHttpServer(8002);
-
- httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod);
-
- httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
- httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
-
- httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
-
- httpServer.Start();
- m_console.Status("Userserver 0.3 - Startup complete");
- }
-
-
- public void do_create(string what)
- {
- switch (what)
- {
- case "user":
- string tempfirstname;
- string templastname;
- string tempMD5Passwd;
- uint regX = 1000;
- uint regY = 1000;
-
- tempfirstname = m_console.CmdPrompt("First name");
- templastname = m_console.CmdPrompt("Last name");
- tempMD5Passwd = m_console.PasswdPrompt("Password");
- regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
- regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
-
- tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
-
- m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
- break;
- }
- }
-
- public void RunCmd(string cmd, string[] cmdparams)
- {
- switch (cmd)
- {
- case "help":
- m_console.Notice("create user - create a new user");
- m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
- break;
-
- case "create":
- do_create(cmdparams[0]);
- break;
-
- case "shutdown":
- m_console.Close();
- Environment.Exit(0);
- break;
- }
- }
-
- private void ConfigDB(IGenericConfig configData)
- {
- try
- {
- string attri = "";
- attri = configData.GetAttribute("DataBaseProvider");
- if (attri == "")
- {
- StorageDll = "OpenSim.Framework.Data.DB4o.dll";
- configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
- }
- else
- {
- StorageDll = attri;
- }
- configData.Commit();
- }
- catch
- {
-
- }
- }
-
- private UserConfig LoadConfigDll(string dllName)
- {
- Assembly pluginAssembly = Assembly.LoadFrom(dllName);
- UserConfig config = null;
-
- foreach (Type pluginType in pluginAssembly.GetTypes())
- {
- if (pluginType.IsPublic)
- {
- if (!pluginType.IsAbstract)
- {
- Type typeInterface = pluginType.GetInterface("IUserConfig", true);
-
- if (typeInterface != null)
- {
- IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- config = plug.GetConfigObject();
- break;
- }
-
- typeInterface = null;
- }
- }
- }
- pluginAssembly = null;
- return config;
- }
-
- public void Show(string ShowWhat)
- {
- }
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using libsecondlife;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Servers;
+using OpenSim.Framework.User;
+using OpenSim.Framework.Utilities;
+using OpenSim.GenericConfig;
+
+namespace OpenSim.Grid.UserServer
+{
+ ///
+ ///
+ public class OpenUser_Main : conscmd_callback
+ {
+ private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll";
+ private string StorageDll = "OpenSim.Framework.Data.MySQL.dll";
+ private UserConfig Cfg;
+ protected IGenericConfig localXMLConfig;
+
+ public UserManager m_userManager;
+
+ public Dictionary UserSessions = new Dictionary();
+
+ LogBase m_console;
+
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ Console.WriteLine("Launching UserServer...");
+
+ OpenUser_Main userserver = new OpenUser_Main();
+
+ userserver.Startup();
+ userserver.Work();
+ }
+
+ private OpenUser_Main()
+ {
+ m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false);
+ MainLog.Instance = m_console;
+ }
+
+ private void Work()
+ {
+ m_console.Notice("Enter help for a list of commands\n");
+
+ while (true)
+ {
+ m_console.MainLogPrompt();
+ }
+ }
+
+ public void Startup()
+ {
+ this.localXMLConfig = new XmlConfig("UserServerConfig.xml");
+ this.localXMLConfig.LoadData();
+ this.ConfigDB(this.localXMLConfig);
+ this.localXMLConfig.Close();
+
+ MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration");
+ Cfg = this.LoadConfigDll(this.ConfigDll);
+ Cfg.InitConfig();
+
+ MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection");
+ m_userManager = new UserManager();
+ m_userManager._config = Cfg;
+ m_userManager.AddPlugin(StorageDll);
+
+ MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
+ BaseHttpServer httpServer = new BaseHttpServer(8002);
+
+ httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod);
+
+ httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
+ httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
+
+ httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
+
+ httpServer.Start();
+ m_console.Status("Userserver 0.3 - Startup complete");
+ }
+
+
+ public void do_create(string what)
+ {
+ switch (what)
+ {
+ case "user":
+ string tempfirstname;
+ string templastname;
+ string tempMD5Passwd;
+ uint regX = 1000;
+ uint regY = 1000;
+
+ tempfirstname = m_console.CmdPrompt("First name");
+ templastname = m_console.CmdPrompt("Last name");
+ tempMD5Passwd = m_console.PasswdPrompt("Password");
+ regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
+ regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
+
+ tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
+
+ m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
+ break;
+ }
+ }
+
+ public void RunCmd(string cmd, string[] cmdparams)
+ {
+ switch (cmd)
+ {
+ case "help":
+ m_console.Notice("create user - create a new user");
+ m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
+ break;
+
+ case "create":
+ do_create(cmdparams[0]);
+ break;
+
+ case "shutdown":
+ m_console.Close();
+ Environment.Exit(0);
+ break;
+ }
+ }
+
+ private void ConfigDB(IGenericConfig configData)
+ {
+ try
+ {
+ string attri = "";
+ attri = configData.GetAttribute("DataBaseProvider");
+ if (attri == "")
+ {
+ StorageDll = "OpenSim.Framework.Data.DB4o.dll";
+ configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
+ }
+ else
+ {
+ StorageDll = attri;
+ }
+ configData.Commit();
+ }
+ catch
+ {
+
+ }
+ }
+
+ private UserConfig LoadConfigDll(string dllName)
+ {
+ Assembly pluginAssembly = Assembly.LoadFrom(dllName);
+ UserConfig config = null;
+
+ foreach (Type pluginType in pluginAssembly.GetTypes())
+ {
+ if (pluginType.IsPublic)
+ {
+ if (!pluginType.IsAbstract)
+ {
+ Type typeInterface = pluginType.GetInterface("IUserConfig", true);
+
+ if (typeInterface != null)
+ {
+ IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ config = plug.GetConfigObject();
+ break;
+ }
+
+ typeInterface = null;
+ }
+ }
+ }
+ pluginAssembly = null;
+ return config;
+ }
+
+ public void Show(string ShowWhat)
+ {
+ }
+ }
+}
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
index a0a6f3c..877f02f 100644
--- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
@@ -1,31 +1,31 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OGS-UserServer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("OGS-UserServer")]
-[assembly: AssemblyCopyright("Copyright © 2007")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.InteropServices;
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OGS-UserServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OGS-UserServer")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index f5275e2..bb7d673 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -1,100 +1,100 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections;
-using Nwc.XmlRpc;
-using OpenSim.Framework.Data;
-using OpenSim.Framework.UserManagement;
-using OpenSim.Framework.Utilities;
-
-namespace OpenSim.Grid.UserServer
-{
- public class UserManager : UserManagerBase
- {
- public UserManager()
- {
- }
-
- ///
- /// Customises the login response and fills in missing values.
- ///
- /// The existing response
- /// The user profile
- public override void CustomiseResponse( LoginResponse response, UserProfileData theUser)
- {
- // Load information from the gridserver
- SimProfileData SimInfo = new SimProfileData();
- SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
-
- // Customise the response
- // Home Location
- response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
- "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
- "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
-
- // Destination
- Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
- response.SimAddress = SimInfo.serverIP;
- response.SimPort = (Int32)SimInfo.serverPort;
- response.RegionX = SimInfo.regionLocX;
- response.RegionY = SimInfo.regionLocY;
-
- //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
- string capsPath = Util.GetRandomCapsPath();
- response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
-
- // Notify the target of an incoming user
- Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")");
-
- // Prepare notification
- Hashtable SimParams = new Hashtable();
- SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
- SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
- SimParams["firstname"] = theUser.username;
- SimParams["lastname"] = theUser.surname;
- SimParams["agent_id"] = theUser.UUID.ToString();
- SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
- SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
- SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
- SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
- SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
- SimParams["caps_path"] = capsPath;
- ArrayList SendParams = new ArrayList();
- SendParams.Add(SimParams);
-
- // Update agent with target sim
- theUser.currentAgent.currentRegion = SimInfo.UUID;
- theUser.currentAgent.currentHandle = SimInfo.regionHandle;
-
- System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
- // Send
- XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
- XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000);
- }
- }
-}
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections;
+using Nwc.XmlRpc;
+using OpenSim.Framework.Data;
+using OpenSim.Framework.UserManagement;
+using OpenSim.Framework.Utilities;
+
+namespace OpenSim.Grid.UserServer
+{
+ public class UserManager : UserManagerBase
+ {
+ public UserManager()
+ {
+ }
+
+ ///
+ /// Customises the login response and fills in missing values.
+ ///
+ /// The existing response
+ /// The user profile
+ public override void CustomiseResponse( LoginResponse response, UserProfileData theUser)
+ {
+ // Load information from the gridserver
+ SimProfileData SimInfo = new SimProfileData();
+ SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
+
+ // Customise the response
+ // Home Location
+ response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
+ "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
+ "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
+
+ // Destination
+ Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
+ response.SimAddress = SimInfo.serverIP;
+ response.SimPort = (Int32)SimInfo.serverPort;
+ response.RegionX = SimInfo.regionLocX;
+ response.RegionY = SimInfo.regionLocY;
+
+ //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
+ string capsPath = Util.GetRandomCapsPath();
+ response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
+
+ // Notify the target of an incoming user
+ Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")");
+
+ // Prepare notification
+ Hashtable SimParams = new Hashtable();
+ SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
+ SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
+ SimParams["firstname"] = theUser.username;
+ SimParams["lastname"] = theUser.surname;
+ SimParams["agent_id"] = theUser.UUID.ToString();
+ SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
+ SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
+ SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
+ SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
+ SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
+ SimParams["caps_path"] = capsPath;
+ ArrayList SendParams = new ArrayList();
+ SendParams.Add(SimParams);
+
+ // Update agent with target sim
+ theUser.currentAgent.currentRegion = SimInfo.UUID;
+ theUser.currentAgent.currentHandle = SimInfo.regionHandle;
+
+ System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
+ // Send
+ XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
+ XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000);
+ }
+ }
+}
--
cgit v1.1