Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capId = UUID.Random();

            caps.RegisterHandler("AgentPreferences",
                                 new RestStreamHandler("POST", "/CAPS/" + capId,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(UpdateAgentPreferences(request, path, param, agentID));
            }));
            caps.RegisterHandler("UpdateAgentLanguage",
                                 new RestStreamHandler("POST", "/CAPS/" + capId,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(UpdateAgentPreferences(request, path, param, agentID));
            }));
            caps.RegisterHandler("UpdateAgentInformation",
                                 new RestStreamHandler("POST", "/CAPS/" + capId,
                                                       delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(UpdateAgentPreferences(request, path, param, agentID));
            }));
        }
Ejemplo n.º 3
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler
                = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);

            caps.RegisterHandler("SimulatorFeatures", reqHandler);
        }
        private void OnRegisterCaps(UUID agentID, OpenSim.Framework.Communications.Capabilities.Caps caps)
        {
            string renderCap = CapsUtil.CreateCAPS("RenderMaterials", String.Empty);

            // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
            // and POST handlers, so we first set up a POST handler normally and then add a GET/PUT handler via MainServer

            IRequestHandler renderMaterialsPostHandler
                = new RestStreamHandler(
                      "POST", renderCap,
                      (request, path, param, httpRequest, httpResponse) => RenderMaterialsPostCap(request, agentID),
                      "RenderMaterials", null);

            MainServer.Instance.AddStreamHandler(renderMaterialsPostHandler);
            caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler);

            IRequestHandler renderMaterialsGetHandler
                = new RestStreamHandler("GET", renderCap,
                                        (request, path, param, httpRequest, httpResponse) => RenderMaterialsGetCap(request),
                                        "RenderMaterials", null);

            MainServer.Instance.AddStreamHandler(renderMaterialsGetHandler);

            // materials viewer seems to use either POST or PUT, so assign POST handler for PUT as well
            IRequestHandler renderMaterialsPutHandler
                = new RestStreamHandler("PUT", renderCap,
                                        (request, path, param, httpRequest, httpResponse) => RenderMaterialsPostCap(request, agentID),
                                        "RenderMaterials", null);

            MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler);
        }
Ejemplo n.º 5
0
 public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
 {
     handlerDeregisterCaps = OnDeregisterCaps;
     if (handlerDeregisterCaps != null)
     {
         handlerDeregisterCaps(agentID, caps);
     }
 }
Ejemplo n.º 6
0
 public void ResumeTraffic()
 {
     OpenSim.Framework.Communications.Capabilities.Caps userCaps = _capsModule.GetCapsForUser(_userId);
     if (userCaps != null)
     {
         userCaps.ResumeTraffic();
     }
 }
Ejemplo n.º 7
0
 public void SetMaxBandwidth(int bwMax)
 {
     OpenSim.Framework.Communications.Capabilities.Caps userCaps = _capsModule.GetCapsForUser(_userId);
     if (userCaps != null)
     {
         userCaps.SetMaxBandwidth(bwMax);
     }
 }
Ejemplo n.º 8
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capID = UUID.Random();
            GroupMemberDataHandler handler =
                new GroupMemberDataHandler("/CAPS/" + capID + "/", "GroupMemberData", agentID, m_scene);

            caps.RegisterHandler("GroupMemberData", handler);
        }
Ejemplo n.º 9
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capuuid = UUID.Random();

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

            caps.RegisterHandler("ObjectAdd",
                                 new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/",
                                                     delegate(Hashtable m_dhttpMethod)
            {
                return(ProcessAdd(m_dhttpMethod, agentID, caps));
            }));
        }
            public EventQueueGetRequestHandler(string httpMethod, string path, UUID agentID, Caps caps, int debugLevel)
                : base(httpMethod, path, "EventQueueGetHandler", "AsyncRequest")
            {
                m_eqLock            = new object();
                m_agentID           = agentID;
                m_Caps              = caps;
                m_highPriorityItems = new Queue <OSD>();
                m_Items             = new Queue <OSD>();
                Random rnd = new Random(Environment.TickCount);

                m_SequenceNumber = rnd.Next(30000000);
                DebugLevel       = debugLevel;
            }
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            if (!m_scene.RegionInfo.EstateSettings.IsEstateManager(agentID))
            {
                return;
            }

            UUID capID = UUID.Random();

            //            m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
            caps.RegisterHandler(
                "SimConsoleAsync",
                new ConsoleHandler("/CAPS/" + capID + "/", "SimConsoleAsync", agentID, this, m_scene));
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            string homeLocationCap = CapsUtil.CreateCAPS("HomeLocation", String.Empty);

            // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
            // and POST handlers, so we first set up a POST handler normally and then add a GET/PUT handler via MainServer

            IRequestHandler homeLocationRequestHandler
                = new RestStreamHandler(
                      "POST", homeLocationCap,
                      (request, path, param, httpRequest, httpResponse) => HomeLocation(request, agentID),
                      "HomeLocation", null);

            MainServer.Instance.AddStreamHandler(homeLocationRequestHandler);
            caps.RegisterHandler("HomeLocation", homeLocationRequestHandler);
        }
        public void OnDeregisterCaps(UUID AgentID, Caps caps)
        {
            m_log.DebugFormat("[EVENTQUEUE]: Deregister caps for client {0} in region {1}", AgentID, m_Scene.RegionInfo.RegionName);

            lock (queues)
            {
                caps.DeregisterHandler("EventQueueGet");

                // If there is a posted request signal it.  We'll send a 404 in the handler
                EventQueueGetRequestHandler queue;
                if (queues.TryGetValue(AgentID, out queue) == true)
                {
                    queues.Remove(AgentID);
                    queue.DumpQueue();
                }
            }
        }
Ejemplo n.º 15
0
        public void AddCapsHandler(UUID agentId)
        {
            if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
            {
                return;
            }

            String capsObjectPath = GetCapsPath(agentId);

            if (m_capsHandlers.ContainsKey(agentId))
            {
                Caps oldCaps = m_capsHandlers[agentId];

                m_log.DebugFormat(
                    "[CAPS]: Reregistering caps for agent {0}.  Old caps path {1}, new caps path {2}. ",
                    agentId, oldCaps.CapsObjectPath, capsObjectPath);
                // This should not happen. The caller code is confused. We need to fix that.
                // CAPs can never be reregistered, or the client will be confused.
                // Hence this return here.
                //return;
            }

            Caps caps
                = new Caps(
                      m_scene.CommsManager.AssetCache, m_scene.CommsManager.HttpServer, m_scene.RegionInfo.ExternalHostName,
                      m_scene.CommsManager.HttpServer.Port,
                      capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);

            caps.RegisterHandlers();

            m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);

            caps.AddNewInventoryItem           = m_scene.AddUploadedInventoryItem;
            caps.ItemUpdatedCall               = m_scene.CapsUpdateInventoryItemAsset;
            caps.TaskScriptUpdatedCall         = m_scene.CapsUpdateTaskInventoryScriptAsset;
            caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS;
            caps.GetClient = m_scene.SceneContents.GetControllingClient;

            m_capsHandlers[agentId] = caps;
        }
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            m_log.DebugFormat("[EVENTQUEUE]: Register caps for client {0} in region {1}", agentID, m_Scene.RegionInfo.RegionName);

            lock (queues)
            {
                EventQueueGetRequestHandler queue;
                if (queues.TryGetValue(agentID, out queue) == true)
                {
                    // shouldn't happen
                    m_log.ErrorFormat("[EVENTQUEUE]: OnRegisterCaps and an EQ already exists for client {0} in region {1}!", agentID, m_Scene.RegionInfo.RegionName);
                }
                else
                {
                    string capsUrl = "/CAPS/EQG/" + UUID.Random().ToString() + "/";
                    queue = new EventQueueGetRequestHandler("POST", capsUrl, agentID, caps, DebugLevel);
                    queues.Add(agentID, queue);
                }

                caps.RegisterHandler("EventQueueGet", queue);
            }
        }
Ejemplo n.º 17
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            if (!m_scene.RegionInfo.EstateSettings.IsEstateManager(agentID))
                return;

            UUID capID = UUID.Random();

            //            m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
            caps.RegisterHandler(
                "SimConsoleAsync",
                new ConsoleHandler("/CAPS/" + capID + "/", "SimConsoleAsync", agentID, this, m_scene));
        }
Ejemplo n.º 18
0
        public Hashtable ProcessQueue(Hashtable request, UUID agentID, Caps caps)
        {
            // TODO: this has to be redone to not busy-wait (and block the thread),
            // TODO: as soon as we have a non-blocking way to handle HTTP-requests.

//            if (m_log.IsDebugEnabled)
//            {
//                String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [  ";
//                foreach (object key in request.Keys)
//                {
//                    debug += key.ToString() + "=" + request[key].ToString() + "  ";
//                }
//                m_log.DebugFormat(debug + "  ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name);
//            }

            BlockingLLSDQueue queue = TryGetQueue(agentID);
            OSD element             = queue.Dequeue(15000); // 15s timeout

            Hashtable responsedata = new Hashtable();

            int thisID = 0;

            lock (m_ids)
                thisID = m_ids[agentID];

            if (element == null)
            {
                //m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName);
                if (thisID == -1) // close-request
                {
                    m_log.ErrorFormat("[EVENTQUEUE]: 404 in " + m_scene.RegionInfo.RegionName);
                    responsedata["int_response_code"]   = 404; //501; //410; //404;
                    responsedata["content_type"]        = "text/plain";
                    responsedata["keepalive"]           = false;
                    responsedata["str_response_string"] = "Closed EQG";
                    return(responsedata);
                }
                responsedata["int_response_code"]     = 502;
                responsedata["content_type"]          = "text/plain";
                responsedata["keepalive"]             = false;
                responsedata["str_response_string"]   = "Upstream error: ";
                responsedata["error_status_text"]     = "Upstream error:";
                responsedata["http_protocol_version"] = "HTTP/1.0";
                return(responsedata);
            }

            OSDArray array = new OSDArray();

            if (element == null) // didn't have an event in 15s
            {
                // Send it a fake event to keep the client polling!   It doesn't like 502s like the proxys say!
                array.Add(EventQueueHelper.KeepAliveEvent());
                m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
            }
            else
            {
                array.Add(element);
                while (queue.Count() > 0)
                {
                    array.Add(queue.Dequeue(1));
                    thisID++;
                }
            }

            OSDMap events = new OSDMap();

            events.Add("events", array);

            events.Add("id", new OSDInteger(thisID));
            lock (m_ids)
            {
                m_ids[agentID] = thisID + 1;
            }

            responsedata["int_response_code"]   = 200;
            responsedata["content_type"]        = "application/xml";
            responsedata["keepalive"]           = false;
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
            //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);

            return(responsedata);
        }
Ejemplo n.º 19
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            // Register an event queue for the client

            //m_log.DebugFormat(
            //    "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
            //    agentID, caps, m_scene.RegionInfo.RegionName);

            // Let's instantiate a Queue for this agent right now
            TryGetQueue(agentID);

            string capsBase          = "/CAPS/EQG/";
            UUID   EventQueueGetUUID = UUID.Zero;

            lock (m_AvatarQueueUUIDMapping)
            {
                // Reuse open queues.  The client does!
                if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
                {
                    m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
                    EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
                }
                else
                {
                    EventQueueGetUUID = UUID.Random();
                    //m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!");
                }
            }

            lock (m_QueueUUIDAvatarMapping)
            {
                if (!m_QueueUUIDAvatarMapping.ContainsKey(EventQueueGetUUID))
                {
                    m_QueueUUIDAvatarMapping.Add(EventQueueGetUUID, agentID);
                }
            }

            lock (m_AvatarQueueUUIDMapping)
            {
                if (!m_AvatarQueueUUIDMapping.ContainsKey(agentID))
                {
                    m_AvatarQueueUUIDMapping.Add(agentID, EventQueueGetUUID);
                }
            }

            // Register this as a caps handler
            caps.RegisterHandler("EventQueueGet",
                                 new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/",
                                                     delegate(Hashtable m_dhttpMethod)
            {
                return(ProcessQueue(m_dhttpMethod, agentID, caps));
            }));

            // This will persist this beyond the expiry of the caps handlers
            m_scene.CommsManager.HttpServer.AddHTTPHandler(
                capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePath2);

            Random rnd = new Random(Environment.TickCount);

            lock (m_ids)
            {
                if (!m_ids.ContainsKey(agentID))
                {
                    m_ids.Add(agentID, rnd.Next(30000000));
                }
            }
        }
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            if(!m_enabled)
                return;

            UUID capID = UUID.Random();

//            m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID);
            caps.RegisterHandler(
                "NewFileAgentInventoryVariablePrice",
                new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>(
                    "POST",
                    "/CAPS/" + capID.ToString(),
                    req => NewAgentInventoryRequest(req, agentID),
                    "NewFileAgentInventoryVariablePrice",
                    agentID.ToString()));         
        }
Ejemplo n.º 21
0
 public MeshUploadHandler(Scene scene, UUID agentID, Caps caps)
 {
     m_agentID = agentID;
     m_Caps    = caps;
     m_Scene   = scene;
 }
Ejemplo n.º 22
0
        public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap)
        {
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 400; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["str_response_string"] = "Request wasn't what was expected";
            ScenePresence avatar;

            if (!m_scene.TryGetAvatar(AgentId, out avatar))
                return responsedata; 

            OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
            //UUID session_id = UUID.Zero;
            bool bypass_raycast = false;
            uint everyone_mask = 0;
            uint group_mask = 0;
            uint next_owner_mask = 0;
            uint flags = 0;
            UUID group_id = UUID.Zero;
            int hollow = 0;
            int material = 0;
            int p_code = 0;
            int path_begin = 0;
            int path_curve = 0;
            int path_end = 0;
            int path_radius_offset = 0;
            int path_revolutions = 0;
            int path_scale_x = 0;
            int path_scale_y = 0;
            int path_shear_x = 0;
            int path_shear_y = 0;
            int path_skew = 0;
            int path_taper_x = 0;
            int path_taper_y = 0;
            int path_twist = 0;
            int path_twist_begin = 0;
            int profile_begin = 0;
            int profile_curve = 0;
            int profile_end = 0;
            Vector3 ray_end = Vector3.Zero;
            bool ray_end_is_intersection = false;
            Vector3 ray_start = Vector3.Zero;
            UUID ray_target_id = UUID.Zero;
            Quaternion rotation = Quaternion.Identity;
            Vector3 scale = Vector3.Zero;
            int state = 0;

            if (r.Type != OSDType.Map) // not a proper req
                return responsedata;
            
            OSDMap rm = (OSDMap)r;

            if (rm.ContainsKey("ObjectData")) //v2
            {
                if (rm["ObjectData"].Type != OSDType.Map)
                {
                    responsedata["str_response_string"] = "Has ObjectData key, but data not in expected format";
                    return responsedata;
                }

                OSDMap ObjMap = (OSDMap) rm["ObjectData"];

                bypass_raycast = ObjMap["BypassRaycast"].AsBoolean();
                everyone_mask = readuintval(ObjMap["EveryoneMask"]);
                flags = readuintval(ObjMap["Flags"]);
                group_mask = readuintval(ObjMap["GroupMask"]);
                material = ObjMap["Material"].AsInteger();
                next_owner_mask = readuintval(ObjMap["NextOwnerMask"]);
                p_code = ObjMap["PCode"].AsInteger();

                if (ObjMap.ContainsKey("Path"))
                {
                    if (ObjMap["Path"].Type != OSDType.Map)
                    {
                        responsedata["str_response_string"] = "Has Path key, but data not in expected format";
                        return responsedata;
                    }

                    OSDMap PathMap = (OSDMap)ObjMap["Path"];
                    path_begin = PathMap["Begin"].AsInteger();
                    path_curve = PathMap["Curve"].AsInteger();
                    path_end = PathMap["End"].AsInteger();
                    path_radius_offset = PathMap["RadiusOffset"].AsInteger();
                    path_revolutions = PathMap["Revolutions"].AsInteger();
                    path_scale_x = PathMap["ScaleX"].AsInteger();
                    path_scale_y = PathMap["ScaleY"].AsInteger();
                    path_shear_x = PathMap["ShearX"].AsInteger();
                    path_shear_y = PathMap["ShearY"].AsInteger();
                    path_skew = PathMap["Skew"].AsInteger();
                    path_taper_x = PathMap["TaperX"].AsInteger();
                    path_taper_y = PathMap["TaperY"].AsInteger();
                    path_twist = PathMap["Twist"].AsInteger();
                    path_twist_begin = PathMap["TwistBegin"].AsInteger();

                }

                if (ObjMap.ContainsKey("Profile"))
                {
                    if (ObjMap["Profile"].Type != OSDType.Map)
                    {
                        responsedata["str_response_string"] = "Has Profile key, but data not in expected format";
                        return responsedata;
                    }
                        
                    OSDMap ProfileMap = (OSDMap)ObjMap["Profile"];

                    profile_begin = ProfileMap["Begin"].AsInteger();
                    profile_curve = ProfileMap["Curve"].AsInteger();
                    profile_end = ProfileMap["End"].AsInteger();
                    hollow = ProfileMap["Hollow"].AsInteger();
                }
                ray_end_is_intersection = ObjMap["RayEndIsIntersection"].AsBoolean();
                
                ray_target_id = ObjMap["RayTargetId"].AsUUID();
                state = ObjMap["State"].AsInteger();
                try
                {
                    ray_end = ((OSDArray) ObjMap["RayEnd"]).AsVector3();
                    ray_start = ((OSDArray) ObjMap["RayStart"]).AsVector3();
                    scale = ((OSDArray) ObjMap["Scale"]).AsVector3();
                    rotation = ((OSDArray)ObjMap["Rotation"]).AsQuaternion();
                }
                catch (Exception)
                {
                    responsedata["str_response_string"] = "RayEnd, RayStart, Scale or Rotation wasn't in the expected format";
                    return responsedata;
                }

                if (rm.ContainsKey("AgentData"))
                {
                    if (rm["AgentData"].Type != OSDType.Map)
                    {
                        responsedata["str_response_string"] = "Has AgentData key, but data not in expected format";
                        return responsedata;
                    }

                    OSDMap AgentDataMap = (OSDMap) rm["AgentData"];

                    //session_id = AgentDataMap["SessionId"].AsUUID();
                    group_id = AgentDataMap["GroupId"].AsUUID();
                }

            }
            else
            { //v1
                bypass_raycast = rm["bypass_raycast"].AsBoolean();

                everyone_mask = readuintval(rm["everyone_mask"]);
                flags = readuintval(rm["flags"]);
                group_id = rm["group_id"].AsUUID();
                group_mask = readuintval(rm["group_mask"]);
                hollow = rm["hollow"].AsInteger();
                material = rm["material"].AsInteger();
                next_owner_mask = readuintval(rm["next_owner_mask"]);
                hollow = rm["hollow"].AsInteger();
                p_code = rm["p_code"].AsInteger();
                path_begin = rm["path_begin"].AsInteger();
                path_curve = rm["path_curve"].AsInteger();
                path_end = rm["path_end"].AsInteger();
                path_radius_offset = rm["path_radius_offset"].AsInteger();
                path_revolutions = rm["path_revolutions"].AsInteger();
                path_scale_x = rm["path_scale_x"].AsInteger();
                path_scale_y = rm["path_scale_y"].AsInteger();
                path_shear_x = rm["path_shear_x"].AsInteger();
                path_shear_y = rm["path_shear_y"].AsInteger();
                path_skew = rm["path_skew"].AsInteger();
                path_taper_x = rm["path_taper_x"].AsInteger();
                path_taper_y = rm["path_taper_y"].AsInteger();
                path_twist = rm["path_twist"].AsInteger();
                path_twist_begin = rm["path_twist_begin"].AsInteger();
                profile_begin = rm["profile_begin"].AsInteger();
                profile_curve = rm["profile_curve"].AsInteger();
                profile_end = rm["profile_end"].AsInteger();
                
                ray_end_is_intersection = rm["ray_end_is_intersection"].AsBoolean();
                
                ray_target_id = rm["ray_target_id"].AsUUID();
                
                
                //session_id = rm["session_id"].AsUUID();
                state = rm["state"].AsInteger();
                try 
                {
                    ray_end = ((OSDArray)rm["ray_end"]).AsVector3();
                    ray_start = ((OSDArray)rm["ray_start"]).AsVector3();
                    rotation = ((OSDArray)rm["rotation"]).AsQuaternion();
                    scale = ((OSDArray)rm["scale"]).AsVector3();
                } 
                catch (Exception)
                {
                    responsedata["str_response_string"] = "RayEnd, RayStart, Scale or Rotation wasn't in the expected format";
                    return responsedata;
                }
            }

            Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false, UUID.Zero);

            PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();

            pbs.PathBegin = (ushort)path_begin;
            pbs.PathCurve = (byte)path_curve;
            pbs.PathEnd = (ushort)path_end;
            pbs.PathRadiusOffset = (sbyte)path_radius_offset;
            pbs.PathRevolutions = (byte)path_revolutions;
            pbs.PathScaleX = (byte)path_scale_x;
            pbs.PathScaleY = (byte)path_scale_y;
            pbs.PathShearX = (byte) path_shear_x;
            pbs.PathShearY = (byte)path_shear_y;
            pbs.PathSkew = (sbyte)path_skew;
            pbs.PathTaperX = (sbyte)path_taper_x;
            pbs.PathTaperY = (sbyte)path_taper_y;
            pbs.PathTwist = (sbyte)path_twist;
            pbs.PathTwistBegin = (sbyte)path_twist_begin;
            pbs.HollowShape = (HollowShape) hollow;
            pbs.PCode = (byte)p_code;
            pbs.ProfileBegin = (ushort) profile_begin;
            pbs.ProfileCurve = (byte) profile_curve;
            pbs.ProfileEnd = (ushort)profile_end;
            pbs.Scale = scale;
            pbs.State = (byte)state;

            SceneObjectGroup obj = null; ;

            if (m_scene.Permissions.CanRezObject(1, avatar.UUID, UUID.Zero, pos, false))
            {
                // rez ON the ground, not IN the ground
                pos.Z += 0.25F;

                obj = m_scene.AddNewPrim(avatar.UUID, group_id, pos, rotation, pbs, false);
            }


            if (obj == null)
                return responsedata;

            SceneObjectPart rootpart = obj.RootPart;
            rootpart.Shape = pbs;
            rootpart.Flags |= (PrimFlags)flags;
            rootpart.EveryoneMask = everyone_mask;
            rootpart.GroupID = group_id;
            rootpart.GroupMask = group_mask;
            rootpart.NextOwnerMask = next_owner_mask;
            rootpart.Material = (byte)material;
            
            m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
            
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>",ConvertUintToBytes(obj.LocalId));

            return responsedata;
        }
Ejemplo n.º 23
0
 public EventQueueGetRequestHandler(string httpMethod, string path, UUID agentID, Caps caps, int debugLevel) 
     : base(httpMethod, path, "EventQueueGetHandler", "AsyncRequest")
 {
     m_eqLock = new object();
     m_agentID = agentID;
     m_Caps = caps;
     m_highPriorityItems = new Queue<OSD>();
     m_Items = new Queue<OSD>();
     Random rnd = new Random(Environment.TickCount);
     m_SequenceNumber = rnd.Next(30000000);
     DebugLevel = debugLevel;
 }
Ejemplo n.º 24
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);
 }
Ejemplo n.º 25
0
 public MeshUploadHandler(Scene scene, UUID agentID, Caps caps)
 {
     m_agentID = agentID;
     m_Caps = caps;
     m_Scene = scene;
 }
Ejemplo n.º 26
0
        public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap)
        {
            Hashtable responsedata = new Hashtable();

            responsedata["int_response_code"]   = 400; //501; //410; //404;
            responsedata["content_type"]        = "text/plain";
            responsedata["str_response_string"] = "Request wasn't what was expected";
            ScenePresence avatar;

            if (!m_scene.TryGetAvatar(AgentId, out avatar))
            {
                return(responsedata);
            }

            OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
            //UUID session_id = UUID.Zero;
            bool       bypass_raycast          = false;
            uint       everyone_mask           = 0;
            uint       group_mask              = 0;
            uint       next_owner_mask         = 0;
            uint       flags                   = 0;
            UUID       group_id                = UUID.Zero;
            int        hollow                  = 0;
            int        material                = 0;
            int        p_code                  = 0;
            int        path_begin              = 0;
            int        path_curve              = 0;
            int        path_end                = 0;
            int        path_radius_offset      = 0;
            int        path_revolutions        = 0;
            int        path_scale_x            = 0;
            int        path_scale_y            = 0;
            int        path_shear_x            = 0;
            int        path_shear_y            = 0;
            int        path_skew               = 0;
            int        path_taper_x            = 0;
            int        path_taper_y            = 0;
            int        path_twist              = 0;
            int        path_twist_begin        = 0;
            int        profile_begin           = 0;
            int        profile_curve           = 0;
            int        profile_end             = 0;
            Vector3    ray_end                 = Vector3.Zero;
            bool       ray_end_is_intersection = false;
            Vector3    ray_start               = Vector3.Zero;
            UUID       ray_target_id           = UUID.Zero;
            Quaternion rotation                = Quaternion.Identity;
            Vector3    scale                   = Vector3.Zero;
            int        state                   = 0;

            if (r.Type != OSDType.Map) // not a proper req
            {
                return(responsedata);
            }

            OSDMap rm = (OSDMap)r;

            if (rm.ContainsKey("ObjectData")) //v2
            {
                if (rm["ObjectData"].Type != OSDType.Map)
                {
                    responsedata["str_response_string"] = "Has ObjectData key, but data not in expected format";
                    return(responsedata);
                }

                OSDMap ObjMap = (OSDMap)rm["ObjectData"];

                bypass_raycast  = ObjMap["BypassRaycast"].AsBoolean();
                everyone_mask   = readuintval(ObjMap["EveryoneMask"]);
                flags           = readuintval(ObjMap["Flags"]);
                group_mask      = readuintval(ObjMap["GroupMask"]);
                material        = ObjMap["Material"].AsInteger();
                next_owner_mask = readuintval(ObjMap["NextOwnerMask"]);
                p_code          = ObjMap["PCode"].AsInteger();

                if (ObjMap.ContainsKey("Path"))
                {
                    if (ObjMap["Path"].Type != OSDType.Map)
                    {
                        responsedata["str_response_string"] = "Has Path key, but data not in expected format";
                        return(responsedata);
                    }

                    OSDMap PathMap = (OSDMap)ObjMap["Path"];
                    path_begin         = PathMap["Begin"].AsInteger();
                    path_curve         = PathMap["Curve"].AsInteger();
                    path_end           = PathMap["End"].AsInteger();
                    path_radius_offset = PathMap["RadiusOffset"].AsInteger();
                    path_revolutions   = PathMap["Revolutions"].AsInteger();
                    path_scale_x       = PathMap["ScaleX"].AsInteger();
                    path_scale_y       = PathMap["ScaleY"].AsInteger();
                    path_shear_x       = PathMap["ShearX"].AsInteger();
                    path_shear_y       = PathMap["ShearY"].AsInteger();
                    path_skew          = PathMap["Skew"].AsInteger();
                    path_taper_x       = PathMap["TaperX"].AsInteger();
                    path_taper_y       = PathMap["TaperY"].AsInteger();
                    path_twist         = PathMap["Twist"].AsInteger();
                    path_twist_begin   = PathMap["TwistBegin"].AsInteger();
                }

                if (ObjMap.ContainsKey("Profile"))
                {
                    if (ObjMap["Profile"].Type != OSDType.Map)
                    {
                        responsedata["str_response_string"] = "Has Profile key, but data not in expected format";
                        return(responsedata);
                    }

                    OSDMap ProfileMap = (OSDMap)ObjMap["Profile"];

                    profile_begin = ProfileMap["Begin"].AsInteger();
                    profile_curve = ProfileMap["Curve"].AsInteger();
                    profile_end   = ProfileMap["End"].AsInteger();
                    hollow        = ProfileMap["Hollow"].AsInteger();
                }
                ray_end_is_intersection = ObjMap["RayEndIsIntersection"].AsBoolean();

                ray_target_id = ObjMap["RayTargetId"].AsUUID();
                state         = ObjMap["State"].AsInteger();
                try
                {
                    ray_end   = ((OSDArray)ObjMap["RayEnd"]).AsVector3();
                    ray_start = ((OSDArray)ObjMap["RayStart"]).AsVector3();
                    scale     = ((OSDArray)ObjMap["Scale"]).AsVector3();
                    rotation  = ((OSDArray)ObjMap["Rotation"]).AsQuaternion();
                }
                catch (Exception)
                {
                    responsedata["str_response_string"] = "RayEnd, RayStart, Scale or Rotation wasn't in the expected format";
                    return(responsedata);
                }

                if (rm.ContainsKey("AgentData"))
                {
                    if (rm["AgentData"].Type != OSDType.Map)
                    {
                        responsedata["str_response_string"] = "Has AgentData key, but data not in expected format";
                        return(responsedata);
                    }

                    OSDMap AgentDataMap = (OSDMap)rm["AgentData"];

                    //session_id = AgentDataMap["SessionId"].AsUUID();
                    group_id = AgentDataMap["GroupId"].AsUUID();
                }
            }
            else
            { //v1
                bypass_raycast = rm["bypass_raycast"].AsBoolean();

                everyone_mask      = readuintval(rm["everyone_mask"]);
                flags              = readuintval(rm["flags"]);
                group_id           = rm["group_id"].AsUUID();
                group_mask         = readuintval(rm["group_mask"]);
                hollow             = rm["hollow"].AsInteger();
                material           = rm["material"].AsInteger();
                next_owner_mask    = readuintval(rm["next_owner_mask"]);
                hollow             = rm["hollow"].AsInteger();
                p_code             = rm["p_code"].AsInteger();
                path_begin         = rm["path_begin"].AsInteger();
                path_curve         = rm["path_curve"].AsInteger();
                path_end           = rm["path_end"].AsInteger();
                path_radius_offset = rm["path_radius_offset"].AsInteger();
                path_revolutions   = rm["path_revolutions"].AsInteger();
                path_scale_x       = rm["path_scale_x"].AsInteger();
                path_scale_y       = rm["path_scale_y"].AsInteger();
                path_shear_x       = rm["path_shear_x"].AsInteger();
                path_shear_y       = rm["path_shear_y"].AsInteger();
                path_skew          = rm["path_skew"].AsInteger();
                path_taper_x       = rm["path_taper_x"].AsInteger();
                path_taper_y       = rm["path_taper_y"].AsInteger();
                path_twist         = rm["path_twist"].AsInteger();
                path_twist_begin   = rm["path_twist_begin"].AsInteger();
                profile_begin      = rm["profile_begin"].AsInteger();
                profile_curve      = rm["profile_curve"].AsInteger();
                profile_end        = rm["profile_end"].AsInteger();

                ray_end_is_intersection = rm["ray_end_is_intersection"].AsBoolean();

                ray_target_id = rm["ray_target_id"].AsUUID();


                //session_id = rm["session_id"].AsUUID();
                state = rm["state"].AsInteger();
                try
                {
                    ray_end   = ((OSDArray)rm["ray_end"]).AsVector3();
                    ray_start = ((OSDArray)rm["ray_start"]).AsVector3();
                    rotation  = ((OSDArray)rm["rotation"]).AsQuaternion();
                    scale     = ((OSDArray)rm["scale"]).AsVector3();
                }
                catch (Exception)
                {
                    responsedata["str_response_string"] = "RayEnd, RayStart, Scale or Rotation wasn't in the expected format";
                    return(responsedata);
                }
            }

            Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false, UUID.Zero);

            PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();

            pbs.PathBegin        = (ushort)path_begin;
            pbs.PathCurve        = (byte)path_curve;
            pbs.PathEnd          = (ushort)path_end;
            pbs.PathRadiusOffset = (sbyte)path_radius_offset;
            pbs.PathRevolutions  = (byte)path_revolutions;
            pbs.PathScaleX       = (byte)path_scale_x;
            pbs.PathScaleY       = (byte)path_scale_y;
            pbs.PathShearX       = (byte)path_shear_x;
            pbs.PathShearY       = (byte)path_shear_y;
            pbs.PathSkew         = (sbyte)path_skew;
            pbs.PathTaperX       = (sbyte)path_taper_x;
            pbs.PathTaperY       = (sbyte)path_taper_y;
            pbs.PathTwist        = (sbyte)path_twist;
            pbs.PathTwistBegin   = (sbyte)path_twist_begin;
            pbs.HollowShape      = (HollowShape)hollow;
            pbs.PCode            = (byte)p_code;
            pbs.ProfileBegin     = (ushort)profile_begin;
            pbs.ProfileCurve     = (byte)profile_curve;
            pbs.ProfileEnd       = (ushort)profile_end;
            pbs.Scale            = scale;
            pbs.State            = (byte)state;

            SceneObjectGroup obj = null;;

            if (m_scene.Permissions.CanRezObject(1, avatar.UUID, UUID.Zero, pos, false))
            {
                // rez ON the ground, not IN the ground
                pos.Z += 0.25F;

                obj = m_scene.AddNewPrim(avatar.UUID, group_id, pos, rotation, pbs, false, true);
            }


            if (obj == null)
            {
                return(responsedata);
            }

            SceneObjectPart rootpart = obj.RootPart;

            rootpart.Shape         = pbs;
            rootpart.Flags        |= (PrimFlags)flags;
            rootpart.EveryoneMask  = everyone_mask;
            rootpart.GroupID       = group_id;
            rootpart.GroupMask     = group_mask;
            rootpart.NextOwnerMask = next_owner_mask;
            rootpart.Material      = (byte)material;

            m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);

            responsedata["int_response_code"]   = 200; //501; //410; //404;
            responsedata["content_type"]        = "text/plain";
            responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(obj.LocalId));

            return(responsedata);
        }
Ejemplo n.º 27
0
 public void RegisterCaps(UUID agentID, Caps caps)
 {
     UUID capID = UUID.Random();
     GroupMemberDataHandler handler = 
         new GroupMemberDataHandler("/CAPS/" + capID + "/", "GroupMemberData", agentID, m_scene);
     caps.RegisterHandler("GroupMemberData", handler);
 }
Ejemplo n.º 28
0
 public void RegisterCaps(UUID agentID, Caps caps)
 {
 }
Ejemplo n.º 29
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            string homeLocationCap = CapsUtil.CreateCAPS("HomeLocation", String.Empty);

            // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
            // and POST handlers, so we first set up a POST handler normally and then add a GET/PUT handler via MainServer

            IRequestHandler homeLocationRequestHandler
                = new RestStreamHandler(
                    "POST", homeLocationCap,
                    (request, path, param, httpRequest, httpResponse) => HomeLocation(request, agentID),
                    "HomeLocation", null);

            MainServer.Instance.AddStreamHandler(homeLocationRequestHandler);
            caps.RegisterHandler("HomeLocation", homeLocationRequestHandler);
        }
Ejemplo n.º 30
0
        public void DeregisterCaps(UUID agentID, Caps caps)
        {
//            m_service.RemoveStreamHandler("HomeLocation", "POST");
        }
Ejemplo n.º 31
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            m_log.DebugFormat("[EVENTQUEUE]: Register caps for client {0} in region {1}", agentID, m_Scene.RegionInfo.RegionName);

            lock (queues)
            {
                EventQueueGetRequestHandler queue;
                if (queues.TryGetValue(agentID, out queue) == true)
                {
                    // shouldn't happen
                    m_log.ErrorFormat("[EVENTQUEUE]: OnRegisterCaps and an EQ already exists for client {0} in region {1}!", agentID, m_Scene.RegionInfo.RegionName);
                }
                else
                {
                    string capsUrl = "/CAPS/EQG/" + UUID.Random().ToString() + "/";
                    queue = new EventQueueGetRequestHandler("POST", capsUrl, agentID, caps, DebugLevel);
                    queues.Add(agentID, queue);
                }

                caps.RegisterHandler("EventQueueGet", queue);
            }
        }
Ejemplo n.º 32
0
        public void OnDeregisterCaps(UUID AgentID, Caps caps)
        {
            m_log.DebugFormat("[EVENTQUEUE]: Deregister caps for client {0} in region {1}", AgentID, m_Scene.RegionInfo.RegionName);

            lock (queues)
            {
                caps.DeregisterHandler("EventQueueGet"); 

                // If there is a posted request signal it.  We'll send a 404 in the handler
                EventQueueGetRequestHandler queue;
                if (queues.TryGetValue(AgentID, out queue) == true)
                {
                    queues.Remove(AgentID);
                    queue.DumpQueue();
                }
            }
        }
Ejemplo n.º 33
0
 public void RegisterCaps(UUID agentID, Caps caps)
 {
 }
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            IRequestHandler reqHandler
                = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);

            caps.RegisterHandler("SimulatorFeatures", reqHandler);
        }
Ejemplo n.º 35
0
 public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
 {
     handlerDeregisterCaps = OnDeregisterCaps;
     if (handlerDeregisterCaps != null)
     {
         handlerDeregisterCaps(agentID, caps);
     }
 }
Ejemplo n.º 36
0
        public void DeregisterCaps(UUID agentID, Caps caps)
        {
//            m_service.RemoveStreamHandler("HomeLocation", "POST");
        }
Ejemplo n.º 37
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
#if false
            m_service = service;
            m_agentInfoService = service.Registry.RequestModuleInterface<IAgentInfoService>();
            m_agentProcessing = service.Registry.RequestModuleInterface<IAgentProcessing>();

            HttpServerHandle method = delegate(string path, Stream request,
                                  OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return ProcessUpdateAgentLanguage(request, m_service.AgentID);
            };
            service.AddStreamHandler("UpdateAgentLanguage", new GenericStreamHandler("POST", service.CreateCAPS("UpdateAgentLanguage", ""),
                                                      method));


            method = delegate(string path, Stream request,
                                  OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return ProcessUpdateAgentInfo(request, m_service.AgentID);
            };
            service.AddStreamHandler("UpdateAgentInformation", new GenericStreamHandler("POST", service.CreateCAPS("UpdateAgentInformation", ""),
                                method));

            service.AddStreamHandler("AvatarPickerSearch", new GenericStreamHandler("GET", service.CreateCAPS("AvatarPickerSearch", ""),
                                                      ProcessAvatarPickerSearch));

            method = delegate(string path, Stream request,
                                  OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return HomeLocation(request, m_service.AgentID);
            };
            service.AddStreamHandler("HomeLocation", new GenericStreamHandler("POST", service.CreateCAPS("HomeLocation", ""),
                                                      method));

            method = delegate(string path, Stream request,
                                  OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return TeleportLocation(request, m_service.AgentID);
            };

            service.AddStreamHandler("TeleportLocation", new GenericStreamHandler("POST", service.CreateCAPS("TeleportLocation", ""),
                                                      method)); 
#endif
        }