From d607914f6a7e0ef7890ae229474a1ad90511868f Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 24 Jun 2007 18:40:02 +0000 Subject: Hopefully enabled the OGS commsManager --- OpenSim/OpenSim.Region/Caps.cs | 52 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'OpenSim/OpenSim.Region/Caps.cs') diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs index 59f24e3..7ec0c75 100644 --- a/OpenSim/OpenSim.Region/Caps.cs +++ b/OpenSim/OpenSim.Region/Caps.cs @@ -22,9 +22,11 @@ namespace OpenSim.Region private string mapLayerPath = "0001/"; private string newInventory = "0002/"; private string requestTexture = "0003/"; + private string eventQueue = "0100/"; private BaseHttpServer httpListener; private LLUUID agentID; private AssetCache assetCache; + private int eventQueueCount = 1; public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) { @@ -45,6 +47,7 @@ namespace OpenSim.Region httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); } /// @@ -74,6 +77,7 @@ namespace OpenSim.Region capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; + capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; return capURLS; } @@ -116,6 +120,40 @@ namespace OpenSim.Region return res; } + public string ProcessEventQueue(string request, string path, string param) + { + Console.WriteLine("event queue request " + request); + string res = ""; + res = this.CreateEmptyEventResponse(); + return res; + } + + public string CreateEstablishAgentComms(string caps, string ipAddressPort) + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += "messageEstablishAgentCommunication"; + res += "body"; + res += "sim-ip-and-port"+ipAddressPort +""; + res += "seed-capability"+caps+""; + res += "agent-id"+this.agentID.ToStringHyphenated()+""; + res += ""; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + + public string CreateEmptyEventResponse() + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + public string NewAgentInventory(string request, string path, string param) { //Console.WriteLine("received upload request:"+ request); @@ -123,13 +161,13 @@ namespace OpenSim.Region LLUUID newAsset = LLUUID.Random(); LLUUID newInvItem = LLUUID.Random(); string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = new AssetUploader(newAsset,newInvItem, uploaderPath, this.httpListener); + AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; Console.WriteLine("uploader url is " + uploaderURL); res += ""; - res += "uploader"+uploaderURL +""; - //res += "successtrue"; + res += "uploader" + uploaderURL + ""; + //res += "successtrue"; res += "stateupload"; res += ""; uploader.OnUpLoad += this.UploadHandler; @@ -138,7 +176,7 @@ namespace OpenSim.Region public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) { - // Console.WriteLine("upload handler called"); + // Console.WriteLine("upload handler called"); AssetBase asset; asset = new AssetBase(); asset.FullID = assetID; @@ -147,7 +185,7 @@ namespace OpenSim.Region asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); asset.Data = data; this.assetCache.AddAsset(asset); - + } public class AssetUploader @@ -181,12 +219,12 @@ namespace OpenSim.Region res += ""; Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); - httpListener.RemoveRestHandler("POST", "/CAPS/"+uploaderPath); + httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); if (OnUpLoad != null) { OnUpLoad(newAssetID, inv, data); } - + /*FileStream fs = File.Create("upload.jp2"); BinaryWriter bw = new BinaryWriter(fs); bw.Write(data); -- cgit v1.1