public WifiServerConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            //
            // Leaving this here for educational purposes
            //
            //if (Environment.StaticVariables.ContainsKey("AppDll"))
            //{
            //    object[] args = new object[] { config, server };
            //    WebApp app = ServerUtils.LoadPlugin<IWebApp>(Environment.StaticVariables["AppDll"].ToString(), args);
            //    Environment.InitializeWebApp(app);
            //}

            // Launch the WebApp
            WebApp app = new WebApp(config, m_ConfigName, server);

            // Register all the handlers
            server.AddStreamHandler(new WifiGetHandler(app));
            server.AddStreamHandler(new WifiInstallGetHandler(app));
            server.AddStreamHandler(new WifiInstallPostHandler(app));
            server.AddStreamHandler(new WifiLoginHandler(app));
            server.AddStreamHandler(new WifiLogoutHandler(app));
            server.AddStreamHandler(new WifiUserAccountGetHandler(app));
            server.AddStreamHandler(new WifiUserAccountPostHandler(app));
            server.AddStreamHandler(new WifiUserManagementGetHandler(app));
            server.AddStreamHandler(new WifiUserManagementPostHandler(app));
            server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            server.AddStreamHandler(new WifiRegionManagementGetHandler(app));
        }
Example #2
0
 public WifiUserManagementGetHandler(WebApp webapp) :
     base("GET", "/wifi/admin/users")
 {
     m_WebApp = webapp;
 }
        public WifiScriptFace(WebApp webApp)
        {
            m_log.Debug("[WifiScriptFace]: Starting...");

            m_WebApp = webApp;
        }
Example #4
0
 public WifiHeadHandler(WebApp webapp) :
     base("HEAD", "/wifi")
 {
     m_WebApp = webapp;
 }
Example #5
0
 public WifiLogoutHandler(WebApp webapp) :
     base("GET", "/wifi/logout")
 {
     m_WebApp = webapp;
 }
 public WifiTOSGetHandler(WebApp webapp)
     : base("GET", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
 public WifiHeadHandler(WebApp webapp)
     : base("HEAD", "/wifi")
 {
     m_WebApp = webapp;
 }
 public WifiInstallPostHandler(WebApp webapp) :
     base("POST", "/wifi/install")
 {
     m_WebApp = webapp;
 }
Example #9
0
 public WifiHyperlinkGetHandler(WebApp webapp) :
     base("GET", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
Example #10
0
 public WifiHyperlinkPostHandler(WebApp webapp) :
     base("POST", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
Example #11
0
        private void Initialize(IHttpServer server)
        {
            m_log.DebugFormat("[Wifi]: Initializing. Server at port {0}.", server.Port);

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

            // Launch the WebApp
            m_WebApp = new WebApp(m_Config, ConfigName, m_Server, m_SceneActor);

            // Register all the handlers
            BaseStreamHandler defaultHandler = new WifiDefaultHandler(m_WebApp);
            AddStreamHandler(defaultHandler);
            AddStreamHandler(new WifiRootHandler(defaultHandler));
            AddStreamHandler(new WifiHeadHandler(m_WebApp));
            AddStreamHandler(new WifiNotifyHandler(m_WebApp));
            AddStreamHandler(new WifiInstallGetHandler(m_WebApp));
            AddStreamHandler(new WifiInstallPostHandler(m_WebApp));
            AddStreamHandler(new WifiLoginHandler(m_WebApp));
            AddStreamHandler(new WifiLogoutHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordGetHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordPostHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverGetHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementPostHandler(m_WebApp));
            AddStreamHandler(new WifiConsoleHandler(m_WebApp));

            AddStreamHandler(new WifiInventoryLoadGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryPostHandler(m_WebApp));

            AddStreamHandler(new WifiHyperlinkGetHandler(m_WebApp));
            AddStreamHandler(new WifiHyperlinkPostHandler(m_WebApp));

            AddStreamHandler(new WifiTOSGetHandler(m_WebApp));
            AddStreamHandler(new WifiTOSPostHandler(m_WebApp));

            AddStreamHandler(new WifiGroupsManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiGroupsManagementPostHandler(m_WebApp));

            //server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            //server.AddStreamHandler(new WifiRegionManagementGetHandler(app));

            // Add handlers for serving configured paths
            IEnumerable<string> servePaths = serverConfig.GetKeys().Where(option => option.StartsWith(m_ServePathPrefix));
            if (servePaths.Count() > 0)
            {
                foreach (string servePath in servePaths)
                {
                    string paths = serverConfig.GetString(servePath, string.Empty);
                    string[] parts = paths.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Count() == 2)
                        AddStreamHandler(new WifiGetHandler(parts[0], parts[1]));
                    else
                        m_log.WarnFormat("[Wifi]: Invalid format with configuration option {0}: {1}", servePath, paths);
                }
            }

            // Load addons
            IEnumerable<string> addonVars = serverConfig.GetKeys().Where(option => option.StartsWith(m_AddonPrefix));
            if (addonVars.Count() > 0)
            {
                foreach (string addonVar in addonVars)
                {
                    string addonDll = serverConfig.GetString(addonVar, string.Empty);
                    if (addonDll != string.Empty)
                    {
                        m_log.InfoFormat("[Wifi]: Loading addon {0}", addonDll);
                        object[] args = new object[] { m_Config, ConfigName, m_Server, m_WebApp };
                        IWifiAddon addon = ServerUtils.LoadPlugin<IWifiAddon>(addonDll, args);

                        if (addon == null)
                            m_log.WarnFormat("[Wifi]: Unable to load addon {0}", addonDll);
                    }
                }
            }

            // Load Wifi addons as mono addins, if they exist
            try
            {
                AddinManager.AddExtensionNodeHandler("/Diva/Wifi/Addon", OnExtensionChanged);
            }
            catch (InvalidOperationException e)
            {
                m_log.DebugFormat("[Wifi]: extension point /Diva/Wifi/Addon not found");
            }
        }
Example #12
0
 public WifiInventoryGetHandler(WebApp webapp) :
     base("GET", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
Example #13
0
 public WifiInventoryPostHandler(WebApp webapp) :
     base("POST", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
 public WifiRegionManagementGetHandler(WebApp webapp) :
     base("GET", "/wifi/admin/regions")
 {
     m_WebApp = webapp;
 }
 public WifiHyperlinkPostHandler(WebApp webapp)
     : base("POST", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
 public WifiConsoleHandler(WebApp webapp)
     : base("GET", "/wifi/admin/console")
 {
     m_WebApp = webapp;
 }
 public WifiGroupsManagementGetHandler(WebApp webapp) :
     base("GET", "/wifi/admin/groups")
 {
     m_WebApp = webapp;
 }
 public WifiInventoryGetHandler(WebApp webapp)
     : base("GET", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
Example #19
0
        private void Initialize(IHttpServer server)
        {
            m_log.DebugFormat("[Wifi]: Initializing. Server at port {0}.", server.Port);

            IConfig serverConfig = m_Config.Configs[ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section {0} in config file", ConfigName));
            }

            // Launch the WebApp
            m_WebApp = new WebApp(m_Config, ConfigName, m_Server, m_SceneActor);

            // Register all the handlers
            BaseStreamHandler defaultHandler = new WifiDefaultHandler(m_WebApp);

            AddStreamHandler(defaultHandler);
            AddStreamHandler(new WifiRootHandler(defaultHandler));
            AddStreamHandler(new WifiHeadHandler(m_WebApp));
            AddStreamHandler(new WifiNotifyHandler(m_WebApp));
            AddStreamHandler(new WifiInstallGetHandler(m_WebApp));
            AddStreamHandler(new WifiInstallPostHandler(m_WebApp));
            AddStreamHandler(new WifiLoginHandler(m_WebApp));
            AddStreamHandler(new WifiLogoutHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordGetHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordPostHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverGetHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementPostHandler(m_WebApp));
            AddStreamHandler(new WifiConsoleHandler(m_WebApp));

            AddStreamHandler(new WifiInventoryLoadGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryPostHandler(m_WebApp));

            AddStreamHandler(new WifiHyperlinkGetHandler(m_WebApp));
            AddStreamHandler(new WifiHyperlinkPostHandler(m_WebApp));

            AddStreamHandler(new WifiTOSGetHandler(m_WebApp));
            AddStreamHandler(new WifiTOSPostHandler(m_WebApp));

            AddStreamHandler(new WifiGroupsManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiGroupsManagementPostHandler(m_WebApp));

            //server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            //server.AddStreamHandler(new WifiRegionManagementGetHandler(app));

            // Add handlers for serving configured paths
            IEnumerable <string> servePaths = serverConfig.GetKeys().Where(option => option.StartsWith(m_ServePathPrefix));

            if (servePaths.Count() > 0)
            {
                foreach (string servePath in servePaths)
                {
                    string   paths = serverConfig.GetString(servePath, string.Empty);
                    string[] parts = paths.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Count() == 2)
                    {
                        AddStreamHandler(new WifiGetHandler(parts[0], parts[1]));
                    }
                    else
                    {
                        m_log.WarnFormat("[Wifi]: Invalid format with configuration option {0}: {1}", servePath, paths);
                    }
                }
            }

            // Load addons
            IEnumerable <string> addonVars = serverConfig.GetKeys().Where(option => option.StartsWith(m_AddonPrefix));

            if (addonVars.Count() > 0)
            {
                foreach (string addonVar in addonVars)
                {
                    string addonDll = serverConfig.GetString(addonVar, string.Empty);
                    if (addonDll != string.Empty)
                    {
                        m_log.InfoFormat("[Wifi]: Loading addon {0}", addonDll);
                        object[]   args  = new object[] { m_Config, ConfigName, m_Server, m_WebApp };
                        IWifiAddon addon = ServerUtils.LoadPlugin <IWifiAddon>(addonDll, args);

                        if (addon == null)
                        {
                            m_log.WarnFormat("[Wifi]: Unable to load addon {0}", addonDll);
                        }
                    }
                }
            }

            // Load Wifi addons as mono addins, if they exist
            try
            {
                AddinManager.AddExtensionNodeHandler("/Diva/Wifi/Addon", OnExtensionChanged);
            }
            catch (InvalidOperationException e)
            {
                m_log.DebugFormat("[Wifi]: extension point /Diva/Wifi/Addon not found");
            }
        }
 public WifiNotifyHandler(WebApp webapp)
     : base("POST", "/wifi/notify")
 {
     m_WebApp = webapp;
 }
Example #21
0
 public WifiPasswordRecoverPostHandler(WebApp webapp) :
     base("POST", "/wifi/recover")
 {
     m_WebApp = webapp;
 }
        public WifiScriptFace(WebApp webApp)
        {
            m_log.Debug("[WifiScriptFace]: Starting...");

            m_WebApp = webApp;
        }
Example #23
0
 public WifiForgotPasswordPostHandler(WebApp webapp) :
     base("POST", "/wifi/forgotpassword")
 {
     m_WebApp = webapp;
 }
Example #24
0
        public WebApp(IConfigSource config, string configName, IHttpServer server)
        {
            ReadConfigs(config, configName);

            // Create the two parts
            Services = new Services(config, configName, this);
            WifiScriptFace = new WifiScriptFace(this);

            m_ExtensionMethods = typeof(ExtensionMethods);
            m_Statistics = new StatisticsDict();

            WebAppInstance = this;
            WifiScriptFaceInstance = WifiScriptFace;

            m_log.DebugFormat("[Wifi]: Starting with extension methods type {0}", m_ExtensionMethods);
        }
        public WifiServerConnector(IConfigSource config, IHttpServer server, string configName, ISceneActor sactor)
            : base(config, server, configName)
        {
            m_log.DebugFormat("[Wifi]: WifiServerConnector starting");
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            //
            // Leaving this here for educational purposes
            //
            //if (Environment.StaticVariables.ContainsKey("AppDll"))
            //{
            //    object[] args = new object[] { config, server };
            //    WebApp app = ServerUtils.LoadPlugin<IWebApp>(Environment.StaticVariables["AppDll"].ToString(), args);
            //    Environment.InitializeWebApp(app);
            //}

            // Launch the WebApp
            WebApp app = new WebApp(config, m_ConfigName, server, sactor);

            // Register all the handlers
            server.AddStreamHandler(new WifiDefaultHandler(app));
            server.AddStreamHandler(new WifiHeadHandler(app));
            server.AddStreamHandler(new WifiNotifyHandler(app));
            server.AddStreamHandler(new WifiInstallGetHandler(app));
            server.AddStreamHandler(new WifiInstallPostHandler(app));
            server.AddStreamHandler(new WifiLoginHandler(app));
            server.AddStreamHandler(new WifiLogoutHandler(app));
            server.AddStreamHandler(new WifiForgotPasswordGetHandler(app));
            server.AddStreamHandler(new WifiForgotPasswordPostHandler(app));
            server.AddStreamHandler(new WifiPasswordRecoverGetHandler(app));
            server.AddStreamHandler(new WifiPasswordRecoverPostHandler(app));
            server.AddStreamHandler(new WifiUserAccountGetHandler(app));
            server.AddStreamHandler(new WifiUserAccountPostHandler(app));
            server.AddStreamHandler(new WifiUserManagementGetHandler(app));
            server.AddStreamHandler(new WifiUserManagementPostHandler(app));
            server.AddStreamHandler(new WifiConsoleHandler(app));

            server.AddStreamHandler(new WifiInventoryLoadGetHandler(app));
            server.AddStreamHandler(new WifiInventoryGetHandler(app));
            server.AddStreamHandler(new WifiInventoryPostHandler(app));

            server.AddStreamHandler(new WifiHyperlinkGetHandler(app));
            server.AddStreamHandler(new WifiHyperlinkPostHandler(app));

            server.AddStreamHandler(new WifiTOSGetHandler(app));
            server.AddStreamHandler(new WifiTOSPostHandler(app));

            server.AddStreamHandler(new WifiGroupsManagementGetHandler(app));
            server.AddStreamHandler(new WifiGroupsManagementPostHandler(app));

            //server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            //server.AddStreamHandler(new WifiRegionManagementGetHandler(app));

            // Add handlers for serving configured paths
            IEnumerable<string> servePaths = serverConfig.GetKeys().Where(option => option.StartsWith(m_ServePathPrefix));
            if (servePaths.Count() > 0)
            {
                foreach (string servePath in servePaths)
                {
                    string paths = serverConfig.GetString(servePath, string.Empty);
                    string[] parts = paths.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Count() == 2)
                        server.AddStreamHandler(new WifiGetHandler(parts[0], parts[1]));
                    else
                        m_log.WarnFormat("[Wifi]: Invalid format with configuration option {0}: {1}", servePath, paths);
                }
            }

            // Load addons
            IEnumerable<string> addonVars = serverConfig.GetKeys().Where(option => option.StartsWith(m_AddonPrefix));
            if (addonVars.Count() > 0)
            {
                foreach (string addonVar in addonVars)
                {
                    string addonDll = serverConfig.GetString(addonVar, string.Empty);
                    if (addonDll != string.Empty)
                    {
                        m_log.InfoFormat("[Wifi]: Loading addon {0}", addonDll);
                        object[] args = new object[] { config, m_ConfigName, server, app };
                        IWifiAddon addon = ServerUtils.LoadPlugin<IWifiAddon>(addonDll, args);

                        if (addon == null)
                            m_log.WarnFormat("[Wifi]: Unable to load addon {0}", addonDll);
                    }
                }
            }
        }
Example #26
0
 public WifiDefaultHandler(WebApp webapp) :
     base("GET", "/wifi")
 {
     m_WebApp = webapp;
 }
Example #27
0
 public WifiConsoleHandler(WebApp webapp) :
     base("GET", "/wifi/admin/console")
 {
     m_WebApp = webapp;
 }
 public WifiUserManagementGetHandler(WebApp webapp)
     : base("GET", "/wifi/admin/users")
 {
     m_WebApp = webapp;
 }
Example #29
0
 public WifiTOSGetHandler(WebApp webapp) :
     base("GET", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
 public WifiLoginHandler(WebApp webapp) :
     base("POST", "/wifi/login")
 {
     m_WebApp = webapp;
 }
Example #31
0
 public WifiTOSPostHandler(WebApp webapp) :
     base("POST", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
 public WifiHyperlinkGetHandler(WebApp webapp)
     : base("GET", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
 public WifiUserAccountGetHandler(WebApp webapp) :
     base("GET", "/wifi/user/account")
 {
     m_WebApp = webapp;
 }
 public WifiInstallGetHandler(WebApp webapp) :
         base("GET", "/wifi/install")
 {
     m_WebApp = webapp;
 }
 public WifiGroupsManagementGetHandler(WebApp webapp)
     : base("GET", "/wifi/admin/groups")
 {
     m_WebApp = webapp;
 }
 public WifiInventoryPostHandler(WebApp webapp)
     : base("POST", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
Example #37
0
 public WifiInstallGetHandler(WebApp webapp) :
     base("GET", "/wifi/install")
 {
     m_WebApp = webapp;
 }
 public WifiLoginHandler(WebApp webapp)
     : base("POST", "/wifi/login")
 {
     m_WebApp = webapp;
 }
Example #39
0
 public WifiInstallPostHandler(WebApp webapp) :
     base("POST", "/wifi/install")
 {
     m_WebApp = webapp;
 }
 public WifiRegionManagementGetHandler(WebApp webapp)
     : base("GET", "/wifi/admin/regions")
 {
     m_WebApp = webapp;
 }
 public WifiPasswordRecoverPostHandler(WebApp webapp)
     : base("POST", "/wifi/recover")
 {
     m_WebApp = webapp;
 }
 public WifiTOSPostHandler(WebApp webapp)
     : base("POST", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
 public WifiForgotPasswordGetHandler(WebApp webapp)
     : base("GET", "/wifi/forgotpassword")
 {
     m_WebApp = webapp;
 }
 public WifiDefaultHandler(WebApp webapp)
     : base("GET", "/wifi")
 {
     m_WebApp = webapp;
 }
 public WifiUserAccountGetHandler(WebApp webapp)
     : base("GET", "/wifi/user/account")
 {
     m_WebApp = webapp;
 }
 public WifiLogoutHandler(WebApp webapp)
     : base("GET", "/wifi/logout")
 {
     m_WebApp = webapp;
 }
Example #47
0
 public WifiNotifyHandler(WebApp webapp) :
     base("POST", "/wifi/notify")
 {
     m_WebApp = webapp;
 }