aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Base/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs1
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs25
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs12
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs30
-rw-r--r--OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs35
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs8
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs8
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs201
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs7
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs15
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs4
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs67
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs25
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Map/MapGetServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs8
-rw-r--r--OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs112
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs461
-rw-r--r--OpenSim/Server/Handlers/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs182
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs2
34 files changed, 885 insertions, 350 deletions
diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs
index b4732b8..67340c7 100644
--- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.6.*")] 32[assembly: AssemblyVersion("0.8.0.*")]
33 33
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 210a314..08ba50d 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -286,6 +286,7 @@ namespace OpenSim.Server.Base
286 e.InnerException == null ? e.Message : e.InnerException.Message, 286 e.InnerException == null ? e.Message : e.InnerException.Message,
287 e.StackTrace); 287 e.StackTrace);
288 } 288 }
289 m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1} args.Length {2}", dllName, e.Message, args.Length);
289 return null; 290 return null;
290 } 291 }
291 292
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 7c8e6b7..667cef8 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -34,6 +34,7 @@ using System.Text;
34using System.Xml; 34using System.Xml;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Monitoring;
37using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
38using log4net; 39using log4net;
39using log4net.Config; 40using log4net.Config;
@@ -171,11 +172,6 @@ namespace OpenSim.Server.Base
171 172
172 m_console = MainConsole.Instance; 173 m_console = MainConsole.Instance;
173 174
174 // Configure the appenders for log4net
175 //
176 OpenSimAppender consoleAppender = null;
177 FileAppender fileAppender = null;
178
179 if (logConfig != null) 175 if (logConfig != null)
180 { 176 {
181 FileInfo cfg = new FileInfo(logConfig); 177 FileInfo cfg = new FileInfo(logConfig);
@@ -195,16 +191,7 @@ namespace OpenSim.Server.Base
195 } 191 }
196 192
197 RegisterCommonCommands(); 193 RegisterCommonCommands();
198 194 RegisterCommonComponents(Config);
199 // Register the quit command
200 //
201 MainConsole.Instance.Commands.AddCommand("General", false, "quit",
202 "quit",
203 "Quit the application", HandleQuit);
204
205 MainConsole.Instance.Commands.AddCommand("General", false, "shutdown",
206 "shutdown",
207 "Quit the application", HandleQuit);
208 195
209 // Allow derived classes to perform initialization that 196 // Allow derived classes to perform initialization that
210 // needs to be done after the console has opened 197 // needs to be done after the console has opened
@@ -219,6 +206,9 @@ namespace OpenSim.Server.Base
219 206
220 public virtual int Run() 207 public virtual int Run()
221 { 208 {
209 Watchdog.Enabled = true;
210 MemoryWatchdog.Enabled = true;
211
222 while (m_Running) 212 while (m_Running)
223 { 213 {
224 try 214 try
@@ -236,11 +226,12 @@ namespace OpenSim.Server.Base
236 return 0; 226 return 0;
237 } 227 }
238 228
239 protected virtual void HandleQuit(string module, string[] args) 229 protected override void ShutdownSpecific()
240 { 230 {
241 m_Running = false; 231 m_Running = false;
242 m_log.Info("[CONSOLE] Quitting"); 232 m_log.Info("[CONSOLE] Quitting");
243 233
234 base.ShutdownSpecific();
244 } 235 }
245 236
246 protected virtual void ReadConfig() 237 protected virtual void ReadConfig()
@@ -251,4 +242,4 @@ namespace OpenSim.Server.Base
251 { 242 {
252 } 243 }
253 } 244 }
254} 245} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index ff45d94..cc4325a 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -119,16 +119,14 @@ namespace OpenSim.Server.Handlers.Asset
119 119
120 if (asset == null || asset.Data.Length == 0) 120 if (asset == null || asset.Data.Length == 0)
121 { 121 {
122 MainConsole.Instance.Output("Asset not found"); 122 MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]);
123 return; 123 return;
124 } 124 }
125 125
126 m_AssetService.Delete(args[2]); 126 if (!m_AssetService.Delete(asset.ID))
127 127 MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name);
128 //MainConsole.Instance.Output("Asset deleted"); 128 else
129 // TODO: Implement this 129 MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name);
130
131 MainConsole.Instance.Output("Asset deletion not supported by database");
132 } 130 }
133 131
134 void HandleDumpAsset(string module, string[] args) 132 void HandleDumpAsset(string module, string[] args)
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
index 986394b..941b97d 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Asset
70 m_allowedTypes = allowedTypes; 70 m_allowedTypes = allowedTypes;
71 } 71 }
72 72
73 public override byte[] Handle(string path, Stream request, 73 protected override byte[] ProcessRequest(string path, Stream request,
74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
75 { 75 {
76 bool result = false; 76 bool result = false;
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
index 8f7412b..8b23a83 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
54 m_AssetService = service; 54 m_AssetService = service;
55 } 55 }
56 56
57 public override byte[] Handle(string path, Stream request, 57 protected override byte[] ProcessRequest(string path, Stream request,
58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 byte[] result = new byte[0]; 60 byte[] result = new byte[0];
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
index a006fa8..8eebc61 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
54 m_AssetService = service; 54 m_AssetService = service;
55 } 55 }
56 56
57 public override byte[] Handle(string path, Stream request, 57 protected override byte[] ProcessRequest(string path, Stream request,
58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 AssetBase asset; 60 AssetBase asset;
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 6b93cd9..16e011a 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Authentication
70 } 70 }
71 } 71 }
72 72
73 public override byte[] Handle(string path, Stream request, 73 protected override byte[] ProcessRequest(string path, Stream request,
74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
75 { 75 {
76 string[] p = SplitParams(path); 76 string[] p = SplitParams(path);
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index 18cef15..66a26fc 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication
147 #endregion 147 #endregion
148 } 148 }
149 149
150 public class OpenIdStreamHandler : IStreamHandler 150 public class OpenIdStreamHandler : BaseOutputStreamHandler
151 { 151 {
152 #region HTML 152 #region HTML
153 153
@@ -191,42 +191,34 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
191 191
192 #endregion HTML 192 #endregion HTML
193 193
194 public string Name { get { return "OpenId"; } }
195 public string Description { get { return null; } }
196 public string ContentType { get { return m_contentType; } }
197 public string HttpMethod { get { return m_httpMethod; } }
198 public string Path { get { return m_path; } }
199
200 string m_contentType;
201 string m_httpMethod;
202 string m_path;
203 IAuthenticationService m_authenticationService; 194 IAuthenticationService m_authenticationService;
204 IUserAccountService m_userAccountService; 195 IUserAccountService m_userAccountService;
205 ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); 196 ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
206 197
198 public override string ContentType { get { return "text/html"; } }
199
207 /// <summary> 200 /// <summary>
208 /// Constructor 201 /// Constructor
209 /// </summary> 202 /// </summary>
210 public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService) 203 public OpenIdStreamHandler(
204 string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
205 : base(httpMethod, path, "OpenId", "OpenID stream handler")
211 { 206 {
212 m_authenticationService = authService; 207 m_authenticationService = authService;
213 m_userAccountService = userService; 208 m_userAccountService = userService;
214 m_httpMethod = httpMethod;
215 m_path = path;
216
217 m_contentType = "text/html";
218 } 209 }
219 210
220 /// <summary> 211 /// <summary>
221 /// Handles all GET and POST requests for OpenID identifier pages and endpoint 212 /// Handles all GET and POST requests for OpenID identifier pages and endpoint
222 /// server communication 213 /// server communication
223 /// </summary> 214 /// </summary>
224 public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 215 protected override void ProcessRequest(
216 string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
225 { 217 {
226 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); 218 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
227 219
228 // Defult to returning HTML content 220 // Defult to returning HTML content
229 m_contentType = "text/html"; 221 httpResponse.ContentType = ContentType;
230 222
231 try 223 try
232 { 224 {
@@ -276,7 +268,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
276 268
277 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); 269 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
278 if (contentTypeValues != null && contentTypeValues.Length == 1) 270 if (contentTypeValues != null && contentTypeValues.Length == 1)
279 m_contentType = contentTypeValues[0]; 271 httpResponse.ContentType = contentTypeValues[0];
280 272
281 // Set the response code and document body based on the OpenID result 273 // Set the response code and document body based on the OpenID result
282 httpResponse.StatusCode = (int)provider.Request.Response.Code; 274 httpResponse.StatusCode = (int)provider.Request.Response.Code;
@@ -344,4 +336,4 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
344 return false; 336 return false;
345 } 337 }
346 } 338 }
347} 339} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
index bcf9d47..c9b4e9b 100644
--- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Authorization
54 m_AuthorizationService = service; 54 m_AuthorizationService = service;
55 } 55 }
56 56
57 public override byte[] Handle(string path, Stream request, 57 protected override byte[] ProcessRequest(string path, Stream request,
58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest)); 60 XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index 8cd747e..d6bbb8f 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Avatar
56 m_AvatarService = service; 56 m_AvatarService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream requestData, 59 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 StreamReader sr = new StreamReader(requestData); 62 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 47a8558..ca0a24c 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Friends
57 m_FriendsService = service; 57 m_FriendsService = service;
58 } 58 }
59 59
60 public override byte[] Handle(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 { 62 {
63 StreamReader sr = new StreamReader(requestData); 63 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index ef5f33e..c63b409 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Grid
57 m_GridService = service; 57 m_GridService = service;
58 } 58 }
59 59
60 public override byte[] Handle(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 { 62 {
63 StreamReader sr = new StreamReader(requestData); 63 StreamReader sr = new StreamReader(requestData);
@@ -106,6 +106,9 @@ namespace OpenSim.Server.Handlers.Grid
106 case "get_default_regions": 106 case "get_default_regions":
107 return GetDefaultRegions(request); 107 return GetDefaultRegions(request);
108 108
109 case "get_default_hypergrid_regions":
110 return GetDefaultHypergridRegions(request);
111
109 case "get_fallback_regions": 112 case "get_fallback_regions":
110 return GetFallbackRegions(request); 113 return GetFallbackRegions(request);
111 114
@@ -444,6 +447,36 @@ namespace OpenSim.Server.Handlers.Grid
444 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 447 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
445 } 448 }
446 449
450 byte[] GetDefaultHypergridRegions(Dictionary<string, object> request)
451 {
452 //m_log.DebugFormat("[GRID HANDLER]: GetDefaultRegions");
453 UUID scopeID = UUID.Zero;
454 if (request.ContainsKey("SCOPEID"))
455 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
456 else
457 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range");
458
459 List<GridRegion> rinfos = m_GridService.GetDefaultHypergridRegions(scopeID);
460
461 Dictionary<string, object> result = new Dictionary<string, object>();
462 if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
463 result["result"] = "null";
464 else
465 {
466 int i = 0;
467 foreach (GridRegion rinfo in rinfos)
468 {
469 Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
470 result["region" + i] = rinfoDict;
471 i++;
472 }
473 }
474 string xmlString = ServerUtils.BuildXmlResponse(result);
475
476 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
477 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
478 }
479
447 byte[] GetFallbackRegions(Dictionary<string, object> request) 480 byte[] GetFallbackRegions(Dictionary<string, object> request)
448 { 481 {
449 //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); 482 //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange");
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 687cf8d..0b98e9a 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser
56 m_GridUserService = service; 56 m_GridUserService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream requestData, 59 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 StreamReader sr = new StreamReader(requestData); 62 StreamReader sr = new StreamReader(requestData);
@@ -185,10 +185,12 @@ namespace OpenSim.Server.Handlers.GridUser
185 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); 185 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user);
186 186
187 Dictionary<string, object> result = new Dictionary<string, object>(); 187 Dictionary<string, object> result = new Dictionary<string, object>();
188 result["result"] = guinfo.ToKeyValuePairs(); 188 if (guinfo != null)
189 result["result"] = guinfo.ToKeyValuePairs();
190 else
191 result["result"] = "null";
189 192
190 string xmlString = ServerUtils.BuildXmlResponse(result); 193 string xmlString = ServerUtils.BuildXmlResponse(result);
191
192 //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); 194 //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
193 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 195 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
194 } 196 }
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
index cf1af15..adc2fbc 100644
--- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
61 m_Proxy = proxy; 61 m_Proxy = proxy;
62 } 62 }
63 63
64 protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 64 protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
65 { 65 {
66 return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); 66 return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason);
67 } 67 }
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
index 0d4990a..ffe2f36 100644
--- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
@@ -76,10 +76,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
76 server.AddStreamHandler(new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy)); 76 server.AddStreamHandler(new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy));
77 } 77 }
78 78
79 public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) 79 public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, string configName)
80 : this(config, server, null) 80 : this(config, server, (ISimulationService)null)
81 { 81 {
82 } 82 }
83 83
84 public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server)
85 : this(config, server, String.Empty)
86 {
87 }
84 } 88 }
85} 89}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 0aa2729..a2bdadb 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
68 m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!"); 68 m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!");
69 } 69 }
70 70
71 public override byte[] Handle(string path, Stream requestData, 71 protected override byte[] ProcessRequest(string path, Stream requestData,
72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
73 { 73 {
74 StreamReader sr = new StreamReader(requestData); 74 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
index f306b1c..06eaf2e 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
91 m_HandlersType = handlersType; 91 m_HandlersType = handlersType;
92 } 92 }
93 93
94 public override byte[] Handle(string path, Stream requestData, 94 protected override byte[] ProcessRequest(string path, Stream requestData,
95 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 95 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
96 { 96 {
97 return OKResponse(httpResponse); 97 return OKResponse(httpResponse);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index 968c1e6..04bb9e8 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -49,191 +49,88 @@ using log4net;
49 49
50namespace OpenSim.Server.Handlers.Hypergrid 50namespace OpenSim.Server.Handlers.Hypergrid
51{ 51{
52 public class HomeAgentHandler 52 public class HomeAgentHandler : AgentPostHandler
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private IUserAgentService m_UserAgentService; 55 private IUserAgentService m_UserAgentService;
56 56
57 private string m_LoginServerIP; 57 private string m_LoginServerIP;
58 private bool m_Proxy = false;
59 58
60 public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP, bool proxy) 59 public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP, bool proxy) :
60 base("/homeagent")
61 { 61 {
62 m_UserAgentService = userAgentService; 62 m_UserAgentService = userAgentService;
63 m_LoginServerIP = loginServerIP; 63 m_LoginServerIP = loginServerIP;
64 m_Proxy = proxy; 64 m_Proxy = proxy;
65 } 65 }
66 66
67 public Hashtable Handler(Hashtable request) 67 protected override AgentDestinationData CreateAgentDestinationData()
68 { 68 {
69// m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called"); 69 return new ExtendedAgentDestinationData();
70// 70 }
71// m_log.Debug("---------------------------"); 71
72// m_log.Debug(" >> uri=" + request["uri"]); 72 protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request)
73// m_log.Debug(" >> content-type=" + request["content-type"]); 73 {
74// m_log.Debug(" >> http-method=" + request["http-method"]); 74 base.UnpackData(args, d, request);
75// m_log.Debug("---------------------------\n"); 75 ExtendedAgentDestinationData data = (ExtendedAgentDestinationData)d;
76 76 try
77 Hashtable responsedata = new Hashtable();
78 responsedata["content_type"] = "text/html";
79 responsedata["keepalive"] = false;
80
81
82 UUID agentID;
83 UUID regionID;
84 string action;
85 if (!Utils.GetParams((string)request["uri"], out agentID, out regionID, out action))
86 { 77 {
87 m_log.InfoFormat("[HOME AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); 78 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
88 responsedata["int_response_code"] = 404; 79 data.host = args["gatekeeper_host"].AsString();
89 responsedata["str_response_string"] = "false"; 80 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
81 Int32.TryParse(args["gatekeeper_port"].AsString(), out data.port);
82 if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] != null)
83 data.gatekeeperServerURI = args["gatekeeper_serveruri"];
84 if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] != null)
85 data.destinationServerURI = args["destination_serveruri"];
90 86
91 return responsedata;
92 } 87 }
93 88 catch (InvalidCastException)
94 // Next, let's parse the verb
95 string method = (string)request["http-method"];
96 if (method.Equals("POST"))
97 { 89 {
98 DoAgentPost(request, responsedata, agentID); 90 m_log.ErrorFormat("[HOME AGENT HANDLER]: Bad cast in UnpackData");
99 return responsedata;
100 } 91 }
101 else
102 {
103 m_log.InfoFormat("[HOME AGENT HANDLER]: method {0} not supported in agent message", method);
104 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
105 responsedata["str_response_string"] = "Method not allowed";
106 92
107 return responsedata; 93 string callerIP = GetCallerIP(request);
108 } 94 // Verify if this call came from the login server
95 if (callerIP == m_LoginServerIP)
96 data.fromLogin = true;
109 97
110 } 98 }
111 99
112 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) 100 protected override GridRegion ExtractGatekeeper(AgentDestinationData d)
113 { 101 {
114 OSDMap args = Utils.GetOSDMap((string)request["body"]); 102 if (d is ExtendedAgentDestinationData)
115 if (args == null)
116 { 103 {
117 responsedata["int_response_code"] = HttpStatusCode.BadRequest; 104 ExtendedAgentDestinationData data = (ExtendedAgentDestinationData)d;
118 responsedata["str_response_string"] = "Bad request"; 105 GridRegion gatekeeper = new GridRegion();
119 return; 106 gatekeeper.ServerURI = data.gatekeeperServerURI;
107 gatekeeper.ExternalHostName = data.host;
108 gatekeeper.HttpPort = (uint)data.port;
109 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
110
111 return gatekeeper;
120 } 112 }
121
122 // retrieve the input arguments
123 int x = 0, y = 0;
124 UUID uuid = UUID.Zero;
125 string regionname = string.Empty;
126 string gatekeeper_host = string.Empty;
127 string gatekeeper_serveruri = string.Empty;
128 string destination_serveruri = string.Empty;
129 int gatekeeper_port = 0;
130 IPEndPoint client_ipaddress = null;
131
132 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
133 gatekeeper_host = args["gatekeeper_host"].AsString();
134 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
135 Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port);
136 if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null)
137 gatekeeper_serveruri = args["gatekeeper_serveruri"];
138 if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null)
139 destination_serveruri = args["destination_serveruri"];
140
141 GridRegion gatekeeper = new GridRegion();
142 gatekeeper.ServerURI = gatekeeper_serveruri;
143 gatekeeper.ExternalHostName = gatekeeper_host;
144 gatekeeper.HttpPort = (uint)gatekeeper_port;
145 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
146
147 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
148 Int32.TryParse(args["destination_x"].AsString(), out x);
149 else
150 m_log.WarnFormat(" -- request didn't have destination_x");
151 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
152 Int32.TryParse(args["destination_y"].AsString(), out y);
153 else 113 else
154 m_log.WarnFormat(" -- request didn't have destination_y"); 114 m_log.WarnFormat("[HOME AGENT HANDLER]: Wrong data type");
155 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
156 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
157 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
158 regionname = args["destination_name"].ToString();
159
160 if (args.ContainsKey("client_ip") && args["client_ip"] != null)
161 {
162 string ip_str = args["client_ip"].ToString();
163 try
164 {
165 string callerIP = GetCallerIP(request);
166 // Verify if this caller has authority to send the client IP
167 if (callerIP == m_LoginServerIP)
168 client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0);
169 else // leaving this for now, but this warning should be removed
170 m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str);
171 }
172 catch
173 {
174 m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str);
175 }
176 }
177 115
178 GridRegion destination = new GridRegion(); 116 return null;
179 destination.RegionID = uuid;
180 destination.RegionLocX = x;
181 destination.RegionLocY = y;
182 destination.RegionName = regionname;
183 destination.ServerURI = destination_serveruri;
184
185 AgentCircuitData aCircuit = new AgentCircuitData();
186 try
187 {
188 aCircuit.UnpackAgentCircuitData(args);
189 }
190 catch (Exception ex)
191 {
192 m_log.InfoFormat("[HOME AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
193 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
194 responsedata["str_response_string"] = "Bad request";
195 return;
196 }
197
198 OSDMap resp = new OSDMap(2);
199 string reason = String.Empty;
200
201 bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason);
202
203 resp["reason"] = OSD.FromString(reason);
204 resp["success"] = OSD.FromBoolean(result);
205
206 // TODO: add reason if not String.Empty?
207 responsedata["int_response_code"] = HttpStatusCode.OK;
208 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
209 } 117 }
210 118
211 private string GetCallerIP(Hashtable request)
212 {
213 if (!m_Proxy)
214 return Util.GetCallerIP(request);
215
216 // We're behind a proxy
217 Hashtable headers = (Hashtable)request["headers"];
218 string xff = "X-Forwarded-For";
219 if (headers.ContainsKey(xff.ToLower()))
220 xff = xff.ToLower();
221 119
222 if (!headers.ContainsKey(xff) || headers[xff] == null) 120 protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
223 { 121 {
224 m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); 122 return m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, fromLogin, out reason);
225 return Util.GetCallerIP(request); 123 }
226 }
227 124
228 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); 125 }
229 126
230 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); 127 public class ExtendedAgentDestinationData : AgentDestinationData
231 if (ep != null) 128 {
232 return ep.Address.ToString(); 129 public string host;
130 public int port;
131 public string gatekeeperServerURI;
132 public string destinationServerURI;
233 133
234 // Oops
235 return Util.GetCallerIP(request);
236 }
237 } 134 }
238 135
239} 136}
diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
index 80eb5d2..8145a21 100644
--- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
@@ -54,10 +54,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
54 private IInstantMessage m_IMService; 54 private IInstantMessage m_IMService;
55 55
56 public InstantMessageServerConnector(IConfigSource config, IHttpServer server) : 56 public InstantMessageServerConnector(IConfigSource config, IHttpServer server) :
57 this(config, server, null) 57 this(config, server, (IInstantMessageSimConnector)null)
58 { 58 {
59 } 59 }
60 60
61 public InstantMessageServerConnector(IConfigSource config, IHttpServer server, string configName) :
62 this(config, server)
63 {
64 }
65
61 public InstantMessageServerConnector(IConfigSource config, IHttpServer server, IInstantMessageSimConnector simConnector) : 66 public InstantMessageServerConnector(IConfigSource config, IHttpServer server, IInstantMessageSimConnector simConnector) :
62 base(config, server, String.Empty) 67 base(config, server, String.Empty)
63 { 68 {
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index db62aaa..7137836 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -62,10 +62,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
62 private bool m_VerifyCallers = false; 62 private bool m_VerifyCallers = false;
63 63
64 public UserAgentServerConnector(IConfigSource config, IHttpServer server) : 64 public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
65 this(config, server, null) 65 this(config, server, (IFriendsSimConnector)null)
66 { 66 {
67 } 67 }
68 68
69 public UserAgentServerConnector(IConfigSource config, IHttpServer server, string configName) :
70 this(config, server)
71 {
72 }
73
69 public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) : 74 public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) :
70 base(config, server, String.Empty) 75 base(config, server, String.Empty)
71 { 76 {
@@ -103,7 +108,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
103 server.AddXmlRPCHandler("get_uui", GetUUI, false); 108 server.AddXmlRPCHandler("get_uui", GetUUI, false);
104 server.AddXmlRPCHandler("get_uuid", GetUUID, false); 109 server.AddXmlRPCHandler("get_uuid", GetUUID, false);
105 110
106 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); 111 server.AddStreamHandler(new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy));
107 } 112 }
108 113
109 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) 114 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
@@ -448,7 +453,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
448 XmlRpcResponse response = new XmlRpcResponse(); 453 XmlRpcResponse response = new XmlRpcResponse();
449 response.Value = hash; 454 response.Value = hash;
450 return response; 455 return response;
451
452 } 456 }
453 457
454 /// <summary> 458 /// <summary>
@@ -466,9 +470,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
466 //string portstr = (string)requestData["port"]; 470 //string portstr = (string)requestData["port"];
467 if (requestData.ContainsKey("first") && requestData.ContainsKey("last")) 471 if (requestData.ContainsKey("first") && requestData.ContainsKey("last"))
468 { 472 {
469 UUID userID = UUID.Zero;
470 string first = (string)requestData["first"]; 473 string first = (string)requestData["first"];
471
472 string last = (string)requestData["last"]; 474 string last = (string)requestData["last"];
473 UUID uuid = m_HomeUsersService.GetUUID(first, last); 475 UUID uuid = m_HomeUsersService.GetUUID(first, last);
474 hash["UUID"] = uuid.ToString(); 476 hash["UUID"] = uuid.ToString();
@@ -477,7 +479,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
477 XmlRpcResponse response = new XmlRpcResponse(); 479 XmlRpcResponse response = new XmlRpcResponse();
478 response.Value = hash; 480 response.Value = hash;
479 return response; 481 return response;
480
481 } 482 }
482 } 483 }
483} 484} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
index 231e32f..e2c50fe 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Inventory
56 m_InventoryService = service; 56 m_InventoryService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream request, 59 protected override byte[] ProcessRequest(string path, Stream request,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>)); 62 XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 64127c2..0d7c136 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Server.Handlers.Asset
87 m_InventoryService = service; 87 m_InventoryService = service;
88 } 88 }
89 89
90 public override byte[] Handle(string path, Stream requestData, 90 protected override byte[] ProcessRequest(string path, Stream requestData,
91 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 91 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
92 { 92 {
93 StreamReader sr = new StreamReader(requestData); 93 StreamReader sr = new StreamReader(requestData);
@@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset
155 } 155 }
156 catch (Exception e) 156 catch (Exception e)
157 { 157 {
158 m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); 158 m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace);
159 } 159 }
160 160
161 return FailureResult(); 161 return FailureResult();
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index f83a239..f2a5678 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Server.Handlers.Login
53 53
54 private ILoginService m_LocalService; 54 private ILoginService m_LocalService;
55 private bool m_Proxy; 55 private bool m_Proxy;
56
56 57
57 public LLLoginHandlers(ILoginService service, bool hasProxy) 58 public LLLoginHandlers(ILoginService service, bool hasProxy)
58 { 59 {
@@ -144,6 +145,17 @@ namespace OpenSim.Server.Handlers.Login
144 return FailedXMLRPCResponse(); 145 return FailedXMLRPCResponse();
145 146
146 } 147 }
148 public XmlRpcResponse HandleXMLRPCLoginBlocked(XmlRpcRequest request, IPEndPoint client)
149 {
150 XmlRpcResponse response = new XmlRpcResponse();
151 Hashtable resp = new Hashtable();
152
153 resp["reason"] = "presence";
154 resp["message"] = "Logins are currently restricted. Please try again later.";
155 resp["login"] = "false";
156 response.Value = resp;
157 return response;
158 }
147 159
148 public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) 160 public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient)
149 { 161 {
@@ -213,6 +225,61 @@ namespace OpenSim.Server.Handlers.Login
213 return FailedOSDResponse(); 225 return FailedOSDResponse();
214 } 226 }
215 227
228 public void HandleWebSocketLoginEvents(string path, WebSocketHttpServerHandler sock)
229 {
230 sock.MaxPayloadSize = 16384; //16 kb payload
231 sock.InitialMsgTimeout = 5000; //5 second first message to trigger at least one of these events
232 sock.NoDelay_TCP_Nagle = true;
233 sock.OnData += delegate(object sender, WebsocketDataEventArgs data) { sock.Close("fail"); };
234 sock.OnPing += delegate(object sender, PingEventArgs pingdata) { sock.Close("fail"); };
235 sock.OnPong += delegate(object sender, PongEventArgs pongdata) { sock.Close("fail"); };
236 sock.OnText += delegate(object sender, WebsocketTextEventArgs text)
237 {
238 OSD request = null;
239 try
240 {
241 request = OSDParser.DeserializeJson(text.Data);
242 if (!(request is OSDMap))
243 {
244 sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse()));
245 }
246 else
247 {
248 OSDMap req = request as OSDMap;
249 string first = req["firstname"].AsString();
250 string last = req["lastname"].AsString();
251 string passwd = req["passwd"].AsString();
252 string start = req["startlocation"].AsString();
253 string version = req["version"].AsString();
254 string channel = req["channel"].AsString();
255 string mac = req["mac"].AsString();
256 string id0 = req["id0"].AsString();
257 UUID scope = UUID.Zero;
258 IPEndPoint endPoint =
259 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint();
260 LoginResponse reply = null;
261 reply = m_LocalService.Login(first, last, passwd, start, scope, version,
262 channel, mac, id0, endPoint);
263 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap()));
264
265 }
266
267 }
268 catch (Exception)
269 {
270 sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse()));
271 }
272 finally
273 {
274 sock.Close("success");
275 }
276 };
277
278 sock.HandshakeAndUpgrade();
279
280 }
281
282
216 private XmlRpcResponse FailedXMLRPCResponse() 283 private XmlRpcResponse FailedXMLRPCResponse()
217 { 284 {
218 Hashtable hash = new Hashtable(); 285 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
index 9a7ad34..f60e892 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
@@ -44,6 +44,7 @@ namespace OpenSim.Server.Handlers.Login
44 44
45 private ILoginService m_LoginService; 45 private ILoginService m_LoginService;
46 private bool m_Proxy; 46 private bool m_Proxy;
47 private BasicDosProtectorOptions m_DosProtectionOptions;
47 48
48 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : 49 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
49 base(config, server, String.Empty) 50 base(config, server, String.Empty)
@@ -60,8 +61,8 @@ namespace OpenSim.Server.Handlers.Login
60 InitializeHandlers(server); 61 InitializeHandlers(server);
61 } 62 }
62 63
63 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server) : 64 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
64 base(config, server, String.Empty) 65 base(config, server, configName)
65 { 66 {
66 string loginService = ReadLocalServiceFromConfig(config); 67 string loginService = ReadLocalServiceFromConfig(config);
67 68
@@ -72,6 +73,11 @@ namespace OpenSim.Server.Handlers.Login
72 InitializeHandlers(server); 73 InitializeHandlers(server);
73 } 74 }
74 75
76 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server) :
77 this(config, server, String.Empty)
78 {
79 }
80
75 private string ReadLocalServiceFromConfig(IConfigSource config) 81 private string ReadLocalServiceFromConfig(IConfigSource config)
76 { 82 {
77 IConfig serverConfig = config.Configs["LoginService"]; 83 IConfig serverConfig = config.Configs["LoginService"];
@@ -83,6 +89,16 @@ namespace OpenSim.Server.Handlers.Login
83 throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); 89 throw new Exception(String.Format("No LocalServiceModule for LoginService in config file"));
84 90
85 m_Proxy = serverConfig.GetBoolean("HasProxy", false); 91 m_Proxy = serverConfig.GetBoolean("HasProxy", false);
92 m_DosProtectionOptions = new BasicDosProtectorOptions();
93 // Dos Protection Options
94 m_DosProtectionOptions.AllowXForwardedFor = serverConfig.GetBoolean("DOSAllowXForwardedForHeader", false);
95 m_DosProtectionOptions.RequestTimeSpan =
96 TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSRequestTimeFrameMS", 10000));
97 m_DosProtectionOptions.MaxRequestsInTimeframe = serverConfig.GetInt("DOSMaxRequestsInTimeFrame", 5);
98 m_DosProtectionOptions.ForgetTimeSpan =
99 TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSForgiveClientAfterMS", 120000));
100 m_DosProtectionOptions.ReportingName = "LOGINDOSPROTECTION";
101
86 102
87 return loginService; 103 return loginService;
88 } 104 }
@@ -90,9 +106,12 @@ namespace OpenSim.Server.Handlers.Login
90 private void InitializeHandlers(IHttpServer server) 106 private void InitializeHandlers(IHttpServer server)
91 { 107 {
92 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); 108 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy);
93 server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); 109 server.AddXmlRPCHandler("login_to_simulator",
110 new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin,loginHandlers.HandleXMLRPCLoginBlocked,
111 m_DosProtectionOptions).Process, false);
94 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); 112 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
95 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); 113 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
114 server.AddWebSocketHandler("/WebSocket/GridLogin", loginHandlers.HandleWebSocketLoginEvents);
96 } 115 }
97 } 116 }
98} 117}
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 4a61969..d438fc7 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.MapImage
99 m_Proxy = proxy; 99 m_Proxy = proxy;
100 } 100 }
101 101
102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 102 protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
103 { 103 {
104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); 104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
105 StreamReader sr = new StreamReader(requestData); 105 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index 4502b7d..bd1ddbd 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.MapImage
83 m_MapService = service; 83 m_MapService = service;
84 } 84 }
85 85
86 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 86 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
87 { 87 {
88 ev.WaitOne(); 88 ev.WaitOne();
89 lock (ev) 89 lock (ev)
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index 8a1f824..3525a01 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Neighbour
58 // TODO: unused: m_AuthenticationService = authentication; 58 // TODO: unused: m_AuthenticationService = authentication;
59 } 59 }
60 60
61 public override byte[] Handle(string path, Stream request, 61 protected override byte[] ProcessRequest(string path, Stream request,
62 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 62 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
63 { 63 {
64 // Not implemented yet 64 // Not implemented yet
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Neighbour
83 // TODO: unused: m_AllowForeignGuests = foreignGuests; 83 // TODO: unused: m_AllowForeignGuests = foreignGuests;
84 } 84 }
85 85
86 public override byte[] Handle(string path, Stream request, 86 protected override byte[] ProcessRequest(string path, Stream request,
87 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 87 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
88 { 88 {
89 byte[] result = new byte[0]; 89 byte[] result = new byte[0];
@@ -176,7 +176,7 @@ namespace OpenSim.Server.Handlers.Neighbour
176 // TODO: unused: m_AuthenticationService = authentication; 176 // TODO: unused: m_AuthenticationService = authentication;
177 } 177 }
178 178
179 public override byte[] Handle(string path, Stream request, 179 protected override byte[] ProcessRequest(string path, Stream request,
180 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 180 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
181 { 181 {
182 // Not implemented yet 182 // Not implemented yet
@@ -197,7 +197,7 @@ namespace OpenSim.Server.Handlers.Neighbour
197 // TODO: unused: m_AuthenticationService = authentication; 197 // TODO: unused: m_AuthenticationService = authentication;
198 } 198 }
199 199
200 public override byte[] Handle(string path, Stream request, 200 protected override byte[] ProcessRequest(string path, Stream request,
201 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 201 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
202 { 202 {
203 // Not implemented yet 203 // Not implemented yet
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 2d67c6d..abb4b19 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Presence
56 m_PresenceService = service; 56 m_PresenceService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream requestData, 59 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 StreamReader sr = new StreamReader(requestData); 62 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
new file mode 100644
index 0000000..28dbbc2
--- /dev/null
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
@@ -0,0 +1,112 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using Nini.Config;
31using OpenSim.Server.Base;
32using OpenSim.Services.Interfaces;
33using OpenSim.Framework.Servers.HttpServer;
34using OpenSim.Framework;
35using OpenSim.Server.Handlers.Base;
36using log4net;
37
38namespace OpenSim.Server.Handlers.Profiles
39{
40 public class UserProfilesConnector: ServiceConnector
41 {
42// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 // Our Local Module
45 public IUserProfilesService ServiceModule
46 {
47 get; private set;
48 }
49
50 // The HTTP server.
51 public IHttpServer Server
52 {
53 get; private set;
54 }
55
56 public string ConfigName
57 {
58 get; private set;
59 }
60
61 public bool Enabled
62 {
63 get; private set;
64 }
65
66 public UserProfilesConnector(IConfigSource config, IHttpServer server, string configName) :
67 base(config, server, configName)
68 {
69 ConfigName = "UserProfilesService";
70 if(!string.IsNullOrEmpty(configName))
71 ConfigName = configName;
72
73 IConfig serverConfig = config.Configs[ConfigName];
74 if (serverConfig == null)
75 throw new Exception(String.Format("No section {0} in config file", ConfigName));
76
77 if(!serverConfig.GetBoolean("Enabled",false))
78 {
79 Enabled = false;
80 return;
81 }
82
83 Enabled = true;
84
85 Server = server;
86
87 string service = serverConfig.GetString("LocalServiceModule", String.Empty);
88
89 Object[] args = new Object[] { config, ConfigName };
90 ServiceModule = ServerUtils.LoadPlugin<IUserProfilesService>(service, args);
91
92 JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule);
93
94 Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest);
95 Server.AddJsonRPCHandler("classified_update", handler.ClassifiedUpdate);
96 Server.AddJsonRPCHandler("classifieds_info_query", handler.ClassifiedInfoRequest);
97 Server.AddJsonRPCHandler("classified_delete", handler.ClassifiedDelete);
98 Server.AddJsonRPCHandler("avatarpicksrequest", handler.AvatarPicksRequest);
99 Server.AddJsonRPCHandler("pickinforequest", handler.PickInfoRequest);
100 Server.AddJsonRPCHandler("picks_update", handler.PicksUpdate);
101 Server.AddJsonRPCHandler("picks_delete", handler.PicksDelete);
102 Server.AddJsonRPCHandler("avatarnotesrequest", handler.AvatarNotesRequest);
103 Server.AddJsonRPCHandler("avatar_notes_update", handler.NotesUpdate);
104 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
105 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
106 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
107 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
108 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
109 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
110 }
111 }
112} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
new file mode 100644
index 0000000..f5f0794
--- /dev/null
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
@@ -0,0 +1,461 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using OpenMetaverse;
31using OpenMetaverse.StructuredData;
32using log4net;
33using OpenSim.Services.Interfaces;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Framework;
36
37namespace OpenSim.Server.Handlers
38{
39 public class UserProfilesHandlers
40 {
41 public UserProfilesHandlers ()
42 {
43 }
44 }
45
46 public class JsonRpcProfileHandlers
47 {
48 static readonly ILog m_log =
49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType);
51
52 public IUserProfilesService Service
53 {
54 get; private set;
55 }
56
57 public JsonRpcProfileHandlers(IUserProfilesService service)
58 {
59 Service = service;
60 }
61
62 #region Classifieds
63 /// <summary>
64 /// Request avatar's classified ads.
65 /// </summary>
66 /// <returns>
67 /// An array containing all the calassified uuid and it's name created by the creator id
68 /// </returns>
69 /// <param name='json'>
70 /// Our parameters are in the OSDMap json["params"]
71 /// </param>
72 /// <param name='response'>
73 /// If set to <c>true</c> response.
74 /// </param>
75 public bool AvatarClassifiedsRequest(OSDMap json, ref JsonRpcResponse response)
76 {
77 if(!json.ContainsKey("params"))
78 {
79 response.Error.Code = ErrorCode.ParseError;
80 m_log.DebugFormat ("Classified Request");
81 return false;
82 }
83
84 OSDMap request = (OSDMap)json["params"];
85 UUID creatorId = new UUID(request["creatorId"].AsString());
86
87
88 OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId);
89 response.Result = data;
90
91 return true;
92 }
93
94 public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response)
95 {
96 if(!json.ContainsKey("params"))
97 {
98 response.Error.Code = ErrorCode.ParseError;
99 response.Error.Message = "Error parsing classified update request";
100 m_log.DebugFormat ("Classified Update Request");
101 return false;
102 }
103
104 string result = string.Empty;
105 UserClassifiedAdd ad = new UserClassifiedAdd();
106 object Ad = (object)ad;
107 OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]);
108 if(Service.ClassifiedUpdate(ad, ref result))
109 {
110 response.Result = OSD.SerializeMembers(ad);
111 return true;
112 }
113
114 response.Error.Code = ErrorCode.InternalError;
115 response.Error.Message = string.Format("{0}", result);
116 return false;
117 }
118
119 public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response)
120 {
121 if(!json.ContainsKey("params"))
122 {
123 response.Error.Code = ErrorCode.ParseError;
124 m_log.DebugFormat ("Classified Delete Request");
125 return false;
126 }
127
128 OSDMap request = (OSDMap)json["params"];
129 UUID classifiedId = new UUID(request["classifiedID"].AsString());
130
131 OSDMap res = new OSDMap();
132 res["result"] = OSD.FromString("success");
133 response.Result = res;
134
135 return true;
136
137 }
138
139 public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response)
140 {
141 if(!json.ContainsKey("params"))
142 {
143 response.Error.Code = ErrorCode.ParseError;
144 response.Error.Message = "no parameters supplied";
145 m_log.DebugFormat ("Classified Info Request");
146 return false;
147 }
148
149 string result = string.Empty;
150 UserClassifiedAdd ad = new UserClassifiedAdd();
151 object Ad = (object)ad;
152 OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]);
153 if(Service.ClassifiedInfoRequest(ref ad, ref result))
154 {
155 response.Result = OSD.SerializeMembers(ad);
156 return true;
157 }
158
159 response.Error.Code = ErrorCode.InternalError;
160 response.Error.Message = string.Format("{0}", result);
161 return false;
162 }
163 #endregion Classifieds
164
165 #region Picks
166 public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response)
167 {
168 if(!json.ContainsKey("params"))
169 {
170 response.Error.Code = ErrorCode.ParseError;
171 m_log.DebugFormat ("Avatar Picks Request");
172 return false;
173 }
174
175 OSDMap request = (OSDMap)json["params"];
176 UUID creatorId = new UUID(request["creatorId"].AsString());
177
178
179 OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId);
180 response.Result = data;
181
182 return true;
183 }
184
185 public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response)
186 {
187 if(!json.ContainsKey("params"))
188 {
189 response.Error.Code = ErrorCode.ParseError;
190 response.Error.Message = "no parameters supplied";
191 m_log.DebugFormat ("Avatar Picks Info Request");
192 return false;
193 }
194
195 string result = string.Empty;
196 UserProfilePick pick = new UserProfilePick();
197 object Pick = (object)pick;
198 OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]);
199 if(Service.PickInfoRequest(ref pick, ref result))
200 {
201 response.Result = OSD.SerializeMembers(pick);
202 return true;
203 }
204
205 response.Error.Code = ErrorCode.InternalError;
206 response.Error.Message = string.Format("{0}", result);
207 return false;
208 }
209
210 public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response)
211 {
212 if(!json.ContainsKey("params"))
213 {
214 response.Error.Code = ErrorCode.ParseError;
215 response.Error.Message = "no parameters supplied";
216 m_log.DebugFormat ("Avatar Picks Update Request");
217 return false;
218 }
219
220 string result = string.Empty;
221 UserProfilePick pick = new UserProfilePick();
222 object Pick = (object)pick;
223 OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]);
224 if(Service.PicksUpdate(ref pick, ref result))
225 {
226 response.Result = OSD.SerializeMembers(pick);
227 return true;
228 }
229
230 response.Error.Code = ErrorCode.InternalError;
231 response.Error.Message = "unable to update pick";
232
233 return false;
234 }
235
236 public bool PicksDelete(OSDMap json, ref JsonRpcResponse response)
237 {
238 if(!json.ContainsKey("params"))
239 {
240 response.Error.Code = ErrorCode.ParseError;
241 m_log.DebugFormat ("Avatar Picks Delete Request");
242 return false;
243 }
244
245 OSDMap request = (OSDMap)json["params"];
246 UUID pickId = new UUID(request["pickId"].AsString());
247 if(Service.PicksDelete(pickId))
248 return true;
249
250 response.Error.Code = ErrorCode.InternalError;
251 response.Error.Message = "data error removing record";
252 return false;
253 }
254 #endregion Picks
255
256 #region Notes
257 public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response)
258 {
259 if(!json.ContainsKey("params"))
260 {
261 response.Error.Code = ErrorCode.ParseError;
262 response.Error.Message = "Params missing";
263 m_log.DebugFormat ("Avatar Notes Request");
264 return false;
265 }
266
267 string result = string.Empty;
268 UserProfileNotes note = new UserProfileNotes();
269 object Note = (object)note;
270 OSD.DeserializeMembers(ref Note, (OSDMap)json["params"]);
271 if(Service.AvatarNotesRequest(ref note))
272 {
273 response.Result = OSD.SerializeMembers(note);
274 return true;
275 }
276
277 object Notes = (object) note;
278 OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]);
279 return true;
280 }
281
282 public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response)
283 {
284 if(!json.ContainsKey("params"))
285 {
286 response.Error.Code = ErrorCode.ParseError;
287 response.Error.Message = "No parameters";
288 m_log.DebugFormat ("Avatar Notes Update Request");
289 return false;
290 }
291
292 string result = string.Empty;
293 UserProfileNotes note = new UserProfileNotes();
294 object Notes = (object) note;
295 OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]);
296 if(Service.NotesUpdate(ref note, ref result))
297 {
298 response.Result = OSD.SerializeMembers(note);
299 return true;
300 }
301 return true;
302 }
303 #endregion Notes
304
305 #region Profile Properties
306 public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response)
307 {
308 if(!json.ContainsKey("params"))
309 {
310 response.Error.Code = ErrorCode.ParseError;
311 response.Error.Message = "no parameters supplied";
312 m_log.DebugFormat ("Avatar Properties Request");
313 return false;
314 }
315
316 string result = string.Empty;
317 UserProfileProperties props = new UserProfileProperties();
318 object Props = (object)props;
319 OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
320 if(Service.AvatarPropertiesRequest(ref props, ref result))
321 {
322 response.Result = OSD.SerializeMembers(props);
323 return true;
324 }
325
326 response.Error.Code = ErrorCode.InternalError;
327 response.Error.Message = string.Format("{0}", result);
328 return false;
329 }
330
331 public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response)
332 {
333 if(!json.ContainsKey("params"))
334 {
335 response.Error.Code = ErrorCode.ParseError;
336 response.Error.Message = "no parameters supplied";
337 m_log.DebugFormat ("Avatar Properties Update Request");
338 return false;
339 }
340
341 string result = string.Empty;
342 UserProfileProperties props = new UserProfileProperties();
343 object Props = (object)props;
344 OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
345 if(Service.AvatarPropertiesUpdate(ref props, ref result))
346 {
347 response.Result = OSD.SerializeMembers(props);
348 return true;
349 }
350
351 response.Error.Code = ErrorCode.InternalError;
352 response.Error.Message = string.Format("{0}", result);
353 return false;
354 }
355 #endregion Profile Properties
356
357 #region Interests
358 public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response)
359 {
360 if(!json.ContainsKey("params"))
361 {
362 response.Error.Code = ErrorCode.ParseError;
363 response.Error.Message = "no parameters supplied";
364 m_log.DebugFormat ("Avatar Interests Update Request");
365 return false;
366 }
367
368 string result = string.Empty;
369 UserProfileProperties props = new UserProfileProperties();
370 object Props = (object)props;
371 OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
372 if(Service.AvatarInterestsUpdate(props, ref result))
373 {
374 response.Result = OSD.SerializeMembers(props);
375 return true;
376 }
377
378 response.Error.Code = ErrorCode.InternalError;
379 response.Error.Message = string.Format("{0}", result);
380 return false;
381 }
382 #endregion Interests
383
384 #region Utility
385 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
386 {
387 if(!json.ContainsKey("params"))
388 {
389 response.Error.Code = ErrorCode.ParseError;
390 m_log.DebugFormat ("Avatar Image Assets Request");
391 return false;
392 }
393
394 OSDMap request = (OSDMap)json["params"];
395 UUID avatarId = new UUID(request["avatarId"].AsString());
396
397 OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId);
398 response.Result = data;
399
400 return true;
401 }
402 #endregion Utiltiy
403
404 #region UserData
405 public bool RequestUserAppData(OSDMap json, ref JsonRpcResponse response)
406 {
407 if(!json.ContainsKey("params"))
408 {
409 response.Error.Code = ErrorCode.ParseError;
410 response.Error.Message = "no parameters supplied";
411 m_log.DebugFormat ("User Application Service URL Request: No Parameters!");
412 return false;
413 }
414
415 string result = string.Empty;
416 UserAppData props = new UserAppData();
417 object Props = (object)props;
418 OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
419 if(Service.RequestUserAppData(ref props, ref result))
420 {
421 OSDMap res = new OSDMap();
422 res["result"] = OSD.FromString("success");
423 res["token"] = OSD.FromString (result);
424 response.Result = res;
425
426 return true;
427 }
428
429 response.Error.Code = ErrorCode.InternalError;
430 response.Error.Message = string.Format("{0}", result);
431 return false;
432 }
433
434 public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response)
435 {
436 if(!json.ContainsKey("params"))
437 {
438 response.Error.Code = ErrorCode.ParseError;
439 response.Error.Message = "no parameters supplied";
440 m_log.DebugFormat ("User App Data Update Request");
441 return false;
442 }
443
444 string result = string.Empty;
445 UserAppData props = new UserAppData();
446 object Props = (object)props;
447 OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
448 if(Service.SetUserAppData(props, ref result))
449 {
450 response.Result = OSD.SerializeMembers(props);
451 return true;
452 }
453
454 response.Error.Code = ErrorCode.InternalError;
455 response.Error.Message = string.Format("{0}", result);
456 return false;
457 }
458 #endregion UserData
459 }
460}
461
diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
index 3295ffd..04cd798 100644
--- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.6.*")] 32[assembly: AssemblyVersion("0.8.0.*")]
33 33
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 0bd8269..964ccf8 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -27,11 +27,13 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Specialized;
30using System.IO; 31using System.IO;
31using System.IO.Compression; 32using System.IO.Compression;
32using System.Reflection; 33using System.Reflection;
33using System.Net; 34using System.Net;
34using System.Text; 35using System.Text;
36using System.Web;
35 37
36using OpenSim.Server.Base; 38using OpenSim.Server.Base;
37using OpenSim.Server.Handlers.Base; 39using OpenSim.Server.Handlers.Base;
@@ -90,19 +92,13 @@ namespace OpenSim.Server.Handlers.Simulation
90 92
91 // Next, let's parse the verb 93 // Next, let's parse the verb
92 string method = (string)request["http-method"]; 94 string method = (string)request["http-method"];
93 if (method.Equals("GET")) 95 if (method.Equals("DELETE"))
94 { 96 {
95 DoAgentGet(request, responsedata, agentID, regionID); 97 string auth_token = string.Empty;
96 return responsedata; 98 if (request.ContainsKey("auth"))
97 } 99 auth_token = request["auth"].ToString();
98 else if (method.Equals("DELETE")) 100
99 { 101 DoAgentDelete(request, responsedata, agentID, action, regionID, auth_token);
100 DoAgentDelete(request, responsedata, agentID, action, regionID);
101 return responsedata;
102 }
103 else if (method.Equals("DELETECHILD"))
104 {
105 DoChildAgentDelete(request, responsedata, agentID, action, regionID);
106 return responsedata; 102 return responsedata;
107 } 103 }
108 else if (method.Equals("QUERYACCESS")) 104 else if (method.Equals("QUERYACCESS"))
@@ -112,7 +108,7 @@ namespace OpenSim.Server.Handlers.Simulation
112 } 108 }
113 else 109 else
114 { 110 {
115 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); 111 m_log.ErrorFormat("[AGENT HANDLER]: method {0} not supported in agent message {1} (caller is {2})", method, (string)request["uri"], Util.GetCallerIP(request));
116 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; 112 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
117 responsedata["str_response_string"] = "Method not allowed"; 113 responsedata["str_response_string"] = "Method not allowed";
118 114
@@ -161,79 +157,12 @@ namespace OpenSim.Server.Handlers.Simulation
161// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); 157// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
162 } 158 }
163 159
164 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 160 protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID, string auth_token)
165 { 161 {
166 if (m_SimulationService == null) 162 if (string.IsNullOrEmpty(action))
167 { 163 m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE <<< RegionID: {0}; from: {1}; auth_code: {2}", regionID, Util.GetCallerIP(request), auth_token);
168 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
169 responsedata["content_type"] = "application/json";
170 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
171 responsedata["str_response_string"] = string.Empty;
172
173 return;
174 }
175
176 GridRegion destination = new GridRegion();
177 destination.RegionID = regionID;
178
179 IAgentData agent = null;
180 bool result = m_SimulationService.RetrieveAgent(destination, id, out agent);
181 OSDMap map = null;
182 if (result)
183 {
184 if (agent != null) // just to make sure
185 {
186 map = agent.Pack();
187 string strBuffer = "";
188 try
189 {
190 strBuffer = OSDParser.SerializeJsonString(map);
191 }
192 catch (Exception e)
193 {
194 m_log.WarnFormat("[AGENT HANDLER]: Exception thrown on serialization of DoAgentGet: {0}", e.Message);
195 responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
196 // ignore. buffer will be empty, caller should check.
197 }
198
199 responsedata["content_type"] = "application/json";
200 responsedata["int_response_code"] = HttpStatusCode.OK;
201 responsedata["str_response_string"] = strBuffer;
202 }
203 else
204 {
205 responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
206 responsedata["str_response_string"] = "Internal error";
207 }
208 }
209 else
210 {
211 responsedata["int_response_code"] = HttpStatusCode.NotFound;
212 responsedata["str_response_string"] = "Not Found";
213 }
214 }
215
216 protected void DoChildAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
217 {
218 m_log.Debug(" >>> DoChildAgentDelete action:" + action + "; RegionID:" + regionID);
219
220 GridRegion destination = new GridRegion();
221 destination.RegionID = regionID;
222
223 if (action.Equals("release"))
224 ReleaseAgent(regionID, id);
225 else 164 else
226 m_SimulationService.CloseChildAgent(destination, id); 165 m_log.DebugFormat("[AGENT HANDLER]: Release {0} to RegionID: {1}", id, regionID);
227
228 responsedata["int_response_code"] = HttpStatusCode.OK;
229 responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
230
231 m_log.Debug("[AGENT HANDLER]: Child Agent Released/Deleted.");
232 }
233
234 protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
235 {
236 m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID);
237 166
238 GridRegion destination = new GridRegion(); 167 GridRegion destination = new GridRegion();
239 destination.RegionID = regionID; 168 destination.RegionID = regionID;
@@ -241,12 +170,12 @@ namespace OpenSim.Server.Handlers.Simulation
241 if (action.Equals("release")) 170 if (action.Equals("release"))
242 ReleaseAgent(regionID, id); 171 ReleaseAgent(regionID, id);
243 else 172 else
244 m_SimulationService.CloseAgent(destination, id); 173 Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id, auth_token); });
245 174
246 responsedata["int_response_code"] = HttpStatusCode.OK; 175 responsedata["int_response_code"] = HttpStatusCode.OK;
247 responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); 176 responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
248 177
249 m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID); 178 //m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID);
250 } 179 }
251 180
252 protected virtual void ReleaseAgent(UUID regionID, UUID id) 181 protected virtual void ReleaseAgent(UUID regionID, UUID id)
@@ -274,7 +203,7 @@ namespace OpenSim.Server.Handlers.Simulation
274 m_SimulationService = null; 203 m_SimulationService = null;
275 } 204 }
276 205
277 public override byte[] Handle(string path, Stream request, 206 protected override byte[] ProcessRequest(string path, Stream request,
278 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 207 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
279 { 208 {
280// m_log.DebugFormat("[SIMULATION]: Stream handler called"); 209// m_log.DebugFormat("[SIMULATION]: Stream handler called");
@@ -351,31 +280,16 @@ namespace OpenSim.Server.Handlers.Simulation
351 return; 280 return;
352 } 281 }
353 282
354 // retrieve the input arguments 283 AgentDestinationData data = CreateAgentDestinationData();
355 int x = 0, y = 0; 284 UnpackData(args, data, request);
356 UUID uuid = UUID.Zero;
357 string regionname = string.Empty;
358 uint teleportFlags = 0;
359 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
360 Int32.TryParse(args["destination_x"].AsString(), out x);
361 else
362 m_log.WarnFormat(" -- request didn't have destination_x");
363 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
364 Int32.TryParse(args["destination_y"].AsString(), out y);
365 else
366 m_log.WarnFormat(" -- request didn't have destination_y");
367 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
368 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
369 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
370 regionname = args["destination_name"].ToString();
371 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null)
372 teleportFlags = args["teleport_flags"].AsUInteger();
373 285
374 GridRegion destination = new GridRegion(); 286 GridRegion destination = new GridRegion();
375 destination.RegionID = uuid; 287 destination.RegionID = data.uuid;
376 destination.RegionLocX = x; 288 destination.RegionLocX = data.x;
377 destination.RegionLocY = y; 289 destination.RegionLocY = data.y;
378 destination.RegionName = regionname; 290 destination.RegionName = data.name;
291
292 GridRegion gatekeeper = ExtractGatekeeper(data);
379 293
380 AgentCircuitData aCircuit = new AgentCircuitData(); 294 AgentCircuitData aCircuit = new AgentCircuitData();
381 try 295 try
@@ -396,7 +310,7 @@ namespace OpenSim.Server.Handlers.Simulation
396 // This is the meaning of POST agent 310 // This is the meaning of POST agent
397 //m_regionClient.AdjustUserInformation(aCircuit); 311 //m_regionClient.AdjustUserInformation(aCircuit);
398 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); 312 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
399 bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); 313 bool result = CreateAgent(gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason);
400 314
401 resp["reason"] = OSD.FromString(reason); 315 resp["reason"] = OSD.FromString(reason);
402 resp["success"] = OSD.FromBoolean(result); 316 resp["success"] = OSD.FromBoolean(result);
@@ -408,7 +322,36 @@ namespace OpenSim.Server.Handlers.Simulation
408 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); 322 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
409 } 323 }
410 324
411 private string GetCallerIP(Hashtable request) 325 protected virtual AgentDestinationData CreateAgentDestinationData()
326 {
327 return new AgentDestinationData();
328 }
329
330 protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request)
331 {
332 // retrieve the input arguments
333 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
334 Int32.TryParse(args["destination_x"].AsString(), out data.x);
335 else
336 m_log.WarnFormat(" -- request didn't have destination_x");
337 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
338 Int32.TryParse(args["destination_y"].AsString(), out data.y);
339 else
340 m_log.WarnFormat(" -- request didn't have destination_y");
341 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
342 UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid);
343 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
344 data.name = args["destination_name"].ToString();
345 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null)
346 data.flags = args["teleport_flags"].AsUInteger();
347 }
348
349 protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data)
350 {
351 return null;
352 }
353
354 protected string GetCallerIP(Hashtable request)
412 { 355 {
413 if (!m_Proxy) 356 if (!m_Proxy)
414 return Util.GetCallerIP(request); 357 return Util.GetCallerIP(request);
@@ -441,7 +384,7 @@ namespace OpenSim.Server.Handlers.Simulation
441 } 384 }
442 385
443 // subclasses can override this 386 // subclasses can override this
444 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 387 protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
445 { 388 {
446 reason = String.Empty; 389 reason = String.Empty;
447 390
@@ -474,7 +417,7 @@ namespace OpenSim.Server.Handlers.Simulation
474 m_SimulationService = null; 417 m_SimulationService = null;
475 } 418 }
476 419
477 public override byte[] Handle(string path, Stream request, 420 protected override byte[] ProcessRequest(string path, Stream request,
478 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 421 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
479 { 422 {
480// m_log.DebugFormat("[SIMULATION]: Stream handler called"); 423// m_log.DebugFormat("[SIMULATION]: Stream handler called");
@@ -593,7 +536,6 @@ namespace OpenSim.Server.Handlers.Simulation
593 //agent.Dump(); 536 //agent.Dump();
594 // This is one of the meanings of PUT agent 537 // This is one of the meanings of PUT agent
595 result = UpdateAgent(destination, agent); 538 result = UpdateAgent(destination, agent);
596
597 } 539 }
598 else if ("AgentPosition".Equals(messageType)) 540 else if ("AgentPosition".Equals(messageType))
599 { 541 {
@@ -624,4 +566,14 @@ namespace OpenSim.Server.Handlers.Simulation
624 return m_SimulationService.UpdateAgent(destination, agent); 566 return m_SimulationService.UpdateAgent(destination, agent);
625 } 567 }
626 } 568 }
569
570 public class AgentDestinationData
571 {
572 public int x;
573 public int y;
574 public string name;
575 public UUID uuid;
576 public uint flags;
577 public bool fromLogin;
578 }
627} 579}
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 72551ef..24c9de6 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
68 } 68 }
69 } 69 }
70 70
71 public override byte[] Handle(string path, Stream requestData, 71 protected override byte[] ProcessRequest(string path, Stream requestData,
72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
73 { 73 {
74 StreamReader sr = new StreamReader(requestData); 74 StreamReader sr = new StreamReader(requestData);