Beginning of rewriting HG. Compiles, and runs, but HG functions not restored yet.
parent
ee1fb81376
commit
04e29c1bac
|
@ -1154,7 +1154,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Object Crossings
|
#region Object Transfers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
||||||
/// into.
|
/// into.
|
||||||
|
|
|
@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Server.Handlers.Base;
|
using OpenSim.Server.Handlers.Base;
|
||||||
using OpenSim.Server.Handlers.Grid;
|
using OpenSim.Server.Handlers.Hypergrid;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||||
|
|
||||||
private IConfigSource m_Config;
|
private IConfigSource m_Config;
|
||||||
bool m_Registered = false;
|
bool m_Registered = false;
|
||||||
HypergridServiceInConnector m_HypergridHandler;
|
GatekeeperServiceInConnector m_HypergridHandler;
|
||||||
|
|
||||||
#region IRegionModule interface
|
#region IRegionModule interface
|
||||||
|
|
||||||
|
@ -102,9 +102,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||||
{
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GridRegion rinfo = new GridRegion(scene.RegionInfo);
|
|
||||||
m_HypergridHandler.RemoveRegion(rinfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
@ -119,13 +116,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||||
m_log.Info("[HypergridService]: Starting...");
|
m_log.Info("[HypergridService]: Starting...");
|
||||||
|
|
||||||
// Object[] args = new Object[] { m_Config, MainServer.Instance };
|
// Object[] args = new Object[] { m_Config, MainServer.Instance };
|
||||||
|
ISimulationService simService = scene.RequestModuleInterface<ISimulationService>();
|
||||||
m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance, scene.RequestModuleInterface<IHyperlinkService>());
|
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
|
||||||
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
GridRegion rinfo = new GridRegion(scene.RegionInfo);
|
|
||||||
m_HypergridHandler.AddRegion(rinfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -49,12 +49,11 @@ using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
{
|
{
|
||||||
public class HGGridConnector : ISharedRegionModule, IGridService, IHyperlinkService
|
public class HGGridConnector : ISharedRegionModule, IGridService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private static string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
|
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
private bool m_Initialized = false;
|
private bool m_Initialized = false;
|
||||||
|
@ -63,18 +62,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
|
private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
|
||||||
|
|
||||||
private IGridService m_GridServiceConnector;
|
private IGridService m_GridServiceConnector;
|
||||||
private HypergridServiceConnector m_HypergridServiceConnector;
|
private IHypergridService m_HypergridService;
|
||||||
|
|
||||||
// Hyperlink regions are hyperlinks on the map
|
|
||||||
protected Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
|
|
||||||
|
|
||||||
// Known regions are home regions of visiting foreign users.
|
|
||||||
// They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when
|
|
||||||
// the visitor goes away. They are mapped to X=0 on the map.
|
|
||||||
// This is key-ed on agent ID
|
|
||||||
protected Dictionary<UUID, GridRegion> m_knownRegions = new Dictionary<UUID, GridRegion>();
|
|
||||||
|
|
||||||
protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>();
|
|
||||||
|
|
||||||
#region ISharedRegionModule
|
#region ISharedRegionModule
|
||||||
|
|
||||||
|
@ -125,13 +114,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (module == String.Empty)
|
if (module == String.Empty)
|
||||||
{
|
{
|
||||||
m_log.Error("[HGGRID CONNECTOR]: No GridServiceConnectorModule named in section GridService");
|
m_log.Error("[HGGRID CONNECTOR]: No GridServiceConnectorModule named in section GridService");
|
||||||
//return;
|
|
||||||
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] args = new Object[] { source };
|
Object[] args = new Object[] { source };
|
||||||
m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args);
|
m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args);
|
||||||
|
|
||||||
|
string hypergrid = gridConfig.GetString("HypergridService", string.Empty);
|
||||||
|
if (hypergrid == String.Empty)
|
||||||
|
{
|
||||||
|
m_log.Error("[HGGRID CONNECTOR]: No HypergridService named in section GridService");
|
||||||
|
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
||||||
|
}
|
||||||
|
m_HypergridService = ServerUtils.LoadPlugin<IHypergridService>(hypergrid, args);
|
||||||
|
|
||||||
|
if (m_GridServiceConnector == null || m_HypergridService == null)
|
||||||
|
throw new Exception("Unable to proceed. HGGrid services could not be loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -151,7 +149,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
|
m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
|
||||||
scene.RegisterModuleInterface<IGridService>(this);
|
scene.RegisterModuleInterface<IGridService>(this);
|
||||||
scene.RegisterModuleInterface<IHyperlinkService>(this);
|
|
||||||
|
|
||||||
((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
|
((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
|
||||||
|
|
||||||
|
@ -175,18 +172,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
{
|
{
|
||||||
m_aScene = scene;
|
m_aScene = scene;
|
||||||
|
|
||||||
m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
|
|
||||||
|
|
||||||
HGCommands hgCommands = new HGCommands(this, scene);
|
|
||||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region",
|
|
||||||
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
|
||||||
"Link a hypergrid region", hgCommands.RunCommand);
|
|
||||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlink-region",
|
|
||||||
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
|
||||||
"Unlink a hypergrid region", hgCommands.RunCommand);
|
|
||||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
|
|
||||||
"Set local coordinate to map HG regions to", hgCommands.RunCommand);
|
|
||||||
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,50 +182,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
||||||
{
|
{
|
||||||
// Region doesn't exist here. Trying to link remote region
|
return m_GridServiceConnector.RegisterRegion(scopeID, regionInfo);
|
||||||
if (regionInfo.RegionID.Equals(UUID.Zero))
|
|
||||||
{
|
|
||||||
m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort);
|
|
||||||
ulong regionHandle = 0;
|
|
||||||
regionInfo.RegionID = m_HypergridServiceConnector.LinkRegion(regionInfo, out regionHandle);
|
|
||||||
if (!regionInfo.RegionID.Equals(UUID.Zero))
|
|
||||||
{
|
|
||||||
AddHyperlinkRegion(regionInfo, regionHandle);
|
|
||||||
m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID);
|
|
||||||
|
|
||||||
// Try get the map image
|
|
||||||
m_HypergridServiceConnector.GetMapImage(regionInfo);
|
|
||||||
return String.Empty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")");
|
|
||||||
return "No such region";
|
|
||||||
}
|
|
||||||
// Note that these remote regions aren't registered in localBackend, so return null, no local listeners
|
|
||||||
}
|
|
||||||
else // normal grid
|
|
||||||
return m_GridServiceConnector.RegisterRegion(scopeID, regionInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeregisterRegion(UUID regionID)
|
public bool DeregisterRegion(UUID regionID)
|
||||||
{
|
{
|
||||||
// Try the hyperlink collection
|
|
||||||
if (m_HyperlinkRegions.ContainsKey(regionID))
|
|
||||||
{
|
|
||||||
RemoveHyperlinkRegion(regionID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Try the foreign users home collection
|
|
||||||
|
|
||||||
foreach (GridRegion r in m_knownRegions.Values)
|
|
||||||
if (r.RegionID == regionID)
|
|
||||||
{
|
|
||||||
RemoveHyperlinkHomeRegion(regionID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, try the normal route
|
|
||||||
return m_GridServiceConnector.DeregisterRegion(regionID);
|
return m_GridServiceConnector.DeregisterRegion(regionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,41 +199,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
|
public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
|
||||||
{
|
{
|
||||||
// Try the hyperlink collection
|
GridRegion region = m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
||||||
if (m_HyperlinkRegions.ContainsKey(regionID))
|
if (region != null)
|
||||||
return m_HyperlinkRegions[regionID];
|
return region;
|
||||||
|
|
||||||
// Try the foreign users home collection
|
|
||||||
foreach (GridRegion r in m_knownRegions.Values)
|
|
||||||
if (r.RegionID == regionID)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
// Finally, try the normal route
|
region = m_HypergridService.GetRegionByUUID(regionID);
|
||||||
return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
|
||||||
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
|
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
|
||||||
{
|
{
|
||||||
int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize;
|
int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||||
int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize;
|
int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||||
// Try the hyperlink collection
|
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
{
|
|
||||||
if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the foreign users home collection
|
GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y);
|
||||||
foreach (GridRegion r in m_knownRegions.Values)
|
if (region != null)
|
||||||
{
|
return region;
|
||||||
if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
|
|
||||||
{
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, try the normal route
|
region = m_HypergridService.GetRegionByPosition(snapX, snapY);
|
||||||
return m_GridServiceConnector.GetRegionByPosition(scopeID, x, y);
|
|
||||||
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridRegion GetRegionByName(UUID scopeID, string regionName)
|
public GridRegion GetRegionByName(UUID scopeID, string regionName)
|
||||||
|
@ -297,551 +229,55 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (region != null)
|
if (region != null)
|
||||||
return region;
|
return region;
|
||||||
|
|
||||||
// Try the hyperlink collection
|
region = m_HypergridService.GetRegionByName(regionName);
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
{
|
|
||||||
if (r.RegionName == regionName)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the foreign users home collection
|
return region;
|
||||||
foreach (GridRegion r in m_knownRegions.Values)
|
|
||||||
{
|
|
||||||
if (r.RegionName == regionName)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
|
public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
|
||||||
{
|
{
|
||||||
List<GridRegion> rinfos = new List<GridRegion>();
|
|
||||||
|
|
||||||
if (name == string.Empty)
|
if (name == string.Empty)
|
||||||
return rinfos;
|
return new List<GridRegion>();
|
||||||
|
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
List<GridRegion> rinfos = m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber);
|
||||||
if ((r.RegionName != null) && r.RegionName.ToLower().StartsWith(name.ToLower()))
|
|
||||||
rinfos.Add(r);
|
rinfos.AddRange(m_HypergridService.GetRegionsByName(name));
|
||||||
|
if (rinfos.Count > maxNumber)
|
||||||
|
rinfos.RemoveRange(maxNumber - 1, rinfos.Count - maxNumber);
|
||||||
|
|
||||||
rinfos.AddRange(m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber));
|
|
||||||
return rinfos;
|
return rinfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
|
public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
|
||||||
{
|
{
|
||||||
int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
|
int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||||
// int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
|
int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||||
int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
|
int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||||
int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
|
int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||||
|
|
||||||
List<GridRegion> rinfos = new List<GridRegion>();
|
List<GridRegion> rinfos = m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
if ((r.RegionLocX > snapXmin) && (r.RegionLocX < snapYmax) &&
|
|
||||||
(r.RegionLocY > snapYmin) && (r.RegionLocY < snapYmax))
|
|
||||||
rinfos.Add(r);
|
|
||||||
|
|
||||||
rinfos.AddRange(m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax));
|
rinfos.AddRange(m_HypergridService.GetRegionRange(snapXmin, snapXmax, snapYmin, snapYmax));
|
||||||
|
|
||||||
return rinfos;
|
return rinfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Auxiliary
|
|
||||||
|
|
||||||
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
|
|
||||||
{
|
|
||||||
m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
|
|
||||||
m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveHyperlinkRegion(UUID regionID)
|
|
||||||
{
|
|
||||||
m_HyperlinkRegions.Remove(regionID);
|
|
||||||
m_HyperlinkHandles.Remove(regionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle)
|
|
||||||
{
|
|
||||||
m_knownRegions[userID] = regionInfo;
|
|
||||||
m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveHyperlinkHomeRegion(UUID regionID)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, GridRegion> kvp in m_knownRegions)
|
|
||||||
{
|
|
||||||
if (kvp.Value.RegionID == regionID)
|
|
||||||
{
|
|
||||||
m_knownRegions.Remove(kvp.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_HyperlinkHandles.Remove(regionID);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IHyperlinkService
|
|
||||||
|
|
||||||
private static Random random = new Random();
|
|
||||||
|
|
||||||
// From the command line link-region
|
|
||||||
public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc)
|
|
||||||
{
|
|
||||||
string host = "127.0.0.1";
|
|
||||||
string portstr;
|
|
||||||
string regionName = "";
|
|
||||||
uint port = 9000;
|
|
||||||
string[] parts = mapName.Split(new char[] { ':' });
|
|
||||||
if (parts.Length >= 1)
|
|
||||||
{
|
|
||||||
host = parts[0];
|
|
||||||
}
|
|
||||||
if (parts.Length >= 2)
|
|
||||||
{
|
|
||||||
portstr = parts[1];
|
|
||||||
//m_log.Debug("-- port = " + portstr);
|
|
||||||
if (!UInt32.TryParse(portstr, out port))
|
|
||||||
regionName = parts[1];
|
|
||||||
}
|
|
||||||
// always take the last one
|
|
||||||
if (parts.Length >= 3)
|
|
||||||
{
|
|
||||||
regionName = parts[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanity check. Don't ever link to this sim.
|
|
||||||
IPAddress ipaddr = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ipaddr = Util.GetHostFromDNS(host);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
|
|
||||||
if ((ipaddr != null) &&
|
|
||||||
!((m_scene.RegionInfo.ExternalEndPoint.Address.Equals(ipaddr)) && (m_scene.RegionInfo.HttpPort == port)))
|
|
||||||
{
|
|
||||||
GridRegion regInfo;
|
|
||||||
bool success = TryCreateLink(m_scene, client, xloc, yloc, regionName, port, host, out regInfo);
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
regInfo.RegionName = mapName;
|
|
||||||
return regInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// From the map search and secondlife://blah
|
|
||||||
public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
|
|
||||||
{
|
|
||||||
int xloc = random.Next(0, Int16.MaxValue) * (int) Constants.RegionSize;
|
|
||||||
return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// From the command line and the 2 above
|
|
||||||
public bool TryCreateLink(Scene m_scene, IClientAPI client, int xloc, int yloc,
|
|
||||||
string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[HGrid]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
|
|
||||||
|
|
||||||
regInfo = new GridRegion();
|
|
||||||
regInfo.RegionName = externalRegionName;
|
|
||||||
regInfo.HttpPort = externalPort;
|
|
||||||
regInfo.ExternalHostName = externalHostName;
|
|
||||||
regInfo.RegionLocX = xloc;
|
|
||||||
regInfo.RegionLocY = yloc;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Warn("[HGrid]: Wrong format for link-region: " + e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, link it
|
|
||||||
if (RegisterRegion(UUID.Zero, regInfo) != String.Empty)
|
|
||||||
{
|
|
||||||
m_log.Warn("[HGrid]: Unable to link region");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int x, y;
|
|
||||||
if (!Check4096(m_scene, regInfo, out x, out y))
|
|
||||||
{
|
|
||||||
DeregisterRegion(regInfo.RegionID);
|
|
||||||
if (client != null)
|
|
||||||
client.SendAlertMessage("Region is too far (" + x + ", " + y + ")");
|
|
||||||
m_log.Info("[HGrid]: Unable to link, region is too far (" + x + ", " + y + ")");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckCoords(m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, x, y))
|
|
||||||
{
|
|
||||||
DeregisterRegion(regInfo.RegionID);
|
|
||||||
if (client != null)
|
|
||||||
client.SendAlertMessage("Region has incompatible coordinates (" + x + ", " + y + ")");
|
|
||||||
m_log.Info("[HGrid]: Unable to link, region has incompatible coordinates (" + x + ", " + y + ")");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Debug("[HGrid]: link region succeeded");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryUnlinkRegion(Scene m_scene, string mapName)
|
|
||||||
{
|
|
||||||
GridRegion regInfo = null;
|
|
||||||
if (mapName.Contains(":"))
|
|
||||||
{
|
|
||||||
string host = "127.0.0.1";
|
|
||||||
//string portstr;
|
|
||||||
//string regionName = "";
|
|
||||||
uint port = 9000;
|
|
||||||
string[] parts = mapName.Split(new char[] { ':' });
|
|
||||||
if (parts.Length >= 1)
|
|
||||||
{
|
|
||||||
host = parts[0];
|
|
||||||
}
|
|
||||||
// if (parts.Length >= 2)
|
|
||||||
// {
|
|
||||||
// portstr = parts[1];
|
|
||||||
// if (!UInt32.TryParse(portstr, out port))
|
|
||||||
// regionName = parts[1];
|
|
||||||
// }
|
|
||||||
// always take the last one
|
|
||||||
// if (parts.Length >= 3)
|
|
||||||
// {
|
|
||||||
// regionName = parts[2];
|
|
||||||
// }
|
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
|
|
||||||
regInfo = r;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
if (r.RegionName.Equals(mapName))
|
|
||||||
regInfo = r;
|
|
||||||
}
|
|
||||||
if (regInfo != null)
|
|
||||||
{
|
|
||||||
return DeregisterRegion(regInfo.RegionID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.InfoFormat("[HGrid]: Region {0} not found", mapName);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Cope with this viewer limitation.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="regInfo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool Check4096(Scene m_scene, GridRegion regInfo, out int x, out int y)
|
|
||||||
{
|
|
||||||
ulong realHandle = m_HyperlinkHandles[regInfo.RegionID];
|
|
||||||
uint ux = 0, uy = 0;
|
|
||||||
Utils.LongToUInts(realHandle, out ux, out uy);
|
|
||||||
x = (int)(ux / Constants.RegionSize);
|
|
||||||
y = (int)(uy / Constants.RegionSize);
|
|
||||||
|
|
||||||
if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - x) >= 4096) ||
|
|
||||||
(Math.Abs((int)m_scene.RegionInfo.RegionLocY - y) >= 4096))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CheckCoords(uint thisx, uint thisy, int x, int y)
|
|
||||||
{
|
|
||||||
if ((thisx == x) && (thisy == y))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// From the map search
|
|
||||||
public GridRegion TryLinkRegion(IClientAPI client, string regionDescriptor)
|
|
||||||
{
|
|
||||||
return TryLinkRegion((Scene)client.Scene, client, regionDescriptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// From the map and secondlife://blah
|
|
||||||
public GridRegion GetHyperlinkRegion(ulong handle)
|
|
||||||
{
|
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
if (r.RegionHandle == handle)
|
|
||||||
return r;
|
|
||||||
foreach (GridRegion r in m_knownRegions.Values)
|
|
||||||
if (r.RegionHandle == handle)
|
|
||||||
return r;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong FindRegionHandle(ulong handle)
|
|
||||||
{
|
|
||||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
|
|
||||||
return m_HyperlinkHandles[r.RegionID];
|
|
||||||
|
|
||||||
foreach (GridRegion r in m_knownRegions.Values)
|
|
||||||
if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
|
|
||||||
return m_HyperlinkHandles[r.RegionID];
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData)
|
|
||||||
{
|
|
||||||
// REFACTORING PROBLEM. This needs to change. Some of this info should go with the agent circuit data.
|
|
||||||
|
|
||||||
//UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, agentData.AgentID);
|
|
||||||
//if (account == null)
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
//if ((IsLocalUser(account) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) ||
|
|
||||||
// (!IsLocalUser(account) && !IsGoingHome(uinfo, regInfo)))
|
|
||||||
//{
|
|
||||||
// m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
|
|
||||||
|
|
||||||
// PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(agentData.SessionID);
|
|
||||||
// if (pinfo != null)
|
|
||||||
// {
|
|
||||||
// // Set the position of the region on the remote grid
|
|
||||||
// // ulong realHandle = FindRegionHandle(regInfo.RegionHandle);
|
|
||||||
// uint x = 0, y = 0;
|
|
||||||
// Utils.LongToUInts(regInfo.RegionHandle, out x, out y);
|
|
||||||
// GridRegion clonedRegion = new GridRegion(regInfo);
|
|
||||||
// clonedRegion.RegionLocX = (int)x;
|
|
||||||
// clonedRegion.RegionLocY = (int)y;
|
|
||||||
|
|
||||||
// // Get the user's home region information and adapt the region handle
|
|
||||||
// GridRegion home = GetRegionByUUID(m_aScene.RegionInfo.ScopeID, pinfo.HomeRegionID);
|
|
||||||
// if (m_HyperlinkHandles.ContainsKey(pinfo.HomeRegionID))
|
|
||||||
// {
|
|
||||||
// ulong realHandle = m_HyperlinkHandles[pinfo.HomeRegionID];
|
|
||||||
// Utils.LongToUInts(realHandle, out x, out y);
|
|
||||||
// m_log.DebugFormat("[HGrid]: Foreign user is going elsewhere. Adjusting home handle from {0}-{1} to {2}-{3}", home.RegionLocX, home.RegionLocY, x, y);
|
|
||||||
// home.RegionLocX = (int)x;
|
|
||||||
// home.RegionLocY = (int)y;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Get the user's service URLs
|
|
||||||
// string serverURI = "";
|
|
||||||
// if (uinfo.UserProfile is ForeignUserProfileData)
|
|
||||||
// serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
|
|
||||||
// string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI;
|
|
||||||
|
|
||||||
// string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI);
|
|
||||||
// if ((assetServer == null) || (assetServer == ""))
|
|
||||||
// assetServer = LocalAssetServerURI;
|
|
||||||
|
|
||||||
// string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
|
||||||
// if ((inventoryServer == null) || (inventoryServer == ""))
|
|
||||||
// inventoryServer = LocalInventoryServerURI;
|
|
||||||
|
|
||||||
// if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer))
|
|
||||||
// {
|
|
||||||
// m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.Warn("[HGrid]: Unable to find local presence of transferring user.");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
////if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
|
|
||||||
////{
|
|
||||||
//// m_log.Info("[HGrid]: User seems to be going to foreign region.");
|
|
||||||
//// if (!InformRegionOfUser(regInfo, agentData))
|
|
||||||
//// {
|
|
||||||
//// m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
////}
|
|
||||||
////else
|
|
||||||
//// m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
|
|
||||||
|
|
||||||
//// May need to change agent's name
|
|
||||||
//if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null))
|
|
||||||
//{
|
|
||||||
// agentData.firstname = agentData.firstname + "." + agentData.lastname;
|
|
||||||
// agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
|
|
||||||
//}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AdjustUserInformation(AgentCircuitData agentData)
|
|
||||||
{
|
|
||||||
// REFACTORING PROBLEM!!! This needs to change
|
|
||||||
|
|
||||||
//CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
|
|
||||||
//if ((uinfo != null) && (uinfo.UserProfile != null) &&
|
|
||||||
// (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
|
|
||||||
//{
|
|
||||||
// //m_log.Debug("---------------> Local User!");
|
|
||||||
// string[] parts = agentData.firstname.Split(new char[] { '.' });
|
|
||||||
// if (parts.Length == 2)
|
|
||||||
// {
|
|
||||||
// agentData.firstname = parts[0];
|
|
||||||
// agentData.lastname = parts[1];
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
////else
|
|
||||||
//// m_log.Debug("---------------> Foreign User!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if a local user exists with the same UUID as the incoming foreign user
|
|
||||||
public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
|
|
||||||
{
|
|
||||||
comingHome = false;
|
|
||||||
|
|
||||||
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID);
|
|
||||||
if (account != null)
|
|
||||||
{
|
|
||||||
if (m_aScene.AuthenticationService.Verify(userID, sessionID.ToString(), 30))
|
|
||||||
{
|
|
||||||
// oh, so it's you! welcome back
|
|
||||||
comingHome = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// can't have a foreigner with a local UUID
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OK, user can come in
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AcceptUser(ForeignUserProfileData user, GridRegion home)
|
|
||||||
{
|
|
||||||
// REFACTORING PROBLEM. uh-oh, commenting this breaks HG completely
|
|
||||||
// Needs to be rewritten
|
|
||||||
//m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user);
|
|
||||||
|
|
||||||
ulong realHandle = home.RegionHandle;
|
|
||||||
// Change the local coordinates
|
|
||||||
// X=0 on the map
|
|
||||||
home.RegionLocX = 0;
|
|
||||||
home.RegionLocY = random.Next(0, 10000) * (int)Constants.RegionSize;
|
|
||||||
|
|
||||||
AddHyperlinkHomeRegion(user.ID, home, realHandle);
|
|
||||||
|
|
||||||
DumpUserData(user);
|
|
||||||
DumpRegionData(home);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsLocalUser(UUID userID)
|
|
||||||
{
|
|
||||||
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID);
|
|
||||||
return IsLocalUser(account);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IHyperlink Misc
|
|
||||||
|
|
||||||
protected bool IsComingHome(ForeignUserProfileData userData)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
// REFACTORING PROBLEM
|
|
||||||
//return (userData.UserServerURI == LocalUserServerURI);
|
|
||||||
}
|
|
||||||
|
|
||||||
// REFACTORING PROBLEM
|
|
||||||
//// Is the user going back to the home region or the home grid?
|
|
||||||
//protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo)
|
|
||||||
//{
|
|
||||||
// if (uinfo == null)
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// if (uinfo.UserProfile == null)
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// if (!(uinfo.UserProfile is ForeignUserProfileData))
|
|
||||||
// // it's a home user, can't be outside to return home
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// // OK, it's a foreign user with a ForeignUserProfileData
|
|
||||||
// // and is going back to exactly the home region.
|
|
||||||
// // We can't check if it's going back to a non-home region
|
|
||||||
// // of the home grid. That will be dealt with in the
|
|
||||||
// // receiving end
|
|
||||||
// return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID);
|
|
||||||
//}
|
|
||||||
|
|
||||||
protected bool IsLocalUser(UserAccount account)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// REFACTORING PROBLEM
|
|
||||||
//if (account != null &&
|
|
||||||
// account.ServiceURLs.ContainsKey("HomeURI") &&
|
|
||||||
// account.ServiceURLs["HomeURI"] != null)
|
|
||||||
|
|
||||||
// return (account.ServiceURLs["HomeURI"].ToString() == LocalUserServerURI);
|
|
||||||
|
|
||||||
//return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected bool IsLocalRegion(ulong handle)
|
|
||||||
{
|
|
||||||
return m_LocalScenes.ContainsKey(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DumpUserData(ForeignUserProfileData userData)
|
|
||||||
{
|
|
||||||
m_log.Info(" ------------ User Data Dump ----------");
|
|
||||||
m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName);
|
|
||||||
m_log.Info(" >> HomeID: " + userData.HomeRegionID);
|
|
||||||
m_log.Info(" >> UserServer: " + userData.UserServerURI);
|
|
||||||
m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
|
|
||||||
m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
|
|
||||||
m_log.Info(" ------------ -------------- ----------");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DumpRegionData(GridRegion rinfo)
|
|
||||||
{
|
|
||||||
m_log.Info(" ------------ Region Data Dump ----------");
|
|
||||||
m_log.Info(" >> handle: " + rinfo.RegionHandle);
|
|
||||||
m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
|
|
||||||
m_log.Info(" >> external host name: " + rinfo.ExternalHostName);
|
|
||||||
m_log.Info(" >> http port: " + rinfo.HttpPort);
|
|
||||||
m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address);
|
|
||||||
m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port);
|
|
||||||
m_log.Info(" ------------ -------------- ----------");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public List<GridRegion> GetDefaultRegions(UUID scopeID)
|
public List<GridRegion> GetDefaultRegions(UUID scopeID)
|
||||||
{
|
{
|
||||||
return null;
|
return m_GridServiceConnector.GetDefaultRegions(scopeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
|
public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||||
{
|
{
|
||||||
return null;
|
return m_GridServiceConnector.GetFallbackRegions(scopeID, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetRegionFlags(UUID scopeID, UUID regionID)
|
public int GetRegionFlags(UUID scopeID, UUID regionID)
|
||||||
{
|
{
|
||||||
return 0;
|
return m_GridServiceConnector.GetRegionFlags(scopeID, regionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3157,7 +3157,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agent.AgentID, agent.circuitcode, teleportFlags);
|
agent.AgentID, agent.circuitcode, teleportFlags);
|
||||||
|
|
||||||
reason = String.Empty;
|
reason = String.Empty;
|
||||||
if (!AuthenticateUser(agent, out reason))
|
if (!VerifyUserPresence(agent, out reason))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!AuthorizeUser(agent, out reason))
|
if (!AuthorizeUser(agent, out reason))
|
||||||
|
@ -3258,30 +3258,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Verifies that the user has a session on the Grid
|
/// Verifies that the user has a presence on the Grid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agent">Circuit Data of the Agent we're verifying</param>
|
/// <param name="agent">Circuit Data of the Agent we're verifying</param>
|
||||||
/// <param name="reason">Outputs the reason for the false response on this string</param>
|
/// <param name="reason">Outputs the reason for the false response on this string</param>
|
||||||
/// <returns>True if the user has a session on the grid. False if it does not. False will
|
/// <returns>True if the user has a session on the grid. False if it does not. False will
|
||||||
/// also return a reason.</returns>
|
/// also return a reason.</returns>
|
||||||
public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason)
|
public virtual bool VerifyUserPresence(AgentCircuitData agent, out string reason)
|
||||||
{
|
{
|
||||||
reason = String.Empty;
|
reason = String.Empty;
|
||||||
|
|
||||||
IAuthenticationService auth = RequestModuleInterface<IAuthenticationService>();
|
IPresenceService presence = RequestModuleInterface<IPresenceService>();
|
||||||
if (auth == null)
|
if (presence == null)
|
||||||
{
|
{
|
||||||
reason = String.Format("Failed to authenticate user {0} {1} in region {2}. Authentication service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = auth.Verify(agent.AgentID, agent.SecureSessionID.ToString(), 30);
|
OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID);
|
||||||
|
|
||||||
m_log.Debug("[CONNECTION BEGIN]: Session authentication returned " + result);
|
if (pinfo == null || (pinfo != null && pinfo.Online == false))
|
||||||
if (!result)
|
{
|
||||||
reason = String.Format("Failed to authenticate user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenSim.Server.Handlers.Base;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
using log4net;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
|
||||||
|
namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
{
|
||||||
|
public class GatekeeperServiceInConnector : ServiceConnector
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private IGatekeeperService m_GatekeeperService;
|
||||||
|
|
||||||
|
public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
|
||||||
|
base(config, server, String.Empty)
|
||||||
|
{
|
||||||
|
IConfig gridConfig = config.Configs["GatekeeperService"];
|
||||||
|
if (gridConfig != null)
|
||||||
|
{
|
||||||
|
string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
|
||||||
|
Object[] args = new Object[] { config, simService };
|
||||||
|
m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args);
|
||||||
|
}
|
||||||
|
if (m_GatekeeperService == null)
|
||||||
|
throw new Exception("Gatekeeper server connector cannot proceed because of missing service");
|
||||||
|
|
||||||
|
server.AddXmlRPCHandler("link_region", LinkRegionRequest, false);
|
||||||
|
server.AddXmlRPCHandler("get_region", GetRegion, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server)
|
||||||
|
: this(config, server, null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Someone wants to link to us
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
//string host = (string)requestData["host"];
|
||||||
|
//string portstr = (string)requestData["port"];
|
||||||
|
string name = (string)requestData["region_name"];
|
||||||
|
|
||||||
|
m_log.DebugFormat("[HGrid]: Hyperlink request");
|
||||||
|
|
||||||
|
UUID regionID = UUID.Zero;
|
||||||
|
string imageURL = string.Empty;
|
||||||
|
ulong regionHandle = 0;
|
||||||
|
string reason = string.Empty;
|
||||||
|
|
||||||
|
bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason);
|
||||||
|
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
hash["result"] = success.ToString();
|
||||||
|
hash["uuid"] = regionID.ToString();
|
||||||
|
hash["handle"] = regionHandle.ToString();
|
||||||
|
hash["region_image"] = imageURL;
|
||||||
|
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
response.Value = hash;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
//string host = (string)requestData["host"];
|
||||||
|
//string portstr = (string)requestData["port"];
|
||||||
|
string regionID_str = (string)requestData["regionID"];
|
||||||
|
UUID regionID = UUID.Zero;
|
||||||
|
UUID.TryParse(regionID_str, out regionID);
|
||||||
|
|
||||||
|
GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID);
|
||||||
|
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
if (regInfo == null)
|
||||||
|
hash["result"] = "false";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hash["result"] = "true";
|
||||||
|
hash["uuid"] = regInfo.RegionID.ToString();
|
||||||
|
hash["x"] = regInfo.RegionLocX.ToString();
|
||||||
|
hash["y"] = regInfo.RegionLocY.ToString();
|
||||||
|
hash["region_name"] = regInfo.RegionName;
|
||||||
|
hash["hostname"] = regInfo.ExternalHostName;
|
||||||
|
hash["http_port"] = regInfo.HttpPort.ToString();
|
||||||
|
hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
|
||||||
|
}
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
response.Value = hash;
|
||||||
|
return response;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,14 @@ namespace OpenSim.Services.Connectors.Grid
|
||||||
m_AssetService = assService;
|
m_AssetService = assService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool LinkRegion(GridRegion info, out UUID regionID, out ulong regionHandle, out string reason)
|
||||||
|
{
|
||||||
|
regionID = LinkRegion(info, out regionHandle);
|
||||||
|
// reason...
|
||||||
|
reason = string.Empty;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID LinkRegion(GridRegion info, out ulong realHandle)
|
public UUID LinkRegion(GridRegion info, out ulong realHandle)
|
||||||
{
|
{
|
||||||
UUID uuid = UUID.Zero;
|
UUID uuid = UUID.Zero;
|
||||||
|
|
|
@ -0,0 +1,245 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Net;
|
||||||
|
using System.Reflection;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Imaging;
|
||||||
|
using log4net;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
|
{
|
||||||
|
public class HypergridServiceConnector
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private IAssetService m_AssetService;
|
||||||
|
|
||||||
|
public HypergridServiceConnector(IAssetService assService)
|
||||||
|
{
|
||||||
|
m_AssetService = assService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason)
|
||||||
|
{
|
||||||
|
regionID = UUID.Zero;
|
||||||
|
imageURL = string.Empty;
|
||||||
|
realHandle = 0;
|
||||||
|
reason = string.Empty;
|
||||||
|
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
hash["region_name"] = info.RegionName;
|
||||||
|
|
||||||
|
IList paramList = new ArrayList();
|
||||||
|
paramList.Add(hash);
|
||||||
|
|
||||||
|
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
|
||||||
|
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
|
||||||
|
m_log.Debug("[HGrid]: Linking to " + uri);
|
||||||
|
XmlRpcResponse response = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = request.Send(uri, 10000);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Debug("[HGrid]: Exception " + e.Message);
|
||||||
|
reason = "Error contacting remote server";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.IsFault)
|
||||||
|
{
|
||||||
|
reason = response.FaultString;
|
||||||
|
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash = (Hashtable)response.Value;
|
||||||
|
//foreach (Object o in hash)
|
||||||
|
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
Boolean.TryParse((string)hash["result"], out success);
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
UUID.TryParse((string)hash["uuid"], out regionID);
|
||||||
|
//m_log.Debug(">> HERE, uuid: " + uuid);
|
||||||
|
if ((string)hash["handle"] != null)
|
||||||
|
{
|
||||||
|
realHandle = Convert.ToUInt64((string)hash["handle"]);
|
||||||
|
//m_log.Debug(">> HERE, realHandle: " + realHandle);
|
||||||
|
}
|
||||||
|
if (hash["region_image"] != null)
|
||||||
|
{
|
||||||
|
imageURL = (string)hash["region_image"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
reason = "Error parsing return arguments";
|
||||||
|
m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID GetMapImage(UUID regionID, string imageURL)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
WebClient c = new WebClient();
|
||||||
|
//m_log.Debug("JPEG: " + uri);
|
||||||
|
string filename = regionID.ToString();
|
||||||
|
c.DownloadFile(imageURL, filename + ".jpg");
|
||||||
|
Bitmap m = new Bitmap(filename + ".jpg");
|
||||||
|
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
|
||||||
|
byte[] imageData = OpenJPEG.EncodeFromImage(m, true);
|
||||||
|
AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture);
|
||||||
|
|
||||||
|
// !!! for now
|
||||||
|
//info.RegionSettings.TerrainImageID = ass.FullID;
|
||||||
|
|
||||||
|
ass.Temporary = true;
|
||||||
|
ass.Local = true;
|
||||||
|
ass.Data = imageData;
|
||||||
|
|
||||||
|
m_AssetService.Store(ass);
|
||||||
|
|
||||||
|
// finally
|
||||||
|
return ass.FullID;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
|
||||||
|
{
|
||||||
|
m_log.Warn("[HGrid]: Failed getting/storing map image, because it is probably already in the cache");
|
||||||
|
}
|
||||||
|
return UUID.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)
|
||||||
|
{
|
||||||
|
Hashtable hash = new Hashtable();
|
||||||
|
hash["region_uuid"] = regionID.ToString();
|
||||||
|
|
||||||
|
IList paramList = new ArrayList();
|
||||||
|
paramList.Add(hash);
|
||||||
|
|
||||||
|
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
|
||||||
|
string uri = "http://" + gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/";
|
||||||
|
m_log.Debug("[HGrid]: contacting " + uri);
|
||||||
|
XmlRpcResponse response = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = request.Send(uri, 10000);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Debug("[HGrid]: Exception " + e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.IsFault)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash = (Hashtable)response.Value;
|
||||||
|
//foreach (Object o in hash)
|
||||||
|
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
Boolean.TryParse((string)hash["result"], out success);
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
GridRegion region = new GridRegion();
|
||||||
|
|
||||||
|
UUID.TryParse((string)hash["uuid"], out region.RegionID);
|
||||||
|
//m_log.Debug(">> HERE, uuid: " + uuid);
|
||||||
|
int n = 0;
|
||||||
|
if (hash["x"] != null)
|
||||||
|
{
|
||||||
|
Int32.TryParse((string)hash["x"], out n);
|
||||||
|
region.RegionLocX = n;
|
||||||
|
}
|
||||||
|
if (hash["y"] != null)
|
||||||
|
{
|
||||||
|
Int32.TryParse((string)hash["y"], out n);
|
||||||
|
region.RegionLocY = n;
|
||||||
|
}
|
||||||
|
if (hash["region_name"] != null)
|
||||||
|
{
|
||||||
|
region.RegionName = (string)hash["region_name"];
|
||||||
|
}
|
||||||
|
if (hash["hostname"] != null)
|
||||||
|
region.ExternalHostName = (string)hash["hostname"];
|
||||||
|
if (hash["http_port"] != null)
|
||||||
|
{
|
||||||
|
uint p = 0;
|
||||||
|
UInt32.TryParse((string)hash["http_port"], out p);
|
||||||
|
region.HttpPort = p;
|
||||||
|
}
|
||||||
|
if (hash["internal_port"] != null)
|
||||||
|
{
|
||||||
|
int p = 0;
|
||||||
|
Int32.TryParse((string)hash["internal_port"], out p);
|
||||||
|
region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Successful return
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
using Nini.Config;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.HypergridService
|
||||||
|
{
|
||||||
|
public class GatekeeperService : IGatekeeperService
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
IGridService m_GridService;
|
||||||
|
IPresenceService m_PresenceService;
|
||||||
|
IAuthenticationService m_AuthenticationService;
|
||||||
|
IUserAccountService m_UserAccountService;
|
||||||
|
ISimulationService m_SimulationService;
|
||||||
|
|
||||||
|
string m_AuthDll;
|
||||||
|
|
||||||
|
UUID m_ScopeID;
|
||||||
|
bool m_AllowTeleportsToAnyRegion;
|
||||||
|
GridRegion m_DefaultGatewayRegion;
|
||||||
|
|
||||||
|
public GatekeeperService(IConfigSource config, ISimulationService simService)
|
||||||
|
{
|
||||||
|
IConfig serverConfig = config.Configs["GatekeeperService"];
|
||||||
|
if (serverConfig == null)
|
||||||
|
throw new Exception(String.Format("No section GatekeeperService in config file"));
|
||||||
|
|
||||||
|
string accountService = serverConfig.GetString("UserAccountService", String.Empty);
|
||||||
|
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||||
|
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||||
|
string simulationService = serverConfig.GetString("SimulationService", String.Empty);
|
||||||
|
|
||||||
|
m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty);
|
||||||
|
|
||||||
|
if (accountService == string.Empty || gridService == string.Empty ||
|
||||||
|
presenceService == string.Empty || m_AuthDll == string.Empty)
|
||||||
|
throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
|
||||||
|
|
||||||
|
string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
|
||||||
|
UUID.TryParse(scope, out m_ScopeID);
|
||||||
|
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
||||||
|
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
||||||
|
|
||||||
|
Object[] args = new Object[] { config };
|
||||||
|
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||||
|
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||||
|
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
|
||||||
|
if (simService != null)
|
||||||
|
m_SimulationService = simService;
|
||||||
|
else if (simulationService != string.Empty)
|
||||||
|
m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
|
||||||
|
|
||||||
|
if (m_UserAccountService == null || m_GridService == null ||
|
||||||
|
m_PresenceService == null || m_SimulationService == null)
|
||||||
|
throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
|
||||||
|
|
||||||
|
m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GatekeeperService(IConfigSource config)
|
||||||
|
: this(config, null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason)
|
||||||
|
{
|
||||||
|
regionID = m_DefaultGatewayRegion.RegionID;
|
||||||
|
regionHandle = m_DefaultGatewayRegion.RegionHandle;
|
||||||
|
imageURL = string.Empty;
|
||||||
|
reason = string.Empty;
|
||||||
|
|
||||||
|
if (!m_AllowTeleportsToAnyRegion)
|
||||||
|
{
|
||||||
|
regionID = m_DefaultGatewayRegion.RegionID;
|
||||||
|
regionHandle = m_DefaultGatewayRegion.RegionHandle;
|
||||||
|
if (regionName != string.Empty)
|
||||||
|
{
|
||||||
|
reason = "Direct links to regions not allowed";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GridRegion region = m_GridService.GetRegionByName(m_ScopeID, regionName);
|
||||||
|
if (region == null)
|
||||||
|
{
|
||||||
|
reason = "Region not found";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
regionID = region.RegionID;
|
||||||
|
regionHandle = region.RegionHandle;
|
||||||
|
string regionimage = "regionImage" + region.RegionID.ToString();
|
||||||
|
regionimage = regionimage.Replace("-", "");
|
||||||
|
|
||||||
|
imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridRegion GetHyperlinkRegion(UUID regionID)
|
||||||
|
{
|
||||||
|
if (!m_AllowTeleportsToAnyRegion)
|
||||||
|
// Don't even check the given regionID
|
||||||
|
return m_DefaultGatewayRegion;
|
||||||
|
|
||||||
|
GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID);
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination)
|
||||||
|
{
|
||||||
|
if (!Authenticate(aCircuit))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Check to see if we have a local user with that UUID
|
||||||
|
UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
|
||||||
|
if (account != null)
|
||||||
|
// No, sorry; go away
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// May want to authorize
|
||||||
|
|
||||||
|
// Login the presence
|
||||||
|
if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Finally launch the agent at the destination
|
||||||
|
string reason = string.Empty;
|
||||||
|
return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoginAttachments(ISceneObject sog, GridRegion destination)
|
||||||
|
{
|
||||||
|
// May want to filter attachments
|
||||||
|
return m_SimulationService.CreateObject(destination, sog, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool Authenticate(AgentCircuitData aCircuit)
|
||||||
|
{
|
||||||
|
string authURL = string.Empty; // GetAuthURL(aCircuit);
|
||||||
|
if (authURL == string.Empty)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Object[] args = new Object[] { authURL };
|
||||||
|
IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args);
|
||||||
|
if (authService != null)
|
||||||
|
return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,41 +34,52 @@ using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
//using OpenSim.Framework.Communications;
|
//using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.Framework;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
|
||||||
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
public class HGCommands
|
public class HGCommands
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private HGGridConnector m_HGGridConnector;
|
private HypergridService m_HypergridService;
|
||||||
private Scene m_scene;
|
|
||||||
|
|
||||||
private static uint m_autoMappingX = 0;
|
private static uint m_autoMappingX = 0;
|
||||||
private static uint m_autoMappingY = 0;
|
private static uint m_autoMappingY = 0;
|
||||||
private static bool m_enableAutoMapping = false;
|
private static bool m_enableAutoMapping = false;
|
||||||
|
|
||||||
public HGCommands(HGGridConnector hgConnector, Scene scene)
|
public HGCommands(HypergridService service)
|
||||||
{
|
{
|
||||||
m_HGGridConnector = hgConnector;
|
m_HypergridService = service;
|
||||||
m_scene = scene;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
|
public void HandleShow(string module, string[] cmd)
|
||||||
// StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
|
{
|
||||||
//{
|
if (cmd.Length != 2)
|
||||||
// HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices);
|
{
|
||||||
|
MainConsole.Instance.Output("Syntax: show hyperlinks");
|
||||||
// return
|
return;
|
||||||
// new HGScene(
|
}
|
||||||
// regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager,
|
List<GridRegion> regions = new List<GridRegion>(m_HypergridService.m_HyperlinkRegions.Values);
|
||||||
// m_moduleLoader, false, m_configSettings.PhysicalPrim,
|
if (regions == null || regions.Count < 1)
|
||||||
// m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
|
{
|
||||||
//}
|
MainConsole.Instance.Output("No hyperlinks");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output("Region Name Region UUID");
|
||||||
|
MainConsole.Instance.Output("Location URI");
|
||||||
|
MainConsole.Instance.Output("Owner ID Flags");
|
||||||
|
MainConsole.Instance.Output("-------------------------------------------------------------------------------");
|
||||||
|
foreach (GridRegion r in regions)
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n",
|
||||||
|
r.RegionName, r.RegionID,
|
||||||
|
String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(),
|
||||||
|
r.EstateOwner.ToString()));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
public void RunCommand(string module, string[] cmdparams)
|
public void RunCommand(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
List<string> args = new List<string>(cmdparams);
|
List<string> args = new List<string>(cmdparams);
|
||||||
|
@ -133,13 +144,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
for (int i = 3; i < cmdparams.Length; i++)
|
for (int i = 3; i < cmdparams.Length; i++)
|
||||||
mapName += " " + cmdparams[i];
|
mapName += " " + cmdparams[i];
|
||||||
|
|
||||||
m_log.Info(">> MapName: " + mapName);
|
//m_log.Info(">> MapName: " + mapName);
|
||||||
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
|
||||||
//remotingPort = Convert.ToUInt32(cmdparams[5]);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
|
MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message);
|
||||||
LinkRegionCmdUsage();
|
LinkRegionCmdUsage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +156,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
// Convert cell coordinates given by the user to meters
|
// Convert cell coordinates given by the user to meters
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = xloc * (int)Constants.RegionSize;
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = yloc * (int)Constants.RegionSize;
|
||||||
m_HGGridConnector.TryLinkRegionToCoords(m_scene, null, mapName, xloc, yloc);
|
string reason = string.Empty;
|
||||||
|
if (m_HypergridService.TryLinkRegionToCoords(mapName, xloc, yloc, out reason) == null)
|
||||||
|
MainConsole.Instance.Output("Failed to link region: " + reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -167,7 +178,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
|
MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message);
|
||||||
LinkRegionCmdUsage();
|
LinkRegionCmdUsage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +186,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
// Convert cell coordinates given by the user to meters
|
// Convert cell coordinates given by the user to meters
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = xloc * (int)Constants.RegionSize;
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = yloc * (int)Constants.RegionSize;
|
||||||
if (m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
|
string reason = string.Empty;
|
||||||
|
if (m_HypergridService.TryCreateLink(xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length >= 5)
|
if (cmdparams.Length >= 5)
|
||||||
{
|
{
|
||||||
|
@ -194,10 +206,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
UnlinkRegionCmdUsage();
|
UnlinkRegionCmdUsage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_HGGridConnector.TryUnlinkRegion(m_scene, cmdparams[0]))
|
if (m_HypergridService.TryUnlinkRegion(cmdparams[0]))
|
||||||
m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]);
|
MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]);
|
||||||
else
|
else
|
||||||
m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]);
|
MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,27 +288,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
{
|
{
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = xloc * (int)Constants.RegionSize;
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = yloc * (int)Constants.RegionSize;
|
||||||
if (
|
string reason = string.Empty;
|
||||||
m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort,
|
if (m_HypergridService.TryCreateLink(xloc, yloc, "", externalPort,
|
||||||
externalHostName, out regInfo))
|
externalHostName, out regInfo, out reason))
|
||||||
{
|
{
|
||||||
regInfo.RegionName = config.GetString("localName", "");
|
regInfo.RegionName = config.GetString("localName", "");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
MainConsole.Instance.Output("Unable to link " + externalHostName + ": " + reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LinkRegionCmdUsage()
|
private void LinkRegionCmdUsage()
|
||||||
{
|
{
|
||||||
m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
|
MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
|
||||||
m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
||||||
m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
|
MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnlinkRegionCmdUsage()
|
private void UnlinkRegionCmdUsage()
|
||||||
{
|
{
|
||||||
m_log.Info("Usage: unlink-region <HostName>:<HttpPort>");
|
MainConsole.Instance.Output("Usage: unlink-region <HostName>:<HttpPort>");
|
||||||
m_log.Info("Usage: unlink-region <LocalName>");
|
MainConsole.Instance.Output("Usage: unlink-region <LocalName>");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,415 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using System.Reflection;
|
||||||
|
using Nini.Config;
|
||||||
|
using log4net;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Data;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.Connectors.Hypergrid;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.HypergridService
|
||||||
|
{
|
||||||
|
public class HypergridService : HypergridServiceBase, IHypergridService
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private static HypergridService m_RootInstance = null;
|
||||||
|
protected IConfigSource m_config;
|
||||||
|
|
||||||
|
protected IAuthenticationService m_AuthenticationService = null;
|
||||||
|
protected IGridService m_GridService;
|
||||||
|
protected IAssetService m_AssetService;
|
||||||
|
protected HypergridServiceConnector m_HypergridConnector;
|
||||||
|
|
||||||
|
protected bool m_AllowDuplicateNames = false;
|
||||||
|
protected UUID m_ScopeID = UUID.Zero;
|
||||||
|
|
||||||
|
// Hyperlink regions are hyperlinks on the map
|
||||||
|
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
|
||||||
|
protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>();
|
||||||
|
|
||||||
|
protected GridRegion m_DefaultRegion;
|
||||||
|
protected GridRegion DefaultRegion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_DefaultRegion == null)
|
||||||
|
{
|
||||||
|
List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);
|
||||||
|
if (defs != null && defs.Count > 0)
|
||||||
|
m_DefaultRegion = defs[0];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Best guess, may be totally off
|
||||||
|
m_DefaultRegion = new GridRegion(1000, 1000);
|
||||||
|
m_log.WarnFormat("[HYPERGRID SERVICE]: This grid does not have a default region. Assuming default coordinates at 1000, 1000.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_DefaultRegion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HypergridService(IConfigSource config)
|
||||||
|
: base(config)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HYPERGRID SERVICE]: Starting...");
|
||||||
|
|
||||||
|
m_config = config;
|
||||||
|
IConfig gridConfig = config.Configs["HypergridService"];
|
||||||
|
if (gridConfig != null)
|
||||||
|
{
|
||||||
|
string gridService = gridConfig.GetString("GridService", string.Empty);
|
||||||
|
string authService = gridConfig.GetString("AuthenticationService", String.Empty);
|
||||||
|
string assetService = gridConfig.GetString("AssetService", string.Empty);
|
||||||
|
|
||||||
|
Object[] args = new Object[] { config };
|
||||||
|
if (gridService != string.Empty)
|
||||||
|
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||||
|
|
||||||
|
if (m_GridService == null)
|
||||||
|
throw new Exception("HypergridService cannot function without a GridService");
|
||||||
|
|
||||||
|
if (authService != String.Empty)
|
||||||
|
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
|
||||||
|
|
||||||
|
if (assetService != string.Empty)
|
||||||
|
m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||||
|
|
||||||
|
m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
|
||||||
|
|
||||||
|
string scope = gridConfig.GetString("ScopeID", string.Empty);
|
||||||
|
if (scope != string.Empty)
|
||||||
|
UUID.TryParse(scope, out m_ScopeID);
|
||||||
|
|
||||||
|
m_HypergridConnector = new HypergridServiceConnector(m_AssetService);
|
||||||
|
|
||||||
|
m_log.DebugFormat("[HYPERGRID SERVICE]: Loaded all services...");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_RootInstance == null)
|
||||||
|
{
|
||||||
|
m_RootInstance = this;
|
||||||
|
|
||||||
|
HGCommands hgCommands = new HGCommands(this);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
|
||||||
|
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
||||||
|
"Link a hypergrid region", hgCommands.RunCommand);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
|
||||||
|
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
||||||
|
"Unlink a hypergrid region", hgCommands.RunCommand);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
|
||||||
|
"Set local coordinate to map HG regions to", hgCommands.RunCommand);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks <cr>",
|
||||||
|
"List the HG regions", hgCommands.HandleShow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Link Region
|
||||||
|
|
||||||
|
public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason)
|
||||||
|
{
|
||||||
|
regionID = UUID.Zero;
|
||||||
|
imageURL = string.Empty;
|
||||||
|
regionHandle = 0;
|
||||||
|
reason = string.Empty;
|
||||||
|
int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize;
|
||||||
|
GridRegion region = TryLinkRegionToCoords(regionDescriptor, xloc, 0, out reason);
|
||||||
|
if (region == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
regionID = region.RegionID;
|
||||||
|
regionHandle = region.RegionHandle;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Random random = new Random();
|
||||||
|
|
||||||
|
// From the command line link-region
|
||||||
|
public GridRegion TryLinkRegionToCoords(string mapName, int xloc, int yloc, out string reason)
|
||||||
|
{
|
||||||
|
reason = string.Empty;
|
||||||
|
string host = "127.0.0.1";
|
||||||
|
string portstr;
|
||||||
|
string regionName = "";
|
||||||
|
uint port = 9000;
|
||||||
|
string[] parts = mapName.Split(new char[] { ':' });
|
||||||
|
if (parts.Length >= 1)
|
||||||
|
{
|
||||||
|
host = parts[0];
|
||||||
|
}
|
||||||
|
if (parts.Length >= 2)
|
||||||
|
{
|
||||||
|
portstr = parts[1];
|
||||||
|
//m_log.Debug("-- port = " + portstr);
|
||||||
|
if (!UInt32.TryParse(portstr, out port))
|
||||||
|
regionName = parts[1];
|
||||||
|
}
|
||||||
|
// always take the last one
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
regionName = parts[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity check. Don't ever link to this sim.
|
||||||
|
IPAddress ipaddr = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ipaddr = Util.GetHostFromDNS(host);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
GridRegion regInfo;
|
||||||
|
bool success = TryCreateLink(xloc, yloc, regionName, port, host, out regInfo, out reason);
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
regInfo.RegionName = mapName;
|
||||||
|
return regInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// From the command line and the 2 above
|
||||||
|
public bool TryCreateLink(int xloc, int yloc,
|
||||||
|
string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HYPERGRID SERVICE]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
|
||||||
|
|
||||||
|
reason = string.Empty;
|
||||||
|
regInfo = new GridRegion();
|
||||||
|
regInfo.RegionName = externalRegionName;
|
||||||
|
regInfo.HttpPort = externalPort;
|
||||||
|
regInfo.ExternalHostName = externalHostName;
|
||||||
|
regInfo.RegionLocX = xloc;
|
||||||
|
regInfo.RegionLocY = yloc;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Warn("[HYPERGRID SERVICE]: Wrong format for link-region: " + e.Message);
|
||||||
|
reason = "Internal error";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally, link it
|
||||||
|
ulong handle = 0;
|
||||||
|
UUID regionID = UUID.Zero;
|
||||||
|
string imageURL = string.Empty;
|
||||||
|
if (!m_HypergridConnector.LinkRegion(regInfo, out regionID, out handle, out imageURL, out reason))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (regionID != UUID.Zero)
|
||||||
|
{
|
||||||
|
regInfo.RegionID = regionID;
|
||||||
|
|
||||||
|
AddHyperlinkRegion(regInfo, handle);
|
||||||
|
m_log.Info("[HYPERGRID SERVICE]: Successfully linked to region_uuid " + regInfo.RegionID);
|
||||||
|
|
||||||
|
// Try get the map image
|
||||||
|
regInfo.TerrainImage = m_HypergridConnector.GetMapImage(regionID, imageURL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[HYPERGRID SERVICE]: Unable to link region");
|
||||||
|
reason = "Remote region could not be found";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint x, y;
|
||||||
|
if (!Check4096(regInfo, out x, out y))
|
||||||
|
{
|
||||||
|
RemoveHyperlinkRegion(regInfo.RegionID);
|
||||||
|
reason = "Region is too far (" + x + ", " + y + ")";
|
||||||
|
m_log.Info("[HYPERGRID SERVICE]: Unable to link, region is too far (" + x + ", " + y + ")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Debug("[HYPERGRID SERVICE]: link region succeeded");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryUnlinkRegion(string mapName)
|
||||||
|
{
|
||||||
|
GridRegion regInfo = null;
|
||||||
|
if (mapName.Contains(":"))
|
||||||
|
{
|
||||||
|
string host = "127.0.0.1";
|
||||||
|
//string portstr;
|
||||||
|
//string regionName = "";
|
||||||
|
uint port = 9000;
|
||||||
|
string[] parts = mapName.Split(new char[] { ':' });
|
||||||
|
if (parts.Length >= 1)
|
||||||
|
{
|
||||||
|
host = parts[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||||
|
if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
|
||||||
|
regInfo = r;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||||
|
if (r.RegionName.Equals(mapName))
|
||||||
|
regInfo = r;
|
||||||
|
}
|
||||||
|
if (regInfo != null)
|
||||||
|
{
|
||||||
|
RemoveHyperlinkRegion(regInfo.RegionID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[HYPERGRID SERVICE]: Region {0} not found", mapName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cope with this viewer limitation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="regInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool Check4096(GridRegion regInfo, out uint x, out uint y)
|
||||||
|
{
|
||||||
|
GridRegion defRegion = DefaultRegion;
|
||||||
|
|
||||||
|
ulong realHandle = m_HyperlinkHandles[regInfo.RegionID];
|
||||||
|
uint ux = 0, uy = 0;
|
||||||
|
Utils.LongToUInts(realHandle, out ux, out uy);
|
||||||
|
x = ux / Constants.RegionSize;
|
||||||
|
y = uy / Constants.RegionSize;
|
||||||
|
|
||||||
|
if ((Math.Abs((int)defRegion.RegionLocX - ux) >= 4096 * Constants.RegionSize) ||
|
||||||
|
(Math.Abs((int)defRegion.RegionLocY - uy) >= 4096 * Constants.RegionSize))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
|
||||||
|
{
|
||||||
|
m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
|
||||||
|
m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveHyperlinkRegion(UUID regionID)
|
||||||
|
{
|
||||||
|
// Try the hyperlink collection
|
||||||
|
if (m_HyperlinkRegions.ContainsKey(regionID))
|
||||||
|
{
|
||||||
|
m_HyperlinkRegions.Remove(regionID);
|
||||||
|
m_HyperlinkHandles.Remove(regionID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Get Hyperlinks
|
||||||
|
|
||||||
|
public GridRegion GetHyperlinkRegion(UUID regionID)
|
||||||
|
{
|
||||||
|
//GridRegion region = m_HypergridConnector.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GetRegionBy X
|
||||||
|
|
||||||
|
public GridRegion GetRegionByUUID(UUID regionID)
|
||||||
|
{
|
||||||
|
if (m_HyperlinkRegions.ContainsKey(regionID))
|
||||||
|
return m_HyperlinkRegions[regionID];
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridRegion GetRegionByPosition(int x, int y)
|
||||||
|
{
|
||||||
|
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||||
|
if (r.RegionLocX == x && r.RegionLocY == y)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridRegion GetRegionByName(string name)
|
||||||
|
{
|
||||||
|
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||||
|
if (r.RegionName.ToLower() == name.ToLower())
|
||||||
|
return r;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GridRegion> GetRegionsByName(string name)
|
||||||
|
{
|
||||||
|
List<GridRegion> regions = new List<GridRegion>();
|
||||||
|
|
||||||
|
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||||
|
if ((r.RegionName != null) && r.RegionName.ToLower().StartsWith(name.ToLower()))
|
||||||
|
regions.Add(r);
|
||||||
|
|
||||||
|
return regions;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax)
|
||||||
|
{
|
||||||
|
List<GridRegion> regions = new List<GridRegion>();
|
||||||
|
|
||||||
|
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||||
|
if ((r.RegionLocX > xmin) && (r.RegionLocX < xmax) &&
|
||||||
|
(r.RegionLocY > ymin) && (r.RegionLocY < ymax))
|
||||||
|
regions.Add(r);
|
||||||
|
|
||||||
|
return regions;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Data;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.Base;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.HypergridService
|
||||||
|
{
|
||||||
|
public class HypergridServiceBase : ServiceBase
|
||||||
|
{
|
||||||
|
protected IRegionData m_Database = null;
|
||||||
|
|
||||||
|
public HypergridServiceBase(IConfigSource config)
|
||||||
|
: base(config)
|
||||||
|
{
|
||||||
|
string dllName = String.Empty;
|
||||||
|
string connString = String.Empty;
|
||||||
|
string realm = "TBD";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try reading the [DatabaseService] section, if it exists
|
||||||
|
//
|
||||||
|
IConfig dbConfig = config.Configs["DatabaseService"];
|
||||||
|
if (dbConfig != null)
|
||||||
|
{
|
||||||
|
if (dllName == String.Empty)
|
||||||
|
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
||||||
|
if (connString == String.Empty)
|
||||||
|
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// [HypergridService] section overrides [DatabaseService], if it exists
|
||||||
|
//
|
||||||
|
IConfig gridConfig = config.Configs["HypergridService"];
|
||||||
|
if (gridConfig != null)
|
||||||
|
{
|
||||||
|
dllName = gridConfig.GetString("StorageProvider", dllName);
|
||||||
|
connString = gridConfig.GetString("ConnectionString", connString);
|
||||||
|
realm = gridConfig.GetString("Realm", realm);
|
||||||
|
}
|
||||||
|
|
||||||
|
////
|
||||||
|
//// We tried, but this doesn't exist. We can't proceed.
|
||||||
|
////
|
||||||
|
//if (dllName.Equals(String.Empty))
|
||||||
|
// throw new Exception("No StorageProvider configured");
|
||||||
|
|
||||||
|
//m_Database = LoadPlugin<IRegionData>(dllName, new Object[] { connString, realm });
|
||||||
|
//if (m_Database == null)
|
||||||
|
// throw new Exception("Could not find a storage interface in the given module");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IGatekeeperService
|
||||||
|
{
|
||||||
|
bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason);
|
||||||
|
GridRegion GetHyperlinkRegion(UUID regionID);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IHypergridService
|
||||||
|
{
|
||||||
|
bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason);
|
||||||
|
GridRegion GetHyperlinkRegion(UUID regionID);
|
||||||
|
|
||||||
|
GridRegion GetRegionByUUID(UUID regionID);
|
||||||
|
GridRegion GetRegionByPosition(int x, int y);
|
||||||
|
GridRegion GetRegionByName(string name);
|
||||||
|
List<GridRegion> GetRegionsByName(string name);
|
||||||
|
List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax);
|
||||||
|
}
|
||||||
|
}
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
///
|
///
|
||||||
/// <param name="agent"></param>
|
/// <param name="agent"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override bool AuthenticateUser(AgentCircuitData agent, out string reason)
|
public override bool VerifyUserPresence(AgentCircuitData agent, out string reason)
|
||||||
{
|
{
|
||||||
reason = String.Empty;
|
reason = String.Empty;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -63,9 +63,22 @@
|
||||||
[GridService]
|
[GridService]
|
||||||
; for the HGGridServicesConnector to instantiate
|
; for the HGGridServicesConnector to instantiate
|
||||||
GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:LocalGridServicesConnector"
|
GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:LocalGridServicesConnector"
|
||||||
|
HypergridService = "OpenSim.Services.HypergridService.dll:HypergridService"
|
||||||
; LocalGridServicesConnector needs this
|
; LocalGridServicesConnector needs this
|
||||||
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
|
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
|
||||||
Realm = "regions"
|
Realm = "regions"
|
||||||
|
|
||||||
|
[HypergridService]
|
||||||
|
GridService = "OpenSim.Region.CoreModules.dll:LocalGridServicesConnector"
|
||||||
|
AssetService = "OpenSim.Services.AssetService.dll:AssetService"
|
||||||
|
|
||||||
|
[GatekeeperService]
|
||||||
|
LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService"
|
||||||
|
;; for the service
|
||||||
|
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||||
|
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||||
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
|
AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector"
|
||||||
|
|
||||||
[PresenceService]
|
[PresenceService]
|
||||||
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||||
|
|
32
prebuild.xml
32
prebuild.xml
|
@ -1193,6 +1193,38 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
<Project frameworkVersion="v3_5" name="OpenSim.Services.HypergridService" path="OpenSim/Services/HypergridService" type="Library">
|
||||||
|
<Configuration name="Debug">
|
||||||
|
<Options>
|
||||||
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
</Options>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration name="Release">
|
||||||
|
<Options>
|
||||||
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
</Options>
|
||||||
|
</Configuration>
|
||||||
|
|
||||||
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
|
<Reference name="System"/>
|
||||||
|
<Reference name="System.Xml"/>
|
||||||
|
<Reference name="OpenMetaverseTypes.dll"/>
|
||||||
|
<Reference name="OpenMetaverse.dll"/>
|
||||||
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
|
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||||
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
<Reference name="OpenSim.Services.Base"/>
|
||||||
|
<Reference name="OpenSim.Services.Connectors"/>
|
||||||
|
<Reference name="OpenSim.Data"/>
|
||||||
|
<Reference name="OpenSim.Server.Base"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
|
<Reference name="log4net.dll"/>
|
||||||
|
|
||||||
|
<Files>
|
||||||
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
||||||
|
|
||||||
|
|
||||||
<Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library">
|
<Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library">
|
||||||
|
|
Loading…
Reference in New Issue