Exemplo n.º 1
0
        public void RegisterCaps(IRegionClientCapsService service)
        {
            m_service = service;

            string capsBase = "/CAPS/EQG/";

            m_capsPath = capsBase + UUID.Random() + "/";


            // Register this as a caps handler
            IRequestHandler rhandler = new RestHTTPHandler("POST", m_capsPath,
                                                           delegate(Hashtable m_dhttpMethod)
            {
                return(ProcessQueue(m_dhttpMethod, service.AgentID));
            });

            m_service.AddStreamHandler("EventQueueGet", rhandler);

            // This will persist this beyond the expiry of the caps handlers
            MainServer.Instance.AddPollServiceHTTPHandler(
                m_capsPath, EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, service.AgentID));

            Random rnd = new Random(Environment.TickCount);

            m_ids = rnd.Next(30000000);
        }
Exemplo n.º 2
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler
                = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);

            caps.RegisterHandler("SimulatorFeatures", reqHandler);
        }
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            //            UUID capID = UUID.Random();

            //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
            if (m_URL == "localhost")
            {
                //                m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
                GetMeshHandler  gmeshHandler = new GetMeshHandler(m_AssetService);
                IRequestHandler reqHandler
                    = new RestHTTPHandler(
                          "GET",
                          "/CAPS/" + UUID.Random(),
                          httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
                          "GetMesh",
                          agentID.ToString());

                caps.RegisterHandler("GetMesh", reqHandler);
            }
            else
            {
                //                m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
                caps.RegisterHandler("GetMesh", m_URL);
            }
        }
Exemplo n.º 4
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            MeshUploadHandler handler    = new MeshUploadHandler(m_scene, agentID, caps);
            IRequestHandler   reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), handler.MeshUploadFlag);

            caps.RegisterHandler("MeshUploadFlag", reqHandler);
        }
Exemplo n.º 5
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag);

            caps.RegisterHandler("MeshUploadFlag", reqHandler);
            m_agentID = agentID;
        }
Exemplo n.º 6
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler
                = new RestHTTPHandler(
                      "GET", "/CAPS/" + UUID.Random(), ht => MeshUploadFlag(ht, agentID), "MeshUploadFlag", agentID.ToString());

            caps.RegisterHandler("MeshUploadFlag", reqHandler);
        }
Exemplo n.º 7
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler
                = new RestHTTPHandler(
                      "GET", "/CAPS/" + UUID.Random(),
                      x => { return(HandleSimulatorFeaturesRequest(x, agentID)); }, "SimulatorFeatures", agentID.ToString());

            caps.RegisterHandler("SimulatorFeatures", reqHandler);
        }
Exemplo n.º 8
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            string capUrl = "/CAPS/" + UUID.Random() + "/";

            IRequestHandler ServerReleaseNote = new RestHTTPHandler("GET", capUrl,
                                                                    delegate(Hashtable request)
            {
                return(ProcessServerReleaseNotes(request, agentID));
            });

            caps.RegisterHandler("ServerReleaseNotes", ServerReleaseNote);
        }
Exemplo n.º 9
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capuuid = UUID.Random();


            IRequestHandler ServerReleaseNote
                = new RestHTTPHandler(
                      "GET", "/CAPS/ServerReleaseNotes/" + capuuid + "/",
                      delegate(Hashtable m_dhttpMethod)
                      { return(ProcessServerReleaseNotes(m_dhttpMethod, agentID, capuuid)); });

            caps.RegisterHandler("ServerReleaseNotes", ServerReleaseNote);
        }
Exemplo n.º 10
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            IRequestHandler reqHandler
                = new RestHTTPHandler(
                      "GET", "/CAPS/" + UUID.Random(),
                      x => { return(HandleSimulatorFeaturesRequest(x, agentID)); }, "SimulatorFeatures", agentID.ToString());

            caps.RegisterHandler("SimulatorFeatures", reqHandler);
        }
Exemplo n.º 11
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capuuid = UUID.Random();

            m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/");

            IRequestHandler handler =
                new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/",
                                    delegate(Hashtable m_dhttpMethod)
            {
                return(ProcessAdd(m_dhttpMethod, agentID, caps));
            });

            caps.RegisterHandler("ObjectAdd", handler);
        }
Exemplo n.º 12
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler = new RestHTTPHandler(
                "GET", "/CAPS/" + UUID.Random(),
                x => { return(HandleSimulatorFeaturesRequest(x, agentID)); },
                "SimulatorFeatures", agentID.ToString());

            caps.RegisterHandler("SimulatorFeatures", reqHandler);

            if (m_doScriptSyntax && m_scriptSyntaxID != UUID.Zero && !String.IsNullOrEmpty(m_scriptSyntaxXML))
            {
                IRequestHandler sreqHandler = new RestHTTPHandler(
                    "GET", "/CAPS/" + UUID.Random(),
                    x => { return(HandleSyntaxRequest(x, agentID)); },
                    "LSLSyntax", agentID.ToString());
                caps.RegisterHandler("LSLSyntax", sreqHandler);
            }
        }
        public GetMeshServerConnector(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 assetService = serverConfig.GetString("AssetService", String.Empty);

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

            Object[] args = new Object[] { config };
            m_AssetService =
                ServerUtils.LoadPlugin <IAssetService>(assetService, args);

            if (m_AssetService == null)
            {
                throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
            }

            string rurl = serverConfig.GetString("GetMeshRedirectURL");

            GetMeshHandler  gmeshHandler = new GetMeshHandler(m_AssetService);
            IRequestHandler reqHandler
                = new RestHTTPHandler(
                      "GET",
                      "/" + UUID.Random(),
                      httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
                      "GetMesh",
                      null);

            server.AddStreamHandler(reqHandler);;
        }
Exemplo n.º 14
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capID = UUID.Random();

            try
            {
                if (m_useAperture == true)
                {
                    string externalBaseURL = GetApertureBaseURL(caps);
                    string externalURL     = GetApertureHttUrl(caps, capID);
                    string addCapURL       = externalBaseURL + ADD_CAPS_TOKEN_URL + m_apToken + "/" + capID.ToString();

                    WebRequest      req      = WebRequest.Create(addCapURL);
                    HttpWebResponse response = (HttpWebResponse)req.GetResponse();

                    if (response.StatusCode != HttpStatusCode.OK)
                    {
                        throw new Exception("Got response '" + response.StatusDescription + "' while trying to register CAPS with HTT");
                    }

                    //register this cap url with the server
                    caps.RegisterHandler("GetTexture", externalURL,
                                         () => this.PauseAperture(caps, capID),
                                         () => this.ResumeAperture(caps, capID),
                                         (int bwMax) => this.SetApertureBandwidth(caps, capID, bwMax));
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(
                    "[APERTURE] Could not contact the aperture texture server to register caps on region {0}. Server returned error {1}",
                    caps.RegionName, e.Message);
            }

            IRequestHandler requestHandler;

            ISimulatorFeaturesModule SimulatorFeatures = m_Scene.RequestModuleInterface <ISimulatorFeaturesModule>();

            if ((SimulatorFeatures != null) && (SimulatorFeatures.MeshEnabled == true))
            {
                //use the same cap ID for mesh and HTT. That way the token bucket in aperture will balance the
                //available bandwidth between mesh and http textures
                //capID = UUID.Random();

                bool getMeshCapRegistered = false;

                try
                {
                    if (m_useAperture == true)
                    {
                        string externalBaseURL = GetApertureBaseURL(caps);
                        string externalURL     = GetApertureHttUrl(caps, capID);

                        //register this cap url with the server
                        caps.RegisterHandler("GetMesh", externalURL); //caps control for the texture server will apply to pause mesh as well
                        getMeshCapRegistered = true;
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat(
                        "[APERTURE] Could not contact the aperture texture server to register caps on region {0}. Server returned error {1}",
                        caps.RegionName, e.Message);
                }

                if (getMeshCapRegistered == false)
                {
                    // m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
                    GetMeshHandler gmeshHandler = new GetMeshHandler(m_Scene, agentID, caps);
                    requestHandler = new RestHTTPHandler(
                        "GET", "/CAPS/" + UUID.Random(),
                        httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null));
                    caps.RegisterHandler("GetMesh", requestHandler);
                }
            }

            // Upload Baked Texture
            UploadBakedTextureHandler uploadHandler = new UploadBakedTextureHandler(m_Scene, caps);

            requestHandler = new RestStreamHandler("POST", "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, uploadHandler.UploadBakedTexture);
            caps.RegisterHandler("UploadBakedTexture", requestHandler);

            requestHandler = new RestStreamHandler("POST", caps.CapsBase + "/" + UUID.Random(), GetObjectCostHandler);
            caps.RegisterHandler("GetObjectCost", requestHandler);

            requestHandler = new RestStreamHandler("POST", caps.CapsBase + "/" + UUID.Random(), ResourceCostsSelected);
            caps.RegisterHandler("ResourceCostSelected", requestHandler);

            requestHandler = new RestStreamHandler("POST", caps.CapsBase + "/" + UUID.Random(), GetObjectPhysicsDataHandler);
            caps.RegisterHandler("GetObjectPhysicsData", requestHandler);
        }