ToOSD() public method

public ToOSD ( ) : OSDMap
return OSDMap
Example #1
0
        OSDMap GetRegion(OSDMap map)
        {
            OSDMap      resp       = new OSDMap();
            IRegionData regiondata = DataPlugins.RequestPlugin <IRegionData> ();

            if (regiondata != null && (map.ContainsKey("RegionID") || map.ContainsKey("Region")))
            {
                string regionName = map.ContainsKey("Region") ? map ["Region"].ToString().Trim() : "";
                UUID   regionID   = map.ContainsKey("RegionID") ? UUID.Parse(map ["RegionID"].ToString()) : UUID.Zero;
                // not used?? // UUID scopeID = map.ContainsKey ("ScopeID") ? UUID.Parse (map ["ScopeID"].ToString ()) : UUID.Zero;
                GridRegion region = null;
                if (regionID != UUID.Zero)
                {
                    region = regiondata.Get(regionID, null);
                }
                else if (regionName != string.Empty)
                {
                    region = regiondata.Get(regionName, null, null, null) [0];
                }
                if (region != null)
                {
                    resp ["Region"] = region.ToOSD();
                }
            }
            return(resp);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]      = "CreateObjectRequest";
            map["Destination"] = Destination.ToOSD();
            map["Object"]      = Object.ToBinaryXml2();
            return(map);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]      = "CloseAgentRequest";
            map["AgentID"]     = AgentID;
            map["Destination"] = Destination.ToOSD();
            return(map);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]      = "UpdateAgentDataRequest";
            map["Destination"] = Destination.ToOSD();
            map["Update"]      = Update.ToOSD();
            return(map);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]         = "RetrieveAgentRequest";
            map["AgentID"]        = AgentID;
            map["Destination"]    = Destination.ToOSD();
            map["AgentIsLeaving"] = AgentIsLeaving;
            return(map);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]        = "CreateAgentRequest";
            map["Destination"]   = Destination.ToOSD();
            map["TeleportFlags"] = TeleportFlags;
            map["CircuitData"]   = CircuitData.ToOSD();
            return(map);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]      = "MakeChildAgentRequest";
            map["AgentID"]     = AgentID;
            map["Destination"] = Destination.ToOSD();
            map["OldRegion"]   = OldRegion.ToOSD();
            map["IsCrossing"]  = IsCrossing;
            return(map);
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Method"]         = "FailedToTeleportAgentRequest";
            map["AgentID"]        = AgentID;
            map["Destination"]    = Destination.ToOSD();
            map["IsCrossing"]     = IsCrossing;
            map["Reason"]         = Reason;
            map["FailedRegionID"] = FailedRegionID;
            return(map);
        }
        public OSDMap GetExternalCaps(UUID agentID, GridRegion region)
        {
            if (m_registry == null)
            {
                return(new OSDMap());
            }
            OSDMap resp = new OSDMap();

            if (m_registry.RequestModuleInterface <IGridServerInfoService>() != null)
            {
                m_servers = m_registry.RequestModuleInterface <IGridServerInfoService>().GetGridURIs("SyncMessageServerURI");
                OSDMap req = new OSDMap();
                req["AgentID"] = agentID;
                req["Region"]  = region.ToOSD();
                req["Method"]  = "GetCaps";

                List <ManualResetEvent> events = new List <ManualResetEvent>();
                foreach (string uri in m_servers.Where((u) => (!u.Contains(MainServer.Instance.Port.ToString()))))
                {
                    ManualResetEvent even = new ManualResetEvent(false);
                    m_syncPoster.Get(uri, req, (r) =>
                    {
                        if (r == null)
                        {
                            return;
                        }
                        foreach (KeyValuePair <string, OSD> kvp in r)
                        {
                            resp.Add(kvp.Key, kvp.Value);
                        }
                        even.Set();
                    });
                    events.Add(even);
                }
                if (events.Count > 0)
                {
                    ManualResetEvent.WaitAll(events.ToArray());
                }
            }
            foreach (var h in GetHandlers(agentID, region.RegionID))
            {
                if (m_allowedCapsModules.Contains(h.Name))
                {
                    h.IncomingCapsRequest(agentID, region, m_registry.RequestModuleInterface <ISimulationBase>(), ref resp);
                }
            }
            return(resp);
        }
Example #10
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["Error"]       = Error;
            map["Neighbors"]   = new OSDArray(Neighbors.ConvertAll <OSD>((region) => region.ToOSD()));
            map["SessionID"]   = SessionID;
            map["RegionFlags"] = RegionFlags;
            if (Region != null)
            {
                map["Region"] = Region.ToOSD();
            }
            if (URIs != null)
            {
                map["URIs"] = URIs.ToOSDMap();
            }
            return(map);
        }
        public bool Store(GridRegion region)
        {
            if (region.EstateOwner == UUID.Zero)
            {
                IEstateConnector EstateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector>();
                EstateSettings   ES = null;
                if (EstateConnector != null)
                {
                    ES = EstateConnector.GetEstateSettings(region.RegionID);
                    if (ES != null)
                    {
                        region.EstateOwner = ES.EstateOwner;
                    }
                }
                if (region.EstateOwner == UUID.Zero && ES != null && ES.EstateID != 0)
                {
                    MainConsole.Instance.Error(
                        "[Local Grid Connector] Attempt to store region with owner of UUID.Zero detected:" +
                        (new System.Diagnostics.StackTrace()).GetFrame(1).ToString());
                }
            }

            Dictionary <string, object> row = new Dictionary <string, object>(14);

            row["ScopeID"]    = region.ScopeID;
            row["RegionUUID"] = region.RegionID;
            row["RegionName"] = region.RegionName;
            row["LocX"]       = region.RegionLocX;
            row["LocY"]       = region.RegionLocY;
            row["LocZ"]       = region.RegionLocZ;
            row["OwnerUUID"]  = region.EstateOwner;
            row["Access"]     = region.Access;
            row["SizeX"]      = region.RegionSizeX;
            row["SizeY"]      = region.RegionSizeY;
            row["SizeZ"]      = region.RegionSizeZ;
            row["Flags"]      = region.Flags;
            row["SessionID"]  = region.SessionID;
            row["Info"]       = OSDParser.SerializeJsonString(region.ToOSD());

            return(GD.Replace(m_realm, row));
        }
        public void RemoveExternalCaps(UUID agentID, GridRegion region)
        {
            OSDMap req = new OSDMap();

            req ["AgentID"] = agentID;
            req ["Region"]  = region.ToOSD();
            req ["Method"]  = "RemoveCaps";

            foreach (string uri in m_servers)
            {
                m_syncPoster.Post(uri, req);
            }

            foreach (var h in GetHandlers(agentID, region.RegionID))
            {
                if (m_allowedCapsModules.Contains(h.Name))
                {
                    h.IncomingCapsDestruction();
                }
            }
        }
        public OSDMap GetExternalCaps(UUID agentID, GridRegion region)
        {
            if (m_registry == null) return new OSDMap();
            OSDMap resp = new OSDMap();
            if (m_registry.RequestModuleInterface<IGridServerInfoService>() != null)
            {
                m_servers = m_registry.RequestModuleInterface<IGridServerInfoService>().GetGridURIs("SyncMessageServerURI");
                OSDMap req = new OSDMap();
                req["AgentID"] = agentID;
                req["Region"] = region.ToOSD();
                req["Method"] = "GetCaps";

                List<ManualResetEvent> events = new List<ManualResetEvent>();
                foreach (string uri in m_servers.Where((u)=>(!u.Contains(MainServer.Instance.Port.ToString()))))
                {
                    ManualResetEvent even = new ManualResetEvent(false);
                    m_syncPoster.Get(uri, req, (r) =>
                    {
                        if (r == null)
                            return;
                        foreach (KeyValuePair<string, OSD> kvp in r)
                            resp.Add(kvp.Key, kvp.Value);
                        even.Set();
                    });
                    events.Add(even);
                }
                if(events.Count > 0)
                    ManualResetEvent.WaitAll(events.ToArray());
            }
            foreach (var h in GetHandlers(agentID, region.RegionID))
            {
                if (m_allowedCapsModules.Contains(h.Name))
                    h.IncomingCapsRequest(agentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref resp);
            }
            return resp;
        }
        public void RemoveExternalCaps(UUID agentID, GridRegion region)
        {
            OSDMap req = new OSDMap();
            req["AgentID"] = agentID;
            req["Region"] = region.ToOSD();
            req["Method"] = "RemoveCaps";

            foreach (string uri in m_servers)
                m_syncPoster.Post(uri, req);

            foreach (var h in GetHandlers(agentID, region.RegionID))
            {
                if (m_allowedCapsModules.Contains(h.Name))
                    h.IncomingCapsDestruction();
            }
        }