aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJohan Berntsson2008-03-04 05:31:54 +0000
committerJohan Berntsson2008-03-04 05:31:54 +0000
commit279e0061c515ee0a03036bef68eea9738273d785 (patch)
tree4502228eb7b87a760e0b0e67aded9d1d870d0bed /OpenSim/Framework
parentAdded copyright heaaders. Minor cleanup. (diff)
downloadopensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.zip
opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.gz
opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.bz2
opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.xz
Merged 3Di code that provides scene and avatar serialization, and plugin support for region move/split/merge. See ThirdParty/3Di/README.txt. Unless the new modules are used there should be no noticeable changes when running OpenSim.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarWearable.cs35
-rw-r--r--OpenSim/Framework/BlockingQueue.cs5
-rw-r--r--OpenSim/Framework/ClientManager.cs2
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs28
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs42
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql3
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql3
-rw-r--r--OpenSim/Framework/Data/RegionProfileData.cs10
-rw-r--r--OpenSim/Framework/IClientAPI.cs19
-rw-r--r--OpenSim/Framework/IScene.cs5
-rw-r--r--OpenSim/Framework/PacketPool.cs104
-rw-r--r--OpenSim/Framework/RegionInfo.cs23
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs60
-rw-r--r--OpenSim/Framework/Util.cs58
14 files changed, 340 insertions, 57 deletions
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index c7083f3..e7c2338 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -26,10 +26,14 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using System;
30using System.Runtime.Serialization;
31using System.Security.Permissions;
29 32
30namespace OpenSim.Framework 33namespace OpenSim.Framework
31{ 34{
32 public class AvatarWearable 35 [Serializable]
36 public class AvatarWearable : ISerializable
33 { 37 {
34 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); 38 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
35 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); 39 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
@@ -67,5 +71,32 @@ namespace OpenSim.Framework
67 return defaultWearables; 71 return defaultWearables;
68 } 72 }
69 } 73 }
74 protected AvatarWearable(SerializationInfo info, StreamingContext context)
75 {
76 //System.Console.WriteLine("AvatarWearable Deserialize BGN");
77 if (info == null)
78 {
79 throw new System.ArgumentNullException("info");
80 }
81
82 AssetID = new LLUUID((Guid)info.GetValue("AssetID", typeof(Guid)));
83 ItemID = new LLUUID((Guid)info.GetValue("ItemID", typeof(Guid)));
84
85 //System.Console.WriteLine("AvatarWearable Deserialize END");
86 }
87
88 [SecurityPermission(SecurityAction.LinkDemand,
89 Flags = SecurityPermissionFlag.SerializationFormatter)]
90 public virtual void GetObjectData(
91 SerializationInfo info, StreamingContext context)
92 {
93 if (info == null)
94 {
95 throw new System.ArgumentNullException("info");
96 }
97
98 info.AddValue("AssetID", AssetID.UUID);
99 info.AddValue("ItemID", ItemID.UUID);
100 }
70 } 101 }
71} \ No newline at end of file 102}
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
index e72884c..6f56782 100644
--- a/OpenSim/Framework/BlockingQueue.cs
+++ b/OpenSim/Framework/BlockingQueue.cs
@@ -69,5 +69,10 @@ namespace OpenSim.Framework
69 { 69 {
70 return m_queue.Count; 70 return m_queue.Count;
71 } 71 }
72
73 public T[] GetQueueArray()
74 {
75 return m_queue.ToArray();
76 }
72 } 77 }
73} 78}
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index cfdcbf0..39d8d99 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Framework
137 } 137 }
138 } 138 }
139 139
140 private uint[] GetAllCircuits(LLUUID agentId) 140 public uint[] GetAllCircuits(LLUUID agentId)
141 { 141 {
142 List<uint> circuits = new List<uint>(); 142 List<uint> circuits = new List<uint>();
143 // Wasteful, I know 143 // Wasteful, I know
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 3737e48..eefb4e9 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -97,6 +97,11 @@ namespace OpenSim.Framework.Data.MySQL
97 database.ExecuteResourceSql("CreateRegionsTable.sql"); 97 database.ExecuteResourceSql("CreateRegionsTable.sql");
98 return; 98 return;
99 } 99 }
100 else if (oldVersion.Contains("Rev. 1"))
101 {
102 database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql");
103 return;
104 }
100 } 105 }
101 106
102 #endregion 107 #endregion
@@ -260,6 +265,27 @@ namespace OpenSim.Framework.Data.MySQL
260 } 265 }
261 266
262 /// <summary> 267 /// <summary>
268 /// Deletes a profile from the database
269 /// </summary>
270 /// <param name="profile">The profile to delete</param>
271 /// <returns>Successful?</returns>
272 //public DataResponse DeleteProfile(RegionProfileData profile)
273 public DataResponse DeleteProfile(string uuid)
274 {
275 lock (database)
276 {
277 if (database.deleteRegion(uuid))
278 {
279 return DataResponse.RESPONSE_OK;
280 }
281 else
282 {
283 return DataResponse.RESPONSE_ERROR;
284 }
285 }
286 }
287
288 /// <summary>
263 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. 289 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
264 /// </summary> 290 /// </summary>
265 /// <param name="uuid">The UUID of the challenger</param> 291 /// <param name="uuid">The UUID of the challenger</param>
@@ -328,4 +354,4 @@ namespace OpenSim.Framework.Data.MySQL
328 } 354 }
329 } 355 }
330 } 356 }
331} \ No newline at end of file 357}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index ea11aa0..0410643 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -301,6 +301,7 @@ namespace OpenSim.Framework.Data.MySQL
301 301
302 // non-critical parts 302 // non-critical parts
303 retval.regionName = (string)reader["regionName"]; 303 retval.regionName = (string)reader["regionName"];
304 retval.originUUID = new LLUUID((string) reader["originUUID"]);
304 305
305 // Secrets 306 // Secrets
306 retval.regionRecvKey = (string) reader["regionRecvKey"]; 307 retval.regionRecvKey = (string) reader["regionRecvKey"];
@@ -752,13 +753,13 @@ namespace OpenSim.Framework.Data.MySQL
752 // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql, 753 // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql,
753 // as well as the related parameterization 754 // as well as the related parameterization
754 sql += 755 sql +=
755 "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid) VALUES "; 756 "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID) VALUES ";
756 757
757 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; 758 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
758 sql += 759 sql +=
759 "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; 760 "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
760 sql += 761 sql +=
761 "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid)"; 762 "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid, ?originUUID)";
762 763
763 if (GRID_ONLY_UPDATE_NECESSARY_DATA) 764 if (GRID_ONLY_UPDATE_NECESSARY_DATA)
764 { 765 {
@@ -798,6 +799,7 @@ namespace OpenSim.Framework.Data.MySQL
798 parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); 799 parameters["?serverHttpPort"] = regiondata.httpPort.ToString();
799 parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); 800 parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString();
800 parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); 801 parameters["?owner_uuid"] = regiondata.owner_uuid.ToString();
802 parameters["?originUUID"] = regiondata.originUUID.ToString();
801 803
802 bool returnval = false; 804 bool returnval = false;
803 805
@@ -821,5 +823,41 @@ namespace OpenSim.Framework.Data.MySQL
821 823
822 return returnval; 824 return returnval;
823 } 825 }
826 /// <summary>
827 /// Delete a region from the database
828 /// </summary>
829 /// <param name="profile">The region to insert</param>
830 /// <returns>Success?</returns>
831 //public bool deleteRegion(RegionProfileData regiondata)
832 public bool deleteRegion(string uuid)
833 {
834 bool returnval = false;
835
836 string sql =
837 "DELETE FROM regions WHERE uuid = ?uuid;";
838
839 Dictionary<string, string> parameters = new Dictionary<string, string>();
840
841 try
842 {
843 parameters["?uuid"] = uuid;
844
845 IDbCommand result = Query(sql, parameters);
846
847 int x;
848 if ((x = result.ExecuteNonQuery()) > 0)
849 {
850 returnval = true;
851 }
852 result.Dispose();
853 }
854 catch (Exception e)
855 {
856 m_log.Error(e.ToString());
857 return false;
858 }
859
860 return returnval;
861 }
824 } 862 }
825} 863}
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
index 07b0d9b..23535af 100644
--- a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
@@ -23,8 +23,9 @@ CREATE TABLE `regions` (
23 `regionUserRecvKey` varchar(128) default NULL, 23 `regionUserRecvKey` varchar(128) default NULL,
24 `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, 24 `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
25 `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, 25 `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL,
26 `originUUID` varchar(36),
26 PRIMARY KEY (`uuid`), 27 PRIMARY KEY (`uuid`),
27 KEY `regionName` (`regionName`), 28 KEY `regionName` (`regionName`),
28 KEY `regionHandle` (`regionHandle`), 29 KEY `regionHandle` (`regionHandle`),
29 KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) 30 KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
30) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 1'; 31) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 2';
diff --git a/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql
new file mode 100644
index 0000000..5880954
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql
@@ -0,0 +1,3 @@
1ALTER TABLE `regions`
2 ADD COLUMN `originUUID` varchar(36),
3COMMENT='Rev. 2';
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs
index f9f4283..e4b48b7 100644
--- a/OpenSim/Framework/Data/RegionProfileData.cs
+++ b/OpenSim/Framework/Data/RegionProfileData.cs
@@ -130,6 +130,12 @@ namespace OpenSim.Framework.Data
130 public LLUUID owner_uuid = LLUUID.Zero; 130 public LLUUID owner_uuid = LLUUID.Zero;
131 131
132 /// <summary> 132 /// <summary>
133 /// OGS/OpenSim Specific original ID for a region after move/split
134 /// </summary>
135 public LLUUID originUUID;
136
137
138 /// <summary>
133 /// Get Sim profile data from grid server when in grid mode 139 /// Get Sim profile data from grid server when in grid mode
134 /// </summary> 140 /// </summary>
135 /// <param name="region_uuid"></param> 141 /// <param name="region_uuid"></param>
@@ -162,7 +168,7 @@ namespace OpenSim.Framework.Data
162 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); 168 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
163 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); 169 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
164 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); 170 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
165 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; 171 simData.serverURI = (string)responseData["server_uri"];
166 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; 172 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
167 simData.UUID = new LLUUID((string) responseData["region_UUID"]); 173 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
168 simData.regionName = (string) responseData["region_name"]; 174 simData.regionName = (string) responseData["region_name"];
@@ -205,7 +211,7 @@ namespace OpenSim.Framework.Data
205 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); 211 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
206 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); 212 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
207 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; 213 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
208 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; 214 simData.serverURI = (string)responseData["server_uri"];
209 simData.UUID = new LLUUID((string) responseData["region_UUID"]); 215 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
210 simData.regionName = (string) responseData["region_name"]; 216 simData.regionName = (string) responseData["region_name"];
211 217
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 5001f00..7a0a232 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -665,5 +665,24 @@ namespace OpenSim.Framework
665 void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message); 665 void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message);
666 666
667 void SendLogoutPacket(); 667 void SendLogoutPacket();
668 ClientInfo GetClientInfo();
669 void SetClientInfo(ClientInfo info);
670 void Terminate();
671 }
672
673 [Serializable]
674 public class ClientInfo
675 {
676 public byte[] usecircuit;
677 public EndPoint userEP;
678 public EndPoint proxyEP;
679 public sAgentCircuitData agentcircuit;
680
681 public Dictionary<uint, uint> pendingAcks;
682 public Dictionary<uint, byte[]> needAck;
683
684 public List<byte[]> out_packets;
685
686 public uint sequence;
668 } 687 }
669} 688}
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 3445050..0bb0efb 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -38,7 +38,8 @@ namespace OpenSim.Framework
38 Down = 0, 38 Down = 0,
39 Up = 1, 39 Up = 1,
40 Crashed = 2, 40 Crashed = 2,
41 Starting = 3 41 Starting = 3,
42 SlaveScene = 4
42 } ; 43 } ;
43 44
44 public interface IScene 45 public interface IScene
@@ -63,4 +64,4 @@ namespace OpenSim.Framework
63 64
64 ClientManager ClientManager { get; } 65 ClientManager ClientManager { get; }
65 } 66 }
66} \ No newline at end of file 67}
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs
index 30b6d6a..2c44ae3 100644
--- a/OpenSim/Framework/PacketPool.cs
+++ b/OpenSim/Framework/PacketPool.cs
@@ -26,6 +26,7 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Net;
29using System.Collections; 30using System.Collections;
30using libsecondlife.Packets; 31using libsecondlife.Packets;
31 32
@@ -33,29 +34,68 @@ namespace OpenSim.Framework
33{ 34{
34 public sealed class PacketPool 35 public sealed class PacketPool
35 { 36 {
37 static public void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP)
38 {
39 if( numBytes > 4090 ) // max UPD size = 4096
40 {
41 throw new Exception("ERROR: No space to encode the proxy EP");
42 }
43
44 ushort port = (ushort) ((IPEndPoint) trueEP).Port;
45 bytes[numBytes++] = (byte)(port % 256);
46 bytes[numBytes++] = (byte)(port / 256);
47
48 foreach (byte b in ((IPEndPoint)trueEP).Address.GetAddressBytes())
49 {
50 bytes[numBytes++] = b;
51 }
52
53 int x = numBytes;
54
55 DecodeProxyMessage(bytes, ref numBytes);
56
57 numBytes = x;
58 }
59
60 static public EndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)
61 {
62 // IPv4 Only
63 byte[] addr = new byte[4];
64
65 addr[3] = bytes[--numBytes];
66 addr[2] = bytes[--numBytes];
67 addr[1] = bytes[--numBytes];
68 addr[0] = bytes[--numBytes];
69
70 ushort port = (ushort)(bytes[--numBytes] * 256);
71 port += (ushort)bytes[--numBytes];
72
73 return (EndPoint) new IPEndPoint(new IPAddress(addr), (int)port);
74 }
75
36 // Set up a thread-safe singleton pattern 76 // Set up a thread-safe singleton pattern
37 static PacketPool() 77 static PacketPool()
38 { 78 {
39 } 79 }
40 80
41 private static readonly PacketPool instance = new PacketPool(); 81 static readonly PacketPool instance = new PacketPool();
42 82
43 public static PacketPool Instance 83 public static PacketPool Instance
44 { 84 {
45 get { return instance; } 85 get
86 {
87 return instance;
88 }
46 } 89 }
47 90
48 private Hashtable pool = new Hashtable(); 91 private Hashtable pool = new Hashtable();
49 92
50 public Packet GetPacket(PacketType type) 93 public Packet GetPacket(PacketType type) {
51 {
52 return Packet.BuildPacket(type);
53/* Skip until PacketPool performance problems have been resolved (mantis 281)
54 Packet packet = null; 94 Packet packet = null;
55 95
56 lock (pool) 96 lock(pool)
57 { 97 {
58 if (pool[type] == null || ((Stack) pool[type]).Count == 0) 98 if(pool[type] == null || ((Stack) pool[type]).Count == 0)
59 { 99 {
60 // Creating a new packet if we cannot reuse an old package 100 // Creating a new packet if we cannot reuse an old package
61 packet = Packet.BuildPacket(type); 101 packet = Packet.BuildPacket(type);
@@ -63,39 +103,16 @@ namespace OpenSim.Framework
63 else 103 else
64 { 104 {
65 // Recycle old packages 105 // Recycle old packages
66 packet = (Packet) ((Stack) pool[type]).Pop(); 106 packet=(Packet) ((Stack) pool[type]).Pop();
67 } 107 }
68 } 108 }
69 109
70 return packet; 110 return packet;
71*/
72 }
73
74 // Copied from LibSL, and added a check to avoid overwriting the
75 // buffer
76 private void ZeroDecodeCommand(byte[] src, byte[] dest)
77 {
78 for (int srcPos = 6, destPos = 6; destPos < 10; ++srcPos)
79 {
80 if (src[srcPos] == 0x00)
81 {
82 for (byte j = 0; j < src[srcPos + 1] && destPos < 10; ++j)
83 {
84 dest[destPos++] = 0x00;
85 }
86 ++srcPos;
87 }
88 else
89 {
90 dest[destPos++] = src[srcPos];
91 }
92 }
93 } 111 }
94 112
113 private byte[] decoded_header = new byte[10];
95 private PacketType GetType(byte[] bytes) 114 private PacketType GetType(byte[] bytes)
96 { 115 {
97 byte[] decoded_header = new byte[10];
98
99 ushort id; 116 ushort id;
100 libsecondlife.PacketFrequency freq; 117 libsecondlife.PacketFrequency freq;
101 118
@@ -103,7 +120,7 @@ namespace OpenSim.Framework
103 120
104 if((bytes[0] & libsecondlife.Helpers.MSG_ZEROCODED)!=0) 121 if((bytes[0] & libsecondlife.Helpers.MSG_ZEROCODED)!=0)
105 { 122 {
106 ZeroDecodeCommand(bytes, decoded_header); 123 libsecondlife.Helpers.ZeroDecodeCommand(bytes, decoded_header);
107 } 124 }
108 125
109 if (decoded_header[6] == 0xFF) 126 if (decoded_header[6] == 0xFF)
@@ -138,21 +155,22 @@ namespace OpenSim.Framework
138 return packet; 155 return packet;
139 } 156 }
140 157
141 public void ReturnPacket(Packet packet) 158 public void ReturnPacket(Packet packet) {
142 { 159 return; // packet pool disabled
143/* Skip until PacketPool performance problems have been resolved (mantis 281) 160
144 lock (pool) 161 lock(pool)
145 { 162 {
146 PacketType type = packet.Type; 163 PacketType type=packet.Type;
147 164
148 if (pool[type] == null) 165 if(pool[type] == null)
149 { 166 {
150 pool[type] = new Stack(); 167 pool[type] = new Stack();
151 } 168 }
152 169 if (((Stack)pool[type]).Count < 50)
153 ((Stack) pool[type]).Push(packet); 170 {
171 ((Stack)pool[type]).Push(packet);
172 }
154 } 173 }
155*/
156 } 174 }
157 } 175 }
158} 176}
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index f97db5c..43e2a24 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -71,6 +71,7 @@ namespace OpenSim.Framework
71 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; 71 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
72 RemotingAddress = ConvertFrom.RemotingAddress; 72 RemotingAddress = ConvertFrom.RemotingAddress;
73 RegionID = LLUUID.Zero; 73 RegionID = LLUUID.Zero;
74 ServerURI = ConvertFrom.ServerURI;
74 } 75 }
75 76
76 public LLUUID RegionID = LLUUID.Zero; 77 public LLUUID RegionID = LLUUID.Zero;
@@ -84,6 +85,19 @@ namespace OpenSim.Framework
84 } 85 }
85 public bool m_allow_alternate_ports; 86 public bool m_allow_alternate_ports;
86 87
88 public string m_serverURI;
89 public string ServerURI
90 {
91 get
92 {
93 return m_serverURI;
94 }
95 set
96 {
97 m_serverURI = value;
98 }
99 }
100
87 public string RemotingAddress; 101 public string RemotingAddress;
88 102
89 public IPEndPoint ExternalEndPoint 103 public IPEndPoint ExternalEndPoint
@@ -175,6 +189,8 @@ namespace OpenSim.Framework
175 public string MasterAvatarFirstName = String.Empty; 189 public string MasterAvatarFirstName = String.Empty;
176 public string MasterAvatarLastName = String.Empty; 190 public string MasterAvatarLastName = String.Empty;
177 public string MasterAvatarSandboxPassword = String.Empty; 191 public string MasterAvatarSandboxPassword = String.Empty;
192 public string proxyUrl = "";
193 public LLUUID originRegionID = LLUUID.Zero;
178 194
179 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 195 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
180 private EstateSettings m_estateSettings; 196 private EstateSettings m_estateSettings;
@@ -227,6 +243,10 @@ namespace OpenSim.Framework
227 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; 243 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
228 RemotingAddress = ConvertFrom.RemotingAddress; 244 RemotingAddress = ConvertFrom.RemotingAddress;
229 RegionID = LLUUID.Zero; 245 RegionID = LLUUID.Zero;
246 proxyUrl = ConvertFrom.ProxyUrl;
247 originRegionID = ConvertFrom.OriginRegionID;
248 RegionName = ConvertFrom.RegionName;
249 ServerURI = ConvertFrom.ServerURI;
230 } 250 }
231 251
232 public RegionInfo(SimpleRegionInfo ConvertFrom) 252 public RegionInfo(SimpleRegionInfo ConvertFrom)
@@ -239,6 +259,7 @@ namespace OpenSim.Framework
239 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; 259 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
240 RemotingAddress = ConvertFrom.RemotingAddress; 260 RemotingAddress = ConvertFrom.RemotingAddress;
241 RegionID = LLUUID.Zero; 261 RegionID = LLUUID.Zero;
262 ServerURI = ConvertFrom.ServerURI;
242 } 263 }
243 264
244 //not in use, should swap to nini though. 265 //not in use, should swap to nini though.
@@ -411,4 +432,4 @@ namespace OpenSim.Framework
411 432
412 } 433 }
413 } 434 }
414} \ No newline at end of file 435}
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs
index 077ed8d..48ddbdf 100644
--- a/OpenSim/Framework/SerializableRegionInfo.cs
+++ b/OpenSim/Framework/SerializableRegionInfo.cs
@@ -51,6 +51,10 @@ namespace OpenSim.Framework
51 m_remotingPort = ConvertFrom.RemotingPort; 51 m_remotingPort = ConvertFrom.RemotingPort;
52 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; 52 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
53 RemotingAddress = ConvertFrom.RemotingAddress; 53 RemotingAddress = ConvertFrom.RemotingAddress;
54 m_proxyUrl = ConvertFrom.proxyUrl;
55 OriginRegionID = ConvertFrom.originRegionID;
56 RegionName = ConvertFrom.RegionName;
57 ServerURI = ConvertFrom.ServerURI;
54 } 58 }
55 59
56 public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 60 public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -157,5 +161,57 @@ namespace OpenSim.Framework
157 { 161 {
158 get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); } 162 get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); }
159 } 163 }
160 } 164
161} \ No newline at end of file 165 protected string m_proxyUrl;
166 public string ProxyUrl
167 {
168 get
169 {
170 return m_proxyUrl;
171 }
172 set
173 {
174 m_proxyUrl = value;
175 }
176 }
177
178 protected Guid m_originRegionID = LLUUID.Zero.UUID;
179 public LLUUID OriginRegionID
180 {
181 get
182 {
183 return new LLUUID(m_originRegionID);
184 }
185 set
186 {
187 m_originRegionID = value.UUID;
188 }
189 }
190
191 protected string m_regionName;
192 public string RegionName
193 {
194 get
195 {
196 return m_regionName;
197 }
198 set
199 {
200 m_regionName = value;
201 }
202 }
203
204 protected string m_serverURI;
205 public string ServerURI
206 {
207 get
208 {
209 return m_serverURI;
210 }
211 set
212 {
213 m_serverURI = value;
214 }
215 }
216 }
217}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 35e795b..8ba6643 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -37,6 +37,8 @@ using System.Text;
37using libsecondlife; 37using libsecondlife;
38using Nini.Config; 38using Nini.Config;
39 39
40using System.Runtime.Serialization;
41using System.Runtime.Serialization.Formatters.Binary;
40namespace OpenSim.Framework 42namespace OpenSim.Framework
41{ 43{
42 public class Util 44 public class Util
@@ -509,7 +511,63 @@ namespace OpenSim.Framework
509 { 511 {
510 return ""; 512 return "";
511 } 513 }
514 }
515
516 public static void SerializeToFile(string filename, Object obj)
517 {
518 IFormatter formatter = new BinaryFormatter();
519 Stream stream = null;
520
521 try
522 {
523 stream = new FileStream(
524 filename, FileMode.Create,
525 FileAccess.Write, FileShare.None);
526
527 formatter.Serialize(stream, obj);
528 }
529 catch (Exception e)
530 {
531 System.Console.WriteLine(e.Message);
532 System.Console.WriteLine(e.StackTrace);
533 }
534 finally
535 {
536 if (stream != null)
537 {
538 stream.Close();
539 }
540 }
541 }
542
543 public static Object DeserializeFromFile(string filename)
544 {
545 IFormatter formatter = new BinaryFormatter();
546 Stream stream = null;
547 Object ret = null;
548
549 try
550 {
551 stream = new FileStream(
552 filename, FileMode.Open,
553 FileAccess.Read, FileShare.None);
554
555 ret = formatter.Deserialize(stream);
556 }
557 catch (Exception e)
558 {
559 System.Console.WriteLine(e.Message);
560 System.Console.WriteLine(e.StackTrace);
561 }
562 finally
563 {
564 if (stream != null)
565 {
566 stream.Close();
567 }
568 }
512 569
570 return ret;
513 } 571 }
514 } 572 }
515} 573}