aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer')
-rw-r--r--OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs43
-rw-r--r--OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs96
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.Grid.cs1
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs18
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs17
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs97
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientViewBase.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/CommsManager.cs10
-rw-r--r--OpenSim/OpenSim.RegionServer/Grid.cs14
-rw-r--r--OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs91
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj127
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSimMain.cs531
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs5
-rw-r--r--OpenSim/OpenSim.RegionServer/PacketServer.cs40
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionInfo.cs70
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionInfoBase.cs32
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionServerBase.cs13
-rw-r--r--OpenSim/OpenSim.RegionServer/UDPServer.cs34
-rw-r--r--OpenSim/OpenSim.RegionServer/UserConfigUtility.cs10
-rw-r--r--OpenSim/OpenSim.RegionServer/VersionInfo.cs2
21 files changed, 359 insertions, 896 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
index ccebb24..f82418d 100644
--- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
+++ b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading; 30using System.Threading;
31using System.Reflection;
31using libsecondlife; 32using libsecondlife;
32using libsecondlife.Packets; 33using libsecondlife.Packets;
33using OpenSim; 34using OpenSim;
@@ -71,6 +72,20 @@ namespace OpenSim.Assets
71 72
72 } 73 }
73 74
75 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey)
76 {
77 Console.WriteLine("Creating Asset cache");
78 _assetServer = this.LoadAssetDll(assetServerDLLName);
79 _assetServer.SetServerInfo(assetServerURL, assetServerKey);
80 _assetServer.SetReceiver(this);
81 Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
82 Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
83 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
84 this._assetCacheThread.IsBackground = true;
85 this._assetCacheThread.Start();
86
87 }
88
74 /// <summary> 89 /// <summary>
75 /// 90 ///
76 /// </summary> 91 /// </summary>
@@ -513,6 +528,34 @@ namespace OpenSim.Assets
513 } 528 }
514 #endregion 529 #endregion
515 530
531 private IAssetServer LoadAssetDll(string dllName)
532 {
533 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
534 IAssetServer server = null;
535
536 foreach (Type pluginType in pluginAssembly.GetTypes())
537 {
538 if (pluginType.IsPublic)
539 {
540 if (!pluginType.IsAbstract)
541 {
542 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
543
544 if (typeInterface != null)
545 {
546 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
547 server = plug.GetAssetServer();
548 break;
549 }
550
551 typeInterface = null;
552 }
553 }
554 }
555 pluginAssembly = null;
556 return server;
557 }
558
516 } 559 }
517 560
518 public class AssetRequest 561 public class AssetRequest
diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 1f508ce..c5d5dc2 100644
--- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -2,13 +2,11 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using OpenSim.world;
6using OpenSim.UserServer; 5using OpenSim.UserServer;
7using OpenSim.Servers; 6using OpenSim.Servers;
8using OpenSim.Assets; 7using OpenSim.Assets;
9using OpenSim.Framework.Inventory; 8using OpenSim.Framework.Inventory;
10using libsecondlife; 9using libsecondlife;
11using OpenSim.RegionServer.world.scripting;
12using Avatar=libsecondlife.Avatar; 10using Avatar=libsecondlife.Avatar;
13 11
14namespace OpenSim.CAPS 12namespace OpenSim.CAPS
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
new file mode 100644
index 0000000..579928c
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -0,0 +1,96 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Interfaces;
5using OpenSim.Framework.Inventory;
6using libsecondlife;
7using libsecondlife.Packets;
8
9namespace OpenSim
10{
11 partial class ClientView
12 {
13 public event ChatFromViewer OnChatFromViewer;
14 public event RezObject OnRezObject;
15 public event GenericCall4 OnDeRezObject;
16 public event ModifyTerrain OnModifyTerrain;
17 public event GenericCall OnRegionHandShakeReply;
18 public event GenericCall OnRequestWearables;
19 public event SetAppearance OnSetAppearance;
20 public event GenericCall2 OnCompleteMovementToRegion;
21 public event GenericCall3 OnAgentUpdate;
22 public event StartAnim OnStartAnim;
23 public event GenericCall OnRequestAvatarsData;
24 public event LinkObjects OnLinkObjects;
25 public event GenericCall4 OnAddPrim;
26 public event UpdateShape OnUpdatePrimShape;
27 public event ObjectSelect OnObjectSelect;
28 public event UpdatePrimFlags OnUpdatePrimFlags;
29 public event UpdatePrimTexture OnUpdatePrimTexture;
30 public event UpdatePrimVector OnUpdatePrimPosition;
31 public event UpdatePrimRotation OnUpdatePrimRotation;
32 public event UpdatePrimVector OnUpdatePrimScale;
33 public event StatusChange OnChildAgentStatus;
34 public event GenericCall2 OnStopMovement;
35
36 public LLVector3 StartPos
37 {
38 get
39 {
40 return startpos;
41 }
42 set
43 {
44 startpos = value;
45 }
46 }
47
48 public LLUUID AgentId
49 {
50 get
51 {
52 return this.AgentID;
53 }
54 }
55
56 #region World/Avatar to Client
57 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
58 {
59 System.Text.Encoding enc = System.Text.Encoding.ASCII;
60 libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
61 reply.ChatData.Audible = 1;
62 reply.ChatData.Message = message;
63 reply.ChatData.ChatType = type;
64 reply.ChatData.SourceType = 1;
65 reply.ChatData.Position = fromPos;
66 reply.ChatData.FromName = enc.GetBytes(fromName + "\0");
67 reply.ChatData.OwnerID = fromAgentID;
68 reply.ChatData.SourceID = fromAgentID;
69
70 this.OutPacket(reply);
71 }
72
73 public void SendAppearance(AvatarWearable[] wearables)
74 {
75 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
76 aw.AgentData.AgentID = this.AgentID;
77 aw.AgentData.SerialNum = 0;
78 aw.AgentData.SessionID = this.SessionID;
79
80 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
81 AgentWearablesUpdatePacket.WearableDataBlock awb;
82 for (int i = 0; i < wearables.Length; i++)
83 {
84 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
85 awb.WearableType = (byte)i;
86 awb.AssetID = wearables[i].AssetID;
87 awb.ItemID = wearables[i].ItemID;
88 aw.WearableData[i] = awb;
89 }
90
91 this.OutPacket(aw);
92 }
93 #endregion
94
95 }
96}
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
index b4e4b5f..9545db8 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
@@ -13,7 +13,6 @@ using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory; 14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities; 15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets; 16using OpenSim.Assets;
18 17
19namespace OpenSim 18namespace OpenSim
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
index 75fcf18..3c39781 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
@@ -13,7 +13,6 @@ using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory; 14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities; 15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets; 16using OpenSim.Assets;
18 17
19namespace OpenSim 18namespace OpenSim
@@ -42,26 +41,21 @@ namespace OpenSim
42 KillObjectPacket kill = new KillObjectPacket(); 41 KillObjectPacket kill = new KillObjectPacket();
43 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 42 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
44 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 43 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
45 kill.ObjectData[0].ID = this.ClientAvatar.localid; 44 // kill.ObjectData[0].ID = this.ClientAvatar.localid;
46 foreach (ClientView client in m_clientThreads.Values) 45 foreach (ClientView client in m_clientThreads.Values)
47 { 46 {
48 client.OutPacket(kill); 47 client.OutPacket(kill);
49 } 48 }
50 if (this.m_userServer != null) 49
51 { 50 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
52 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); 51
53 }
54 else
55 {
56 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
57 }
58 52
59 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); 53 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
60 /*lock (m_world.Entities) 54 /*lock (m_world.Entities)
61 { 55 {
62 m_world.Entities.Remove(this.AgentID); 56 m_world.Entities.Remove(this.AgentID);
63 }*/ 57 }*/
64 m_world.RemoveViewerAgent(this); 58 // m_world.RemoveViewerAgent(this);
65 //need to do other cleaning up here too 59 //need to do other cleaning up here too
66 m_clientThreads.Remove(this.CircuitCode); 60 m_clientThreads.Remove(this.CircuitCode);
67 m_networkServer.RemoveClientCircuit(this.CircuitCode); 61 m_networkServer.RemoveClientCircuit(this.CircuitCode);
@@ -109,7 +103,7 @@ namespace OpenSim
109 else if (multipleupdate.ObjectData[i].Type == 13)//scale 103 else if (multipleupdate.ObjectData[i].Type == 13)//scale
110 { 104 {
111 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 105 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
112 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 106 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
113 } 107 }
114 } 108 }
115 return true; 109 return true;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 6a33432..54cb662 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -13,15 +13,12 @@ using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory; 14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities; 15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets; 16using OpenSim.Assets;
18 17
19namespace OpenSim 18namespace OpenSim
20{ 19{
21 public partial class ClientView 20 public partial class ClientView
22 { 21 {
23
24
25 protected override void ProcessInPacket(Packet Pack) 22 protected override void ProcessInPacket(Packet Pack)
26 { 23 {
27 ack_pack(Pack); 24 ack_pack(Pack);
@@ -65,10 +62,10 @@ namespace OpenSim
65 //empty message so don't bother with it 62 //empty message so don't bother with it
66 break; 63 break;
67 } 64 }
68 string fromName = ClientAvatar.firstname + " " + ClientAvatar.lastname; 65 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
69 byte[] message = inchatpack.ChatData.Message; 66 byte[] message = inchatpack.ChatData.Message;
70 byte type = inchatpack.ChatData.Type; 67 byte type = inchatpack.ChatData.Type;
71 LLVector3 fromPos = ClientAvatar.Pos; 68 LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
72 LLUUID fromAgentID = AgentID; 69 LLUUID fromAgentID = AgentID;
73 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); 70 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
74 break; 71 break;
@@ -151,7 +148,7 @@ namespace OpenSim
151 OnLinkObjects(parentprimid, childrenprims); 148 OnLinkObjects(parentprimid, childrenprims);
152 break; 149 break;
153 case PacketType.ObjectAdd: 150 case PacketType.ObjectAdd:
154 m_world.AddNewPrim((ObjectAddPacket)Pack, this); 151 // m_world.AddNewPrim((ObjectAddPacket)Pack, this);
155 OnAddPrim(Pack, this); 152 OnAddPrim(Pack, this);
156 break; 153 break;
157 case PacketType.ObjectShape: 154 case PacketType.ObjectShape:
@@ -270,7 +267,7 @@ namespace OpenSim
270 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 267 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
271 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); 268 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
272 bool foundent = false; 269 bool foundent = false;
273 foreach (Entity ent in m_world.Entities.Values) 270 /* foreach (Entity ent in m_world.Entities.Values)
274 { 271 {
275 if (ent.localid == requesttask.InventoryData.LocalID) 272 if (ent.localid == requesttask.InventoryData.LocalID)
276 { 273 {
@@ -283,13 +280,13 @@ namespace OpenSim
283 if (foundent) 280 if (foundent)
284 { 281 {
285 this.OutPacket(replytask); 282 this.OutPacket(replytask);
286 } 283 }*/
287 break; 284 break;
288 case PacketType.UpdateTaskInventory: 285 case PacketType.UpdateTaskInventory:
289 // Console.WriteLine(Pack.ToString()); 286 // Console.WriteLine(Pack.ToString());
290 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 287 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
291 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); 288 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
292 if (myinventory != null) 289 /*if (myinventory != null)
293 { 290 {
294 if (updatetask.UpdateData.Key == 0) 291 if (updatetask.UpdateData.Key == 0)
295 { 292 {
@@ -315,7 +312,7 @@ namespace OpenSim
315 } 312 }
316 } 313 }
317 } 314 }
318 } 315 }*/
319 break; 316 break;
320 case PacketType.MapLayerRequest: 317 case PacketType.MapLayerRequest:
321 this.RequestMapLayer(); 318 this.RequestMapLayer();
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index a422102..0419b7a 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -35,11 +35,11 @@ using System.Net.Sockets;
35using System.IO; 35using System.IO;
36using System.Threading; 36using System.Threading;
37using System.Timers; 37using System.Timers;
38using OpenSim.Framework;
38using OpenSim.Framework.Interfaces; 39using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Types; 40using OpenSim.Framework.Types;
40using OpenSim.Framework.Inventory; 41using OpenSim.Framework.Inventory;
41using OpenSim.Framework.Utilities; 42using OpenSim.Framework.Utilities;
42using OpenSim.world;
43using OpenSim.Assets; 43using OpenSim.Assets;
44 44
45namespace OpenSim 45namespace OpenSim
@@ -58,73 +58,40 @@ namespace OpenSim
58 public LLUUID AgentID; 58 public LLUUID AgentID;
59 public LLUUID SessionID; 59 public LLUUID SessionID;
60 public LLUUID SecureSessionID = LLUUID.Zero; 60 public LLUUID SecureSessionID = LLUUID.Zero;
61 public bool m_child; 61 public bool m_child = false;
62 public world.Avatar ClientAvatar;
63 private UseCircuitCodePacket cirpack; 62 private UseCircuitCodePacket cirpack;
64 public Thread ClientThread; 63 public Thread ClientThread;
65 public LLVector3 startpos; 64 public LLVector3 startpos;
66 65
67 private AgentAssetUpload UploadAssets; 66 private AgentAssetUpload UploadAssets;
68 private LLUUID newAssetFolder = LLUUID.Zero; 67 private LLUUID newAssetFolder = LLUUID.Zero;
69 private bool debug = false; 68 private bool debug = false;
70 private World m_world; 69 private IWorld m_world;
71 private Dictionary<uint, ClientView> m_clientThreads; 70 private Dictionary<uint, ClientView> m_clientThreads;
72 private AssetCache m_assetCache; 71 private AssetCache m_assetCache;
73 private IGridServer m_gridServer; 72 private IGridServer m_gridServer;
74 private IUserServer m_userServer = null;
75 private InventoryCache m_inventoryCache; 73 private InventoryCache m_inventoryCache;
76 public bool m_sandboxMode;
77 private int cachedtextureserial = 0; 74 private int cachedtextureserial = 0;
78 private RegionInfo m_regionData; 75 private RegionInfo m_regionData;
79 protected AuthenticateSessionsBase m_authenticateSessionsHandler; 76 protected AuthenticateSessionsBase m_authenticateSessionsHandler;
80 77
81 public IUserServer UserServer
82 {
83 set
84 {
85 this.m_userServer = value;
86 }
87 }
88 78
89 public LLVector3 StartPos 79 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions)
90 { 80 {
91 get
92 {
93 return startpos;
94 }
95 set
96 {
97 startpos = value;
98 }
99 }
100 81
101 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions)
102 {
103 m_world = world;
104 m_clientThreads = clientThreads; 82 m_clientThreads = clientThreads;
105 m_assetCache = assetCache; 83 m_assetCache = assetCache;
106 m_gridServer = gridServer; 84
107 m_networkServer = application; 85 m_networkServer = packServer;
108 m_inventoryCache = inventoryCache; 86 m_inventoryCache = inventoryCache;
109 m_sandboxMode = sandboxMode;
110 m_child = child;
111 m_regionData = regionDat;
112 m_authenticateSessionsHandler = authenSessions; 87 m_authenticateSessionsHandler = authenSessions;
113 88
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request"); 89 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request");
115 cirpack = initialcirpack; 90 cirpack = initialcirpack;
116 userEP = remoteEP; 91 userEP = remoteEP;
117 92
118 if (m_gridServer.GetName() == "Remote") 93 this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
119 { 94 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
120 this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
121 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
122 //Console.WriteLine("start pos is " + this.startpos.X + " , " + this.startpos.Y + " , " + this.startpos.Z);
123 }
124 else
125 {
126 this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f);
127 }
128 95
129 PacketQueue = new BlockingQueue<QueItem>(); 96 PacketQueue = new BlockingQueue<QueItem>();
130 97
@@ -146,11 +113,10 @@ namespace OpenSim
146 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); 113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
147 this.m_child = false; 114 this.m_child = false;
148 //this.m_world.RemoveViewerAgent(this); 115 //this.m_world.RemoveViewerAgent(this);
149 if (!this.m_sandboxMode) 116
150 { 117 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
151 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); 118 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
152 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); 119
153 }
154 OnChildAgentStatus(this.m_child); 120 OnChildAgentStatus(this.m_child);
155 //this.InitNewClient(); 121 //this.InitNewClient();
156 } 122 }
@@ -169,21 +135,16 @@ namespace OpenSim
169 KillObjectPacket kill = new KillObjectPacket(); 135 KillObjectPacket kill = new KillObjectPacket();
170 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 136 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
171 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 137 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
172 kill.ObjectData[0].ID = this.ClientAvatar.localid; 138 //kill.ObjectData[0].ID = this.ClientAvatar.localid;
173 foreach (ClientView client in m_clientThreads.Values) 139 foreach (ClientView client in m_clientThreads.Values)
174 { 140 {
175 client.OutPacket(kill); 141 client.OutPacket(kill);
176 } 142 }
177 if (this.m_userServer != null)
178 {
179 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
180 }
181 else
182 {
183 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
184 }
185 143
186 m_world.RemoveViewerAgent(this); 144 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
145
146
147 // m_world.RemoveViewerAgent(this);
187 148
188 m_clientThreads.Remove(this.CircuitCode); 149 m_clientThreads.Remove(this.CircuitCode);
189 m_networkServer.RemoveClientCircuit(this.CircuitCode); 150 m_networkServer.RemoveClientCircuit(this.CircuitCode);
@@ -270,13 +231,13 @@ namespace OpenSim
270 protected virtual void InitNewClient() 231 protected virtual void InitNewClient()
271 { 232 {
272 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 233 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
273 this.ClientAvatar = m_world.AddViewerAgent(this); 234 // this.ClientAvatar = m_world.AddViewerAgent(this);
274 } 235 }
275 236
276 protected virtual void AuthUser() 237 protected virtual void AuthUser()
277 { 238 {
278 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 239 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
279 AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 240 AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
280 if (!sessionInfo.Authorised) 241 if (!sessionInfo.Authorised)
281 { 242 {
282 //session/circuit not authorised 243 //session/circuit not authorised
@@ -290,20 +251,14 @@ namespace OpenSim
290 this.AgentID = cirpack.CircuitCode.ID; 251 this.AgentID = cirpack.CircuitCode.ID;
291 this.SessionID = cirpack.CircuitCode.SessionID; 252 this.SessionID = cirpack.CircuitCode.SessionID;
292 this.CircuitCode = cirpack.CircuitCode.Code; 253 this.CircuitCode = cirpack.CircuitCode.Code;
293 InitNewClient(); 254 InitNewClient();
294 this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; 255 //this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
295 this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; 256 // this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
296 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) 257 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
297 { 258 {
298 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; 259 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
299 } 260 }
300 261
301 // Create Inventory, currently only works for sandbox mode
302 if (m_sandboxMode)
303 {
304 this.SetupInventory(sessionInfo);
305 }
306
307 ClientLoop(); 262 ClientLoop();
308 } 263 }
309 } 264 }
@@ -318,18 +273,18 @@ namespace OpenSim
318 #region Inventory Creation 273 #region Inventory Creation
319 private void SetupInventory(AuthenticateResponse sessionInfo) 274 private void SetupInventory(AuthenticateResponse sessionInfo)
320 { 275 {
321 276
322 } 277 }
323 private AgentInventory CreateInventory(LLUUID baseFolder) 278 private AgentInventory CreateInventory(LLUUID baseFolder)
324 { 279 {
325 AgentInventory inventory = null; 280 AgentInventory inventory = null;
326 281
327 return inventory; 282 return inventory;
328 } 283 }
329 284
330 private void CreateInventoryItem(CreateInventoryItemPacket packet) 285 private void CreateInventoryItem(CreateInventoryItemPacket packet)
331 { 286 {
332 287
333 } 288 }
334 #endregion 289 #endregion
335 290
diff --git a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs
index 572dbce..eb21b80 100644
--- a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29 public uint CircuitCode; 29 public uint CircuitCode;
30 public EndPoint userEP; 30 public EndPoint userEP;
31 31
32 protected OpenSimNetworkHandler m_networkServer; 32 protected PacketServer m_networkServer;
33 33
34 public ClientViewBase() 34 public ClientViewBase()
35 { 35 {
diff --git a/OpenSim/OpenSim.RegionServer/CommsManager.cs b/OpenSim/OpenSim.RegionServer/CommsManager.cs
new file mode 100644
index 0000000..5cd9a9b
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/CommsManager.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim
6{
7 public class CommsManager
8 {
9 }
10}
diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs
deleted file mode 100644
index 0b8db4d..0000000
--- a/OpenSim/OpenSim.RegionServer/Grid.cs
+++ /dev/null
@@ -1,14 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5using OpenSim.Framework.Interfaces;
6using OpenSim.UserServer;
7
8namespace OpenSim
9{
10 public class Grid
11 {
12
13 }
14}
diff --git a/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs b/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs
new file mode 100644
index 0000000..a607909
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs
@@ -0,0 +1,91 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Interfaces;
5
6namespace OpenSim
7{
8 public class NetworkServersInfo
9 {
10 public string AssetURL = "http://127.0.0.1:8003/";
11 public string AssetSendKey = "";
12
13 public string GridURL = "";
14 public string GridSendKey = "";
15 public string GridRecvKey = "";
16 public string UserURL = "";
17 public string UserSendKey = "";
18 public string UserRecvKey = "";
19 public bool isSandbox;
20
21 public void InitConfig(bool sandboxMode, IGenericConfig configData)
22 {
23 this.isSandbox = sandboxMode;
24
25 try
26 {
27 if (!isSandbox)
28 {
29 string attri = "";
30 //Grid Server URL
31 attri = "";
32 attri = configData.GetAttribute("GridServerURL");
33 if (attri == "")
34 {
35 this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
36 configData.SetAttribute("GridServerURL", this.GridURL);
37 }
38 else
39 {
40 this.GridURL = attri;
41 }
42
43 //Grid Send Key
44 attri = "";
45 attri = configData.GetAttribute("GridSendKey");
46 if (attri == "")
47 {
48 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server", "null");
49 configData.SetAttribute("GridSendKey", this.GridSendKey);
50 }
51 else
52 {
53 this.GridSendKey = attri;
54 }
55
56 //Grid Receive Key
57 attri = "";
58 attri = configData.GetAttribute("GridRecvKey");
59 if (attri == "")
60 {
61 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server", "null");
62 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
63 }
64 else
65 {
66 this.GridRecvKey = attri;
67 }
68
69 attri = "";
70 attri = configData.GetAttribute("AssetServerURL");
71 if (attri == "")
72 {
73 this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
74 configData.SetAttribute("AssetServerURL", this.GridURL);
75 }
76 else
77 {
78 this.AssetURL = attri;
79 }
80
81 }
82 configData.Commit();
83 }
84 catch (Exception e)
85 {
86 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Config.cs:InitConfig() - Exception occured");
87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
88 }
89 }
90 }
91}
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index a6bc5ae..73116ee 100644
--- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,28 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 74 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 75 <Private>False</Private>
68 </Reference> 76 </Reference>
69 <Reference Include="libsecondlife.dll" > 77 <Reference Include="libsecondlife.dll">
70 <HintPath>..\..\bin\libsecondlife.dll</HintPath> 78 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 79 <Private>False</Private>
72 </Reference> 80 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 81 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> 82 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 83 <Private>False</Private>
76 </Reference> 84 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 85 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> 86 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 87 <Private>False</Private>
80 </Reference> 88 </Reference>
@@ -84,43 +92,43 @@
84 <Name>OpenSim.Terrain.BasicTerrain</Name> 92 <Name>OpenSim.Terrain.BasicTerrain</Name>
85 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 93 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 95 <Private>False</Private>
88 </ProjectReference> 96 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> 97 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name> 98 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 99 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 101 <Private>False</Private>
94 </ProjectReference> 102 </ProjectReference>
95 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 103 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name> 104 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 105 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 107 <Private>False</Private>
100 </ProjectReference> 108 </ProjectReference>
101 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> 109 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
102 <Name>OpenSim.GenericConfig.Xml</Name> 110 <Name>OpenSim.GenericConfig.Xml</Name>
103 <Project>{E88EF749-0000-0000-0000-000000000000}</Project> 111 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 113 <Private>False</Private>
106 </ProjectReference> 114 </ProjectReference>
107 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 115 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
108 <Name>OpenSim.Physics.Manager</Name> 116 <Name>OpenSim.Physics.Manager</Name>
109 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 117 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 118 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 119 <Private>False</Private>
112 </ProjectReference> 120 </ProjectReference>
113 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> 121 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
114 <Name>OpenSim.Servers</Name> 122 <Name>OpenSim.Servers</Name>
115 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 123 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 124 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private> 125 <Private>False</Private>
118 </ProjectReference> 126 </ProjectReference>
119 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> 127 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
120 <Name>XMLRPC</Name> 128 <Name>XMLRPC</Name>
121 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> 129 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 130 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private> 131 <Private>False</Private>
124 </ProjectReference> 132 </ProjectReference>
125 </ItemGroup> 133 </ItemGroup>
126 <ItemGroup> 134 <ItemGroup>
@@ -157,30 +165,17 @@
157 <Compile Include="CommsManager.cs"> 165 <Compile Include="CommsManager.cs">
158 <SubType>Code</SubType> 166 <SubType>Code</SubType>
159 </Compile> 167 </Compile>
160 <Compile Include="Grid.cs"> 168 <Compile Include="OpenSimNetworkHandler.cs" />
161 <SubType>Code</SubType>
162 </Compile>
163 <Compile Include="OpenSimMain.cs">
164 <SubType>Code</SubType>
165 </Compile>
166 <Compile Include="OpenSimNetworkHandler.cs">
167 <SubType>Code</SubType>
168 </Compile>
169 <Compile Include="PacketServer.cs"> 169 <Compile Include="PacketServer.cs">
170 <SubType>Code</SubType> 170 <SubType>Code</SubType>
171 </Compile> 171 </Compile>
172 <Compile Include="RegionInfo.cs">
173 <SubType>Code</SubType>
174 </Compile>
175 <Compile Include="RegionInfoBase.cs">
176 <SubType>Code</SubType>
177 </Compile>
178 <Compile Include="RegionServerBase.cs"> 172 <Compile Include="RegionServerBase.cs">
179 <SubType>Code</SubType> 173 <SubType>Code</SubType>
180 </Compile> 174 </Compile>
181 <Compile Include="UDPServer.cs"> 175 <Compile Include="UDPServer.cs">
182 <SubType>Code</SubType> 176 <SubType>Code</SubType>
183 </Compile> 177 </Compile>
178 <Compile Include="UserConfigUtility.cs" />
184 <Compile Include="VersionInfo.cs"> 179 <Compile Include="VersionInfo.cs">
185 <SubType>Code</SubType> 180 <SubType>Code</SubType>
186 </Compile> 181 </Compile>
@@ -193,66 +188,6 @@
193 <Compile Include="CAPS\AdminWebFront.cs"> 188 <Compile Include="CAPS\AdminWebFront.cs">
194 <SubType>Code</SubType> 189 <SubType>Code</SubType>
195 </Compile> 190 </Compile>
196 <Compile Include="types\Mesh.cs">
197 <SubType>Code</SubType>
198 </Compile>
199 <Compile Include="types\Triangle.cs">
200 <SubType>Code</SubType>
201 </Compile>
202 <Compile Include="world\Avatar.Client.cs">
203 <SubType>Code</SubType>
204 </Compile>
205 <Compile Include="world\Avatar.cs">
206 <SubType>Code</SubType>
207 </Compile>
208 <Compile Include="world\Avatar.Update.cs">
209 <SubType>Code</SubType>
210 </Compile>
211 <Compile Include="world\AvatarAnimations.cs">
212 <SubType>Code</SubType>
213 </Compile>
214 <Compile Include="world\Entity.cs">
215 <SubType>Code</SubType>
216 </Compile>
217 <Compile Include="world\Primitive.cs">
218 <SubType>Code</SubType>
219 </Compile>
220 <Compile Include="world\Primitive2.cs">
221 <SubType>Code</SubType>
222 </Compile>
223 <Compile Include="world\SceneObject.cs">
224 <SubType>Code</SubType>
225 </Compile>
226 <Compile Include="world\World.cs">
227 <SubType>Code</SubType>
228 </Compile>
229 <Compile Include="world\World.PacketHandlers.cs">
230 <SubType>Code</SubType>
231 </Compile>
232 <Compile Include="world\World.Scripting.cs">
233 <SubType>Code</SubType>
234 </Compile>
235 <Compile Include="world\WorldBase.cs">
236 <SubType>Code</SubType>
237 </Compile>
238 <Compile Include="world\scripting\IScriptContext.cs">
239 <SubType>Code</SubType>
240 </Compile>
241 <Compile Include="world\scripting\IScriptEntity.cs">
242 <SubType>Code</SubType>
243 </Compile>
244 <Compile Include="world\scripting\IScriptHandler.cs">
245 <SubType>Code</SubType>
246 </Compile>
247 <Compile Include="world\scripting\Script.cs">
248 <SubType>Code</SubType>
249 </Compile>
250 <Compile Include="world\scripting\ScriptFactory.cs">
251 <SubType>Code</SubType>
252 </Compile>
253 <Compile Include="world\scripting\Scripts\FollowRandomAvatar.cs">
254 <SubType>Code</SubType>
255 </Compile>
256 </ItemGroup> 191 </ItemGroup>
257 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 192 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
258 <PropertyGroup> 193 <PropertyGroup>
@@ -261,4 +196,4 @@
261 <PostBuildEvent> 196 <PostBuildEvent>
262 </PostBuildEvent> 197 </PostBuildEvent>
263 </PropertyGroup> 198 </PropertyGroup>
264</Project> 199</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim/OpenSim.RegionServer/OpenSimMain.cs
deleted file mode 100644
index 003412d..0000000
--- a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs
+++ /dev/null
@@ -1,531 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the <organization> nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29using System;
30using System.Text;
31using System.IO;
32using System.Threading;
33using System.Net;
34using System.Net.Sockets;
35using System.Timers;
36using System.Reflection;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using libsecondlife.Packets;
41using OpenSim.world;
42using OpenSim.Terrain;
43using OpenSim.Framework.Interfaces;
44using OpenSim.Framework.Types;
45using OpenSim.UserServer;
46using OpenSim.Assets;
47using OpenSim.CAPS;
48using OpenSim.Framework.Console;
49using OpenSim.Physics.Manager;
50using Nwc.XmlRpc;
51using OpenSim.Servers;
52using OpenSim.GenericConfig;
53
54namespace OpenSim
55{
56 //moved to the opensim main application project (do we want it there or here?)
57/*
58 public class OpenSimMain : OpenSimApplicationBase , conscmd_callback
59 {
60
61 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
62 {
63 this.configFileSetup = useConfigFile;
64 m_sandbox = sandBoxMode;
65 m_loginserver = startLoginServer;
66 m_physicsEngine = physicsEngine;
67 m_config = configFile;
68
69 m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent);
70 OpenSim.Framework.Console.MainConsole.Instance = m_console;
71 }
72
73 /// <summary>
74 /// Performs initialisation of the world, such as loading configuration from disk.
75 /// </summary>
76 public override void StartUp()
77 {
78 this.regionData = new RegionInfo();
79 try
80 {
81 this.localConfig = new XmlConfig(m_config);
82 this.localConfig.LoadData();
83 }
84 catch (Exception e)
85 {
86 Console.WriteLine(e.Message);
87 }
88 if (this.configFileSetup)
89 {
90 this.SetupFromConfigFile(this.localConfig);
91 }
92 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration");
93 this.regionData.InitConfig(this.m_sandbox, this.localConfig);
94 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
95
96 GridServers = new Grid();
97 if (m_sandbox)
98 {
99 this.SetupLocalGridServers();
100 //Authenticate Session Handler
101 AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal();
102 this.AuthenticateSessionsHandler = authen;
103 }
104 else
105 {
106 this.SetupRemoteGridServers();
107 //Authenticate Session Handler
108 AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote();
109 this.AuthenticateSessionsHandler = authen;
110 }
111
112 startuptime = DateTime.Now;
113
114 try
115 {
116 AssetCache = new AssetCache(GridServers.AssetServer);
117 InventoryCache = new InventoryCache();
118 }
119 catch (Exception e)
120 {
121 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache");
122 Environment.Exit(1);
123 }
124
125 m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler);
126
127 //should be passing a IGenericConfig object to these so they can read the config data they want from it
128 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
129 IGridServer gridServer = GridServers.GridServer;
130 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
131
132 if (!m_sandbox)
133 {
134 this.ConnectToRemoteGridServer();
135 }
136
137 this.SetupLocalWorld();
138
139 if (m_sandbox)
140 {
141 AssetCache.LoadDefaultTextureSet();
142 }
143
144 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server");
145
146 this.SetupHttpListener();
147
148 LoginServer loginServer = null;
149 LoginServer adminLoginServer = null;
150
151 bool sandBoxWithLoginServer = m_loginserver && m_sandbox;
152 if (sandBoxWithLoginServer)
153 {
154 loginServer = new LoginServer( regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts);
155 loginServer.Startup();
156 loginServer.SetSessionHandler(((AuthenticateSessionsLocal) this.AuthenticateSessionsHandler).AddNewSession);
157
158 if (user_accounts)
159 {
160 //sandbox mode with loginserver using accounts
161 this.GridServers.UserServer = loginServer;
162 adminLoginServer = loginServer;
163
164 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
165 }
166 else
167 {
168 //sandbox mode with loginserver not using accounts
169 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
170 }
171 }
172
173 AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer);
174 adminWebFront.LoadMethods(httpServer);
175
176 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP server");
177 httpServer.Start();
178
179 //MainServerListener();
180 this.m_udpServer.ServerListener();
181
182 m_heartbeatTimer.Enabled = true;
183 m_heartbeatTimer.Interval = 100;
184 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
185 }
186
187 # region Setup methods
188 protected virtual void SetupLocalGridServers()
189 {
190 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
191 GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
192
193 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Sandbox mode");
194
195 try
196 {
197 GridServers.Initialise();
198 }
199 catch (Exception e)
200 {
201 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface");
202 Environment.Exit(1);
203 }
204 }
205
206 protected virtual void SetupRemoteGridServers()
207 {
208 if (this.gridLocalAsset)
209 {
210 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
211 }
212 else
213 {
214 GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
215 }
216 GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
217
218 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Grid mode");
219
220 try
221 {
222 GridServers.Initialise();
223 }
224 catch (Exception e)
225 {
226 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface");
227 Environment.Exit(1);
228 }
229 }
230
231 protected virtual void SetupLocalWorld()
232 {
233 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString());
234 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world");
235 m_console.componentname = "Region " + regionData.RegionName;
236
237 m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName);
238 LocalWorld.InventoryCache = InventoryCache;
239 LocalWorld.AssetCache = AssetCache;
240
241 this.m_udpServer.LocalWorld = LocalWorld;
242 this.m_udpServer.PacketServer.RegisterClientPacketHandlers();
243
244 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
245 this.physManager.LoadPlugins();
246
247 LocalWorld.m_datastore = this.regionData.DataStore;
248
249 LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
250 LocalWorld.LoadWorldMap();
251
252 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system");
253 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
254 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D());
255 LocalWorld.LoadPrimsFromStorage();
256 }
257
258 protected virtual void SetupHttpListener()
259 {
260 httpServer = new BaseHttpServer(regionData.IPListenPort);
261
262 if (this.GridServers.GridServer.GetName() == "Remote")
263 {
264
265 // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
266 httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler).ExpectUser );
267
268 httpServer.AddXmlRPCHandler("agent_crossing",
269 delegate(XmlRpcRequest request)
270 {
271 Hashtable requestData = (Hashtable)request.Params[0];
272 AgentCircuitData agent_data = new AgentCircuitData();
273 agent_data.firstname = (string)requestData["firstname"];
274 agent_data.lastname = (string)requestData["lastname"];
275 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
276 agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"]));
277
278 if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode))
279 {
280 ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname;
281 ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname;
282 ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos;
283 }
284
285 return new XmlRpcResponse();
286 });
287
288 httpServer.AddRestHandler("GET", "/simstatus/",
289 delegate(string request, string path, string param)
290 {
291 return "OK";
292 });
293 }
294 }
295
296 protected virtual void ConnectToRemoteGridServer()
297 {
298 if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort))
299 {
300 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Success: Got a grid connection OK!");
301 }
302 else
303 {
304 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down.");
305 Shutdown();
306 }
307
308 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
309
310 // If we are being told to load a file, load it.
311 string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"];
312
313 if (!String.IsNullOrEmpty(dataUri))
314 {
315 this.LocalWorld.m_datastore = dataUri;
316 }
317
318 if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "")
319 {
320 // The grid server has told us who we are
321 // We must obey the grid server.
322 try
323 {
324 regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString());
325 regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString());
326 regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
327 }
328 catch (Exception e)
329 {
330 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!");
331 Environment.Exit(1);
332 }
333 }
334 }
335
336 #endregion
337
338 private void SetupFromConfigFile(IGenericConfig configData)
339 {
340 try
341 {
342 // SandBoxMode
343 string attri = "";
344 attri = configData.GetAttribute("SandBox");
345 if ((attri == "") || ((attri != "false") && (attri != "true")))
346 {
347 this.m_sandbox = false;
348 configData.SetAttribute("SandBox", "false");
349 }
350 else
351 {
352 this.m_sandbox = Convert.ToBoolean(attri);
353 }
354
355 // LoginServer
356 attri = "";
357 attri = configData.GetAttribute("LoginServer");
358 if ((attri == "") || ((attri != "false") && (attri != "true")))
359 {
360 this.m_loginserver = false;
361 configData.SetAttribute("LoginServer", "false");
362 }
363 else
364 {
365 this.m_loginserver = Convert.ToBoolean(attri);
366 }
367
368 // Sandbox User accounts
369 attri = "";
370 attri = configData.GetAttribute("UserAccount");
371 if ((attri == "") || ((attri != "false") && (attri != "true")))
372 {
373 this.user_accounts = false;
374 configData.SetAttribute("UserAccounts", "false");
375 }
376 else if (attri == "true")
377 {
378 this.user_accounts = Convert.ToBoolean(attri);
379 }
380
381 // Grid mode hack to use local asset server
382 attri = "";
383 attri = configData.GetAttribute("LocalAssets");
384 if ((attri == "") || ((attri != "false") && (attri != "true")))
385 {
386 this.gridLocalAsset = false;
387 configData.SetAttribute("LocalAssets", "false");
388 }
389 else if (attri == "true")
390 {
391 this.gridLocalAsset = Convert.ToBoolean(attri);
392 }
393
394
395 attri = "";
396 attri = configData.GetAttribute("PhysicsEngine");
397 switch (attri)
398 {
399 default:
400 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
401 Environment.Exit(1);
402 break;
403
404 case "":
405 this.m_physicsEngine = "basicphysics";
406 configData.SetAttribute("PhysicsEngine", "basicphysics");
407 OpenSim.world.Avatar.PhysicsEngineFlying = false;
408 break;
409
410 case "basicphysics":
411 this.m_physicsEngine = "basicphysics";
412 configData.SetAttribute("PhysicsEngine", "basicphysics");
413 OpenSim.world.Avatar.PhysicsEngineFlying = false;
414 break;
415
416 case "RealPhysX":
417 this.m_physicsEngine = "RealPhysX";
418 OpenSim.world.Avatar.PhysicsEngineFlying = true;
419 break;
420
421 case "OpenDynamicsEngine":
422 this.m_physicsEngine = "OpenDynamicsEngine";
423 OpenSim.world.Avatar.PhysicsEngineFlying = true;
424 break;
425 }
426
427 configData.Commit();
428 }
429 catch (Exception e)
430 {
431 Console.WriteLine(e.Message);
432 Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data");
433 Console.WriteLine("Can not continue starting up");
434 Environment.Exit(1);
435 }
436 }
437
438 /// <summary>
439 /// Performs any last-minute sanity checking and shuts down the region server
440 /// </summary>
441 public virtual void Shutdown()
442 {
443 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing all threads");
444 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing listener thread");
445 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients");
446 // IMPLEMENT THIS
447 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating");
448 LocalWorld.Close();
449 GridServers.Close();
450 m_console.Close();
451 Environment.Exit(0);
452 }
453
454 /// <summary>
455 /// Performs per-frame updates regularly
456 /// </summary>
457 /// <param name="sender"></param>
458 /// <param name="e"></param>
459 void Heartbeat(object sender, System.EventArgs e)
460 {
461 LocalWorld.Update();
462 }
463
464 #region Console Commands
465 /// <summary>
466 /// Runs commands issued by the server console from the operator
467 /// </summary>
468 /// <param name="command">The first argument of the parameter (the command)</param>
469 /// <param name="cmdparams">Additional arguments passed to the command</param>
470 public void RunCmd(string command, string[] cmdparams)
471 {
472 switch (command)
473 {
474 case "help":
475 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "show users - show info about connected users");
476 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - disconnect all clients and shutdown");
477 break;
478
479 case "show":
480 Show(cmdparams[0]);
481 break;
482
483 case "terrain":
484 string result = "";
485 if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result))
486 {
487 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result);
488 }
489 break;
490
491 case "shutdown":
492 Shutdown();
493 break;
494
495 default:
496 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "Unknown command");
497 break;
498 }
499 }
500
501 /// <summary>
502 /// Outputs to the console information about the region
503 /// </summary>
504 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param>
505 public void Show(string ShowWhat)
506 {
507 switch (ShowWhat)
508 {
509 case "uptime":
510 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "OpenSim has been running since " + startuptime.ToString());
511 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "That is " + (DateTime.Now - startuptime).ToString());
512 break;
513 case "users":
514 OpenSim.world.Avatar TempAv;
515 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP"));
516 foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys)
517 {
518 if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
519 {
520 TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID];
521 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
522 }
523 }
524 break;
525 }
526 }
527 #endregion
528 }
529
530 */
531}
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs
index 15ee740..202b7f7 100644
--- a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs
+++ b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs
@@ -4,15 +4,16 @@ using System.Text;
4using System.Net; 4using System.Net;
5using System.Net.Sockets; 5using System.Net.Sockets;
6using libsecondlife; 6using libsecondlife;
7using OpenSim.Framework.Interfaces; 7
8 8
9namespace OpenSim 9namespace OpenSim
10{ 10{
11
11 public interface OpenSimNetworkHandler 12 public interface OpenSimNetworkHandler
12 { 13 {
13 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); 14 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
14 void RemoveClientCircuit(uint circuitcode); 15 void RemoveClientCircuit(uint circuitcode);
15 void RegisterPacketServer(PacketServer server); 16 void RegisterPacketServer(PacketServer server);
16 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
17 } 17 }
18
18} 19}
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs
index 6c6f4ca..dd8de4c 100644
--- a/OpenSim/OpenSim.RegionServer/PacketServer.cs
+++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs
@@ -1,16 +1,20 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.world;
5using libsecondlife.Packets; 4using libsecondlife.Packets;
5using OpenSim.Framework.Interfaces;
6using System.Net;
7using System.Net.Sockets;
8using OpenSim.Assets;
6 9
7namespace OpenSim 10namespace OpenSim
8{ 11{
9 public class PacketServer 12 public class PacketServer
10 { 13 {
11 private OpenSimNetworkHandler _networkHandler; 14 private OpenSimNetworkHandler _networkHandler;
12 private World _localWorld; 15 private IWorld _localWorld;
13 public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>(); 16 public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>();
17 public Dictionary<uint, IClientAPI> ClientAPIs = new Dictionary<uint, IClientAPI>();
14 18
15 public PacketServer(OpenSimNetworkHandler networkHandler) 19 public PacketServer(OpenSimNetworkHandler networkHandler)
16 { 20 {
@@ -18,7 +22,7 @@ namespace OpenSim
18 _networkHandler.RegisterPacketServer(this); 22 _networkHandler.RegisterPacketServer(this);
19 } 23 }
20 24
21 public World LocalWorld 25 public IWorld LocalWorld
22 { 26 {
23 set 27 set
24 { 28 {
@@ -59,27 +63,23 @@ namespace OpenSim
59 63
60 } 64 }
61 65
62 #region Client Packet Handlers 66 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass)
63
64 public bool RequestUUIDName(ClientView simClient, Packet packet)
65 { 67 {
66 System.Text.Encoding enc = System.Text.Encoding.ASCII; 68 ClientView newuser = new ClientView(epSender, useCircuit, this.ClientThreads, assetCache, this, inventoryCache, authenticateSessionsClass);
67 Console.WriteLine(packet.ToString()); 69 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
68 UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet; 70 this.ClientAPIs.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser);
69 UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
70 nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
71 71
72 for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
73 {
74 nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
75 nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
76 nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name
77 nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up
78 }
79 simClient.OutPacket(nameReply);
80 return true; 72 return true;
81 } 73 }
82 74
83 #endregion 75 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
76 {
77 this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
78 }
79
80 public virtual void RemoveClientCircuit(uint circuitcode)
81 {
82 this._networkHandler.RemoveClientCircuit(circuitcode);
83 }
84 } 84 }
85} 85}
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs
index 76f05b6..d148d0f 100644
--- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs
+++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs
@@ -7,22 +7,13 @@ using System.IO;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Utilities; 8using OpenSim.Framework.Utilities;
9using libsecondlife; 9using libsecondlife;
10using OpenSim.Framework.Types;
10 11
11namespace OpenSim 12namespace OpenSim
12{ 13{
13 public class RegionInfo : RegionInfoBase 14 public class RegionInfo : RegionInfoBase
14 { 15 {
15 //following should be removed and the GenericConfig object passed around, 16
16 //so each class (AssetServer, GridServer etc) can access what config data they want
17 public string AssetURL = "http://127.0.0.1:8003/";
18 public string AssetSendKey = "";
19
20 public string GridURL = "";
21 public string GridSendKey = "";
22 public string GridRecvKey = "";
23 public string UserURL = "";
24 public string UserSendKey = "";
25 public string UserRecvKey = "";
26 private bool isSandbox; 17 private bool isSandbox;
27 18
28 public string DataStore; 19 public string DataStore;
@@ -129,62 +120,7 @@ namespace OpenSim
129 this.IPListenAddr = attri; 120 this.IPListenAddr = attri;
130 } 121 }
131 122
132 if (!isSandbox) 123
133 {
134 //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object
135
136 //Grid Server URL
137 attri = "";
138 attri = configData.GetAttribute("GridServerURL");
139 if (attri == "")
140 {
141 this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/");
142 configData.SetAttribute("GridServerURL", this.GridURL);
143 }
144 else
145 {
146 this.GridURL = attri;
147 }
148
149 //Grid Send Key
150 attri = "";
151 attri = configData.GetAttribute("GridSendKey");
152 if (attri == "")
153 {
154 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null");
155 configData.SetAttribute("GridSendKey", this.GridSendKey);
156 }
157 else
158 {
159 this.GridSendKey = attri;
160 }
161
162 //Grid Receive Key
163 attri = "";
164 attri = configData.GetAttribute("GridRecvKey");
165 if (attri == "")
166 {
167 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null");
168 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
169 }
170 else
171 {
172 this.GridRecvKey = attri;
173 }
174
175 attri = "";
176 attri = configData.GetAttribute("AssetServerURL");
177 if (attri == "")
178 {
179 this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
180 configData.SetAttribute("AssetServerURL", this.GridURL);
181 }
182 else
183 {
184 this.AssetURL = attri;
185 }
186
187 }
188 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); 124 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
189 125
190 configData.Commit(); 126 configData.Commit();
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs
deleted file mode 100644
index 42d3030..0000000
--- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs
+++ /dev/null
@@ -1,32 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.Web;
6using System.IO;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Utilities;
9using libsecondlife;
10
11namespace OpenSim
12{
13 public class RegionInfoBase
14 {
15 public LLUUID SimUUID;
16 public string RegionName;
17 public uint RegionLocX;
18 public uint RegionLocY;
19 public ulong RegionHandle;
20 public ushort RegionWaterHeight = 20;
21 public bool RegionTerraform = true;
22
23 public int IPListenPort;
24 public string IPListenAddr;
25
26 public RegionInfoBase()
27 {
28
29 }
30 }
31
32}
diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
index 69a8748..7f18d34 100644
--- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
+++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
@@ -10,7 +10,6 @@ using System.Collections;
10using System.Collections.Generic; 10using System.Collections.Generic;
11using libsecondlife; 11using libsecondlife;
12using libsecondlife.Packets; 12using libsecondlife.Packets;
13using OpenSim.world;
14using OpenSim.Terrain; 13using OpenSim.Terrain;
15using OpenSim.Framework.Interfaces; 14using OpenSim.Framework.Interfaces;
16using OpenSim.Framework.Types; 15using OpenSim.Framework.Types;
@@ -29,14 +28,12 @@ namespace OpenSim
29 { 28 {
30 protected IGenericConfig localConfig; 29 protected IGenericConfig localConfig;
31 protected PhysicsManager physManager; 30 protected PhysicsManager physManager;
32 protected Grid GridServers;
33 protected AssetCache AssetCache; 31 protected AssetCache AssetCache;
34 protected InventoryCache InventoryCache; 32 protected InventoryCache InventoryCache;
35 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 33 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
36 protected DateTime startuptime; 34 protected DateTime startuptime;
37 protected RegionInfo regionData; 35 protected NetworkServersInfo serversData;
38 36
39 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
40 public string m_physicsEngine; 37 public string m_physicsEngine;
41 public bool m_sandbox = false; 38 public bool m_sandbox = false;
42 public bool m_loginserver; 39 public bool m_loginserver;
@@ -45,7 +42,9 @@ namespace OpenSim
45 protected bool configFileSetup = false; 42 protected bool configFileSetup = false;
46 public string m_config; 43 public string m_config;
47 44
48 protected UDPServer m_udpServer; 45 protected List<UDPServer> m_udpServer = new List<UDPServer>();
46 protected List<RegionInfo> regionData = new List<RegionInfo>();
47 protected List<IWorld> m_localWorld = new List<IWorld>();
49 protected BaseHttpServer httpServer; 48 protected BaseHttpServer httpServer;
50 protected AuthenticateSessionsBase AuthenticateSessionsHandler; 49 protected AuthenticateSessionsBase AuthenticateSessionsHandler;
51 50
@@ -65,11 +64,11 @@ namespace OpenSim
65 m_config = configFile; 64 m_config = configFile;
66 } 65 }
67 66
68 protected World m_localWorld; 67 /*protected World m_localWorld;
69 public World LocalWorld 68 public World LocalWorld
70 { 69 {
71 get { return m_localWorld; } 70 get { return m_localWorld; }
72 } 71 }*/
73 72
74 /// <summary> 73 /// <summary>
75 /// Performs initialisation of the world, such as loading configuration from disk. 74 /// Performs initialisation of the world, such as loading configuration from disk.
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs
index 3a93e66..8ec5af1 100644
--- a/OpenSim/OpenSim.RegionServer/UDPServer.cs
+++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs
@@ -10,7 +10,6 @@ using System.Collections;
10using System.Collections.Generic; 10using System.Collections.Generic;
11using libsecondlife; 11using libsecondlife;
12using libsecondlife.Packets; 12using libsecondlife.Packets;
13using OpenSim.world;
14using OpenSim.Terrain; 13using OpenSim.Terrain;
15using OpenSim.Framework.Interfaces; 14using OpenSim.Framework.Interfaces;
16using OpenSim.Framework.Types; 15using OpenSim.Framework.Types;
@@ -24,7 +23,6 @@ using OpenSim.GenericConfig;
24 23
25namespace OpenSim 24namespace OpenSim
26{ 25{
27 public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode);
28 26
29 public class UDPServer : OpenSimNetworkHandler 27 public class UDPServer : OpenSimNetworkHandler
30 { 28 {
@@ -39,18 +37,12 @@ namespace OpenSim
39 protected PacketServer _packetServer; 37 protected PacketServer _packetServer;
40 38
41 protected int listenPort; 39 protected int listenPort;
42 protected Grid m_gridServers; 40 protected IWorld m_localWorld;
43 protected World m_localWorld;
44 protected AssetCache m_assetCache; 41 protected AssetCache m_assetCache;
45 protected InventoryCache m_inventoryCache; 42 protected InventoryCache m_inventoryCache;
46 protected RegionInfo m_regionData;
47 protected bool m_sandbox = false;
48 protected bool user_accounts = false;
49 protected ConsoleBase m_console; 43 protected ConsoleBase m_console;
50 protected AuthenticateSessionsBase m_authenticateSessionsClass; 44 protected AuthenticateSessionsBase m_authenticateSessionsClass;
51 45
52 public AuthenticateSessionHandler AuthenticateHandler;
53
54 public PacketServer PacketServer 46 public PacketServer PacketServer
55 { 47 {
56 get 48 get
@@ -63,7 +55,7 @@ namespace OpenSim
63 } 55 }
64 } 56 }
65 57
66 public World LocalWorld 58 public IWorld LocalWorld
67 { 59 {
68 set 60 set
69 { 61 {
@@ -76,21 +68,15 @@ namespace OpenSim
76 { 68 {
77 } 69 }
78 70
79 public UDPServer(int port, Grid gridServers, AssetCache assetCache, InventoryCache inventoryCache, RegionInfo _regionData, bool sandbox, bool accounts, ConsoleBase console, AuthenticateSessionsBase authenticateClass) 71 public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, ConsoleBase console, AuthenticateSessionsBase authenticateClass)
80 { 72 {
81 listenPort = port; 73 listenPort = port;
82 this.m_gridServers = gridServers;
83 this.m_assetCache = assetCache; 74 this.m_assetCache = assetCache;
84 this.m_inventoryCache = inventoryCache; 75 this.m_inventoryCache = inventoryCache;
85 this.m_regionData = _regionData;
86 this.m_sandbox = sandbox;
87 this.user_accounts = accounts;
88 this.m_console = console; 76 this.m_console = console;
89 this.m_authenticateSessionsClass = authenticateClass; 77 this.m_authenticateSessionsClass = authenticateClass;
90 this.CreatePacketServer(); 78 this.CreatePacketServer();
91 79
92 //set up delegate for authenticate sessions
93 this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_authenticateSessionsClass.AuthenticateSession);
94 } 80 }
95 81
96 protected virtual void CreatePacketServer() 82 protected virtual void CreatePacketServer()
@@ -131,15 +117,8 @@ namespace OpenSim
131 { 117 {
132 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 118 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
133 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 119 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
134 bool isChildAgent = false;
135 120
136 ClientView newuser = new ClientView(epSender, useCircuit, m_localWorld, _packetServer.ClientThreads, m_assetCache, m_gridServers.GridServer, this, m_inventoryCache, m_sandbox, isChildAgent, this.m_regionData, m_authenticateSessionsClass); 121 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass);
137 if ((this.m_gridServers.UserServer != null) && (user_accounts))
138 {
139 newuser.UserServer = this.m_gridServers.UserServer;
140 }
141 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
142 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
143 } 122 }
144 123
145 public void ServerListener() 124 public void ServerListener()
@@ -197,9 +176,6 @@ namespace OpenSim
197 } 176 }
198 } 177 }
199 178
200 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) 179
201 {
202 return this.AuthenticateHandler(sessionID, agentID, circuitCode);
203 }
204 } 180 }
205} \ No newline at end of file 181} \ No newline at end of file
diff --git a/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs b/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs
new file mode 100644
index 0000000..9f6abe9
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim
6{
7 public class UserConfigUtility
8 {
9 }
10}
diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs
index 49cc6a5..38b6685 100644
--- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs
+++ b/OpenSim/OpenSim.RegionServer/VersionInfo.cs
@@ -32,6 +32,6 @@ namespace OpenSim
32 /// </summary> 32 /// </summary>
33 public class VersionInfo 33 public class VersionInfo
34 { 34 {
35 public static string Version = "0.2, SVN build - please use releng if you desire any form of support"; 35 public static string Version = "0.2, SVN build ";
36 } 36 }
37} 37}