コード例 #1
0
        public override void RegionLoaded(Scene scene)
        {
            base.RegionLoaded(scene);

            if (m_Enabled)
                m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
        }
コード例 #2
0
        public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector)
        {
            // Let's set this always, because we don't know the sequence
            // of instantiations
            if (friendsConnector != null)
            {
                m_FriendsLocalSimConnector = friendsConnector;
            }

            if (!m_Initialized)
            {
                m_Initialized = true;

                m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");

                m_FriendsSimConnector = new FriendsSimConnector();

                IConfig serverConfig = config.Configs["UserAgentService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section UserAgentService in config file"));
                }

                string gridService        = serverConfig.GetString("GridService", String.Empty);
                string gridUserService    = serverConfig.GetString("GridUserService", String.Empty);
                string gatekeeperService  = serverConfig.GetString("GatekeeperService", String.Empty);
                string friendsService     = serverConfig.GetString("FriendsService", String.Empty);
                string presenceService    = serverConfig.GetString("PresenceService", String.Empty);
                string userAccountService = serverConfig.GetString("UserAccountService", String.Empty);

                m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);

                if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
                {
                    throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
                }

                Object[] args = new Object[] { config };
                m_GridService         = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_GridUserService     = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                m_GatekeeperConnector = new GatekeeperServiceConnector();
                m_GatekeeperService   = ServerUtils.LoadPlugin <IGatekeeperService>(gatekeeperService, args);
                m_FriendsService      = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
                m_PresenceService     = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
                m_UserAccountService  = ServerUtils.LoadPlugin <IUserAccountService>(userAccountService, args);

                m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_GridName == string.Empty)
                {
                    serverConfig = config.Configs["GatekeeperService"];
                    m_GridName   = serverConfig.GetString("ExternalName", string.Empty);
                }
                if (!m_GridName.EndsWith("/"))
                {
                    m_GridName = m_GridName + "/";
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Tries to teleport agent to landmark.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
        {
            m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
                              (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);

            if (lm.Gatekeeper == string.Empty)
            {
                base.RequestTeleportLandmark(remoteClient, lm);
                return;
            }

            GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);

            // Local region?
            if (info != null)
            {
                ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
                                                                      Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
            }
            else
            {
                // Foreign region
                Scene scene = (Scene)(remoteClient.Scene);
                GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                GridRegion gatekeeper            = new GridRegion();
                gatekeeper.ServerURI = lm.Gatekeeper;
                string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);

                string     message;
                GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out message);

                if (finalDestination != null)
                {
                    ScenePresence         sp          = scene.GetScenePresence(remoteClient.AgentId);
                    IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();

                    if (transferMod != null && sp != null)
                    {
                        if (message != null)
                        {
                            sp.ControllingClient.SendAgentAlertMessage(message, true);
                        }

                        transferMod.DoTeleport(
                            sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
                            (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                    }
                }
                else
                {
                    remoteClient.SendTeleportFailed(message);
                }
            }
        }
コード例 #4
0
 public override void RegionLoaded(Scene scene)
 {
     base.RegionLoaded(scene);
     if (m_Enabled)
     {
         if (!m_Initialized)
         {
             m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
             m_Initialized         = true;
         }
     }
 }
コード例 #5
0
        private void Lure(IClientAPI client, uint teleportflags, GridInstantMessage im)
        {
            Scene      scene    = client.Scene as Scene;
            UUID       regionID = new UUID(im.RegionID);
            GridRegion region   = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, regionID);

            if (region != null)
            {
                scene.RequestTeleportLocation(client, region.RegionHandle, im.Position + new Vector3(0.5f, 0.5f, 0f), Vector3.UnitX, teleportflags);
            }
            else // we don't have that region here. Check if it's HG
            {
                string[] parts = im.message.Split(new char[] { '@' });
                if (parts.Length > 1)
                {
                    string url = parts[parts.Length - 1]; // the last part
                    if (m_thisGridInfo.IsLocalGrid(url, true) == 0)
                    {
                        m_log.DebugFormat("[HG LURE MODULE]: Luring agent to grid {0} region {1} position {2}", url, im.RegionID, im.Position);
                        GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                        GridRegion gatekeeper            = new GridRegion();
                        gatekeeper.ServerURI = url;
                        string homeURI = scene.GetAgentHomeURI(client.AgentId);

                        string     message;
                        GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, regionID, client.AgentId, homeURI, out message);
                        if (finalDestination != null)
                        {
                            ScenePresence         sp          = scene.GetScenePresence(client.AgentId);
                            IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();

                            if (transferMod != null && sp != null)
                            {
                                if (message != null)
                                {
                                    sp.ControllingClient.SendAgentAlertMessage(message, true);
                                }

                                transferMod.DoTeleport(
                                    sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
                                    Vector3.UnitX, teleportflags);
                            }
                        }
                        else
                        {
                            m_log.InfoFormat("[HG LURE MODULE]: Lure failed: {0}", message);
                            client.SendAgentAlertMessage(message, true);
                        }
                    }
                }
            }
        }
コード例 #6
0
        public override void RegionLoaded(Scene scene)
        {
            base.RegionLoaded(scene);

            if (m_Enabled)
            {
                m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
                m_UAS = scene.RequestModuleInterface <IUserAgentService>();
                if (m_UAS == null)
                {
                    m_UAS = new UserAgentServiceConnector(m_thisGridInfo.HomeURL);
                }
            }
        }
コード例 #7
0
        public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
        {
            m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());

            m_Database    = db;
            m_GridService = gridService;

            IConfig gridConfig = config.Configs["GridService"];

            if (gridConfig != null)
            {
                string assetService = gridConfig.GetString("AssetService", string.Empty);

                Object[] args = new Object[] { config };

                if (assetService != string.Empty)
                {
                    m_AssetService = ServerUtils.LoadPlugin <IAssetService>(assetService, args);
                }

                string scope = gridConfig.GetString("ScopeID", string.Empty);
                if (scope != string.Empty)
                {
                    UUID.TryParse(scope, out m_ScopeID);
                }

                m_Check4096 = gridConfig.GetBoolean("Check4096", true);

                m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);

                m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services...");
            }

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
                                                         "Link a hypergrid region", RunCommand);
                MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
                                                         "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
                                                         "Unlink a hypergrid region", RunCommand);
                MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
                                                         "Set local coordinate to map HG regions to", RunCommand);
                MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks <cr>",
                                                         "List the HG regions", HandleShow);
            }
        }
コード例 #8
0
        /// <summary>
        /// Tries to teleport agent to landmark.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
        {
            m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
                              (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
            if (lm.Gatekeeper == string.Empty)
            {
                base.RequestTeleportLandmark(remoteClient, lm);
                return;
            }

            GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);

            // Local region?
            if (info != null)
            {
                ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
                                                                      Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                return;
            }
            else
            {
                // Foreign region
                Scene scene = (Scene)(remoteClient.Scene);
                GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                GridRegion gatekeeper            = new GridRegion();
                gatekeeper.ServerURI = lm.Gatekeeper;
                GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID));
                if (finalDestination != null)
                {
                    ScenePresence         sp          = scene.GetScenePresence(remoteClient.AgentId);
                    IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();
                    IEventQueue           eq          = sp.Scene.RequestModuleInterface <IEventQueue>();
                    if (transferMod != null && sp != null && eq != null)
                    {
                        transferMod.DoTeleport(sp, gatekeeper, finalDestination, lm.Position,
                                               Vector3.UnitX, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark), eq);
                    }
                }
            }

            // can't find the region: Tell viewer and abort
            remoteClient.SendTeleportFailed("The teleport destination could not be found.");
        }
コード例 #9
0
        public UserAgentService(IConfigSource config)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");

                IConfig serverConfig = config.Configs["UserAgentService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section UserAgentService in config file"));
                }

                string gridService       = serverConfig.GetString("GridService", String.Empty);
                string gridUserService   = serverConfig.GetString("GridUserService", String.Empty);
                string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);

                m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);

                if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
                {
                    throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
                }

                Object[] args = new Object[] { config };
                m_GridService         = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_GridUserService     = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                m_GatekeeperConnector = new GatekeeperServiceConnector();
                m_GatekeeperService   = ServerUtils.LoadPlugin <IGatekeeperService>(gatekeeperService, args);

                m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_GridName == string.Empty)
                {
                    serverConfig = config.Configs["GatekeeperService"];
                    m_GridName   = serverConfig.GetString("ExternalName", string.Empty);
                }
                if (!m_GridName.EndsWith("/"))
                {
                    m_GridName = m_GridName + "/";
                }
            }
        }
コード例 #10
0
        private void Lure(IClientAPI client, uint teleportflags, GridInstantMessage im)
        {
            Scene      scene  = (Scene)(client.Scene);
            GridRegion region = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, new UUID(im.RegionID));

            if (region != null)
            {
                scene.RequestTeleportLocation(client, region.RegionHandle, im.Position + new Vector3(0.5f, 0.5f, 0f), Vector3.UnitX, teleportflags);
            }
            else // we don't have that region here. Check if it's HG
            {
                string[] parts = im.message.Split(new char[] { '@' });
                if (parts.Length > 1)
                {
                    string url = parts[parts.Length - 1]; // the last part
                    if (url.Trim(new char[] { '/' }) != m_ThisGridURL.Trim(new char[] { '/' }))
                    {
                        m_log.DebugFormat("[HG LURE MODULE]: Luring agent to grid {0} region {1} position {2}", url, im.RegionID, im.Position);
                        GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                        GridRegion gatekeeper            = new GridRegion();
                        gatekeeper.ServerURI = url;
                        GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(im.RegionID));
                        if (finalDestination != null)
                        {
                            ScenePresence         sp          = scene.GetScenePresence(client.AgentId);
                            IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();

                            if (transferMod != null && sp != null)
                            {
                                transferMod.DoTeleport(
                                    sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
                                    Vector3.UnitX, teleportflags);
                            }
                        }
                    }
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Tries to teleport agent to landmark.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt)
        {
            m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
                              (string.IsNullOrEmpty(lm.Gatekeeper)) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);

            ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId);

            if (sp == null || sp.IsDeleted || sp.IsInTransit || sp.IsChildAgent || sp.IsNPC)
            {
                return;
            }

            GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);

            // Local region?
            if (info != null)
            {
                //check if region on same position and fix local offset
                if (Util.CompareRegionHandles(lm.RegionHandle, lm.Position, info.RegionLocX, info.RegionLocY, info.RegionSizeX, info.RegionSizeY, out Vector3 offset))
                {
                    Scene.RequestTeleportLocation(remoteClient, info.RegionHandle, offset,
                                                  lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                }
                else //region may had move to other grid slot. assume the lm position is good
                {
                    Scene.RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
                                                  lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                }
                return;
            }

            if (string.IsNullOrEmpty(lm.Gatekeeper))
            {
                remoteClient.SendTeleportFailed("Landmark region not found");
                return;
            }

            // Foreign region
            GridRegion gatekeeper = MakeGateKeeperRegion(lm.Gatekeeper);

            if (gatekeeper == null)
            {
                remoteClient.SendTeleportFailed("Could not parse landmark destiny gatekeeper");
                return;
            }

            string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);

            GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
            GridRegion finalDestination      = gConn.GetHyperlinkRegion(gatekeeper, lm.RegionID, remoteClient.AgentId, homeURI, out string message);

            if (finalDestination == null)
            {
                remoteClient.SendTeleportFailed(message);
            }

            // Validate assorted conditions
            if (!ValidateGenericConditions(sp, gatekeeper, finalDestination, 0, out string reason))
            {
                remoteClient.SendTeleportFailed(reason);
                return;
            }

            if (Util.CompareRegionHandles(lm.RegionHandle, lm.Position, finalDestination.RegionLocX, finalDestination.RegionLocY,
                                          finalDestination.RegionSizeX, finalDestination.RegionSizeY, out Vector3 roffset))
            {
                DoTeleport(sp, gatekeeper, finalDestination, roffset, lookAt,
                           (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                return;
            }
            remoteClient.SendTeleportFailed("landmark region not found");
        }
コード例 #12
0
        public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector)
            : base(config)
        {
            // Let's set this always, because we don't know the sequence
            // of instantiations
            if (friendsConnector != null)
            {
                m_FriendsLocalSimConnector = friendsConnector;
            }

            if (!m_Initialized)
            {
                m_Initialized = true;

                m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");

                m_FriendsSimConnector = new FriendsSimConnector();

                IConfig serverConfig = config.Configs["UserAgentService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section UserAgentService in config file"));
                }

                string gridService        = serverConfig.GetString("GridService", String.Empty);
                string gridUserService    = serverConfig.GetString("GridUserService", String.Empty);
                string gatekeeperService  = serverConfig.GetString("GatekeeperService", String.Empty);
                string friendsService     = serverConfig.GetString("FriendsService", String.Empty);
                string presenceService    = serverConfig.GetString("PresenceService", String.Empty);
                string userAccountService = serverConfig.GetString("UserAccountService", String.Empty);

                m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);

                if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
                {
                    throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
                }

                Object[] args = new Object[] { config };
                m_GridService         = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_GridUserService     = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                m_GatekeeperConnector = new GatekeeperServiceConnector();
                m_GatekeeperService   = ServerUtils.LoadPlugin <IGatekeeperService>(gatekeeperService, args);
                m_FriendsService      = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
                m_PresenceService     = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
                m_UserAccountService  = ServerUtils.LoadPlugin <IUserAccountService>(userAccountService, args);

                m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);
                m_ShowDetails          = serverConfig.GetBoolean("ShowUserDetailsInHGProfile", true);

                LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed");
                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);

                m_GridName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                    new string[] { "Startup", "Hypergrid", "UserAgentService" }, String.Empty);
                if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon.
                {
                    m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                    if (m_GridName == string.Empty)
                    {
                        serverConfig = config.Configs["GatekeeperService"];
                        m_GridName   = serverConfig.GetString("ExternalName", string.Empty);
                    }
                }

                if (!string.IsNullOrEmpty(m_GridName))
                {
                    m_GridName = m_GridName.ToLowerInvariant();
                    if (!m_GridName.EndsWith("/"))
                    {
                        m_GridName = m_GridName + "/";
                    }
                    Uri gateURI;
                    if (!Uri.TryCreate(m_GridName, UriKind.Absolute, out gateURI))
                    {
                        throw new Exception(String.Format("[UserAgentService] could not parse gatekeeper uri"));
                    }
                    string    host = gateURI.DnsSafeHost;
                    IPAddress ip   = Util.GetHostFromDNS(host);
                    if (ip == null)
                    {
                        throw new Exception(String.Format("[UserAgentService] failed to resolve gatekeeper host"));
                    }
                    m_MyExternalIP = ip.ToString();
                }
                // Finally some cleanup
                m_Database.DeleteOld();
            }
        }
コード例 #13
0
ファイル: HypergridLinker.cs プロジェクト: wgahnagl/opensim
        public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
        {
            IConfig gridConfig = config.Configs["GridService"];

            if (gridConfig == null)
            {
                return;
            }

            if (!gridConfig.GetBoolean("HypergridLinker", false))
            {
                return;
            }

            m_Database    = db;
            m_GridService = gridService;
            m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());

            string assetService = gridConfig.GetString("AssetService", string.Empty);

            Object[] args = new Object[] { config };

            if (assetService != string.Empty)
            {
                m_AssetService = ServerUtils.LoadPlugin <IAssetService>(assetService, args);
            }

            string scope = gridConfig.GetString("ScopeID", string.Empty);

            if (scope != string.Empty)
            {
                UUID.TryParse(scope, out m_ScopeID);
            }

//                m_Check4096 = gridConfig.GetBoolean("Check4096", true);

            m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");

            m_ThisGridInfo = new GridInfo(config);
            if (!m_ThisGridInfo.HasHGConfig)
            {
                throw new Exception("missing HyperGrid configuration");
            }

            m_log.DebugFormat("[HYPERGRID LINKER]: Local Gatekeeper: {0}", m_ThisGridInfo.GateKeeperURL);

            m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);

            m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");

            if (!string.IsNullOrEmpty(m_MapTileDirectory))
            {
                try
                {
                    Directory.CreateDirectory(m_MapTileDirectory);
                }
                catch (Exception e)
                {
                    m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e);
                    m_MapTileDirectory = string.Empty;
                }
            }

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]",
                                                         "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
                                                         "Link a hypergrid region (deprecated)", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "unlink-region",
                                                         "unlink-region <local name>",
                                                         "Unlink a hypergrid region", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-mapping", "link-mapping [<x> <y>]",
                                                         "Set local coordinate to map HG regions to", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "show hyperlinks", "show hyperlinks",
                                                         "List the HG regions", HandleShow);
            }
        }
コード例 #14
0
        /// <summary>
        /// Tries to teleport agent to landmark.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
        {
            m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
                              (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);

            if (lm.Gatekeeper == string.Empty)
            {
                base.RequestTeleportLandmark(remoteClient, lm);
                return;
            }

            GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);

            // Local region?
            if (info != null)
            {
                Scene.RequestTeleportLocation(
                    remoteClient, info.RegionHandle, lm.Position,
                    Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
            }
            else
            {
                // Foreign region
                GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                GridRegion gatekeeper            = MakeGateKeeperRegion(lm.Gatekeeper);
                if (gatekeeper == null)
                {
                    remoteClient.SendTeleportFailed("Could not parse landmark destiny URI");
                    return;
                }

                string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);

                GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out string message);

                if (finalDestination != null)
                {
                    ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId);

                    if (sp != null)
                    {
                        if (message != null)
                        {
                            sp.ControllingClient.SendAgentAlertMessage(message, true);
                        }

                        // Validate assorted conditions
                        string reason = string.Empty;
                        if (!ValidateGenericConditions(sp, gatekeeper, finalDestination, 0, out reason))
                        {
                            sp.ControllingClient.SendTeleportFailed(reason);
                            return;
                        }

                        DoTeleport(
                            sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
                            (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                    }
                }
                else
                {
                    remoteClient.SendTeleportFailed(message);
                }
            }
        }
コード例 #15
0
        public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
        {
            IConfig gridConfig = config.Configs["GridService"];

            if (gridConfig == null)
            {
                return;
            }

            if (!gridConfig.GetBoolean("HypergridLinker", false))
            {
                return;
            }

            m_Database    = db;
            m_GridService = gridService;
            m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());

            string assetService = gridConfig.GetString("AssetService", string.Empty);

            Object[] args = new Object[] { config };

            if (assetService != string.Empty)
            {
                m_AssetService = ServerUtils.LoadPlugin <IAssetService>(assetService, args);
            }

            string scope = gridConfig.GetString("ScopeID", string.Empty);

            if (scope != string.Empty)
            {
                UUID.TryParse(scope, out m_ScopeID);
            }

//                m_Check4096 = gridConfig.GetBoolean("Check4096", true);

            m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");

            m_ThisGatekeeperURI = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                         new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
            m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI);

            if (!Util.checkServiceURI(m_ThisGatekeeperURI, out m_ThisGatekeeperURI, out m_ThisGatekeeperHost, out m_ThisGateKeeperIP))
            {
                m_log.ErrorFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeperURI);
                throw new Exception("Failed to resolve gatekeeper external IP, please check GatekeeperURI configuration");
            }

            string gatekeeperURIAlias = Util.GetConfigVarFromSections <string>(config, "GatekeeperURIAlias",
                                                                               new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);

            if (!string.IsNullOrWhiteSpace(gatekeeperURIAlias))
            {
                string[] alias = gatekeeperURIAlias.Split(',');
                for (int i = 0; i < alias.Length; ++i)
                {
                    if (!string.IsNullOrWhiteSpace(alias[i]))
                    {
                        m_ThisGateKeeperAlias.Add(alias[i].Trim().ToLower());
                    }
                }
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);

            m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");

            if (!string.IsNullOrEmpty(m_MapTileDirectory))
            {
                try
                {
                    Directory.CreateDirectory(m_MapTileDirectory);
                }
                catch (Exception e)
                {
                    m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e);
                    m_MapTileDirectory = string.Empty;
                }
            }

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]",
                                                         "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
                                                         "Link a hypergrid region (deprecated)", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "unlink-region",
                                                         "unlink-region <local name>",
                                                         "Unlink a hypergrid region", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-mapping", "link-mapping [<x> <y>]",
                                                         "Set local coordinate to map HG regions to", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "show hyperlinks", "show hyperlinks",
                                                         "List the HG regions", HandleShow);
            }
        }
コード例 #16
0
        public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
        {
            IConfig gridConfig = config.Configs["GridService"];

            if (gridConfig == null)
            {
                return;
            }

            if (!gridConfig.GetBoolean("HypergridLinker", false))
            {
                return;
            }

            m_Database    = db;
            m_GridService = gridService;
            m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());

            string assetService = gridConfig.GetString("AssetService", string.Empty);

            Object[] args = new Object[] { config };

            if (assetService != string.Empty)
            {
                m_AssetService = ServerUtils.LoadPlugin <IAssetService>(assetService, args);
            }

            string scope = gridConfig.GetString("ScopeID", string.Empty);

            if (scope != string.Empty)
            {
                UUID.TryParse(scope, out m_ScopeID);
            }

//                m_Check4096 = gridConfig.GetBoolean("Check4096", true);

            m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");

            m_ThisGatekeeper = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                      new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
            // Legacy. Remove soon!
            m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
            try
            {
                m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
            }
            catch
            {
                m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
            }

            m_ThisGatekeeper = m_ThisGatekeeperURI.AbsoluteUri;
            if (m_ThisGatekeeperURI.Port == 80)
            {
                m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) + ":80/";
            }
            else if (m_ThisGatekeeperURI.Port == 443)
            {
                m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) + ":443/";
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);

            m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");

            if (!string.IsNullOrEmpty(m_MapTileDirectory))
            {
                try
                {
                    Directory.CreateDirectory(m_MapTileDirectory);
                }
                catch (Exception e)
                {
                    m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e);
                    m_MapTileDirectory = string.Empty;
                }
            }

            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]",
                                                         "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region",
                                                         "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
                                                         "Link a hypergrid region (deprecated)", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "unlink-region",
                                                         "unlink-region <local name>",
                                                         "Unlink a hypergrid region", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-mapping", "link-mapping [<x> <y>]",
                                                         "Set local coordinate to map HG regions to", RunCommand);
                MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "show hyperlinks", "show hyperlinks",
                                                         "List the HG regions", HandleShow);
            }
        }
コード例 #17
0
//        IConfig m_ClientsConfig;

        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
            {
                throw new Exception(String.Format("No section LoginService in config file"));
            }

            string accountService    = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService   = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService      = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService       = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService        = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService       = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService   = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService        = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService    = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService     = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName        = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage           = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory         = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel            = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL            = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                                new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
            m_MapTileURL       = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_ProfileURL       = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
            m_OpenIDURL        = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
            m_SearchURL        = m_LoginServerConfig.GetString("SearchURL", string.Empty);
            m_Currency         = m_LoginServerConfig.GetString("Currency", string.Empty);
            m_ClassifiedFee    = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty);
            m_DestinationGuide = m_LoginServerConfig.GetString("DestinationGuide", string.Empty);
            m_AvatarPicker     = m_LoginServerConfig.GetString("AvatarPicker", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients  = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");

            // Clean up some of these vars
            if (m_MapTileURL != String.Empty)
            {
                m_MapTileURL = m_MapTileURL.Trim();
                if (!m_MapTileURL.EndsWith("/"))
                {
                    m_MapTileURL = m_MapTileURL + "/";
                }
            }

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
            {
                throw new Exception("LoginService is missing service specifications");
            }

            // replace newlines in welcome message
            m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n");

            Object[] args = new Object[] { config };
            m_UserAccountService    = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
            m_GridUserService       = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin <IAuthenticationService>(authService, args);
            m_InventoryService      = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }
            if (presenceService != string.Empty)
            {
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
            }
            if (avatarService != string.Empty)
            {
                m_AvatarService = ServerUtils.LoadPlugin <IAvatarService>(avatarService, args);
            }
            if (friendsService != string.Empty)
            {
                m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
            }
            if (simulationService != string.Empty)
            {
                m_RemoteSimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
            }
            if (agentService != string.Empty)
            {
                m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(agentService, args);
            }

            // Get the Hypergrid inventory service (exists only if Hypergrid is enabled)
            string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);

            if (hgInvServicePlugin != string.Empty)
            {
                string   hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
                Object[] args2           = new Object[] { config, hgInvServiceArg };
                m_HGInventoryService = ServerUtils.LoadPlugin <IInventoryService>(hgInvServicePlugin, args2);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin <ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
コード例 #18
0
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
            {
                throw new Exception(String.Format("No section LoginService in config file"));
            }

            string accountService    = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService   = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService      = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService       = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService        = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService       = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService   = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService        = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService    = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService     = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName        = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage           = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory         = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel            = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL            = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_SearchURL  = m_LoginServerConfig.GetString("SearchURL", string.Empty);

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
            {
                throw new Exception("LoginService is missing service specifications");
            }

            Object[] args = new Object[] { config };
            m_UserAccountService    = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
            m_GridUserService       = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin <IAuthenticationService>(authService, args);
            m_InventoryService      = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }
            if (presenceService != string.Empty)
            {
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
            }
            if (avatarService != string.Empty)
            {
                m_AvatarService = ServerUtils.LoadPlugin <IAvatarService>(avatarService, args);
            }
            if (friendsService != string.Empty)
            {
                m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
            }
            if (simulationService != string.Empty)
            {
                m_RemoteSimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
            }
            if (agentService != string.Empty)
            {
                m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(agentService, args);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin <ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }