// Called from standalone configurations public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) : base(config, server, configName) { if (configName != string.Empty) m_ConfigName = configName; Object[] args = new Object[] { config, m_ConfigName, localConn }; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); string theService = serverConfig.GetString("LocalServiceModule", String.Empty); if (theService == String.Empty) throw new Exception("No LocalServiceModule in config file"); m_TheService = ServerUtils.LoadPlugin<IHGFriendsService>(theService, args); theService = serverConfig.GetString("UserAgentService", string.Empty); if (theService == String.Empty) throw new Exception("No UserAgentService in " + m_ConfigName); m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(theService, new Object[] { config, localConn }); server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn)); }
public void RegionLoaded(Scene scene) { if (!m_Enabled) { return; } if (!m_Registered) { m_Registered = true; m_log.Info("[HypergridService]: Starting..."); ISimulationService simService = scene.RequestModuleInterface <ISimulationService>(); IFriendsSimConnector friendsConn = scene.RequestModuleInterface <IFriendsSimConnector>(); Object[] args = new Object[] { m_Config }; // IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args) ServerUtils.LoadPlugin <IFriendsService>(m_LocalServiceDll, args); m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); m_UASHandler = new UserAgentServerConnector(m_Config, MainServer.Instance, friendsConn); new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); new HGFriendsServerConnector(m_Config, MainServer.Instance, "HGFriendsService", friendsConn); } scene.RegisterModuleInterface <IGatekeeperService>(m_HypergridHandler.GateKeeper); scene.RegisterModuleInterface <IUserAgentService>(m_UASHandler.HomeUsersService); }
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 + "/"; } } }
public HGFriendsService(IConfigSource config, String configName, IFriendsSimConnector localSimConn) { if (m_FriendsLocalSimConnector == null) { m_FriendsLocalSimConnector = localSimConn; } if (!m_Initialized) { m_Initialized = true; if (configName != String.Empty) { m_ConfigName = configName; } Object[] args = new Object[] { config }; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) { throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); } string theService = serverConfig.GetString("FriendsService", string.Empty); if (theService == String.Empty) { throw new Exception("No FriendsService in config file " + m_ConfigName); } m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(theService, args); theService = serverConfig.GetString("UserAccountService", string.Empty); if (theService == String.Empty) { throw new Exception("No UserAccountService in " + m_ConfigName); } m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(theService, args); theService = serverConfig.GetString("GridService", string.Empty); if (theService == String.Empty) { throw new Exception("No GridService in " + m_ConfigName); } m_GridService = ServerUtils.LoadPlugin <IGridService>(theService, args); theService = serverConfig.GetString("PresenceService", string.Empty); if (theService == String.Empty) { throw new Exception("No PresenceService in " + m_ConfigName); } m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(theService, args); m_FriendsSimConnector = new FriendsSimConnector(); m_log.DebugFormat("[HGFRIENDS SERVICE]: Starting..."); } }
public FriendServerProxy(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) : base("POST", "/hgfriends") { m_TheService = service; m_UserAgentService = uas; m_FriendsLocalSimConnector = friendsConn; m_realHandler = new HGFriendsServerPostHandler(service, uas, friendsConn); if (File.Exists("friends.txt")) { m_fixCache = new List <String>(File.ReadAllLines("friends.txt")); } }
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 + "/"; m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); } }
public HGFriendsServerPostHandler(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) : base("POST", "/hgfriends") { m_TheService = service; m_UserAgentService = uas; m_FriendsLocalSimConnector = friendsConn; m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", (m_FriendsLocalSimConnector == null ? "robust" : "standalone")); if (m_TheService == null) m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!"); }
public HGFriendsServerPostHandler(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) : base("POST", "/hgfriends") { m_TheService = service; m_UserAgentService = uas; m_FriendsLocalSimConnector = friendsConn; m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", (m_FriendsLocalSimConnector == null ? "robust" : "standalone")); if (m_TheService == null) { m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!"); } }
public HGFriendsService(IConfigSource config, String configName, IFriendsSimConnector localSimConn) { if (m_FriendsLocalSimConnector == null) m_FriendsLocalSimConnector = localSimConn; if (!m_Initialized) { m_Initialized = true; if (configName != String.Empty) m_ConfigName = configName; Object[] args = new Object[] { config }; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); string theService = serverConfig.GetString("FriendsService", string.Empty); if (theService == String.Empty) throw new Exception("No FriendsService in config file " + m_ConfigName); m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); theService = serverConfig.GetString("UserAccountService", string.Empty); if (theService == String.Empty) throw new Exception("No UserAccountService in " + m_ConfigName); m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(theService, args); theService = serverConfig.GetString("GridService", string.Empty); if (theService == String.Empty) throw new Exception("No GridService in " + m_ConfigName); m_GridService = ServerUtils.LoadPlugin<IGridService>(theService, args); theService = serverConfig.GetString("PresenceService", string.Empty); if (theService == String.Empty) throw new Exception("No PresenceService in " + m_ConfigName); m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(theService, args); m_FriendsSimConnector = new FriendsSimConnector(); m_easyFriendship = serverConfig.GetBoolean("EasyFriendship", false); if (m_easyFriendship) m_log.DebugFormat("[HGFRIENDS SERVICE]: Enbale EasyFriendship"); m_log.DebugFormat("[HGFRIENDS SERVICE]: Starting..."); } }
public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) : base(config, server, String.Empty) { IConfig gridConfig = config.Configs["UserAgentService"]; if (gridConfig != null) { string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty); Object[] args = new Object[] { config, friendsConnector }; m_HomeUsersService = ServerUtils.LoadPlugin <IUserAgentService>(serviceDll, args); } if (m_HomeUsersService == null) { throw new Exception("UserAgent server connector cannot proceed because of missing service"); } string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); bool proxy = gridConfig.GetBoolean("HasProxy", false); m_VerifyCallers = gridConfig.GetBoolean("VerifyCallers", false); string csv = gridConfig.GetString("AuthorizedCallers", "127.0.0.1"); csv = csv.Replace(" ", ""); m_AuthorizedCallers = csv.Split(','); server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); server.AddXmlRPCHandler("verify_client", VerifyClient, false); server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); #pragma warning disable 0612 server.AddXmlRPCHandler("status_notification", StatusNotification, false); server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); #pragma warning restore 0612 server.AddXmlRPCHandler("get_user_info", GetUserInfo, false); server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); server.AddXmlRPCHandler("locate_user", LocateUser, false); server.AddXmlRPCHandler("get_uui", GetUUI, false); server.AddXmlRPCHandler("get_uuid", GetUUID, false); server.AddSimpleStreamHandler(new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy), true); }
public void RegionLoaded(Scene scene) { if (!m_Enabled) { return; } if (!m_Registered) { m_Registered = true; m_log.Info("[HypergridService]: Starting..."); ISimulationService simService = scene.RequestModuleInterface <ISimulationService>(); m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); IFriendsSimConnector friendsConn = scene.RequestModuleInterface <IFriendsSimConnector>(); new UserAgentServerConnector(m_Config, MainServer.Instance, friendsConn); new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); new HGFriendsServerConnector(m_Config, MainServer.Instance, "HGFriendsService"); } scene.RegisterModuleInterface <IGatekeeperService>(m_HypergridHandler.GateKeeper); }
// Called from standalone configurations public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) : base(config, server, configName) { if (configName != string.Empty) { m_ConfigName = configName; } Object[] args = new Object[] { config, m_ConfigName, localConn }; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) { throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); } string theService = serverConfig.GetString("LocalServiceModule", String.Empty); if (theService == String.Empty) { throw new Exception("No LocalServiceModule in config file"); } m_TheService = ServerUtils.LoadPlugin <IHGFriendsService>(theService, args); theService = serverConfig.GetString("UserAgentService", string.Empty); if (theService == String.Empty) { throw new Exception("No UserAgentService in " + m_ConfigName); } m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(theService, new Object[] { config, localConn }); server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn)); }
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(); } }
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); 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 (!m_GridName.EndsWith("/")) m_GridName = m_GridName + "/"; // Finally some cleanup m_Database.DeleteOld(); } }
// Called from standalone configurations public AssetProxyConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) : base(config, server, configName) { try { if (configName != String.Empty) { m_ConfigName = configName; } IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) { throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); } m_AssetService = new AssetServerProxy(config, m_ConfigName); IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth, string.Empty)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, AllowedRemoteDeleteTypes.None, auth)); server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); }catch (Exception error) { m_log.Error(error.Message); m_log.Error(error.StackTrace); } }