aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Caps.cs
diff options
context:
space:
mode:
authorMW2007-06-24 18:40:02 +0000
committerMW2007-06-24 18:40:02 +0000
commitd607914f6a7e0ef7890ae229474a1ad90511868f (patch)
tree0030127df56b96c774faaf8e73a74620d0a13c54 /OpenSim/OpenSim.Region/Caps.cs
parent* Updated to use multi-listeners (diff)
downloadopensim-SC_OLD-d607914f6a7e0ef7890ae229474a1ad90511868f.zip
opensim-SC_OLD-d607914f6a7e0ef7890ae229474a1ad90511868f.tar.gz
opensim-SC_OLD-d607914f6a7e0ef7890ae229474a1ad90511868f.tar.bz2
opensim-SC_OLD-d607914f6a7e0ef7890ae229474a1ad90511868f.tar.xz
Hopefully enabled the OGS commsManager
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Region/Caps.cs52
1 files changed, 45 insertions, 7 deletions
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
22 private string mapLayerPath = "0001/"; 22 private string mapLayerPath = "0001/";
23 private string newInventory = "0002/"; 23 private string newInventory = "0002/";
24 private string requestTexture = "0003/"; 24 private string requestTexture = "0003/";
25 private string eventQueue = "0100/";
25 private BaseHttpServer httpListener; 26 private BaseHttpServer httpListener;
26 private LLUUID agentID; 27 private LLUUID agentID;
27 private AssetCache assetCache; 28 private AssetCache assetCache;
29 private int eventQueueCount = 1;
28 30
29 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) 31 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent)
30 { 32 {
@@ -45,6 +47,7 @@ namespace OpenSim.Region
45 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); 47 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest);
46 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); 48 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer);
47 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); 49 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory);
50 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue);
48 } 51 }
49 52
50 /// <summary> 53 /// <summary>
@@ -74,6 +77,7 @@ namespace OpenSim.Region
74 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>"; 77 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
75 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>"; 78 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
76 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>"; 79 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
80 capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>";
77 return capURLS; 81 return capURLS;
78 } 82 }
79 83
@@ -116,6 +120,40 @@ namespace OpenSim.Region
116 return res; 120 return res;
117 } 121 }
118 122
123 public string ProcessEventQueue(string request, string path, string param)
124 {
125 Console.WriteLine("event queue request " + request);
126 string res = "";
127 res = this.CreateEmptyEventResponse();
128 return res;
129 }
130
131 public string CreateEstablishAgentComms(string caps, string ipAddressPort)
132 {
133 string res = "<llsd><map><key>id</key><integer>" + eventQueueCount + "</integer>";
134 res += "<key>events</key><array><map>";
135 res += "<key>message</key><string>EstablishAgentCommunication</string>";
136 res += "<key>body</key><map>";
137 res += "<key>sim-ip-and-port</key><string>"+ipAddressPort +"</string>";
138 res += "<key>seed-capability</key><string>"+caps+"</string>";
139 res += "<key>agent-id</key><uuid>"+this.agentID.ToStringHyphenated()+"</uuid>";
140 res += "</map>";
141 res += "</map></array>";
142 res += "</map></llsd>";
143 eventQueueCount++;
144 return res;
145 }
146
147 public string CreateEmptyEventResponse()
148 {
149 string res = "<llsd><map><key>id</key><integer>" + eventQueueCount + "</integer>";
150 res += "<key>events</key><array><map>";
151 res += "</map></array>";
152 res += "</map></llsd>";
153 eventQueueCount++;
154 return res;
155 }
156
119 public string NewAgentInventory(string request, string path, string param) 157 public string NewAgentInventory(string request, string path, string param)
120 { 158 {
121 //Console.WriteLine("received upload request:"+ request); 159 //Console.WriteLine("received upload request:"+ request);
@@ -123,13 +161,13 @@ namespace OpenSim.Region
123 LLUUID newAsset = LLUUID.Random(); 161 LLUUID newAsset = LLUUID.Random();
124 LLUUID newInvItem = LLUUID.Random(); 162 LLUUID newInvItem = LLUUID.Random();
125 string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); 163 string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000");
126 AssetUploader uploader = new AssetUploader(newAsset,newInvItem, uploaderPath, this.httpListener); 164 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener);
127 httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); 165 httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
128 string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; 166 string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath;
129 Console.WriteLine("uploader url is " + uploaderURL); 167 Console.WriteLine("uploader url is " + uploaderURL);
130 res += "<llsd><map>"; 168 res += "<llsd><map>";
131 res += "<key>uploader</key><string>"+uploaderURL +"</string>"; 169 res += "<key>uploader</key><string>" + uploaderURL + "</string>";
132 //res += "<key>success</key><boolean>true</boolean>"; 170 //res += "<key>success</key><boolean>true</boolean>";
133 res += "<key>state</key><string>upload</string>"; 171 res += "<key>state</key><string>upload</string>";
134 res += "</map></llsd>"; 172 res += "</map></llsd>";
135 uploader.OnUpLoad += this.UploadHandler; 173 uploader.OnUpLoad += this.UploadHandler;
@@ -138,7 +176,7 @@ namespace OpenSim.Region
138 176
139 public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) 177 public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data)
140 { 178 {
141 // Console.WriteLine("upload handler called"); 179 // Console.WriteLine("upload handler called");
142 AssetBase asset; 180 AssetBase asset;
143 asset = new AssetBase(); 181 asset = new AssetBase();
144 asset.FullID = assetID; 182 asset.FullID = assetID;
@@ -147,7 +185,7 @@ namespace OpenSim.Region
147 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); 185 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
148 asset.Data = data; 186 asset.Data = data;
149 this.assetCache.AddAsset(asset); 187 this.assetCache.AddAsset(asset);
150 188
151 } 189 }
152 190
153 public class AssetUploader 191 public class AssetUploader
@@ -181,12 +219,12 @@ namespace OpenSim.Region
181 res += "</map></llsd>"; 219 res += "</map></llsd>";
182 220
183 Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); 221 Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated());
184 httpListener.RemoveRestHandler("POST", "/CAPS/"+uploaderPath); 222 httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath);
185 if (OnUpLoad != null) 223 if (OnUpLoad != null)
186 { 224 {
187 OnUpLoad(newAssetID, inv, data); 225 OnUpLoad(newAssetID, inv, data);
188 } 226 }
189 227
190 /*FileStream fs = File.Create("upload.jp2"); 228 /*FileStream fs = File.Create("upload.jp2");
191 BinaryWriter bw = new BinaryWriter(fs); 229 BinaryWriter bw = new BinaryWriter(fs);
192 bw.Write(data); 230 bw.Write(data);