diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
index ea38f06f80..9028d8d291 100644
--- a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
+++ b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Framework.Interfaces
void SendTeleportCancel();
void SendTeleportLocationStart();
- void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos);
+ void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity);
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
diff --git a/Common/OpenSim.Framework/Types/PrimData.cs b/Common/OpenSim.Framework/Types/PrimData.cs
index 56d41b38e9..f84ae3eb52 100644
--- a/Common/OpenSim.Framework/Types/PrimData.cs
+++ b/Common/OpenSim.Framework/Types/PrimData.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Framework.Types
public sbyte PathTaperY;
public sbyte PathTwist;
public sbyte PathTwistBegin;
- public byte[] Texture;
+ public byte[] TextureEntry; // a LL textureEntry in byte[] format
public Int32 CreationDate;
public uint OwnerMask = FULL_MASK_PERMISSIONS;
@@ -105,8 +105,8 @@ namespace OpenSim.Framework.Types
this.PathTwist = (sbyte)data[i++];
this.PathTwistBegin = (sbyte)data[i++];
ushort length = (ushort)(data[i++] + (data[i++] << 8));
- this.Texture = new byte[length];
- Array.Copy(data, i, Texture, 0, length); i += length;
+ this.TextureEntry = new byte[length];
+ Array.Copy(data, i, TextureEntry, 0, length); i += length;
this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
@@ -123,7 +123,7 @@ namespace OpenSim.Framework.Types
public byte[] ToBytes()
{
int i = 0;
- byte[] bytes = new byte[126 + Texture.Length];
+ byte[] bytes = new byte[126 + TextureEntry.Length];
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = this.PCode;
bytes[i++] = (byte)(this.PathBegin % 256);
@@ -154,9 +154,9 @@ namespace OpenSim.Framework.Types
bytes[i++] = ((byte)this.PathTaperY);
bytes[i++] = ((byte)this.PathTwist);
bytes[i++] = ((byte)this.PathTwistBegin);
- bytes[i++] = (byte)(Texture.Length % 256);
- bytes[i++] = (byte)((Texture.Length >> 8) % 256);
- Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length;
+ bytes[i++] = (byte)(TextureEntry.Length % 256);
+ bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
+ Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
bytes[i++] = (byte)(this.CreationDate % 256);
bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
diff --git a/Common/OpenSim.Servers/BaseHttpServer.cs b/Common/OpenSim.Servers/BaseHttpServer.cs
index 10716922c8..55826f61ae 100644
--- a/Common/OpenSim.Servers/BaseHttpServer.cs
+++ b/Common/OpenSim.Servers/BaseHttpServer.cs
@@ -88,6 +88,17 @@ namespace OpenSim.Servers
return false;
}
+ public bool RemoveRestHandler(string method, string path)
+ {
+ string methodKey = String.Format("{0}: {1}", method, path);
+ if (this.m_restHandlers.ContainsKey(methodKey))
+ {
+ this.m_restHandlers.Remove(methodKey);
+ return true;
+ }
+ return false;
+ }
+
public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
{
if (!this.m_rpcHandlers.ContainsKey(method))
@@ -213,7 +224,7 @@ namespace OpenSim.Servers
//Console.WriteLine(requestBody);
string responseString = "";
- //Console.WriteLine("new request " + request.ContentType);
+ Console.WriteLine("new request " + request.ContentType +" at "+ request.RawUrl);
switch (request.ContentType)
{
case "text/xml":
@@ -232,6 +243,13 @@ namespace OpenSim.Servers
response.AddHeader("Content-type", "application/xml");
break;
+ case "application/octet-stream":
+ // probably LLSD we hope, otherwise it should be ignored by the parser
+ // responseString = ParseLLSDXML(requestBody);
+ responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
+ response.AddHeader("Content-type", "application/xml");
+ break;
+
case "application/x-www-form-urlencoded":
// a form data POST so send to the REST parser
responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
diff --git a/Common/OpenSim.Servers/CheckSumServer.cs b/Common/OpenSim.Servers/CheckSumServer.cs
index 14ac11b49b..a3592055d0 100644
--- a/Common/OpenSim.Servers/CheckSumServer.cs
+++ b/Common/OpenSim.Servers/CheckSumServer.cs
@@ -42,7 +42,7 @@ using OpenSim.Framework.Console;
namespace OpenSim.Servers
{
- public class CheckSumServer : UDPServerBase
+/* public class CheckSumServer : UDPServerBase
{
//protected ConsoleBase m_log;
@@ -79,7 +79,7 @@ namespace OpenSim.Servers
SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket();
checkrequest.TokenBlock.Token = checksum.TokenBlock.Token;
this.SendPacket(checkrequest, epSender);
- */
+
}
else if (packet.Type == PacketType.TemplateChecksumReply)
{
@@ -136,5 +136,6 @@ namespace OpenSim.Servers
{
this.Server.SendTo(buffer, size, flags, endp);
}
- }
+ *
+ }*/
}
\ No newline at end of file
diff --git a/OpenSim/Examples/SimpleApp/MyWorld.cs b/OpenSim/Examples/SimpleApp/MyWorld.cs
index 477d29d8be..01e0c59356 100644
--- a/OpenSim/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Examples/SimpleApp/MyWorld.cs
@@ -69,7 +69,7 @@ namespace SimpleApp
{
client.SendAvatarData(m_regionInfo.RegionHandle, client.FirstName,
client.LastName, client.AgentId, 0,
- pos);
+ pos, null);
client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
};
diff --git a/OpenSim/Examples/SimpleApp/Program.cs b/OpenSim/Examples/SimpleApp/Program.cs
index ffcaa52836..b56e77ecca 100644
--- a/OpenSim/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Examples/SimpleApp/Program.cs
@@ -27,8 +27,8 @@ namespace SimpleApp
m_log = new LogBase(null, "SimpleApp", this, false);
MainLog.Instance = m_log;
- CheckSumServer checksumServer = new CheckSumServer(12036);
- checksumServer.ServerListener();
+ // CheckSumServer checksumServer = new CheckSumServer(12036);
+ // checksumServer.ServerListener();
string simAddr = "127.0.0.1";
int simPort = 9000;
diff --git a/OpenSim/OpenSim.Caches/AssetCache.cs b/OpenSim/OpenSim.Caches/AssetCache.cs
index eae0f801f1..44d22a963b 100644
--- a/OpenSim/OpenSim.Caches/AssetCache.cs
+++ b/OpenSim/OpenSim.Caches/AssetCache.cs
@@ -38,6 +38,7 @@ using OpenSim.Framework.Utilities;
namespace OpenSim.Caches
{
+ public delegate void DownloadComplete(AssetCache.TextureSender sender);
///
/// Manages local cache of assets and their sending to viewers.
///
@@ -52,6 +53,7 @@ namespace OpenSim.Caches
public Dictionary RequestedAssets = new Dictionary(); //Assets requested from the asset server
public Dictionary RequestedTextures = new Dictionary(); //Textures requested from the asset server
+ public Dictionary SendingTextures = new Dictionary();
private IAssetServer _assetServer;
private Thread _assetCacheThread;
private LLUUID[] textureList = new LLUUID[5];
@@ -155,8 +157,10 @@ namespace OpenSim.Caches
public void AddAsset(AssetBase asset)
{
+ // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
if (asset.Type == 0)
{
+ //Console.WriteLine("which is a texture");
if (!this.Textures.ContainsKey(asset.FullID))
{ //texture
TextureImage textur = new TextureImage(asset);
@@ -186,94 +190,42 @@ namespace OpenSim.Caches
return;
}
int num;
+ num = this.TextureRequests.Count;
- if (this.TextureRequests.Count < 5)
- {
- //lower than 5 so do all of them
- num = this.TextureRequests.Count;
- }
- else
- {
- num = 5;
- }
AssetRequest req;
for (int i = 0; i < num; i++)
{
req = (AssetRequest)this.TextureRequests[i];
- if (req.PacketCounter != req.NumPackets)
+ if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID))
{
- // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
- if (req.PacketCounter == 0)
+ TextureSender sender = new TextureSender(req);
+ sender.OnComplete += this.TextureSent;
+ lock (this.SendingTextures)
{
- //first time for this request so send imagedata packet
- if (req.NumPackets == 1)
- {
- //only one packet so send whole file
- ImageDataPacket im = new ImageDataPacket();
- im.ImageID.Packets = 1;
- im.ImageID.ID = req.ImageInfo.FullID;
- im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
- im.ImageData.Data = req.ImageInfo.Data;
- im.ImageID.Codec = 2;
- req.RequestUser.OutPacket(im);
- req.PacketCounter++;
- //req.ImageInfo.l= time;
- //System.Console.WriteLine("sent texture: "+req.image_info.FullID);
- }
- else
- {
- //more than one packet so split file up
- ImageDataPacket im = new ImageDataPacket();
- im.ImageID.Packets = (ushort)req.NumPackets;
- im.ImageID.ID = req.ImageInfo.FullID;
- im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
- im.ImageData.Data = new byte[600];
- Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
- im.ImageID.Codec = 2;
- req.RequestUser.OutPacket(im);
- req.PacketCounter++;
- //req.ImageInfo.last_used = time;
- //System.Console.WriteLine("sent first packet of texture:
- }
- }
- else
- {
- //send imagepacket
- //more than one packet so split file up
- ImagePacketPacket im = new ImagePacketPacket();
- im.ImageID.Packet = (ushort)req.PacketCounter;
- im.ImageID.ID = req.ImageInfo.FullID;
- int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
- if (size > 1000) size = 1000;
- im.ImageData.Data = new byte[size];
- Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
- req.RequestUser.OutPacket(im);
- req.PacketCounter++;
- //req.ImageInfo.last_used = time;
- //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
- }
- }
- }
-
- //remove requests that have been completed
- int count = 0;
- for (int i = 0; i < num; i++)
- {
- if (this.TextureRequests.Count > count)
- {
- req = (AssetRequest)this.TextureRequests[count];
- if (req.PacketCounter == req.NumPackets)
- {
- this.TextureRequests.Remove(req);
- }
- else
- {
- count++;
+ this.SendingTextures.Add(req.ImageInfo.FullID, sender);
}
}
+
}
+ this.TextureRequests.Clear();
}
+
+ ///
+ /// Event handler, called by a TextureSender object to say that texture has been sent
+ ///
+ ///
+ public void TextureSent(AssetCache.TextureSender sender)
+ {
+ if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID))
+ {
+ lock (this.SendingTextures)
+ {
+ this.SendingTextures.Remove(sender.request.ImageInfo.FullID);
+ }
+ }
+ }
+
public void AssetReceived(AssetBase asset, bool IsTexture)
{
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
@@ -343,6 +295,7 @@ namespace OpenSim.Caches
{
LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
//check to see if asset is in local cache, if not we need to request it from asset server.
+
if (!this.Assets.ContainsKey(requestID))
{
//not found asset
@@ -481,6 +434,7 @@ namespace OpenSim.Caches
///
public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID)
{
+ //Console.WriteLine("texture request for " + imageID.ToStringHyphenated());
//check to see if texture is in local cache, if not request from asset server
if (!this.Textures.ContainsKey(imageID))
{
@@ -497,6 +451,7 @@ namespace OpenSim.Caches
return;
}
+ //Console.WriteLine("texture already in cache");
TextureImage imag = this.Textures[imageID];
AssetRequest req = new AssetRequest();
req.RequestUser = userInfo;
@@ -611,6 +566,98 @@ namespace OpenSim.Caches
Description = aBase.Description;
}
}
+
+ public class TextureSender
+ {
+ public AssetRequest request;
+ public event DownloadComplete OnComplete;
+
+ public TextureSender(AssetRequest req)
+ {
+ request = req;
+ //Console.WriteLine("creating worker thread for texture " + req.ImageInfo.FullID.ToStringHyphenated());
+ //Console.WriteLine("texture data length is " + req.ImageInfo.Data.Length);
+ // Console.WriteLine("in " + req.NumPackets + " packets");
+ ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object());
+ }
+
+ public void SendTexture(Object obj)
+ {
+ //Console.WriteLine("starting to send sending texture " + request.ImageInfo.FullID.ToStringHyphenated());
+ while (request.PacketCounter != request.NumPackets)
+ {
+ SendPacket();
+ Thread.Sleep(500);
+ }
+
+ //Console.WriteLine("finished sending texture " + request.ImageInfo.FullID.ToStringHyphenated());
+ if (OnComplete != null)
+ {
+ OnComplete(this);
+ }
+ }
+
+ public void SendPacket()
+ {
+ AssetRequest req = request;
+ // Console.WriteLine("sending " + req.ImageInfo.FullID);
+
+ // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
+ if (req.PacketCounter == 0)
+ {
+ //first time for this request so send imagedata packet
+ if (req.NumPackets == 1)
+ {
+ //only one packet so send whole file
+ ImageDataPacket im = new ImageDataPacket();
+ im.ImageID.Packets = 1;
+ im.ImageID.ID = req.ImageInfo.FullID;
+ im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
+ im.ImageData.Data = req.ImageInfo.Data;
+ im.ImageID.Codec = 2;
+ req.RequestUser.OutPacket(im);
+ req.PacketCounter++;
+ //req.ImageInfo.l= time;
+ //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID);
+ // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
+ }
+ else
+ {
+ //more than one packet so split file up
+ ImageDataPacket im = new ImageDataPacket();
+ im.ImageID.Packets = (ushort)req.NumPackets;
+ im.ImageID.ID = req.ImageInfo.FullID;
+ im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
+ im.ImageData.Data = new byte[600];
+ Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
+ im.ImageID.Codec = 2;
+ req.RequestUser.OutPacket(im);
+ req.PacketCounter++;
+ //req.ImageInfo.last_used = time;
+ //System.Console.WriteLine("sent first packet of texture:
+ // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
+ }
+ }
+ else
+ {
+ //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated());
+ //send imagepacket
+ //more than one packet so split file up
+ ImagePacketPacket im = new ImagePacketPacket();
+ im.ImageID.Packet = (ushort)req.PacketCounter;
+ im.ImageID.ID = req.ImageInfo.FullID;
+ int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
+ if (size > 1000) size = 1000;
+ im.ImageData.Data = new byte[size];
+ Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
+ req.RequestUser.OutPacket(im);
+ req.PacketCounter++;
+ //req.ImageInfo.last_used = time;
+ //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
+ }
+
+ }
+ }
}
}
diff --git a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs
index ebf0fd14ab..4ca088b31e 100644
--- a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs
+++ b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs
@@ -122,7 +122,7 @@ namespace OpenSim.LocalCommunications
List mapBlocks = new List();
foreach(RegionInfo regInfo in this.regions.Values)
{
- if (((regInfo.RegionLocX > minX) && (regInfo.RegionLocX < maxX)) && ((regInfo.RegionLocY > minY) && (regInfo.RegionLocY < maxY)))
+ if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
{
MapBlockData map = new MapBlockData();
map.Name = regInfo.RegionName;
diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs
index c86061f929..5be481e218 100644
--- a/OpenSim/OpenSim.Region/Caps.cs
+++ b/OpenSim/OpenSim.Region/Caps.cs
@@ -1,23 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.IO;
using OpenSim.Servers;
+using OpenSim.Framework.Utilities;
+using OpenSim.Framework.Types;
+using OpenSim.Caches;
using libsecondlife;
namespace OpenSim.Region
{
+ public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data);
+
public class Caps
{
+
private string httpListenerAddress;
private uint httpListenPort;
private string capsObjectPath = "00001-";
private string requestPath = "0000/";
private string mapLayerPath = "0001/";
+ private string newInventory = "0002/";
+ private string requestTexture = "0003/";
private BaseHttpServer httpListener;
private LLUUID agentID;
+ private AssetCache assetCache;
- public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent)
+ public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent)
{
+ assetCache = assetCach;
capsObjectPath = capsPath;
httpListener = httpServer;
httpListenerAddress = httpListen;
@@ -31,8 +42,9 @@ namespace OpenSim.Region
public void RegisterHandlers()
{
Console.WriteLine("registering CAPS handlers");
- httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ requestPath, CapsRequest);
- httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ mapLayerPath, MapLayer);
+ httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest);
+ httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer);
+ httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory);
}
///
@@ -44,7 +56,7 @@ namespace OpenSim.Region
///
public string CapsRequest(string request, string path, string param)
{
- //Console.WriteLine("Caps Request " + request);
+ Console.WriteLine("Caps Request " + request);
string result = "";
@@ -57,10 +69,11 @@ namespace OpenSim.Region
///
protected string GetCapabilities()
{
- string capURLS="";
+ string capURLS = "";
- capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" +capsObjectPath+ mapLayerPath + "";
-
+ capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "";
+ capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "";
+ //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "";
return capURLS;
}
@@ -93,15 +106,94 @@ namespace OpenSim.Region
int bottom;
LLUUID image = null;
- left = 500;
- bottom = 500;
- top = 1500;
- right = 1500;
+ left = 0;
+ bottom = 0;
+ top = 5000;
+ right = 5000;
image = new LLUUID("00000000-0000-0000-9999-000000000006");
res += "";
-
+
return res;
}
+
+ public string NewAgentInventory(string request, string path, string param)
+ {
+
+ //Console.WriteLine("received upload request:"+ request);
+ string res = "";
+ LLUUID newAsset = LLUUID.Random();
+ string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 7000).ToString("0000");
+ AssetUploader uploader = new AssetUploader(newAsset, 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 += "";
+ uploader.OnUpLoad += this.UploadHandler;
+ return res;
+ }
+
+ public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data)
+ {
+ // Console.WriteLine("upload handler called");
+ AssetBase asset;
+ asset = new AssetBase();
+ asset.FullID = assetID;
+ asset.Type = 0;
+ asset.InvType = 0;
+ asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
+ asset.Data = data;
+ this.assetCache.AddAsset(asset);
+
+ }
+
+ public class AssetUploader
+ {
+ public event UpLoadedTexture OnUpLoad;
+
+ private string uploaderPath = "";
+ private LLUUID newAssetID;
+ //private LLUUID inventoryItemID;
+ private BaseHttpServer httpListener;
+ public AssetUploader(LLUUID assetID, string path,BaseHttpServer httpServer)
+ {
+ newAssetID = assetID;
+ uploaderPath = path;
+ httpListener = httpServer;
+
+ }
+
+ public string uploaderCaps(string request, string path, string param)
+ {
+ Encoding _enc = System.Text.Encoding.UTF8;
+ byte[] data = _enc.GetBytes(request);
+ //Console.WriteLine("recieved upload " + Util.FieldToString(data));
+ LLUUID inv = LLUUID.Random();
+ string res = "";
+ res += "";
+
+ Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated());
+ 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);
+ bw.Close();
+ fs.Close();*/
+ return res;
+ }
+ }
}
}
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
index d18bf3fcd6..fd583a938c 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
@@ -1,4 +1,4 @@
-
+
Local
8.0.50727
@@ -6,7 +6,8 @@
{196916AF-0000-0000-0000-000000000000}
Debug
AnyCPU
-
+
+
OpenSim.Region
@@ -15,9 +16,11 @@
IE50
false
Library
-
+
+
OpenSim.Region
-
+
+
@@ -28,7 +31,8 @@
TRACE;DEBUG
-
+
+
True
4096
False
@@ -37,7 +41,8 @@
False
False
4
-
+
+
False
@@ -46,7 +51,8 @@
TRACE
-
+
+
False
4096
True
@@ -55,26 +61,28 @@
False
False
4
-
+
+
-
+
..\..\bin\Axiom.MathLib.dll
False
-
+
..\..\bin\Db4objects.Db4o.dll
False
-
+
..\..\bin\libsecondlife.dll
False
-
+
System.dll
False
-
+
+
System.Xml.dll
False
@@ -84,55 +92,55 @@
OpenGrid.Framework.Communications
{683344D5-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.Caches
{1938EB12-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.Framework
{8ACA2445-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.Framework.Console
{A7CD0630-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.GenericConfig.Xml
{E88EF749-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.Physics.Manager
{8BE16150-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.Servers
{8BB20F0A-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
OpenSim.Terrain.BasicTerrain
{2270B8FE-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
XMLRPC
{8E81D43C-0000-0000-0000-000000000000}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- False
+ False
@@ -145,6 +153,7 @@
Code
+
Code
@@ -204,4 +213,4 @@
-
+
\ No newline at end of file
diff --git a/OpenSim/OpenSim.Region/RegionManager.cs b/OpenSim/OpenSim.Region/RegionManager.cs
new file mode 100644
index 0000000000..a317f0f2c2
--- /dev/null
+++ b/OpenSim/OpenSim.Region/RegionManager.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenGrid.Framework.Communications;
+using OpenSim.Framework;
+using OpenSim.Framework.Types;
+using OpenSim.Servers;
+
+namespace OpenSim.Region
+{
+ public class RegionManager //needs renaming , but first we need to rename the namespace
+ {
+ protected AuthenticateSessionsBase authenticateHandler;
+ protected RegionCommsListener regionCommsHost;
+ protected CommunicationsManager commsManager;
+ protected List capsHandlers = new List();
+ protected BaseHttpServer httpListener;
+
+ protected Scenes.Scene m_Scene;
+
+ public ParcelManager parcelManager;
+ public EstateManager estateManager;
+
+ public RegionManager()
+ {
+
+ }
+
+ }
+}
diff --git a/OpenSim/OpenSim.Region/Scenes/Primitive.cs b/OpenSim/OpenSim.Region/Scenes/Primitive.cs
index 8192bf018a..62f401cb4a 100644
--- a/OpenSim/OpenSim.Region/Scenes/Primitive.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Primitive.cs
@@ -273,7 +273,7 @@ namespace OpenSim.Region.Scenes
///
public void UpdateTexture(byte[] tex)
{
- this.primData.Texture = tex;
+ this.primData.TextureEntry = tex;
}
///
@@ -411,7 +411,7 @@ namespace OpenSim.Region.Scenes
lPos = this.Pos;
}
- remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-1000-5005-000000000018"));
+ remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"));
}
///
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index 07f1d70669..07b1ee48f3 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -730,7 +730,7 @@ namespace OpenSim.Region.Scenes
if (agent.CapsPath != "")
{
//Console.WriteLine("new user, so creating caps handler for it");
- Caps cap = new Caps(httpListener, this.m_regInfo.IPListenAddr, 9000, agent.CapsPath, agent.AgentID);
+ Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.IPListenAddr, 9000, agent.CapsPath, agent.AgentID);
cap.RegisterHandlers();
this.capsHandlers.Add(cap);
}
@@ -795,7 +795,7 @@ namespace OpenSim.Region.Scenes
{
List mapBlocks;
mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
-
+ Console.WriteLine("number of mapblocks " + mapBlocks.Count +" in "+ minX +" , " + minY + " , "+ maxX + " , "+ maxY);
remoteClient.SendMapBlock(mapBlocks);
}
@@ -843,9 +843,9 @@ namespace OpenSim.Region.Scenes
///
///
///
- public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
+ public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
{
- this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
+ return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
}
#endregion
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
index 1255606415..fe82130a00 100644
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Region.Scenes
{
public static bool PhysicsEngineFlying = false;
public static AvatarAnimations Animations;
+ public static byte[] DefaultTexture;
public string firstname;
public string lastname;
public IClientAPI ControllingClient;
@@ -324,7 +325,7 @@ namespace OpenSim.Region.Scenes
///
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{
- remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
+ remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture);
}
///
@@ -332,7 +333,7 @@ namespace OpenSim.Region.Scenes
///
public void SendInitialData()
{
- this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
+ this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture);
if (this.newAvatar)
{
this.m_world.InformClientOfNeighbours(this.ControllingClient);
@@ -439,10 +440,12 @@ namespace OpenSim.Region.Scenes
RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null)
{
- this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
- this.MakeChildAgent();
- this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
-
+ bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
+ if (res)
+ {
+ this.MakeChildAgent();
+ this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
+ }
}
}
#endregion
@@ -481,6 +484,18 @@ namespace OpenSim.Region.Scenes
}
}
+ public static void LoadTextureFile(string name)
+ {
+ FileInfo fInfo = new FileInfo(name);
+ long numBytes = fInfo.Length;
+ FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
+ BinaryReader br = new BinaryReader(fStream);
+ byte[] data1 = br.ReadBytes((int)numBytes);
+ br.Close();
+ fStream.Close();
+ DefaultTexture = data1;
+ }
+
public class NewForce
{
public float X;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 1a032163b2..ca473e314e 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -491,7 +491,7 @@ namespace OpenSim
///
///
///
- public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos)
+ public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry)
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
//send a objectupdate packet with information about the clients avatar
@@ -500,7 +500,7 @@ namespace OpenSim
objupdate.RegionData.RegionHandle = regionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
- objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket();
+ objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry);
//give this avatar object a local id and assign the user a name
objupdate.ObjectData[0].ID = avatarLocalID;
@@ -859,7 +859,7 @@ namespace OpenSim
///
///
///
- protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket()
+ protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry)
{
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
@@ -873,6 +873,10 @@ namespace OpenSim
objdata.OwnerID = LLUUID.Zero;
objdata.Scale = new LLVector3(1, 1, 1);
objdata.PCode = 47;
+ if (textureEntry != null)
+ {
+ objdata.TextureEntry = textureEntry;
+ }
System.Text.Encoding enc = System.Text.Encoding.ASCII;
libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
pos.X = 100f;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs b/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
index 31749d8ab3..1b01f24edb 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Text;
using OpenSim.Assets;
using OpenSim.Framework.Types;
+using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Caches;
using libsecondlife;
@@ -258,6 +259,99 @@ namespace OpenSim
}
}
+
+ //new class , not currently used.
+ public class AssetXferUploader
+ {
+ private IClientAPI ourClient;
+
+ public bool UploadComplete = false;
+
+ public bool AddToInventory;
+ public LLUUID InventFolder = LLUUID.Zero;
+
+ public uint XferID;
+ public AssetBase Asset;
+ public LLUUID TransactionID = LLUUID.Zero;
+
+
+ public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data)
+ {
+ ourClient = remoteClient;
+ Asset = new AssetBase();
+ Asset.FullID = assetID;
+ Asset.InvType = type;
+ Asset.Type = type;
+ Asset.Data = data;
+ Asset.Name = "blank";
+ Asset.Description = "empty";
+ TransactionID = transaction;
+
+ if (Asset.Data.Length > 2)
+ {
+ this.SendCompleteMessage();
+ }
+ else
+ {
+ this.ReqestStartXfer();
+ }
+ }
+
+ protected void SendCompleteMessage()
+ {
+ UploadComplete = true;
+ AssetUploadCompletePacket response = new AssetUploadCompletePacket();
+ response.AssetBlock.Type = Asset.Type;
+ response.AssetBlock.Success = true;
+ response.AssetBlock.UUID = Asset.FullID;
+ this.ourClient.OutPacket(response);
+
+ //TODO trigger event
+ }
+
+ protected void ReqestStartXfer()
+ {
+ UploadComplete = false;
+ XferID = Util.GetNextXferID();
+ RequestXferPacket xfer = new RequestXferPacket();
+ xfer.XferID.ID = XferID;
+ xfer.XferID.VFileType = Asset.Type;
+ xfer.XferID.VFileID = Asset.FullID;
+ xfer.XferID.FilePath = 0;
+ xfer.XferID.Filename = new byte[0];
+ this.ourClient.OutPacket(xfer);
+ }
+
+ public void HandleXferPacket(uint xferID, uint packetID, byte[] data)
+ {
+ if (XferID == xferID)
+ {
+ if (Asset.Data.Length > 1)
+ {
+ byte[] newArray = new byte[Asset.Data.Length + data.Length];
+ Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length);
+ Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length);
+ Asset.Data = newArray;
+ }
+ else
+ {
+ byte[] newArray = new byte[data.Length - 4];
+ Array.Copy(data, 4, newArray, 0, data.Length - 4);
+ Asset.Data = newArray;
+ }
+
+ ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
+ confirmXfer.XferID.ID = xferID;
+ confirmXfer.XferID.Packet = packetID;
+ this.ourClient.OutPacket(confirmXfer);
+
+ if ((packetID & 2147483648) != 0)
+ {
+ this.SendCompleteMessage();
+ }
+ }
+ }
+ }
}
}
}
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
index a6c2872446..8e6b04d66d 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
found.ProfileHollow = prim.ProfileHollow;
found.Position = prim.Position;
found.Rotation = prim.Rotation;
- found.Texture = prim.Texture;
+ found.TextureEntry = prim.TextureEntry;
db.Set(found);
db.Commit();
}
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
index fa1abc8611..8a7893e12b 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Storage.LocalStorageSQLite
sql += "\"" + prim.PathTaperY.ToString() + "\",";
sql += "\"" + prim.PathTwist.ToString() + "\",";
sql += "\"" + prim.PathTwistBegin.ToString() + "\",";
- sql += "\"" + prim.Texture.ToString() + "\",";
+ sql += "\"" + prim.TextureEntry.ToString() + "\",";
sql += "\"" + prim.CreationDate.ToString() + "\",";
sql += "\"" + prim.OwnerMask.ToString() + "\",";
sql += "\"" + prim.NextOwnerMask.ToString() + "\",";
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs
index 66cc2ba162..4e2f599a72 100644
--- a/OpenSim/OpenSim/OpenSimMain.cs
+++ b/OpenSim/OpenSim/OpenSimMain.cs
@@ -60,7 +60,7 @@ namespace OpenSim
public class OpenSimMain : RegionApplicationBase, conscmd_callback
{
- private CheckSumServer checkServer;
+ // private CheckSumServer checkServer;
protected CommunicationsManager commsManager;
private bool m_silent;
@@ -97,6 +97,8 @@ namespace OpenSim
m_log.Verbose( "Main.cs:Startup() - Loading configuration");
this.serversData.InitConfig(this.m_sandbox, this.localConfig);
this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
+
+ ScenePresence.LoadTextureFile("avatar-texture.dat");
ClientView.TerrainManager = new TerrainManager(new SecondLife());
@@ -104,8 +106,8 @@ namespace OpenSim
if (m_sandbox)
{
this.SetupLocalGridServers();
- this.checkServer = new CheckSumServer(12036);
- this.checkServer.ServerListener();
+ // this.checkServer = new CheckSumServer(12036);
+ // this.checkServer.ServerListener();
sandboxCommunications = new CommunicationsLocal(this.serversData.DefaultHomeLocX, this.serversData.DefaultHomeLocY);
this.commsManager = sandboxCommunications;
}