aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs35
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs6
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs339
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs22
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs2
5 files changed, 196 insertions, 208 deletions
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index eed21a4..a00b35f 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -38,43 +38,26 @@ using OpenSim.Framework.Utilities;
38namespace OpenSim.Region.Communications.Local 38namespace OpenSim.Region.Communications.Local
39{ 39{
40 public class CommunicationsLocal : CommunicationsManager 40 public class CommunicationsLocal : CommunicationsManager
41 { 41 {
42 public LocalBackEndServices InstanceServices;
43
44 public LocalLoginService LoginServices;
45
46 protected LocalSettings m_settings;
47
48 protected CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
49 : base(serversInfo, httpServer, assetCache)
50 {
51
52 }
53
54 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, LocalSettings settings) 42 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, LocalSettings settings)
55 : base(serversInfo, httpServer, assetCache) 43 : base(serversInfo, httpServer, assetCache)
56 { 44 {
57 m_settings = settings;
58
59 LocalInventoryService inventoryService = new LocalInventoryService(); 45 LocalInventoryService inventoryService = new LocalInventoryService();
60 inventoryService.AddPlugin(m_settings.InventoryPlugin); 46 inventoryService.AddPlugin(settings.InventoryPlugin);
61 m_inventoryService = inventoryService; 47 m_inventoryService = inventoryService;
62 48
63 LocalUserServices userService = new LocalUserServices(this, serversInfo); 49 LocalUserServices userService = new LocalUserServices(this, serversInfo);
64 userService.AddPlugin(m_settings.UserDatabasePlugin); 50 userService.AddPlugin(settings.UserDatabasePlugin);
65 m_userService = userService; 51 m_userService = userService;
66 52
67 InstanceServices = new LocalBackEndServices(); 53 LocalBackEndServices backendService = new LocalBackEndServices();
68 m_gridService = InstanceServices; 54 m_gridService = backendService;
69 m_interRegion = InstanceServices; 55 m_interRegion = backendService;
70 56
71 LoginServices = new LocalLoginService(userService, m_settings.WelcomeMessage, this, serversInfo, m_settings.AccountAuthentication); 57 LocalLoginService loginService = new LocalLoginService(userService, settings.WelcomeMessage, this, serversInfo, settings.AccountAuthentication);
72 httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod); 58 loginService.OnLoginToRegion += backendService.AddNewSession;
73 }
74 59
75 internal void InformRegionOfLogin(ulong regionHandle, Login login) 60 httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
76 {
77 this.InstanceServices.AddNewSession(regionHandle, login);
78 } 61 }
79 62
80 public void doCreate(string[] cmmdParams) 63 public void doCreate(string[] cmmdParams)
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 706be09..3e23963 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -187,7 +187,7 @@ namespace OpenSim.Region.Communications.Local
187 /// <param name="regionHandle"></param> 187 /// <param name="regionHandle"></param>
188 /// <param name="loginData"></param> 188 /// <param name="loginData"></param>
189 /// <returns></returns> 189 /// <returns></returns>
190 public bool AddNewSession(ulong regionHandle, Login loginData) 190 public void AddNewSession(ulong regionHandle, Login loginData)
191 { 191 {
192 AgentCircuitData agent = new AgentCircuitData(); 192 AgentCircuitData agent = new AgentCircuitData();
193 agent.AgentID = loginData.Agent; 193 agent.AgentID = loginData.Agent;
@@ -204,11 +204,7 @@ namespace OpenSim.Region.Communications.Local
204 if (this.regionHosts.ContainsKey(regionHandle)) 204 if (this.regionHosts.ContainsKey(regionHandle))
205 { 205 {
206 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); 206 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
207 return true;
208 } 207 }
209
210 // region not found
211 return false;
212 } 208 }
213 } 209 }
214} 210}
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index ed1858d..ab8e397 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -1,166 +1,173 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Communications; 5using OpenSim.Framework.Communications;
6using OpenSim.Framework.Data; 6using OpenSim.Framework.Data;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.UserManagement; 8using OpenSim.Framework.UserManagement;
9using OpenSim.Framework.Utilities; 9using OpenSim.Framework.Utilities;
10using OpenSim.Framework.Inventory; 10using OpenSim.Framework.Inventory;
11 11
12namespace OpenSim.Region.Communications.Local 12namespace OpenSim.Region.Communications.Local
13{ 13{
14 public class LocalLoginService : LoginService 14 public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
15 { 15
16 private CommunicationsLocal m_Parent; 16 public class LocalLoginService : LoginService
17 17 {
18 private NetworkServersInfo serversInfo; 18 private CommunicationsLocal m_Parent;
19 private uint defaultHomeX; 19
20 private uint defaultHomeY; 20 private NetworkServersInfo serversInfo;
21 private bool authUsers = false; 21 private uint defaultHomeX;
22 22 private uint defaultHomeY;
23 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) 23 private bool authUsers = false;
24 : base(userManager, welcomeMess) 24
25 { 25 public event LoginToRegionEvent OnLoginToRegion;
26 m_Parent = parent; 26
27 this.serversInfo = serversInfo; 27 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
28 defaultHomeX = this.serversInfo.DefaultHomeLocX; 28 : base(userManager, welcomeMess)
29 defaultHomeY = this.serversInfo.DefaultHomeLocY; 29 {
30 this.authUsers = authenticate; 30 m_Parent = parent;
31 } 31 this.serversInfo = serversInfo;
32 32 defaultHomeX = this.serversInfo.DefaultHomeLocX;
33 33 defaultHomeY = this.serversInfo.DefaultHomeLocY;
34 public override UserProfileData GetTheUser(string firstname, string lastname) 34 this.authUsers = authenticate;
35 { 35 }
36 UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname); 36
37 if (profile != null) 37
38 { 38 public override UserProfileData GetTheUser(string firstname, string lastname)
39 39 {
40 return profile; 40 UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname);
41 } 41 if (profile != null)
42 42 {
43 if (!authUsers) 43
44 { 44 return profile;
45 //no current user account so make one 45 }
46 Console.WriteLine("No User account found so creating a new one "); 46
47 this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 47 if (!authUsers)
48 48 {
49 profile = this.m_userManager.GetUserProfile(firstname, lastname); 49 //no current user account so make one
50 if (profile != null) 50 Console.WriteLine("No User account found so creating a new one ");
51 { 51 this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
52 m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); 52
53 } 53 profile = this.m_userManager.GetUserProfile(firstname, lastname);
54 54 if (profile != null)
55 return profile; 55 {
56 } 56 m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
57 return null; 57 }
58 } 58
59 59 return profile;
60 public override bool AuthenticateUser(UserProfileData profile, string password) 60 }
61 { 61 return null;
62 if (!authUsers) 62 }
63 { 63
64 //for now we will accept any password in sandbox mode 64 public override bool AuthenticateUser(UserProfileData profile, string password)
65 Console.WriteLine("authorising user"); 65 {
66 return true; 66 if (!authUsers)
67 } 67 {
68 else 68 //for now we will accept any password in sandbox mode
69 { 69 Console.WriteLine("authorising user");
70 Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); 70 return true;
71 71 }
72 password = password.Remove(0, 3); //remove $1$ 72 else
73 73 {
74 string s = Util.Md5Hash(password + ":" + profile.passwordSalt); 74 Console.WriteLine("Authenticating " + profile.username + " " + profile.surname);
75 75
76 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 76 password = password.Remove(0, 3); //remove $1$
77 } 77
78 } 78 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
79 79
80 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) 80 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
81 { 81 }
82 ulong currentRegion = theUser.currentAgent.currentHandle; 82 }
83 RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion); 83
84 84 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
85 if (reg != null) 85 {
86 { 86 ulong currentRegion = theUser.currentAgent.currentHandle;
87 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + 87 RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
88 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 88
89 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 89 if (reg != null)
90 string capsPath = Util.GetRandomCapsPath(); 90 {
91 response.SimAddress = reg.ExternalEndPoint.Address.ToString(); 91 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
92 response.SimPort = (Int32)reg.ExternalEndPoint.Port; 92 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
93 response.RegionX = reg.RegionLocX; 93 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
94 response.RegionY = reg.RegionLocY; 94 string capsPath = Util.GetRandomCapsPath();
95 95 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
96 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; 96 response.SimPort = (Int32)reg.ExternalEndPoint.Port;
97 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; 97 response.RegionX = reg.RegionLocX;
98 theUser.currentAgent.currentRegion = reg.SimUUID; 98 response.RegionY = reg.RegionLocY;
99 theUser.currentAgent.currentHandle = reg.RegionHandle; 99
100 100 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
101 Login _login = new Login(); 101 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
102 //copy data to login object 102 theUser.currentAgent.currentRegion = reg.SimUUID;
103 _login.First = response.Firstname; 103 theUser.currentAgent.currentHandle = reg.RegionHandle;
104 _login.Last = response.Lastname; 104
105 _login.Agent = response.AgentID; 105 Login _login = new Login();
106 _login.Session = response.SessionID; 106 //copy data to login object
107 _login.SecureSession = response.SecureSessionID; 107 _login.First = response.Firstname;
108 _login.CircuitCode = (uint)response.CircuitCode; 108 _login.Last = response.Lastname;
109 _login.CapsPath = capsPath; 109 _login.Agent = response.AgentID;
110 110 _login.Session = response.SessionID;
111 m_Parent.InformRegionOfLogin(currentRegion, _login); 111 _login.SecureSession = response.SecureSessionID;
112 } 112 _login.CircuitCode = (uint)response.CircuitCode;
113 else 113 _login.CapsPath = capsPath;
114 { 114
115 Console.WriteLine("not found region " + currentRegion); 115 if( OnLoginToRegion != null )
116 } 116 {
117 117 OnLoginToRegion(currentRegion, _login);
118 } 118 }
119 119 }
120 protected override InventoryData CreateInventoryData(LLUUID userID) 120 else
121 { 121 {
122 List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); 122 Console.WriteLine("not found region " + currentRegion);
123 if (folders.Count > 0) 123 }
124 { 124
125 LLUUID rootID = LLUUID.Zero; 125 }
126 ArrayList AgentInventoryArray = new ArrayList(); 126
127 Hashtable TempHash; 127 protected override InventoryData CreateInventoryData(LLUUID userID)
128 foreach (InventoryFolderBase InvFolder in folders) 128 {
129 { 129 List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
130 if (InvFolder.parentID == LLUUID.Zero) 130 if (folders.Count > 0)
131 { 131 {
132 rootID = InvFolder.folderID; 132 LLUUID rootID = LLUUID.Zero;
133 } 133 ArrayList AgentInventoryArray = new ArrayList();
134 TempHash = new Hashtable(); 134 Hashtable TempHash;
135 TempHash["name"] = InvFolder.name; 135 foreach (InventoryFolderBase InvFolder in folders)
136 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); 136 {
137 TempHash["version"] = (Int32)InvFolder.version; 137 if (InvFolder.parentID == LLUUID.Zero)
138 TempHash["type_default"] = (Int32)InvFolder.type; 138 {
139 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); 139 rootID = InvFolder.folderID;
140 AgentInventoryArray.Add(TempHash); 140 }
141 } 141 TempHash = new Hashtable();
142 return new InventoryData(AgentInventoryArray, rootID); 142 TempHash["name"] = InvFolder.name;
143 } 143 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
144 else 144 TempHash["version"] = (Int32)InvFolder.version;
145 { 145 TempHash["type_default"] = (Int32)InvFolder.type;
146 AgentInventory userInventory = new AgentInventory(); 146 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
147 userInventory.CreateRootFolder(userID, false); 147 AgentInventoryArray.Add(TempHash);
148 148 }
149 ArrayList AgentInventoryArray = new ArrayList(); 149 return new InventoryData(AgentInventoryArray, rootID);
150 Hashtable TempHash; 150 }
151 foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) 151 else
152 { 152 {
153 TempHash = new Hashtable(); 153 AgentInventory userInventory = new AgentInventory();
154 TempHash["name"] = InvFolder.FolderName; 154 userInventory.CreateRootFolder(userID, false);
155 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 155
156 TempHash["version"] = (Int32)InvFolder.Version; 156 ArrayList AgentInventoryArray = new ArrayList();
157 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 157 Hashtable TempHash;
158 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 158 foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
159 AgentInventoryArray.Add(TempHash); 159 {
160 } 160 TempHash = new Hashtable();
161 161 TempHash["name"] = InvFolder.FolderName;
162 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); 162 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
163 } 163 TempHash["version"] = (Int32)InvFolder.Version;
164 } 164 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
165 } 165 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
166} 166 AgentInventoryArray.Add(TempHash);
167 }
168
169 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
170 }
171 }
172 }
173}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index dea4b9f..91694b5 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Communications.OGS1
70 70
71 // Send Request 71 // Send Request
72 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); 72 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
73 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); 73 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000);
74 Hashtable GridRespData = (Hashtable)GridResp.Value; 74 Hashtable GridRespData = (Hashtable)GridResp.Value;
75 75
76 Hashtable griddatahash = GridRespData; 76 Hashtable griddatahash = GridRespData;
@@ -109,18 +109,20 @@ namespace OpenSim.Region.Communications.OGS1
109 109
110 List<RegionInfo> neighbours = new List<RegionInfo>(); 110 List<RegionInfo> neighbours = new List<RegionInfo>();
111 111
112 foreach (ArrayList a in respData.Values) 112 foreach (ArrayList neighboursList in respData.Values)
113 { 113 {
114 foreach (Hashtable n in a) 114 foreach (Hashtable neighbourData in neighboursList)
115 { 115 {
116 uint regX = Convert.ToUInt32(n["x"]); 116 uint regX = Convert.ToUInt32(neighbourData["x"]);
117 uint regY = Convert.ToUInt32(n["y"]); 117 uint regY = Convert.ToUInt32(neighbourData["y"]);
118 if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY)) 118 if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY))
119 { 119 {
120 string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS((string)n["sim_ip"]).ToString(); 120 string simIp = (string)neighbourData["sim_ip"];
121 uint port = Convert.ToUInt32(n["sim_port"]); 121
122 string externalUri = (string)n["sim_uri"]; 122 uint port = Convert.ToUInt32(neighbourData["sim_port"]);
123 string externalUri = (string)neighbourData["sim_uri"];
123 124
125 string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS(simIp).ToString();
124 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port); 126 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port);
125 string neighbourExternalUri = externalUri; 127 string neighbourExternalUri = externalUri;
126 RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr); 128 RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr);
@@ -128,10 +130,10 @@ namespace OpenSim.Region.Communications.OGS1
128 //OGS1 130 //OGS1
129 //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally 131 //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally
130 132
131 neighbour.RegionName = (string)n["name"]; 133 neighbour.RegionName = (string)neighbourData["name"];
132 134
133 //OGS1+ 135 //OGS1+
134 neighbour.SimUUID = (string)n["uuid"]; 136 neighbour.SimUUID = new LLUUID((string) neighbourData["uuid"]);
135 137
136 neighbours.Add(neighbour); 138 neighbours.Add(neighbour);
137 } 139 }
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 9a113ff..45188c1 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -1,10 +1,10 @@
1using System;
2using System.Collections.Generic; 1using System.Collections.Generic;
3using libsecondlife; 2using libsecondlife;
4using OpenSim.Framework.Communications; 3using OpenSim.Framework.Communications;
5using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
6using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; 5using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
7 6
7
8namespace OpenSim.Region.Communications.OGS1 8namespace OpenSim.Region.Communications.OGS1
9{ 9{
10 public class OGS1InventoryService : IInventoryServices 10 public class OGS1InventoryService : IInventoryServices