aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer.Config/AssemblyInfo.cs112
-rw-r--r--OpenSim/Grid/GridServer.Config/DbGridConfig.cs320
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs1420
-rw-r--r--OpenSim/Grid/GridServer/Main.cs516
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs116
5 files changed, 1242 insertions, 1242 deletions
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 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("GridConfig")] 36[assembly: AssemblyTitle("GridConfig")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("GridConfig")] 40[assembly: AssemblyProduct("GridConfig")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[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 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31using OpenSim.Framework.Interfaces; 31using OpenSim.Framework.Interfaces;
32 32
33namespace OpenGrid.Config.GridConfigDb4o 33namespace OpenGrid.Config.GridConfigDb4o
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// A grid configuration interface for returning the DB4o Config Provider 36 /// A grid configuration interface for returning the DB4o Config Provider
37 /// </summary> 37 /// </summary>
38 public class Db40ConfigPlugin: IGridConfig 38 public class Db40ConfigPlugin: IGridConfig
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// Loads and returns a configuration objeect 41 /// Loads and returns a configuration objeect
42 /// </summary> 42 /// </summary>
43 /// <returns>A grid configuration object</returns> 43 /// <returns>A grid configuration object</returns>
44 public GridConfig GetConfigObject() 44 public GridConfig GetConfigObject()
45 { 45 {
46 MainLog.Instance.Verbose("Loading Db40Config dll"); 46 MainLog.Instance.Verbose("Loading Db40Config dll");
47 return ( new DbGridConfig()); 47 return ( new DbGridConfig());
48 } 48 }
49 } 49 }
50 50
51 /// <summary> 51 /// <summary>
52 /// A DB4o based Gridserver configuration object 52 /// A DB4o based Gridserver configuration object
53 /// </summary> 53 /// </summary>
54 public class DbGridConfig : GridConfig 54 public class DbGridConfig : GridConfig
55 { 55 {
56 /// <summary> 56 /// <summary>
57 /// The DB4o Database 57 /// The DB4o Database
58 /// </summary> 58 /// </summary>
59 private IObjectContainer db; 59 private IObjectContainer db;
60 60
61 /// <summary> 61 /// <summary>
62 /// User configuration for the Grid Config interfaces 62 /// User configuration for the Grid Config interfaces
63 /// </summary> 63 /// </summary>
64 public void LoadDefaults() { 64 public void LoadDefaults() {
65 MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 65 MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
66 66
67 // About the grid options 67 // About the grid options
68 this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); 68 this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team");
69 69
70 // Asset Options 70 // Asset Options
71 this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); 71 this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/");
72 this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); 72 this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null");
73 this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); 73 this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null");
74 74
75 // User Server Options 75 // User Server Options
76 this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); 76 this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/");
77 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); 77 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null");
78 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); 78 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null");
79 79
80 // Region Server Options 80 // Region Server Options
81 this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); 81 this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null");
82 this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); 82 this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null");
83 } 83 }
84 84
85 /// <summary> 85 /// <summary>
86 /// Initialises a new configuration object 86 /// Initialises a new configuration object
87 /// </summary> 87 /// </summary>
88 public override void InitConfig() { 88 public override void InitConfig() {
89 try { 89 try {
90 // Perform Db4o initialisation 90 // Perform Db4o initialisation
91 db = Db4oFactory.OpenFile("opengrid.yap"); 91 db = Db4oFactory.OpenFile("opengrid.yap");
92 92
93 // Locate the grid configuration object 93 // Locate the grid configuration object
94 IObjectSet result = db.Get(typeof(DbGridConfig)); 94 IObjectSet result = db.Get(typeof(DbGridConfig));
95 // Found? 95 // Found?
96 if(result.Count==1) { 96 if(result.Count==1) {
97 MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); 97 MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
98 foreach (DbGridConfig cfg in result) { 98 foreach (DbGridConfig cfg in result) {
99 // Import each setting into this class 99 // Import each setting into this class
100 // Grid Settings 100 // Grid Settings
101 this.GridOwner=cfg.GridOwner; 101 this.GridOwner=cfg.GridOwner;
102 // Asset Settings 102 // Asset Settings
103 this.DefaultAssetServer=cfg.DefaultAssetServer; 103 this.DefaultAssetServer=cfg.DefaultAssetServer;
104 this.AssetSendKey=cfg.AssetSendKey; 104 this.AssetSendKey=cfg.AssetSendKey;
105 this.AssetRecvKey=cfg.AssetRecvKey; 105 this.AssetRecvKey=cfg.AssetRecvKey;
106 // User Settings 106 // User Settings
107 this.DefaultUserServer=cfg.DefaultUserServer; 107 this.DefaultUserServer=cfg.DefaultUserServer;
108 this.UserSendKey=cfg.UserSendKey; 108 this.UserSendKey=cfg.UserSendKey;
109 this.UserRecvKey=cfg.UserRecvKey; 109 this.UserRecvKey=cfg.UserRecvKey;
110 // Region Settings 110 // Region Settings
111 this.SimSendKey=cfg.SimSendKey; 111 this.SimSendKey=cfg.SimSendKey;
112 this.SimRecvKey=cfg.SimRecvKey; 112 this.SimRecvKey=cfg.SimRecvKey;
113 } 113 }
114 // Create a new configuration object from this class 114 // Create a new configuration object from this class
115 } else { 115 } else {
116 MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 116 MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
117 117
118 // Load default settings into this class 118 // Load default settings into this class
119 LoadDefaults(); 119 LoadDefaults();
120 120
121 // Saves to the database file... 121 // Saves to the database file...
122 MainLog.Instance.Verbose( "Writing out default settings to local database"); 122 MainLog.Instance.Verbose( "Writing out default settings to local database");
123 db.Set(this); 123 db.Set(this);
124 124
125 // Closes file locks 125 // Closes file locks
126 db.Close(); 126 db.Close();
127 } 127 }
128 } catch(Exception e) { 128 } catch(Exception e) {
129 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); 129 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
130 MainLog.Instance.Warn(e.ToString()); 130 MainLog.Instance.Warn(e.ToString());
131 } 131 }
132 132
133 // Grid Settings 133 // Grid Settings
134 MainLog.Instance.Verbose("Grid settings loaded:"); 134 MainLog.Instance.Verbose("Grid settings loaded:");
135 MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); 135 MainLog.Instance.Verbose("Grid owner: " + this.GridOwner);
136 136
137 // Asset Settings 137 // Asset Settings
138 MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); 138 MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer);
139 MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); 139 MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey);
140 MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); 140 MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey);
141 141
142 // User Settings 142 // User Settings
143 MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); 143 MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer);
144 MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); 144 MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey);
145 MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); 145 MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey);
146 146
147 // Region Settings 147 // Region Settings
148 MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); 148 MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey);
149 MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); 149 MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey);
150 } 150 }
151 151
152 /// <summary> 152 /// <summary>
153 /// Closes down the database and releases filesystem locks 153 /// Closes down the database and releases filesystem locks
154 /// </summary> 154 /// </summary>
155 public void Shutdown() { 155 public void Shutdown() {
156 db.Close(); 156 db.Close();
157 } 157 }
158 } 158 }
159 159
160} 160}
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 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33using libsecondlife; 33using libsecondlife;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Utilities; 38using OpenSim.Framework.Utilities;
39 39
40namespace OpenSim.Grid.GridServer 40namespace OpenSim.Grid.GridServer
41{ 41{
42 class GridManager 42 class GridManager
43 { 43 {
44 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 44 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
45 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); 45 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
46 46
47 public GridConfig config; 47 public GridConfig config;
48 48
49 /// <summary> 49 /// <summary>
50 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. 50 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
51 /// </summary> 51 /// </summary>
52 /// <param name="FileName">The filename to the grid server plugin DLL</param> 52 /// <param name="FileName">The filename to the grid server plugin DLL</param>
53 public void AddPlugin(string FileName) 53 public void AddPlugin(string FileName)
54 { 54 {
55 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); 55 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName);
56 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 56 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
57 57
58 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 58 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
59 foreach (Type pluginType in pluginAssembly.GetTypes()) 59 foreach (Type pluginType in pluginAssembly.GetTypes())
60 { 60 {
61 if (!pluginType.IsAbstract) 61 if (!pluginType.IsAbstract)
62 { 62 {
63 // Regions go here 63 // Regions go here
64 Type typeInterface = pluginType.GetInterface("IGridData", true); 64 Type typeInterface = pluginType.GetInterface("IGridData", true);
65 65
66 if (typeInterface != null) 66 if (typeInterface != null)
67 { 67 {
68 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
69 plug.Initialise(); 69 plug.Initialise();
70 this._plugins.Add(plug.getName(), plug); 70 this._plugins.Add(plug.getName(), plug);
71 MainLog.Instance.Verbose("Storage: Added IGridData Interface"); 71 MainLog.Instance.Verbose("Storage: Added IGridData Interface");
72 } 72 }
73 73
74 typeInterface = null; 74 typeInterface = null;
75 75
76 // Logs go here 76 // Logs go here
77 typeInterface = pluginType.GetInterface("ILogData", true); 77 typeInterface = pluginType.GetInterface("ILogData", true);
78 78
79 if (typeInterface != null) 79 if (typeInterface != null)
80 { 80 {
81 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 81 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
82 plug.Initialise(); 82 plug.Initialise();
83 this._logplugins.Add(plug.getName(), plug); 83 this._logplugins.Add(plug.getName(), plug);
84 MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); 84 MainLog.Instance.Verbose( "Storage: Added ILogData Interface");
85 } 85 }
86 86
87 typeInterface = null; 87 typeInterface = null;
88 } 88 }
89 } 89 }
90 90
91 pluginAssembly = null; 91 pluginAssembly = null;
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
95 /// Logs a piece of information to the database 95 /// Logs a piece of information to the database
96 /// </summary> 96 /// </summary>
97 /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> 97 /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param>
98 /// <param name="method">Which method is being called?</param> 98 /// <param name="method">Which method is being called?</param>
99 /// <param name="args">What arguments are being passed?</param> 99 /// <param name="args">What arguments are being passed?</param>
100 /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> 100 /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param>
101 /// <param name="message">The message to log</param> 101 /// <param name="message">The message to log</param>
102 private void logToDB(string target, string method, string args, int priority, string message) 102 private void logToDB(string target, string method, string args, int priority, string message)
103 { 103 {
104 foreach (KeyValuePair<string, ILogData> kvp in _logplugins) 104 foreach (KeyValuePair<string, ILogData> kvp in _logplugins)
105 { 105 {
106 try 106 try
107 { 107 {
108 kvp.Value.saveLog("Gridserver", target, method, args, priority, message); 108 kvp.Value.saveLog("Gridserver", target, method, args, priority, message);
109 } 109 }
110 catch (Exception) 110 catch (Exception)
111 { 111 {
112 MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key); 112 MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key);
113 } 113 }
114 } 114 }
115 } 115 }
116 116
117 /// <summary> 117 /// <summary>
118 /// Returns a region by argument 118 /// Returns a region by argument
119 /// </summary> 119 /// </summary>
120 /// <param name="uuid">A UUID key of the region to return</param> 120 /// <param name="uuid">A UUID key of the region to return</param>
121 /// <returns>A SimProfileData for the region</returns> 121 /// <returns>A SimProfileData for the region</returns>
122 public SimProfileData getRegion(LLUUID uuid) 122 public SimProfileData getRegion(LLUUID uuid)
123 { 123 {
124 foreach(KeyValuePair<string,IGridData> kvp in _plugins) { 124 foreach(KeyValuePair<string,IGridData> kvp in _plugins) {
125 try 125 try
126 { 126 {
127 return kvp.Value.GetProfileByLLUUID(uuid); 127 return kvp.Value.GetProfileByLLUUID(uuid);
128 } 128 }
129 catch (Exception e) 129 catch (Exception e)
130 { 130 {
131 MainLog.Instance.Warn("Message from Storage: " + e.Message); 131 MainLog.Instance.Warn("Message from Storage: " + e.Message);
132 } 132 }
133 } 133 }
134 return null; 134 return null;
135 } 135 }
136 136
137 /// <summary> 137 /// <summary>
138 /// Returns a region by argument 138 /// Returns a region by argument
139 /// </summary> 139 /// </summary>
140 /// <param name="uuid">A regionHandle of the region to return</param> 140 /// <param name="uuid">A regionHandle of the region to return</param>
141 /// <returns>A SimProfileData for the region</returns> 141 /// <returns>A SimProfileData for the region</returns>
142 public SimProfileData getRegion(ulong handle) 142 public SimProfileData getRegion(ulong handle)
143 { 143 {
144 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 144 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
145 { 145 {
146 try 146 try
147 { 147 {
148 return kvp.Value.GetProfileByHandle(handle); 148 return kvp.Value.GetProfileByHandle(handle);
149 } 149 }
150 catch 150 catch
151 { 151 {
152 MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); 152 MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
153 } 153 }
154 } 154 }
155 return null; 155 return null;
156 } 156 }
157 157
158 public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) 158 public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
159 { 159 {
160 Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>(); 160 Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>();
161 161
162 SimProfileData[] neighbours; 162 SimProfileData[] neighbours;
163 163
164 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 164 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
165 { 165 {
166 try 166 try
167 { 167 {
168 neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); 168 neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
169 foreach (SimProfileData neighbour in neighbours) 169 foreach (SimProfileData neighbour in neighbours)
170 { 170 {
171 regions[neighbour.regionHandle] = neighbour; 171 regions[neighbour.regionHandle] = neighbour;
172 } 172 }
173 } 173 }
174 catch 174 catch
175 { 175 {
176 MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); 176 MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key);
177 } 177 }
178 } 178 }
179 179
180 return regions; 180 return regions;
181 } 181 }
182 182
183 183
184 184
185 /// <summary> 185 /// <summary>
186 /// Returns a XML String containing a list of the neighbouring regions 186 /// Returns a XML String containing a list of the neighbouring regions
187 /// </summary> 187 /// </summary>
188 /// <param name="reqhandle">The regionhandle for the center sim</param> 188 /// <param name="reqhandle">The regionhandle for the center sim</param>
189 /// <returns>An XML string containing neighbour entities</returns> 189 /// <returns>An XML string containing neighbour entities</returns>
190 public string GetXMLNeighbours(ulong reqhandle) 190 public string GetXMLNeighbours(ulong reqhandle)
191 { 191 {
192 string response = ""; 192 string response = "";
193 SimProfileData central_region = getRegion(reqhandle); 193 SimProfileData central_region = getRegion(reqhandle);
194 SimProfileData neighbour; 194 SimProfileData neighbour;
195 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 195 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
196 { 196 {
197 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) 197 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null)
198 { 198 {
199 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); 199 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256));
200 response += "<neighbour>"; 200 response += "<neighbour>";
201 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 201 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
202 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 202 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
203 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; 203 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
204 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; 204 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
205 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; 205 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
206 response += "</neighbour>"; 206 response += "</neighbour>";
207 207
208 } 208 }
209 } 209 }
210 return response; 210 return response;
211 } 211 }
212 212
213 /// <summary> 213 /// <summary>
214 /// Performed when a region connects to the grid server initially. 214 /// Performed when a region connects to the grid server initially.
215 /// </summary> 215 /// </summary>
216 /// <param name="request">The XMLRPC Request</param> 216 /// <param name="request">The XMLRPC Request</param>
217 /// <returns>Startup parameters</returns> 217 /// <returns>Startup parameters</returns>
218 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) 218 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
219 { 219 {
220 220
221 XmlRpcResponse response = new XmlRpcResponse(); 221 XmlRpcResponse response = new XmlRpcResponse();
222 Hashtable responseData = new Hashtable(); 222 Hashtable responseData = new Hashtable();
223 response.Value = responseData; 223 response.Value = responseData;
224 224
225 SimProfileData TheSim = null; 225 SimProfileData TheSim = null;
226 Hashtable requestData = (Hashtable)request.Params[0]; 226 Hashtable requestData = (Hashtable)request.Params[0];
227 227
228 if (requestData.ContainsKey("UUID")) 228 if (requestData.ContainsKey("UUID"))
229 { 229 {
230 TheSim = getRegion(new LLUUID((string)requestData["UUID"])); 230 TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
231 231
232 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); 232 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
233 } 233 }
234 else if (requestData.ContainsKey("region_handle")) 234 else if (requestData.ContainsKey("region_handle"))
235 { 235 {
236 236
237 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); 237 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
238 logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); 238 logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
239 } 239 }
240 else 240 else
241 { 241 {
242 responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; 242 responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you";
243 return response; 243 return response;
244 } 244 }
245 245
246 if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? 246 if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
247 { 247 {
248 //NEW REGION 248 //NEW REGION
249 TheSim = new SimProfileData(); 249 TheSim = new SimProfileData();
250 250
251 TheSim.regionRecvKey = config.SimRecvKey; 251 TheSim.regionRecvKey = config.SimRecvKey;
252 TheSim.regionSendKey = config.SimSendKey; 252 TheSim.regionSendKey = config.SimSendKey;
253 TheSim.regionSecret = config.SimRecvKey; 253 TheSim.regionSecret = config.SimRecvKey;
254 TheSim.regionDataURI = ""; 254 TheSim.regionDataURI = "";
255 TheSim.regionAssetURI = config.DefaultAssetServer; 255 TheSim.regionAssetURI = config.DefaultAssetServer;
256 TheSim.regionAssetRecvKey = config.AssetRecvKey; 256 TheSim.regionAssetRecvKey = config.AssetRecvKey;
257 TheSim.regionAssetSendKey = config.AssetSendKey; 257 TheSim.regionAssetSendKey = config.AssetSendKey;
258 TheSim.regionUserURI = config.DefaultUserServer; 258 TheSim.regionUserURI = config.DefaultUserServer;
259 TheSim.regionUserSendKey = config.UserSendKey; 259 TheSim.regionUserSendKey = config.UserSendKey;
260 TheSim.regionUserRecvKey = config.UserRecvKey; 260 TheSim.regionUserRecvKey = config.UserRecvKey;
261 261
262 TheSim.serverIP = (string)requestData["sim_ip"]; 262 TheSim.serverIP = (string)requestData["sim_ip"];
263 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); 263 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
264 TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); 264 TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
265 TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); 265 TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
266 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); 266 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
267 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); 267 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
268 TheSim.regionLocZ = 0; 268 TheSim.regionLocZ = 0;
269 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); 269 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
270 270
271 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 271 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
272 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle); 272 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
273 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; 273 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
274 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; 274 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
275 275
276 Console.WriteLine("NEW SIM: " + TheSim.serverURI); 276 Console.WriteLine("NEW SIM: " + TheSim.serverURI);
277 TheSim.regionName = (string)requestData["sim_name"]; 277 TheSim.regionName = (string)requestData["sim_name"];
278 TheSim.UUID = new LLUUID((string)requestData["UUID"]); 278 TheSim.UUID = new LLUUID((string)requestData["UUID"]);
279 279
280 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 280 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
281 { 281 {
282 try 282 try
283 { 283 {
284 DataResponse insertResponse = kvp.Value.AddProfile(TheSim); 284 DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
285 switch(insertResponse) 285 switch(insertResponse)
286 { 286 {
287 case DataResponse.RESPONSE_OK: 287 case DataResponse.RESPONSE_OK:
288 OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName); 288 OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName);
289 break; 289 break;
290 case DataResponse.RESPONSE_ERROR: 290 case DataResponse.RESPONSE_ERROR:
291 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName); 291 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName);
292 break; 292 break;
293 case DataResponse.RESPONSE_INVALIDCREDENTIALS: 293 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
294 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName); 294 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName);
295 break; 295 break;
296 case DataResponse.RESPONSE_AUTHREQUIRED: 296 case DataResponse.RESPONSE_AUTHREQUIRED:
297 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName); 297 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName);
298 break; 298 break;
299 } 299 }
300 300
301 } 301 }
302 catch (Exception e) 302 catch (Exception e)
303 { 303 {
304 OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); 304 OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
305 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); 305 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
306 } 306 }
307 } 307 }
308 308
309 309
310 if (getRegion(TheSim.regionHandle) == null) 310 if (getRegion(TheSim.regionHandle) == null)
311 { 311 {
312 responseData["error"] = "Unable to add new region"; 312 responseData["error"] = "Unable to add new region";
313 return response; 313 return response;
314 } 314 }
315 } 315 }
316 316
317 317
318 ArrayList SimNeighboursData = new ArrayList(); 318 ArrayList SimNeighboursData = new ArrayList();
319 319
320 SimProfileData neighbour; 320 SimProfileData neighbour;
321 Hashtable NeighbourBlock; 321 Hashtable NeighbourBlock;
322 322
323 bool fastMode = false; // Only compatible with MySQL right now 323 bool fastMode = false; // Only compatible with MySQL right now
324 324
325 if (fastMode) 325 if (fastMode)
326 { 326 {
327 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); 327 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
328 328
329 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) 329 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
330 { 330 {
331 NeighbourBlock = new Hashtable(); 331 NeighbourBlock = new Hashtable();
332 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); 332 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
333 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); 333 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
334 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); 334 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
335 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); 335 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
336 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); 336 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
337 337
338 if (aSim.Value.UUID != TheSim.UUID) 338 if (aSim.Value.UUID != TheSim.UUID)
339 SimNeighboursData.Add(NeighbourBlock); 339 SimNeighboursData.Add(NeighbourBlock);
340 } 340 }
341 } 341 }
342 else 342 else
343 { 343 {
344 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 344 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
345 { 345 {
346 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) 346 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
347 { 347 {
348 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); 348 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
349 349
350 NeighbourBlock = new Hashtable(); 350 NeighbourBlock = new Hashtable();
351 NeighbourBlock["sim_ip"] = neighbour.serverIP; 351 NeighbourBlock["sim_ip"] = neighbour.serverIP;
352 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); 352 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
353 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); 353 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
354 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); 354 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
355 NeighbourBlock["UUID"] = neighbour.UUID.ToString(); 355 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
356 356
357 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); 357 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
358 } 358 }
359 } 359 }
360 } 360 }
361 361
362 responseData["UUID"] = TheSim.UUID.ToString(); 362 responseData["UUID"] = TheSim.UUID.ToString();
363 responseData["region_locx"] = TheSim.regionLocX.ToString(); 363 responseData["region_locx"] = TheSim.regionLocX.ToString();
364 responseData["region_locy"] = TheSim.regionLocY.ToString(); 364 responseData["region_locy"] = TheSim.regionLocY.ToString();
365 responseData["regionname"] = TheSim.regionName; 365 responseData["regionname"] = TheSim.regionName;
366 responseData["estate_id"] = "1"; 366 responseData["estate_id"] = "1";
367 responseData["neighbours"] = SimNeighboursData; 367 responseData["neighbours"] = SimNeighboursData;
368 368
369 responseData["sim_ip"] = TheSim.serverIP; 369 responseData["sim_ip"] = TheSim.serverIP;
370 responseData["sim_port"] = TheSim.serverPort.ToString(); 370 responseData["sim_port"] = TheSim.serverPort.ToString();
371 responseData["asset_url"] = TheSim.regionAssetURI; 371 responseData["asset_url"] = TheSim.regionAssetURI;
372 responseData["asset_sendkey"] = TheSim.regionAssetSendKey; 372 responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
373 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; 373 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
374 responseData["user_url"] = TheSim.regionUserURI; 374 responseData["user_url"] = TheSim.regionUserURI;
375 responseData["user_sendkey"] = TheSim.regionUserSendKey; 375 responseData["user_sendkey"] = TheSim.regionUserSendKey;
376 responseData["user_recvkey"] = TheSim.regionUserRecvKey; 376 responseData["user_recvkey"] = TheSim.regionUserRecvKey;
377 responseData["authkey"] = TheSim.regionSecret; 377 responseData["authkey"] = TheSim.regionSecret;
378 378
379 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) 379 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
380 responseData["data_uri"] = TheSim.regionDataURI; 380 responseData["data_uri"] = TheSim.regionDataURI;
381 381
382 382
383 return response; 383 return response;
384 } 384 }
385 385
386 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 386 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
387 { 387 {
388 Hashtable requestData = (Hashtable)request.Params[0]; 388 Hashtable requestData = (Hashtable)request.Params[0];
389 Hashtable responseData = new Hashtable(); 389 Hashtable responseData = new Hashtable();
390 SimProfileData simData = null; 390 SimProfileData simData = null;
391 if (requestData.ContainsKey("region_UUID")) 391 if (requestData.ContainsKey("region_UUID"))
392 { 392 {
393 simData = getRegion(new LLUUID((string)requestData["region_UUID"])); 393 simData = getRegion(new LLUUID((string)requestData["region_UUID"]));
394 } 394 }
395 else if (requestData.ContainsKey("region_handle")) 395 else if (requestData.ContainsKey("region_handle"))
396 { 396 {
397 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); 397 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]);
398 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); 398 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
399 } 399 }
400 400
401 if (simData == null) 401 if (simData == null)
402 { 402 {
403 //Sim does not exist 403 //Sim does not exist
404 Console.WriteLine("region not found"); 404 Console.WriteLine("region not found");
405 responseData["error"] = "Sim does not exist"; 405 responseData["error"] = "Sim does not exist";
406 } 406 }
407 else 407 else
408 { 408 {
409 Console.WriteLine("found region"); 409 Console.WriteLine("found region");
410 responseData["sim_ip"] = simData.serverIP; 410 responseData["sim_ip"] = simData.serverIP;
411 responseData["sim_port"] = simData.serverPort.ToString(); 411 responseData["sim_port"] = simData.serverPort.ToString();
412 responseData["http_port"] = simData.httpPort.ToString(); 412 responseData["http_port"] = simData.httpPort.ToString();
413 responseData["remoting_port"] = simData.remotingPort.ToString(); 413 responseData["remoting_port"] = simData.remotingPort.ToString();
414 responseData["region_locx"] = simData.regionLocX.ToString() ; 414 responseData["region_locx"] = simData.regionLocX.ToString() ;
415 responseData["region_locy"] = simData.regionLocY.ToString(); 415 responseData["region_locy"] = simData.regionLocY.ToString();
416 responseData["region_UUID"] = simData.UUID.UUID.ToString(); 416 responseData["region_UUID"] = simData.UUID.UUID.ToString();
417 responseData["region_name"] = simData.regionName; 417 responseData["region_name"] = simData.regionName;
418 } 418 }
419 419
420 XmlRpcResponse response = new XmlRpcResponse(); 420 XmlRpcResponse response = new XmlRpcResponse();
421 response.Value = responseData; 421 response.Value = responseData;
422 return response; 422 return response;
423 } 423 }
424 424
425 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) 425 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
426 { 426 {
427 int xmin=980, ymin=980, xmax=1020, ymax=1020; 427 int xmin=980, ymin=980, xmax=1020, ymax=1020;
428 428
429 Hashtable requestData = (Hashtable)request.Params[0]; 429 Hashtable requestData = (Hashtable)request.Params[0];
430 if (requestData.ContainsKey("xmin")) 430 if (requestData.ContainsKey("xmin"))
431 { 431 {
432 xmin = (Int32)requestData["xmin"]; 432 xmin = (Int32)requestData["xmin"];
433 } 433 }
434 if (requestData.ContainsKey("ymin")) 434 if (requestData.ContainsKey("ymin"))
435 { 435 {
436 ymin = (Int32)requestData["ymin"]; 436 ymin = (Int32)requestData["ymin"];
437 } 437 }
438 if (requestData.ContainsKey("xmax")) 438 if (requestData.ContainsKey("xmax"))
439 { 439 {
440 xmax = (Int32)requestData["xmax"]; 440 xmax = (Int32)requestData["xmax"];
441 } 441 }
442 if (requestData.ContainsKey("ymax")) 442 if (requestData.ContainsKey("ymax"))
443 { 443 {
444 ymax = (Int32)requestData["ymax"]; 444 ymax = (Int32)requestData["ymax"];
445 } 445 }
446 446
447 XmlRpcResponse response = new XmlRpcResponse(); 447 XmlRpcResponse response = new XmlRpcResponse();
448 Hashtable responseData = new Hashtable(); 448 Hashtable responseData = new Hashtable();
449 response.Value = responseData; 449 response.Value = responseData;
450 IList simProfileList = new ArrayList(); 450 IList simProfileList = new ArrayList();
451 451
452 bool fastMode = false; // MySQL Only 452 bool fastMode = false; // MySQL Only
453 453
454 if (fastMode) 454 if (fastMode)
455 { 455 {
456 Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); 456 Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
457 457
458 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) 458 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
459 { 459 {
460 Hashtable simProfileBlock = new Hashtable(); 460 Hashtable simProfileBlock = new Hashtable();
461 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 461 simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
462 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 462 simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
463 System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); 463 System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString());
464 simProfileBlock["name"] = aSim.Value.regionName; 464 simProfileBlock["name"] = aSim.Value.regionName;
465 simProfileBlock["access"] = 21; 465 simProfileBlock["access"] = 21;
466 simProfileBlock["region-flags"] = 512; 466 simProfileBlock["region-flags"] = 512;
467 simProfileBlock["water-height"] = 0; 467 simProfileBlock["water-height"] = 0;
468 simProfileBlock["agents"] = 1; 468 simProfileBlock["agents"] = 1;
469 simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); 469 simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString();
470 470
471 // For Sugilite compatibility 471 // For Sugilite compatibility
472 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); 472 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
473 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); 473 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
474 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); 474 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
475 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); 475 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
476 simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated(); 476 simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated();
477 477
478 simProfileList.Add(simProfileBlock); 478 simProfileList.Add(simProfileBlock);
479 } 479 }
480 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); 480 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode");
481 } 481 }
482 else 482 else
483 { 483 {
484 SimProfileData simProfile; 484 SimProfileData simProfile;
485 for (int x = xmin; x < xmax+1; x++) 485 for (int x = xmin; x < xmax+1; x++)
486 { 486 {
487 for (int y = ymin; y < ymax+1; y++) 487 for (int y = ymin; y < ymax+1; y++)
488 { 488 {
489 ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); 489 ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256));
490 simProfile = getRegion(regHandle); 490 simProfile = getRegion(regHandle);
491 if (simProfile != null) 491 if (simProfile != null)
492 { 492 {
493 Hashtable simProfileBlock = new Hashtable(); 493 Hashtable simProfileBlock = new Hashtable();
494 simProfileBlock["x"] = x; 494 simProfileBlock["x"] = x;
495 simProfileBlock["y"] = y; 495 simProfileBlock["y"] = y;
496 simProfileBlock["name"] = simProfile.regionName; 496 simProfileBlock["name"] = simProfile.regionName;
497 simProfileBlock["access"] = 0; 497 simProfileBlock["access"] = 0;
498 simProfileBlock["region-flags"] = 0; 498 simProfileBlock["region-flags"] = 0;
499 simProfileBlock["water-height"] = 20; 499 simProfileBlock["water-height"] = 20;
500 simProfileBlock["agents"] = 1; 500 simProfileBlock["agents"] = 1;
501 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated(); 501 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated();
502 502
503 // For Sugilite compatibility 503 // For Sugilite compatibility
504 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); 504 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
505 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); 505 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
506 simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); 506 simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
507 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); 507 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
508 simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated(); 508 simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated();
509 509
510 simProfileList.Add(simProfileBlock); 510 simProfileList.Add(simProfileBlock);
511 } 511 }
512 } 512 }
513 } 513 }
514 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); 514 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode");
515 } 515 }
516 516
517 responseData["sim-profiles"] = simProfileList; 517 responseData["sim-profiles"] = simProfileList;
518 518
519 return response; 519 return response;
520 } 520 }
521 521
522 522
523 523
524 /// <summary> 524 /// <summary>
525 /// Performs a REST Get Operation 525 /// Performs a REST Get Operation
526 /// </summary> 526 /// </summary>
527 /// <param name="request"></param> 527 /// <param name="request"></param>
528 /// <param name="path"></param> 528 /// <param name="path"></param>
529 /// <param name="param"></param> 529 /// <param name="param"></param>
530 /// <returns></returns> 530 /// <returns></returns>
531 public string RestGetRegionMethod(string request, string path, string param) 531 public string RestGetRegionMethod(string request, string path, string param)
532 { 532 {
533 return RestGetSimMethod("", "/sims/", param); 533 return RestGetSimMethod("", "/sims/", param);
534 } 534 }
535 535
536 /// <summary> 536 /// <summary>
537 /// Performs a REST Set Operation 537 /// Performs a REST Set Operation
538 /// </summary> 538 /// </summary>
539 /// <param name="request"></param> 539 /// <param name="request"></param>
540 /// <param name="path"></param> 540 /// <param name="path"></param>
541 /// <param name="param"></param> 541 /// <param name="param"></param>
542 /// <returns></returns> 542 /// <returns></returns>
543 public string RestSetRegionMethod(string request, string path, string param) 543 public string RestSetRegionMethod(string request, string path, string param)
544 { 544 {
545 return RestSetSimMethod("", "/sims/", param); 545 return RestSetSimMethod("", "/sims/", param);
546 } 546 }
547 547
548 /// <summary> 548 /// <summary>
549 /// Returns information about a sim via a REST Request 549 /// Returns information about a sim via a REST Request
550 /// </summary> 550 /// </summary>
551 /// <param name="request"></param> 551 /// <param name="request"></param>
552 /// <param name="path"></param> 552 /// <param name="path"></param>
553 /// <param name="param"></param> 553 /// <param name="param"></param>
554 /// <returns>Information about the sim in XML</returns> 554 /// <returns>Information about the sim in XML</returns>
555 public string RestGetSimMethod(string request, string path, string param) 555 public string RestGetSimMethod(string request, string path, string param)
556 { 556 {
557 string respstring = String.Empty; 557 string respstring = String.Empty;
558 558
559 SimProfileData TheSim; 559 SimProfileData TheSim;
560 LLUUID UUID = new LLUUID(param); 560 LLUUID UUID = new LLUUID(param);
561 TheSim = getRegion(UUID); 561 TheSim = getRegion(UUID);
562 562
563 if (!(TheSim == null)) 563 if (!(TheSim == null))
564 { 564 {
565 respstring = "<Root>"; 565 respstring = "<Root>";
566 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; 566 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
567 respstring += "<sim>"; 567 respstring += "<sim>";
568 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; 568 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
569 respstring += "<regionname>" + TheSim.regionName + "</regionname>"; 569 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
570 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; 570 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>";
571 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; 571 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
572 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; 572 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
573 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; 573 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
574 respstring += "<estate_id>1</estate_id>"; 574 respstring += "<estate_id>1</estate_id>";
575 respstring += "</sim>"; 575 respstring += "</sim>";
576 respstring += "</Root>"; 576 respstring += "</Root>";
577 } 577 }
578 578
579 return respstring; 579 return respstring;
580 } 580 }
581 581
582 /// <summary> 582 /// <summary>
583 /// Creates or updates a sim via a REST Method Request 583 /// Creates or updates a sim via a REST Method Request
584 /// BROKEN with SQL Update 584 /// BROKEN with SQL Update
585 /// </summary> 585 /// </summary>
586 /// <param name="request"></param> 586 /// <param name="request"></param>
587 /// <param name="path"></param> 587 /// <param name="path"></param>
588 /// <param name="param"></param> 588 /// <param name="param"></param>
589 /// <returns>"OK" or an error</returns> 589 /// <returns>"OK" or an error</returns>
590 public string RestSetSimMethod(string request, string path, string param) 590 public string RestSetSimMethod(string request, string path, string param)
591 { 591 {
592 Console.WriteLine("Processing region update via REST method"); 592 Console.WriteLine("Processing region update via REST method");
593 SimProfileData TheSim; 593 SimProfileData TheSim;
594 TheSim = getRegion(new LLUUID(param)); 594 TheSim = getRegion(new LLUUID(param));
595 if ((TheSim) == null) 595 if ((TheSim) == null)
596 { 596 {
597 TheSim = new SimProfileData(); 597 TheSim = new SimProfileData();
598 LLUUID UUID = new LLUUID(param); 598 LLUUID UUID = new LLUUID(param);
599 TheSim.UUID = UUID; 599 TheSim.UUID = UUID;
600 TheSim.regionRecvKey = config.SimRecvKey; 600 TheSim.regionRecvKey = config.SimRecvKey;
601 } 601 }
602 602
603 XmlDocument doc = new XmlDocument(); 603 XmlDocument doc = new XmlDocument();
604 doc.LoadXml(request); 604 doc.LoadXml(request);
605 XmlNode rootnode = doc.FirstChild; 605 XmlNode rootnode = doc.FirstChild;
606 XmlNode authkeynode = rootnode.ChildNodes[0]; 606 XmlNode authkeynode = rootnode.ChildNodes[0];
607 if (authkeynode.Name != "authkey") 607 if (authkeynode.Name != "authkey")
608 { 608 {
609 return "ERROR! bad XML - expected authkey tag"; 609 return "ERROR! bad XML - expected authkey tag";
610 } 610 }
611 611
612 XmlNode simnode = rootnode.ChildNodes[1]; 612 XmlNode simnode = rootnode.ChildNodes[1];
613 if (simnode.Name != "sim") 613 if (simnode.Name != "sim")
614 { 614 {
615 return "ERROR! bad XML - expected sim tag"; 615 return "ERROR! bad XML - expected sim tag";
616 } 616 }
617 617
618 //TheSim.regionSendKey = Cfg; 618 //TheSim.regionSendKey = Cfg;
619 TheSim.regionRecvKey = config.SimRecvKey; 619 TheSim.regionRecvKey = config.SimRecvKey;
620 TheSim.regionSendKey = config.SimSendKey; 620 TheSim.regionSendKey = config.SimSendKey;
621 TheSim.regionSecret = config.SimRecvKey; 621 TheSim.regionSecret = config.SimRecvKey;
622 TheSim.regionDataURI = ""; 622 TheSim.regionDataURI = "";
623 TheSim.regionAssetURI = config.DefaultAssetServer; 623 TheSim.regionAssetURI = config.DefaultAssetServer;
624 TheSim.regionAssetRecvKey = config.AssetRecvKey; 624 TheSim.regionAssetRecvKey = config.AssetRecvKey;
625 TheSim.regionAssetSendKey = config.AssetSendKey; 625 TheSim.regionAssetSendKey = config.AssetSendKey;
626 TheSim.regionUserURI = config.DefaultUserServer; 626 TheSim.regionUserURI = config.DefaultUserServer;
627 TheSim.regionUserSendKey = config.UserSendKey; 627 TheSim.regionUserSendKey = config.UserSendKey;
628 TheSim.regionUserRecvKey = config.UserRecvKey; 628 TheSim.regionUserRecvKey = config.UserRecvKey;
629 629
630 630
631 for (int i = 0; i < simnode.ChildNodes.Count; i++) 631 for (int i = 0; i < simnode.ChildNodes.Count; i++)
632 { 632 {
633 switch (simnode.ChildNodes[i].Name) 633 switch (simnode.ChildNodes[i].Name)
634 { 634 {
635 case "regionname": 635 case "regionname":
636 TheSim.regionName = simnode.ChildNodes[i].InnerText; 636 TheSim.regionName = simnode.ChildNodes[i].InnerText;
637 break; 637 break;
638 638
639 case "sim_ip": 639 case "sim_ip":
640 TheSim.serverIP = simnode.ChildNodes[i].InnerText; 640 TheSim.serverIP = simnode.ChildNodes[i].InnerText;
641 break; 641 break;
642 642
643 case "sim_port": 643 case "sim_port":
644 TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); 644 TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
645 break; 645 break;
646 646
647 case "region_locx": 647 case "region_locx":
648 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 648 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
649 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 649 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
650 break; 650 break;
651 651
652 case "region_locy": 652 case "region_locy":
653 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 653 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
654 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 654 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
655 break; 655 break;
656 } 656 }
657 } 657 }
658 658
659 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; 659 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
660 660
661 bool requirePublic = false; 661 bool requirePublic = false;
662 bool requireValid = true; 662 bool requireValid = true;
663 663
664 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) 664 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
665 { 665 {
666 return "ERROR! Servers must register with public addresses."; 666 return "ERROR! Servers must register with public addresses.";
667 } 667 }
668 668
669 if (requireValid && (TheSim.serverIP.StartsWith("0."))) 669 if (requireValid && (TheSim.serverIP.StartsWith("0.")))
670 { 670 {
671 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; 671 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
672 } 672 }
673 673
674 674
675 try 675 try
676 { 676 {
677 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); 677 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
678 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 678 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
679 { 679 {
680 try 680 try
681 { 681 {
682 //Check reservations 682 //Check reservations
683 ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); 683 ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY);
684 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) 684 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
685 { 685 {
686 kvp.Value.AddProfile(TheSim); 686 kvp.Value.AddProfile(TheSim);
687 MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); 687 MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")");
688 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); 688 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid.");
689 } 689 }
690 else 690 else
691 { 691 {
692 MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); 692 MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
693 return "Unable to update region (RestSetSimMethod): Incorrect auth key."; 693 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
694 } 694 }
695 } 695 }
696 catch (Exception e) 696 catch (Exception e)
697 { 697 {
698 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); 698 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString());
699 } 699 }
700 } 700 }
701 return "OK"; 701 return "OK";
702 } 702 }
703 catch (Exception e) 703 catch (Exception e)
704 { 704 {
705 return "ERROR! Could not save to database! (" + e.ToString() + ")"; 705 return "ERROR! Could not save to database! (" + e.ToString() + ")";
706 } 706 }
707 } 707 }
708 708
709 } 709 }
710} 710}
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 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using System.Timers; 32using System.Timers;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.GenericConfig; 36using OpenSim.GenericConfig;
37using Timer=System.Timers.Timer; 37using Timer=System.Timers.Timer;
38 38
39namespace OpenSim.Grid.GridServer 39namespace OpenSim.Grid.GridServer
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// </summary> 42 /// </summary>
43 public class OpenGrid_Main : conscmd_callback 43 public class OpenGrid_Main : conscmd_callback
44 { 44 {
45 private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll"; 45 private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll";
46 private string GridDll = "OpenSim.Framework.Data.MySQL.dll"; 46 private string GridDll = "OpenSim.Framework.Data.MySQL.dll";
47 public GridConfig Cfg; 47 public GridConfig Cfg;
48 48
49 public static OpenGrid_Main thegrid; 49 public static OpenGrid_Main thegrid;
50 protected IGenericConfig localXMLConfig; 50 protected IGenericConfig localXMLConfig;
51 51
52 public static bool setuponly; 52 public static bool setuponly;
53 53
54 //public LLUUID highestUUID; 54 //public LLUUID highestUUID;
55 55
56 // private SimProfileManager m_simProfileManager; 56 // private SimProfileManager m_simProfileManager;
57 57
58 private GridManager m_gridManager; 58 private GridManager m_gridManager;
59 59
60 private LogBase m_console; 60 private LogBase m_console;
61 61
62 [STAThread] 62 [STAThread]
63 public static void Main(string[] args) 63 public static void Main(string[] args)
64 { 64 {
65 if (args.Length > 0) 65 if (args.Length > 0)
66 { 66 {
67 if (args[0] == "-setuponly") setuponly = true; 67 if (args[0] == "-setuponly") setuponly = true;
68 } 68 }
69 Console.WriteLine("Starting...\n"); 69 Console.WriteLine("Starting...\n");
70 70
71 thegrid = new OpenGrid_Main(); 71 thegrid = new OpenGrid_Main();
72 thegrid.Startup(); 72 thegrid.Startup();
73 73
74 thegrid.Work(); 74 thegrid.Work();
75 } 75 }
76 76
77 private void Work() 77 private void Work()
78 { 78 {
79 m_console.Notice("Enter help for a list of commands\n"); 79 m_console.Notice("Enter help for a list of commands\n");
80 80
81 while (true) 81 while (true)
82 { 82 {
83 m_console.MainLogPrompt(); 83 m_console.MainLogPrompt();
84 } 84 }
85 } 85 }
86 86
87 private OpenGrid_Main() 87 private OpenGrid_Main()
88 { 88 {
89 m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); 89 m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
90 MainLog.Instance = m_console; 90 MainLog.Instance = m_console;
91 91
92 92
93 } 93 }
94 94
95 public void managercallback(string cmd) 95 public void managercallback(string cmd)
96 { 96 {
97 switch (cmd) 97 switch (cmd)
98 { 98 {
99 case "shutdown": 99 case "shutdown":
100 RunCmd("shutdown", new string[0]); 100 RunCmd("shutdown", new string[0]);
101 break; 101 break;
102 } 102 }
103 } 103 }
104 104
105 105
106 public void Startup() 106 public void Startup()
107 { 107 {
108 this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); 108 this.localXMLConfig = new XmlConfig("GridServerConfig.xml");
109 this.localXMLConfig.LoadData(); 109 this.localXMLConfig.LoadData();
110 this.ConfigDB(this.localXMLConfig); 110 this.ConfigDB(this.localXMLConfig);
111 this.localXMLConfig.Close(); 111 this.localXMLConfig.Close();
112 112
113 m_console.Verbose( "Main.cs:Startup() - Loading configuration"); 113 m_console.Verbose( "Main.cs:Startup() - Loading configuration");
114 Cfg = this.LoadConfigDll(this.ConfigDll); 114 Cfg = this.LoadConfigDll(this.ConfigDll);
115 Cfg.InitConfig(); 115 Cfg.InitConfig();
116 if (setuponly) Environment.Exit(0); 116 if (setuponly) Environment.Exit(0);
117 117
118 m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); 118 m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server");
119 m_gridManager = new GridManager(); 119 m_gridManager = new GridManager();
120 m_gridManager.AddPlugin(GridDll); // Made of win 120 m_gridManager.AddPlugin(GridDll); // Made of win
121 m_gridManager.config = Cfg; 121 m_gridManager.config = Cfg;
122 122
123 m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); 123 m_console.Verbose( "Main.cs:Startup() - Starting HTTP process");
124 BaseHttpServer httpServer = new BaseHttpServer(8001); 124 BaseHttpServer httpServer = new BaseHttpServer(8001);
125 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 125 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
126 126
127 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); 127 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
128 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); 128 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod);
129 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); 129 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
130 130
131 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); 131 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod ));
132 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); 132 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod ));
133 133
134 httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); 134 httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod ));
135 httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); 135 httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod ));
136 136
137 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); 137 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
138 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); 138 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
139 //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); 139 //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
140 //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); 140 //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
141 141
142 httpServer.Start(); 142 httpServer.Start();
143 143
144 m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); 144 m_console.Verbose( "Main.cs:Startup() - Starting sim status checker");
145 145
146 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 146 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
147 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 147 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
148 simCheckTimer.Enabled = true; 148 simCheckTimer.Enabled = true;
149 } 149 }
150 150
151 private GridConfig LoadConfigDll(string dllName) 151 private GridConfig LoadConfigDll(string dllName)
152 { 152 {
153 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 153 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
154 GridConfig config = null; 154 GridConfig config = null;
155 155
156 foreach (Type pluginType in pluginAssembly.GetTypes()) 156 foreach (Type pluginType in pluginAssembly.GetTypes())
157 { 157 {
158 if (pluginType.IsPublic) 158 if (pluginType.IsPublic)
159 { 159 {
160 if (!pluginType.IsAbstract) 160 if (!pluginType.IsAbstract)
161 { 161 {
162 Type typeInterface = pluginType.GetInterface("IGridConfig", true); 162 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
163 163
164 if (typeInterface != null) 164 if (typeInterface != null)
165 { 165 {
166 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 166 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
167 config = plug.GetConfigObject(); 167 config = plug.GetConfigObject();
168 break; 168 break;
169 } 169 }
170 170
171 typeInterface = null; 171 typeInterface = null;
172 } 172 }
173 } 173 }
174 } 174 }
175 pluginAssembly = null; 175 pluginAssembly = null;
176 return config; 176 return config;
177 } 177 }
178 178
179 public void CheckSims(object sender, ElapsedEventArgs e) 179 public void CheckSims(object sender, ElapsedEventArgs e)
180 { 180 {
181 /* 181 /*
182 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) 182 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
183 { 183 {
184 string SimResponse = ""; 184 string SimResponse = "";
185 try 185 try
186 { 186 {
187 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); 187 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
188 CheckSim.Method = "GET"; 188 CheckSim.Method = "GET";
189 CheckSim.ContentType = "text/plaintext"; 189 CheckSim.ContentType = "text/plaintext";
190 CheckSim.ContentLength = 0; 190 CheckSim.ContentLength = 0;
191 191
192 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); 192 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
193 stOut.Write(""); 193 stOut.Write("");
194 stOut.Close(); 194 stOut.Close();
195 195
196 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); 196 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
197 SimResponse = stIn.ReadToEnd(); 197 SimResponse = stIn.ReadToEnd();
198 stIn.Close(); 198 stIn.Close();
199 } 199 }
200 catch 200 catch
201 { 201 {
202 } 202 }
203 203
204 if (SimResponse == "OK") 204 if (SimResponse == "OK")
205 { 205 {
206 m_simProfileManager.SimProfiles[sim.UUID].online = true; 206 m_simProfileManager.SimProfiles[sim.UUID].online = true;
207 } 207 }
208 else 208 else
209 { 209 {
210 m_simProfileManager.SimProfiles[sim.UUID].online = false; 210 m_simProfileManager.SimProfiles[sim.UUID].online = false;
211 } 211 }
212 } 212 }
213 */ 213 */
214 } 214 }
215 215
216 public void RunCmd(string cmd, string[] cmdparams) 216 public void RunCmd(string cmd, string[] cmdparams)
217 { 217 {
218 switch (cmd) 218 switch (cmd)
219 { 219 {
220 case "help": 220 case "help":
221 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); 221 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
222 break; 222 break;
223 223
224 case "shutdown": 224 case "shutdown":
225 m_console.Close(); 225 m_console.Close();
226 Environment.Exit(0); 226 Environment.Exit(0);
227 break; 227 break;
228 } 228 }
229 } 229 }
230 230
231 public void Show(string ShowWhat) 231 public void Show(string ShowWhat)
232 { 232 {
233 } 233 }
234 234
235 private void ConfigDB(IGenericConfig configData) 235 private void ConfigDB(IGenericConfig configData)
236 { 236 {
237 try 237 try
238 { 238 {
239 string attri = ""; 239 string attri = "";
240 attri = configData.GetAttribute("DataBaseProvider"); 240 attri = configData.GetAttribute("DataBaseProvider");
241 if (attri == "") 241 if (attri == "")
242 { 242 {
243 GridDll = "OpenSim.Framework.Data.DB4o.dll"; 243 GridDll = "OpenSim.Framework.Data.DB4o.dll";
244 configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); 244 configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
245 } 245 }
246 else 246 else
247 { 247 {
248 GridDll = attri; 248 GridDll = attri;
249 } 249 }
250 configData.Commit(); 250 configData.Commit();
251 } 251 }
252 catch 252 catch
253 { 253 {
254 254
255 } 255 }
256 } 256 }
257 } 257 }
258} 258}
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 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OGS-GridServer")] 33[assembly: AssemblyTitle("OGS-GridServer")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OGS-GridServer")] 37[assembly: AssemblyProduct("OGS-GridServer")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57[assembly: AssemblyVersion("1.0.0.0")] 57[assembly: AssemblyVersion("1.0.0.0")]
58[assembly: AssemblyFileVersion("1.0.0.0")] 58[assembly: AssemblyFileVersion("1.0.0.0")]