public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            //IConfig serverConfig = config.Configs["SimulationService"];
            //if (serverConfig == null)
            //    throw new Exception("No section 'SimulationService' in config file");

            //string simService = serverConfig.GetString("LocalServiceModule",
            //        String.Empty);

            //if (simService == String.Empty)
            //    throw new Exception("No SimulationService in config file");

            //Object[] args = new Object[] { config };
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
                    //ServerUtils.LoadPlugin<ISimulationService>(simService, args);

            //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
            //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);

            //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
        }
예제 #2
0
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;
            IConfig mapConfig = config.Configs["MapService"];

            if (mapConfig != null)
            {
                m_enabled      = mapConfig.GetBoolean("Enabled", m_enabled);
                m_port         = mapConfig.GetUInt("Port", m_port);
                m_cacheEnabled = mapConfig.GetBoolean("CacheEnabled", m_cacheEnabled);
                m_cacheExpires = mapConfig.GetFloat("CacheExpires", m_cacheExpires);
            }
            if (!m_enabled)
            {
                return;
            }

            if (m_cacheEnabled)
            {
                CreateCacheDirectories();
            }

            m_server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);
            m_server.AddHTTPHandler("/MapService/", MapRequest);
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapAPI/", MapAPIRequest));

            registry.RegisterModuleInterface <IMapService>(this);
        }
        public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            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));
            }

            string freeswitchService = serverConfig.GetString("LocalServiceModule",
                                                              String.Empty);

            if (freeswitchService == String.Empty)
            {
                throw new Exception("No LocalServiceModule in config file");
            }

            Object[] args = new Object[] { config };
            m_FreeswitchService =
                ServerUtils.LoadPlugin <IFreeswitchService>(freeswitchService, args);

            server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
            server.AddHTTPHandler(String.Format("{0}/region-config", m_freeSwitchAPIPrefix), RegionConfigHTTPHandler);
        }
예제 #4
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];

            if (config.Configs["GridInfoService"] != null)
            {
                m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
            }
            m_registry = registry;
            if (handlerConfig.GetString("WireduxHandler", "") != Name)
            {
                return;
            }
            string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);

            if (Password != "")
            {
                m_server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
                //This handler allows sims to post CAPS for their sims on the CAPS server.
                m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry));
                m_server2 = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
                m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
                m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);
            }
        }
예제 #5
0
        //private IAuthenticationService m_AuthenticationService;

        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
            base(config, server, String.Empty)
        {
            //IConfig serverConfig = config.Configs["SimulationService"];
            //if (serverConfig == null)
            //    throw new Exception("No section 'SimulationService' in config file");

            //string simService = serverConfig.GetString("LocalServiceModule",
            //        String.Empty);

            //if (simService == String.Empty)
            //    throw new Exception("No SimulationService in config file");

            //Object[] args = new Object[] { config };
            m_LocalSimulationService = scene.RequestModuleInterface <ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
            //ServerUtils.LoadPlugin<ISimulationService>(simService, args);

            //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
            //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);

            //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
        }
예제 #6
0
        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
            m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
            m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
        }
        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
            m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
            m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
        }
예제 #8
0
        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/StartSession/", HandleHttpStartSession));
            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/CloseSession/", HandleHttpCloseSession));
            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/SessionCommand/", HandleHttpSessionCommand));
        }
예제 #9
0
        public void AddExistingUrlForClient(string SessionID, ulong RegionHandle, string url)
        {
            IHttpServer server = m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);

            m_port = server.Port;

            m_FreeswitchService = m_registry.RequestModuleInterface <IFreeswitchService>();

            server.AddHTTPHandler(String.Format("{0}/{1}/freeswitch-config", m_freeSwitchAPIPrefix, UUID.Random()), FreeSwitchConfigHTTPHandler);
            server.AddHTTPHandler(String.Format("{0}/{1}/region-config", m_freeSwitchAPIPrefix, UUID.Random()), RegionConfigHTTPHandler);
        }
예제 #10
0
        public void SetServer(IHttpServer server)
        {
            // This is called by the framework to give us the server
            // instance (means: port) to work with.
            m_Server = server;

            // Add our handlers
            m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
            m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
            m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
        }
예제 #11
0
        public string GetUrlForRegisteringClient(string SessionID, ulong RegionHandle)
        {
            string url = "/CAPS/EQMPOSTER" + UUID.Random();

            IHttpServer server = m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);

            m_port = server.Port;

            m_FreeswitchService = m_registry.RequestModuleInterface <IFreeswitchService>();

            server.AddHTTPHandler(String.Format("{0}/{1}/freeswitch-config", m_freeSwitchAPIPrefix, UUID.Random()), FreeSwitchConfigHTTPHandler);
            server.AddHTTPHandler(String.Format("{0}/{1}/region-config", m_freeSwitchAPIPrefix, UUID.Random()), RegionConfigHTTPHandler);
            return(url);
        }
//        private IAuthenticationService m_AuthenticationService;

        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();

            // This one MUST be a stream handler because compressed fatpacks
            // are pure binary and shoehorning that into a string with UTF-8
            // encoding breaks it
            server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService));
            server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);
        }
예제 #13
0
        //        private IAuthenticationService m_AuthenticationService;

        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
            base(config, server, String.Empty)
        {
            m_LocalSimulationService = scene.RequestModuleInterface <ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();

            // This one MUST be a stream handler because compressed fatpacks
            // are pure binary and shoehorning that into a string with UTF-8
            // encoding breaks it
            server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService));
            server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);
        }
        public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
            base(config, server, String.Empty)
        {
            IConfig gridConfig = config.Configs["GatekeeperService"];

            if (gridConfig != null)
            {
                string   serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
                Object[] args       = new Object[] { config, simService };
                m_GatekeeperService = ServerUtils.LoadPlugin <IGatekeeperService>(serviceDll, args);
            }
            if (m_GatekeeperService == null)
            {
                throw new Exception("Gatekeeper server connector cannot proceed because of missing service");
            }

            m_Proxy = gridConfig.GetBoolean("HasProxy", false);

            HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);

            server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
            server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);

            server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler);
        }
예제 #15
0
        public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
            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 };
                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);

            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);

            server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
        }
예제 #16
0
        public UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID)
        {
            UUID urlcode = UUID.Random();

            lock (m_UrlMap)
            {
                if (m_UrlMap.Count >= m_TotalUrls)
                {
                    engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
                    return(urlcode);
                }
                string url = "http://" + System.Environment.MachineName + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";

                UrlData urlData = new UrlData();
                urlData.hostID   = host.UUID;
                urlData.itemID   = itemID;
                urlData.engine   = engine;
                urlData.url      = url;
                urlData.urlcode  = urlcode;
                urlData.requests = new Dictionary <UUID, RequestData>();

                m_UrlMap[url] = urlData;

                m_HttpServer.AddHTTPHandler("/lslhttp/" + urlcode.ToString() + "/", HttpRequestHandler);

                engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
            }

            return(urlcode);
        }
        private object EventManager_OnGenericEvent(string FunctionName, object parameters)
        {
            if (FunctionName != "PreRegisterRegion")
            {
                return(null);
            }
            IConfig handlerConfig = m_config.Configs["Handlers"];

            if (handlerConfig.GetString("SimulationInHandler", "") != Name)
            {
                return(null);
            }

            if (m_LocalSimulationService != null)
            {
                return(null);
            }

            bool        secure = handlerConfig.GetBoolean("SecureSimulation", true);
            IHttpServer server =
                m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(
                    (uint)handlerConfig.GetInt("SimulationInHandlerPort"));

            m_LocalSimulationService = m_registry.RequestModuleInterface <ISimulationService>();

            string path = "/" + UUID.Random().ToString() + "/agent/";

            IGridRegisterModule registerModule = m_registry.RequestModuleInterface <IGridRegisterModule>();

            if (registerModule != null && secure)
            {
                registerModule.AddGenericInfo("SimulationAgent", path);
            }
            else
            {
                secure = false;
                path   = "/agent/";
            }

            server.AddHTTPHandler(path,
                                  new AgentHandler(m_LocalSimulationService.GetInnerService(), m_registry, secure).
                                  Handler);
            server.AddHTTPHandler("/object/",
                                  new ObjectHandler(m_LocalSimulationService.GetInnerService(), m_config).Handler);
            return(null);
        }
예제 #18
0
        public virtual void AddHttpHandlers()
        {
            httpServer.AddHTTPHandler("/InvCap/", CapHandler);

            // Un-cap'ed for now
            httpServer.AddStreamHandler(new RestDeserialiseSecureHandler <Guid, InventoryItemBase>(
                                            "POST", "/GetItem/", GetInventoryItem, CheckAuthSession));
        }
예제 #19
0
        /// <summary>
        /// Creates a cap for the given type
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private string AddSpecificUrl(string type)
        {
            string capPath = "/cap/" + UUID.Random() + "/" + type;

            m_server.AddHTTPHandler(capPath, delegate(Hashtable request)
            {
                Hashtable responsedata       = new Hashtable();
                responsedata["content_type"] = "text/html";
                responsedata["keepalive"]    = false;

                OSD resp = new OSD();
                try
                {
                    OSDMap r = (OSDMap)OSDParser.DeserializeLLSDXml((string)request["requestbody"]);

                    if (type == "add_to_group")
                    {
                        resp = AddUserToGroup(r);
                    }

                    if (type == "check_name")
                    {
                        resp = CheckName(r);
                    }

                    if (type == "create_user")
                    {
                        resp = CreateUser(r);
                    }

                    if (type == "get_error_codes")
                    {
                        resp = GetErrorCode(r);
                    }

                    if (type == "get_last_names")
                    {
                        resp = GetLastNames(r);
                    }
                }
                catch
                {
                }

                responsedata["int_response_code"]   = HttpStatusCode.OK;
                responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(resp);

                return(responsedata);
            });
            ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>();

            if (capsService != null)
            {
                capPath = capsService.HostUri + capPath;
                return(capPath);
            }
            return("");
        }
예제 #20
0
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;
            IConfig mapConfig = config.Configs["MapService"];

            if (mapConfig != null)
            {
                m_enabled      = mapConfig.GetBoolean("Enabled", m_enabled);
                m_port         = mapConfig.GetUInt("Port", m_port);
                m_cacheEnabled = mapConfig.GetBoolean("CacheEnabled", m_cacheEnabled);
                m_cacheExpires = mapConfig.GetFloat("CacheExpires", m_cacheExpires);
            }
            if (!m_enabled)
            {
                return;
            }

            if (m_cacheEnabled)
            {
                CreateCacheDirectories();
            }

            m_server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapService/", MapRequest));
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapAPI/", MapAPIRequest));

            registry.RegisterModuleInterface <IMapService>(this);

            m_blankRegionTile     = new Bitmap(256, 256);
            m_blankRegionTile.Tag = "StaticBlank";
            using (Graphics g = Graphics.FromImage(m_blankRegionTile))
            {
                SolidBrush sea = new SolidBrush(Color.FromArgb(29, 71, 95));
                g.FillRectangle(sea, 0, 0, 256, 256);
            }
            m_blankRegionTileData = CacheMapTexture(1, 0, 0, m_blankRegionTile, true);

            /*string path = Path.Combine("assetcache", Path.Combine("mapzoomlevels", "blankMap.index"));
             * if(File.Exists(path))
             * {
             *  FileStream stream = File.OpenRead(path);
             *  m_blankTiles = ProtoBuf.Serializer.Deserialize<MapTileIndex>(stream);
             *  stream.Close();
             * }*/
        }
예제 #21
0
        public void Initialise()
        {
            IHttpServer httpServer = MainServer.Instance;

            if (httpServer != null)
            {
                // We want to handle anything that occurs in the Waters Wars namespace
                httpServer.AddHTTPHandler(WaterWarsConstants.WEB_SERVICE_PREFIX, HandleRequest);
            }
        }
예제 #22
0
 public void FinishedStartup()
 {
     _server = _registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(0);
     if (_server != null)
     {
         _server.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
         _registry.RegisterModuleInterface<IWebHttpTextureService>(this);
     }
     IGridInfo gridInfo = _registry.RequestModuleInterface<IGridInfo>();
     _gridNick = gridInfo != null ? gridInfo.GridName :
         "No Grid Name Available, please set this";
 }
예제 #23
0
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;
            IConfig mapConfig = config.Configs["MapService"];
            if (mapConfig != null)
            {
                m_enabled = mapConfig.GetBoolean("Enabled", m_enabled);
                m_port = mapConfig.GetUInt("Port", m_port);
                m_cacheEnabled = mapConfig.GetBoolean("CacheEnabled", m_cacheEnabled);
                m_cacheExpires = mapConfig.GetFloat("CacheExpires", m_cacheExpires);
            }
            if (!m_enabled)
                return;

            if (m_cacheEnabled)
                CreateCacheDirectories();

            m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(m_port);
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapService/", MapRequest));
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapAPI/", MapAPIRequest));

            registry.RegisterModuleInterface<IMapService>(this);

            m_blankRegionTile = new Bitmap(256, 256);
            m_blankRegionTile.Tag = "StaticBlank";
            using (Graphics g = Graphics.FromImage(m_blankRegionTile))
            {
                SolidBrush sea = new SolidBrush(Color.FromArgb(29, 71, 95));
                g.FillRectangle(sea, 0, 0, 256, 256);
            }
            m_blankRegionTileData = CacheMapTexture(1, 0, 0, m_blankRegionTile, true);
            /*string path = Path.Combine("assetcache", Path.Combine("mapzoomlevels", "blankMap.index"));
            if(File.Exists(path))
            {
                FileStream stream = File.OpenRead(path);
                m_blankTiles = ProtoBuf.Serializer.Deserialize<MapTileIndex>(stream);
                stream.Close();
            }*/
        }
예제 #24
0
        public void FinishedStartup()
        {
            _server = _registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(0);
            if (_server != null)
            {
                _server.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
                _registry.RegisterModuleInterface <IWebHttpTextureService>(this);
            }
            IGridInfo gridInfo = _registry.RequestModuleInterface <IGridInfo>();

            _gridNick = gridInfo != null ? gridInfo.GridName :
                        "No Grid Name Available, please set this";
        }
예제 #25
0
        public void Initialize (IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;
            IConfig mapConfig = config.Configs["MapService"];
            if (mapConfig != null)
            {
                m_enabled = mapConfig.GetBoolean ("Enabled", m_enabled);
                m_port = mapConfig.GetUInt ("Port", m_port);
                m_cacheEnabled = mapConfig.GetBoolean ("CacheEnabled", m_cacheEnabled);
                m_cacheExpires = mapConfig.GetFloat ("CacheExpires", m_cacheExpires);
            }
            if(!m_enabled)
                return;

            if (m_cacheEnabled)
                CreateCacheDirectories ();

            m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(m_port);
            m_server.AddHTTPHandler("/MapService/", MapRequest);
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapAPI/", MapAPIRequest));

            registry.RegisterModuleInterface<IMapService>(this);
        }
        public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            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));

            string freeswitchService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

            if (freeswitchService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");

            Object[] args = new Object[] { config };
            m_FreeswitchService =
                    ServerUtils.LoadPlugin<IFreeswitchService>(freeswitchService, args);

            server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
            server.AddHTTPHandler(String.Format("{0}/region-config", m_freeSwitchAPIPrefix), RegionConfigHTTPHandler);
        }
        public void Initialize(Scene scene, IConfigSource source)
        {
            if (m_firstScene == null)
            {
                m_firstScene = scene;

                IConfig startupConfig = source.Configs["Startup"];
                if (startupConfig != null)
                {
                    m_enabled = !startupConfig.GetBoolean("gridmode", false);
                }

                if (m_enabled)
                {
                    bool    authenticate = true;
                    string  welcomeMessage = "Welcome to InWorldz", mapServerURI = String.Empty, profileServerURI = String.Empty;
                    IConfig standaloneConfig = source.Configs["StandAlone"];
                    if (standaloneConfig != null)
                    {
                        authenticate     = standaloneConfig.GetBoolean("accounts_authenticate", true);
                        welcomeMessage   = standaloneConfig.GetString("welcome_message");
                        mapServerURI     = standaloneConfig.GetString("map_server_uri", String.Empty);
                        profileServerURI = standaloneConfig.GetString("profile_server_uri", String.Empty);
                    }

                    //TODO: fix casting.
                    LibraryRootFolder rootFolder
                        = m_firstScene.CommsManager.LibraryRoot as LibraryRootFolder;

                    IHttpServer httpServer = m_firstScene.CommsManager.HttpServer;

                    //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
                    m_loginService = new LLStandaloneLoginService((UserProfileManager)m_firstScene.CommsManager.UserAdminService, mapServerURI, profileServerURI, welcomeMessage, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this);

                    httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);

                    // New Style
                    httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("login_to_simulator"), m_loginService.XmlRpcLoginMethod));

                    // provides the web form login
                    httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
                }
            }

            if (m_enabled)
            {
                AddScene(scene);
            }
        }
예제 #28
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];

            if (handlerConfig.GetString("FreeswitchInHandler", "") != Name)
            {
                return;
            }

            m_registry = registry;
            m_port     = handlerConfig.GetUInt("FreeswitchInHandlerPort");

            if (handlerConfig.GetBoolean("UnsecureUrls", false))
            {
                IHttpServer server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);
                m_port = server.Port;

                m_FreeswitchService = registry.RequestModuleInterface <IFreeswitchService>();

                server.AddHTTPHandler(String.Format("{0}/{1}/freeswitch-config", m_freeSwitchAPIPrefix, UUID.Random()), FreeSwitchConfigHTTPHandler);
                server.AddHTTPHandler(String.Format("{0}/{1}/region-config", m_freeSwitchAPIPrefix, UUID.Random()), RegionConfigHTTPHandler);
            }
            m_registry.RequestModuleInterface <IGridRegistrationService>().RegisterModule(this);
        }
예제 #29
0
        public void FinishedStartup()
        {
            IConfig hgConfig = config.Configs["HyperGrid"];

            if (hgConfig == null || !hgConfig.GetBoolean("Enabled", false))
            {
                return;
            }

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

            if (gridConfig == null || !gridConfig.GetBoolean("Enabled", false))
            {
                return;
            }

            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(',');

            IHttpServer server = MainServer.Instance;

            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);

            server.AddXmlRPCHandler("status_notification", StatusNotification, false);
            server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
            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);

            m_HomeUsersService = registry.RequestModuleInterface <IUserAgentService> ();
            Uri       m_Uri = new Uri(server.FullHostName);
            IPAddress ip    = NetworkUtils.GetHostFromDNS(m_Uri.Host);
            string    sip   = ip.ToString();

            server.AddHTTPHandler("/homeagent", new HomeAgentHandler(m_HomeUsersService, sip, proxy).Handler);
        }
예제 #30
0
        public void Initialise(Scene scene, IConfigSource source)
        {
            if (m_firstScene == null)
            {
                m_firstScene = scene;

                IConfig startupConfig = source.Configs["Startup"];
                if (startupConfig != null)
                {
                    m_enabled = !startupConfig.GetBoolean("gridmode", false);
                }

                if (m_enabled)
                {
                    bool    authenticate     = true;
                    string  welcomeMessage   = "Welcome to OpenSim";
                    IConfig standaloneConfig = source.Configs["StandAlone"];
                    if (standaloneConfig != null)
                    {
                        authenticate   = standaloneConfig.GetBoolean("accounts_authenticate", true);
                        welcomeMessage = standaloneConfig.GetString("welcome_message");
                    }

                    //TODO: fix casting.
                    LibraryRootFolder rootFolder
                        = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;

                    IHttpServer httpServer = m_firstScene.CommsManager.HttpServer;

                    //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
                    m_loginService = new LLStandaloneLoginService((UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage, m_firstScene.CommsManager.InterServiceInventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this);

                    httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);

                    // provides the web form login
                    httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);

                    // Provides the LLSD login
                    httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
                }
            }

            if (m_enabled)
            {
                AddScene(scene);
            }
        }
예제 #31
0
        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);

            server.AddXmlRPCHandler("status_notification", StatusNotification, false);
            server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
            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.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
        }
        public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
                base(config, server, String.Empty)
        {
            IConfig gridConfig = config.Configs["GatekeeperService"];
            if (gridConfig != null)
            {
                string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
                Object[] args = new Object[] { config, simService };
                m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args);

            }
            if (m_GatekeeperService == null)
                throw new Exception("Gatekeeper server connector cannot proceed because of missing service");

            HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);
            server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
            server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);

            server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler);
        }
        public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
                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 };
                m_HomeUsersService = ServerUtils.LoadPlugin<IUserAgentService>(serviceDll, args);
            }
            if (m_HomeUsersService == null)
                throw new Exception("UserAgent server connector cannot proceed because of missing service");

            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);

            server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler);
        }
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            IConfig ssaConfig = config.Configs["SSAService"];
            uint    port      = 8011;

            if (ssaConfig != null)
            {
                m_enabled = ssaConfig.GetBoolean("Enabled", m_enabled);
                port      = ssaConfig.GetUInt("Port", port);
            }
            if (!m_enabled)
            {
                return;
            }
            IHttpServer server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(port);

            ServiceURI = server.ServerURI + "/";
            server.AddHTTPHandler(new GenericStreamHandler("GET", "/texture/", GetBakedTexture));
            registry.RegisterModuleInterface <IAgentAppearanceService>(this);
            m_registry = registry;
        }
예제 #35
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;

            IConfig handlerConfig = config.Configs["Handlers"];
            string  name          = handlerConfig.GetString(Name, "");

            if (name != Name)
            {
                MainConsole.Instance.Warn("[MapAPI] module not loaded");
                return;
            }
            MainConsole.Instance.Info("[MapAPI] module loaded");

            ISimulationBase simBase = registry.RequestModuleInterface <ISimulationBase>();

            m_textureServer = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "TextureServerPort", 8002));
            m_textureServer.AddHTTPHandler(urlMapTexture, OnHTTPGetMapImage);

            m_server = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "Port", 8007));
            m_server.AddStreamHandler(new MapAPIHTTPHandler_GET(this, registry, m_textureServer));
        }
        public void RegionLoaded(Scene scene)
        {
            if (m_firstScene == null)
            {
                m_firstScene = scene;

                if (m_enabled)
                {
                    //TODO: fix casting.
                    LibraryRootFolder rootFolder
                        = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;

                    IHttpServer httpServer = m_firstScene.CommsManager.HttpServer;

                    //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
                    m_loginService
                        = new LLStandaloneLoginService(
                              (UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage,
                              m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate,
                              rootFolder, this);

                    httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);

                    // provides the web form login
                    httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);

                    // Provides the LLSD login
                    httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
                }
            }

            if (m_enabled)
            {
                AddScene(scene);
            }
        }
예제 #37
0
        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/StartSession/", HandleHttpStartSession));
            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/CloseSession/", HandleHttpCloseSession));
            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/SessionCommand/", HandleHttpSessionCommand));
        }
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            if (config.Configs["GridInfoService"] != null)
                m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
            m_registry = registry;
            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString("WireduxHandler", "");
            if (name != Name)
                return;
            string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);
            if (Password != "")
            {
                IConfig gridCfg = config.Configs["GridInfoService"];
                OSDMap gridInfo = new OSDMap();
                if (gridCfg != null)
                {
                    if (gridCfg.GetString("gridname", "") != "" && gridCfg.GetString("gridnick", "") != "")
                    {
                        foreach (string k in gridCfg.GetKeys())
                        {
                            gridInfo[k] = gridCfg.GetString(k);
                        }
                    }
                }

                m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
                //This handler allows sims to post CAPS for their sims on the CAPS server.
                m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry, gridInfo, UUID.Zero));
                m_server2 = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
                m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
                m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);
                gridInfo["WireduxTextureServer"] = m_server2.ServerURI;

                MainConsole.Instance.Commands.AddCommand("webui promote user", "Grants the specified user administrative powers within webui.", "webui promote user", PromoteUser);
                MainConsole.Instance.Commands.AddCommand("webui demote user", "Revokes administrative powers for webui from the specified user.", "webui demote user", DemoteUser);
                MainConsole.Instance.Commands.AddCommand("webui add user", "Deprecated alias for webui promote user.", "webui add user", PromoteUser);
                MainConsole.Instance.Commands.AddCommand("webui remove user", "Deprecated alias for webui demote user.", "webui remove user", DemoteUser);
            }
        }
예제 #39
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;

            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString(Name, "");

            if (name != Name)
            {
                MainConsole.Instance.Warn("[MapAPI] module not loaded");
                return;
            }
            MainConsole.Instance.Info("[MapAPI] module loaded");

            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();

            m_textureServer = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "TextureServerPort", 8002));
            m_textureServer.AddHTTPHandler(urlMapTexture, OnHTTPGetMapImage);

            m_server = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "Port", 8007));
            m_server.AddStreamHandler(new MapAPIHTTPHandler_GET(this, registry, m_textureServer));

        }
예제 #40
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString(Name, "");
            string Password = handlerConfig.GetString(Name + "Password", String.Empty);
            bool runLocally = handlerConfig.GetBoolean("RunLocally", false);
            uint httpPort = handlerConfig.GetUInt("WebUIHTTPPort", 80);
            string phpBinPath = handlerConfig.GetString("phpBinPath", string.Empty);

            if (name != Name || (!runLocally && Password == string.Empty) || (runLocally && phpBinPath == string.Empty))
            {
                return;
            }

            m_registry = registry;

            IConfig GridInfoConfig = config.Configs["GridInfoService"];
            if (GridInfoConfig != null)
            {
                m_servernick = GridInfoConfig.GetString("gridnick", m_servernick);
            }

            if (runLocally)
            {
                SetUpWebUIPHP(httpPort, phpBinPath);
            }

            OSDMap gridInfo = new OSDMap();
            if (GridInfoConfig != null && (GridInfoConfig.GetString("gridname", "") != "" && GridInfoConfig.GetString("gridnick", "") != ""))
            {
                foreach (string k in GridInfoConfig.GetKeys())
                {
                    gridInfo[k] = GridInfoConfig.GetString(k);
                }
            }

            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();

            m_server2 = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "TextureServerPort", 8002));
            m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
            m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);
            gridInfo[Name + "TextureServer"] = m_server2.ServerURI;

            m_server = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "Port", 8007));
            m_server.AddStreamHandler(new WebUIHTTPHandler(this, Password, registry, gridInfo, UUID.Zero, runLocally, httpPort)); //This handler allows sims to post CAPS for their sims on the CAPS server.

            MainConsole.Instance.Commands.AddCommand("webui promote user", "Grants the specified user administrative powers within webui.", "webui promote user", PromoteUser);
            MainConsole.Instance.Commands.AddCommand("webui demote user", "Revokes administrative powers for webui from the specified user.", "webui demote user", DemoteUser);
            //            MainConsole.Instance.Commands.AddCommand("webui add user", "Deprecated alias for webui promote user.", "webui add user", PromoteUser);
            //            MainConsole.Instance.Commands.AddCommand("webui remove user", "Deprecated alias for webui demote user.", "webui remove user", DemoteUser);
        }
예제 #41
0
        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);

            server.AddXmlRPCHandler("status_notification", StatusNotification, false);
            server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
            server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);

            server.AddXmlRPCHandler("locate_user", LocateUser, false);
            server.AddXmlRPCHandler("get_uui", GetUUI, false);

            server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler);
        }
예제 #42
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_connector = DataManager.DataManager.RequestPlugin<WebAPIConnector>();
            if (m_connector == null || m_connector.Enabled == false || m_connector.Handler != Name)
            {
                return;
            }

            IConfig webapiConfig = config.Configs["WebAPI"];
            UUID.TryParse(webapiConfig.GetString("AdminID", UUID.Zero.ToString()), out AdminAgentID);

            if (m_connector.Handler != Name)
            {
                MainConsole.Instance.Warn("[WebAPI]: module not loaded");
                return;
            }
            MainConsole.Instance.Info("[WebAPI]: module loaded");

            m_registry = registry;

            IConfig GridInfoConfig = config.Configs["GridInfoService"];
            if (GridInfoConfig != null)
            {
                m_servernick = GridInfoConfig.GetString("gridnick", m_servernick);
            }

            m_GridInfo = new OSDMap();
            if (GridInfoConfig != null && (GridInfoConfig.GetString("gridname", "") != "" && GridInfoConfig.GetString("gridnick", "") != ""))
            {
                foreach (string k in GridInfoConfig.GetKeys())
                {
                    m_GridInfo[k] = GridInfoConfig.GetString(k);
                }
            }

            m_APIAuthentication = webapiConfig.GetString("SupportedAuthentication", "Digest");
            m_EnableCORS = webapiConfig.GetBoolean("CORS", false);
            m_AccessControlAllowOrigin = (new List<string>(webapiConfig.GetString("AccessControlAllowOrigin", "*").Split(' '))).ConvertAll<string>(x=>x.Trim());

            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();

            m_server = simBase.GetHttpServer(webapiConfig.GetUInt("Port", m_connector.HandlerPort));
            foreach (WebAPIHttpMethod method in Enum.GetValues(typeof(WebAPIHttpMethod)))
            {
                m_server.AddStreamHandler(new WebAPI_StreamHandler(this, method)); // This handler is for WebAPI methods that only read data
            }

            m_server2 = simBase.GetHttpServer(webapiConfig.GetUInt("TextureServerPort", m_connector.TexturePort));
            m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);

            m_GridInfo[Name + "TextureServer"] = m_server2.ServerURI;

            m_authNonces = new ExpiringCache<string, string>();

            #region Users

            MainConsole.Instance.Commands.AddCommand("webapi user promote", "Grants the specified user administrative powers within WebAPI.", "webapi user promote", PromoteUser);
            MainConsole.Instance.Commands.AddCommand("webapi user demote", "Revokes administrative powers for WebAPI from the specified user.", "webapi user demote", DemoteUser);

            #endregion

            #region News

            MainConsole.Instance.Commands.AddCommand("webapi news source add", "Sets a group as a news source so in-world group notices can be used as a publishing tool for the website.", "webapi news source add", AddGroupAsNewsSource);
            MainConsole.Instance.Commands.AddCommand("webapi news source remove", "Removes a group as a news source so it's notices will stop showing up on the news page.", "webapi news source remove", RemoveGroupAsNewsSource);

            #endregion

            #region Access Tokens

            MainConsole.Instance.Commands.AddCommand("webapi access token", "Gets the current access token to the API for the specified user", "webapi access token", GetAccessToken);
            MainConsole.Instance.Commands.AddCommand("webapi access token new", "Gets a new access token to the API for the specified user", "webapi access token new", GetNewAccessToken);

            #endregion

            #region ACL

            MainConsole.Instance.Commands.AddCommand("webapi access grant", "Grants access to a specified method for a specified user.", "webapi access grant [method]", GrantAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi access revoke", "Revokes access for a specified user.", "webapi access revoke", RevokeAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi access reset", "Resets access to defaults for a specified method for a specified user.", "webapi access reset", ResetAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi access display", "Displays information about the API usage for the specified user.", "webapi access display", DisplayAPIAccessInfo);

            MainConsole.Instance.Commands.AddCommand("webapi access threat get", "Gets maximum threat level for API access for the specified user.", "webapi access threat get", GetMaxThreatLevel);
            MainConsole.Instance.Commands.AddCommand("webapi access threat set", "Sets maximum threat level for API access for the specified user.", "webapi access threat set", SetMaxThreatLevel);

            #endregion

            #region Log

            MainConsole.Instance.Commands.AddCommand("webapi log clear", "Clears the API access log", "webapi log clear [staleonly]", ClearLog);
            MainConsole.Instance.Commands.AddCommand("webapi log usage", "Get the current usage rate for the specified user on the specified method.", "webapi log usage", GetUsageRate);

            #endregion

            MainConsole.Instance.Commands.AddCommand("webapi list methods", "List API methods", "webapi list methods", ListAPImethods);
        }
예제 #43
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_connector = DataManager.DataManager.RequestPlugin<WebAPIConnector>();
            if (m_connector == null || m_connector.Enabled == false || m_connector.Handler != Name)
            {
                return;
            }

            IConfig handlerConfig = config.Configs["Handlers"];
            UUID.TryParse(handlerConfig.GetString("WebAPIAdminID", UUID.Zero.ToString()), out AdminAgentID);

            if (m_connector.Handler != Name)
            {
                MainConsole.Instance.Warn("[WebAPI]: module not loaded");
                return;
            }
            MainConsole.Instance.Info("[WebAPI]: module loaded");

            m_registry = registry;

            IConfig GridInfoConfig = config.Configs["GridInfoService"];
            if (GridInfoConfig != null)
            {
                m_servernick = GridInfoConfig.GetString("gridnick", m_servernick);
            }

            m_GridInfo = new OSDMap();
            if (GridInfoConfig != null && (GridInfoConfig.GetString("gridname", "") != "" && GridInfoConfig.GetString("gridnick", "") != ""))
            {
                foreach (string k in GridInfoConfig.GetKeys())
                {
                    m_GridInfo[k] = GridInfoConfig.GetString(k);
                }
            }

            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();

            m_server = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "Port", m_connector.HandlerPort));
            foreach (WebAPIHttpMethod method in Enum.GetValues(typeof(WebAPIHttpMethod)))
            {
                m_server.AddStreamHandler(new WebAPI_StreamHandler(this, method)); // This handler is for WebAPI methods that only read data
            }

            m_server2 = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "TextureServerPort", m_connector.TexturePort));
            m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);

            m_GridInfo[Name + "TextureServer"] = m_server2.ServerURI;

            m_authNonces = new ExpiringCache<string, string>();

            MainConsole.Instance.Commands.AddCommand("webapi promote user", "Grants the specified user administrative powers within WebAPI.", "webapi promote user", PromoteUser);
            MainConsole.Instance.Commands.AddCommand("webapi demote user", "Revokes administrative powers for WebAPI from the specified user.", "webapi demote user", DemoteUser);
            MainConsole.Instance.Commands.AddCommand("webapi add group as news source", "Sets a group as a news source so in-world group notices can be used as a publishing tool for the website.", "webapi add group as news source", AddGroupAsNewsSource);
            MainConsole.Instance.Commands.AddCommand("webapi remove group as news source", "Removes a group as a news source so it's notices will stop showing up on the news page.", "webapi remove group as news source", RemoveGroupAsNewsSource);
            MainConsole.Instance.Commands.AddCommand("webapi list methods", "List API methods", "webapi list methods", ListAPImethods);
            MainConsole.Instance.Commands.AddCommand("webapi get access token", "Gets the current access token to the API for the specified user", "webapi get access token", GetAccessToken);
            MainConsole.Instance.Commands.AddCommand("webapi get new access token", "Gets a new access token to the API for the specified user", "webapi get new access token", GetNewAccessToken);
            MainConsole.Instance.Commands.AddCommand("webapi clear log", "Clears the API access log", "webapi clear log [staleonly]", ClearLog);
            MainConsole.Instance.Commands.AddCommand("webapi get usage rate", "Get the current usage rate for the specified user on the specified method.", "webapi get usage rate", GetUsageRate);
            MainConsole.Instance.Commands.AddCommand("webapi grant access", "Grants access to a specified method for a specified user.", "webapi grant access [method]", GrantAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi revoke access", "Revokes access for a specified user.", "webapi revoke access", RevokeAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi reset access", "Resets access to defaults for a specified method for a specified user.", "webapi reset access", ResetAPIAccess);
        }
예제 #44
0
 public void Start(IConfigSource config, IRegistryCore registry)
 {
     IConfig handlerConfig = config.Configs["Handlers"];
     if (config.Configs["GridInfoService"] != null)
         m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
     m_registry = registry;
     if (handlerConfig.GetString("WireduxHandler", "") != Name)
         return;
     string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);
     if (Password != "")
     {
         m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
         //This handler allows sims to post CAPS for their sims on the CAPS server.
         m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry));
         m_server2 = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
         m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
         m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);
     }
 }
예제 #45
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            if (config.Configs["GridInfoService"] != null)
                m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
            m_registry = registry;
            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString("WireduxHandler", "");
            if (name != Name)
                return;
            string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);
            if (Password != "")
            {
                m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
                //This handler allows sims to post CAPS for their sims on the CAPS server.
                m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry));
                m_server2 = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
                m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
                m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);

                MainConsole.Instance.Commands.AddCommand ("webui add user", "Adds an admin user for WebUI", "webui add user", AddUser);
                MainConsole.Instance.Commands.AddCommand ("webui remove user", "Removes an admin user for WebUI", "webui add user", RemoveUser);
            }
        }