aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.Framework')
-rw-r--r--OpenSim.Framework/AgentCiruitData.cs18
-rw-r--r--OpenSim.Framework/AssetBase.cs22
-rw-r--r--OpenSim.Framework/BlockingQueue.cs33
-rw-r--r--OpenSim.Framework/HeightMapGenHills.cs149
-rw-r--r--OpenSim.Framework/IAssetServer.cs68
-rw-r--r--OpenSim.Framework/IConfig.cs78
-rw-r--r--OpenSim.Framework/IGridServer.cs78
-rw-r--r--OpenSim.Framework/ILocalStorage.cs51
-rw-r--r--OpenSim.Framework/IUserServer.cs14
-rw-r--r--OpenSim.Framework/Inventory.cs127
-rw-r--r--OpenSim.Framework/LocalGridBase.cs21
-rw-r--r--OpenSim.Framework/Login.cs22
-rw-r--r--OpenSim.Framework/LoginService.cs14
-rw-r--r--OpenSim.Framework/NeighbourInfo.cs19
-rw-r--r--OpenSim.Framework/OpenSim.Framework.csproj151
-rw-r--r--OpenSim.Framework/OpenSim.Framework.dll.build63
-rw-r--r--OpenSim.Framework/PrimData.cs45
-rw-r--r--OpenSim.Framework/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim.Framework/RemoteGridBase.cs25
-rw-r--r--OpenSim.Framework/SimProfile.cs51
-rw-r--r--OpenSim.Framework/SimProfileBase.cs25
-rw-r--r--OpenSim.Framework/UserProfile.cs50
-rw-r--r--OpenSim.Framework/UserProfileManager.cs223
-rw-r--r--OpenSim.Framework/UserProfileManagerBase.cs91
-rw-r--r--OpenSim.Framework/Util.cs32
25 files changed, 1503 insertions, 0 deletions
diff --git a/OpenSim.Framework/AgentCiruitData.cs b/OpenSim.Framework/AgentCiruitData.cs
new file mode 100644
index 0000000..3ab8a80
--- /dev/null
+++ b/OpenSim.Framework/AgentCiruitData.cs
@@ -0,0 +1,18 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public class AgentCircuitData
9 {
10 public AgentCircuitData() { }
11 public LLUUID AgentID;
12 public LLUUID SessionID;
13 public LLUUID SecureSessionID;
14 public string firstname;
15 public string lastname;
16 public uint circuitcode;
17 }
18}
diff --git a/OpenSim.Framework/AssetBase.cs b/OpenSim.Framework/AssetBase.cs
new file mode 100644
index 0000000..8206b30
--- /dev/null
+++ b/OpenSim.Framework/AssetBase.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Assets
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/OpenSim.Framework/BlockingQueue.cs b/OpenSim.Framework/BlockingQueue.cs
new file mode 100644
index 0000000..f840354
--- /dev/null
+++ b/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/OpenSim.Framework/HeightMapGenHills.cs b/OpenSim.Framework/HeightMapGenHills.cs
new file mode 100644
index 0000000..6a729da
--- /dev/null
+++ b/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/OpenSim.Framework/IAssetServer.cs b/OpenSim.Framework/IAssetServer.cs
new file mode 100644
index 0000000..a0de548
--- /dev/null
+++ b/OpenSim.Framework/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.Assets;
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/OpenSim.Framework/IConfig.cs b/OpenSim.Framework/IConfig.cs
new file mode 100644
index 0000000..ca7f645
--- /dev/null
+++ b/OpenSim.Framework/IConfig.cs
@@ -0,0 +1,78 @@
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 public abstract float[] LoadWorld();
70 public abstract void SaveMap(float[] heightmap);
71
72 }
73
74 public interface ISimConfig
75 {
76 SimConfig GetConfigObject();
77 }
78}
diff --git a/OpenSim.Framework/IGridServer.cs b/OpenSim.Framework/IGridServer.cs
new file mode 100644
index 0000000..026dfab
--- /dev/null
+++ b/OpenSim.Framework/IGridServer.cs
@@ -0,0 +1,78 @@
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.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.IO;
34using libsecondlife;
35using OpenSim;
36
37namespace OpenSim.Framework.Interfaces
38{
39 /// <summary>
40 /// Handles connection to Grid Servers.
41 /// also Sim to Sim connections?
42 /// </summary>
43
44 public interface IGridServer
45 {
46 UUIDBlock RequestUUIDBlock();
47 NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions
48 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
49 bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
50 string GetName();
51 bool RequestConnection();
52 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
53 void Close();
54 }
55
56 public struct UUIDBlock
57 {
58 public LLUUID BlockStart;
59 public LLUUID BlockEnd;
60 }
61
62 public class AuthenticateResponse
63 {
64 public bool Authorised;
65 public Login LoginInfo;
66
67 public AuthenticateResponse()
68 {
69
70 }
71
72 }
73
74 public interface IGridPlugin
75 {
76 IGridServer GetGridServer();
77 }
78}
diff --git a/OpenSim.Framework/ILocalStorage.cs b/OpenSim.Framework/ILocalStorage.cs
new file mode 100644
index 0000000..e9aa1a2
--- /dev/null
+++ b/OpenSim.Framework/ILocalStorage.cs
@@ -0,0 +1,51 @@
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.Assets;
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 StorePrim(PrimData prim);
40 void RemovePrim(LLUUID primID);
41 void LoadPrimitives(ILocalStorageReceiver receiver);
42 void ShutDown();
43 }
44
45 public interface ILocalStorageReceiver
46 {
47 void PrimFromStorage(PrimData prim);
48 }
49
50}
51
diff --git a/OpenSim.Framework/IUserServer.cs b/OpenSim.Framework/IUserServer.cs
new file mode 100644
index 0000000..bb2b668
--- /dev/null
+++ b/OpenSim.Framework/IUserServer.cs
@@ -0,0 +1,14 @@
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 }
14}
diff --git a/OpenSim.Framework/Inventory.cs b/OpenSim.Framework/Inventory.cs
new file mode 100644
index 0000000..e34ea75
--- /dev/null
+++ b/OpenSim.Framework/Inventory.cs
@@ -0,0 +1,127 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Assets;
6
7namespace OpenSim.Framework.Inventory
8{
9 public class AgentInventory
10 {
11 //Holds the local copy of Inventory info for a agent
12 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
13 public Dictionary<LLUUID, InventoryItem> InventoryItems;
14 public InventoryFolder InventoryRoot;
15 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
16 public LLUUID AgentID;
17 public AvatarWearable[] Wearables;
18
19 public AgentInventory()
20 {
21 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
22 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
23 this.Initialise();
24 }
25
26 public virtual void Initialise()
27 {
28 Wearables = new AvatarWearable[2]; //should be 12 of these
29 for (int i = 0; i < 2; i++)
30 {
31 Wearables[i] = new AvatarWearable();
32 }
33
34 InventoryRoot = new InventoryFolder();
35 InventoryRoot.FolderID = LLUUID.Random();
36 InventoryRoot.ParentID = new LLUUID();
37 InventoryRoot.Version = 1;
38 InventoryRoot.DefaultType = 8;
39 InventoryRoot.FolderName = "My Inventory";
40 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
41 }
42
43 public bool CreateNewFolder(LLUUID folderID)
44 {
45 InventoryFolder Folder = new InventoryFolder();
46 Folder.FolderID = folderID;
47 Folder.OwnerID = this.AgentID;
48 this.InventoryFolders.Add(Folder.FolderID, Folder);
49
50 return (true);
51 }
52
53 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
54 {
55 if (this.InventoryFolders.ContainsKey(folderID))
56 {
57 LLUUID NewItemID = LLUUID.Random();
58
59 InventoryItem Item = new InventoryItem();
60 Item.FolderID = folderID;
61 Item.OwnerID = AgentID;
62 Item.AssetID = asset.FullID;
63 Item.ItemID = NewItemID;
64 Item.Type = asset.Type;
65 Item.Name = asset.Name;
66 Item.Description = asset.Description;
67 Item.InvType = asset.InvType;
68 this.InventoryItems.Add(Item.ItemID, Item);
69 InventoryFolder Folder = InventoryFolders[Item.FolderID];
70 Folder.Items.Add(Item);
71 return (Item.ItemID);
72 }
73 else
74 {
75 return (null);
76 }
77 }
78 }
79
80 public class InventoryFolder
81 {
82 public List<InventoryItem> Items;
83 //public List<InventoryFolder> Subfolders;
84 public LLUUID FolderID;
85 public LLUUID OwnerID;
86 public LLUUID ParentID;
87 public string FolderName;
88 public ushort DefaultType;
89 public ushort Version;
90
91 public InventoryFolder()
92 {
93 Items = new List<InventoryItem>();
94 //Subfolders = new List<InventoryFolder>();
95 }
96
97 }
98
99 public class InventoryItem
100 {
101 public LLUUID FolderID;
102 public LLUUID OwnerID;
103 public LLUUID ItemID;
104 public LLUUID AssetID;
105 public LLUUID CreatorID;
106 public sbyte InvType;
107 public sbyte Type;
108 public string Name;
109 public string Description;
110
111 public InventoryItem()
112 {
113 this.CreatorID = LLUUID.Zero;
114 }
115 }
116
117 public class AvatarWearable
118 {
119 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
120 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
121
122 public AvatarWearable()
123 {
124
125 }
126 }
127}
diff --git a/OpenSim.Framework/LocalGridBase.cs b/OpenSim.Framework/LocalGridBase.cs
new file mode 100644
index 0000000..c9b278a
--- /dev/null
+++ b/OpenSim.Framework/LocalGridBase.cs
@@ -0,0 +1,21 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public abstract class LocalGridBase : IGridServer
9 {
10 public abstract UUIDBlock RequestUUIDBlock();
11 public abstract NeighbourInfo[] RequestNeighbours();
12 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
13 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
14 public abstract string GetName();
15 public abstract bool RequestConnection();
16 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
17 public abstract void AddNewSession(Login session);
18 public abstract void Close();
19 }
20
21}
diff --git a/OpenSim.Framework/Login.cs b/OpenSim.Framework/Login.cs
new file mode 100644
index 0000000..8a67853
--- /dev/null
+++ b/OpenSim.Framework/Login.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
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 Login()
18 {
19
20 }
21 }
22}
diff --git a/OpenSim.Framework/LoginService.cs b/OpenSim.Framework/LoginService.cs
new file mode 100644
index 0000000..eba0281
--- /dev/null
+++ b/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/OpenSim.Framework/NeighbourInfo.cs b/OpenSim.Framework/NeighbourInfo.cs
new file mode 100644
index 0000000..8b4fa64
--- /dev/null
+++ b/OpenSim.Framework/NeighbourInfo.cs
@@ -0,0 +1,19 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Interfaces
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/OpenSim.Framework/OpenSim.Framework.csproj b/OpenSim.Framework/OpenSim.Framework.csproj
new file mode 100644
index 0000000..7a10319
--- /dev/null
+++ b/OpenSim.Framework/OpenSim.Framework.csproj
@@ -0,0 +1,151 @@
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>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</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="System.dll" >
62 <HintPath>\System.dll.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="libsecondlife.dll" >
68 <HintPath>\libsecondlife.dll.dll</HintPath>
69 </Reference>
70 </ItemGroup>
71 <ItemGroup>
72 </ItemGroup>
73 <ItemGroup>
74 <Compile Include="AgentCiruitData.cs">
75 <SubType>Code</SubType>
76 </Compile>
77 <Compile Include="AssetBase.cs">
78 <SubType>Code</SubType>
79 </Compile>
80 <Compile Include="BlockingQueue.cs">
81 <SubType>Code</SubType>
82 </Compile>
83 <Compile Include="HeightMapGenHills.cs">
84 <SubType>Code</SubType>
85 </Compile>
86 <Compile Include="IAssetServer.cs">
87 <SubType>Code</SubType>
88 </Compile>
89 <Compile Include="IConfig.cs">
90 <SubType>Code</SubType>
91 </Compile>
92 <Compile Include="IGridServer.cs">
93 <SubType>Code</SubType>
94 </Compile>
95 <Compile Include="ILocalStorage.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="Inventory.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="IUserServer.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 <Compile Include="LocalGridBase.cs">
105 <SubType>Code</SubType>
106 </Compile>
107 <Compile Include="Login.cs">
108 <SubType>Code</SubType>
109 </Compile>
110 <Compile Include="LoginService.cs">
111 <SubType>Code</SubType>
112 </Compile>
113 <Compile Include="NeighbourInfo.cs">
114 <SubType>Code</SubType>
115 </Compile>
116 <Compile Include="PrimData.cs">
117 <SubType>Code</SubType>
118 </Compile>
119 <Compile Include="RemoteGridBase.cs">
120 <SubType>Code</SubType>
121 </Compile>
122 <Compile Include="SimProfile.cs">
123 <SubType>Code</SubType>
124 </Compile>
125 <Compile Include="SimProfileBase.cs">
126 <SubType>Code</SubType>
127 </Compile>
128 <Compile Include="UserProfile.cs">
129 <SubType>Code</SubType>
130 </Compile>
131 <Compile Include="UserProfileManager.cs">
132 <SubType>Code</SubType>
133 </Compile>
134 <Compile Include="UserProfileManagerBase.cs">
135 <SubType>Code</SubType>
136 </Compile>
137 <Compile Include="Util.cs">
138 <SubType>Code</SubType>
139 </Compile>
140 <Compile Include="Properties\AssemblyInfo.cs">
141 <SubType>Code</SubType>
142 </Compile>
143 </ItemGroup>
144 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
145 <PropertyGroup>
146 <PreBuildEvent>
147 </PreBuildEvent>
148 <PostBuildEvent>
149 </PostBuildEvent>
150 </PropertyGroup>
151</Project>
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build
new file mode 100644
index 0000000..1418947
--- /dev/null
+++ b/OpenSim.Framework/OpenSim.Framework.dll.build
@@ -0,0 +1,63 @@
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="AgentCiruitData.cs" />
15 <include name="AssetBase.cs" />
16 <include name="BlockingQueue.cs" />
17 <include name="HeightMapGenHills.cs" />
18 <include name="IAssetServer.cs" />
19 <include name="IConfig.cs" />
20 <include name="IGridServer.cs" />
21 <include name="ILocalStorage.cs" />
22 <include name="Inventory.cs" />
23 <include name="IUserServer.cs" />
24 <include name="LocalGridBase.cs" />
25 <include name="Login.cs" />
26 <include name="LoginService.cs" />
27 <include name="NeighbourInfo.cs" />
28 <include name="PrimData.cs" />
29 <include name="RemoteGridBase.cs" />
30 <include name="SimProfile.cs" />
31 <include name="SimProfileBase.cs" />
32 <include name="UserProfile.cs" />
33 <include name="UserProfileManager.cs" />
34 <include name="UserProfileManagerBase.cs" />
35 <include name="Util.cs" />
36 <include name="Properties/AssemblyInfo.cs" />
37 </sources>
38 <references basedir="${project::get-base-directory()}">
39 <lib>
40 <include name="${project::get-base-directory()}" />
41 <include name="${project::get-base-directory()}/${build.dir}" />
42 </lib>
43 <include name="System.dll.dll" />
44 <include name="System.Xml.dll.dll" />
45 <include name="../bin/libsecondlife.dll" />
46 </references>
47 </csc>
48 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
49 <mkdir dir="${project::get-base-directory()}/../bin/"/>
50 <copy todir="${project::get-base-directory()}/../bin/">
51 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
52 <include name="*.dll"/>
53 <include name="*.exe"/>
54 </fileset>
55 </copy>
56 </target>
57 <target name="clean">
58 <delete dir="${bin.dir}" failonerror="false" />
59 <delete dir="${obj.dir}" failonerror="false" />
60 </target>
61 <target name="doc" description="Creates documentation.">
62 </target>
63</project>
diff --git a/OpenSim.Framework/PrimData.cs b/OpenSim.Framework/PrimData.cs
new file mode 100644
index 0000000..175a014
--- /dev/null
+++ b/OpenSim.Framework/PrimData.cs
@@ -0,0 +1,45 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Assets
7{
8 public class PrimData
9 {
10 public LLUUID OwnerID;
11 public byte PCode;
12 public byte PathBegin;
13 public byte PathEnd;
14 public byte PathScaleX;
15 public byte PathScaleY;
16 public byte PathShearX;
17 public byte PathShearY;
18 public sbyte PathSkew;
19 public byte ProfileBegin;
20 public byte ProfileEnd;
21 public LLVector3 Scale;
22 public byte PathCurve;
23 public byte ProfileCurve;
24 public uint ParentID = 0;
25 public byte ProfileHollow;
26 public sbyte PathRadiusOffset;
27 public byte PathRevolutions;
28 public sbyte PathTaperX;
29 public sbyte PathTaperY;
30 public sbyte PathTwist;
31 public sbyte PathTwistBegin;
32 public byte[] Texture;
33
34 //following only used during prim storage
35 public LLVector3 Position;
36 public LLQuaternion Rotation;
37 public uint LocalID;
38 public LLUUID FullID;
39
40 public PrimData()
41 {
42
43 }
44 }
45}
diff --git a/OpenSim.Framework/Properties/AssemblyInfo.cs b/OpenSim.Framework/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..86f5cdb
--- /dev/null
+++ b/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/OpenSim.Framework/RemoteGridBase.cs b/OpenSim.Framework/RemoteGridBase.cs
new file mode 100644
index 0000000..6ca57df
--- /dev/null
+++ b/OpenSim.Framework/RemoteGridBase.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public abstract class RemoteGridBase : IGridServer
9 {
10 public abstract Dictionary<uint, AgentCircuitData> agentcircuits
11 {
12 get;
13 set;
14 }
15
16 public abstract UUIDBlock RequestUUIDBlock();
17 public abstract NeighbourInfo[] RequestNeighbours();
18 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
19 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
20 public abstract string GetName();
21 public abstract bool RequestConnection();
22 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
23 public abstract void Close();
24 }
25}
diff --git a/OpenSim.Framework/SimProfile.cs b/OpenSim.Framework/SimProfile.cs
new file mode 100644
index 0000000..ac4cf9e
--- /dev/null
+++ b/OpenSim.Framework/SimProfile.cs
@@ -0,0 +1,51 @@
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["caller"] = "userserver";
20 GridReqParams["authkey"] = SendKey;
21 ArrayList SendParams = new ArrayList();
22 SendParams.Add(GridReqParams);
23 XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info", SendParams);
24
25 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
26
27 Hashtable RespData = (Hashtable)GridResp.Value;
28 this.UUID = new LLUUID((string)RespData["UUID"]);
29 this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]);
30 this.regionname = (string)RespData["regionname"];
31 this.sim_ip = (string)RespData["sim_ip"];
32 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
33 this.caps_url = (string)RespData["caps_url"];
34 this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]);
35 this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]);
36 this.sendkey = (string)RespData["sendkey"];
37 this.recvkey = (string)RespData["recvkey"];
38 }
39 catch (Exception e)
40 {
41 Console.WriteLine(e.ToString());
42 }
43 return this;
44 }
45
46 public SimProfile()
47 {
48 }
49 }
50
51}
diff --git a/OpenSim.Framework/SimProfileBase.cs b/OpenSim.Framework/SimProfileBase.cs
new file mode 100644
index 0000000..5fe2734
--- /dev/null
+++ b/OpenSim.Framework/SimProfileBase.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Sims
7{
8 public class SimProfileBase
9 {
10 public LLUUID UUID;
11 public ulong regionhandle;
12 public string regionname;
13 public string sim_ip;
14 public uint sim_port;
15 public string caps_url;
16 public uint RegionLocX;
17 public uint RegionLocY;
18 public string sendkey;
19 public string recvkey;
20
21 public SimProfileBase()
22 {
23 }
24 }
25}
diff --git a/OpenSim.Framework/UserProfile.cs b/OpenSim.Framework/UserProfile.cs
new file mode 100644
index 0000000..2c264c5
--- /dev/null
+++ b/OpenSim.Framework/UserProfile.cs
@@ -0,0 +1,50 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Inventory;
6
7namespace OpenSim.Framework.User
8{
9 public class UserProfile
10 {
11
12 public string firstname;
13 public string lastname;
14 public ulong homeregionhandle;
15 public LLVector3 homepos;
16 public LLVector3 homelookat;
17
18 public bool IsGridGod = false;
19 public bool IsLocal = true; // will be used in future for visitors from foreign grids
20 public string AssetURL;
21 public string MD5passwd;
22
23 public LLUUID CurrentSessionID;
24 public LLUUID CurrentSecureSessionID;
25 public LLUUID UUID;
26 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
27
28 public AgentInventory Inventory;
29
30 public UserProfile()
31 {
32 Circuits = new Dictionary<LLUUID, uint>();
33 Inventory = new AgentInventory();
34 homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ;
35 }
36
37 public void InitSessionData()
38 {
39 CurrentSessionID = LLUUID.Random();
40 CurrentSecureSessionID = LLUUID.Random();
41 }
42
43 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
44 {
45 if (this.Circuits.ContainsKey(regionUUID) == false)
46 this.Circuits.Add(regionUUID, circuitCode);
47 }
48
49 }
50}
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs
new file mode 100644
index 0000000..f77ca4c
--- /dev/null
+++ b/OpenSim.Framework/UserProfileManager.cs
@@ -0,0 +1,223 @@
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 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
38
39 Hashtable requestData = (Hashtable)request.Params[0];
40 switch (request.MethodName)
41 {
42 case "login_to_simulator":
43 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
44 bool GoodLogin = false;
45 string firstname = "";
46 string lastname = "";
47 string passwd = "";
48
49 if (GoodXML)
50 {
51 firstname = (string)requestData["first"];
52 lastname = (string)requestData["last"];
53 passwd = (string)requestData["passwd"];
54 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
55 }
56
57
58 if (!(GoodXML && GoodLogin))
59 {
60 XmlRpcResponse LoginErrorResp = new XmlRpcResponse();
61 Hashtable ErrorRespData = new Hashtable();
62 ErrorRespData["reason"] = "key";
63 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";
64 ErrorRespData["login"] = "false";
65 LoginErrorResp.Value = ErrorRespData;
66 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp), " encoding=\"utf-16\"", ""));
67 }
68
69 UserProfile TheUser = GetProfileByName(firstname, lastname);
70
71 if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
72 {
73 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
74 Hashtable PresenceErrorRespData = new Hashtable();
75 PresenceErrorRespData["reason"] = "presence";
76 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";
77 PresenceErrorRespData["login"] = "false";
78 PresenceErrorResp.Value = PresenceErrorRespData;
79 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
80
81 }
82
83 try
84 {
85 LLUUID AgentID = TheUser.UUID;
86 TheUser.InitSessionData();
87 // SimProfile SimInfo = new SimProfile();
88 // SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
89
90 XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
91 Hashtable LoginGoodData = new Hashtable();
92
93 Hashtable GlobalT = new Hashtable();
94 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
95 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
96 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
97 ArrayList GlobalTextures = new ArrayList();
98 GlobalTextures.Add(GlobalT);
99
100 Hashtable LoginFlagsHash = new Hashtable();
101 LoginFlagsHash["daylight_savings"] = "N";
102 LoginFlagsHash["stipend_since_login"] = "N";
103 LoginFlagsHash["gendered"] = "Y";
104 LoginFlagsHash["ever_logged_in"] = "Y";
105 ArrayList LoginFlags = new ArrayList();
106 LoginFlags.Add(LoginFlagsHash);
107
108 Hashtable uiconfig = new Hashtable();
109 uiconfig["allow_first_life"] = "Y";
110 ArrayList ui_config = new ArrayList();
111 ui_config.Add(uiconfig);
112
113 Hashtable ClassifiedCategoriesHash = new Hashtable();
114 ClassifiedCategoriesHash["category_name"] = "bla bla";
115 ClassifiedCategoriesHash["category_id"] = (Int32)1;
116 ArrayList ClassifiedCategories = new ArrayList();
117 ClassifiedCategories.Add(ClassifiedCategoriesHash);
118
119 ArrayList AgentInventory = new ArrayList();
120 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
121 {
122 Hashtable TempHash = new Hashtable();
123 TempHash["name"] = InvFolder.FolderName;
124 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
125 TempHash["version"] = (Int32)InvFolder.Version;
126 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
127 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
128 AgentInventory.Add(TempHash);
129 }
130
131 Hashtable InventoryRootHash = new Hashtable();
132 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
133 ArrayList InventoryRoot = new ArrayList();
134 InventoryRoot.Add(InventoryRootHash);
135
136 Hashtable InitialOutfitHash = new Hashtable();
137 InitialOutfitHash["folder_name"] = "Nightclub Female";
138 InitialOutfitHash["gender"] = "female";
139 ArrayList InitialOutfit = new ArrayList();
140 InitialOutfit.Add(InitialOutfitHash);
141
142 uint circode = (uint)(Util.RandomClass.Next());
143 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
144
145 LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\"";
146 LoginGoodData["ui-config"] = ui_config;
147 LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
148 LoginGoodData["login-flags"] = LoginFlags;
149 LoginGoodData["global-textures"] = GlobalTextures;
150 LoginGoodData["classified_categories"] = ClassifiedCategories;
151 LoginGoodData["event_categories"] = new ArrayList();
152 LoginGoodData["inventory-skeleton"] = AgentInventory;
153 LoginGoodData["inventory-skel-lib"] = new ArrayList();
154 LoginGoodData["inventory-root"] = InventoryRoot;
155 LoginGoodData["event_notifications"] = new ArrayList();
156 LoginGoodData["gestures"] = new ArrayList();
157 LoginGoodData["inventory-lib-owner"] = new ArrayList();
158 LoginGoodData["initial-outfit"] = InitialOutfit;
159 LoginGoodData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
160 LoginGoodData["start_location"] = "last";
161 LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 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() + "]}";
162 LoginGoodData["message"] = DefaultStartupMsg;
163 LoginGoodData["first_name"] = "\"" + firstname + "\"";
164 LoginGoodData["circuit_code"] = (Int32)circode;
165 LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
166 LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
167 LoginGoodData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
168 LoginGoodData["agent_id"] = AgentID.ToStringHyphenated();
169 LoginGoodData["region_y"] = (Int32) 996 * 256; // (Int32)SimInfo.RegionLocY * 256;
170 LoginGoodData["region_x"] = (Int32) 997 * 256; //SimInfo.RegionLocX * 256;
171 LoginGoodData["seed_capability"] = null;
172 LoginGoodData["agent_access"] = "M";
173 LoginGoodData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
174 LoginGoodData["login"] = "true";
175
176 this.CustomiseResponse(ref LoginGoodData, TheUser);
177 LoginGoodResp.Value = LoginGoodData;
178 //TheUser.SendDataToSim(SimInfo);
179 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp), "utf-16", "utf-8"));
180
181 }
182 catch (Exception E)
183 {
184 Console.WriteLine(E.ToString());
185 }
186
187 break;
188 }
189
190 return "";
191 }
192
193 public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
194 {
195 //default method set up to act as ogs user server
196 SimProfile SimInfo = new SimProfile();
197 //get siminfo from grid server
198 SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
199 uint circode = (uint)response["circuit_code"];
200 theUser.AddSimCircuit(circode, SimInfo.UUID);
201 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() + "]}";
202 response["sim_ip"] = SimInfo.sim_ip.ToString();
203 response["sim_port"] = (Int32)SimInfo.sim_port;
204 response["region_y"] = (Int32) SimInfo.RegionLocY * 256;
205 response["region_x"] = (Int32) SimInfo.RegionLocX * 256;
206
207 //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
208 Console.WriteLine(SimInfo.caps_url);
209 Hashtable SimParams = new Hashtable();
210 SimParams["session_id"] = theUser.CurrentSessionID.ToString();
211 SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
212 SimParams["firstname"] = theUser.firstname;
213 SimParams["lastname"] = theUser.lastname;
214 SimParams["agent_id"] = theUser.UUID.ToString();
215 SimParams["circuit_code"] = (Int32)theUser.Circuits[SimInfo.UUID];
216 ArrayList SendParams = new ArrayList();
217 SendParams.Add(SimParams);
218
219 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
220 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
221 }
222 }
223}
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs
new file mode 100644
index 0000000..ad03bc2
--- /dev/null
+++ b/OpenSim.Framework/UserProfileManagerBase.cs
@@ -0,0 +1,91 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Utilities;
6using OpenSim.Framework.Inventory;
7
8namespace OpenSim.Framework.User
9{
10 public class UserProfileManagerBase
11 {
12
13 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
14
15 public UserProfileManagerBase()
16 {
17 }
18
19 public virtual void InitUserProfiles()
20 {
21 // TODO: need to load from database
22 }
23
24 public UserProfile GetProfileByName(string firstname, string lastname)
25 {
26 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
27 {
28 if ((UserProfiles[UUID].firstname == firstname) && (UserProfiles[UUID].lastname == lastname))
29 {
30 return UserProfiles[UUID];
31 }
32 }
33 return null;
34 }
35
36 public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID)
37 {
38 return UserProfiles[ProfileLLUUID];
39 }
40
41 public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
42 {
43 UserProfile TheUser = GetProfileByName(firstname, lastname);
44 if (TheUser != null)
45 {
46 if (TheUser.MD5passwd == passwd)
47 {
48 return true;
49 }
50 else
51 {
52 return false;
53 }
54 }
55 else
56 {
57 return false;
58 }
59
60 }
61
62 public void SetGod(LLUUID GodID)
63 {
64 this.UserProfiles[GodID].IsGridGod = true;
65 }
66
67 public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
68 {
69 UserProfile newprofile = new UserProfile();
70 newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
71 newprofile.firstname = firstname;
72 newprofile.lastname = lastname;
73 newprofile.MD5passwd = MD5passwd;
74 newprofile.UUID = LLUUID.Random();
75 this.UserProfiles.Add(newprofile.UUID, newprofile);
76 return newprofile;
77 }
78
79 public virtual AgentInventory GetUsersInventory(LLUUID agentID)
80 {
81 UserProfile user = this.GetProfileByLLUUID(agentID);
82 if (user != null)
83 {
84 return user.Inventory;
85 }
86
87 return null;
88 }
89
90 }
91}
diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs
new file mode 100644
index 0000000..042360d
--- /dev/null
+++ b/OpenSim.Framework/Util.cs
@@ -0,0 +1,32 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace OpenSim.Framework.Utilities
8{
9 public class Util
10 {
11 private static Random randomClass = new Random();
12
13 public static ulong UIntsToLong(uint X, uint Y)
14 {
15 return Helpers.UIntsToLong(X, Y);
16 }
17
18 public static Random RandomClass
19 {
20 get
21 {
22 return randomClass;
23 }
24 }
25
26 public Util()
27 {
28
29 }
30 }
31
32}