aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenSim.Framework
diff options
context:
space:
mode:
Diffstat (limited to 'Common/OpenSim.Framework')
-rw-r--r--Common/OpenSim.Framework/AgentInventory.cs251
-rw-r--r--Common/OpenSim.Framework/BlockingQueue.cs33
-rw-r--r--Common/OpenSim.Framework/HeightMapGenHills.cs149
-rw-r--r--Common/OpenSim.Framework/Interfaces/IAssetServer.cs68
-rw-r--r--Common/OpenSim.Framework/Interfaces/IClientAPI.cs30
-rw-r--r--Common/OpenSim.Framework/Interfaces/IConfig.cs76
-rw-r--r--Common/OpenSim.Framework/Interfaces/IGenericConfig.cs15
-rw-r--r--Common/OpenSim.Framework/Interfaces/IGridConfig.cs64
-rw-r--r--Common/OpenSim.Framework/Interfaces/IGridServer.cs81
-rw-r--r--Common/OpenSim.Framework/Interfaces/ILocalStorage.cs54
-rw-r--r--Common/OpenSim.Framework/Interfaces/IScriptAPI.cs14
-rw-r--r--Common/OpenSim.Framework/Interfaces/IScriptEngine.cs14
-rw-r--r--Common/OpenSim.Framework/Interfaces/IUserConfig.cs58
-rw-r--r--Common/OpenSim.Framework/Interfaces/IUserServer.cs15
-rw-r--r--Common/OpenSim.Framework/Interfaces/LocalGridBase.cs24
-rw-r--r--Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs37
-rw-r--r--Common/OpenSim.Framework/LoginService.cs14
-rw-r--r--Common/OpenSim.Framework/OpenSim.Framework.csproj200
-rw-r--r--Common/OpenSim.Framework/OpenSim.Framework.csproj.user12
-rw-r--r--Common/OpenSim.Framework/OpenSim.Framework.dll.build75
-rw-r--r--Common/OpenSim.Framework/Properties/AssemblyInfo.cs33
-rw-r--r--Common/OpenSim.Framework/Remoting.cs109
-rw-r--r--Common/OpenSim.Framework/SimProfile.cs83
-rw-r--r--Common/OpenSim.Framework/SimProfileBase.cs27
-rw-r--r--Common/OpenSim.Framework/Types/AgentCiruitData.cs22
-rw-r--r--Common/OpenSim.Framework/Types/AssetBase.cs22
-rw-r--r--Common/OpenSim.Framework/Types/AssetLandmark.cs34
-rw-r--r--Common/OpenSim.Framework/Types/AssetStorage.cs23
-rw-r--r--Common/OpenSim.Framework/Types/Login.cs24
-rw-r--r--Common/OpenSim.Framework/Types/NeighbourInfo.cs19
-rw-r--r--Common/OpenSim.Framework/Types/OSVector3.cs18
-rw-r--r--Common/OpenSim.Framework/Types/PrimData.cs173
-rw-r--r--Common/OpenSim.Framework/UserProfile.cs62
-rw-r--r--Common/OpenSim.Framework/UserProfileManager.cs272
-rw-r--r--Common/OpenSim.Framework/UserProfileManagerBase.cs124
-rw-r--r--Common/OpenSim.Framework/Util.cs151
36 files changed, 2480 insertions, 0 deletions
diff --git a/Common/OpenSim.Framework/AgentInventory.cs b/Common/OpenSim.Framework/AgentInventory.cs
new file mode 100644
index 0000000..b28645e
--- /dev/null
+++ b/Common/OpenSim.Framework/AgentInventory.cs
@@ -0,0 +1,251 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6using OpenSim.Framework.Types;
7using OpenSim.Framework.Utilities;
8
9namespace OpenSim.Framework.Inventory
10{
11 public class AgentInventory
12 {
13 //Holds the local copy of Inventory info for a agent
14 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
15 public Dictionary<LLUUID, InventoryItem> InventoryItems;
16 public InventoryFolder InventoryRoot;
17 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
18 public LLUUID AgentID;
19 public AvatarWearable[] Wearables;
20
21 public AgentInventory()
22 {
23 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
24 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
25 this.Initialise();
26 }
27
28 public virtual void Initialise()
29 {
30 Wearables = new AvatarWearable[13]; //should be 12 of these
31 for (int i = 0; i < 13; i++)
32 {
33 Wearables[i] = new AvatarWearable();
34 }
35
36 }
37
38 public bool CreateNewFolder(LLUUID folderID, ushort type)
39 {
40 InventoryFolder Folder = new InventoryFolder();
41 Folder.FolderID = folderID;
42 Folder.OwnerID = this.AgentID;
43 Folder.DefaultType = type;
44 this.InventoryFolders.Add(Folder.FolderID, Folder);
45 return (true);
46 }
47
48 public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
49 {
50 this.AgentID = newAgentID;
51 InventoryRoot = new InventoryFolder();
52 InventoryRoot.FolderID = LLUUID.Random();
53 InventoryRoot.ParentID = new LLUUID();
54 InventoryRoot.Version = 1;
55 InventoryRoot.DefaultType = 8;
56 InventoryRoot.OwnerID = this.AgentID;
57 InventoryRoot.FolderName = "My Inventory";
58 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
59 InventoryRoot.OwnerID = this.AgentID;
60 if (createTextures)
61 {
62 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
63 }
64 }
65
66 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
67 {
68 InventoryFolder Folder = new InventoryFolder();
69 Folder.FolderID = folderID;
70 Folder.OwnerID = this.AgentID;
71 Folder.DefaultType = type;
72 Folder.FolderName = folderName;
73 this.InventoryFolders.Add(Folder.FolderID, Folder);
74
75 return (true);
76 }
77
78 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
79 {
80 if (!this.InventoryFolders.ContainsKey(folderID))
81 {
82 Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
83 InventoryFolder Folder = new InventoryFolder();
84 Folder.FolderID = folderID;
85 Folder.OwnerID = this.AgentID;
86 Folder.DefaultType = type;
87 Folder.FolderName = folderName;
88 Folder.ParentID = parent;
89 this.InventoryFolders.Add(Folder.FolderID, Folder);
90 }
91
92 return (true);
93 }
94
95 public bool HasFolder(LLUUID folderID)
96 {
97 if (this.InventoryFolders.ContainsKey(folderID))
98 {
99 return true;
100 }
101 return false;
102 }
103
104 public LLUUID GetFolderID(string folderName)
105 {
106 foreach (InventoryFolder inv in this.InventoryFolders.Values)
107 {
108 if (inv.FolderName == folderName)
109 {
110 return inv.FolderID;
111 }
112 }
113
114 return LLUUID.Zero;
115 }
116
117 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
118 {
119 if(this.InventoryItems.ContainsKey(itemID))
120 {
121 InventoryItem Item = this.InventoryItems[itemID];
122 Item.AssetID = asset.FullID;
123 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated());
124 //TODO need to update the rest of the info
125 }
126 return true;
127 }
128
129 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
130 {
131 Console.WriteLine("updating inventory item details");
132 if (this.InventoryItems.ContainsKey(itemID))
133 {
134 Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name));
135 InventoryItem Item = this.InventoryItems[itemID];
136 Item.Name = Util.FieldToString(packet.Name);
137 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
138 //TODO need to update the rest of the info
139 }
140 return true;
141 }
142
143 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
144 {
145 if (this.InventoryFolders.ContainsKey(folderID))
146 {
147 LLUUID NewItemID = LLUUID.Random();
148
149 InventoryItem Item = new InventoryItem();
150 Item.FolderID = folderID;
151 Item.OwnerID = AgentID;
152 Item.AssetID = asset.FullID;
153 Item.ItemID = NewItemID;
154 Item.Type = asset.Type;
155 Item.Name = asset.Name;
156 Item.Description = asset.Description;
157 Item.InvType = asset.InvType;
158 this.InventoryItems.Add(Item.ItemID, Item);
159 InventoryFolder Folder = InventoryFolders[Item.FolderID];
160 Folder.Items.Add(Item);
161 return (Item.ItemID);
162 }
163 else
164 {
165 return (null);
166 }
167 }
168
169 public bool DeleteFromInventory(LLUUID itemID)
170 {
171 bool res = false;
172 if (this.InventoryItems.ContainsKey(itemID))
173 {
174 InventoryItem item = this.InventoryItems[itemID];
175 this.InventoryItems.Remove(itemID);
176 foreach (InventoryFolder fold in InventoryFolders.Values)
177 {
178 if (fold.Items.Contains(item))
179 {
180 fold.Items.Remove(item);
181 break;
182 }
183 }
184 res = true;
185
186 }
187 return res;
188 }
189 }
190
191 public class InventoryFolder
192 {
193 public List<InventoryItem> Items;
194 //public List<InventoryFolder> Subfolders;
195 public LLUUID FolderID;
196 public LLUUID OwnerID;
197 public LLUUID ParentID = LLUUID.Zero;
198 public string FolderName;
199 public ushort DefaultType;
200 public ushort Version;
201
202 public InventoryFolder()
203 {
204 Items = new List<InventoryItem>();
205 //Subfolders = new List<InventoryFolder>();
206 }
207
208 }
209
210 public class InventoryItem
211 {
212 public LLUUID FolderID;
213 public LLUUID OwnerID;
214 public LLUUID ItemID;
215 public LLUUID AssetID;
216 public LLUUID CreatorID;
217 public sbyte InvType;
218 public sbyte Type;
219 public string Name ="";
220 public string Description;
221
222 public InventoryItem()
223 {
224 this.CreatorID = LLUUID.Zero;
225 }
226
227 public string ExportString()
228 {
229 string typ = "notecard";
230 string result = "";
231 result += "\tinv_object\t0\n\t{\n";
232 result += "\t\tobj_id\t%s\n";
233 result += "\t\tparent_id\t"+ ItemID.ToString() +"\n";
234 result += "\t\ttype\t"+ typ +"\n";
235 result += "\t\tname\t" + Name+"|\n";
236 result += "\t}\n";
237 return result;
238 }
239 }
240
241 public class AvatarWearable
242 {
243 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
244 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
245
246 public AvatarWearable()
247 {
248
249 }
250 }
251}
diff --git a/Common/OpenSim.Framework/BlockingQueue.cs b/Common/OpenSim.Framework/BlockingQueue.cs
new file mode 100644
index 0000000..f840354
--- /dev/null
+++ b/Common/OpenSim.Framework/BlockingQueue.cs
@@ -0,0 +1,33 @@
1using System;
2using System.Threading;
3using System.Collections.Generic;
4using System.Text;
5
6namespace OpenSim.Framework.Utilities
7{
8 public class BlockingQueue<T>
9 {
10 private Queue<T> _queue = new Queue<T>();
11 private object _queueSync = new object();
12
13 public void Enqueue(T value)
14 {
15 lock (_queueSync)
16 {
17 _queue.Enqueue(value);
18 Monitor.Pulse(_queueSync);
19 }
20 }
21
22 public T Dequeue()
23 {
24 lock (_queueSync)
25 {
26 if (_queue.Count < 1)
27 Monitor.Wait(_queueSync);
28
29 return _queue.Dequeue();
30 }
31 }
32 }
33}
diff --git a/Common/OpenSim.Framework/HeightMapGenHills.cs b/Common/OpenSim.Framework/HeightMapGenHills.cs
new file mode 100644
index 0000000..6a729da
--- /dev/null
+++ b/Common/OpenSim.Framework/HeightMapGenHills.cs
@@ -0,0 +1,149 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29
30namespace OpenSim.Framework.Terrain
31{
32 public class HeightmapGenHills
33 {
34 private Random Rand = new Random();
35 private int NumHills;
36 private float HillMin;
37 private float HillMax;
38 private bool Island;
39 private float[] heightmap;
40
41 public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island)
42 {
43 NumHills = numHills;
44 HillMin = hillMin;
45 HillMax = hillMax;
46 Island = island;
47
48 heightmap = new float[256 * 256];
49
50 for (int i = 0; i < numHills; i++)
51 {
52 AddHill();
53 }
54
55 Normalize();
56
57 return heightmap;
58 }
59
60 private void AddHill()
61 {
62 float x, y;
63 float radius = RandomRange(HillMin, HillMax);
64
65 if (Island)
66 {
67 // Which direction from the center of the map the hill is placed
68 float theta = RandomRange(0, 6.28f);
69
70 // How far from the center of the map to place the hill. The radius
71 // is subtracted from the range to prevent any part of the hill from
72 // reaching the edge of the map
73 float distance = RandomRange(radius / 2.0f, 128.0f - radius);
74
75 x = 128.0f + (float)Math.Cos(theta) * distance;
76 y = 128.0f + (float)Math.Sin(theta) * distance;
77 }
78 else
79 {
80 x = RandomRange(-radius, 256.0f + radius);
81 y = RandomRange(-radius, 256.0f + radius);
82 }
83
84 float radiusSq = radius * radius;
85 float distSq;
86 float height;
87
88 int xMin = (int)(x - radius) - 1;
89 int xMax = (int)(x + radius) + 1;
90 if (xMin < 0) xMin = 0;
91 if (xMax > 255) xMax = 255;
92
93 int yMin = (int)(y - radius) - 1;
94 int yMax = (int)(y + radius) + 1;
95 if (yMin < 0) yMin = 0;
96 if (yMax > 255) yMax = 255;
97
98 // Loop through each affected cell and determine the height at that point
99 for (int v = yMin; v <= yMax; ++v)
100 {
101 float fv = (float)v;
102
103 for (int h = xMin; h <= xMax; ++h)
104 {
105 float fh = (float)h;
106
107 // Determine how far from the center of this hill this point is
108 distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv);
109 height = radiusSq - distSq;
110
111 // Don't add negative hill values
112 if (height > 0.0f) heightmap[h + v * 256] += height;
113 }
114 }
115 }
116
117 private void Normalize()
118 {
119 float min = heightmap[0];
120 float max = heightmap[0];
121
122 for (int x = 0; x < 256; x++)
123 {
124 for (int y = 0; y < 256; y++)
125 {
126 if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256];
127 if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256];
128 }
129 }
130
131 // Avoid a rare divide by zero
132 if (min != max)
133 {
134 for (int x = 0; x < 256; x++)
135 {
136 for (int y = 0; y < 256; y++)
137 {
138 heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin);
139 }
140 }
141 }
142 }
143
144 private float RandomRange(float min, float max)
145 {
146 return (float)Rand.NextDouble() * (max - min) + min;
147 }
148 }
149}
diff --git a/Common/OpenSim.Framework/Interfaces/IAssetServer.cs b/Common/OpenSim.Framework/Interfaces/IAssetServer.cs
new file mode 100644
index 0000000..3f86acc
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IAssetServer.cs
@@ -0,0 +1,68 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Net;
29using System.Net.Sockets;
30using System.IO;
31using System.Threading;
32using libsecondlife;
33using OpenSim.Framework.Types;
34
35namespace OpenSim.Framework.Interfaces
36{
37 /// <summary>
38 /// Description of IAssetServer.
39 /// </summary>
40
41 public interface IAssetServer
42 {
43 void SetReceiver(IAssetReceiver receiver);
44 void RequestAsset(LLUUID assetID, bool isTexture);
45 void UpdateAsset(AssetBase asset);
46 void UploadNewAsset(AssetBase asset);
47 void SetServerInfo(string ServerUrl, string ServerKey);
48 void Close();
49 }
50
51 // could change to delegate?
52 public interface IAssetReceiver
53 {
54 void AssetReceived(AssetBase asset, bool IsTexture);
55 void AssetNotFound(AssetBase asset);
56 }
57
58 public interface IAssetPlugin
59 {
60 IAssetServer GetAssetServer();
61 }
62
63 public struct ARequest
64 {
65 public LLUUID AssetID;
66 public bool IsTexture;
67 }
68}
diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
new file mode 100644
index 0000000..a991fb6
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs
@@ -0,0 +1,30 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Inventory;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Types;
8
9namespace OpenSim.Framework.Interfaces
10{
11 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
12 public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
13 public delegate void ModifyTerrain(byte action, float north, float west);
14 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
15 public delegate void StartAnim(LLUUID animID, int seq);
16 public delegate void LinkObjects(uint parent, List<uint> children);
17
18 public interface IClientAPI
19 {
20 event ChatFromViewer OnChatFromViewer;
21 event RezObject OnRezObject;
22 event ModifyTerrain OnModifyTerrain;
23 event SetAppearance OnSetAppearance;
24 event StartAnim OnStartAnim;
25 event LinkObjects OnLinkObjects;
26
27 void SendAppearance(AvatarWearable[] wearables);
28 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
29 }
30}
diff --git a/Common/OpenSim.Framework/Interfaces/IConfig.cs b/Common/OpenSim.Framework/Interfaces/IConfig.cs
new file mode 100644
index 0000000..7b4c040
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IConfig.cs
@@ -0,0 +1,76 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34//using OpenSim.world;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// This class handles connection to the underlying database used for configuration of the region.
40 /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
41 /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
42 /// what is hardcoded here and then saved into opensim.yap for future startups.
43 /// </summary>
44
45
46 public abstract class SimConfig
47 {
48 public string RegionName;
49
50 public uint RegionLocX;
51 public uint RegionLocY;
52 public ulong RegionHandle;
53
54 public int IPListenPort;
55 public string IPListenAddr;
56
57 public string AssetURL;
58 public string AssetSendKey;
59
60 public string GridURL;
61 public string GridSendKey;
62 public string GridRecvKey;
63 public string UserURL;
64 public string UserSendKey;
65 public string UserRecvKey;
66
67 public abstract void InitConfig(bool sandboxMode);
68 public abstract void LoadFromGrid();
69
70 }
71
72 public interface ISimConfig
73 {
74 SimConfig GetConfigObject();
75 }
76}
diff --git a/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs b/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs
new file mode 100644
index 0000000..a853fe4
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs
@@ -0,0 +1,15 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Interfaces
6{
7 public interface IGenericConfig
8 {
9 void LoadData();
10 string GetAttribute(string attributeName);
11 bool SetAttribute(string attributeName, string attributeValue);
12 void Commit();
13 void Close();
14 }
15}
diff --git a/Common/OpenSim.Framework/Interfaces/IGridConfig.cs b/Common/OpenSim.Framework/Interfaces/IGridConfig.cs
new file mode 100644
index 0000000..b2f26da
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IGridConfig.cs
@@ -0,0 +1,64 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34//using OpenSim.world;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// </summary>
40
41
42 public abstract class GridConfig
43 {
44 public string GridOwner;
45 public string DefaultStartupMsg;
46 public string DefaultAssetServer;
47 public string AssetSendKey;
48 public string AssetRecvKey;
49 public string DefaultUserServer;
50 public string UserSendKey;
51 public string UserRecvKey;
52 public string SimSendKey;
53 public string SimRecvKey;
54
55
56 public abstract void InitConfig();
57
58 }
59
60 public interface IGridConfig
61 {
62 GridConfig GetConfigObject();
63 }
64}
diff --git a/Common/OpenSim.Framework/Interfaces/IGridServer.cs b/Common/OpenSim.Framework/Interfaces/IGridServer.cs
new file mode 100644
index 0000000..e67ea98
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IGridServer.cs
@@ -0,0 +1,81 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.Net;
33using System.Net.Sockets;
34using System.IO;
35using libsecondlife;
36using OpenSim;
37using OpenSim.Framework.Types;
38
39namespace OpenSim.Framework.Interfaces
40{
41 /// <summary>
42 /// Handles connection to Grid Servers.
43 /// also Sim to Sim connections?
44 /// </summary>
45
46 public interface IGridServer
47 {
48 UUIDBlock RequestUUIDBlock();
49 NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions
50 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
51 bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
52 string GetName();
53 bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
54 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
55 IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
56 void Close();
57 }
58
59 public struct UUIDBlock
60 {
61 public LLUUID BlockStart;
62 public LLUUID BlockEnd;
63 }
64
65 public class AuthenticateResponse
66 {
67 public bool Authorised;
68 public Login LoginInfo;
69
70 public AuthenticateResponse()
71 {
72
73 }
74
75 }
76
77 public interface IGridPlugin
78 {
79 IGridServer GetGridServer();
80 }
81}
diff --git a/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs b/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
new file mode 100644
index 0000000..4dd8868
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
@@ -0,0 +1,54 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using libsecondlife;
30using OpenSim.Framework.Types;
31
32namespace OpenSim.Framework.Interfaces
33{
34 /// <summary>
35 /// ILocalStorage. Really hacked together right now needs cleaning up
36 /// </summary>
37 public interface ILocalStorage
38 {
39 void Initialise(string datastore);
40 void StorePrim(PrimData prim);
41 void RemovePrim(LLUUID primID);
42 void LoadPrimitives(ILocalStorageReceiver receiver);
43 float[] LoadWorld();
44 void SaveMap(float[] heightmap);
45 void ShutDown();
46 }
47
48 public interface ILocalStorageReceiver
49 {
50 void PrimFromStorage(PrimData prim);
51 }
52
53}
54
diff --git a/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs b/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs
new file mode 100644
index 0000000..3ad0f06
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs
@@ -0,0 +1,14 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Types;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public interface IScriptAPI
9 {
10 OSVector3 GetEntityPosition(uint localID);
11 void SetEntityPosition(uint localID, float x, float y, float z);
12 uint GetRandomAvatarID();
13 }
14}
diff --git a/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs b/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs
new file mode 100644
index 0000000..ed8974c
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs
@@ -0,0 +1,14 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Interfaces
6{
7 public interface IScriptEngine
8 {
9 bool Init(IScriptAPI api);
10 string GetName();
11 void LoadScript(string script, string scriptName, uint entityID);
12 void OnFrame();
13 }
14}
diff --git a/Common/OpenSim.Framework/Interfaces/IUserConfig.cs b/Common/OpenSim.Framework/Interfaces/IUserConfig.cs
new file mode 100644
index 0000000..e15867d
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IUserConfig.cs
@@ -0,0 +1,58 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34//using OpenSim.world;
35
36namespace OpenSim.Framework.Interfaces
37{
38 /// <summary>
39 /// </summary>
40
41
42 public abstract class UserConfig
43 {
44 public string DefaultStartupMsg;
45 public string GridServerURL;
46 public string GridSendKey;
47 public string GridRecvKey;
48
49
50 public abstract void InitConfig();
51
52 }
53
54 public interface IUserConfig
55 {
56 UserConfig GetConfigObject();
57 }
58}
diff --git a/Common/OpenSim.Framework/Interfaces/IUserServer.cs b/Common/OpenSim.Framework/Interfaces/IUserServer.cs
new file mode 100644
index 0000000..21f2721
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/IUserServer.cs
@@ -0,0 +1,15 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Inventory;
5using libsecondlife;
6
7namespace OpenSim.Framework.Interfaces
8{
9 public interface IUserServer
10 {
11 AgentInventory RequestAgentsInventory(LLUUID agentID);
12 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
13 bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
14 }
15}
diff --git a/Common/OpenSim.Framework/Interfaces/LocalGridBase.cs b/Common/OpenSim.Framework/Interfaces/LocalGridBase.cs
new file mode 100644
index 0000000..ff46502
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/LocalGridBase.cs
@@ -0,0 +1,24 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Types;
6using System.Collections;
7
8namespace OpenSim.Framework.Interfaces
9{
10 public abstract class LocalGridBase : IGridServer
11 {
12 public abstract UUIDBlock RequestUUIDBlock();
13 public abstract NeighbourInfo[] RequestNeighbours();
14 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
15 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
16 public abstract string GetName();
17 public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
18 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
19 public abstract void AddNewSession(Login session);
20 public abstract IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
21 public abstract void Close();
22 }
23
24}
diff --git a/Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs b/Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs
new file mode 100644
index 0000000..ed13ed5
--- /dev/null
+++ b/Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs
@@ -0,0 +1,37 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using libsecondlife;
6using OpenSim.Framework.Types;
7
8namespace OpenSim.Framework.Interfaces
9{
10 public abstract class RemoteGridBase : IGridServer
11 {
12 public abstract Dictionary<uint, AgentCircuitData> agentcircuits
13 {
14 get;
15 set;
16 }
17
18 public abstract UUIDBlock RequestUUIDBlock();
19 public abstract NeighbourInfo[] RequestNeighbours();
20 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
21 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
22 public abstract string GetName();
23 public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
24 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
25 public abstract IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
26 public abstract void Close();
27 public abstract Hashtable GridData {
28 get;
29 set;
30 }
31
32 public abstract ArrayList neighbours {
33 get;
34 set;
35 }
36 }
37}
diff --git a/Common/OpenSim.Framework/LoginService.cs b/Common/OpenSim.Framework/LoginService.cs
new file mode 100644
index 0000000..eba0281
--- /dev/null
+++ b/Common/OpenSim.Framework/LoginService.cs
@@ -0,0 +1,14 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using Nwc.XmlRpc;
6using libsecondlife;
7
8namespace OpenSim.Framework.Grid
9{
10 public abstract class LoginService
11 {
12
13 }
14} \ No newline at end of file
diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj
new file mode 100644
index 0000000..1b7f3c0
--- /dev/null
+++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj
@@ -0,0 +1,200 @@
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>
10 </ApplicationIcon>
11 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName>
13 <AssemblyName>OpenSim.Framework</AssemblyName>
14 <DefaultClientScript>JScript</DefaultClientScript>
15 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <DelaySign>false</DelaySign>
18 <OutputType>Library</OutputType>
19 <AppDesignerFolder>
20 </AppDesignerFolder>
21 <RootNamespace>OpenSim.Framework</RootNamespace>
22 <StartupObject>
23 </StartupObject>
24 <FileUpgradeFlags>
25 </FileUpgradeFlags>
26 </PropertyGroup>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
29 <BaseAddress>285212672</BaseAddress>
30 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
31 <ConfigurationOverrideFile>
32 </ConfigurationOverrideFile>
33 <DefineConstants>TRACE;DEBUG</DefineConstants>
34 <DocumentationFile>
35 </DocumentationFile>
36 <DebugSymbols>True</DebugSymbols>
37 <FileAlignment>4096</FileAlignment>
38 <Optimize>False</Optimize>
39 <OutputPath>..\bin\</OutputPath>
40 <RegisterForComInterop>False</RegisterForComInterop>
41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <WarningLevel>4</WarningLevel>
44 <NoWarn>
45 </NoWarn>
46 </PropertyGroup>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
49 <BaseAddress>285212672</BaseAddress>
50 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
51 <ConfigurationOverrideFile>
52 </ConfigurationOverrideFile>
53 <DefineConstants>TRACE</DefineConstants>
54 <DocumentationFile>
55 </DocumentationFile>
56 <DebugSymbols>False</DebugSymbols>
57 <FileAlignment>4096</FileAlignment>
58 <Optimize>True</Optimize>
59 <OutputPath>..\bin\</OutputPath>
60 <RegisterForComInterop>False</RegisterForComInterop>
61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
63 <WarningLevel>4</WarningLevel>
64 <NoWarn>
65 </NoWarn>
66 </PropertyGroup>
67 <ItemGroup>
68 <Reference Include="System">
69 <HintPath>System.dll</HintPath>
70 <Private>False</Private>
71 </Reference>
72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
74 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="libsecondlife.dll">
78 <HintPath>..\bin\libsecondlife.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="Db4objects.Db4o.dll">
82 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 </ItemGroup>
86 <ItemGroup>
87 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
88 <Name>XMLRPC</Name>
89 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
90 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
91 <Private>False</Private>
92 </ProjectReference>
93 </ItemGroup>
94 <ItemGroup>
95 <Compile Include="AgentInventory.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="BlockingQueue.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="HeightMapGenHills.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 <Compile Include="Interfaces\IClientAPI.cs" />
105 <Compile Include="LoginService.cs">
106 <SubType>Code</SubType>
107 </Compile>
108 <Compile Include="Remoting.cs">
109 <SubType>Code</SubType>
110 </Compile>
111 <Compile Include="SimProfile.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="SimProfileBase.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 <Compile Include="UserProfile.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 <Compile Include="UserProfileManager.cs">
121 <SubType>Code</SubType>
122 </Compile>
123 <Compile Include="UserProfileManagerBase.cs">
124 <SubType>Code</SubType>
125 </Compile>
126 <Compile Include="Util.cs">
127 <SubType>Code</SubType>
128 </Compile>
129 <Compile Include="Interfaces\IAssetServer.cs">
130 <SubType>Code</SubType>
131 </Compile>
132 <Compile Include="Interfaces\IConfig.cs">
133 <SubType>Code</SubType>
134 </Compile>
135 <Compile Include="Interfaces\IGenericConfig.cs">
136 <SubType>Code</SubType>
137 </Compile>
138 <Compile Include="Interfaces\IGridConfig.cs">
139 <SubType>Code</SubType>
140 </Compile>
141 <Compile Include="Interfaces\IGridServer.cs">
142 <SubType>Code</SubType>
143 </Compile>
144 <Compile Include="Interfaces\ILocalStorage.cs">
145 <SubType>Code</SubType>
146 </Compile>
147 <Compile Include="Interfaces\IScriptAPI.cs">
148 <SubType>Code</SubType>
149 </Compile>
150 <Compile Include="Interfaces\IScriptEngine.cs">
151 <SubType>Code</SubType>
152 </Compile>
153 <Compile Include="Interfaces\IUserConfig.cs">
154 <SubType>Code</SubType>
155 </Compile>
156 <Compile Include="Interfaces\IUserServer.cs">
157 <SubType>Code</SubType>
158 </Compile>
159 <Compile Include="Interfaces\LocalGridBase.cs">
160 <SubType>Code</SubType>
161 </Compile>
162 <Compile Include="Interfaces\RemoteGridBase.cs">
163 <SubType>Code</SubType>
164 </Compile>
165 <Compile Include="Properties\AssemblyInfo.cs">
166 <SubType>Code</SubType>
167 </Compile>
168 <Compile Include="Types\AgentCiruitData.cs">
169 <SubType>Code</SubType>
170 </Compile>
171 <Compile Include="Types\AssetBase.cs">
172 <SubType>Code</SubType>
173 </Compile>
174 <Compile Include="Types\AssetLandmark.cs">
175 <SubType>Code</SubType>
176 </Compile>
177 <Compile Include="Types\AssetStorage.cs">
178 <SubType>Code</SubType>
179 </Compile>
180 <Compile Include="Types\Login.cs">
181 <SubType>Code</SubType>
182 </Compile>
183 <Compile Include="Types\NeighbourInfo.cs">
184 <SubType>Code</SubType>
185 </Compile>
186 <Compile Include="Types\OSVector3.cs">
187 <SubType>Code</SubType>
188 </Compile>
189 <Compile Include="Types\PrimData.cs">
190 <SubType>Code</SubType>
191 </Compile>
192 </ItemGroup>
193 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
194 <PropertyGroup>
195 <PreBuildEvent>
196 </PreBuildEvent>
197 <PostBuildEvent>
198 </PostBuildEvent>
199 </PropertyGroup>
200</Project> \ No newline at end of file
diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj.user b/Common/OpenSim.Framework/OpenSim.Framework.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/Common/OpenSim.Framework/OpenSim.Framework.dll.build b/Common/OpenSim.Framework/OpenSim.Framework.dll.build
new file mode 100644
index 0000000..fecd382
--- /dev/null
+++ b/Common/OpenSim.Framework/OpenSim.Framework.dll.build
@@ -0,0 +1,75 @@
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="BlockingQueue.cs" />
16 <include name="HeightMapGenHills.cs" />
17 <include name="LoginService.cs" />
18 <include name="Remoting.cs" />
19 <include name="SimProfile.cs" />
20 <include name="SimProfileBase.cs" />
21 <include name="UserProfile.cs" />
22 <include name="UserProfileManager.cs" />
23 <include name="UserProfileManagerBase.cs" />
24 <include name="Util.cs" />
25 <include name="Interfaces/IAssetServer.cs" />
26 <include name="Interfaces/IClientAPI.cs" />
27 <include name="Interfaces/IConfig.cs" />
28 <include name="Interfaces/IGenericConfig.cs" />
29 <include name="Interfaces/IGridConfig.cs" />
30 <include name="Interfaces/IGridServer.cs" />
31 <include name="Interfaces/ILocalStorage.cs" />
32 <include name="Interfaces/IScriptAPI.cs" />
33 <include name="Interfaces/IScriptEngine.cs" />
34 <include name="Interfaces/IUserConfig.cs" />
35 <include name="Interfaces/IUserServer.cs" />
36 <include name="Interfaces/LocalGridBase.cs" />
37 <include name="Interfaces/RemoteGridBase.cs" />
38 <include name="Properties/AssemblyInfo.cs" />
39 <include name="Types/AgentCiruitData.cs" />
40 <include name="Types/AssetBase.cs" />
41 <include name="Types/AssetLandmark.cs" />
42 <include name="Types/AssetStorage.cs" />
43 <include name="Types/Login.cs" />
44 <include name="Types/NeighbourInfo.cs" />
45 <include name="Types/OSVector3.cs" />
46 <include name="Types/PrimData.cs" />
47 </sources>
48 <references basedir="${project::get-base-directory()}">
49 <lib>
50 <include name="${project::get-base-directory()}" />
51 <include name="${project::get-base-directory()}/${build.dir}" />
52 </lib>
53 <include name="System.dll" />
54 <include name="System.Xml.dll" />
55 <include name="../bin/libsecondlife.dll" />
56 <include name="../bin/Db4objects.Db4o.dll" />
57 <include name="../bin/XMLRPC.dll" />
58 </references>
59 </csc>
60 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
61 <mkdir dir="${project::get-base-directory()}/../bin/"/>
62 <copy todir="${project::get-base-directory()}/../bin/">
63 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
64 <include name="*.dll"/>
65 <include name="*.exe"/>
66 </fileset>
67 </copy>
68 </target>
69 <target name="clean">
70 <delete dir="${bin.dir}" failonerror="false" />
71 <delete dir="${obj.dir}" failonerror="false" />
72 </target>
73 <target name="doc" description="Creates documentation.">
74 </target>
75</project>
diff --git a/Common/OpenSim.Framework/Properties/AssemblyInfo.cs b/Common/OpenSim.Framework/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..86f5cdb
--- /dev/null
+++ b/Common/OpenSim.Framework/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/Common/OpenSim.Framework/Remoting.cs b/Common/OpenSim.Framework/Remoting.cs
new file mode 100644
index 0000000..1212ee5
--- /dev/null
+++ b/Common/OpenSim.Framework/Remoting.cs
@@ -0,0 +1,109 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Security.Cryptography;
5
6namespace OpenSim.Framework
7{
8 /// <summary>
9 /// NEEDS AUDIT.
10 /// </summary>
11 /// <remarks>
12 /// Suggested implementation
13 /// <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>
14 /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
15 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
16 /// <para>Both hosts should be performing these operations for this to be effective.</para>
17 /// </remarks>
18 class RemoteDigest
19 {
20 private byte[] currentHash;
21 private byte[] secret;
22
23 private SHA512Managed SHA512;
24
25 /// <summary>
26 /// Initialises a new RemoteDigest authentication mechanism
27 /// </summary>
28 /// <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>
29 /// <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>
30 /// <param name="salt">Binary salt - some common value - to be decided what</param>
31 /// <param name="challenge">The challenge key provided by the third party</param>
32 public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
33 {
34 SHA512 = new SHA512Managed();
35 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt);
36 secret = RFC2898.GetBytes(512);
37 ASCIIEncoding ASCII = new ASCIIEncoding();
38
39 currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
40 }
41
42 /// <summary>
43 /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
44 /// </summary>
45 /// <param name="data">The incoming data</param>
46 /// <param name="digest">The remote digest</param>
47 /// <returns></returns>
48 public bool Authenticate(byte[] data, byte[] digest)
49 {
50 byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
51 if (digest == newHash)
52 {
53 currentHash = newHash;
54 return true;
55 }
56 else
57 {
58 throw new Exception("Hash comparison failed. Key resync required.");
59 }
60 }
61
62 /// <summary>
63 /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
64 /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
65 /// hashes will get out of sync and throw an exception when validation is attempted.
66 /// </summary>
67 /// <param name="data">The outgoing data</param>
68 /// <returns>The local digest</returns>
69 public byte[] Sign(byte[] data)
70 {
71 currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
72 return currentHash;
73 }
74
75 /// <summary>
76 /// 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.
77 /// </summary>
78 /// <returns>A 128-character hexadecimal string containing the challenge.</returns>
79 public static string GenerateChallenge()
80 {
81 RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
82 byte[] bytes = new byte[64];
83 RNG.GetBytes(bytes);
84
85 StringBuilder sb = new StringBuilder(bytes.Length * 2);
86 foreach (byte b in bytes)
87 {
88 sb.AppendFormat("{0:x2}", b);
89 }
90 return sb.ToString();
91 }
92
93 /// <summary>
94 /// Helper function, merges two byte arrays
95 /// </summary>
96 /// <remarks>Sourced from MSDN Forum</remarks>
97 /// <param name="a">A</param>
98 /// <param name="b">B</param>
99 /// <returns>C</returns>
100 private byte[] AppendArrays(byte[] a, byte[] b)
101 {
102 byte[] c = new byte[a.Length + b.Length];
103 Buffer.BlockCopy(a, 0, c, 0, a.Length);
104 Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
105 return c;
106 }
107
108 }
109}
diff --git a/Common/OpenSim.Framework/SimProfile.cs b/Common/OpenSim.Framework/SimProfile.cs
new file mode 100644
index 0000000..8acb20b
--- /dev/null
+++ b/Common/OpenSim.Framework/SimProfile.cs
@@ -0,0 +1,83 @@
1using System;
2using System.Collections.Generic;
3using System.Collections;
4using System.Xml;
5using System.Text;
6using libsecondlife;
7using Nwc.XmlRpc;
8
9namespace OpenSim.Framework.Sims
10{
11 public class SimProfile : SimProfileBase
12 {
13 public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
14 {
15 try
16 {
17 Hashtable GridReqParams = new Hashtable();
18 GridReqParams["region_handle"] = region_handle.ToString();
19 GridReqParams["authkey"] = SendKey;
20 ArrayList SendParams = new ArrayList();
21 SendParams.Add(GridReqParams);
22 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
23
24 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
25
26 Hashtable RespData = (Hashtable)GridResp.Value;
27 this.UUID = new LLUUID((string)RespData["UUID"]);
28 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
29 this.regionname = (string)RespData["regionname"];
30 this.sim_ip = (string)RespData["sim_ip"];
31 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
32 this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
33 this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
34 this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
35 this.sendkey = SendKey;
36 this.recvkey = RecvKey;
37 }
38 catch (Exception e)
39 {
40 Console.WriteLine(e.ToString());
41 }
42 return this;
43 }
44
45 public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
46 {
47 try
48 {
49 Hashtable GridReqParams = new Hashtable();
50 GridReqParams["UUID"] = UUID.ToString();
51 GridReqParams["authkey"] = SendKey;
52 ArrayList SendParams = new ArrayList();
53 SendParams.Add(GridReqParams);
54 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
55
56 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
57
58 Hashtable RespData = (Hashtable)GridResp.Value;
59 this.UUID = new LLUUID((string)RespData["UUID"]);
60 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
61 this.regionname = (string)RespData["regionname"];
62 this.sim_ip = (string)RespData["sim_ip"];
63 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
64 this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
65 this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
66 this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
67 this.sendkey = SendKey;
68 this.recvkey = RecvKey;
69 }
70 catch (Exception e)
71 {
72 Console.WriteLine(e.ToString());
73 }
74 return this;
75 }
76
77
78 public SimProfile()
79 {
80 }
81 }
82
83}
diff --git a/Common/OpenSim.Framework/SimProfileBase.cs b/Common/OpenSim.Framework/SimProfileBase.cs
new file mode 100644
index 0000000..30e2e0f
--- /dev/null
+++ b/Common/OpenSim.Framework/SimProfileBase.cs
@@ -0,0 +1,27 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Sims
7{
8 [System.Obsolete("Depreciated, use SimProfileData instead")]
9 public class SimProfileBase
10 {
11 public LLUUID UUID;
12 public ulong regionhandle;
13 public string regionname;
14 public string sim_ip;
15 public uint sim_port;
16 public string caps_url;
17 public uint RegionLocX;
18 public uint RegionLocY;
19 public string sendkey;
20 public string recvkey;
21 public bool online;
22
23 public SimProfileBase()
24 {
25 }
26 }
27}
diff --git a/Common/OpenSim.Framework/Types/AgentCiruitData.cs b/Common/OpenSim.Framework/Types/AgentCiruitData.cs
new file mode 100644
index 0000000..7314586
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/AgentCiruitData.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class AgentCircuitData
9 {
10 public AgentCircuitData() { }
11 public LLUUID AgentID;
12 public LLUUID SessionID;
13 public LLUUID SecureSessionID;
14 public LLVector3 startpos;
15 public string firstname;
16 public string lastname;
17 public uint circuitcode;
18 public bool child;
19 public LLUUID InventoryFolder;
20 public LLUUID BaseFolder;
21 }
22}
diff --git a/Common/OpenSim.Framework/Types/AssetBase.cs b/Common/OpenSim.Framework/Types/AssetBase.cs
new file mode 100644
index 0000000..f6104f8
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/AssetBase.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class AssetBase
9 {
10 public byte[] Data;
11 public LLUUID FullID;
12 public sbyte Type;
13 public sbyte InvType;
14 public string Name;
15 public string Description;
16
17 public AssetBase()
18 {
19
20 }
21 }
22}
diff --git a/Common/OpenSim.Framework/Types/AssetLandmark.cs b/Common/OpenSim.Framework/Types/AssetLandmark.cs
new file mode 100644
index 0000000..9d1a326
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/AssetLandmark.cs
@@ -0,0 +1,34 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class AssetLandmark : AssetBase
9 {
10 public int Version;
11 public LLVector3 Position;
12 public LLUUID RegionID;
13
14 public AssetLandmark(AssetBase a)
15 {
16 this.Data = a.Data;
17 this.FullID = a.FullID;
18 this.Type = a.Type;
19 this.InvType = a.InvType;
20 this.Name = a.Name;
21 this.Description = a.Description;
22 InternData();
23 }
24
25 private void InternData()
26 {
27 string temp = System.Text.Encoding.UTF8.GetString(Data).Trim();
28 string[] parts = temp.Split('\n');
29 int.TryParse(parts[0].Substring(17, 1), out Version);
30 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
31 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
32 }
33 }
34}
diff --git a/Common/OpenSim.Framework/Types/AssetStorage.cs b/Common/OpenSim.Framework/Types/AssetStorage.cs
new file mode 100644
index 0000000..5b5b3b2
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/AssetStorage.cs
@@ -0,0 +1,23 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class AssetStorage
9 {
10
11 public AssetStorage() {
12 }
13
14 public AssetStorage(LLUUID assetUUID) {
15 UUID=assetUUID;
16 }
17
18 public byte[] Data;
19 public sbyte Type;
20 public string Name;
21 public LLUUID UUID;
22 }
23}
diff --git a/Common/OpenSim.Framework/Types/Login.cs b/Common/OpenSim.Framework/Types/Login.cs
new file mode 100644
index 0000000..71f9de3
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/Login.cs
@@ -0,0 +1,24 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class Login
9 {
10 public string First = "Test";
11 public string Last = "User";
12 public LLUUID Agent;
13 public LLUUID Session;
14 public LLUUID SecureSession = LLUUID.Zero;
15 public LLUUID InventoryFolder;
16 public LLUUID BaseFolder;
17 public uint CircuitCode;
18
19 public Login()
20 {
21
22 }
23 }
24}
diff --git a/Common/OpenSim.Framework/Types/NeighbourInfo.cs b/Common/OpenSim.Framework/Types/NeighbourInfo.cs
new file mode 100644
index 0000000..58b6cb1
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/NeighbourInfo.cs
@@ -0,0 +1,19 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Types
6{
7 public class NeighbourInfo
8 {
9 public NeighbourInfo()
10 {
11 }
12
13 public ulong regionhandle;
14 public uint RegionLocX;
15 public uint RegionLocY;
16 public string sim_ip;
17 public uint sim_port;
18 }
19}
diff --git a/Common/OpenSim.Framework/Types/OSVector3.cs b/Common/OpenSim.Framework/Types/OSVector3.cs
new file mode 100644
index 0000000..8fb840b
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/OSVector3.cs
@@ -0,0 +1,18 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Types
6{
7 public class OSVector3
8 {
9 public float X;
10 public float Y;
11 public float Z;
12
13 public OSVector3()
14 {
15
16 }
17 }
18}
diff --git a/Common/OpenSim.Framework/Types/PrimData.cs b/Common/OpenSim.Framework/Types/PrimData.cs
new file mode 100644
index 0000000..68e2a22
--- /dev/null
+++ b/Common/OpenSim.Framework/Types/PrimData.cs
@@ -0,0 +1,173 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Types
7{
8 public class PrimData
9 {
10 private const uint FULL_MASK_PERMISSIONS = 2147483647;
11
12 public LLUUID OwnerID;
13 public byte PCode;
14 public ushort PathBegin;
15 public ushort PathEnd;
16 public byte PathScaleX;
17 public byte PathScaleY;
18 public byte PathShearX;
19 public byte PathShearY;
20 public sbyte PathSkew;
21 public ushort ProfileBegin;
22 public ushort ProfileEnd;
23 public LLVector3 Scale;
24 public byte PathCurve;
25 public byte ProfileCurve;
26 public uint ParentID = 0;
27 public ushort ProfileHollow;
28 public sbyte PathRadiusOffset;
29 public byte PathRevolutions;
30 public sbyte PathTaperX;
31 public sbyte PathTaperY;
32 public sbyte PathTwist;
33 public sbyte PathTwistBegin;
34 public byte[] Texture;
35
36
37 public Int32 CreationDate;
38 public uint OwnerMask = FULL_MASK_PERMISSIONS;
39 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
40 public uint GroupMask = FULL_MASK_PERMISSIONS;
41 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
42 public uint BaseMask = FULL_MASK_PERMISSIONS;
43
44 //following only used during prim storage
45 public LLVector3 Position;
46 public LLQuaternion Rotation = new LLQuaternion(0,1,0,0);
47 public uint LocalID;
48 public LLUUID FullID;
49
50 public PrimData()
51 {
52
53 }
54
55 public PrimData(byte[] data)
56 {
57 int i =0;
58
59 this.OwnerID = new LLUUID(data, i); i += 16;
60 this.PCode = data[i++];
61 this.PathBegin = (ushort)(data[i++] + (data[i++] << 8));
62 this.PathEnd = (ushort)(data[i++] + (data[i++] << 8));
63 this.PathScaleX = data[i++];
64 this.PathScaleY = data[i++];
65 this.PathShearX = data[i++];
66 this.PathShearY = data[i++];
67 this.PathSkew = (sbyte)data[i++];
68 this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8));
69 this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8));
70 this.Scale = new LLVector3(data, i); i += 12;
71 this.PathCurve = data[i++];
72 this.ProfileCurve = data[i++];
73 this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
74 this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8));
75 this.PathRadiusOffset = (sbyte)data[i++];
76 this.PathRevolutions = data[i++];
77 this.PathTaperX = (sbyte)data[i++];
78 this.PathTaperY =(sbyte) data[i++];
79 this.PathTwist = (sbyte) data[i++];
80 this.PathTwistBegin = (sbyte) data[i++];
81 ushort length = (ushort)(data[i++] + (data[i++] << 8));
82 this.Texture = new byte[length];
83 Array.Copy(data, i, Texture, 0, length); i += length;
84 this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
85 this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
86 this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
87 this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
88 this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
89 this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
90 this.Position = new LLVector3(data, i); i += 12;
91 this.Rotation = new LLQuaternion(data,i, true); i += 12;
92 this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
93 this.FullID = new LLUUID(data, i); i += 16;
94
95 }
96
97 public byte[] ToBytes()
98 {
99 int i = 0;
100 byte[] bytes = new byte[126 + Texture.Length];
101 Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
102 bytes[i++] = this.PCode;
103 bytes[i++] = (byte)(this.PathBegin % 256);
104 bytes[i++] = (byte)((this.PathBegin >> 8) % 256);
105 bytes[i++] = (byte)(this.PathEnd % 256);
106 bytes[i++] = (byte)((this.PathEnd >> 8) % 256);
107 bytes[i++] = this.PathScaleX;
108 bytes[i++] = this.PathScaleY;
109 bytes[i++] = this.PathShearX;
110 bytes[i++] = this.PathShearY;
111 bytes[i++] = (byte)this.PathSkew;
112 bytes[i++] = (byte)(this.ProfileBegin % 256);
113 bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256);
114 bytes[i++] = (byte)(this.ProfileEnd % 256);
115 bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256);
116 Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
117 bytes[i++] = this.PathCurve;
118 bytes[i++] = this.ProfileCurve;
119 bytes[i++] = (byte)(ParentID % 256);
120 bytes[i++] = (byte)((ParentID >> 8) % 256);
121 bytes[i++] = (byte)((ParentID >> 16) % 256);
122 bytes[i++] = (byte)((ParentID >> 24) % 256);
123 bytes[i++] = (byte)(this.ProfileHollow %256);
124 bytes[i++] = (byte)((this.ProfileHollow >> 8)% 256);
125 bytes[i++] = ((byte)this.PathRadiusOffset);
126 bytes[i++] = this.PathRevolutions;
127 bytes[i++] = ((byte) this.PathTaperX);
128 bytes[i++] = ((byte) this.PathTaperY);
129 bytes[i++] = ((byte) this.PathTwist);
130 bytes[i++] = ((byte) this.PathTwistBegin);
131 bytes[i++] = (byte)(Texture.Length % 256);
132 bytes[i++] = (byte)((Texture.Length >> 8) % 256);
133 Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length;
134 bytes[i++] = (byte)(this.CreationDate % 256);
135 bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
136 bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
137 bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
138 bytes[i++] = (byte)(this.OwnerMask % 256);
139 bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
140 bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
141 bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
142 bytes[i++] = (byte)(this.NextOwnerMask % 256);
143 bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
144 bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
145 bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
146 bytes[i++] = (byte)(this.GroupMask % 256);
147 bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
148 bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
149 bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
150 bytes[i++] = (byte)(this.EveryoneMask % 256);
151 bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
152 bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
153 bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
154 bytes[i++] = (byte)(this.BaseMask % 256);
155 bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
156 bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
157 bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
158 Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
159 if (this.Rotation == new LLQuaternion(0,0,0,0))
160 {
161 this.Rotation = new LLQuaternion(0, 1, 0, 0);
162 }
163 Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
164 bytes[i++] = (byte)(this.LocalID % 256);
165 bytes[i++] = (byte)((this.LocalID >> 8) % 256);
166 bytes[i++] = (byte)((this.LocalID >> 16) % 256);
167 bytes[i++] = (byte)((this.LocalID >> 24) % 256);
168 Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
169
170 return bytes;
171 }
172 }
173}
diff --git a/Common/OpenSim.Framework/UserProfile.cs b/Common/OpenSim.Framework/UserProfile.cs
new file mode 100644
index 0000000..f95a8fa
--- /dev/null
+++ b/Common/OpenSim.Framework/UserProfile.cs
@@ -0,0 +1,62 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Inventory;
6using System.Security.Cryptography;
7
8namespace OpenSim.Framework.User
9{
10 public class UserProfile
11 {
12
13 public string firstname;
14 public string lastname;
15 public ulong homeregionhandle;
16 public LLVector3 homepos;
17 public LLVector3 homelookat;
18
19 public bool IsGridGod = false;
20 public bool IsLocal = true; // will be used in future for visitors from foreign grids
21 public string AssetURL;
22 public string MD5passwd;
23
24 public LLUUID CurrentSessionID;
25 public LLUUID CurrentSecureSessionID;
26 public LLUUID UUID;
27 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
28
29 public AgentInventory Inventory;
30
31 public UserProfile()
32 {
33 Circuits = new Dictionary<LLUUID, uint>();
34 Inventory = new AgentInventory();
35 homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
36 homepos = new LLVector3();
37 homelookat = new LLVector3();
38 }
39
40 public void InitSessionData()
41 {
42 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
43
44 byte[] randDataS = new byte[16];
45 byte[] randDataSS = new byte[16];
46
47 rand.GetBytes(randDataS);
48 rand.GetBytes(randDataSS);
49
50 CurrentSecureSessionID = new LLUUID(randDataSS,0);
51 CurrentSessionID = new LLUUID(randDataS,0);
52
53 }
54
55 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
56 {
57 if (this.Circuits.ContainsKey(regionUUID) == false)
58 this.Circuits.Add(regionUUID, circuitCode);
59 }
60
61 }
62}
diff --git a/Common/OpenSim.Framework/UserProfileManager.cs b/Common/OpenSim.Framework/UserProfileManager.cs
new file mode 100644
index 0000000..18b3513
--- /dev/null
+++ b/Common/OpenSim.Framework/UserProfileManager.cs
@@ -0,0 +1,272 @@
1using System;
2using System.Collections.Generic;
3using System.Collections;
4using System.Text;
5using System.Text.RegularExpressions;
6using System.Xml;
7using libsecondlife;
8using Nwc.XmlRpc;
9using OpenSim.Framework.Sims;
10using OpenSim.Framework.Inventory;
11using OpenSim.Framework.Utilities;
12
13namespace OpenSim.Framework.User
14{
15 public class UserProfileManager : UserProfileManagerBase
16 {
17 public string GridURL;
18 public string GridSendKey;
19 public string GridRecvKey;
20 public string DefaultStartupMsg;
21
22 public UserProfileManager()
23 {
24
25 }
26
27 public void SetKeys(string sendKey, string recvKey, string url, string message)
28 {
29 GridRecvKey = recvKey;
30 GridSendKey = sendKey;
31 GridURL = url;
32 DefaultStartupMsg = message;
33 }
34
35 public virtual string ParseXMLRPC(string requestBody)
36 {
37
38 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
39
40 switch (request.MethodName)
41 {
42 case "login_to_simulator":
43 XmlRpcResponse response = XmlRpcLoginMethod(request);
44
45 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(response), "utf-16", "utf-8"));
46 }
47
48 return "";
49 }
50
51 public string RestDeleteUserSessionMethod( string request, string path, string param )
52 {
53 LLUUID sessionid = new LLUUID(param); // get usersessions/sessionid
54 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
55 {
56 if ( UserProfiles[UUID].CurrentSessionID == sessionid)
57 {
58 UserProfiles[UUID].CurrentSessionID = null;
59 UserProfiles[UUID].CurrentSecureSessionID = null;
60 UserProfiles[UUID].Circuits.Clear();
61 }
62 }
63
64 return "OK";
65 }
66
67 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
68 {
69 XmlRpcResponse response = new XmlRpcResponse();
70 Hashtable requestData = (Hashtable)request.Params[0];
71
72 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
73 bool GoodLogin = false;
74 string firstname = "";
75 string lastname = "";
76 string passwd = "";
77
78 if (GoodXML)
79 {
80 firstname = (string)requestData["first"];
81 lastname = (string)requestData["last"];
82 passwd = (string)requestData["passwd"];
83 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
84 }
85
86
87 if (!(GoodXML && GoodLogin))
88 {
89 response = CreateErrorConnectingToGridResponse();
90 }
91 else
92 {
93 UserProfile TheUser = GetProfileByName(firstname, lastname);
94 //we need to sort out how sessions are logged out , currently the sim tells the gridserver
95 //but if as this suggests the userserver handles it then please have the sim telling the userserver instead
96 //as it really makes things messy for sandbox mode
97 //if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
98 // {
99 // response = CreateAlreadyLoggedInResponse();
100 // }
101 //else
102 //{
103 try
104 {
105 Hashtable responseData = new Hashtable();
106
107 LLUUID AgentID = TheUser.UUID;
108 TheUser.InitSessionData();
109
110 //for loading data from a grid server, make any changes in CustomiseResponse() (or create a sub class of this and override that method)
111 //SimProfile SimInfo = new SimProfile();
112 //SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
113
114
115 Hashtable GlobalT = new Hashtable();
116 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
117 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
118 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
119 ArrayList GlobalTextures = new ArrayList();
120 GlobalTextures.Add(GlobalT);
121
122 Hashtable LoginFlagsHash = new Hashtable();
123 LoginFlagsHash["daylight_savings"] = "N";
124 LoginFlagsHash["stipend_since_login"] = "N";
125 LoginFlagsHash["gendered"] = "Y";
126 LoginFlagsHash["ever_logged_in"] = "Y";
127 ArrayList LoginFlags = new ArrayList();
128 LoginFlags.Add(LoginFlagsHash);
129
130 Hashtable uiconfig = new Hashtable();
131 uiconfig["allow_first_life"] = "Y";
132 ArrayList ui_config = new ArrayList();
133 ui_config.Add(uiconfig);
134
135 Hashtable ClassifiedCategoriesHash = new Hashtable();
136 ClassifiedCategoriesHash["category_name"] = "bla bla";
137 ClassifiedCategoriesHash["category_id"] = (Int32)1;
138 ArrayList ClassifiedCategories = new ArrayList();
139 ClassifiedCategories.Add(ClassifiedCategoriesHash);
140
141 ArrayList AgentInventory = new ArrayList();
142 Console.WriteLine("adding inventory to response");
143 Hashtable TempHash;
144 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
145 {
146 TempHash = new Hashtable();
147 Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated());
148 TempHash["name"] = InvFolder.FolderName;
149 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
150 TempHash["version"] = (Int32)InvFolder.Version;
151 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
152 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
153 AgentInventory.Add(TempHash);
154 }
155
156 Hashtable InventoryRootHash = new Hashtable();
157 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
158 ArrayList InventoryRoot = new ArrayList();
159 InventoryRoot.Add(InventoryRootHash);
160
161 Hashtable InitialOutfitHash = new Hashtable();
162 InitialOutfitHash["folder_name"] = "Nightclub Female";
163 InitialOutfitHash["gender"] = "female";
164 ArrayList InitialOutfit = new ArrayList();
165 InitialOutfit.Add(InitialOutfitHash);
166
167 uint circode = (uint)(Util.RandomClass.Next());
168 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
169
170 responseData["last_name"] = TheUser.lastname;
171 responseData["ui-config"] = ui_config;
172 responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
173 responseData["login-flags"] = LoginFlags;
174 responseData["global-textures"] = GlobalTextures;
175 responseData["classified_categories"] = ClassifiedCategories;
176 responseData["event_categories"] = new ArrayList();
177 responseData["inventory-skeleton"] = AgentInventory;
178 responseData["inventory-skel-lib"] = new ArrayList();
179 responseData["inventory-root"] = InventoryRoot;
180 responseData["event_notifications"] = new ArrayList();
181 responseData["gestures"] = new ArrayList();
182 responseData["inventory-lib-owner"] = new ArrayList();
183 responseData["initial-outfit"] = InitialOutfit;
184 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
185 responseData["start_location"] = "last";
186 responseData["home"] = "{'region_handle':[r" + (0 * 256).ToString() + ",r" + (0 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
187 responseData["message"] = DefaultStartupMsg;
188 responseData["first_name"] = TheUser.firstname;
189 responseData["circuit_code"] = (Int32)circode;
190 responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port;
191 responseData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
192 responseData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
193 responseData["agent_id"] = AgentID.ToStringHyphenated();
194 responseData["region_y"] = (Int32)0 * 256; // (Int32)SimInfo.RegionLocY * 256;
195 responseData["region_x"] = (Int32)0 * 256; //SimInfo.RegionLocX * 256;
196 responseData["seed_capability"] = "";
197 responseData["agent_access"] = "M";
198 responseData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
199 responseData["login"] = "true";
200
201 this.CustomiseResponse(ref responseData, TheUser);
202 response.Value = responseData;
203 // TheUser.SendDataToSim(SimInfo);
204 return response;
205
206 }
207 catch (Exception E)
208 {
209 Console.WriteLine(E.ToString());
210 }
211 //}
212 }
213 return response;
214
215 }
216
217 private static XmlRpcResponse CreateErrorConnectingToGridResponse()
218 {
219 XmlRpcResponse response = new XmlRpcResponse();
220 Hashtable ErrorRespData = new Hashtable();
221 ErrorRespData["reason"] = "key";
222 ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
223 ErrorRespData["login"] = "false";
224 response.Value = ErrorRespData;
225 return response;
226 }
227
228 private static XmlRpcResponse CreateAlreadyLoggedInResponse()
229 {
230 XmlRpcResponse response = new XmlRpcResponse();
231 Hashtable PresenceErrorRespData = new Hashtable();
232 PresenceErrorRespData["reason"] = "presence";
233 PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
234 PresenceErrorRespData["login"] = "false";
235 response.Value = PresenceErrorRespData;
236 return response;
237 }
238
239 public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
240 {
241 //default method set up to act as ogs user server
242 SimProfile SimInfo= new SimProfile();
243 //get siminfo from grid server
244 SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
245 Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]);
246 theUser.AddSimCircuit((uint)circode, SimInfo.UUID);
247 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
248 response["sim_ip"] = SimInfo.sim_ip;
249 response["sim_port"] = (Int32)SimInfo.sim_port;
250 response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
251 response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
252
253 //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
254 Console.WriteLine(SimInfo.caps_url);
255 Hashtable SimParams = new Hashtable();
256 SimParams["session_id"] = theUser.CurrentSessionID.ToString();
257 SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
258 SimParams["firstname"] = theUser.firstname;
259 SimParams["lastname"] = theUser.lastname;
260 SimParams["agent_id"] = theUser.UUID.ToString();
261 SimParams["circuit_code"] = (Int32)circode;
262 SimParams["startpos_x"] = theUser.homepos.X.ToString();
263 SimParams["startpos_y"] = theUser.homepos.Y.ToString();
264 SimParams["startpos_z"] = theUser.homepos.Z.ToString();
265 ArrayList SendParams = new ArrayList();
266 SendParams.Add(SimParams);
267
268 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
269 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
270 }
271 }
272}
diff --git a/Common/OpenSim.Framework/UserProfileManagerBase.cs b/Common/OpenSim.Framework/UserProfileManagerBase.cs
new file mode 100644
index 0000000..d1307a5
--- /dev/null
+++ b/Common/OpenSim.Framework/UserProfileManagerBase.cs
@@ -0,0 +1,124 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Utilities;
6using OpenSim.Framework.Inventory;
7using Db4objects.Db4o;
8
9namespace OpenSim.Framework.User
10{
11 public class UserProfileManagerBase
12 {
13
14 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
15
16 public UserProfileManagerBase()
17 {
18 }
19
20 public virtual void InitUserProfiles()
21 {
22 IObjectContainer db;
23 db = Db4oFactory.OpenFile("userprofiles.yap");
24 IObjectSet result = db.Get(typeof(UserProfile));
25 foreach (UserProfile userprof in result)
26 {
27 UserProfiles.Add(userprof.UUID, userprof);
28 }
29 Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database");
30 db.Close();
31 }
32
33 public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT!
34 {
35 IObjectContainer db;
36 db = Db4oFactory.OpenFile("userprofiles.yap");
37 IObjectSet result = db.Get(typeof(UserProfile));
38 foreach (UserProfile userprof in result)
39 {
40 db.Delete(userprof);
41 db.Commit();
42 }
43 foreach (UserProfile userprof in UserProfiles.Values)
44 {
45 db.Set(userprof);
46 db.Commit();
47 }
48 db.Close();
49 }
50
51 public UserProfile GetProfileByName(string firstname, string lastname)
52 {
53 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
54 {
55 if (UserProfiles[UUID].firstname.Equals(firstname)) if (UserProfiles[UUID].lastname.Equals(lastname))
56 {
57 return UserProfiles[UUID];
58 }
59 }
60 return null;
61 }
62
63 public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID)
64 {
65 return UserProfiles[ProfileLLUUID];
66 }
67
68 public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
69 {
70 UserProfile TheUser = GetProfileByName(firstname, lastname);
71 passwd = passwd.Remove(0, 3); //remove $1$
72 if (TheUser != null)
73 {
74 if (TheUser.MD5passwd == passwd)
75 {
76 Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname);
77 return true;
78 }
79 else
80 {
81 Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd);
82 return false;
83 }
84 }
85 else
86 {
87 Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname);
88 return false;
89 }
90
91 }
92
93 public void SetGod(LLUUID GodID)
94 {
95 this.UserProfiles[GodID].IsGridGod = true;
96 }
97
98 public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
99 {
100 Console.WriteLine("creating new profile for : " + firstname + " , " + lastname);
101 UserProfile newprofile = new UserProfile();
102 newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
103 newprofile.firstname = firstname;
104 newprofile.lastname = lastname;
105 newprofile.MD5passwd = MD5passwd;
106 newprofile.UUID = LLUUID.Random();
107 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
108 this.UserProfiles.Add(newprofile.UUID, newprofile);
109 return newprofile;
110 }
111
112 public virtual AgentInventory GetUsersInventory(LLUUID agentID)
113 {
114 UserProfile user = this.GetProfileByLLUUID(agentID);
115 if (user != null)
116 {
117 return user.Inventory;
118 }
119
120 return null;
121 }
122
123 }
124}
diff --git a/Common/OpenSim.Framework/Util.cs b/Common/OpenSim.Framework/Util.cs
new file mode 100644
index 0000000..400f415
--- /dev/null
+++ b/Common/OpenSim.Framework/Util.cs
@@ -0,0 +1,151 @@
1using System;
2using System.Security.Cryptography;
3using System.Collections.Generic;
4using System.Text;
5using libsecondlife;
6using libsecondlife.Packets;
7
8namespace OpenSim.Framework.Utilities
9{
10 public class Util
11 {
12 private static Random randomClass = new Random();
13 private static uint nextXferID = 5000;
14 private static object XferLock = new object();
15
16 public static ulong UIntsToLong(uint X, uint Y)
17 {
18 return Helpers.UIntsToLong(X, Y);
19 }
20
21 public static Random RandomClass
22 {
23 get
24 {
25 return randomClass;
26 }
27 }
28
29 public static uint GetNextXferID()
30 {
31 uint id = 0;
32 lock(XferLock)
33 {
34 id = nextXferID;
35 nextXferID++;
36 }
37 return id;
38 }
39
40 public static int UnixTimeSinceEpoch()
41 {
42 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
43 int timestamp = (int)t.TotalSeconds;
44 return timestamp;
45 }
46
47 public static string Md5Hash(string pass)
48 {
49 MD5 md5 = MD5CryptoServiceProvider.Create();
50 byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass));
51 StringBuilder sb = new StringBuilder();
52 for (int i = 0; i < dataMd5.Length; i++)
53 sb.AppendFormat("{0:x2}", dataMd5[i]);
54 return sb.ToString();
55 }
56
57 //public static int fast_distance2d(int x, int y)
58 //{
59 // x = System.Math.Abs(x);
60 // y = System.Math.Abs(y);
61
62 // int min = System.Math.Min(x, y);
63
64 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
65 //}
66
67 public static string FieldToString(byte[] bytes)
68 {
69 return FieldToString(bytes, String.Empty);
70 }
71
72 /// <summary>
73 /// Convert a variable length field (byte array) to a string, with a
74 /// field name prepended to each line of the output
75 /// </summary>
76 /// <remarks>If the byte array has unprintable characters in it, a
77 /// hex dump will be put in the string instead</remarks>
78 /// <param name="bytes">The byte array to convert to a string</param>
79 /// <param name="fieldName">A field name to prepend to each line of output</param>
80 /// <returns>An ASCII string or a string containing a hex dump, minus
81 /// the null terminator</returns>
82 public static string FieldToString(byte[] bytes, string fieldName)
83 {
84 // Check for a common case
85 if (bytes.Length == 0) return String.Empty;
86
87 StringBuilder output = new StringBuilder();
88 bool printable = true;
89
90 for (int i = 0; i < bytes.Length; ++i)
91 {
92 // Check if there are any unprintable characters in the array
93 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
94 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
95 {
96 printable = false;
97 break;
98 }
99 }
100
101 if (printable)
102 {
103 if (fieldName.Length > 0)
104 {
105 output.Append(fieldName);
106 output.Append(": ");
107 }
108
109 if (bytes[bytes.Length - 1] == 0x00)
110 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
111 else
112 output.Append(UTF8Encoding.UTF8.GetString(bytes));
113 }
114 else
115 {
116 for (int i = 0; i < bytes.Length; i += 16)
117 {
118 if (i != 0)
119 output.Append(Environment.NewLine);
120 if (fieldName.Length > 0)
121 {
122 output.Append(fieldName);
123 output.Append(": ");
124 }
125
126 for (int j = 0; j < 16; j++)
127 {
128 if ((i + j) < bytes.Length)
129 output.Append(String.Format("{0:X2} ", bytes[i + j]));
130 else
131 output.Append(" ");
132 }
133
134 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
135 {
136 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
137 output.Append((char)bytes[i + j]);
138 else
139 output.Append(".");
140 }
141 }
142 }
143
144 return output.ToString();
145 }
146 public Util()
147 {
148
149 }
150 }
151}