aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/General')
-rw-r--r--OpenSim/Framework/General/AgentInventory.cs267
-rw-r--r--OpenSim/Framework/General/AuthenticateSessionBase.cs132
-rw-r--r--OpenSim/Framework/General/BlockingQueue.cs60
-rw-r--r--OpenSim/Framework/General/IRegionCommsListener.cs47
-rw-r--r--OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs51
-rw-r--r--OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs42
-rw-r--r--OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs63
-rw-r--r--OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs57
-rw-r--r--OpenSim/Framework/General/Interfaces/IAssetServer.cs69
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs164
-rw-r--r--OpenSim/Framework/General/Interfaces/ILocalStorage.cs69
-rw-r--r--OpenSim/Framework/General/Interfaces/IUserServer.cs42
-rw-r--r--OpenSim/Framework/General/Interfaces/IWorld.cs45
-rw-r--r--OpenSim/Framework/General/Logger.cs85
-rw-r--r--OpenSim/Framework/General/LoginService.cs41
-rw-r--r--OpenSim/Framework/General/OpenSim.Framework.csproj204
-rw-r--r--OpenSim/Framework/General/OpenSim.Framework.dll.build78
-rw-r--r--OpenSim/Framework/General/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/General/RegionCommsListener.cs70
-rw-r--r--OpenSim/Framework/General/Remoting.cs136
-rw-r--r--OpenSim/Framework/General/SimProfile.cs122
-rw-r--r--OpenSim/Framework/General/Types/AgentCiruitData.cs50
-rw-r--r--OpenSim/Framework/General/Types/AgentWearable.cs60
-rw-r--r--OpenSim/Framework/General/Types/AssetBase.cs49
-rw-r--r--OpenSim/Framework/General/Types/AssetLandmark.cs61
-rw-r--r--OpenSim/Framework/General/Types/AssetStorage.cs50
-rw-r--r--OpenSim/Framework/General/Types/EstateSettings.cs97
-rw-r--r--OpenSim/Framework/General/Types/Login.cs52
-rw-r--r--OpenSim/Framework/General/Types/MapBlockData.cs25
-rw-r--r--OpenSim/Framework/General/Types/NeighbourInfo.cs50
-rw-r--r--OpenSim/Framework/General/Types/NetworkServersInfo.cs220
-rw-r--r--OpenSim/Framework/General/Types/ParcelData.cs115
-rw-r--r--OpenSim/Framework/General/Types/PrimData.cs230
-rw-r--r--OpenSim/Framework/General/Types/RegionHandle.cs120
-rw-r--r--OpenSim/Framework/General/Types/RegionInfo.cs304
-rw-r--r--OpenSim/Framework/General/UserProfile.cs89
-rw-r--r--OpenSim/Framework/General/Util.cs186
37 files changed, 3635 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/AgentInventory.cs b/OpenSim/Framework/General/AgentInventory.cs
new file mode 100644
index 0000000..fbf4d23
--- /dev/null
+++ b/OpenSim/Framework/General/AgentInventory.cs
@@ -0,0 +1,267 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim.Framework.Types;
34using OpenSim.Framework.Utilities;
35
36namespace OpenSim.Framework.Inventory
37{
38 public class AgentInventory
39 {
40 //Holds the local copy of Inventory info for a agent
41 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
42 public Dictionary<LLUUID, InventoryItem> InventoryItems;
43 public InventoryFolder InventoryRoot;
44 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
45 public LLUUID AgentID;
46 public AvatarWearable[] Wearables;
47
48 public AgentInventory()
49 {
50 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
51 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
52 this.Initialise();
53 }
54
55 public virtual void Initialise()
56 {
57 Wearables = new AvatarWearable[13]; //should be 12 of these
58 for (int i = 0; i < 13; i++)
59 {
60 Wearables[i] = new AvatarWearable();
61 }
62
63 }
64
65 public bool CreateNewFolder(LLUUID folderID, ushort type)
66 {
67 InventoryFolder Folder = new InventoryFolder();
68 Folder.FolderID = folderID;
69 Folder.OwnerID = this.AgentID;
70 Folder.DefaultType = type;
71 this.InventoryFolders.Add(Folder.FolderID, Folder);
72 return (true);
73 }
74
75 public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
76 {
77 this.AgentID = newAgentID;
78 InventoryRoot = new InventoryFolder();
79 InventoryRoot.FolderID = LLUUID.Random();
80 InventoryRoot.ParentID = new LLUUID();
81 InventoryRoot.Version = 1;
82 InventoryRoot.DefaultType = 8;
83 InventoryRoot.OwnerID = this.AgentID;
84 InventoryRoot.FolderName = "My Inventory";
85 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
86 InventoryRoot.OwnerID = this.AgentID;
87 if (createTextures)
88 {
89 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
90 }
91 }
92
93 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
94 {
95 InventoryFolder Folder = new InventoryFolder();
96 Folder.FolderID = folderID;
97 Folder.OwnerID = this.AgentID;
98 Folder.DefaultType = type;
99 Folder.FolderName = folderName;
100 this.InventoryFolders.Add(Folder.FolderID, Folder);
101
102 return (true);
103 }
104
105 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
106 {
107 if (!this.InventoryFolders.ContainsKey(folderID))
108 {
109 System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
110 InventoryFolder Folder = new InventoryFolder();
111 Folder.FolderID = folderID;
112 Folder.OwnerID = this.AgentID;
113 Folder.DefaultType = type;
114 Folder.FolderName = folderName;
115 Folder.ParentID = parent;
116 this.InventoryFolders.Add(Folder.FolderID, Folder);
117 }
118
119 return (true);
120 }
121
122 public bool HasFolder(LLUUID folderID)
123 {
124 if (this.InventoryFolders.ContainsKey(folderID))
125 {
126 return true;
127 }
128 return false;
129 }
130
131 public LLUUID GetFolderID(string folderName)
132 {
133 foreach (InventoryFolder inv in this.InventoryFolders.Values)
134 {
135 if (inv.FolderName == folderName)
136 {
137 return inv.FolderID;
138 }
139 }
140
141 return LLUUID.Zero;
142 }
143
144 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
145 {
146 if(this.InventoryItems.ContainsKey(itemID))
147 {
148 InventoryItem Item = this.InventoryItems[itemID];
149 Item.AssetID = asset.FullID;
150 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated());
151 //TODO need to update the rest of the info
152 }
153 return true;
154 }
155
156 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
157 {
158 System.Console.WriteLine("updating inventory item details");
159 if (this.InventoryItems.ContainsKey(itemID))
160 {
161 System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name));
162 InventoryItem Item = this.InventoryItems[itemID];
163 Item.Name = Util.FieldToString(packet.Name);
164 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
165 //TODO need to update the rest of the info
166 }
167 return true;
168 }
169
170 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
171 {
172 if (this.InventoryFolders.ContainsKey(folderID))
173 {
174 LLUUID NewItemID = LLUUID.Random();
175
176 InventoryItem Item = new InventoryItem();
177 Item.FolderID = folderID;
178 Item.OwnerID = AgentID;
179 Item.AssetID = asset.FullID;
180 Item.ItemID = NewItemID;
181 Item.Type = asset.Type;
182 Item.Name = asset.Name;
183 Item.Description = asset.Description;
184 Item.InvType = asset.InvType;
185 this.InventoryItems.Add(Item.ItemID, Item);
186 InventoryFolder Folder = InventoryFolders[Item.FolderID];
187 Folder.Items.Add(Item);
188 return (Item.ItemID);
189 }
190 else
191 {
192 return (null);
193 }
194 }
195
196 public bool DeleteFromInventory(LLUUID itemID)
197 {
198 bool res = false;
199 if (this.InventoryItems.ContainsKey(itemID))
200 {
201 InventoryItem item = this.InventoryItems[itemID];
202 this.InventoryItems.Remove(itemID);
203 foreach (InventoryFolder fold in InventoryFolders.Values)
204 {
205 if (fold.Items.Contains(item))
206 {
207 fold.Items.Remove(item);
208 break;
209 }
210 }
211 res = true;
212
213 }
214 return res;
215 }
216 }
217
218 public class InventoryFolder
219 {
220 public List<InventoryItem> Items;
221 //public List<InventoryFolder> Subfolders;
222 public LLUUID FolderID;
223 public LLUUID OwnerID;
224 public LLUUID ParentID = LLUUID.Zero;
225 public string FolderName;
226 public ushort DefaultType;
227 public ushort Version;
228
229 public InventoryFolder()
230 {
231 Items = new List<InventoryItem>();
232 //Subfolders = new List<InventoryFolder>();
233 }
234
235 }
236
237 public class InventoryItem
238 {
239 public LLUUID FolderID;
240 public LLUUID OwnerID;
241 public LLUUID ItemID;
242 public LLUUID AssetID;
243 public LLUUID CreatorID;
244 public sbyte InvType;
245 public sbyte Type;
246 public string Name ="";
247 public string Description;
248
249 public InventoryItem()
250 {
251 this.CreatorID = LLUUID.Zero;
252 }
253
254 public string ExportString()
255 {
256 string typ = "notecard";
257 string result = "";
258 result += "\tinv_object\t0\n\t{\n";
259 result += "\t\tobj_id\t%s\n";
260 result += "\t\tparent_id\t"+ ItemID.ToString() +"\n";
261 result += "\t\ttype\t"+ typ +"\n";
262 result += "\t\tname\t" + Name+"|\n";
263 result += "\t}\n";
264 return result;
265 }
266 }
267}
diff --git a/OpenSim/Framework/General/AuthenticateSessionBase.cs b/OpenSim/Framework/General/AuthenticateSessionBase.cs
new file mode 100644
index 0000000..73dd3e2
--- /dev/null
+++ b/OpenSim/Framework/General/AuthenticateSessionBase.cs
@@ -0,0 +1,132 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types;
34
35namespace OpenSim.Framework
36{
37 public class AuthenticateSessionsBase
38 {
39 public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
40
41 public AuthenticateSessionsBase()
42 {
43
44 }
45
46 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
47 {
48 AgentCircuitData validcircuit = null;
49 if (this.AgentCircuits.ContainsKey(circuitcode))
50 {
51 validcircuit = this.AgentCircuits[circuitcode];
52 }
53 AuthenticateResponse user = new AuthenticateResponse();
54 if (validcircuit == null)
55 {
56 //don't have this circuit code in our list
57 user.Authorised = false;
58 return (user);
59 }
60
61 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
62 {
63 user.Authorised = true;
64 user.LoginInfo = new Login();
65 user.LoginInfo.Agent = agentID;
66 user.LoginInfo.Session = sessionID;
67 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
68 user.LoginInfo.First = validcircuit.firstname;
69 user.LoginInfo.Last = validcircuit.lastname;
70 user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder;
71 user.LoginInfo.BaseFolder = validcircuit.BaseFolder;
72 }
73 else
74 {
75 // Invalid
76 user.Authorised = false;
77 }
78
79 return (user);
80 }
81
82 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
83 {
84 if (this.AgentCircuits.ContainsKey(circuitCode))
85 {
86 this.AgentCircuits[circuitCode] = agentData;
87 }
88 else
89 {
90 this.AgentCircuits.Add(circuitCode, agentData);
91 }
92 }
93
94 public LLVector3 GetPosition(uint circuitCode)
95 {
96 LLVector3 vec = new LLVector3();
97 if (this.AgentCircuits.ContainsKey(circuitCode))
98 {
99 vec = this.AgentCircuits[circuitCode].startpos;
100 }
101 return vec;
102 }
103
104 public void UpdateAgentData(AgentCircuitData agentData)
105 {
106 if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode))
107 {
108 this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname;
109 this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname;
110 this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos;
111 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
112 }
113 }
114
115 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
116 {
117 if (this.AgentCircuits.ContainsKey(circuitcode))
118 {
119 this.AgentCircuits[circuitcode].child = childstatus;
120 }
121 }
122
123 public bool GetAgentChildStatus(uint circuitcode)
124 {
125 if (this.AgentCircuits.ContainsKey(circuitcode))
126 {
127 return this.AgentCircuits[circuitcode].child;
128 }
129 return false;
130 }
131 }
132} \ No newline at end of file
diff --git a/OpenSim/Framework/General/BlockingQueue.cs b/OpenSim/Framework/General/BlockingQueue.cs
new file mode 100644
index 0000000..667b8d8
--- /dev/null
+++ b/OpenSim/Framework/General/BlockingQueue.cs
@@ -0,0 +1,60 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Threading;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework.Utilities
34{
35 public class BlockingQueue<T>
36 {
37 private Queue<T> _queue = new Queue<T>();
38 private object _queueSync = new object();
39
40 public void Enqueue(T value)
41 {
42 lock (_queueSync)
43 {
44 _queue.Enqueue(value);
45 Monitor.Pulse(_queueSync);
46 }
47 }
48
49 public T Dequeue()
50 {
51 lock (_queueSync)
52 {
53 if (_queue.Count < 1)
54 Monitor.Wait(_queueSync);
55
56 return _queue.Dequeue();
57 }
58 }
59 }
60}
diff --git a/OpenSim/Framework/General/IRegionCommsListener.cs b/OpenSim/Framework/General/IRegionCommsListener.cs
new file mode 100644
index 0000000..0e80941
--- /dev/null
+++ b/OpenSim/Framework/General/IRegionCommsListener.cs
@@ -0,0 +1,47 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Types;
33
34namespace OpenSim.Framework
35{
36 public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
37 public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
38 public delegate void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position);
39
40 public interface IRegionCommsListener
41 {
42 event ExpectUserDelegate OnExpectUser;
43 event GenericCall2 OnExpectChildAgent;
44 event AgentCrossing OnAvatarCrossingIntoRegion;
45 event UpdateNeighbours OnNeighboursUpdate;
46 }
47}
diff --git a/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs b/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs
new file mode 100644
index 0000000..462e2c5
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs
@@ -0,0 +1,51 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.IO;
34using libsecondlife;
35using OpenSim;
36using OpenSim.Framework.Types;
37
38namespace OpenSim.Framework.Interfaces
39{
40 public class AuthenticateResponse
41 {
42 public bool Authorised;
43 public Login LoginInfo;
44
45 public AuthenticateResponse()
46 {
47
48 }
49
50 }
51}
diff --git a/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs b/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs
new file mode 100644
index 0000000..13980fe
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs
@@ -0,0 +1,42 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Framework.Interfaces
33{
34 public interface IGenericConfig
35 {
36 void LoadData();
37 string GetAttribute(string attributeName);
38 bool SetAttribute(string attributeName, string attributeValue);
39 void Commit();
40 void Close();
41 }
42}
diff --git a/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs b/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs
new file mode 100644
index 0000000..0fafe1a
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs
@@ -0,0 +1,63 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections.Generic;
31using System.IO;
32using libsecondlife;
33//using OpenSim.world;
34
35namespace OpenSim.Framework.Interfaces
36{
37 /// <summary>
38 /// </summary>
39
40
41 public abstract class GridConfig
42 {
43 public string GridOwner;
44 public string DefaultStartupMsg;
45 public string DefaultAssetServer;
46 public string AssetSendKey;
47 public string AssetRecvKey;
48 public string DefaultUserServer;
49 public string UserSendKey;
50 public string UserRecvKey;
51 public string SimSendKey;
52 public string SimRecvKey;
53
54
55 public abstract void InitConfig();
56
57 }
58
59 public interface IGridConfig
60 {
61 GridConfig GetConfigObject();
62 }
63}
diff --git a/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs b/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs
new file mode 100644
index 0000000..2f4b340
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs
@@ -0,0 +1,57 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections.Generic;
31using System.IO;
32using libsecondlife;
33//using OpenSim.world;
34
35namespace OpenSim.Framework.Interfaces
36{
37 /// <summary>
38 /// </summary>
39
40
41 public abstract class UserConfig
42 {
43 public string DefaultStartupMsg;
44 public string GridServerURL;
45 public string GridSendKey;
46 public string GridRecvKey;
47
48
49 public abstract void InitConfig();
50
51 }
52
53 public interface IUserConfig
54 {
55 UserConfig GetConfigObject();
56 }
57}
diff --git a/OpenSim/Framework/General/Interfaces/IAssetServer.cs b/OpenSim/Framework/General/Interfaces/IAssetServer.cs
new file mode 100644
index 0000000..826392d
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/IAssetServer.cs
@@ -0,0 +1,69 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Net;
30using System.Net.Sockets;
31using System.IO;
32using System.Threading;
33using libsecondlife;
34using OpenSim.Framework.Types;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// Description of IAssetServer.
40 /// </summary>
41
42 public interface IAssetServer
43 {
44 void SetReceiver(IAssetReceiver receiver);
45 void RequestAsset(LLUUID assetID, bool isTexture);
46 void UpdateAsset(AssetBase asset);
47 void UploadNewAsset(AssetBase asset);
48 void SetServerInfo(string ServerUrl, string ServerKey);
49 void Close();
50 }
51
52 // could change to delegate?
53 public interface IAssetReceiver
54 {
55 void AssetReceived(AssetBase asset, bool IsTexture);
56 void AssetNotFound(AssetBase asset);
57 }
58
59 public interface IAssetPlugin
60 {
61 IAssetServer GetAssetServer();
62 }
63
64 public struct ARequest
65 {
66 public LLUUID AssetID;
67 public bool IsTexture;
68 }
69}
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
new file mode 100644
index 0000000..4e8ac1a
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -0,0 +1,164 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Inventory;
32using libsecondlife;
33using libsecondlife.Packets;
34using OpenSim.Framework.Types;
35
36namespace OpenSim.Framework.Interfaces
37{
38 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
39 public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west);
41 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
42 public delegate void StartAnim(LLUUID animID, int seq);
43 public delegate void LinkObjects(uint parent, List<uint> children);
44 public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY);
45 public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags);
46
47 public delegate void GenericCall(IClientAPI remoteClient);
48 public delegate void GenericCall2();
49 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
50 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
51 public delegate void GenericCall5(IClientAPI remoteClient, bool status);
52 public delegate void GenericCall6(LLUUID uid);
53
54 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
55 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
56 public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient);
57 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
58 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient);
59 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
60 public delegate void StatusChange(bool status);
61 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
62 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
63 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
64
65 public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
66 public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
67 public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
68 public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); // NOTETOSELFremove the packet part
69
70 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
71
72 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
73
74 public interface IClientAPI
75 {
76 event ChatFromViewer OnChatFromViewer;
77 event RezObject OnRezObject;
78 event ModifyTerrain OnModifyTerrain;
79 event SetAppearance OnSetAppearance;
80 event StartAnim OnStartAnim;
81 event LinkObjects OnLinkObjects;
82 event RequestMapBlocks OnRequestMapBlocks;
83 event TeleportLocationRequest OnTeleportLocationRequest;
84
85 event GenericCall4 OnDeRezObject;
86 event GenericCall OnRegionHandShakeReply;
87 event GenericCall OnRequestWearables;
88 event GenericCall2 OnCompleteMovementToRegion;
89 event UpdateAgent OnAgentUpdate;
90 event GenericCall OnRequestAvatarsData;
91 event GenericCall4 OnAddPrim;
92 event UpdateVector OnGrapObject;
93 event ObjectSelect OnDeGrapObject;
94 event MoveObject OnGrapUpdate;
95
96 event UpdateShape OnUpdatePrimShape;
97 event ObjectSelect OnObjectSelect;
98 event UpdatePrimFlags OnUpdatePrimFlags;
99 event UpdatePrimTexture OnUpdatePrimTexture;
100 event UpdateVector OnUpdatePrimPosition;
101 event UpdatePrimRotation OnUpdatePrimRotation;
102 event UpdateVector OnUpdatePrimScale;
103 event StatusChange OnChildAgentStatus;
104 event GenericCall2 OnStopMovement;
105 event NewAvatar OnNewAvatar;
106 event GenericCall6 OnRemoveAvatar;
107
108 event UUIDNameRequest OnNameFromUUIDRequest;
109
110 event ParcelPropertiesRequest OnParcelPropertiesRequest;
111 event ParcelDivideRequest OnParcelDivideRequest;
112 event ParcelJoinRequest OnParcelJoinRequest;
113 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
114
115 event EstateOwnerMessageRequest OnEstateOwnerMessage;
116
117 LLVector3 StartPos
118 {
119 get;
120 set;
121 }
122
123 LLUUID AgentId
124 {
125 get;
126 }
127
128 string FirstName
129 {
130 get;
131 }
132
133 string LastName
134 {
135 get;
136 }
137
138 void OutPacket(Packet newPack);
139 void SendWearables(AvatarWearable[] wearables);
140 void SendRegionHandshake(RegionInfo regionInfo);
141 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
142 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
143 void SendLayerData(float[] map);
144 void SendLayerData(int px, int py, float[] map);
145 void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look);
146 void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort);
147 AgentCircuitData RequestClientInfo();
148 void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort);
149 void SendMapBlock(List<MapBlockData> mapBlocks);
150 void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags);
151 void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags);
152 void SendTeleportCancel();
153 void SendTeleportLocationStart();
154 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
155
156 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry);
157 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity);
158
159 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
160 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags);
161 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags);
162 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation);
163 }
164}
diff --git a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs b/OpenSim/Framework/General/Interfaces/ILocalStorage.cs
new file mode 100644
index 0000000..4987d10
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/ILocalStorage.cs
@@ -0,0 +1,69 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using libsecondlife;
31using OpenSim.Framework.Types;
32
33namespace OpenSim.Framework.Interfaces
34{
35 /// <summary>
36 /// ILocalStorage. Really hacked together right now needs cleaning up
37 /// </summary>
38 public interface ILocalStorage
39 {
40 void Initialise(string datastore);
41
42 void StorePrim(PrimData prim);
43 void RemovePrim(LLUUID primID);
44 void LoadPrimitives(ILocalStorageReceiver receiver);
45
46 float[] LoadWorld();
47 void SaveMap(float[] heightmap);
48
49 void SaveParcels(ParcelData[] parcels);
50 void SaveParcel(ParcelData parcel);
51 void RemoveParcel(ParcelData parcel);
52 void RemoveAllParcels();
53 void LoadParcels(ILocalStorageParcelReceiver recv);
54
55 void ShutDown();
56 }
57
58 public interface ILocalStorageReceiver
59 {
60 void PrimFromStorage(PrimData prim);
61 }
62
63 public interface ILocalStorageParcelReceiver
64 {
65 void ParcelFromStorage(ParcelData data);
66 void NoParcelDataFromStorage();
67 }
68}
69
diff --git a/OpenSim/Framework/General/Interfaces/IUserServer.cs b/OpenSim/Framework/General/Interfaces/IUserServer.cs
new file mode 100644
index 0000000..c6e2223
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/IUserServer.cs
@@ -0,0 +1,42 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Inventory;
32using libsecondlife;
33
34namespace OpenSim.Framework.Interfaces
35{
36 public interface IUserServer
37 {
38 AgentInventory RequestAgentsInventory(LLUUID agentID);
39 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
40 bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
41 }
42}
diff --git a/OpenSim/Framework/General/Interfaces/IWorld.cs b/OpenSim/Framework/General/Interfaces/IWorld.cs
new file mode 100644
index 0000000..4857417
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/IWorld.cs
@@ -0,0 +1,45 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using OpenSim.Framework.Types;
33
34namespace OpenSim.Framework.Interfaces
35{
36 public interface IWorld
37 {
38 void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child);
39 void RemoveClient(LLUUID agentID);
40
41 RegionInfo RegionInfo { get; }
42 object SyncRoot { get; }
43 uint NextLocalId { get; }
44 }
45}
diff --git a/OpenSim/Framework/General/Logger.cs b/OpenSim/Framework/General/Logger.cs
new file mode 100644
index 0000000..e7eaa03
--- /dev/null
+++ b/OpenSim/Framework/General/Logger.cs
@@ -0,0 +1,85 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework
6{
7 public class Logger
8 {
9 public static Logger Instance = new Logger( false );
10
11 public delegate void LoggerMethodDelegate();
12 private delegate bool LoggerDelegate( LoggerMethodDelegate whatToDo );
13
14
15 private LoggerDelegate m_delegate;
16
17 public Logger( bool log )
18 {
19 if( log )
20 {
21 m_delegate = CatchAndLog;
22 }
23 else
24 {
25 m_delegate = DontCatch;
26 }
27 }
28
29 public bool Wrap( LoggerMethodDelegate whatToDo )
30 {
31 return m_delegate( whatToDo );
32 }
33
34
35 private bool CatchAndLog(LoggerMethodDelegate whatToDo)
36 {
37 try
38 {
39 whatToDo();
40 return true;
41 }
42 catch(Exception e)
43 {
44 System.Console.WriteLine( "Exception logged!!! Woah!!!!" );
45 return false;
46 }
47 }
48
49 private bool DontCatch(LoggerMethodDelegate whatToDo)
50 {
51 whatToDo();
52 return true;
53 }
54
55 public class LoggerExample
56 {
57 public void TryWrap()
58 {
59 // This will log and ignore
60 Logger log = new Logger(true);
61
62 log.Wrap(delegate()
63 {
64 Int16.Parse("waa!");
65 });
66
67 // This will throw;
68 try
69 {
70
71 log = new Logger(false);
72
73 log.Wrap(delegate()
74 {
75 Int16.Parse("waa!");
76 });
77 }
78 catch
79 {
80 System.Console.WriteLine("Example barfed!");
81 }
82 }
83 }
84 }
85}
diff --git a/OpenSim/Framework/General/LoginService.cs b/OpenSim/Framework/General/LoginService.cs
new file mode 100644
index 0000000..f14754f
--- /dev/null
+++ b/OpenSim/Framework/General/LoginService.cs
@@ -0,0 +1,41 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Text;
32using Nwc.XmlRpc;
33using libsecondlife;
34
35namespace OpenSim.Framework.Grid
36{
37 public abstract class LoginService
38 {
39
40 }
41} \ No newline at end of file
diff --git a/OpenSim/Framework/General/OpenSim.Framework.csproj b/OpenSim/Framework/General/OpenSim.Framework.csproj
new file mode 100644
index 0000000..48db634
--- /dev/null
+++ b/OpenSim/Framework/General/OpenSim.Framework.csproj
@@ -0,0 +1,204 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Framework</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Framework</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="Db4objects.Db4o.dll" >
62 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="libsecondlife.dll" >
66 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System" >
70 <HintPath>System.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="System.Xml" >
74 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="XMLRPC.dll" >
78 <HintPath>..\..\..\bin\XMLRPC.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\Console\OpenSim.Framework.Console.csproj">
84 <Name>OpenSim.Framework.Console</Name>
85 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="AgentInventory.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="AuthenticateSessionBase.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="BlockingQueue.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="IRegionCommsListener.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 <Compile Include="Logger.cs">
104 <SubType>Code</SubType>
105 </Compile>
106 <Compile Include="LoginService.cs">
107 <SubType>Code</SubType>
108 </Compile>
109 <Compile Include="RegionCommsListener.cs">
110 <SubType>Code</SubType>
111 </Compile>
112 <Compile Include="Remoting.cs">
113 <SubType>Code</SubType>
114 </Compile>
115 <Compile Include="SimProfile.cs">
116 <SubType>Code</SubType>
117 </Compile>
118 <Compile Include="UserProfile.cs">
119 <SubType>Code</SubType>
120 </Compile>
121 <Compile Include="Util.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 <Compile Include="Interfaces\AuthenticateResponse.cs">
125 <SubType>Code</SubType>
126 </Compile>
127 <Compile Include="Interfaces\IAssetServer.cs">
128 <SubType>Code</SubType>
129 </Compile>
130 <Compile Include="Interfaces\IClientAPI.cs">
131 <SubType>Code</SubType>
132 </Compile>
133 <Compile Include="Interfaces\ILocalStorage.cs">
134 <SubType>Code</SubType>
135 </Compile>
136 <Compile Include="Interfaces\IUserServer.cs">
137 <SubType>Code</SubType>
138 </Compile>
139 <Compile Include="Interfaces\IWorld.cs">
140 <SubType>Code</SubType>
141 </Compile>
142 <Compile Include="Interfaces\Config\IGenericConfig.cs">
143 <SubType>Code</SubType>
144 </Compile>
145 <Compile Include="Interfaces\Config\IGridConfig.cs">
146 <SubType>Code</SubType>
147 </Compile>
148 <Compile Include="Interfaces\Config\IUserConfig.cs">
149 <SubType>Code</SubType>
150 </Compile>
151 <Compile Include="Properties\AssemblyInfo.cs">
152 <SubType>Code</SubType>
153 </Compile>
154 <Compile Include="Types\AgentCiruitData.cs">
155 <SubType>Code</SubType>
156 </Compile>
157 <Compile Include="Types\AgentWearable.cs">
158 <SubType>Code</SubType>
159 </Compile>
160 <Compile Include="Types\AssetBase.cs">
161 <SubType>Code</SubType>
162 </Compile>
163 <Compile Include="Types\AssetLandmark.cs">
164 <SubType>Code</SubType>
165 </Compile>
166 <Compile Include="Types\AssetStorage.cs">
167 <SubType>Code</SubType>
168 </Compile>
169 <Compile Include="Types\EstateSettings.cs">
170 <SubType>Code</SubType>
171 </Compile>
172 <Compile Include="Types\Login.cs">
173 <SubType>Code</SubType>
174 </Compile>
175 <Compile Include="Types\MapBlockData.cs">
176 <SubType>Code</SubType>
177 </Compile>
178 <Compile Include="Types\NeighbourInfo.cs">
179 <SubType>Code</SubType>
180 </Compile>
181 <Compile Include="Types\NetworkServersInfo.cs">
182 <SubType>Code</SubType>
183 </Compile>
184 <Compile Include="Types\ParcelData.cs">
185 <SubType>Code</SubType>
186 </Compile>
187 <Compile Include="Types\PrimData.cs">
188 <SubType>Code</SubType>
189 </Compile>
190 <Compile Include="Types\RegionHandle.cs">
191 <SubType>Code</SubType>
192 </Compile>
193 <Compile Include="Types\RegionInfo.cs">
194 <SubType>Code</SubType>
195 </Compile>
196 </ItemGroup>
197 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
198 <PropertyGroup>
199 <PreBuildEvent>
200 </PreBuildEvent>
201 <PostBuildEvent>
202 </PostBuildEvent>
203 </PropertyGroup>
204</Project>
diff --git a/OpenSim/Framework/General/OpenSim.Framework.dll.build b/OpenSim/Framework/General/OpenSim.Framework.dll.build
new file mode 100644
index 0000000..a18838b
--- /dev/null
+++ b/OpenSim/Framework/General/OpenSim.Framework.dll.build
@@ -0,0 +1,78 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Framework" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Framework" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AgentInventory.cs" />
15 <include name="AuthenticateSessionBase.cs" />
16 <include name="BlockingQueue.cs" />
17 <include name="IRegionCommsListener.cs" />
18 <include name="Logger.cs" />
19 <include name="LoginService.cs" />
20 <include name="RegionCommsListener.cs" />
21 <include name="Remoting.cs" />
22 <include name="SimProfile.cs" />
23 <include name="UserProfile.cs" />
24 <include name="Util.cs" />
25 <include name="Interfaces/AuthenticateResponse.cs" />
26 <include name="Interfaces/IAssetServer.cs" />
27 <include name="Interfaces/IClientAPI.cs" />
28 <include name="Interfaces/ILocalStorage.cs" />
29 <include name="Interfaces/IUserServer.cs" />
30 <include name="Interfaces/IWorld.cs" />
31 <include name="Interfaces/Config/IGenericConfig.cs" />
32 <include name="Interfaces/Config/IGridConfig.cs" />
33 <include name="Interfaces/Config/IUserConfig.cs" />
34 <include name="Properties/AssemblyInfo.cs" />
35 <include name="Types/AgentCiruitData.cs" />
36 <include name="Types/AgentWearable.cs" />
37 <include name="Types/AssetBase.cs" />
38 <include name="Types/AssetLandmark.cs" />
39 <include name="Types/AssetStorage.cs" />
40 <include name="Types/EstateSettings.cs" />
41 <include name="Types/Login.cs" />
42 <include name="Types/MapBlockData.cs" />
43 <include name="Types/NeighbourInfo.cs" />
44 <include name="Types/NetworkServersInfo.cs" />
45 <include name="Types/ParcelData.cs" />
46 <include name="Types/PrimData.cs" />
47 <include name="Types/RegionHandle.cs" />
48 <include name="Types/RegionInfo.cs" />
49 </sources>
50 <references basedir="${project::get-base-directory()}">
51 <lib>
52 <include name="${project::get-base-directory()}" />
53 <include name="${project::get-base-directory()}/${build.dir}" />
54 </lib>
55 <include name="../../../bin/Db4objects.Db4o.dll" />
56 <include name="../../../bin/libsecondlife.dll" />
57 <include name="../../../bin/OpenSim.Framework.Console.dll" />
58 <include name="System.dll" />
59 <include name="System.Xml.dll" />
60 <include name="../../../bin/XMLRPC.dll" />
61 </references>
62 </csc>
63 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
64 <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
65 <copy todir="${project::get-base-directory()}/../../../bin/">
66 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
67 <include name="*.dll"/>
68 <include name="*.exe"/>
69 </fileset>
70 </copy>
71 </target>
72 <target name="clean">
73 <delete dir="${bin.dir}" failonerror="false" />
74 <delete dir="${obj.dir}" failonerror="false" />
75 </target>
76 <target name="doc" description="Creates documentation.">
77 </target>
78</project>
diff --git a/OpenSim/Framework/General/Properties/AssemblyInfo.cs b/OpenSim/Framework/General/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..86f5cdb
--- /dev/null
+++ b/OpenSim/Framework/General/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.FrameWork")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.FrameWork")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/General/RegionCommsListener.cs b/OpenSim/Framework/General/RegionCommsListener.cs
new file mode 100644
index 0000000..5fa2f58
--- /dev/null
+++ b/OpenSim/Framework/General/RegionCommsListener.cs
@@ -0,0 +1,70 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Types;
33
34namespace OpenSim.Framework
35{
36 public class RegionCommsListener :IRegionCommsListener
37 {
38 public event ExpectUserDelegate OnExpectUser;
39 public event GenericCall2 OnExpectChildAgent;
40 public event AgentCrossing OnAvatarCrossingIntoRegion;
41 public event UpdateNeighbours OnNeighboursUpdate;
42
43 /// <summary>
44 ///
45 /// </summary>
46 /// <param name="agent"></param>
47 /// <returns></returns>
48 public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
49 {
50 if(OnExpectUser != null)
51 {
52
53 OnExpectUser(regionHandle, agent);
54 return true;
55 }
56
57 return false;
58 }
59
60 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
61 {
62 if (OnAvatarCrossingIntoRegion != null)
63 {
64 OnAvatarCrossingIntoRegion(regionHandle, agentID, position);
65 return true;
66 }
67 return false;
68 }
69 }
70}
diff --git a/OpenSim/Framework/General/Remoting.cs b/OpenSim/Framework/General/Remoting.cs
new file mode 100644
index 0000000..e6fdf70
--- /dev/null
+++ b/OpenSim/Framework/General/Remoting.cs
@@ -0,0 +1,136 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using System.Security.Cryptography;
32
33namespace OpenSim.Framework
34{
35 /// <summary>
36 /// NEEDS AUDIT.
37 /// </summary>
38 /// <remarks>
39 /// Suggested implementation
40 /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para>
41 /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
42 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
43 /// <para>Both hosts should be performing these operations for this to be effective.</para>
44 /// </remarks>
45 class RemoteDigest
46 {
47 private byte[] currentHash;
48 private byte[] secret;
49
50 private SHA512Managed SHA512;
51
52 /// <summary>
53 /// Initialises a new RemoteDigest authentication mechanism
54 /// </summary>
55 /// <remarks>Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting</remarks>
56 /// <param name="sharedSecret">The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)</param>
57 /// <param name="salt">Binary salt - some common value - to be decided what</param>
58 /// <param name="challenge">The challenge key provided by the third party</param>
59 public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
60 {
61 SHA512 = new SHA512Managed();
62 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt);
63 secret = RFC2898.GetBytes(512);
64 ASCIIEncoding ASCII = new ASCIIEncoding();
65
66 currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
67 }
68
69 /// <summary>
70 /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
71 /// </summary>
72 /// <param name="data">The incoming data</param>
73 /// <param name="digest">The remote digest</param>
74 /// <returns></returns>
75 public bool Authenticate(byte[] data, byte[] digest)
76 {
77 byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
78 if (digest == newHash)
79 {
80 currentHash = newHash;
81 return true;
82 }
83 else
84 {
85 throw new Exception("Hash comparison failed. Key resync required.");
86 }
87 }
88
89 /// <summary>
90 /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
91 /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
92 /// hashes will get out of sync and throw an exception when validation is attempted.
93 /// </summary>
94 /// <param name="data">The outgoing data</param>
95 /// <returns>The local digest</returns>
96 public byte[] Sign(byte[] data)
97 {
98 currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
99 return currentHash;
100 }
101
102 /// <summary>
103 /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator.
104 /// </summary>
105 /// <returns>A 128-character hexadecimal string containing the challenge.</returns>
106 public static string GenerateChallenge()
107 {
108 RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
109 byte[] bytes = new byte[64];
110 RNG.GetBytes(bytes);
111
112 StringBuilder sb = new StringBuilder(bytes.Length * 2);
113 foreach (byte b in bytes)
114 {
115 sb.AppendFormat("{0:x2}", b);
116 }
117 return sb.ToString();
118 }
119
120 /// <summary>
121 /// Helper function, merges two byte arrays
122 /// </summary>
123 /// <remarks>Sourced from MSDN Forum</remarks>
124 /// <param name="a">A</param>
125 /// <param name="b">B</param>
126 /// <returns>C</returns>
127 private byte[] AppendArrays(byte[] a, byte[] b)
128 {
129 byte[] c = new byte[a.Length + b.Length];
130 Buffer.BlockCopy(a, 0, c, 0, a.Length);
131 Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
132 return c;
133 }
134
135 }
136}
diff --git a/OpenSim/Framework/General/SimProfile.cs b/OpenSim/Framework/General/SimProfile.cs
new file mode 100644
index 0000000..cfa5e50
--- /dev/null
+++ b/OpenSim/Framework/General/SimProfile.cs
@@ -0,0 +1,122 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Collections;
31using System.Xml;
32using System.Text;
33using libsecondlife;
34using Nwc.XmlRpc;
35
36namespace OpenSim.Framework.Sims
37{
38 public class SimProfile
39 {
40 public LLUUID UUID;
41 public ulong regionhandle;
42 public string regionname;
43 public string sim_ip;
44 public uint sim_port;
45 public string caps_url;
46 public uint RegionLocX;
47 public uint RegionLocY;
48 public string sendkey;
49 public string recvkey;
50 public bool online;
51
52 public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
53 {
54 try
55 {
56 Hashtable GridReqParams = new Hashtable();
57 GridReqParams["region_handle"] = region_handle.ToString();
58 GridReqParams["authkey"] = SendKey;
59 ArrayList SendParams = new ArrayList();
60 SendParams.Add(GridReqParams);
61 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
62
63 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
64
65 Hashtable RespData = (Hashtable)GridResp.Value;
66 this.UUID = new LLUUID((string)RespData["UUID"]);
67 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
68 this.regionname = (string)RespData["regionname"];
69 this.sim_ip = (string)RespData["sim_ip"];
70 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
71 this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
72 this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
73 this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
74 this.sendkey = SendKey;
75 this.recvkey = RecvKey;
76 }
77 catch (Exception e)
78 {
79 System.Console.WriteLine(e.ToString());
80 }
81 return this;
82 }
83
84 public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
85 {
86 try
87 {
88 Hashtable GridReqParams = new Hashtable();
89 GridReqParams["UUID"] = UUID.ToString();
90 GridReqParams["authkey"] = SendKey;
91 ArrayList SendParams = new ArrayList();
92 SendParams.Add(GridReqParams);
93 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
94
95 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
96
97 Hashtable RespData = (Hashtable)GridResp.Value;
98 this.UUID = new LLUUID((string)RespData["UUID"]);
99 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
100 this.regionname = (string)RespData["regionname"];
101 this.sim_ip = (string)RespData["sim_ip"];
102 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
103 this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
104 this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
105 this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
106 this.sendkey = SendKey;
107 this.recvkey = RecvKey;
108 }
109 catch (Exception e)
110 {
111 System.Console.WriteLine(e.ToString());
112 }
113 return this;
114 }
115
116
117 public SimProfile()
118 {
119 }
120 }
121
122}
diff --git a/OpenSim/Framework/General/Types/AgentCiruitData.cs b/OpenSim/Framework/General/Types/AgentCiruitData.cs
new file mode 100644
index 0000000..a650343
--- /dev/null
+++ b/OpenSim/Framework/General/Types/AgentCiruitData.cs
@@ -0,0 +1,50 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AgentCircuitData
36 {
37 public AgentCircuitData() { }
38 public LLUUID AgentID;
39 public LLUUID SessionID;
40 public LLUUID SecureSessionID;
41 public LLVector3 startpos;
42 public string firstname;
43 public string lastname;
44 public uint circuitcode;
45 public bool child;
46 public LLUUID InventoryFolder;
47 public LLUUID BaseFolder;
48 public string CapsPath = "";
49 }
50}
diff --git a/OpenSim/Framework/General/Types/AgentWearable.cs b/OpenSim/Framework/General/Types/AgentWearable.cs
new file mode 100644
index 0000000..4c93da7
--- /dev/null
+++ b/OpenSim/Framework/General/Types/AgentWearable.cs
@@ -0,0 +1,60 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AvatarWearable
36 {
37 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
38 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
39
40 public AvatarWearable()
41 {
42
43 }
44
45 public static AvatarWearable[] DefaultWearables
46 {
47 get
48 {
49 AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these
50 for (int i = 0; i < 13; i++)
51 {
52 defaultWearables[i] = new AvatarWearable();
53 }
54 defaultWearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
55 defaultWearables[0].ItemID = LLUUID.Random();
56 return defaultWearables;
57 }
58 }
59 }
60}
diff --git a/OpenSim/Framework/General/Types/AssetBase.cs b/OpenSim/Framework/General/Types/AssetBase.cs
new file mode 100644
index 0000000..86586a6
--- /dev/null
+++ b/OpenSim/Framework/General/Types/AssetBase.cs
@@ -0,0 +1,49 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AssetBase
36 {
37 public byte[] Data;
38 public LLUUID FullID;
39 public sbyte Type;
40 public sbyte InvType;
41 public string Name;
42 public string Description;
43
44 public AssetBase()
45 {
46
47 }
48 }
49}
diff --git a/OpenSim/Framework/General/Types/AssetLandmark.cs b/OpenSim/Framework/General/Types/AssetLandmark.cs
new file mode 100644
index 0000000..8a10b70
--- /dev/null
+++ b/OpenSim/Framework/General/Types/AssetLandmark.cs
@@ -0,0 +1,61 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AssetLandmark : AssetBase
36 {
37 public int Version;
38 public LLVector3 Position;
39 public LLUUID RegionID;
40
41 public AssetLandmark(AssetBase a)
42 {
43 this.Data = a.Data;
44 this.FullID = a.FullID;
45 this.Type = a.Type;
46 this.InvType = a.InvType;
47 this.Name = a.Name;
48 this.Description = a.Description;
49 InternData();
50 }
51
52 private void InternData()
53 {
54 string temp = System.Text.Encoding.UTF8.GetString(Data).Trim();
55 string[] parts = temp.Split('\n');
56 int.TryParse(parts[0].Substring(17, 1), out Version);
57 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
58 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
59 }
60 }
61}
diff --git a/OpenSim/Framework/General/Types/AssetStorage.cs b/OpenSim/Framework/General/Types/AssetStorage.cs
new file mode 100644
index 0000000..8cac23a
--- /dev/null
+++ b/OpenSim/Framework/General/Types/AssetStorage.cs
@@ -0,0 +1,50 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class AssetStorage
36 {
37
38 public AssetStorage() {
39 }
40
41 public AssetStorage(LLUUID assetUUID) {
42 UUID=assetUUID;
43 }
44
45 public byte[] Data;
46 public sbyte Type;
47 public string Name;
48 public LLUUID UUID;
49 }
50}
diff --git a/OpenSim/Framework/General/Types/EstateSettings.cs b/OpenSim/Framework/General/Types/EstateSettings.cs
new file mode 100644
index 0000000..778c893
--- /dev/null
+++ b/OpenSim/Framework/General/Types/EstateSettings.cs
@@ -0,0 +1,97 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33using libsecondlife;
34
35namespace OpenSim.Framework.Types
36{
37 public class EstateSettings
38 {
39 //Settings to this island
40 public float billableFactor = (float)0.0;
41 public uint estateID = 0;
42 public uint parentEstateID = 0;
43
44 public byte maxAgents = 40;
45 public float objectBonusFactor = (float)1.0;
46
47 public int redirectGridX = 0; //??
48 public int redirectGridY = 0; //??
49 public libsecondlife.Simulator.RegionFlags regionFlags = libsecondlife.Simulator.RegionFlags.None; //Booleam values of various region settings
50 public libsecondlife.Simulator.SimAccess simAccess = libsecondlife.Simulator.SimAccess.Mature; //Is sim PG, Mature, etc? Mature by default.
51 public float sunHour = 0;
52
53 public float terrainRaiseLimit = 0;
54 public float terrainLowerLimit = 0;
55
56 public bool useFixedSun = false;
57 public int pricePerMeter = 1;
58
59 public ushort regionWaterHeight = 20;
60 public bool regionAllowTerraform = true;
61
62 // Region Information
63 // Low resolution 'base' textures. No longer used.
64 public LLUUID terrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default
65 public LLUUID terrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default
66 public LLUUID terrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default
67 public LLUUID terrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default
68
69 // Higher resolution terrain textures
70 public LLUUID terrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
71 public LLUUID terrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
72 public LLUUID terrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
73 public LLUUID terrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
74
75 // First quad - each point is bilinearly interpolated at each meter of terrain
76 public float terrainStartHeight0 = 10.0f;
77 public float terrainStartHeight1 = 10.0f;
78 public float terrainStartHeight2 = 10.0f;
79 public float terrainStartHeight3 = 10.0f;
80
81 // Second quad - also bilinearly interpolated.
82 // Terrain texturing is done that:
83 // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
84 public float terrainHeightRange0 = 60.0f; //00
85 public float terrainHeightRange1 = 60.0f; //01
86 public float terrainHeightRange2 = 60.0f; //10
87 public float terrainHeightRange3 = 60.0f; //11
88
89 // Terrain Default (Must be in F32 Format!)
90 public string terrainFile = "default.r32";
91 public double terrainMultiplier = 60.0;
92 public float waterHeight = (float)20.0;
93
94 public LLUUID terrainImageID = LLUUID.Zero; // the assetID that is the current Map image for this region
95
96 }
97}
diff --git a/OpenSim/Framework/General/Types/Login.cs b/OpenSim/Framework/General/Types/Login.cs
new file mode 100644
index 0000000..3180a16
--- /dev/null
+++ b/OpenSim/Framework/General/Types/Login.cs
@@ -0,0 +1,52 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class Login
36 {
37 public string First = "Test";
38 public string Last = "User";
39 public LLUUID Agent;
40 public LLUUID Session;
41 public LLUUID SecureSession = LLUUID.Zero;
42 public LLUUID InventoryFolder;
43 public LLUUID BaseFolder;
44 public uint CircuitCode;
45 public string CapsPath ="";
46
47 public Login()
48 {
49
50 }
51 }
52}
diff --git a/OpenSim/Framework/General/Types/MapBlockData.cs b/OpenSim/Framework/General/Types/MapBlockData.cs
new file mode 100644
index 0000000..2e6f56e
--- /dev/null
+++ b/OpenSim/Framework/General/Types/MapBlockData.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class MapBlockData
9 {
10 public uint Flags;
11 public ushort X;
12 public ushort Y;
13 public byte Agents;
14 public byte Access;
15 public byte WaterHeight;
16 public LLUUID MapImageId;
17 public String Name;
18 public uint RegionFlags;
19
20 public MapBlockData()
21 {
22
23 }
24 }
25}
diff --git a/OpenSim/Framework/General/Types/NeighbourInfo.cs b/OpenSim/Framework/General/Types/NeighbourInfo.cs
new file mode 100644
index 0000000..310fd1c
--- /dev/null
+++ b/OpenSim/Framework/General/Types/NeighbourInfo.cs
@@ -0,0 +1,50 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Utilities;
33using OpenSim.Framework.Console;
34using libsecondlife;
35
36namespace OpenSim.Framework.Types
37{
38 public class NeighbourInfo
39 {
40 public NeighbourInfo()
41 {
42 }
43
44 public ulong regionhandle;
45 public uint RegionLocX;
46 public uint RegionLocY;
47 public string sim_ip;
48 public uint sim_port;
49 }
50}
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
new file mode 100644
index 0000000..c6b81a7
--- /dev/null
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -0,0 +1,220 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Interfaces;
32
33namespace OpenSim.Framework.Types
34{
35 public class NetworkServersInfo
36 {
37 public string AssetURL = "http://127.0.0.1:8003/";
38 public string AssetSendKey = "";
39
40 public string GridURL = "";
41 public string GridSendKey = "";
42 public string GridRecvKey = "";
43 public string UserURL = "";
44 public string UserSendKey = "";
45 public string UserRecvKey = "";
46 public bool isSandbox;
47
48 public uint DefaultHomeLocX = 0;
49 public uint DefaultHomeLocY = 0;
50
51 public int HttpListenerPort = 9000;
52 public int RemotingListenerPort = 8895;
53
54 public void InitConfig(bool sandboxMode, IGenericConfig configData)
55 {
56 this.isSandbox = sandboxMode;
57
58 try
59 {
60 string attri = "";
61
62 attri = "";
63 attri = configData.GetAttribute("HttpListenerPort");
64 if (attri == "")
65 {
66 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Http Listener Port", "9000");
67 configData.SetAttribute("HttpListenerPort", location);
68 this.HttpListenerPort = Convert.ToInt32(location);
69 }
70 else
71 {
72 this.HttpListenerPort = Convert.ToInt32(attri);
73 }
74
75 attri = "";
76 attri = configData.GetAttribute("RemotingListenerPort");
77 if (attri == "")
78 {
79 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895");
80 configData.SetAttribute("RemotingListenerPort", location);
81 this.RemotingListenerPort = Convert.ToInt32(location);
82 }
83 else
84 {
85 this.RemotingListenerPort = Convert.ToInt32(attri);
86 }
87
88 if (sandboxMode)
89 {
90 // default home location X
91 attri = "";
92 attri = configData.GetAttribute("DefaultLocationX");
93 if (attri == "")
94 {
95 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location X", "1000");
96 configData.SetAttribute("DefaultLocationX", location);
97 this.DefaultHomeLocX = (uint)Convert.ToUInt32(location);
98 }
99 else
100 {
101 this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri);
102 }
103
104 // default home location Y
105 attri = "";
106 attri = configData.GetAttribute("DefaultLocationY");
107 if (attri == "")
108 {
109 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location Y", "1000");
110 configData.SetAttribute("DefaultLocationY", location);
111 this.DefaultHomeLocY = (uint)Convert.ToUInt32(location);
112 }
113 else
114 {
115 this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri);
116 }
117 }
118 if (!isSandbox)
119 {
120 //Grid Server
121 attri = "";
122 attri = configData.GetAttribute("GridServerURL");
123 if (attri == "")
124 {
125 this.GridURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
126 configData.SetAttribute("GridServerURL", this.GridURL);
127 }
128 else
129 {
130 this.GridURL = attri;
131 }
132
133 //Grid Send Key
134 attri = "";
135 attri = configData.GetAttribute("GridSendKey");
136 if (attri == "")
137 {
138 this.GridSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to grid server", "null");
139 configData.SetAttribute("GridSendKey", this.GridSendKey);
140 }
141 else
142 {
143 this.GridSendKey = attri;
144 }
145
146 //Grid Receive Key
147 attri = "";
148 attri = configData.GetAttribute("GridRecvKey");
149 if (attri == "")
150 {
151 this.GridRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from grid server", "null");
152 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
153 }
154 else
155 {
156 this.GridRecvKey = attri;
157 }
158
159 //Grid Server
160 attri = "";
161 attri = configData.GetAttribute("UserServerURL");
162 if (attri == "")
163 {
164 this.UserURL= OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/");
165 configData.SetAttribute("UserServerURL", this.UserURL);
166 }
167 else
168 {
169 this.UserURL = attri;
170 }
171
172 //Grid Send Key
173 attri = "";
174 attri = configData.GetAttribute("UserSendKey");
175 if (attri == "")
176 {
177 this.UserSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to user server", "null");
178 configData.SetAttribute("UserSendKey", this.UserSendKey);
179 }
180 else
181 {
182 this.UserSendKey = attri;
183 }
184
185 //Grid Receive Key
186 attri = "";
187 attri = configData.GetAttribute("UserRecvKey");
188 if (attri == "")
189 {
190 this.UserRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from user server", "null");
191 configData.SetAttribute("GridRecvKey", this.UserRecvKey);
192 }
193 else
194 {
195 this.UserRecvKey = attri;
196 }
197
198 attri = "";
199 attri = configData.GetAttribute("AssetServerURL");
200 if (attri == "")
201 {
202 this.AssetURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
203 configData.SetAttribute("AssetServerURL", this.GridURL);
204 }
205 else
206 {
207 this.AssetURL = attri;
208 }
209
210 }
211 configData.Commit();
212 }
213 catch (Exception e)
214 {
215 OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
216 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
217 }
218 }
219 }
220}
diff --git a/OpenSim/Framework/General/Types/ParcelData.cs b/OpenSim/Framework/General/Types/ParcelData.cs
new file mode 100644
index 0000000..40f128a
--- /dev/null
+++ b/OpenSim/Framework/General/Types/ParcelData.cs
@@ -0,0 +1,115 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35
36 public class ParcelData
37 {
38 public byte[] parcelBitmapByteArray = new byte[512];
39 public string parcelName = "";
40 public string parcelDesc = "";
41 public LLUUID ownerID = new LLUUID();
42 public bool isGroupOwned = false;
43 public LLVector3 AABBMin = new LLVector3();
44 public LLVector3 AABBMax = new LLVector3();
45 public int area = 0;
46 public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned
47 public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID
48 public libsecondlife.Parcel.ParcelCategory category = new libsecondlife.Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
49 public int claimDate = 0; //Unemplemented
50 public int claimPrice = 0; //Unemplemented
51 public LLUUID groupID = new LLUUID(); //Unemplemented
52 public int groupPrims = 0; //Unemplemented
53 public int salePrice = 0; //Unemeplemented. Parcels price.
54 public libsecondlife.Parcel.ParcelStatus parcelStatus = libsecondlife.Parcel.ParcelStatus.None;
55 public libsecondlife.Parcel.ParcelFlags parcelFlags = libsecondlife.Parcel.ParcelFlags.None;
56 public byte landingType = 0;
57 public byte mediaAutoScale = 0;
58 public LLUUID mediaID = LLUUID.Zero;
59 public int localID = 0;
60 public LLUUID globalID = new LLUUID();
61
62 public string mediaURL = "";
63 public string musicURL = "";
64 public float passHours = 0;
65 public int passPrice = 0;
66 public LLUUID snapshotID = LLUUID.Zero;
67 public LLVector3 userLocation = new LLVector3();
68 public LLVector3 userLookAt = new LLVector3();
69
70 public ParcelData()
71 {
72 globalID = LLUUID.Random();
73 }
74
75 public ParcelData Copy()
76 {
77 ParcelData parcelData = new ParcelData();
78
79 parcelData.AABBMax = this.AABBMax;
80 parcelData.AABBMin = this.AABBMin;
81 parcelData.area = this.area;
82 parcelData.auctionID = this.auctionID;
83 parcelData.authBuyerID = this.authBuyerID;
84 parcelData.category = this.category;
85 parcelData.claimDate = this.claimDate;
86 parcelData.claimPrice = this.claimPrice;
87 parcelData.globalID = this.globalID;
88 parcelData.groupID = this.groupID;
89 parcelData.groupPrims = this.groupPrims;
90 parcelData.isGroupOwned = this.isGroupOwned;
91 parcelData.localID = this.localID;
92 parcelData.landingType = this.landingType;
93 parcelData.mediaAutoScale = this.mediaAutoScale;
94 parcelData.mediaID = this.mediaID;
95 parcelData.mediaURL = this.mediaURL;
96 parcelData.musicURL = this.musicURL;
97 parcelData.ownerID = this.ownerID;
98 parcelData.parcelBitmapByteArray = (byte[])this.parcelBitmapByteArray.Clone();
99 parcelData.parcelDesc = this.parcelDesc;
100 parcelData.parcelFlags = this.parcelFlags;
101 parcelData.parcelName = this.parcelName;
102 parcelData.parcelStatus = this.parcelStatus;
103 parcelData.passHours = this.passHours;
104 parcelData.passPrice = this.passPrice;
105 parcelData.salePrice = this.salePrice;
106 parcelData.snapshotID = this.snapshotID;
107 parcelData.userLocation = this.userLocation;
108 parcelData.userLookAt = this.userLookAt;
109
110 return parcelData;
111
112 }
113 }
114
115}
diff --git a/OpenSim/Framework/General/Types/PrimData.cs b/OpenSim/Framework/General/Types/PrimData.cs
new file mode 100644
index 0000000..f84ae3e
--- /dev/null
+++ b/OpenSim/Framework/General/Types/PrimData.cs
@@ -0,0 +1,230 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Framework.Types
34{
35 public class PrimData
36 {
37 private const uint FULL_MASK_PERMISSIONS = 2147483647;
38
39 public LLUUID OwnerID;
40 public byte PCode;
41 public ushort PathBegin;
42 public ushort PathEnd;
43 public byte PathScaleX;
44 public byte PathScaleY;
45 public byte PathShearX;
46 public byte PathShearY;
47 public sbyte PathSkew;
48 public ushort ProfileBegin;
49 public ushort ProfileEnd;
50 public LLVector3 Scale;
51 public byte PathCurve;
52 public byte ProfileCurve;
53 public uint ParentID = 0;
54 public ushort ProfileHollow;
55 public sbyte PathRadiusOffset;
56 public byte PathRevolutions;
57 public sbyte PathTaperX;
58 public sbyte PathTaperY;
59 public sbyte PathTwist;
60 public sbyte PathTwistBegin;
61 public byte[] TextureEntry; // a LL textureEntry in byte[] format
62
63 public Int32 CreationDate;
64 public uint OwnerMask = FULL_MASK_PERMISSIONS;
65 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
66 public uint GroupMask = FULL_MASK_PERMISSIONS;
67 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
68 public uint BaseMask = FULL_MASK_PERMISSIONS;
69
70 //following only used during prim storage
71 public LLVector3 Position;
72 public LLQuaternion Rotation = new LLQuaternion(0, 1, 0, 0);
73 public uint LocalID;
74 public LLUUID FullID;
75
76 public PrimData()
77 {
78
79 }
80
81 public PrimData(byte[] data)
82 {
83 int i = 0;
84
85 this.OwnerID = new LLUUID(data, i); i += 16;
86 this.PCode = data[i++];
87 this.PathBegin = (ushort)(data[i++] + (data[i++] << 8));
88 this.PathEnd = (ushort)(data[i++] + (data[i++] << 8));
89 this.PathScaleX = data[i++];
90 this.PathScaleY = data[i++];
91 this.PathShearX = data[i++];
92 this.PathShearY = data[i++];
93 this.PathSkew = (sbyte)data[i++];
94 this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8));
95 this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8));
96 this.Scale = new LLVector3(data, i); i += 12;
97 this.PathCurve = data[i++];
98 this.ProfileCurve = data[i++];
99 this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
100 this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8));
101 this.PathRadiusOffset = (sbyte)data[i++];
102 this.PathRevolutions = data[i++];
103 this.PathTaperX = (sbyte)data[i++];
104 this.PathTaperY = (sbyte)data[i++];
105 this.PathTwist = (sbyte)data[i++];
106 this.PathTwistBegin = (sbyte)data[i++];
107 ushort length = (ushort)(data[i++] + (data[i++] << 8));
108 this.TextureEntry = new byte[length];
109 Array.Copy(data, i, TextureEntry, 0, length); i += length;
110 this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
111 this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
112 this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
113 this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
114 this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
115 this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
116 this.Position = new LLVector3(data, i); i += 12;
117 this.Rotation = new LLQuaternion(data, i, true); i += 12;
118 this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
119 this.FullID = new LLUUID(data, i); i += 16;
120
121 }
122
123 public byte[] ToBytes()
124 {
125 int i = 0;
126 byte[] bytes = new byte[126 + TextureEntry.Length];
127 Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
128 bytes[i++] = this.PCode;
129 bytes[i++] = (byte)(this.PathBegin % 256);
130 bytes[i++] = (byte)((this.PathBegin >> 8) % 256);
131 bytes[i++] = (byte)(this.PathEnd % 256);
132 bytes[i++] = (byte)((this.PathEnd >> 8) % 256);
133 bytes[i++] = this.PathScaleX;
134 bytes[i++] = this.PathScaleY;
135 bytes[i++] = this.PathShearX;
136 bytes[i++] = this.PathShearY;
137 bytes[i++] = (byte)this.PathSkew;
138 bytes[i++] = (byte)(this.ProfileBegin % 256);
139 bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256);
140 bytes[i++] = (byte)(this.ProfileEnd % 256);
141 bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256);
142 Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
143 bytes[i++] = this.PathCurve;
144 bytes[i++] = this.ProfileCurve;
145 bytes[i++] = (byte)(ParentID % 256);
146 bytes[i++] = (byte)((ParentID >> 8) % 256);
147 bytes[i++] = (byte)((ParentID >> 16) % 256);
148 bytes[i++] = (byte)((ParentID >> 24) % 256);
149 bytes[i++] = (byte)(this.ProfileHollow % 256);
150 bytes[i++] = (byte)((this.ProfileHollow >> 8) % 256);
151 bytes[i++] = ((byte)this.PathRadiusOffset);
152 bytes[i++] = this.PathRevolutions;
153 bytes[i++] = ((byte)this.PathTaperX);
154 bytes[i++] = ((byte)this.PathTaperY);
155 bytes[i++] = ((byte)this.PathTwist);
156 bytes[i++] = ((byte)this.PathTwistBegin);
157 bytes[i++] = (byte)(TextureEntry.Length % 256);
158 bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
159 Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
160 bytes[i++] = (byte)(this.CreationDate % 256);
161 bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
162 bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
163 bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
164 bytes[i++] = (byte)(this.OwnerMask % 256);
165 bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
166 bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
167 bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
168 bytes[i++] = (byte)(this.NextOwnerMask % 256);
169 bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
170 bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
171 bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
172 bytes[i++] = (byte)(this.GroupMask % 256);
173 bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
174 bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
175 bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
176 bytes[i++] = (byte)(this.EveryoneMask % 256);
177 bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
178 bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
179 bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
180 bytes[i++] = (byte)(this.BaseMask % 256);
181 bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
182 bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
183 bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
184 Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
185 if (this.Rotation == new LLQuaternion(0, 0, 0, 0))
186 {
187 this.Rotation = new LLQuaternion(0, 1, 0, 0);
188 }
189 Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
190 bytes[i++] = (byte)(this.LocalID % 256);
191 bytes[i++] = (byte)((this.LocalID >> 8) % 256);
192 bytes[i++] = (byte)((this.LocalID >> 16) % 256);
193 bytes[i++] = (byte)((this.LocalID >> 24) % 256);
194 Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
195
196 return bytes;
197 }
198
199 public static PrimData DefaultCube()
200 {
201 PrimData primData = new PrimData();
202 primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
203 primData.FullID = LLUUID.Random();
204 primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
205 primData.Rotation = new LLQuaternion(0, 0, 0, 1);
206 primData.PCode = 9;
207 primData.ParentID = 0;
208 primData.PathBegin = 0;
209 primData.PathEnd = 0;
210 primData.PathScaleX = 0;
211 primData.PathScaleY = 0;
212 primData.PathShearX = 0;
213 primData.PathShearY = 0;
214 primData.PathSkew = 0;
215 primData.ProfileBegin = 0;
216 primData.ProfileEnd = 0;
217 primData.PathCurve = 16;
218 primData.ProfileCurve = 1;
219 primData.ProfileHollow = 0;
220 primData.PathRadiusOffset = 0;
221 primData.PathRevolutions = 0;
222 primData.PathTaperX = 0;
223 primData.PathTaperY = 0;
224 primData.PathTwist = 0;
225 primData.PathTwistBegin = 0;
226
227 return primData;
228 }
229 }
230}
diff --git a/OpenSim/Framework/General/Types/RegionHandle.cs b/OpenSim/Framework/General/Types/RegionHandle.cs
new file mode 100644
index 0000000..1271d04
--- /dev/null
+++ b/OpenSim/Framework/General/Types/RegionHandle.cs
@@ -0,0 +1,120 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5
6namespace OpenSim.Framework.Types
7{
8 /// <summary>
9 /// A class for manipulating RegionHandle coordinates
10 /// </summary>
11 class RegionHandle
12 {
13 private UInt64 handle;
14
15 /// <summary>
16 /// Initialises a new grid-aware RegionHandle
17 /// </summary>
18 /// <param name="ip">IP Address of the Grid Server for this region</param>
19 /// <param name="x">Grid X Coordinate</param>
20 /// <param name="y">Grid Y Coordinate</param>
21 public RegionHandle(string ip, short x, short y)
22 {
23 IPAddress addr = IPAddress.Parse(ip);
24
25 long baseHandle = addr.Address;
26
27 // Split the IP address in half
28 short a = (short)((baseHandle << 16) & 0xFFFF);
29 short b = (short)((baseHandle << 0) & 0xFFFF);
30
31 // Raise the bounds a little
32 uint nx = (uint)x;
33 uint ny = (uint)y;
34
35 // Multiply grid coords to get region coords
36 nx *= 256;
37 ny *= 256;
38
39 // Stuff the IP address in too
40 nx = (uint)a << 16;
41 ny = (uint)b << 16;
42
43 handle = ((UInt64)nx << 32) | (uint)ny;
44 }
45
46 /// <summary>
47 /// Initialises a new RegionHandle that is not inter-grid aware
48 /// </summary>
49 /// <param name="x">Grid X Coordinate</param>
50 /// <param name="y">Grid Y Coordinate</param>
51 public RegionHandle(uint x, uint y)
52 {
53 handle = ((x * 256) << 32) | (y * 256);
54 }
55
56 /// <summary>
57 /// Initialises a new RegionHandle from an existing value
58 /// </summary>
59 /// <param name="Region">A U64 RegionHandle</param>
60 public RegionHandle(UInt64 Region)
61 {
62 handle = Region;
63 }
64
65 /// <summary>
66 /// Returns the Grid Masked RegionHandle - For use in Teleport packets and other packets where sending the grid IP address may be handy.
67 /// </summary>
68 /// <remarks>Do not use for SimulatorEnable packets. The client will choke.</remarks>
69 /// <returns>Region Handle including IP Address encoding</returns>
70 public UInt64 getTeleportHandle()
71 {
72 return handle;
73 }
74
75 /// <summary>
76 /// Returns a RegionHandle which may be used for SimulatorEnable packets. Removes the IP address encoding and returns the lower bounds.
77 /// </summary>
78 /// <returns>A U64 RegionHandle for use in SimulatorEnable packets.</returns>
79 public UInt64 getNeighbourHandle()
80 {
81 UInt64 mask = 0x0000FFFF0000FFFF;
82
83 return handle | mask;
84 }
85
86 /// <summary>
87 /// Returns the IP Address of the GridServer from a Grid-Encoded RegionHandle
88 /// </summary>
89 /// <returns>Grid Server IP Address</returns>
90 public IPAddress getGridIP()
91 {
92 uint a = (uint)((handle >> 16) & 0xFFFF);
93 uint b = (uint)((handle >> 48) & 0xFFFF);
94
95 return new IPAddress((long)(a << 16) | (long)b);
96 }
97
98 /// <summary>
99 /// Returns the X Coordinate from a Grid-Encoded RegionHandle
100 /// </summary>
101 /// <returns>X Coordinate</returns>
102 public uint getGridX()
103 {
104 uint x = (uint)((handle >> 32) & 0xFFFF);
105
106 return x;
107 }
108
109 /// <summary>
110 /// Returns the Y Coordinate from a Grid-Encoded RegionHandle
111 /// </summary>
112 /// <returns>Y Coordinate</returns>
113 public uint getGridY()
114 {
115 uint y = (uint)((handle >> 0) & 0xFFFF);
116
117 return y;
118 }
119 }
120}
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs
new file mode 100644
index 0000000..0fba6ca
--- /dev/null
+++ b/OpenSim/Framework/General/Types/RegionInfo.cs
@@ -0,0 +1,304 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using System.Globalization;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Utilities;
34using OpenSim.Framework.Console;
35using libsecondlife;
36
37namespace OpenSim.Framework.Types
38{
39 public class RegionInfo
40 {
41 public LLUUID SimUUID = new LLUUID();
42 public string RegionName = "";
43 public uint RegionLocX = 0;
44 public uint RegionLocY = 0;
45 public ulong RegionHandle = 0;
46
47 public string DataStore = "";
48 public bool isSandbox = false;
49
50 public LLUUID MasterAvatarAssignedUUID = new LLUUID();
51 public string MasterAvatarFirstName = "";
52 public string MasterAvatarLastName = "";
53 public string MasterAvatarSandboxPassword = "";
54
55 /// <summary>
56 /// Port used for listening (TCP and UDP)
57 /// </summary>
58 /// <remarks>Seperate TCP and UDP</remarks>
59 public int CommsIPListenPort = 0;
60 /// <summary>
61 /// Address used for internal listening (default: 0.0.0.0?)
62 /// </summary>
63 public string CommsIPListenAddr = "";
64 /// <summary>
65 /// Address used for external addressing (DNS or IP)
66 /// </summary>
67 public string CommsExternalAddress = "";
68
69
70 public EstateSettings estateSettings;
71
72 public RegionInfo()
73 {
74 estateSettings = new EstateSettings();
75 }
76
77
78 public void InitConfig(bool sandboxMode, IGenericConfig configData)
79 {
80 this.isSandbox = sandboxMode;
81 try
82 {
83 // Sim UUID
84 string attri = "";
85 attri = configData.GetAttribute("SimUUID");
86 if (attri == "")
87 {
88 this.SimUUID = LLUUID.Random();
89 configData.SetAttribute("SimUUID", this.SimUUID.ToString());
90 }
91 else
92 {
93 this.SimUUID = new LLUUID(attri);
94 }
95
96 // Sim name
97 attri = "";
98 attri = configData.GetAttribute("SimName");
99 if (attri == "")
100 {
101 this.RegionName = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Name", "OpenSim test");
102 configData.SetAttribute("SimName", this.RegionName);
103 }
104 else
105 {
106 this.RegionName = attri;
107 }
108 // Sim/Grid location X
109 attri = "";
110 attri = configData.GetAttribute("SimLocationX");
111 if (attri == "")
112 {
113 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid Location X", "1000");
114 configData.SetAttribute("SimLocationX", location);
115 this.RegionLocX = (uint)Convert.ToUInt32(location);
116 }
117 else
118 {
119 this.RegionLocX = (uint)Convert.ToUInt32(attri);
120 }
121 // Sim/Grid location Y
122 attri = "";
123 attri = configData.GetAttribute("SimLocationY");
124 if (attri == "")
125 {
126 string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid Location Y", "1000");
127 configData.SetAttribute("SimLocationY", location);
128 this.RegionLocY = (uint)Convert.ToUInt32(location);
129 }
130 else
131 {
132 this.RegionLocY = (uint)Convert.ToUInt32(attri);
133 }
134
135 // Local storage datastore
136 attri = "";
137 attri = configData.GetAttribute("Datastore");
138 if (attri == "")
139 {
140 string datastore = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Filename for local storage", "localworld.yap");
141 configData.SetAttribute("Datastore", datastore);
142 this.DataStore = datastore;
143 }
144 else
145 {
146 this.DataStore = attri;
147 }
148
149 //Sim Listen Port
150 attri = "";
151 attri = configData.GetAttribute("SimListenPort");
152 if (attri == "")
153 {
154 string port = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("UDP port for client connections", "9000");
155 configData.SetAttribute("SimListenPort", port);
156 this.CommsIPListenPort = Convert.ToInt32(port);
157 }
158 else
159 {
160 this.CommsIPListenPort = Convert.ToInt32(attri);
161 }
162
163 //Sim Listen Address
164 attri = "";
165 attri = configData.GetAttribute("SimListenAddress");
166 if (attri == "")
167 {
168 this.CommsIPListenAddr = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("IP Address to listen on for client connections", "0.0.0.0");
169 configData.SetAttribute("SimListenAddress", this.CommsIPListenAddr);
170 }
171 else
172 {
173 // Probably belongs elsewhere, but oh well.
174 if (attri.Trim().StartsWith("SYSTEMIP"))
175 {
176 string localhostname = System.Net.Dns.GetHostName();
177 System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname);
178 try
179 {
180 this.CommsIPListenAddr = "0.0.0.0"; // Incase a IPv4 address isnt found
181
182 foreach (System.Net.IPAddress ip in ips)
183 {
184 if (ip.AddressFamily.ToString() == System.Net.Sockets.ProtocolFamily.InterNetwork.ToString())
185 {
186 this.CommsIPListenAddr = ip.ToString();
187 break;
188 }
189 }
190 }
191 catch (Exception e)
192 {
193 e.ToString();
194 this.CommsIPListenAddr = "0.0.0.0"; // Use the default if we fail
195 }
196 }
197 else
198 {
199 this.CommsIPListenAddr = attri;
200 }
201 }
202
203 // Sim External Address
204 attri = "";
205 attri = configData.GetAttribute("SimExternalAddress");
206 if (attri == "")
207 {
208 this.CommsExternalAddress = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("IP or DNS address to send external clients to", "localhost");
209 configData.SetAttribute("SimExternalAddress", this.CommsExternalAddress);
210 }
211 else
212 {
213 this.CommsExternalAddress = attri;
214 }
215
216 attri = "";
217 attri = configData.GetAttribute("TerrainFile");
218 if (attri == "")
219 {
220 this.estateSettings.terrainFile = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("GENERAL SETTING: Default Terrain File", "default.r32");
221 configData.SetAttribute("TerrainFile", this.estateSettings.terrainFile);
222 }
223 else
224 {
225 this.estateSettings.terrainFile = attri;
226 }
227
228 attri = "";
229 attri = configData.GetAttribute("TerrainMultiplier");
230 if (attri == "")
231 {
232 string re = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0");
233 this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture);
234 configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString());
235 }
236 else
237 {
238 this.estateSettings.terrainMultiplier = Convert.ToDouble(attri);
239 }
240
241 attri = "";
242 attri = configData.GetAttribute("MasterAvatarFirstName");
243 if (attri == "")
244 {
245 this.MasterAvatarFirstName = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test");
246
247 configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName);
248 }
249 else
250 {
251 this.MasterAvatarFirstName = attri;
252 }
253
254 attri = "";
255 attri = configData.GetAttribute("MasterAvatarLastName");
256 if (attri == "")
257 {
258 this.MasterAvatarLastName = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User");
259
260 configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName);
261 }
262 else
263 {
264 this.MasterAvatarLastName = attri;
265 }
266
267 if (isSandbox) //Sandbox Mode Specific Settings
268 {
269 attri = "";
270 attri = configData.GetAttribute("MasterAvatarSandboxPassword");
271 if (attri == "")
272 {
273 this.MasterAvatarSandboxPassword = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test");
274
275 //Should I store this?
276 configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword);
277 }
278 else
279 {
280 this.MasterAvatarSandboxPassword = attri;
281 }
282 }
283
284 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
285
286 configData.Commit();
287 }
288 catch (Exception e)
289 {
290 OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
291 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
292 }
293
294 OpenSim.Framework.Console.MainLog.Instance.Verbose("Sim settings loaded:");
295 OpenSim.Framework.Console.MainLog.Instance.Verbose( "UUID: " + this.SimUUID.ToStringHyphenated());
296 OpenSim.Framework.Console.MainLog.Instance.Verbose( "Name: " + this.RegionName);
297 OpenSim.Framework.Console.MainLog.Instance.Verbose( "Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
298 OpenSim.Framework.Console.MainLog.Instance.Verbose( "Region Handle: " + this.RegionHandle.ToString());
299 OpenSim.Framework.Console.MainLog.Instance.Verbose( "Listening on IP: " + this.CommsIPListenAddr + ":" + this.CommsIPListenPort);
300 OpenSim.Framework.Console.MainLog.Instance.Verbose( "Sandbox Mode? " + isSandbox.ToString());
301
302 }
303 }
304}
diff --git a/OpenSim/Framework/General/UserProfile.cs b/OpenSim/Framework/General/UserProfile.cs
new file mode 100644
index 0000000..263dba2
--- /dev/null
+++ b/OpenSim/Framework/General/UserProfile.cs
@@ -0,0 +1,89 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using OpenSim.Framework.Inventory;
33using System.Security.Cryptography;
34
35namespace OpenSim.Framework.User
36{
37 public class UserProfile
38 {
39
40 public string firstname;
41 public string lastname;
42 public ulong homeregionhandle;
43 public LLVector3 homepos;
44 public LLVector3 homelookat;
45
46 public bool IsGridGod = false;
47 public bool IsLocal = true; // will be used in future for visitors from foreign grids
48 public string AssetURL;
49 public string MD5passwd;
50
51 public LLUUID CurrentSessionID;
52 public LLUUID CurrentSecureSessionID;
53 public LLUUID UUID;
54 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
55
56 public AgentInventory Inventory;
57
58 public UserProfile()
59 {
60 Circuits = new Dictionary<LLUUID, uint>();
61 Inventory = new AgentInventory();
62 homeregionhandle = Helpers.UIntsToLong((1000 * 256), (1000 * 256));
63 homepos = new LLVector3();
64 homelookat = new LLVector3();
65 }
66
67 public void InitSessionData()
68 {
69 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
70
71 byte[] randDataS = new byte[16];
72 byte[] randDataSS = new byte[16];
73
74 rand.GetBytes(randDataS);
75 rand.GetBytes(randDataSS);
76
77 CurrentSecureSessionID = new LLUUID(randDataSS,0);
78 CurrentSessionID = new LLUUID(randDataS,0);
79
80 }
81
82 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
83 {
84 if (this.Circuits.ContainsKey(regionUUID) == false)
85 this.Circuits.Add(regionUUID, circuitCode);
86 }
87
88 }
89}
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs
new file mode 100644
index 0000000..8c34c9b
--- /dev/null
+++ b/OpenSim/Framework/General/Util.cs
@@ -0,0 +1,186 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Security.Cryptography;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33using libsecondlife.Packets;
34
35namespace OpenSim.Framework.Utilities
36{
37 public class Util
38 {
39 private static Random randomClass = new Random();
40 private static uint nextXferID = 5000;
41 private static object XferLock = new object();
42
43 public static ulong UIntsToLong(uint X, uint Y)
44 {
45 return Helpers.UIntsToLong(X, Y);
46 }
47
48 public static Random RandomClass
49 {
50 get
51 {
52 return randomClass;
53 }
54 }
55
56 public static uint GetNextXferID()
57 {
58 uint id = 0;
59 lock(XferLock)
60 {
61 id = nextXferID;
62 nextXferID++;
63 }
64 return id;
65 }
66
67 public static int UnixTimeSinceEpoch()
68 {
69 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
70 int timestamp = (int)t.TotalSeconds;
71 return timestamp;
72 }
73
74 public static string Md5Hash(string pass)
75 {
76 MD5 md5 = MD5CryptoServiceProvider.Create();
77 byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass));
78 StringBuilder sb = new StringBuilder();
79 for (int i = 0; i < dataMd5.Length; i++)
80 sb.AppendFormat("{0:x2}", dataMd5[i]);
81 return sb.ToString();
82 }
83
84 public static string GetRandomCapsPath()
85 {
86 LLUUID caps = LLUUID.Random();
87 string capsPath = caps.ToStringHyphenated();
88 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
89 return capsPath;
90 }
91
92 //public static int fast_distance2d(int x, int y)
93 //{
94 // x = System.Math.Abs(x);
95 // y = System.Math.Abs(y);
96
97 // int min = System.Math.Min(x, y);
98
99 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
100 //}
101
102 public static string FieldToString(byte[] bytes)
103 {
104 return FieldToString(bytes, String.Empty);
105 }
106
107 /// <summary>
108 /// Convert a variable length field (byte array) to a string, with a
109 /// field name prepended to each line of the output
110 /// </summary>
111 /// <remarks>If the byte array has unprintable characters in it, a
112 /// hex dump will be put in the string instead</remarks>
113 /// <param name="bytes">The byte array to convert to a string</param>
114 /// <param name="fieldName">A field name to prepend to each line of output</param>
115 /// <returns>An ASCII string or a string containing a hex dump, minus
116 /// the null terminator</returns>
117 public static string FieldToString(byte[] bytes, string fieldName)
118 {
119 // Check for a common case
120 if (bytes.Length == 0) return String.Empty;
121
122 StringBuilder output = new StringBuilder();
123 bool printable = true;
124
125 for (int i = 0; i < bytes.Length; ++i)
126 {
127 // Check if there are any unprintable characters in the array
128 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
129 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
130 {
131 printable = false;
132 break;
133 }
134 }
135
136 if (printable)
137 {
138 if (fieldName.Length > 0)
139 {
140 output.Append(fieldName);
141 output.Append(": ");
142 }
143
144 if (bytes[bytes.Length - 1] == 0x00)
145 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
146 else
147 output.Append(UTF8Encoding.UTF8.GetString(bytes));
148 }
149 else
150 {
151 for (int i = 0; i < bytes.Length; i += 16)
152 {
153 if (i != 0)
154 output.Append(Environment.NewLine);
155 if (fieldName.Length > 0)
156 {
157 output.Append(fieldName);
158 output.Append(": ");
159 }
160
161 for (int j = 0; j < 16; j++)
162 {
163 if ((i + j) < bytes.Length)
164 output.Append(String.Format("{0:X2} ", bytes[i + j]));
165 else
166 output.Append(" ");
167 }
168
169 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
170 {
171 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
172 output.Append((char)bytes[i + j]);
173 else
174 output.Append(".");
175 }
176 }
177 }
178
179 return output.ToString();
180 }
181 public Util()
182 {
183
184 }
185 }
186}