aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs105
-rw-r--r--OpenSim/Framework/LandData.cs104
-rw-r--r--OpenSim/Framework/LandUpdateArgs.cs7
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs10
4 files changed, 210 insertions, 16 deletions
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index 0db7bb9..8a339fe 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Framework.Capabilities
44 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, 44 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
45 byte[] data, string inventoryType, string assetType); 45 byte[] data, string inventoryType, string assetType);
46 46
47 public delegate void UploadedBakedTexture(UUID assetID, byte[] data);
48
47 public delegate UUID UpdateItem(UUID itemID, byte[] data); 49 public delegate UUID UpdateItem(UUID itemID, byte[] data);
48 50
49 public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); 51 public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
@@ -97,6 +99,7 @@ namespace OpenSim.Framework.Capabilities
97 // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. 99 // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module.
98 100
99 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. 101 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
102 private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
100 103
101 //private string eventQueue = "0100/"; 104 //private string eventQueue = "0100/";
102 private IScene m_Scene; 105 private IScene m_Scene;
@@ -185,6 +188,8 @@ namespace OpenSim.Framework.Capabilities
185 m_capsHandlers["UpdateScriptTaskInventory"] = 188 m_capsHandlers["UpdateScriptTaskInventory"] =
186 new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); 189 new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
187 m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"]; 190 m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"];
191 m_capsHandlers["UploadBakedTexture"] =
192 new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture);
188 193
189 } 194 }
190 catch (Exception e) 195 catch (Exception e)
@@ -742,6 +747,50 @@ namespace OpenSim.Framework.Capabilities
742 return null; 747 return null;
743 } 748 }
744 749
750 public string UploadBakedTexture(string request, string path,
751 string param, OSHttpRequest httpRequest,
752 OSHttpResponse httpResponse)
753 {
754 try
755 {
756 m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
757 m_regionName);
758
759 string capsBase = "/CAPS/" + m_capsObjectPath;
760 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
761
762 BakedTextureUploader uploader =
763 new BakedTextureUploader( capsBase + uploaderPath,
764 m_httpListener);
765 uploader.OnUpLoad += BakedTextureUploaded;
766
767 m_httpListener.AddStreamHandler(
768 new BinaryStreamHandler("POST", capsBase + uploaderPath,
769 uploader.uploaderCaps));
770
771 string protocol = "http://";
772
773 if (m_httpListener.UseSSL)
774 protocol = "https://";
775
776 string uploaderURL = protocol + m_httpListenerHostName + ":" +
777 m_httpListenPort.ToString() + capsBase + uploaderPath;
778
779 LLSDAssetUploadResponse uploadResponse =
780 new LLSDAssetUploadResponse();
781 uploadResponse.uploader = uploaderURL;
782 uploadResponse.state = "upload";
783
784 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
785 }
786 catch (Exception e)
787 {
788 m_log.Error("[CAPS]: " + e.ToString());
789 }
790
791 return null;
792 }
793
745 /// <summary> 794 /// <summary>
746 /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. 795 /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.
747 /// </summary> 796 /// </summary>
@@ -925,6 +974,17 @@ namespace OpenSim.Framework.Capabilities
925 } 974 }
926 } 975 }
927 976
977 public void BakedTextureUploaded(UUID assetID, byte[] data)
978 {
979 m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
980 AssetBase asset;
981 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
982 asset.Data = data;
983 asset.Temporary = true;
984 asset.Local = true;
985 m_assetCache.Store(asset);
986 }
987
928 /// <summary> 988 /// <summary>
929 /// Called when new asset data for an agent inventory item update has been uploaded. 989 /// Called when new asset data for an agent inventory item update has been uploaded.
930 /// </summary> 990 /// </summary>
@@ -1243,5 +1303,50 @@ namespace OpenSim.Framework.Capabilities
1243 fs.Close(); 1303 fs.Close();
1244 } 1304 }
1245 } 1305 }
1306
1307 public class BakedTextureUploader
1308 {
1309 public event UploadedBakedTexture OnUpLoad;
1310 private UploadedBakedTexture handlerUpLoad = null;
1311
1312 private string uploaderPath = String.Empty;
1313 private UUID newAssetID;
1314 private IHttpServer httpListener;
1315
1316 public BakedTextureUploader(string path, IHttpServer httpServer)
1317 {
1318 newAssetID = UUID.Random();
1319 uploaderPath = path;
1320 httpListener = httpServer;
1321 }
1322
1323 /// <summary>
1324 ///
1325 /// </summary>
1326 /// <param name="data"></param>
1327 /// <param name="path"></param>
1328 /// <param name="param"></param>
1329 /// <returns></returns>
1330 public string uploaderCaps(byte[] data, string path, string param)
1331 {
1332 string res = String.Empty;
1333 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
1334 uploadComplete.new_asset = newAssetID.ToString();
1335 uploadComplete.new_inventory_item = UUID.Zero;
1336 uploadComplete.state = "complete";
1337
1338 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
1339
1340 httpListener.RemoveStreamHandler("POST", uploaderPath);
1341
1342 handlerUpLoad = OnUpLoad;
1343 if (handlerUpLoad != null)
1344 {
1345 handlerUpLoad(newAssetID, data);
1346 }
1347
1348 return res;
1349 }
1350 }
1246 } 1351 }
1247} 1352}
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 060e886..f263e67 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -90,6 +90,78 @@ namespace OpenSim.Framework
90 private Vector3 _userLookAt = new Vector3(); 90 private Vector3 _userLookAt = new Vector3();
91 private int _dwell = 0; 91 private int _dwell = 0;
92 private int _otherCleanTime = 0; 92 private int _otherCleanTime = 0;
93 private string _mediaType = "none/none";
94 private string _mediaDescription = "";
95 private int _mediaHeight = 0;
96 private int _mediaWidth = 0;
97 private bool _mediaLoop = false;
98 private bool _obscureMusic = false;
99 private bool _obscureMedia = false;
100
101 /// <summary>
102 /// Whether to obscure parcel media URL
103 /// </summary>
104 [XmlIgnore]
105 public bool ObscureMedia {
106 get {
107 return _obscureMedia;
108 }
109 set {
110 _obscureMedia = value;
111 }
112 }
113
114 /// <summary>
115 /// Whether to obscure parcel music URL
116 /// </summary>
117 [XmlIgnore]
118 public bool ObscureMusic {
119 get {
120 return _obscureMusic;
121 }
122 set {
123 _obscureMusic = value;
124 }
125 }
126
127 /// <summary>
128 /// Whether to loop parcel media
129 /// </summary>
130 [XmlIgnore]
131 public bool MediaLoop {
132 get {
133 return _mediaLoop;
134 }
135 set {
136 _mediaLoop = value;
137 }
138 }
139
140 /// <summary>
141 /// Height of parcel media render
142 /// </summary>
143 [XmlIgnore]
144 public int MediaHeight {
145 get {
146 return _mediaHeight;
147 }
148 set {
149 _mediaHeight = value;
150 }
151 }
152
153 /// <summary>
154 /// Width of parcel media render
155 /// </summary>
156 [XmlIgnore]
157 public int MediaWidth {
158 get {
159 return _mediaWidth;
160 }
161 set {
162 _mediaWidth = value;
163 }
164 }
93 165
94 /// <summary> 166 /// <summary>
95 /// Upper corner of the AABB for the parcel 167 /// Upper corner of the AABB for the parcel
@@ -358,20 +430,6 @@ namespace OpenSim.Framework
358 } 430 }
359 } 431 }
360 432
361 private int[] _mediaSize = new int[2];
362 public int[] MediaSize
363 {
364 get
365 {
366 return _mediaSize;
367 }
368 set
369 {
370 _mediaSize = value;
371 }
372 }
373
374 private string _mediaType = "";
375 public string MediaType 433 public string MediaType
376 { 434 {
377 get 435 get
@@ -586,6 +644,17 @@ namespace OpenSim.Framework
586 } 644 }
587 } 645 }
588 646
647 /// <summary>
648 /// parcel media description
649 /// </summary>
650 public string MediaDescription {
651 get {
652 return _mediaDescription;
653 }
654 set {
655 _mediaDescription = value;
656 }
657 }
589 658
590 public LandData() 659 public LandData()
591 { 660 {
@@ -635,6 +704,13 @@ namespace OpenSim.Framework
635 landData._userLookAt = _userLookAt; 704 landData._userLookAt = _userLookAt;
636 landData._otherCleanTime = _otherCleanTime; 705 landData._otherCleanTime = _otherCleanTime;
637 landData._dwell = _dwell; 706 landData._dwell = _dwell;
707 landData._mediaType = _mediaType;
708 landData._mediaDescription = _mediaDescription;
709 landData._mediaWidth = _mediaWidth;
710 landData._mediaHeight = _mediaHeight;
711 landData._mediaLoop = _mediaLoop;
712 landData._obscureMusic = _obscureMusic;
713 landData._obscureMedia = _obscureMedia;
638 714
639 landData._parcelAccessList.Clear(); 715 landData._parcelAccessList.Clear();
640 foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) 716 foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs
index 9760a1d..ed496a1 100644
--- a/OpenSim/Framework/LandUpdateArgs.cs
+++ b/OpenSim/Framework/LandUpdateArgs.cs
@@ -49,5 +49,12 @@ namespace OpenSim.Framework
49 public UUID SnapshotID; 49 public UUID SnapshotID;
50 public Vector3 UserLocation; 50 public Vector3 UserLocation;
51 public Vector3 UserLookAt; 51 public Vector3 UserLookAt;
52 public string MediaType;
53 public string MediaDescription;
54 public int MediaHeight;
55 public int MediaWidth;
56 public bool MediaLoop;
57 public bool ObscureMusic;
58 public bool ObscureMedia;
52 } 59 }
53} 60}
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 016ab73..95c3e6c 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -338,19 +338,25 @@ namespace OpenSim.Framework.Servers.HttpServer
338 // HandleRequest(request,resp); 338 // HandleRequest(request,resp);
339 // } 339 // }
340 340
341 /// <summary>
342 /// This methods is the start of incoming HTTP request handling.
343 /// </summary>
344 /// <param name="request"></param>
345 /// <param name="response"></param>
341 public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) 346 public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
342 { 347 {
343 try 348 try
344 { 349 {
350// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
351
345 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 352 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
353
346 // This is the REST agent interface. We require an agent to properly identify 354 // This is the REST agent interface. We require an agent to properly identify
347 // itself. If the REST handler recognizes the prefix it will attempt to 355 // itself. If the REST handler recognizes the prefix it will attempt to
348 // satisfy the request. If it is not recognizable, and no damage has occurred 356 // satisfy the request. If it is not recognizable, and no damage has occurred
349 // the request can be passed through to the other handlers. This is a low 357 // the request can be passed through to the other handlers. This is a low
350 // probability event; if a request is matched it is normally expected to be 358 // probability event; if a request is matched it is normally expected to be
351 // handled 359 // handled
352// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
353
354 IHttpAgentHandler agentHandler; 360 IHttpAgentHandler agentHandler;
355 361
356 if (TryGetAgentHandler(request, response, out agentHandler)) 362 if (TryGetAgentHandler(request, response, out agentHandler))