Esempio n. 1
0
        protected List <GridRegion> ParseQuery(List <UUID> scopeIDs, List <string> query)
        {
            List <GridRegion> regionData = new List <GridRegion>();

            if ((query.Count % 14) == 0)
            {
                for (int i = 0; i < query.Count; i += 14)
                {
                    GridRegion data = new GridRegion();
                    OSDMap     map  = (OSDMap)OSDParser.DeserializeJson(query[i + 13]);
                    map["owner_uuid"] = (!map.ContainsKey("owner_uuid") || map["owner_uuid"].AsUUID() == UUID.Zero)
                                            ? OSD.FromUUID(UUID.Parse(query[i + 6]))
                                            : map["owner_uuid"];
                    map["EstateOwner"] = (!map.ContainsKey("EstateOwner") || map["EstateOwner"].AsUUID() == UUID.Zero)
                                             ? OSD.FromUUID(UUID.Parse(query[i + 6]))
                                             : map["EstateOwner"];
                    data.FromOSD(map);

                    if (!regionData.Contains(data))
                    {
                        regionData.Add(data);
                    }
                }
            }

            return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, regionData));
        }
 public override void FromOSD(OSDMap map)
 {
     AgentID     = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     AgentIsLeaving = map["AgentIsLeaving"];
 }
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     Update = new AgentData();
     Update.FromOSD((OSDMap)map["Update"]);
 }
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     System.IO.MemoryStream stream = new System.IO.MemoryStream(map["Object"].AsBinary());
     Aurora.Framework.Serialization.SceneEntitySerializer.SceneObjectSerializer.FromXml2Format(ref stream, Scene);
     stream.Close();
 }
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     TeleportFlags = map["TeleportFlags"];
     CircuitData   = new AgentCircuitData();
     CircuitData.FromOSD((OSDMap)map["CircuitData"]);
 }
 public override void FromOSD(OSDMap map)
 {
     AgentID     = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     IsCrossing     = map["IsCrossing"];
     Reason         = map["Reason"];
     FailedRegionID = map["FailedRegionID"];
 }
        OSDMap service_OnMessageReceived(OSDMap message)
        {
            string method = message["Method"];

            if (method != "GetCaps" && method != "RemoveCaps")
            {
                return(null);
            }
            UUID       AgentID = message["AgentID"];
            GridRegion region  = new GridRegion();

            region.FromOSD((OSDMap)message["Region"]);
            OSDMap map = new OSDMap();

            switch (method)
            {
            case "GetCaps":
                foreach (var h in GetHandlers(AgentID, region.RegionID))
                {
                    if (m_allowedCapsModules.Contains(h.Name))
                    {
                        h.IncomingCapsRequest(AgentID, region, m_registry.RequestModuleInterface <ISimulationBase>(), ref map);
                    }
                }
                return(map);

            case "RemoveCaps":
                foreach (var h in GetHandlers(AgentID, region.RegionID))
                {
                    if (m_allowedCapsModules.Contains(h.Name))
                    {
                        h.IncomingCapsDestruction();
                    }
                }
                return(map);
            }
            return(null);
        }
Esempio n. 8
0
        public override void FromOSD(OSDMap map)
        {
            Error = map["Error"];
            OSDArray n = (OSDArray)map["Neighbors"];

            Neighbors = n.ConvertAll <GridRegion>((osd) =>
            {
                GridRegion r = new GridRegion();
                r.FromOSD((OSDMap)osd);
                return(r);
            });
            SessionID   = map["SessionID"];
            RegionFlags = map["RegionFlags"];
            if (map.ContainsKey("Region"))
            {
                Region = new GridRegion();
                Region.FromOSD((OSDMap)map["Region"]);
            }
            if (map.ContainsKey("URIs"))
            {
                URIs = ((OSDMap)map["URIs"]).ConvertMap <List <string> >((o) => ((OSDArray)o).ConvertAll <string>((oo) => oo));
            }
        }
Esempio n. 9
0
 OSDMap service_OnMessageReceived(OSDMap message)
 {
     string method = message["Method"];
     if (method != "GetCaps" && method != "RemoveCaps")
         return null;
     UUID AgentID = message["AgentID"];
     GridRegion region = new GridRegion();
     region.FromOSD((OSDMap)message["Region"]);
     OSDMap map = new OSDMap();
     switch (method)
     {
         case "GetCaps":
             foreach (var h in GetHandlers(AgentID, region.RegionID))
             {
                 if (m_allowedCapsModules.Contains(h.Name))
                     h.IncomingCapsRequest(AgentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref map);
             }
             return map;
         case "RemoveCaps":
             foreach (var h in GetHandlers(AgentID, region.RegionID))
             {
                 if (m_allowedCapsModules.Contains(h.Name))
                     h.IncomingCapsDestruction();
             }
             return map;
     }
     return null;
 }
        protected virtual OSDMap OnMessageReceived(OSDMap message)
        {
            if (!message.ContainsKey("Method"))
                return null;

            if (m_capsService == null)
                return null;

            string method = message["Method"].AsString();
            if (method != "RegionIsOnline" && method != "LogoutRegionAgents" &&
                method != "ArrivedAtDestination" && method != "CancelTeleport" &&
                method != "AgentLoggedOut" && method != "SendChildAgentUpdate" &&
                method != "TeleportAgent" && method != "CrossAgent")
                return null;

            UUID AgentID = message["AgentID"].AsUUID();
            UUID requestingRegion = message["RequestingRegion"].AsUUID();

            IClientCapsService clientCaps = m_capsService.GetClientCapsService(AgentID);

            IRegionClientCapsService regionCaps = null;
            if (clientCaps != null)
                regionCaps = clientCaps.GetCapsService(requestingRegion);
            if (message["Method"] == "LogoutRegionAgents")
            {
                LogOutAllAgentsForRegion(requestingRegion);
            }
            else if (message["Method"] == "RegionIsOnline")
                //This gets fired when the scene is fully finished starting up
            {
                //Log out all the agents first, then add any child agents that should be in this region
                //Don't do this, we don't need to kill all the clients right now
                //LogOutAllAgentsForRegion(requestingRegion);
                IGridService GridService = m_registry.RequestModuleInterface<IGridService>();
                if (GridService != null)
                {
                    GridRegion requestingGridRegion = GridService.GetRegionByUUID(null, requestingRegion);
                    if (requestingGridRegion != null)
                        Util.FireAndForget((o) => EnableChildAgentsForRegion(requestingGridRegion));
                }
            }
            else if (message["Method"] == "ArrivedAtDestination")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Recieved a callback
                if (clientCaps.InTeleport) //Only set this if we are in a teleport,
                    //  otherwise (such as on login), this won't check after the first tp!
                    clientCaps.CallbackHasCome = true;

                regionCaps.Disabled = false;

                //The agent is getting here for the first time (eg. login)
                OSDMap body = ((OSDMap) message["Message"]);

                //Parse the OSDMap
                int DrawDistance = body["DrawDistance"].AsInteger();

                AgentCircuitData circuitData = new AgentCircuitData();
                circuitData.FromOSD((OSDMap)body["Circuit"]);

                //Now do the creation
                EnableChildAgents(AgentID, requestingRegion, DrawDistance, circuitData);
            }
            else if (message["Method"] == "CancelTeleport")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Only the region the client is root in can do this
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    //The user has requested to cancel the teleport, stop them.
                    clientCaps.RequestToCancelTeleport = true;
                    regionCaps.Disabled = false;
                }
            }
            else if (message["Method"] == "AgentLoggedOut")
            {
                //ONLY if the agent is root do we even consider it
                if (regionCaps != null && regionCaps.RootAgent)
                {
                    OSDMap body = ((OSDMap) message["Message"]);

                    AgentPosition pos = new AgentPosition();
                    pos.FromOSD((OSDMap)body["AgentPos"]);

                    regionCaps.Disabled = true;

                    Util.FireAndForget((o) =>
                                           {
                                               LogoutAgent(regionCaps, false); //The root is killing itself
                                               SendChildAgentUpdate(pos, regionCaps);
                                           });
                }
            }
            else if (message["Method"] == "SendChildAgentUpdate")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle) //Has to be root
                {
                    OSDMap body = ((OSDMap) message["Message"]);

                    AgentPosition pos = new AgentPosition();
                    pos.FromOSD((OSDMap) body["AgentPos"]);

                    SendChildAgentUpdate(pos, regionCaps);
                    regionCaps.Disabled = false;
                }
            }
            else if (message["Method"] == "TeleportAgent")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    OSDMap body = ((OSDMap) message["Message"]);

                    GridRegion destination = new GridRegion();
                    destination.FromOSD((OSDMap) body["Region"]);

                    uint TeleportFlags = body["TeleportFlags"].AsUInteger();

                    AgentCircuitData Circuit = new AgentCircuitData();
                    Circuit.FromOSD((OSDMap)body["Circuit"]);

                    AgentData AgentData = new AgentData();
                    AgentData.FromOSD((OSDMap)body["AgentData"]);
                    regionCaps.Disabled = false;

                    //Don't need to wait for this to finish on the main http thread
                    Util.FireAndForget((o) =>
                                           {
                                               string reason = "";
                                               TeleportAgent(ref destination, TeleportFlags,
                                                             Circuit, AgentData, AgentID, requestingRegion, out reason);
                                           });
                    return null;
                }
            }
            else if (message["Method"] == "CrossAgent")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps == null || rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    //This is a simulator message that tells us to cross the agent
                    OSDMap body = ((OSDMap) message["Message"]);

                    Vector3 pos = body["Pos"].AsVector3();
                    Vector3 Vel = body["Vel"].AsVector3();
                    GridRegion Region = new GridRegion();
                    Region.FromOSD((OSDMap) body["Region"]);
                    AgentCircuitData Circuit = new AgentCircuitData();
                    Circuit.FromOSD((OSDMap)body["Circuit"]);
                    AgentData AgentData = new AgentData();
                    AgentData.FromOSD((OSDMap)body["AgentData"]);
                    regionCaps.Disabled = false;

                    Util.FireAndForget((o) =>
                                           {
                                               string reason = "";
                                               CrossAgent(Region, pos, Vel, Circuit, AgentData,
                                                          AgentID, requestingRegion, out reason);
                                           });
                    return null;
                }
                else if (clientCaps.InTeleport)
                {
                    OSDMap result = new OSDMap();
                    result["success"] = false;
                    result["Note"] = false;
                    return result;
                }
                else
                {
                    OSDMap result = new OSDMap();
                    result["success"] = false;
                    result["Note"] = false;
                    return result;
                }
            }
            return null;
        }
Esempio n. 11
0
 public override void FromOSD(OSDMap map)
 {
     AgentID = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     AgentIsLeaving = map["AgentIsLeaving"];
 }
Esempio n. 12
0
 public override void FromOSD(OSDMap map)
 {
     AgentID = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     IsCrossing = map["IsCrossing"];
     Reason = map["Reason"];
     FailedRegionID = map["FailedRegionID"];
 }
Esempio n. 13
0
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     System.IO.MemoryStream stream = new System.IO.MemoryStream(map["Object"].AsBinary());
     Aurora.Framework.Serialization.SceneEntitySerializer.SceneObjectSerializer.FromXml2Format(ref stream, Scene);
     stream.Close();
 }
Esempio n. 14
0
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     TeleportFlags = map["TeleportFlags"];
     CircuitData = new AgentCircuitData();
     CircuitData.FromOSD((OSDMap)map["CircuitData"]);
 }
Esempio n. 15
0
 public override void FromOSD(OSDMap map)
 {
     Error = map["Error"];
     OSDArray n = (OSDArray) map["Neighbors"];
     Neighbors = n.ConvertAll<GridRegion>((osd) =>
                                              {
                                                  GridRegion r = new GridRegion();
                                                  r.FromOSD((OSDMap) osd);
                                                  return r;
                                              });
     SessionID = map["SessionID"];
     RegionFlags = map["RegionFlags"];
     if (map.ContainsKey("Region"))
     {
         Region = new GridRegion();
         Region.FromOSD((OSDMap)map["Region"]);
     }
     if (map.ContainsKey("URIs"))
         URIs = ((OSDMap)map["URIs"]).ConvertMap<List<string>>((o)=>((OSDArray)o).ConvertAll<string>((oo)=>oo));
 }
Esempio n. 16
0
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     ObjectBlob = map["Object"].AsBinary();
 }
Esempio n. 17
0
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     Update = new AgentPosition();
     Update.FromOSD((OSDMap)map["Update"]);
 }
Esempio n. 18
0
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     ObjectBlob = map["Object"].AsBinary();
 }