public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { if (configName != String.Empty) m_ConfigName = configName; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string assetService = serverConfig.GetString("AssetService", String.Empty); if (assetService == String.Empty) throw new Exception("No AssetService in config file"); Object[] args = new Object[] { config }; m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args); if (m_AssetService == null) throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); // NEED TO FIX THIS OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, ""); server.AddStreamHandler(new RestStreamHandler( "POST", "/CAPS/UploadBakedTexture/", new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture, "UploadBakedTexture", "Upload Baked Texture Capability")); }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); caps.RegisterHandler("ViewerStartAuction", new RestHTTPHandler("POST", "/CAPS/" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return ViewerStartAuction(m_dhttpMethod, capuuid); })); }
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 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 + "/", httpMethod => ProcessAdd(httpMethod, agentID, caps), "ObjectAdd", agentID.ToString()));; }
void EventManager_OnRegisterCaps(UUID agentID, Caps caps) { CAPSPrivateSeedHandler handler = new CAPSPrivateSeedHandler(null,//the server IS null for a reason, so that we don't add the handlers at the wrong time m_scene.InventoryService, m_scene.LibraryService, m_scene.GridUserService, m_scene.PresenceService, "", agentID, ""); //URL and Hostname are all "" as well so that we don't add the hostname by accident List<IRequestHandler> handlers = handler.GetServerCAPS(); foreach (IRequestHandler handle in handlers) { if (handler.registeredCAPSPath.ContainsKey(handle.Path)) { caps.RegisterHandler(handler.registeredCAPSPath[handle.Path].ToString(), handle); } } }
private void BuildSummaryStatsByUserReport(StringBuilder sb) { ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Name", 32); cdt.AddColumn("Type", 5); cdt.AddColumn("Req Received", 12); cdt.AddColumn("Req Handled", 12); cdt.Indent = 2; m_scene.ForEachScenePresence( sp => { Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); if (caps == null) { return; } Dictionary <string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers(); int totalRequestsReceived = 0; int totalRequestsHandled = 0; foreach (IRequestHandler reqHandler in capsHandlers.Values) { totalRequestsReceived += reqHandler.RequestsReceived; totalRequestsHandled += reqHandler.RequestsHandled; } Dictionary <string, PollServiceEventArgs> capsPollHandlers = caps.GetPollHandlers(); foreach (PollServiceEventArgs handler in capsPollHandlers.Values) { totalRequestsReceived += handler.RequestsReceived; totalRequestsHandled += handler.RequestsHandled; } cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled); } ); sb.Append(cdt.ToString()); }
private void OnRegisterCaps(UUID agentID, Caps caps) { // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", // Name, agentID, caps.RegionName); caps.RegisterSimpleHandler("EnvironmentSettings", new SimpleStreamHandler("/" + UUID.Random(), delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { processEnv(httpRequest, httpResponse, agentID); })); //Extended caps.RegisterSimpleHandler("ExtEnvironment", new SimpleStreamHandler("/" + UUID.Random(), delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { processExtEnv(httpRequest, httpResponse, agentID, caps); })); }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); caps.RegisterHandler("ObjectAdd", new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return ProcessAdd(m_dhttpMethod, agentID, caps); })); caps.RegisterHandler("ServerReleaseNotes", new RestHTTPHandler("POST", "/CAPS/ServerReleaseNotes/" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return ProcessServerReleaseNotes(m_dhttpMethod, agentID, capuuid); })); }
public void RegisterCaps(UUID agentID, Caps caps) { if (!m_enabled) { return; } UUID capID = UUID.Random(); // m_log.Info("[GETMESH]: /CAPS/" + capID); caps.RegisterHandler("GetMesh", new RestHTTPHandler("GET", "/CAPS/" + capID, delegate(Hashtable m_dhttpMethod) { return(ProcessGetMesh(m_dhttpMethod, agentID, caps)); })); }
public void RegisterCaps(UUID agentID, Caps caps) { IRequestHandler reqHandler = new RestHTTPHandler( "GET", "/CAPS/" + UUID.Random(), x => { return(HandleSimulatorFeaturesRequest(x, agentID)); }, "SimulatorFeatures", agentID.ToString()); caps.RegisterHandler("SimulatorFeatures", reqHandler); if (m_doScriptSyntax && m_scriptSyntaxID != UUID.Zero && !String.IsNullOrEmpty(m_scriptSyntaxXML)) { IRequestHandler sreqHandler = new RestHTTPHandler( "GET", "/CAPS/" + UUID.Random(), x => { return(HandleSyntaxRequest(x, agentID)); }, "LSLSyntax", agentID.ToString()); caps.RegisterHandler("LSLSyntax", sreqHandler); } }
public void OnRegisterCaps(UUID agentID, Caps caps) { // m_log.DebugFormat( // "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID); caps.RegisterSimpleHandler("ObjectMedia", new SimpleStreamHandler("/" + UUID.Random(), delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { HandleObjectMediaMessage(httpRequest, httpResponse, agentID); })); caps.RegisterSimpleHandler("ObjectMediaNavigate", new SimpleStreamHandler("/" + UUID.Random(), delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { HandleObjectMediaNavigateMessage(httpRequest, httpResponse, agentID); })); }
public void CreateCaps(UUID agentId) { if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) { return; } Caps caps; String capsObjectPath = GetCapsPath(agentId); caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, (MainServer.Instance == null) ? 0: MainServer.Instance.Port, capsObjectPath, agentId, m_scene.RegionInfo.RegionName); m_capsObjects[agentId] = caps; m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); caps.RegisterHandler("ServerReleaseNotes", new RestHTTPHandler("POST", "/CAPS/ServerReleaseNotes/" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return ProcessServerReleaseNotes(m_dhttpMethod, agentID, capuuid); })); caps.RegisterHandler("CopyInventoryFromNotecard", new RestHTTPHandler("POST", "/CAPS/" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return CopyInventoryFromNotecard(m_dhttpMethod, capuuid, agentID); })); }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capID = UUID.Random(); //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); caps.RegisterHandler( "GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString())); } else { // m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetTexture", m_URL); } }
public void RegisterCaps(UUID agentID, Caps caps) { // Fr a get we dont care about the key so we just send a random UUID UUID capID = UUID.Random(); //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { m_log.DebugFormat("[DNCAPS GetDisplay]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); // caps.RegisterHandler( // "GetTexture", // new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetDisplay", agentID.ToString())); } else { m_log.DebugFormat("[DNCAPS GetDisplay]: {0} for agent {1}", m_URL, agentID); caps.RegisterHandler("GetDisplayNames", m_URL + agentID.ToString()); } }
private void HandleShowCapsListCommand(string module, string[] cmdParams) { if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) { return; } StringBuilder capsReport = new StringBuilder(); capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); m_capsObjectsRwLock.AcquireReaderLock(-1); try { foreach (KeyValuePair <UUID, Caps> kvp in m_capsObjects) { capsReport.AppendFormat("** User {0}:\n", kvp.Key); Caps caps = kvp.Value; for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext();) { Uri uri = new Uri(kvp2.Value.ToString()); capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); } foreach (KeyValuePair <string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers()) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url); } foreach (KeyValuePair <string, string> kvp3 in caps.ExternalCapsHandlers) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); } } } finally { m_capsObjectsRwLock.ReleaseReaderLock(); } MainConsole.Instance.Output(capsReport.ToString()); }
private void HandleShowCapsListCommand(string module, string[] cmdParams) { if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) { return; } StringBuilder capsReport = new StringBuilder(); capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); lock (m_capsObjects) { foreach (KeyValuePair <uint, Caps> kvp in m_capsObjects) { Caps caps = kvp.Value; string name = string.Empty; if (m_scene.TryGetScenePresence(caps.AgentID, out ScenePresence sp) && sp != null) { name = sp.Name; } capsReport.AppendFormat("** Circuit {0}; {1} {2}:\n", kvp.Key, caps.AgentID, name); for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext();) { Uri uri = new Uri(kvp2.Value.ToString()); capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); } foreach (KeyValuePair <string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers()) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url); } foreach (KeyValuePair <string, string> kvp3 in caps.ExternalCapsHandlers) { capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); } } } MainConsole.Instance.Output(capsReport.ToString()); }
/// <summary> /// Set up the CAPS for display names /// </summary> /// <param name="agentID"></param> /// <param name="caps"></param> public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); caps.RegisterHandler("SetDisplayName", new RestHTTPHandler("POST", "/CAPS" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return ProcessSetDisplayName(m_dhttpMethod, agentID); })); capuuid = UUID.Random(); caps.RegisterHandler("GetDisplayNames", new RestHTTPHandler("POST", "/CAPS" + capuuid + "/", delegate(Hashtable m_dhttpMethod) { return ProcessGetDisplayName(m_dhttpMethod, agentID); })); }
public void RegisterCaps(UUID agent, Caps caps) { string capPath = "/" + UUID.Random().ToString(); caps.RegisterSimpleHandler("AgentPreferences", new SimpleStreamHandler(capPath, delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { UpdateAgentPreferences(httpRequest, httpResponse, agent); })); caps.RegisterSimpleHandler("UpdateAgentLanguage", new SimpleStreamHandler(capPath, delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { UpdateAgentPreferences(httpRequest, httpResponse, agent); }), false); caps.RegisterSimpleHandler("UpdateAgentInformation", new SimpleStreamHandler(capPath, delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { UpdateAgentPreferences(httpRequest, httpResponse, agent); }), false); }
private void RegisterCaps(UUID agentID, Caps caps) { if (m_fetchInventory2Url == "localhost") { FetchInventory2Handler fetchHandler = new FetchInventory2Handler(m_inventoryService, agentID); caps.RegisterSimpleHandler("FetchInventory2", new SimpleOSDMapHandler("POST", "/" + UUID.Random(), delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap map) { fetchHandler.FetchInventorySimpleRequest(httpRequest, httpResponse, map, m_badRequests); } )); } else { caps.RegisterHandler("FetchInventory2", m_fetchInventory2Url); } // m_log.DebugFormat( // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); }
public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { if (configName != String.Empty) { m_ConfigName = configName; } IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) { throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); } string assetService = serverConfig.GetString("AssetService", String.Empty); if (assetService == String.Empty) { throw new Exception("No AssetService in config file"); } Object[] args = new Object[] { config }; m_AssetService = ServerUtils.LoadPlugin <IAssetService>(assetService, args); if (m_AssetService == null) { throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); } // NEED TO FIX THIS OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, ""); server.AddStreamHandler(new RestStreamHandler( "POST", "/CAPS/UploadBakedTexture/", new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture, "UploadBakedTexture", "Upload Baked Texture Capability")); }
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.AssetService, 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 CreateCaps(UUID agentId) { if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) { return; } Caps caps; String capsObjectPath = GetCapsPath(agentId); m_capsObjectsRwLock.AcquireWriterLock(-1); try { if (m_capsObjects.ContainsKey(agentId)) { Caps oldCaps = m_capsObjects[agentId]; //m_log.WarnFormat( // "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); } // m_log.DebugFormat( // "[CAPS]: Adding capabilities for agent {0} in {1} with path {2}", // agentId, m_scene.RegionInfo.RegionName, capsObjectPath); caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, (MainServer.Instance == null) ? 0 : MainServer.Instance.Port, capsObjectPath, agentId, m_scene.RegionInfo.RegionName); m_capsObjects[agentId] = caps; } finally { m_capsObjectsRwLock.ReleaseWriterLock(); } m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); }
private void RegisterCaps(UUID agentID, Caps caps) { if (m_Url == "localhost") { string capUrl = "/CAPS/" + UUID.Random() + "/"; // Register this as a poll service PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); args.Type = PollServiceEventArgs.EventType.Texture; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); string hostName = m_scene.RegionInfo.ExternalHostName; uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; string protocol = "http"; if (MainServer.Instance.UseSSL) { hostName = MainServer.Instance.SSLCommonName; port = MainServer.Instance.SSLPort; protocol = "https"; } IExternalCapsModule handler = m_scene.RequestModuleInterface <IExternalCapsModule>(); if (handler != null) { handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl); } else { caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); } m_pollservices[agentID] = args; m_capsDict[agentID] = capUrl; } else { caps.RegisterHandler("GetTexture", m_Url); } }
public void RegisterCaps(UUID agentID, Caps caps) { //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( caps, m_scene.AssetService, m_persistBakedTextures); caps.RegisterHandler( "UploadBakedTexture", new RestStreamHandler( "POST", "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, avatarhandler.UploadBakedTexture, "UploadBakedTexture", agentID.ToString())); } else { caps.RegisterHandler("UploadBakedTexture", m_URL); } }
public void RegisterCaps(UUID agentID, Caps caps) { GetAssetsHandler assethandler = null; GetAssetsHandler reuse_assethandler = null; foreach (CapsData data in m_CapsData) { if (data.Url == "localhost") { if (string.IsNullOrEmpty(data.RedirectUrl)) { if (reuse_assethandler == null) { reuse_assethandler = new GetAssetsHandler("/CAPS/" + UUID.Random() + "/", m_assetService, "GetAsset", agentID.ToString(), null); } assethandler = reuse_assethandler; } else { assethandler = new GetAssetsHandler("/CAPS/" + UUID.Random() + "/", m_assetService, data.Name, agentID.ToString(), data.RedirectUrl); } caps.RegisterHandler( data.Name, assethandler); } else { IExternalCapsModule handler = m_scene.RequestModuleInterface <IExternalCapsModule>(); if (handler != null) { handler.RegisterExternalUserCapsHandler(agentID, caps, data.Name, data.Url); } else { caps.RegisterHandler(data.Name, data.Url); } } } }
public void RegisterCaps(UUID agentID, Caps caps) { // UUID capID = UUID.Random(); //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { // m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), delegate(Hashtable m_dhttpMethod) { return(gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null)); }); caps.RegisterHandler("GetMesh", reqHandler); } else { // m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetMesh", m_URL); } }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capID = UUID.Random(); if (m_ExternalSearchURL != string.Empty) { caps.RegisterHandler( "AvatarPickerSearch", new ExternalAvatarPickerSearchHandler("/CAPS/" + capID + "/", m_ExternalSearchURL, "ExternalAvatarPickerSearch", "Search for avatars by name")); } else if (m_URL == "localhost") { // m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); caps.RegisterHandler( "AvatarPickerSearch", new AvatarPickerSearchHandler("/CAPS/" + capID + "/", m_People, "AvatarPickerSearch", "Search for avatars by name")); } else { // m_log.DebugFormat("[AVATAR PICKER SEARCH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("AvatarPickerSearch", m_URL); } }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capID = UUID.Random(); bool getMeshRegistered = false; if (m_URL == string.Empty) { } else if (m_URL == "localhost") { getMeshRegistered = true; caps.RegisterHandler( "GetMesh", new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh", agentID.ToString(), m_RedirectURL)); } else { caps.RegisterHandler("GetMesh", m_URL); } if (m_URL2 == string.Empty) { } else if (m_URL2 == "localhost") { if (!getMeshRegistered) { caps.RegisterHandler( "GetMesh2", new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh2", agentID.ToString(), m_RedirectURL2)); } } else { caps.RegisterHandler("GetMesh2", m_URL2); } }
private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp) { sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root"); ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Cap Name", 34); cdt.AddColumn("Req Received", 12); cdt.AddColumn("Req Handled", 12); cdt.Indent = 2; Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); if (caps == null) { return; } List <CapTableRow> capRows = new List <CapTableRow>(); foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values) { capRows.Add(new CapTableRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled)); } foreach (KeyValuePair <string, PollServiceEventArgs> kvp in caps.GetPollHandlers()) { capRows.Add(new CapTableRow(kvp.Key, kvp.Value.RequestsReceived, kvp.Value.RequestsHandled)); } foreach (CapTableRow ctr in capRows.OrderByDescending(ctr => ctr.RequestsReceived)) { cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled); } sb.Append(cdt.ToString()); }
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) { string capUrl; if (url == "localhost") { capUrl = "/CAPS/" + UUID.Random(); IRequestHandler reqHandler = new RestStreamHandler("POST", capUrl, m_webFetchHandler.FetchInventoryDescendentsRequest); caps.RegisterHandler(capName, reqHandler); } else { capUrl = url; caps.RegisterHandler(capName, capUrl); } // m_log.DebugFormat( // "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}", // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); }
void OnRegisterCaps(OpenMetaverse.UUID agentID, OpenSim.Framework.Capabilities.Caps caps) { string capsBase = "/CAPS/" + caps.CapsObjectPath; IRequestHandler renderMaterialsPostHandler = new RestStreamHandler("POST", capsBase + "/", RenderMaterialsPostCap, "RenderMaterials", null); caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler); // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET // and POST handlers, (at least at the time this was originally written), so we first set up a POST // handler normally and then add a GET handler via MainServer IRequestHandler renderMaterialsGetHandler = new RestStreamHandler("GET", capsBase + "/", RenderMaterialsGetCap, "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", capsBase + "/", RenderMaterialsPostCap, "RenderMaterials", null); MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler); }
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); // } Queue<OSD> queue = TryGetQueue(agentID); OSD element = queue.Dequeue(); // 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()); 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; }
public void RegisterCaps(UUID agentID, Caps caps) { IRequestHandler reqHandler = new RestHTTPHandler( "GET", "/CAPS/" + UUID.Random(), x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString()); caps.RegisterHandler("SimulatorFeatures", reqHandler); }
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 MainServer.Instance.AddPollServiceHTTPHandler( capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); Random rnd = new Random(Environment.TickCount); lock (m_ids) { if (!m_ids.ContainsKey(agentID)) m_ids.Add(agentID, rnd.Next(30000000)); } }
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); UUID eventQueueGetUUID; eventQueueGetUUID = m_AvatarQueueUUIDMapping.GetOrAddIfNotExists(agentID, delegate() { return UUID.Random(); }); m_QueueUUIDAvatarMapping[eventQueueGetUUID] = agentID; m_AvatarQueueUUIDMapping[agentID] = eventQueueGetUUID; caps.RegisterPollHandler( "EventQueueGet", new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); Random rnd = new Random(Environment.TickCount); try { m_ids.AddIfNotExists(agentID, delegate() { return rnd.Next(30000000); }); } catch(ThreadedClasses.RwLockedDictionary<UUID, int>.KeyAlreadyExistsException) { } }
/// <summary> /// Parses add request /// </summary> /// <param name="request"></param> /// <param name="AgentId"></param> /// <param name="cap"></param> /// <returns></returns> 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["keepalive"] = false; responsedata["str_response_string"] = "Request wasn't what was expected"; ScenePresence avatar; if (!m_scene.TryGetScenePresence(AgentId, out avatar)) return responsedata; OSDMap r = (OSDMap)OSDParser.Deserialize((string)request["requestbody"]); UploadObjectAssetMessage message = new UploadObjectAssetMessage(); try { message.Deserialize(r); } catch (Exception ex) { m_log.Error("[UPLOAD OBJECT ASSET MODULE]: Error deserializing message " + ex.ToString()); message = null; } if (message == null) { responsedata["int_response_code"] = 400; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = "<llsd><map><key>error</key><string>Error parsing Object</string></map></llsd>"; return responsedata; } Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation); Quaternion rot = Quaternion.Identity; Vector3 rootpos = Vector3.Zero; // Quaternion rootrot = Quaternion.Identity; SceneObjectGroup rootGroup = null; SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length]; for (int i = 0; i < message.Objects.Length; i++) { UploadObjectAssetMessage.Object obj = message.Objects[i]; PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); if (i == 0) { rootpos = obj.Position; // rootrot = obj.Rotation; } // Combine the extraparams data into it's ugly blob again.... //int bytelength = 0; //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) //{ // bytelength += obj.ExtraParams[extparams].ExtraParamData.Length; //} //byte[] extraparams = new byte[bytelength]; //int position = 0; //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) //{ // Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, // obj.ExtraParams[extparams].ExtraParamData.Length); // // position += obj.ExtraParams[extparams].ExtraParamData.Length; // } //pbs.ExtraParams = extraparams; for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) { UploadObjectAssetMessage.Object.ExtraParam extraParam = obj.ExtraParams[extparams]; switch ((ushort)extraParam.Type) { case (ushort)ExtraParamType.Sculpt: Primitive.SculptData sculpt = new Primitive.SculptData(extraParam.ExtraParamData, 0); pbs.SculptEntry = true; pbs.SculptTexture = obj.SculptID; pbs.SculptType = (byte)sculpt.Type; break; case (ushort)ExtraParamType.Flexible: Primitive.FlexibleData flex = new Primitive.FlexibleData(extraParam.ExtraParamData, 0); pbs.FlexiEntry = true; pbs.FlexiDrag = flex.Drag; pbs.FlexiForceX = flex.Force.X; pbs.FlexiForceY = flex.Force.Y; pbs.FlexiForceZ = flex.Force.Z; pbs.FlexiGravity = flex.Gravity; pbs.FlexiSoftness = flex.Softness; pbs.FlexiTension = flex.Tension; pbs.FlexiWind = flex.Wind; break; case (ushort)ExtraParamType.Light: Primitive.LightData light = new Primitive.LightData(extraParam.ExtraParamData, 0); pbs.LightColorA = light.Color.A; pbs.LightColorB = light.Color.B; pbs.LightColorG = light.Color.G; pbs.LightColorR = light.Color.R; pbs.LightCutoff = light.Cutoff; pbs.LightEntry = true; pbs.LightFalloff = light.Falloff; pbs.LightIntensity = light.Intensity; pbs.LightRadius = light.Radius; break; case 0x40: pbs.ReadProjectionData(extraParam.ExtraParamData, 0); break; } } pbs.PathBegin = (ushort) obj.PathBegin; pbs.PathCurve = (byte) obj.PathCurve; pbs.PathEnd = (ushort) obj.PathEnd; pbs.PathRadiusOffset = (sbyte) obj.RadiusOffset; pbs.PathRevolutions = (byte) obj.Revolutions; pbs.PathScaleX = (byte) obj.ScaleX; pbs.PathScaleY = (byte) obj.ScaleY; pbs.PathShearX = (byte) obj.ShearX; pbs.PathShearY = (byte) obj.ShearY; pbs.PathSkew = (sbyte) obj.Skew; pbs.PathTaperX = (sbyte) obj.TaperX; pbs.PathTaperY = (sbyte) obj.TaperY; pbs.PathTwist = (sbyte) obj.Twist; pbs.PathTwistBegin = (sbyte) obj.TwistBegin; pbs.HollowShape = (HollowShape) obj.ProfileHollow; pbs.PCode = (byte) PCode.Prim; pbs.ProfileBegin = (ushort) obj.ProfileBegin; pbs.ProfileCurve = (byte) obj.ProfileCurve; pbs.ProfileEnd = (ushort) obj.ProfileEnd; pbs.Scale = obj.Scale; pbs.State = (byte) 0; pbs.LastAttachPoint = (byte) 0; SceneObjectPart prim = new SceneObjectPart(); prim.UUID = UUID.Random(); prim.CreatorID = AgentId; prim.OwnerID = AgentId; prim.GroupID = obj.GroupID; prim.LastOwnerID = prim.OwnerID; prim.CreationDate = Util.UnixTimeSinceEpoch(); prim.Name = obj.Name; prim.Description = ""; prim.PayPrice[0] = -2; prim.PayPrice[1] = -2; prim.PayPrice[2] = -2; prim.PayPrice[3] = -2; prim.PayPrice[4] = -2; Primitive.TextureEntry tmp = new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f")); for (int j = 0; j < obj.Faces.Length; j++) { UploadObjectAssetMessage.Object.Face face = obj.Faces[j]; Primitive.TextureEntryFace primFace = tmp.CreateFace((uint) j); primFace.Bump = face.Bump; primFace.RGBA = face.Color; primFace.Fullbright = face.Fullbright; primFace.Glow = face.Glow; primFace.TextureID = face.ImageID; primFace.Rotation = face.ImageRot; primFace.MediaFlags = ((face.MediaFlags & 1) != 0); primFace.OffsetU = face.OffsetS; primFace.OffsetV = face.OffsetT; primFace.RepeatU = face.ScaleS; primFace.RepeatV = face.ScaleT; primFace.TexMapType = (MappingType) (face.MediaFlags & 6); } pbs.TextureEntry = tmp.GetBytes(); prim.Shape = pbs; prim.Scale = obj.Scale; SceneObjectGroup grp = new SceneObjectGroup(); grp.SetRootPart(prim); prim.ParentID = 0; if (i == 0) { rootGroup = grp; } grp.AttachToScene(m_scene); grp.AbsolutePosition = obj.Position; prim.RotationOffset = obj.Rotation; // Required for linking grp.RootPart.ClearUpdateSchedule(); if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) { m_scene.AddSceneObject(grp); grp.AbsolutePosition = obj.Position; } allparts[i] = grp; } for (int j = 1; j < allparts.Length; j++) { // Required for linking rootGroup.RootPart.ClearUpdateSchedule(); allparts[j].RootPart.ClearUpdateSchedule(); rootGroup.LinkToGroup(allparts[j]); } rootGroup.ScheduleGroupForFullUpdate(); pos = m_scene.GetNewRezLocation( Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false); responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId)); return responsedata; }
private void OnDeRegisterCaps(UUID agentID, Caps caps) { }
/// <summary> /// Callback for a viewerstats cap /// </summary> /// <param name="request"></param> /// <param name="path"></param> /// <param name="param"></param> /// <param name="agentID"></param> /// <param name="caps"></param> /// <returns></returns> public string ViewerStatsReport(string request, string path, string param, UUID agentID, Caps caps) { //m_log.Debug(request); dataConnector.UpdateUserStats(ParseViewerStats(request, agentID)); return String.Empty; }
public void DeregisterCapsEventHandler(UUID agentID, Caps caps) { }
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["keepalive"] = false; responsedata["str_response_string"] = "Request wasn't what was expected"; ScenePresence avatar; if (!m_scene.TryGetScenePresence(AgentId, out avatar)) { return(responsedata); } OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]); if (r.Type != OSDType.Map) // not a proper req { return(responsedata); } //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; int lastattach = 0; OSDMap rm = (OSDMap)r; OSD tmpOSD; if (rm.TryGetValue("ObjectData", out tmpOSD)) //v2 { if (tmpOSD.Type != OSDType.Map) { responsedata["str_response_string"] = "Has ObjectData key, but data not in expected format"; return(responsedata); } OSDMap ObjMap = (OSDMap)tmpOSD; 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.TryGetValue("Path", out tmpOSD)) { if (tmpOSD.Type != OSDType.Map) { responsedata["str_response_string"] = "Has Path key, but data not in expected format"; return(responsedata); } OSDMap PathMap = (OSDMap)tmpOSD; 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.TryGetValue("Profile", out tmpOSD)) { if (tmpOSD.Type != OSDType.Map) { responsedata["str_response_string"] = "Has Profile key, but data not in expected format"; return(responsedata); } OSDMap ProfileMap = (OSDMap)tmpOSD; 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(); lastattach = ObjMap["LastAttachPoint"].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.TryGetValue("AgentData", out tmpOSD)) { if (tmpOSD.Type != OSDType.Map) { responsedata["str_response_string"] = "Has AgentData key, but data not in expected format"; return(responsedata); } OSDMap AgentDataMap = (OSDMap)tmpOSD; //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(); lastattach = rm["last_attach_point"].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); 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; pbs.LastAttachPoint = (byte)lastattach; SceneObjectGroup obj = null;; if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) { // rez ON the ground, not IN the ground // pos.Z += 0.25F; obj = m_scene.AddNewPrim(avatar.UUID, group_id, pos, rotation, pbs); } 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; obj.InvalidateDeepEffectivePerms(); m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(obj.LocalId)); return(responsedata); }
public void RegisterCaps(UUID agentID, Caps caps) { if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(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)); }
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.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, MainServer.Instance.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; }
void EventManager_OnRegisterCaps(UUID agentID, Caps caps) { /*string capsBase = "/CAPS/" + UUID.Random(); caps.RegisterHandler("GroupProposalBallot", new RestHTTPHandler("POST", capsBase + "/", delegate(Hashtable m_dhttpMethod) { return GroupProposalBallot(m_dhttpMethod, agentID); }));*/ }
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); UUID eventQueueGetUUID; 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); } string eventQueueGetPath = GenerateEqgCapPath(eventQueueGetUUID); // Register this as a caps handler // FIXME: Confusingly, we need to register separate as a capability so that the client is told about // EventQueueGet when it receive capability information, but then we replace the rest handler immediately // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but // really it should be possible to directly register the poll handler as a capability. caps.RegisterHandler("EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null)); // delegate(Hashtable m_dhttpMethod) // { // return ProcessQueue(m_dhttpMethod, agentID, caps); // })); // This will persist this beyond the expiry of the caps handlers // TODO: Add EventQueueGet name/description for diagnostics MainServer.Instance.AddPollServiceHTTPHandler( eventQueueGetPath, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); // m_log.DebugFormat( // "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}", // eventQueueGetPath, agentID, m_scene.RegionInfo.RegionName); 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) { 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), "UploadObjectAsset", agentID.ToString())); /* caps.RegisterHandler("NewFileAgentInventoryVariablePrice", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST", "/CAPS/" + capID.ToString(), delegate(LLSDAssetUploadRequest req) { return NewAgentInventoryRequest(req,agentID); })); */ }
public void RegisterCaps(UUID agent, Caps caps) { UUID capId = UUID.Random(); caps.RegisterHandler("AgentPreferences", new RestStreamHandler("POST", "/CAPS/" + capId, delegate(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { return UpdateAgentPreferences(request, path, param, agent); })); caps.RegisterHandler("UpdateAgentLanguage", new RestStreamHandler("POST", "/CAPS/" + capId, delegate(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { return UpdateAgentPreferences(request, path, param, agent); })); caps.RegisterHandler("UpdateAgentInformation", new RestStreamHandler("POST", "/CAPS/" + capId, delegate(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { return UpdateAgentPreferences(request, path, param, agent); })); }
private void OnRegisterCaps(UUID agentID, Caps caps) { string capUrl = "/CAPS/" + UUID.Random() + "/"; capUrl = "/CAPS/" + UUID.Random() + "/"; caps.RegisterHandler("CustomMenuAction", new MenuActionHandler(capUrl, "CustomMenuAction", agentID, this, m_scene)); }
/// <summary> /// Callback for a viewerstats cap /// </summary> /// <param name="request"></param> /// <param name="path"></param> /// <param name="param"></param> /// <param name="agentID"></param> /// <param name="caps"></param> /// <returns></returns> private string ViewerStatsReport(string request, string path, string param, UUID agentID, Caps caps) { // m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID); UpdateUserStats(ParseViewerStats(request, agentID), dbConn); return String.Empty; }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capID = UUID.Random(); m_log.Info("[GETMESH]: /CAPS/" + capID); caps.RegisterHandler("GetMesh", new RestHTTPHandler("GET", "/CAPS/" + capID, delegate(Hashtable m_dhttpMethod) { return ProcessGetMesh(m_dhttpMethod, agentID, caps); })); }
private void OnRegisterCaps(UUID agentID, Caps caps) { // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); string capsPath = "/CAPS/VS/" + UUID.Random(); caps.RegisterHandler( "ViewerStats", new RestStreamHandler( "POST", capsPath, (request, path, param, httpRequest, httpResponse) => ViewerStatsReport(request, path, param, agentID, caps), "ViewerStats", agentID.ToString())); }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capID = UUID.Random(); // m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); }
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 // FIXME: Confusingly, we need to register separate as a capability so that the client is told about // EventQueueGet when it receive capability information, but then we replace the rest handler immediately // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but // really it should be possible to directly register the poll handler as a capability. caps.RegisterHandler("EventQueueGet", new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/", null)); // delegate(Hashtable m_dhttpMethod) // { // return ProcessQueue(m_dhttpMethod, agentID, caps); // })); // This will persist this beyond the expiry of the caps handlers MainServer.Instance.AddPollServiceHTTPHandler( capsBase + EventQueueGetUUID.ToString() + "/", new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); Random rnd = new Random(Environment.TickCount); lock (m_ids) { if (!m_ids.ContainsKey(agentID)) { m_ids.Add(agentID, rnd.Next(30000000)); } } }
public void ProcessRequest(IOSHttpRequest request, IOSHttpResponse response, UUID AgentId, Caps cap) { if (request.HttpMethod != "POST") { response.StatusCode = (int)HttpStatusCode.NotFound; return; } ScenePresence avatar; if (!m_scene.TryGetScenePresence(AgentId, out avatar) || !m_scene.Permissions.CanIssueEstateCommand(AgentId, false)) { response.StatusCode = (int)HttpStatusCode.Unauthorized; return; } if (m_scene.RegionInfo == null || m_scene.RegionInfo.EstateSettings == null) { response.StatusCode = (int)HttpStatusCode.NotImplemented; return; } OSDMap r; try { r = (OSDMap)OSDParser.Deserialize(request.InputStream); } catch (Exception ex) { m_log.Error("[UPLOAD OBJECT ASSET MODULE]: Error deserializing message " + ex.ToString()); response.StatusCode = (int)HttpStatusCode.BadRequest; return; } bool ok = true; try { string estateName = r["estate_name"].AsString(); UUID invoice = r["invoice"].AsUUID(); //int sunHour = r["sun_hour"].AsInteger(); //bool sunFixed = r["is_sun_fixed"].AsBoolean(); bool externallyVisible = r["is_externally_visible"].AsBoolean(); bool allowDirectTeleport = r["allow_direct_teleport"].AsBoolean(); bool denyAnonymous = r["deny_anonymous"].AsBoolean(); bool denyAgeUnverified = r["deny_age_unverified"].AsBoolean(); bool alloVoiceChat = r["allow_voice_chat"].AsBoolean(); // taxfree is now !AllowAccessOverride bool overridePublicAccess = !m_scene.RegionInfo.EstateSettings.TaxFree; if (r.ContainsKey("override_public_access")) { overridePublicAccess = !r["override_public_access"].AsBoolean(); } bool allowEnvironmentOverride = m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride; if (r.ContainsKey("override_environment")) { allowEnvironmentOverride = !r["override_environment"].AsBoolean(); } ok = m_EstateModule.handleEstateChangeInfoCap(estateName, invoice, externallyVisible, allowDirectTeleport, denyAnonymous, denyAgeUnverified, alloVoiceChat, overridePublicAccess, allowEnvironmentOverride); } catch { ok = false; } response.StatusCode = ok ? (int)HttpStatusCode.OK : (int)HttpStatusCode.BadRequest; }
public void RegisterCaps(UUID agentID, Caps caps) { string hostName = m_scene.RegionInfo.ExternalHostName; uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; string protocol = "http"; if (MainServer.Instance.UseSSL) { hostName = MainServer.Instance.SSLCommonName; port = MainServer.Instance.SSLPort; protocol = "https"; } string hgassets = null; if (m_UserManagement != null) { hgassets = m_UserManagement.GetUserServerURL(agentID, "AssetServerURI"); } IExternalCapsModule handler = m_scene.RequestModuleInterface <IExternalCapsModule>(); string baseURL = String.Format("{0}://{1}:{2}", protocol, hostName, port); if (m_GetTextureURL == "localhost") { string capUrl = "/" + UUID.Random(); // Register this as a poll service PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets); //args.Type = PollServiceEventArgs.EventType.Texture; MainServer.Instance.AddPollServiceHTTPHandler(args); if (handler != null) { handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl); } else { caps.RegisterHandler("GetTexture", baseURL + capUrl); } m_capsDictTexture[agentID] = capUrl; } else { caps.RegisterHandler("GetTexture", m_GetTextureURL); } //GetMesh if (m_GetMeshURL == "localhost") { string capUrl = "/" + UUID.Random(); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets); //args.Type = PollServiceEventArgs.EventType.Mesh; MainServer.Instance.AddPollServiceHTTPHandler(args); if (handler != null) { handler.RegisterExternalUserCapsHandler(agentID, caps, "GetMesh", capUrl); } else { caps.RegisterHandler("GetMesh", baseURL + capUrl); } m_capsDictGetMesh[agentID] = capUrl; } else if (m_GetMeshURL != string.Empty) { caps.RegisterHandler("GetMesh", m_GetMeshURL); } //GetMesh2 if (m_GetMesh2URL == "localhost") { string capUrl = "/" + UUID.Random(); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets); //args.Type = PollServiceEventArgs.EventType.Mesh2; MainServer.Instance.AddPollServiceHTTPHandler(args); if (handler != null) { handler.RegisterExternalUserCapsHandler(agentID, caps, "GetMesh2", capUrl); } else { caps.RegisterHandler("GetMesh2", baseURL + capUrl); } m_capsDictGetMesh2[agentID] = capUrl; } else if (m_GetMesh2URL != string.Empty) { caps.RegisterHandler("GetMesh2", m_GetMesh2URL); } //ViewerAsset if (m_GetAssetURL == "localhost") { string capUrl = "/" + UUID.Random(); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets); //args.Type = PollServiceEventArgs.EventType.Asset; MainServer.Instance.AddPollServiceHTTPHandler(args); if (handler != null) { handler.RegisterExternalUserCapsHandler(agentID, caps, "ViewerAsset", capUrl); } else { caps.RegisterHandler("ViewerAsset", baseURL + capUrl); } m_capsDictGetAsset[agentID] = capUrl; } else if (m_GetAssetURL != string.Empty) { caps.RegisterHandler("ViewerAsset", m_GetAssetURL); } }
public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) { handlerDeregisterCaps = OnDeregisterCaps; if (handlerDeregisterCaps != null) { handlerDeregisterCaps(agentID, caps); } }
public Hashtable ProcessRequest(Hashtable request, UUID AgentId, Caps cap) { Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["content_type"] = "text/plain"; ScenePresence avatar; if (!m_scene.TryGetScenePresence(AgentId, out avatar)) { responsedata["str_response_string"] = "<llsd><array /></llsd>";; responsedata["keepalive"] = false; return(responsedata); } if (m_scene.RegionInfo == null || m_scene.RegionInfo.EstateSettings == null || !m_scene.Permissions.CanIssueEstateCommand(AgentId, false)) { responsedata["str_response_string"] = "<llsd><array /></llsd>";; return(responsedata); } EstateSettings regionSettings = m_scene.RegionInfo.EstateSettings; UUID[] managers = regionSettings.EstateManagers; UUID[] allowed = regionSettings.EstateAccess; UUID[] groups = regionSettings.EstateGroups; EstateBan[] EstateBans = regionSettings.EstateBans; StringBuilder sb = LLSDxmlEncode.Start(); LLSDxmlEncode.AddArray(sb); if (allowed != null && allowed.Length > 0) { LLSDxmlEncode.AddMap("AllowedAgents", sb); for (int i = 0; i < allowed.Length; ++i) { UUID id = allowed[i]; if (id == UUID.Zero) { continue; } LLSDxmlEncode.AddElem("id", id, sb); } LLSDxmlEncode.AddEndMap(sb); } if (groups != null && groups.Length > 0) { LLSDxmlEncode.AddMap("AllowedGroups", sb); for (int i = 0; i < groups.Length; ++i) { UUID id = groups[i]; if (id == UUID.Zero) { continue; } LLSDxmlEncode.AddElem("id", id, sb); } LLSDxmlEncode.AddEndMap(sb); } if (EstateBans != null && EstateBans.Length > 0) { LLSDxmlEncode.AddMap("BannedAgents", sb); for (int i = 0; i < EstateBans.Length; ++i) { UUID id = EstateBans[i].BannedUserID; if (id == UUID.Zero) { continue; } LLSDxmlEncode.AddElem("id", id, sb); } LLSDxmlEncode.AddEndMap(sb); } if (managers != null && managers.Length > 0) { LLSDxmlEncode.AddMap("Managers", sb); for (int i = 0; i < managers.Length; ++i) { LLSDxmlEncode.AddElem("id", managers[i], sb); } LLSDxmlEncode.AddEndMap(sb); } LLSDxmlEncode.AddEndArray(sb); responsedata["str_response_string"] = LLSDxmlEncode.End(sb); return(responsedata); }
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) { Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 400; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = "Request wasn't what was expected"; string meshStr = string.Empty; if (request.ContainsKey("mesh_id")) meshStr = request["mesh_id"].ToString(); UUID meshID = UUID.Zero; if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) { if (m_assetService == null) { responsedata["int_response_code"] = 404; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh."; return responsedata; } AssetBase mesh; // Only try to fetch locally cached textures. Misses are redirected mesh = m_assetService.GetCached(meshID.ToString()); if (mesh != null) { if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; responsedata["int_response_code"] = 200; } // Optionally add additional mesh types here else { responsedata["int_response_code"] = 404; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; return responsedata; } } else { mesh = m_assetService.Get(meshID.ToString()); if (mesh != null) { if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; responsedata["int_response_code"] = 200; } // Optionally add additional mesh types here else { responsedata["int_response_code"] = 404; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; return responsedata; } } else { responsedata["int_response_code"] = 404; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; return responsedata; } } } return responsedata; }
public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) { DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps; if (handlerDeregisterCaps != null) { foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList()) { try { d(agentID, caps); } catch (Exception e) { m_log.ErrorFormat( "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}", e.Message, e.StackTrace); } } } }
public void OnRegisterCaps(UUID agentID, Caps caps) { // Register an event queue for the client if (DebugLevel > 0) 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); UUID eventQueueGetUUID; 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); } caps.RegisterPollHandler( "EventQueueGet", new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); Random rnd = new Random(Environment.TickCount); lock (m_ids) { if (!m_ids.ContainsKey(agentID)) m_ids.Add(agentID, rnd.Next(30000000)); } }