Disabled the CheckSum Server as it seems that isn't used by viewer 1.18.

Started to add support for asset uploads over CAPS (the asset is uploaded but seems to come out corrupt). 
Started to cleanup/rewrite the AssetCache.
Fixed bug in MapBlock requests, where data for some regions wasn't being sent.
Renamed PrimData's Texture  to TextureEntry.   
most likely a few other small changes.
Sugilite
MW 2007-06-24 15:24:02 +00:00
parent 303ea70efa
commit 38a800400a
19 changed files with 459 additions and 147 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}
*
}*/
}

View File

@ -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 );
};

View File

@ -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;

View File

@ -38,6 +38,7 @@ using OpenSim.Framework.Utilities;
namespace OpenSim.Caches
{
public delegate void DownloadComplete(AssetCache.TextureSender sender);
/// <summary>
/// Manages local cache of assets and their sending to viewers.
/// </summary>
@ -52,6 +53,7 @@ namespace OpenSim.Caches
public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>();
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();
}
/// <summary>
/// Event handler, called by a TextureSender object to say that texture has been sent
/// </summary>
/// <param name="sender"></param>
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
/// <param name="imageID"></param>
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);
}
}
}
}
}

View File

@ -122,7 +122,7 @@ namespace OpenSim.LocalCommunications
List<MapBlockData> mapBlocks = new List<MapBlockData>();
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;

View File

@ -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);
}
/// <summary>
@ -44,7 +56,7 @@ namespace OpenSim.Region
/// <returns></returns>
public string CapsRequest(string request, string path, string param)
{
//Console.WriteLine("Caps Request " + request);
Console.WriteLine("Caps Request " + request);
string result = "<llsd><map>";
result += this.GetCapabilities();
result += "</map></llsd>";
@ -57,10 +69,11 @@ namespace OpenSim.Region
/// <returns></returns>
protected string GetCapabilities()
{
string capURLS="";
string capURLS = "";
capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" +capsObjectPath+ mapLayerPath + "</string>";
capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
//capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
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 += "<map><key>Left</key><integer>" + left + "</integer><key>Bottom</key><integer>" + bottom + "</integer><key>Top</key><integer>" + top + "</integer><key>Right</key><integer>" + right + "</integer><key>ImageID</key><uuid>" + image.ToStringHyphenated() + "</uuid></map>";
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 += "<llsd><map>";
res += "<key>uploader</key><string>"+uploaderURL +"</string>";
//res += "<key>success</key><boolean>true</boolean>";
res += "<key>state</key><string>upload</string>";
res += "</map></llsd>";
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 += "<llsd><map>";
res += "<key>new_asset</key><string>" + newAssetID.ToStringHyphenated() + "</string>";
res += "<key>new_inventory_item</key><uuid>" + inv.ToStringHyphenated() + "</uuid>";
res += "<key>state</key><string>complete</string>";
res += "</map></llsd>";
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;
}
}
}
}

View File

@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region</RootNamespace>
<StartupObject></StartupObject>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
@ -55,26 +61,28 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Axiom.MathLib.dll" >
<Reference Include="Axiom.MathLib.dll">
<HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Db4objects.Db4o.dll" >
<Reference Include="Db4objects.Db4o.dll">
<HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll" >
<Reference Include="libsecondlife.dll">
<HintPath>..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" >
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml" >
<Reference Include="System.Data" />
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
@ -84,55 +92,55 @@
<Name>OpenGrid.Framework.Communications</Name>
<Project>{683344D5-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
<Name>OpenSim.Caches</Name>
<Project>{1938EB12-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
<Name>OpenSim.GenericConfig.Xml</Name>
<Project>{E88EF749-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Name>OpenSim.Physics.Manager</Name>
<Project>{8BE16150-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
<Name>OpenSim.Servers</Name>
<Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
<Name>OpenSim.Terrain.BasicTerrain</Name>
<Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
<Name>XMLRPC</Name>
<Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@ -145,6 +153,7 @@
<Compile Include="ParcelManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RegionManager.cs" />
<Compile Include="Scenes\Entity.cs">
<SubType>Code</SubType>
</Compile>
@ -204,4 +213,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>

View File

@ -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<Caps> capsHandlers = new List<Caps>();
protected BaseHttpServer httpListener;
protected Scenes.Scene m_Scene;
public ParcelManager parcelManager;
public EstateManager estateManager;
public RegionManager()
{
}
}
}

View File

@ -273,7 +273,7 @@ namespace OpenSim.Region.Scenes
/// <param name="tex"></param>
public void UpdateTexture(byte[] tex)
{
this.primData.Texture = tex;
this.primData.TextureEntry = tex;
}
/// <summary>
@ -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"));
}
/// <summary>

View File

@ -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<MapBlockData> 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
/// <param name="regionhandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
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

View File

@ -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
/// <param name="remoteAvatar"></param>
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);
}
/// <summary>
@ -332,7 +333,7 @@ namespace OpenSim.Region.Scenes
/// </summary>
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;

View File

@ -491,7 +491,7 @@ namespace OpenSim
/// <param name="avatarID"></param>
/// <param name="avatarLocalID"></param>
/// <param name="Pos"></param>
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
///
/// </summary>
/// <returns></returns>
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;

View File

@ -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();
}
}
}
}
}
}
}

View File

@ -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();
}

View File

@ -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() + "\",";

View File

@ -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;
}