Exemplo n.º 1
0
        /// <summary>
        ///     OnRegisterCaps is invoked via the scene.EventManager
        ///     everytime OpenSim hands out capabilities to a client
        ///     (login, region crossing). We contribute two capabilities to
        ///     the set of capabilities handed back to the client:
        ///     ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
        ///
        ///     ProvisionVoiceAccountRequest allows the client to obtain
        ///     the voice account credentials for the avatar it is
        ///     controlling (e.g., user name, password, etc).
        ///
        ///     ParcelVoiceInfoRequest is invoked whenever the client
        ///     changes from one region or parcel to another.
        ///
        ///     Note that OnRegisterCaps is called here via a closure
        ///     delegate containing the scene of the respective region (see
        ///     Initialise()).
        /// </summary>
        public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
        {
            m_log.DebugFormat("[Free Switc hVoice]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);

            string capsBase = "/CAPS/" + caps.CapsObjectPath;

            caps.RegisterHandler("ProvisionVoiceAccountRequest",
                                 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
                                                       delegate(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(ProvisionVoiceAccountRequest(scene, request, path, param, agentID, caps));
            }));

            caps.RegisterHandler("ParcelVoiceInfoRequest",
                                 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
                                                       delegate(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(ParcelVoiceInfoRequest(scene, request, path, param, agentID, caps));
            }));

            caps.RegisterHandler("ChatSessionRequest", new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
                                                                             delegate(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(ChatSessionRequest(scene, request, path, param, agentID, caps));
            }));
        }
Exemplo n.º 2
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            //            m_log.DebugFormat(
            //                "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID);

            string omCapUrl = "/CAPS/" + UUID.Random();

            lock (m_omCapUsers)
            {
                m_omCapUsers[omCapUrl] = agentID;
                m_omCapUrls[agentID]   = omCapUrl;

                // Even though we're registering for POST we're going to get GETS and UPDATES too
                IRequestHandler handler = new RestStreamHandler("POST", omCapUrl, HandleObjectMediaMessage);
                caps.RegisterHandler("ObjectMedia", handler);
            }

            string omuCapUrl = "/CAPS/" + UUID.Random();

            lock (m_omuCapUsers)
            {
                m_omuCapUsers[omuCapUrl] = agentID;
                m_omuCapUrls[agentID]    = omuCapUrl;

                // Even though we're registering for POST we're going to get GETS and UPDATES too
                IRequestHandler handler = new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage);
                caps.RegisterHandler("ObjectMediaNavigate", handler);
            }
        }
Exemplo n.º 3
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            m_log.Info("[DATASNAPSHOT]: Registering service discovery capability for " + agentID);
            string capsBase = "/CAPS/" + caps.CapsObjectPath;

            caps.RegisterHandler("PublicSnapshotDataInfo",
                                 new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
        }
Exemplo n.º 4
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            SeedCapsHandler handler    = new SeedCapsHandler(m_scene, agentID, caps);
            IRequestHandler reqHandler = new RestStreamHandler("POST", caps.CapsBase + m_requestPath, handler.SeedCapRequest);

            caps.RegisterHandler("SEED", reqHandler);

            m_log.DebugFormat("[CAPS]: Registered seed capability {0} for {1}", caps.CapsBase + m_requestPath, agentID);
        }
Exemplo n.º 5
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            //m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
            string capsBase = "/CAPS/" + caps.CapsObjectPath;

            caps.RegisterHandler("MapLayer",
                                 new RestStreamHandler("POST", capsBase + m_mapLayerPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(MapLayerRequest(request, path, param,
                                       agentID, caps));
            }));
        }
        private void OnRegisterCaps(UUID agentID, Caps caps)
        {
            //            m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}",
            //                Name, agentID, caps.RegionName);

            string capsPath = capsBase + UUID.Random();

            // Get handler
            caps.RegisterHandler(
                capsName,
                new RestStreamHandler(
                    "GET",
                    capsPath,
                    delegate(string request, string path, string param,
                             OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(GetEnvironmentSettings(agentID));
            }));


            // Set handler
            caps.RegisterHandler(
                capsName,
                new RestStreamHandler(
                    "POST",
                    capsPath,
                    delegate(string request, string path, string param,
                             OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                string result = SetEnvironmentSettings(request, agentID);
                if (result == null)
                {
                    return(String.Empty);
                }
                return(result);
            }));
        }
Exemplo n.º 7
0
        private void OnRegisterCaps(UUID agentID, Caps caps)
        {
            //            m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}",
            //                Name, agentID, caps.RegionName);

            string capsPath = capsBase + UUID.Random();

            // Get handler
            caps.RegisterHandler(
                capsName,
                new RestStreamHandler(
                    "GET",
                    capsPath,
                    delegate(string request, string path, string param,
                            OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                    {
                        return GetEnvironmentSettings(request, path, param, agentID, caps);
                    }));


            // Set handler
            caps.RegisterHandler(
                capsName,
                new RestStreamHandler(
                    "POST",
                    capsPath,
                    delegate(string request, string path, string param,
                            OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                    {
                        string result = SetEnvironmentSettings(request, path, param, agentID, caps);
                        if (result == null)
                            return string.Empty;
                        return result;
                    }));
        }
Exemplo n.º 8
0
 public void OnRegisterCaps(UUID agentID, Caps caps)
 {
     //m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
     string capsBase = "/CAPS/" + caps.CapsObjectPath;
     caps.RegisterHandler("MapLayer",
                          new RestStreamHandler("POST", capsBase + m_mapLayerPath,
                                                delegate(string request, string path, string param,
                                                         OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                    {
                                                        return MapLayerRequest(request, path, param,
                                                                               agentID, caps);
                                                    }));
 }
Exemplo n.º 9
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            //            m_log.DebugFormat(
            //                "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID);

            string omCapUrl = "/CAPS/" + UUID.Random();

            lock (m_omCapUsers)
            {
                m_omCapUsers[omCapUrl] = agentID;
                m_omCapUrls[agentID] = omCapUrl;

                // Even though we're registering for POST we're going to get GETS and UPDATES too
                IRequestHandler handler = new RestStreamHandler("POST", omCapUrl, HandleObjectMediaMessage);
                caps.RegisterHandler("ObjectMedia", handler);

            }

            string omuCapUrl = "/CAPS/" + UUID.Random();

            lock (m_omuCapUsers)
            {
                m_omuCapUsers[omuCapUrl] = agentID;
                m_omuCapUrls[agentID] = omuCapUrl;

                // Even though we're registering for POST we're going to get GETS and UPDATES too
                IRequestHandler handler = new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage);
                caps.RegisterHandler("ObjectMediaNavigate", handler);
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            SeedCapsHandler handler = new SeedCapsHandler(m_scene, agentID, caps);
            IRequestHandler reqHandler = new RestStreamHandler("POST", caps.CapsBase + m_requestPath, handler.SeedCapRequest);
            caps.RegisterHandler("SEED", reqHandler); 

            m_log.DebugFormat("[CAPS]: Registered seed capability {0} for {1}", caps.CapsBase + m_requestPath, agentID);
        }
Exemplo n.º 12
0
        // <summary>
        // OnRegisterCaps is invoked via the scene.EventManager
        // everytime OpenSim hands out capabilities to a client
        // (login, region crossing). We contribute two capabilities to
        // the set of capabilities handed back to the client:
        // ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
        // 
        // ProvisionVoiceAccountRequest allows the client to obtain
        // the voice account credentials for the avatar it is
        // controlling (e.g., user name, password, etc).
        // 
        // ParcelVoiceInfoRequest is invoked whenever the client
        // changes from one region or parcel to another.
        //
        // Note that OnRegisterCaps is called here via a closure
        // delegate containing the scene of the respective region (see
        // Initialize()).
        // </summary>
        public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
        {
            //m_log.DebugFormat("[VivoxVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);

            string capsBase = "/CAPS/" + caps.CapsObjectPath;
            caps.RegisterHandler("ProvisionVoiceAccountRequest",
                                 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return ProvisionVoiceAccountRequest(scene, request, path, param,
                                                                                               agentID, caps);
                                                       }));
            caps.RegisterHandler("ParcelVoiceInfoRequest",
                                 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return ParcelVoiceInfoRequest(scene, request, path, param,
                                                                                         agentID, caps);
                                                       }));
            caps.RegisterHandler("ChatSessionRequest",
                                 new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return ChatSessionRequest(scene, request, path, param,
                                                                                     agentID, caps);
                                                       }));
        }
Exemplo n.º 13
0
        private void OnRegisterCaps(UUID agentID, Caps caps)
        {
            string capsBase = "/CAPS/" + caps.CapsObjectPath;
            caps.RegisterHandler(
                "RemoteParcelRequest",
                new RestStreamHandler(
                    "POST",
                    capsBase + remoteParcelRequestPath,
                    (request, path, param, httpRequest, httpResponse)
                        => RemoteParcelRequest(request, path, param, agentID, caps),
                    "RemoteParcelRequest",
                    agentID.ToString()));

            UUID parcelCapID = UUID.Random();
            caps.RegisterHandler(
                "ParcelPropertiesUpdate",
                new RestStreamHandler(
                    "POST",
                    "/CAPS/" + parcelCapID,
                        (request, path, param, httpRequest, httpResponse)
                            => ProcessPropertiesUpdate(request, path, param, agentID, caps),
                    "ParcelPropertiesUpdate",
                    agentID.ToString()));            
        }
Exemplo n.º 14
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capID = UUID.Random();
            bool getTextureCapRegistered = false;

            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));
                    getTextureCapRegistered = 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 (getTextureCapRegistered == false)
            {
#if false
            // If we get here aperture is either disabled or we failed to contact it
            IRequestHandler handler = new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString());
            caps.RegisterHandler("GetTexture", handler);
            // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);  
#endif
            }

            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);
        }
Exemplo n.º 15
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capID = UUID.Random();

            //            m_log.Debug("[UPLOAD OBJECT ASSET MODULE]: /CAPS/" + capID);
            caps.RegisterHandler(
                "UploadObjectAsset",
                new RestHTTPHandler(
                    "POST",
                    "/CAPS/OA/" + capID + "/",
                    httpMethod => ProcessAdd(httpMethod, agentID, caps)));

            /*
                   caps.RegisterHandler("NewFileAgentInventoryVariablePrice",

                           new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST",
                                                                                                  "/CAPS/" + capID.ToString(),
                                                                                                  delegate(LLSDAssetUploadRequest req)
                                                              {
                                                                  return NewAgentInventoryRequest(req,agentID);
                                                              }));
             */

        }
Exemplo n.º 16
0
        // OnRegisterCaps is invoked via the scene.EventManager
        // everytime OpenSim hands out capabilities to a client
        // (login, region crossing). We contribute two capabilities to
        // the set of capabilities handed back to the client:
        // ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
        // 
        // ProvisionVoiceAccountRequest allows the client to obtain
        // the voice account credentials for the avatar it is
        // controlling (e.g., user name, password, etc).
        // 
        // ParcelVoiceInfoRequest is invoked whenever the client
        // changes from one region or parcel to another.
        //
        // Note that OnRegisterCaps is called here via a closure
        // delegate containing the scene of the respective region (see
        // Initialise()).
        public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
        {
            m_log.DebugFormat("[MurmurVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);

            string capsBase = "/CAPS/" + caps.CapsObjectPath;
            caps.RegisterHandler("ProvisionVoiceAccountRequest",
                                 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return ProvisionVoiceAccountRequest(scene, request, path, param,
                                                                                               agentID);
                                                       }));
            caps.RegisterHandler("ParcelVoiceInfoRequest",
                                 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return ParcelVoiceInfoRequest(scene, request, path, param,
                                                                                         agentID);
                                                       }));
            caps.RegisterHandler("ChatSessionRequest",
                                 new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return ChatSessionRequest(scene, request, path, param,
                                                                                     agentID);
                                                       }));

            // For Naali Viewer
            caps.RegisterHandler("mumble_server_info",
                                 new RestStreamHandler("GET", capsBase + m_chatSessionRequestPath,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                                                       {
                                                           return RestGetMumbleServerInfo(scene, request, path, param, httpRequest, httpResponse);
                                                       }));
        }