Пример #1
0
        /// <summary>
        /// Resolve an OSPI name by querying existing persistent user profiles.  If there is no persistent user profile
        /// then a temporary user profile is inserted in the cache.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="commsManager"></param>
        /// <returns>
        /// An OpenSim internal identifier for the name given.  Returns null if the name was not valid
        /// </returns>
        protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager)
        {
            int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);

            if (nameSeparatorIndex < 0)
            {
                m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
                return(UUID.Zero);
            }

            string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
            string lastName  = name.Substring(nameSeparatorIndex + 1).TrimStart();

            UUID uuid = commsManager.UserService.Name2Key(firstName, lastName);

            if (uuid != UUID.Zero)
            {
                return(uuid);
            }

            UserProfileData tempUserProfile = new UserProfileData();

            tempUserProfile.FirstName = firstName;
            tempUserProfile.SurName   = lastName;
            tempUserProfile.ID        = HashName(tempUserProfile.Name);

            m_log.DebugFormat(
                "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
            commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);

            return(tempUserProfile.ID);
        }
Пример #2
0
        /// <summary>
        /// Resolve an osp string into the most suitable internal OpenSim identifier.
        /// </summary>
        ///
        /// In some cases this will be a UUID if a suitable profile exists on the system.  In other cases, this may
        /// just return the same identifier after creating a temporary profile.
        ///
        /// <param name="ospa"></param>
        /// <param name="commsManager"></param>
        /// <returns>
        /// A suitable UUID for use in Second Life client communication.  If the string was not a valid ospa, then UUID.Zero
        /// is returned.
        /// </returns>
        public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager)
        {
            if (!ospa.StartsWith(OSPA_PREFIX))
            {
                return(UUID.Zero);
            }

            m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);

            string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);

            string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);

            foreach (string tuple in ospaTuples)
            {
                int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR);

                if (tupleSeparatorIndex < 0)
                {
                    m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
                    continue;
                }

                string key   = tuple.Remove(tupleSeparatorIndex).Trim();
                string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();

                if (OSPA_NAME_KEY == key)
                {
                    return(ResolveOspaName(value, commsManager));
                }
            }

            return(UUID.Zero);
        }
Пример #3
0
        private bool PrepareSceneForConnection(UUID sessionId, UUID sceneId, UserProfileData userProfile, out string reason)
        {
            Scene scene = m_scenes[sceneId];
            CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
            UserManagerBase       userService  = (UserManagerBase)commsManager.UserService;

            AgentCircuitData agent = new AgentCircuitData();

            agent.AgentID         = userProfile.ID;
            agent.firstname       = userProfile.FirstName;
            agent.lastname        = userProfile.SurName;
            agent.SessionID       = sessionId;
            agent.SecureSessionID = userProfile.CurrentAgent.SecureSessionID;
            agent.circuitcode     = sessionId.CRC();
            agent.BaseFolder      = UUID.Zero;
            agent.InventoryFolder = UUID.Zero;
            agent.startpos        = new Vector3(0, 0, 0); // TODO Fill in region start position
            agent.CapsPath        = "http://localhost/";
            agent.Appearance      = userService.GetUserAppearance(userProfile.ID);

            if (agent.Appearance == null)
            {
                m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
                agent.Appearance = new AvatarAppearance();
            }

            return(scene.NewUserConnection(agent, out reason));
        }
Пример #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="commsManager"></param>
 /// <param name="userProfile"></param>
 public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile, List <FriendListItem> friendInfos)
 {
     m_commsManager = commsManager;
     m_userProfile  = userProfile;
     _friends       = friendInfos;
     this.IndexFriendPermissions();
 }
Пример #5
0
 /// <summary>
 /// User services used when OpenSim is running in standalone mode.
 /// </summary>
 /// <param name="defaultHomeLocX"></param>
 /// <param name="defaultHomeLocY"></param>
 /// <param name="commsManager"></param>
 public LocalUserServices(
     uint defaultHomeLocX, uint defaultHomeLocY, CommunicationsManager commsManager)
     : base(commsManager)
 {
     m_defaultHomeX = defaultHomeLocX;
     m_defaultHomeY = defaultHomeLocY;
 }
Пример #6
0
        /// <summary>
        /// Make an OSPA given a user UUID
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="commsManager"></param>
        /// <returns>The OSPA.  Null if a user with the given UUID could not be found.</returns>
        public static string MakeOspa(UUID userId, CommunicationsManager commsManager)
        {
            CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
            if (userInfo != null)
                return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName);

            return null;
        }
 public InventoryArchiveReadRequest(
     CachedUserInfo userInfo, string invPath, Stream loadStream, CommunicationsManager commsManager)
 {
     m_userInfo     = userInfo;
     m_invPath      = invPath;
     m_loadStream   = loadStream;
     m_commsManager = commsManager;
 }
Пример #8
0
 public static CommunicationsManager GetInstance()
 {
     if (_CommunicationsManager == null)
     {
         _CommunicationsManager = new CommunicationsManager();
     }
     return(_CommunicationsManager);
 }
Пример #9
0
 public void PostInitialise()
 {
     if (m_settings.Configs["Startup"].GetBoolean("gridmode", false))
     {
         m_com = m_scenes[0].CommsManager;
         m_com.HttpServer.AddXmlRPCHandler("grid_message", GridWideMessage);
     }
 }
Пример #10
0
 protected virtual void InitOnce(Scene scene)
 {
     m_localBackend = new LocalInterregionComms();
     m_commsManager = scene.CommsManager;
     m_aScene       = scene;
     m_regionClient = new RegionToRegionClient(m_aScene);
     m_thisIP       = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
 }
Пример #11
0
        /// <summary>
        /// Make an OSPA given a user UUID
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="commsManager"></param>
        /// <returns>The OSPA.  Null if a user with the given UUID could not be found.</returns>
        public static string MakeOspa(UUID userId, CommunicationsManager commsManager)
        {
            string firstName;
            string lastName;
            if (commsManager.UserService.Key2Names(userId, false, out firstName, out lastName))
                return MakeOspa(firstName, lastName);

            return null;
        }
Пример #12
0
 public InventoryArchiveReadRequest(
     CachedUserInfo userInfo, string invPath, string loadPath, CommunicationsManager commsManager)
     : this(
         userInfo,
         invPath,
         new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress),
         commsManager)
 {
 }
        /// <summary>
        /// Initializes the backend services for standalone mode, and registers some http handlers
        /// </summary>
        /// <param name="libraryRootFolder"></param>
        protected virtual void InitializeStandaloneServices(LibraryRootFolder libraryRootFolder)
        {
            m_commsManager
                = new CommunicationsLocal(
                      m_openSim.ConfigurationSettings, m_openSim.NetServersInfo,
                      m_httpServer, m_openSim.AssetCache, libraryRootFolder);

            CreateGridInfoService();
        }
Пример #14
0
 public TestScene(
     RegionInfo regInfo, AgentCircuitManager authen,
     CommunicationsManager commsMan, SceneCommunicationService sceneGridService, StorageManager storeManager,
     ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
     bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
     : base(regInfo, authen, commsMan, sceneGridService, storeManager, moduleLoader,
            dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion)
 {
 }
Пример #15
0
        public GameViewModel(IOptionsViewModel optionsViewModel)
        {
            this.optionsViewModel = optionsViewModel;
            Clients = new ObservableCollection <Client>();
            communicationsManager = new CommunicationsManager();

            communicationsManager.MessageReceived += CommunicationsManagerOnMessageReceived;

            communicationsManager.Start();
        }
Пример #16
0
        /// <summary>
        /// Make an OSPA given a user UUID
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="commsManager"></param>
        /// <returns>The OSPA.  Null if a user with the given UUID could not be found.</returns>
        public static string MakeOspa(UUID userId, CommunicationsManager commsManager)
        {
            CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);

            if (userInfo != null)
            {
                return(MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName));
            }

            return(null);
        }
Пример #17
0
        /// <summary>
        /// Create a test user with a standard inventory
        /// </summary>
        /// <param name="commsManager"></param>
        /// <param name="userId">Explicit user id to use for user creation</param>
        /// <returns></returns>
        public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager, UUID userId)
        {
            LocalUserServices lus = (LocalUserServices)commsManager.UserService;

            lus.AddUser("Bill", "Bailey", "troll", "*****@*****.**", 1000, 1000, userId);

            CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);

            userInfo.FetchInventory();

            return(userInfo);
        }
Пример #18
0
        /// <summary>
        /// Make an OSPA given a user UUID
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="commsManager"></param>
        /// <returns>The OSPA.  Null if a user with the given UUID could not be found.</returns>
        public static string MakeOspa(UUID userId, CommunicationsManager commsManager)
        {
            string firstName;
            string lastName;

            if (commsManager.UserService.Key2Names(userId, false, out firstName, out lastName))
            {
                return(MakeOspa(firstName, lastName));
            }

            return(null);
        }
Пример #19
0
        protected virtual void InitialiseGridServices(LibraryRootFolder libraryRootFolder)
        {
            m_commsManager
                = new CommunicationsOGS1(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, libraryRootFolder);

            m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
            m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
            if (m_openSim.userStatsURI != String.Empty)
            {
                m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
            }
        }
 public void btnUpdateStatistics_Click(System.Object sender, System.EventArgs e)
 {
     try
     {
         this.dgrdGeneralStatistics.DataSource   = CommunicationsManager.GetInstance().ComponentGeneralStatisticsTable(this.ComponentName);
         this.dgrdReceptionStatistics.DataSource = CommunicationsManager.GetInstance().ComponentDataReceptionStatisticsTable(this.ComponentName);
         this.dgrdRequestStatistics.DataSource   = CommunicationsManager.GetInstance().ComponentDataRequestsStatisticsTable(this.ComponentName);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        protected virtual void InitializeGridServices(LibraryRootFolder libraryRootFolder)
        {
            m_commsManager
                = new CommunicationsOGS1(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, libraryRootFolder,
                                         m_openSim.ConfigurationSettings);

            m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
            m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
            if (!String.IsNullOrEmpty(m_openSim.userStatsURI))
            {
                m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
            }
        }
Пример #22
0
        public HGScene(RegionInfo regInfo, AgentCircuitManager authen,
                       CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
                       StorageManager storeManager,
                       ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
                       bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
            : base(regInfo, authen, commsMan, sceneGridService, storeManager, moduleLoader,
                   dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion)
        {
            m_log.Info("[HGScene]: Starting HGScene.");
            m_assMapper = new HGAssetMapper(this);

            EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
        }
Пример #23
0
        protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder)
        {
            HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager);

            m_commsManager
                = new HGCommunicationsStandalone(
                      m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache,
                      gridService,
                      libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);

            HGServices = gridService;

            CreateGridInfoService();
        }
Пример #24
0
        public void SetUpLoginEnviroment()
        {
            m_capsEndPoint    = new IPEndPoint(IPAddress.Loopback, 9123);
            m_commsManager    = new TestCommunicationsManager(new NetworkServersInfo(42, 43));
            m_regionConnector = new TestLoginToRegionConnector();

            m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName));

            m_localUserServices = (LocalUserServices)m_commsManager.UserService;
            m_localUserServices.AddUser(m_firstName, m_lastName, "boingboing", "*****@*****.**", 42, 43);

            m_loginService = new LLStandaloneLoginService((UserManagerBase)m_localUserServices, "Hello folks", new TestInventoryService(),
                                                          m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector);

            m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName);
        }
Пример #25
0
        public void SetUpLoginEnviroment()
        {
            m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123);
            m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43));
            m_regionConnector = new TestLoginToRegionConnector();

            m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName));

            m_localUserServices = (LocalUserServices) m_commsManager.UserService;
            m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","*****@*****.**",42,43);

            m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(),
                  m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector);

            m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName);
        }
Пример #26
0
        /// <summary>
        /// Test replication of an archive path to the user's inventory.
        /// </summary>
        //[Test]
        public void TestReplicateArchivePathToUserInventory()
        {
            TestHelper.InMethod();
            Scene scene = SceneSetupHelpers.SetupScene(false);
            CommunicationsManager commsManager = scene.CommsManager;

            CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);

            userInfo.FetchInventory();
            for (int i = 0; i < 50; i++)
            {
                if (userInfo.HasReceivedInventory == true)
                {
                    break;
                }
                Thread.Sleep(200);
            }
            Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
            Dictionary <string, InventoryFolderImpl> foldersCreated = new Dictionary <string, InventoryFolderImpl>();
            List <InventoryNodeBase> nodesLoaded = new List <InventoryNodeBase>();

            string folder1Name = "a";
            string folder2Name = "b";
            string itemName    = "c.lsl";

            string folder1ArchiveName
                = string.Format(
                      "{0}{1}{2}", folder1Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
            string folder2ArchiveName
                = string.Format(
                      "{0}{1}{2}", folder2Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
            string itemArchivePath
                = string.Format(
                      "{0}{1}/{2}/{3}",
                      ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName);

            new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null)
            .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);

            InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");

            Assert.That(folder1, Is.Not.Null, "Could not find folder a");
            InventoryFolderImpl folder2 = folder1.FindFolderByPath("b");

            Assert.That(folder2, Is.Not.Null, "Could not find folder b");
        }
Пример #27
0
        private void AttachUserAgentToUserProfile(Session session, UUID sessionId, UUID sceneId, UserProfileData userProfile)
        {
            //Scene scene = m_scenes[sceneId];
            CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
            IUserService          userService  = (IUserService)commsManager.UserService;

            UserAgentData agent = new UserAgentData();

            // User connection
            agent.AgentOnline = true;
            agent.AgentIP     = session.RemoteEndPoint.Address.ToString();
            agent.AgentPort   = (uint)session.RemoteEndPoint.Port;

            agent.SecureSessionID = UUID.Random();
            agent.SessionID       = sessionId;

            // Profile UUID
            agent.ProfileID = userProfile.ID;

            // Current location/position/alignment
            if (userProfile.CurrentAgent != null)
            {
                agent.Region   = userProfile.CurrentAgent.Region;
                agent.Handle   = userProfile.CurrentAgent.Handle;
                agent.Position = userProfile.CurrentAgent.Position;
                agent.LookAt   = userProfile.CurrentAgent.LookAt;
            }
            else
            {
                agent.Region   = userProfile.HomeRegionID;
                agent.Handle   = userProfile.HomeRegion;
                agent.Position = userProfile.HomeLocation;
                agent.LookAt   = userProfile.HomeLookAt;
            }

            // What time did the user login?
            agent.LoginTime  = Util.UnixTimeSinceEpoch();
            agent.LogoutTime = 0;

            userProfile.CurrentAgent = agent;


            userService.UpdateUserProfile(userProfile);
            //userService.CommitAgent(ref userProfile);
        }
        private void _communicationsManager_EventFromServer(object sender, ResponseFromServerEventArgs e)
        {
            InvokeUI(delegate
            {
                ResponseFromServerEventArgs.ServerResponseStatus status = e.Status;
                switch (status)
                {
                case ResponseFromServerEventArgs.ServerResponseStatus.Empty:
                    break;

                default:
                    if ((uint)(status - 10) <= 1u)
                    {
                        _frmUser.SpinnerEnabled = false;
                        if (_communicationsManager.CurrentStatus != WorkflowStatus.SignOutSent)
                        {
                            MessageBox.Show(this, e.Receipt.Text, "Fejl i elev ID", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            CreateContextMenu();
                            _communicationsManager = new CommunicationsManager();
                            _communicationsManager.EventFromServer += _communicationsManager_EventFromServer;
                            _communicationsManager.TimeToStop      += _communicationsManager_TimeToStop;
                            StudentId = null;
                        }
                    }
                    else
                    {
                        MessageBox.Show(this, e.Receipt.Text, "Message from server", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    break;

                case ResponseFromServerEventArgs.ServerResponseStatus.SuccessfulLogin:
                    _frmUser.SpinnerEnabled            = false;
                    _frmUser.ClosingFromExternalSource = true;
                    _frmUser.Close();
                    _statusbar.StudentId = "Eksamenskode: " + StudentId;
                    SubscribeToActiveWindowChangedTool();
                    if (_communicationsManager.Receiver.IsInternalCGITestMode)
                    {
                        MessageBox.Show(this, e.Receipt.Text, "Message from server", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    break;
                }
            });
        }
 public void frmAvailableComponents_Load(System.Object sender, System.EventArgs e)
 {
     try
     {
         CommunicationsManager comsMan = CommunicationsManager.GetInstance();
         DataTable             dt      = comsMan.CNDTable;
         DataRow     row           = default(DataRow);
         IEnumerator enumm         = dt.Rows.GetEnumerator();
         string      componentName = "";
         while (enumm.MoveNext())
         {
             row           = (DataRow)enumm.Current;
             componentName = System.Convert.ToString(row[CNDServiceDefinitions.CND_TABLE_COMPONENT_NAME]);
             this.lstBoxAvailableComponents.Items.Add(componentName);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 public void frmSTXCommunicationsEnvironmentTestForm_Load(System.Object sender, System.EventArgs e)
 {
     try
     {
         this._eventLog = CustomEventLog.GetInstance();
         this._eventLog.LogEntryReceived += new CustomEventLog.LogEntryReceivedEventHandler(this._stxeventLog_LogEntryReceived);
     }
     catch (Exception)
     {
     }
     try
     {
         manager = CommunicationsManager.GetInstance();
         manager.CNDTableChanged     += new  CommunicationsManager.CNDTableChangedEventHandler(this.manager_CNDTableChanged);
         this.dgrdCNDTable.DataSource = manager.CNDTable;
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.Message);
     }
 }
Пример #31
0
        public void Initialise(Scene scene, IConfigSource source)
        {
            if (m_scenes.Count == 0)
            {
                scene.RegisterModuleInterface <IInventoryArchiverModule>(this);
                CommsManager             = scene.CommsManager;
                OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;

                scene.AddCommand(
                    this, "load iar",
                    "load iar <first> <last> <inventory path> [<archive path>]",
                    "Load user inventory archive.  EXPERIMENTAL, PLEASE DO NOT USE YET", HandleLoadInvConsoleCommand);

                scene.AddCommand(
                    this, "save iar",
                    "save iar <first> <last> <inventory path> [<archive path>]",
                    "Save user inventory archive.  EXPERIMENTAL, PLEASE DO NOT USE YET", HandleSaveInvConsoleCommand);
            }

            m_scenes[scene.RegionInfo.RegionID] = scene;
        }
Пример #32
0
        public bool CanVerifyUdpConnection(EsMount mount)
        {
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Start Verify UDP Connection");

            //Check Wireless first
            if (!CommunicationsManager.IsConnectedToWirelessNetwork())
            {
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    End Verify UDP Connection - Failure. Not connected to a network");

                return(false);
            }
            if (!CommunicationsManager.ConnectedSsid().Contains("PMC"))
            {
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    End Verify UDP Connection - Failure. Not connected to a PMC network");

                return(false);
            }
            bool versionGood = false;

            try
            {
                string result = CommunicationsManager.SendUdpMessage(mount.ConnectionSettings.IpAddr,
                                                                     mount.ConnectionSettings.IpPort, UDP_QUERY);

                versionGood = result.Contains(UDP_RESPONSE);
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "     End Verify UDP Connection: " + versionGood);

                return(versionGood);
            }
            catch (Exception ex)
            {
                EsException e = new EsException("Error in :" + "CanVerifyUdpConnection", ex);
                //TODO:
                //EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DetailedInfo, "    End Verify UDP Connection - Failure. ERROR");
                EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, "CanVerifyUdpConnection", EsMessagePriority.DetailedInfo, "", null, ex, null);
                return(false);
            }
        }
Пример #33
0
        public bool CanVerifySerialConnection(EsMount mount)
        {
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    Start Very Serial Connection");

            string[] ports          = SerialPort.GetPortNames();
            bool     responseIsGood = false;

            if (ports.Rank > 0 && mount.ConnectionSettings.SerPort != null)
            {
                try
                {
                    string result = CommunicationsManager.SendSerialMessage(mount.ConnectionSettings.SerPort, SERIAL_QUERY);
                    responseIsGood = result.Contains(SERIAL_RESPONSE);
                }
                catch (Exception ex)
                {
                    EsException e = new EsException("Error in :" + "CanVerifySerialConnection", ex);
                    throw e;
                }
            }
            EsEventManager.PublishEsEvent(EsEventSenderEnum.EsMountManager, EsMessagePriority.DebugInfo, "    End  Very Serial Connection: " + responseIsGood);

            return(responseIsGood);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="commsManager"></param>
 /// <param name="libraryRootFolder"></param>
 public UserProfileCacheService(CommunicationsManager commsManager, LibraryRootFolder libraryRootFolder)
 {
     m_commsManager = commsManager;
     LibraryRoot = libraryRootFolder;
 }
Пример #35
0
        /// <summary>
        /// Resolve an OSPI name by querying existing persistent user profiles.  If there is no persistent user profile
        /// then a temporary user profile is inserted in the cache.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="commsManager"></param>
        /// <returns>
        /// An OpenSim internal identifier for the name given.  Returns null if the name was not valid
        /// </returns>
        protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager)
        {
            int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
            
            if (nameSeparatorIndex < 0)
            {
                m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
                return UUID.Zero;
            }
            
            string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
            string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();

            UUID uuid = commsManager.UserService.Name2Key(firstName, lastName);
            if (uuid != UUID.Zero)
                return uuid;
                        
            UserProfileData tempUserProfile = new UserProfileData();
            tempUserProfile.FirstName = firstName;
            tempUserProfile.SurName = lastName;
            tempUserProfile.ID = HashName(tempUserProfile.Name);
            
            m_log.DebugFormat(
                "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);            
            commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
            
            return tempUserProfile.ID;
        }
Пример #36
0
        /// <summary>
        /// Resolve an osp string into the most suitable internal OpenSim identifier.
        /// </summary>
        /// 
        /// In some cases this will be a UUID if a suitable profile exists on the system.  In other cases, this may
        /// just return the same identifier after creating a temporary profile.
        /// 
        /// <param name="ospa"></param>
        /// <param name="commsManager"></param>
        /// <returns>
        /// A suitable UUID for use in Second Life client communication.  If the string was not a valid ospa, then UUID.Zero
        /// is returned.
        /// </returns>
        public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager)
        {
            if (!ospa.StartsWith(OSPA_PREFIX))
                return UUID.Zero;

            m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
            
            string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
            string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
            
            foreach (string tuple in ospaTuples)
            {
                int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR);

                if (tupleSeparatorIndex < 0)
                {
                    m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
                    continue;
                }
                
                string key = tuple.Remove(tupleSeparatorIndex).Trim();
                string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
                
                if (OSPA_NAME_KEY == key)
                    return ResolveOspaName(value, commsManager);
            }
            
            return UUID.Zero;
        }
Пример #37
0
        /// <summary>
        /// Resolve an OSPI name by querying existing persistent user profiles.  If there is no persistent user profile
        /// then a temporary user profile is inserted in the cache.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="commsManager"></param>
        /// <returns>
        /// An OpenSim internal identifier for the name given.  Returns null if the name was not valid
        /// </returns>
        protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager)
        {
            int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
            
            if (nameSeparatorIndex < 0)
            {
                m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
                return UUID.Zero;
            }
            
            string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
            string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
            
            CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
            if (userInfo != null)
                return userInfo.UserProfile.ID;

            // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
            /*
            UserProfileData tempUserProfile = new UserProfileData();
            tempUserProfile.FirstName = firstName;
            tempUserProfile.SurName = lastName;
            tempUserProfile.ID = HashName(tempUserProfile.Name);
            
            m_log.DebugFormat(
                "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
            commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
            
            return tempUserProfile.ID;
            */

            return UUID.Zero;
        }
Пример #38
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="commsManager"></param>
 /// <param name="userProfile"></param>
 public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile, List<FriendListItem> friendInfos)
 {
     m_commsManager = commsManager;
     m_userProfile = userProfile;
     _friends = friendInfos;
     this.IndexFriendPermissions();
 }
Пример #39
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="commsManager"></param>
 /// <param name="libraryRootFolder"></param>
 public UserProfileCacheService(CommunicationsManager commsManager)
 {
     m_commsManager = commsManager;
 }
 public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager)
 {
     m_wrappedPlugin = wrappedPlugin;
     m_commsManager = commsManager;
 }