Prim creation added. Session authentication moved to Gridserver interface.
parent
d6bf4ede92
commit
31209cdab9
|
@ -38,7 +38,7 @@ namespace OpenSim
|
||||||
public class AgentManager
|
public class AgentManager
|
||||||
{
|
{
|
||||||
public Dictionary<libsecondlife.LLUUID,AgentProfile> AgentList;
|
public Dictionary<libsecondlife.LLUUID,AgentProfile> AgentList;
|
||||||
private uint _localNumber=0;
|
private uint _localAvatarNumber=0;
|
||||||
private Server _server;
|
private Server _server;
|
||||||
|
|
||||||
public AgentManager(Server server)
|
public AgentManager(Server server)
|
||||||
|
@ -108,8 +108,8 @@ namespace OpenSim
|
||||||
agent.Avatar.Position = new LLVector3(100, 100, 22);
|
agent.Avatar.Position = new LLVector3(100, 100, 22);
|
||||||
agent.Avatar.BaseFolder = baseFolder;
|
agent.Avatar.BaseFolder = baseFolder;
|
||||||
agent.Avatar.InventoryFolder = inventoryFolder;
|
agent.Avatar.InventoryFolder = inventoryFolder;
|
||||||
agent.Avatar.LocalID = 8880000 + this._localNumber;
|
agent.Avatar.LocalID = 8880000 + this._localAvatarNumber;
|
||||||
this._localNumber++;
|
this._localAvatarNumber++;
|
||||||
this.AgentList.Add(agent.Avatar.FullID, agent);
|
this.AgentList.Add(agent.Avatar.FullID, agent);
|
||||||
|
|
||||||
//Create new Wearable Assets and place in Inventory
|
//Create new Wearable Assets and place in Inventory
|
||||||
|
|
|
@ -46,13 +46,13 @@ namespace OpenSim
|
||||||
public List<AssetRequest> RequestedAssets = new List<AssetRequest>(); //Assets requested from the asset server
|
public List<AssetRequest> RequestedAssets = new List<AssetRequest>(); //Assets requested from the asset server
|
||||||
public List<TextureRequest> RequestedTextures = new List<TextureRequest>(); //Textures requested from the asset server
|
public List<TextureRequest> RequestedTextures = new List<TextureRequest>(); //Textures requested from the asset server
|
||||||
|
|
||||||
private AssetServer _assetServer;
|
private IAssetServer _assetServer;
|
||||||
private Server _server;
|
private Server _server;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AssetManager(Server server, AssetServer assetServer)
|
public AssetManager(Server server, IAssetServer assetServer)
|
||||||
{
|
{
|
||||||
_server = server;
|
_server = server;
|
||||||
_assetServer = assetServer;
|
_assetServer = assetServer;
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace OpenSim
|
||||||
public class PrimData : Node
|
public class PrimData : Node
|
||||||
{
|
{
|
||||||
public LLUUID OwnerID;
|
public LLUUID OwnerID;
|
||||||
|
public LLUUID FullID;
|
||||||
public uint LocalID;
|
public uint LocalID;
|
||||||
public byte PCode;
|
public byte PCode;
|
||||||
public byte PathBegin;
|
public byte PathBegin;
|
||||||
|
@ -76,11 +77,13 @@ namespace OpenSim
|
||||||
public byte ProfileCurve;
|
public byte ProfileCurve;
|
||||||
public uint ParentID=0;
|
public uint ParentID=0;
|
||||||
public byte ProfileHollow;
|
public byte ProfileHollow;
|
||||||
|
public uint AddFlags;
|
||||||
|
public libsecondlife.LLObject.TextureEntry Texture;
|
||||||
//public bool DataBaseStorage=false;
|
//public bool DataBaseStorage=false;
|
||||||
|
|
||||||
public PrimData()
|
public PrimData()
|
||||||
{
|
{
|
||||||
|
this.SceneType = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FromBytes(byte[] bytes)
|
public void FromBytes(byte[] bytes)
|
||||||
|
|
|
@ -42,7 +42,8 @@ namespace OpenSim
|
||||||
public static SceneGraph Scene;
|
public static SceneGraph Scene;
|
||||||
public static AgentManager AgentManager;
|
public static AgentManager AgentManager;
|
||||||
public static PrimManager PrimManager;
|
public static PrimManager PrimManager;
|
||||||
public static UserServer UserServer;
|
public static IUserServer UserServer;
|
||||||
|
public static IGridServer GridServer;
|
||||||
public byte ConnectionType=1;
|
public byte ConnectionType=1;
|
||||||
private bool _authorised = false;
|
private bool _authorised = false;
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ namespace OpenSim
|
||||||
|
|
||||||
//should check that this session/circuit is authorised
|
//should check that this session/circuit is authorised
|
||||||
UseCircuitCodePacket circuitPacket=(UseCircuitCodePacket)packet;
|
UseCircuitCodePacket circuitPacket=(UseCircuitCodePacket)packet;
|
||||||
AuthenticateResponse sessionInfo = UserServer.AuthenticateSession(circuitPacket.CircuitCode.SessionID, circuitPacket.CircuitCode.ID, circuitPacket.CircuitCode.Code);
|
AuthenticateResponse sessionInfo = GridServer.AuthenticateSession(circuitPacket.CircuitCode.SessionID, circuitPacket.CircuitCode.ID, circuitPacket.CircuitCode.Code);
|
||||||
if(!sessionInfo.Authorised)
|
if(!sessionInfo.Authorised)
|
||||||
{
|
{
|
||||||
//session/circuit not authorised
|
//session/circuit not authorised
|
||||||
|
@ -113,6 +114,11 @@ namespace OpenSim
|
||||||
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
|
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
|
||||||
Scene.AvatarMovementCommand(this.NetInfo, agentUpdate);
|
Scene.AvatarMovementCommand(this.NetInfo, agentUpdate);
|
||||||
break;
|
break;
|
||||||
|
case PacketType.ObjectAdd:
|
||||||
|
Console.WriteLine("received add object packet");
|
||||||
|
PrimAsset prim = PrimManager.CreateNewPrim(this.NetInfo, (ObjectAddPacket) packet);
|
||||||
|
Scene.AddNewPrim(prim.PrimData);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,21 +70,24 @@ namespace OpenSim
|
||||||
_gridManager = new GridManager(_viewerServer, _agentManager);
|
_gridManager = new GridManager(_viewerServer, _agentManager);
|
||||||
_scene = new SceneGraph(_viewerServer, _agentManager);
|
_scene = new SceneGraph(_viewerServer, _agentManager);
|
||||||
_assetManager = new AssetManager(_viewerServer, _backboneServers.AssetServer);
|
_assetManager = new AssetManager(_viewerServer, _backboneServers.AssetServer);
|
||||||
|
_primManager = new PrimManager();
|
||||||
ClientConnection.Grid = _gridManager;
|
ClientConnection.Grid = _gridManager;
|
||||||
ClientConnection.Scene = _scene;
|
ClientConnection.Scene = _scene;
|
||||||
ClientConnection.AgentManager = _agentManager;
|
ClientConnection.AgentManager = _agentManager;
|
||||||
|
ClientConnection.PrimManager = _primManager;
|
||||||
ClientConnection.UserServer = _backboneServers.UserServer;
|
ClientConnection.UserServer = _backboneServers.UserServer;
|
||||||
|
ClientConnection.GridServer = _backboneServers.GridServer;
|
||||||
_viewerServer.Startup();
|
_viewerServer.Startup();
|
||||||
BerkeleyDatabases.Instance.Startup();
|
BerkeleyDatabases.Instance.Startup();
|
||||||
_primManager = new PrimManager();
|
|
||||||
|
|
||||||
if(Globals.Instance.StartLoginServer)
|
if(Globals.Instance.StartLoginServer)
|
||||||
{
|
{
|
||||||
_loginServer = new LoginServer(_backboneServers.UserServer);
|
_loginServer = new LoginServer(_backboneServers.GridServer);
|
||||||
_loginServer.Startup();
|
_loginServer.Startup();
|
||||||
}
|
}
|
||||||
timer1.Enabled = true;
|
timer1.Enabled = true;
|
||||||
timer1.Interval = 200;
|
timer1.Interval = 125;
|
||||||
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,15 +113,15 @@ namespace OpenSim
|
||||||
|
|
||||||
public class BackboneServers
|
public class BackboneServers
|
||||||
{
|
{
|
||||||
public GridServer GridServer;
|
public IGridServer GridServer;
|
||||||
public UserServer UserServer;
|
public IUserServer UserServer;
|
||||||
public AssetServer AssetServer;
|
public IAssetServer AssetServer;
|
||||||
|
|
||||||
public BackboneServers()
|
public BackboneServers()
|
||||||
{
|
{
|
||||||
this.GridServer = new GridServer();
|
this.GridServer = (IGridServer) new GridServer();
|
||||||
this.UserServer = new UserServer();
|
this.UserServer =(IUserServer) new UserServer();
|
||||||
this.AssetServer = new AssetServer();
|
this.AssetServer =(IAssetServer) new AssetServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
|
@ -36,8 +37,43 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GridServer //:IGridServer
|
public class GridServer //:IGridServer
|
||||||
{
|
{
|
||||||
|
public List<Logon> Sessions = new List<Logon>(); //should change to something other than logon classes?
|
||||||
|
|
||||||
public GridServer()
|
public GridServer()
|
||||||
{
|
{
|
||||||
|
Sessions = new List<Logon>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
||||||
|
{
|
||||||
|
//For Grid use:
|
||||||
|
//should check to see if it is a teleportation, if so then we should be expecting this session, agent. (?)
|
||||||
|
//if not check with User server/ login server that it is authorised.
|
||||||
|
|
||||||
|
//but for now we are running local
|
||||||
|
AuthenticateResponse user = new AuthenticateResponse();
|
||||||
|
|
||||||
|
lock(this.Sessions)
|
||||||
|
{
|
||||||
|
|
||||||
|
for(int i = 0; i < Sessions.Count; i++)
|
||||||
|
{
|
||||||
|
if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID))
|
||||||
|
{
|
||||||
|
user.Authorised = true;
|
||||||
|
user.LogonInfo = Sessions[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddNewSession(Logon session)
|
||||||
|
{
|
||||||
|
lock(this.Sessions)
|
||||||
|
{
|
||||||
|
this.Sessions.Add(session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +82,8 @@ namespace OpenSim
|
||||||
bool RequestConnection(RegionInfo myRegion);
|
bool RequestConnection(RegionInfo myRegion);
|
||||||
UUIDBlock RequestUUIDBlock();
|
UUIDBlock RequestUUIDBlock();
|
||||||
RegionInfo[] RequestNeighbours();
|
RegionInfo[] RequestNeighbours();
|
||||||
|
AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
||||||
|
void AddNewSession(Logon session);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct UUIDBlock
|
public struct UUIDBlock
|
||||||
|
@ -54,5 +92,16 @@ namespace OpenSim
|
||||||
public LLUUID BlockEnd;
|
public LLUUID BlockEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AuthenticateResponse
|
||||||
|
{
|
||||||
|
public bool Authorised;
|
||||||
|
public Logon LogonInfo;
|
||||||
|
|
||||||
|
public AuthenticateResponse()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,12 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LoginServer
|
public class LoginServer
|
||||||
{
|
{
|
||||||
public LoginServer(UserServer userServer)
|
public LoginServer(IGridServer gridServer)
|
||||||
{
|
{
|
||||||
_userServer = userServer;
|
_gridServer = gridServer;
|
||||||
}
|
}
|
||||||
private Logon _login;
|
private Logon _login;
|
||||||
private UserServer _userServer;
|
private IGridServer _gridServer;
|
||||||
private ushort _loginPort = Globals.Instance.LoginServerPort;
|
private ushort _loginPort = Globals.Instance.LoginServerPort;
|
||||||
public IPAddress clientAddress = IPAddress.Loopback;
|
public IPAddress clientAddress = IPAddress.Loopback;
|
||||||
public IPAddress remoteAddress = IPAddress.Any;
|
public IPAddress remoteAddress = IPAddress.Any;
|
||||||
|
@ -246,11 +246,8 @@ namespace OpenSim
|
||||||
_login.BaseFolder = BaseFolderID;
|
_login.BaseFolder = BaseFolderID;
|
||||||
_login.InventoryFolder = InventoryFolderID;
|
_login.InventoryFolder = InventoryFolderID;
|
||||||
|
|
||||||
//working on local computer so lets add to the userserver's list of sessions
|
//working on local computer so lets add to the gridserver's list of sessions
|
||||||
lock(this._userServer.Sessions)
|
this._gridServer.AddNewSession(_login);
|
||||||
{
|
|
||||||
this._userServer.Sessions.Add(_login);
|
|
||||||
}
|
|
||||||
|
|
||||||
// forward the XML-RPC response to the client
|
// forward the XML-RPC response to the client
|
||||||
writer.WriteLine("HTTP/1.0 200 OK");
|
writer.WriteLine("HTTP/1.0 200 OK");
|
||||||
|
|
|
@ -26,7 +26,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
|
@ -36,30 +39,59 @@ namespace OpenSim
|
||||||
public class PrimManager
|
public class PrimManager
|
||||||
{
|
{
|
||||||
private LocalPrimDb _localPrimDB;
|
private LocalPrimDb _localPrimDB;
|
||||||
|
private int _localPrimNumber;
|
||||||
|
private Dictionary<libsecondlife.LLUUID,PrimAsset> PrimList;
|
||||||
|
|
||||||
public PrimManager()
|
public PrimManager()
|
||||||
{
|
{
|
||||||
this._localPrimDB = new LocalPrimDb();
|
this._localPrimDB = new LocalPrimDb();
|
||||||
|
this.PrimList = new Dictionary<libsecondlife.LLUUID,PrimAsset>();
|
||||||
|
}
|
||||||
|
|
||||||
//database test
|
/// <summary>
|
||||||
/*PrimAsset prim = new PrimAsset();
|
/// Called when a prim is created in-world
|
||||||
prim.Name="happy now";
|
/// </summary>
|
||||||
prim.Description= "test";
|
/// <param name="userInfo"></param>
|
||||||
prim.FullID = new LLUUID("00000000-0000-0000-0000-000000000008");
|
/// <param name="addPacket"></param>
|
||||||
prim.Data= new byte[10];
|
/// <returns></returns>
|
||||||
prim.Data[0]=5;
|
public PrimAsset CreateNewPrim(NetworkInfo userInfo, ObjectAddPacket addPacket)
|
||||||
prim.Data[1]=4;
|
{
|
||||||
prim.Data[2]=5;
|
PrimData PData = new PrimData();
|
||||||
prim.Data[3]=6;
|
PData.OwnerID = userInfo.User.AgentID;
|
||||||
prim.Data[4]=5;
|
PData.PCode = addPacket.ObjectData.PCode;
|
||||||
this._localPrimDB.CreateNewPrimStorage(prim);
|
PData.PathBegin = addPacket.ObjectData.PathBegin;
|
||||||
|
PData.PathEnd = addPacket.ObjectData.PathEnd;
|
||||||
|
PData.PathScaleX = addPacket.ObjectData.PathScaleX;
|
||||||
|
PData.PathScaleY = addPacket.ObjectData.PathScaleY;
|
||||||
|
PData.PathShearX = addPacket.ObjectData.PathShearX;
|
||||||
|
PData.PathShearY = addPacket.ObjectData.PathShearY;
|
||||||
|
PData.PathSkew = addPacket.ObjectData.PathSkew;
|
||||||
|
PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
|
||||||
|
PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
|
||||||
|
PData.Scale = addPacket.ObjectData.Scale;
|
||||||
|
PData.PathCurve = addPacket.ObjectData.PathCurve;
|
||||||
|
PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
|
||||||
|
PData.ParentID = 0;
|
||||||
|
PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
|
||||||
|
PData.AddFlags = addPacket.ObjectData.AddFlags;
|
||||||
|
|
||||||
PrimAsset prim1 = this._localPrimDB.GetPrimFromStroage( new LLUUID("00000000-0000-0000-0000-000000000008"));
|
//finish off copying rest of shape data
|
||||||
Console.WriteLine("prim received : "+prim1.Name + " "+ prim1.Description);
|
PData.LocalID = (uint)(702000 + _localPrimNumber);
|
||||||
Console.WriteLine("received prims data length is: "+prim1.Data.Length);
|
PData.FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefd"+_localPrimNumber.ToString("0000"));
|
||||||
Console.WriteLine(Helpers.FieldToString(prim1.Data));
|
PData.Position = addPacket.ObjectData.RayEnd;
|
||||||
//this._localPrimDB.ReadWholedatabase();
|
_localPrimNumber++;
|
||||||
*/
|
|
||||||
|
//for now give it a default texture
|
||||||
|
PData.Texture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||||
|
|
||||||
|
PrimAsset prim = new PrimAsset();
|
||||||
|
prim.FullID = PData.FullID;
|
||||||
|
prim.PrimData = PData;
|
||||||
|
this.PrimList.Add(prim.FullID, prim);
|
||||||
|
|
||||||
|
//should copy to local prim database (and at some point upload to the asset server)
|
||||||
|
|
||||||
|
return(prim);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
143
SceneGraph.cs
143
SceneGraph.cs
|
@ -48,6 +48,8 @@ namespace OpenSim
|
||||||
private Server _server;
|
private Server _server;
|
||||||
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock _avatarTemplate;
|
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock _avatarTemplate;
|
||||||
|
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock PrimTemplate;
|
||||||
|
|
||||||
private int _objectCount=0;
|
private int _objectCount=0;
|
||||||
private UpdateSender _updateSender;
|
private UpdateSender _updateSender;
|
||||||
private AgentManager _agentManager;
|
private AgentManager _agentManager;
|
||||||
|
@ -70,7 +72,8 @@ namespace OpenSim
|
||||||
_updateSender = new UpdateSender(_server, agentManager);
|
_updateSender = new UpdateSender(_server, agentManager);
|
||||||
_agentManager = agentManager;
|
_agentManager = agentManager;
|
||||||
//testing
|
//testing
|
||||||
this.SetupTemplate("objectupate168.dat");
|
this.SetupAvatarTemplate("objectupate168.dat");
|
||||||
|
this.SetupObjectTemplate("objectupate164.dat");
|
||||||
_updateSender.Startup();
|
_updateSender.Startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +148,7 @@ namespace OpenSim
|
||||||
int updatemask = avatar.UpdateFlag & (128);
|
int updatemask = avatar.UpdateFlag & (128);
|
||||||
if(updatemask == 128) //is a new avatar?
|
if(updatemask == 128) //is a new avatar?
|
||||||
{
|
{
|
||||||
Console.WriteLine("new avatar has been added to scene so update it on the current scene");
|
//Console.WriteLine("new avatar has been added to scene so update it on the current scene");
|
||||||
|
|
||||||
this.SendAvatarDataToAll(avatar);
|
this.SendAvatarDataToAll(avatar);
|
||||||
|
|
||||||
|
@ -160,6 +163,24 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check for new prims
|
||||||
|
lock(this.RootNode)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < this.RootNode.ChildrenCount; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(this.RootNode.GetChild(i).SceneType == 2) //check it is a prim node
|
||||||
|
{
|
||||||
|
PrimData prim =(PrimData) this.RootNode.GetChild(i);
|
||||||
|
if((prim.UpdateFlag & (64)) == 64)
|
||||||
|
{
|
||||||
|
//send prim data to all clients
|
||||||
|
this.SendPrimToAll(prim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//send updates to clients
|
//send updates to clients
|
||||||
//might be better to do these updates reverse to how is done here
|
//might be better to do these updates reverse to how is done here
|
||||||
// ie.. loop through the avatars and find objects /other avatars in their range/vision
|
// ie.. loop through the avatars and find objects /other avatars in their range/vision
|
||||||
|
@ -241,9 +262,8 @@ namespace OpenSim
|
||||||
newCommand.Velocity.X = direc.x;
|
newCommand.Velocity.X = direc.x;
|
||||||
newCommand.Velocity.Y = direc.y;
|
newCommand.Velocity.Y = direc.y;
|
||||||
newCommand.Velocity.Z = direc.z;
|
newCommand.Velocity.Z = direc.z;
|
||||||
//avatar.Walk = true;
|
|
||||||
|
|
||||||
//work out velocity for internal clients movement commands
|
//work out velocity for clients movement commands
|
||||||
internDirec = internDirec * (0.03f);
|
internDirec = internDirec * (0.03f);
|
||||||
internDirec.x += 1;
|
internDirec.x += 1;
|
||||||
internDirec.y += 1;
|
internDirec.y += 1;
|
||||||
|
@ -266,7 +286,6 @@ namespace OpenSim
|
||||||
newCommand.CommandType = 1;
|
newCommand.CommandType = 1;
|
||||||
newCommand.SObject = avatar;
|
newCommand.SObject = avatar;
|
||||||
//walking but key not pressed so need to stop
|
//walking but key not pressed so need to stop
|
||||||
//avatar.Walk = false;
|
|
||||||
newCommand.Velocity.X = 0;
|
newCommand.Velocity.X = 0;
|
||||||
newCommand.Velocity.Y = 0;
|
newCommand.Velocity.Y = 0;
|
||||||
newCommand.Velocity.Z = 0;
|
newCommand.Velocity.Z = 0;
|
||||||
|
@ -355,35 +374,20 @@ namespace OpenSim
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region testing
|
public void AddNewPrim(PrimData prim)
|
||||||
//test only
|
|
||||||
private void SendAvatarData(NetworkInfo userInfo)
|
|
||||||
{
|
{
|
||||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
lock(this.RootNode)
|
||||||
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
{
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
prim.SceneName = "Prim" + this._objectCount.ToString("00000"); //not sure why still doing this as its not used
|
||||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
this._objectCount++;
|
||||||
|
this.RootNode.AddChild(prim);
|
||||||
objupdate.ObjectData[0] = _avatarTemplate;
|
|
||||||
//give this avatar object a local id and assign the user a name
|
|
||||||
objupdate.ObjectData[0].ID = 8880000;// + this._localNumber;
|
|
||||||
userInfo.User.AvatarLocalID = objupdate.ObjectData[0].ID;
|
|
||||||
//User_info.name="Test"+this.local_numer+" User";
|
|
||||||
//this.GetAgent(userInfo.UserAgentID).Started = true;
|
|
||||||
objupdate.ObjectData[0].FullID = userInfo.User.AgentID;
|
|
||||||
objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.User.FirstName + "\nLastName STRING RW SV " + userInfo.User.LastName + " \0");
|
|
||||||
//userInfo.User.FullName = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0";
|
|
||||||
|
|
||||||
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
|
|
||||||
byte[] pb = pos2.GetBytes();
|
|
||||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
|
||||||
|
|
||||||
//this._localNumber++;
|
|
||||||
_server.SendPacket(objupdate, true, userInfo);
|
|
||||||
}
|
}
|
||||||
|
prim.UpdateFlag = 64;
|
||||||
|
}
|
||||||
|
#region temporary template
|
||||||
|
|
||||||
//test only
|
//temporary only
|
||||||
private void SetupTemplate(string name)
|
private void SetupAvatarTemplate(string name)
|
||||||
{
|
{
|
||||||
//should be replaced with completely code generated packets
|
//should be replaced with completely code generated packets
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -409,6 +413,26 @@ namespace OpenSim
|
||||||
|
|
||||||
_avatarTemplate = objdata;
|
_avatarTemplate = objdata;
|
||||||
|
|
||||||
|
}
|
||||||
|
//really really need to get rid of these templates
|
||||||
|
public void SetupObjectTemplate(string name)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
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();
|
||||||
|
|
||||||
|
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
||||||
|
this.PrimTemplate = objdata;
|
||||||
|
objdata.UpdateFlags = objdata.UpdateFlags + 12 - 16 + 32 + 256;
|
||||||
|
objdata.OwnerID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
//test adding a new texture to object , to test image downloading
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
private void SendAvatarDataToAll(AvatarData avatar)
|
private void SendAvatarDataToAll(AvatarData avatar)
|
||||||
|
@ -441,6 +465,49 @@ namespace OpenSim
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendPrimToAll(PrimData prim)
|
||||||
|
{
|
||||||
|
PrimData PData = prim;
|
||||||
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
|
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
|
objupdate.RegionData.TimeDilation = 0;
|
||||||
|
|
||||||
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
objupdate.ObjectData[0] = this.PrimTemplate;
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].OwnerID = PData.OwnerID;
|
||||||
|
objupdate.ObjectData[0].PCode = PData.PCode;
|
||||||
|
objupdate.ObjectData[0].PathBegin = PData.PathBegin;
|
||||||
|
objupdate.ObjectData[0].PathEnd = PData.PathEnd;
|
||||||
|
objupdate.ObjectData[0].PathScaleX = PData.PathScaleX;
|
||||||
|
objupdate.ObjectData[0].PathScaleY = PData.PathScaleY;
|
||||||
|
objupdate.ObjectData[0].PathShearX = PData.PathShearX;
|
||||||
|
objupdate.ObjectData[0].PathShearY = PData.PathShearY;
|
||||||
|
objupdate.ObjectData[0].PathSkew = PData.PathSkew;
|
||||||
|
objupdate.ObjectData[0].ProfileBegin = PData.ProfileBegin;
|
||||||
|
objupdate.ObjectData[0].ProfileEnd = PData.ProfileEnd;
|
||||||
|
objupdate.ObjectData[0].Scale = PData.Scale;
|
||||||
|
objupdate.ObjectData[0].PathCurve = PData.PathCurve;
|
||||||
|
objupdate.ObjectData[0].ProfileCurve = PData.ProfileCurve;
|
||||||
|
objupdate.ObjectData[0].ParentID = PData.ParentID ;
|
||||||
|
objupdate.ObjectData[0].ProfileHollow = PData.ProfileHollow ;
|
||||||
|
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].TextureEntry = PData.Texture.ToBytes();
|
||||||
|
objupdate.ObjectData[0].ID = PData.LocalID;
|
||||||
|
objupdate.ObjectData[0].FullID = PData.FullID;
|
||||||
|
//update position
|
||||||
|
byte[] pb = PData.Position.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||||
|
|
||||||
|
SendInfo send = new SendInfo();
|
||||||
|
send.Incr = true;
|
||||||
|
send.NetInfo = null;
|
||||||
|
send.Packet = objupdate;
|
||||||
|
send.SentTo = 1; //to all clients
|
||||||
|
this._updateSender.SendList.Enqueue(send);
|
||||||
|
}
|
||||||
|
|
||||||
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock(AvatarData avatar)
|
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock(AvatarData avatar)
|
||||||
{
|
{
|
||||||
byte[] bytes = new byte[60];
|
byte[] bytes = new byte[60];
|
||||||
|
@ -455,57 +522,47 @@ namespace OpenSim
|
||||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||||
|
|
||||||
bytes[i++] = 0;
|
bytes[i++] = 0;
|
||||||
bytes[i++] = 1;
|
bytes[i++] = 1;
|
||||||
|
|
||||||
i += 14;
|
i += 14;
|
||||||
bytes[i++] = 128;
|
bytes[i++] = 128;
|
||||||
bytes[i++] = 63;
|
bytes[i++] = 63;
|
||||||
byte[] pb = pos2.GetBytes();
|
|
||||||
|
|
||||||
|
byte[] pb = pos2.GetBytes();
|
||||||
Array.Copy(pb, 0, bytes, i, pb.Length);
|
Array.Copy(pb, 0, bytes, i, pb.Length);
|
||||||
i += 12;
|
i += 12;
|
||||||
|
|
||||||
ushort ac = 32767;
|
ushort ac = 32767;
|
||||||
bytes[i++] = (byte)(avatar.InternVelocityX % 256);
|
bytes[i++] = (byte)(avatar.InternVelocityX % 256);
|
||||||
bytes[i++] = (byte)((avatar.InternVelocityX >> 8) % 256);
|
bytes[i++] = (byte)((avatar.InternVelocityX >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(avatar.InternVelocityY % 256);
|
bytes[i++] = (byte)(avatar.InternVelocityY % 256);
|
||||||
bytes[i++] = (byte)((avatar.InternVelocityY>> 8) % 256);
|
bytes[i++] = (byte)((avatar.InternVelocityY>> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(avatar.InternVelocityZ % 256);
|
bytes[i++] = (byte)(avatar.InternVelocityZ % 256);
|
||||||
bytes[i++] = (byte)((avatar.InternVelocityZ >> 8) % 256);
|
bytes[i++] = (byte)((avatar.InternVelocityZ >> 8) % 256);
|
||||||
|
|
||||||
//accel
|
//accel
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
//rot
|
//rot
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
//rotation vel
|
//rotation vel
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,8 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserServer :IUserServer
|
public class UserServer :IUserServer
|
||||||
{
|
{
|
||||||
public List<Logon> Sessions = new List<Logon>(); //should change to something other than logon classes?
|
|
||||||
public UserServer()
|
public UserServer()
|
||||||
{
|
{
|
||||||
Sessions = new List<Logon>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialise()
|
private void Initialise()
|
||||||
|
@ -52,45 +50,17 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
public void test()
|
||||||
{
|
|
||||||
//For Grid use:
|
|
||||||
//should check to see if it is a teleportation, if so then we should be expecting this session, agent. (?)
|
|
||||||
//if not check with User server/ login server that it is authorised.
|
|
||||||
|
|
||||||
//but for now we are running local
|
|
||||||
AuthenticateResponse user = new AuthenticateResponse();
|
|
||||||
|
|
||||||
lock(this.Sessions)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
for(int i = 0; i < Sessions.Count; i++)
|
|
||||||
{
|
|
||||||
if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID))
|
|
||||||
{
|
|
||||||
user.Authorised = true;
|
|
||||||
user.LogonInfo = Sessions[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IUserServer
|
public interface IUserServer
|
||||||
{
|
{
|
||||||
AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
|
void test();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AuthenticateResponse
|
|
||||||
{
|
|
||||||
public bool Authorised;
|
|
||||||
public Logon LogonInfo;
|
|
||||||
|
|
||||||
public AuthenticateResponse()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue