aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2008-08-25 07:35:17 +0000
committerTeravus Ovares2008-08-25 07:35:17 +0000
commit2912aafe259727351eb9405532e45aa3501b7e9a (patch)
tree34774a49306ae19a6682580d41927fcfb222ea6e /OpenSim
parentMantis#2043. Thank you kindly, Ralphos for a patch that addresses: (diff)
downloadopensim-SC_OLD-2912aafe259727351eb9405532e45aa3501b7e9a.zip
opensim-SC_OLD-2912aafe259727351eb9405532e45aa3501b7e9a.tar.gz
opensim-SC_OLD-2912aafe259727351eb9405532e45aa3501b7e9a.tar.bz2
opensim-SC_OLD-2912aafe259727351eb9405532e45aa3501b7e9a.tar.xz
* This commit incorporates the heart of the OpenGridProtocol patch that is currently on Forge in a nice, friendly modular format.
* There are a lot of changes and this is quite experimental. It's off by default, but you can turn it on by examining the bottom of the opensim.ini.example for the proper OpenSim.ini settings. Remember, you still need an agent domain.. * Furthermore, it isn't quite right when it comes to teleporting to remote regions (place_avatar)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/AgentCircuitManager.cs31
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs25
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs31
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs5
-rw-r--r--OpenSim/Framework/IClientAPI.cs6
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs168
-rw-r--r--OpenSim/Framework/Servers/LLSDMethod.cs3
-rw-r--r--OpenSim/Framework/Servers/LLSDMethodString.cs33
-rw-r--r--OpenSim/Grid/UserServer/Main.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/KillPacket.cs42
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs48
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs6
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs881
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs34
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs9
19 files changed, 1304 insertions, 37 deletions
diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs
index 426e8e2..80e2f87 100644
--- a/OpenSim/Framework/AgentCircuitManager.cs
+++ b/OpenSim/Framework/AgentCircuitManager.cs
@@ -103,10 +103,41 @@ namespace OpenSim.Framework
103 AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; 103 AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname;
104 AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; 104 AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname;
105 AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; 105 AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos;
106
107 // Updated for when we don't know them before calling Scene.NewUserConnection
108 AgentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID;
109 AgentCircuits[(uint) agentData.circuitcode].SessionID = agentData.SessionID;
110
106 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); 111 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
107 } 112 }
108 } 113 }
109 114
115
116 /// <summary>
117 /// Sometimes the circuitcode may not be known before setting up the connection
118 /// </summary>
119 /// <param name="circuitcode"></param>
120 /// <param name="newcircuitcode"></param>
121
122 public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode)
123 {
124 lock (AgentCircuits)
125 {
126 if (AgentCircuits.ContainsKey((uint)circuitcode) && !AgentCircuits.ContainsKey((uint)newcircuitcode))
127 {
128 AgentCircuitData agentData = AgentCircuits[(uint)circuitcode];
129
130 agentData.circuitcode = newcircuitcode;
131
132 AgentCircuits.Remove((uint)circuitcode);
133 AgentCircuits.Add(newcircuitcode, agentData);
134 return true;
135 }
136 }
137 return false;
138
139 }
140
110 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) 141 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
111 { 142 {
112 if (AgentCircuits.ContainsKey(circuitcode)) 143 if (AgentCircuits.ContainsKey(circuitcode))
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 4e3840b..3b02c88 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -160,6 +160,31 @@ namespace OpenSim.Framework.Communications.Cache
160 } 160 }
161 161
162 /// <summary> 162 /// <summary>
163 /// Preloads User data into the region cache. Modules may use this service to add non-standard clients
164 /// </summary>
165 /// <param name="userID"></param>
166 /// <param name="userData"></param>
167 public void PreloadUserCache(LLUUID userID, UserProfileData userData)
168 {
169 if (userID == LLUUID.Zero)
170 return;
171
172 lock (m_userProfiles)
173 {
174 if (m_userProfiles.ContainsKey(userID))
175 {
176 return;
177 }
178 else
179 {
180
181 CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userData);
182 m_userProfiles.Add(userID, userInfo);
183 }
184 }
185 }
186
187 /// <summary>
163 /// Handle an inventory folder creation request from the client. 188 /// Handle an inventory folder creation request from the client.
164 /// </summary> 189 /// </summary>
165 /// <param name="remoteClient"></param> 190 /// <param name="remoteClient"></param>
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs
new file mode 100644
index 0000000..31325d8
--- /dev/null
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs
@@ -0,0 +1,31 @@
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 OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Communications.Capabilities
29{
30 public delegate TResponse LLSDMethodString<TRequest, TResponse>(TRequest request, string path);
31}
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index fd02382..a35ed72 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -339,6 +339,11 @@ namespace OpenSim.Framework.Communications
339 public void ClearUserAgent(LLUUID agentID) 339 public void ClearUserAgent(LLUUID agentID)
340 { 340 {
341 UserProfileData profile = GetUserProfile(agentID); 341 UserProfileData profile = GetUserProfile(agentID);
342
343 if (profile == null)
344 {
345 return;
346 }
342 profile.CurrentAgent = null; 347 profile.CurrentAgent = null;
343 348
344 UpdateUserProfile(profile); 349 UpdateUserProfile(profile);
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index b2d13c7..f437902 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -349,6 +349,11 @@ namespace OpenSim.Framework
349 set; 349 set;
350 } 350 }
351 351
352 bool SendLogoutPacketWhenClosing
353 {
354 set;
355 }
356
352 // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")] 357 // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")]
353 uint CircuitCode { get; } 358 uint CircuitCode { get; }
354 // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] 359 // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")]
@@ -741,5 +746,6 @@ namespace OpenSim.Framework
741 746
742 void SendRegionHandle(LLUUID regoinID, ulong handle); 747 void SendRegionHandle(LLUUID regoinID, ulong handle);
743 void SendParcelInfo(RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y); 748 void SendParcelInfo(RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y);
749 void KillEndDone();
744 } 750 }
745} 751}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 23c28e6..7b2b599 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -47,8 +47,9 @@ namespace OpenSim.Framework.Servers
47 47
48 protected Thread m_workerThread; 48 protected Thread m_workerThread;
49 protected HttpListener m_httpListener; 49 protected HttpListener m_httpListener;
50 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); 50 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
51 protected LLSDMethod m_llsdHandler = null; 51 protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/
52 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
52 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); 53 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
53 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); 54 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
54 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); 55 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
@@ -148,9 +149,28 @@ namespace OpenSim.Framework.Servers
148 return false; 149 return false;
149 } 150 }
150 151
151 public bool SetLLSDHandler(LLSDMethod handler) 152 /// <summary>
153 /// Adds a LLSD handler, yay.
154 /// </summary>
155 /// <param name="path">/resource/ path</param>
156 /// <param name="handler">handle the LLSD response</param>
157 /// <returns></returns>
158 public bool AddLLSDHandler(string path, LLSDMethod handler)
152 { 159 {
153 m_llsdHandler = handler; 160 lock (m_llsdHandlers)
161 {
162 if (!m_llsdHandlers.ContainsKey(path))
163 {
164 m_llsdHandlers.Add(path, handler);
165 return true;
166 }
167 }
168 return false;
169 }
170
171 public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler)
172 {
173 m_defaultLlsdHandler = handler;
154 return true; 174 return true;
155 } 175 }
156 176
@@ -239,20 +259,21 @@ namespace OpenSim.Framework.Servers
239 259
240 switch (request.ContentType) 260 switch (request.ContentType)
241 { 261 {
242 case null: 262 case null:
243 case "text/html": 263 case "text/html":
244 HandleHTTPRequest(request, response); 264 HandleHTTPRequest(request, response);
245 return; 265 return;
246 266
247 case "application/xml+llsd": 267 case "application/llsd+xml":
248 HandleLLSDRequests(request, response); 268 case "application/xml+llsd":
249 return; 269 HandleLLSDRequests(request, response);
270 return;
250 271
251 case "text/xml": 272 case "text/xml":
252 case "application/xml": 273 case "application/xml":
253 default: 274 default:
254 HandleXmlRpcRequests(request, response); 275 HandleXmlRpcRequests(request, response);
255 return; 276 return;
256 } 277 }
257 } 278 }
258 catch (SocketException e) 279 catch (SocketException e)
@@ -456,17 +477,37 @@ namespace OpenSim.Framework.Servers
456 m_log.Warn("[HTTPD]: Error - " + ex.Message); 477 m_log.Warn("[HTTPD]: Error - " + ex.Message);
457 } 478 }
458 479
459 if (llsdRequest != null && m_llsdHandler != null) 480 if (llsdRequest != null)// && m_defaultLlsdHandler != null)
460 { 481 {
461 llsdResponse = m_llsdHandler(llsdRequest); 482
483 LLSDMethod llsdhandler = null;
484
485 if (TryGetLLSDHandler(request.RawUrl, out llsdhandler))
486 {
487 // we found a registered llsd handler to service this request
488 llsdResponse = llsdhandler(request.RawUrl, llsdRequest, request.RemoteIPEndPoint.ToString());
489 }
490 else
491 {
492 // we didn't find a registered llsd handler to service this request
493 // check if we have a default llsd handler
494
495 if (m_defaultLlsdHandler != null)
496 {
497 // LibOMV path
498 llsdResponse = m_defaultLlsdHandler(llsdRequest);
499 }
500 else
501 {
502 // Oops, no handler for this.. give em the failed message
503 llsdResponse = GenerateNoLLSDHandlerResponse();
504 }
505 }
506
462 } 507 }
463 else 508 else
464 { 509 {
465 LLSDMap map = new LLSDMap(); 510 llsdResponse = GenerateNoLLSDHandlerResponse();
466 map["reason"] = LLSD.FromString("LLSDRequest");
467 map["message"] = LLSD.FromString("No handler registered for LLSD Requests");
468 map["login"] = LLSD.FromString("false");
469 llsdResponse = map;
470 } 511 }
471 512
472 response.ContentType = "application/xml+llsd"; 513 response.ContentType = "application/xml+llsd";
@@ -491,6 +532,68 @@ namespace OpenSim.Framework.Servers
491 } 532 }
492 } 533 }
493 534
535 private bool TryGetLLSDHandler(string path, out LLSDMethod llsdHandler)
536 {
537 llsdHandler = null;
538 // Pull out the first part of the path
539 // splitting the path by '/' means we'll get the following return..
540 // {0}/{1}/{2}
541 // where {0} isn't something we really control 100%
542
543 string[] pathbase = path.Split('/');
544 string searchquery = "/";
545
546 if (pathbase.Length < 1)
547 return false;
548
549 for (int i=1; i<pathbase.Length; i++)
550 {
551 searchquery += pathbase[i];
552 if (pathbase.Length-1 != i)
553 searchquery += "/";
554 }
555
556 // while the matching algorithm below doesn't require it, we're expecting a query in the form
557 //
558 // [] = optional
559 // /resource/UUID/action[/action]
560 //
561 // now try to get the closest match to the reigstered path
562 // at least for OGP, registered path would probably only consist of the /resource/
563
564 string bestMatch = null;
565
566 foreach (string pattern in m_llsdHandlers.Keys)
567 {
568 if (searchquery.StartsWith(searchquery))
569 {
570 if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
571 {
572 bestMatch = pattern;
573 }
574 }
575 }
576
577 if (String.IsNullOrEmpty(bestMatch))
578 {
579 llsdHandler = null;
580 return false;
581 }
582 else
583 {
584 llsdHandler = m_llsdHandlers[bestMatch];
585 return true;
586 }
587 }
588
589 private LLSDMap GenerateNoLLSDHandlerResponse()
590 {
591 LLSDMap map = new LLSDMap();
592 map["reason"] = LLSD.FromString("LLSDRequest");
593 map["message"] = LLSD.FromString("No handler registered for LLSD Requests");
594 map["login"] = LLSD.FromString("false");
595 return map;
596 }
494 /// <summary> 597 /// <summary>
495 /// A specific agent handler was provided. Such a handler is expecetd to have an 598 /// A specific agent handler was provided. Such a handler is expecetd to have an
496 /// intimate, and highly specific relationship with the client. Consequently, 599 /// intimate, and highly specific relationship with the client. Consequently,
@@ -809,6 +912,25 @@ namespace OpenSim.Framework.Servers
809 912
810 return false; 913 return false;
811 } 914 }
915 public bool RemoveLLSDHandler(string path, LLSDMethod handler)
916 {
917
918 try
919 {
920 if (handler == m_llsdHandlers[path])
921 {
922 m_llsdHandlers.Remove(path);
923 return true;
924 }
925 }
926 catch (KeyNotFoundException)
927 {
928 // This is an exception to prevent crashing because of invalid code
929 }
930
931 return false;
932 }
933
812 934
813 public string GetHTTP404(string host) 935 public string GetHTTP404(string host)
814 { 936 {
diff --git a/OpenSim/Framework/Servers/LLSDMethod.cs b/OpenSim/Framework/Servers/LLSDMethod.cs
index 05c23b0..7bb946e 100644
--- a/OpenSim/Framework/Servers/LLSDMethod.cs
+++ b/OpenSim/Framework/Servers/LLSDMethod.cs
@@ -29,5 +29,6 @@ using libsecondlife.StructuredData;
29 29
30namespace OpenSim.Framework.Servers 30namespace OpenSim.Framework.Servers
31{ 31{
32 public delegate LLSD LLSDMethod(LLSD request); 32 public delegate LLSD LLSDMethod( string path, LLSD request, string endpoint );
33 public delegate LLSD DefaultLLSDMethod(LLSD request);
33} 34}
diff --git a/OpenSim/Framework/Servers/LLSDMethodString.cs b/OpenSim/Framework/Servers/LLSDMethodString.cs
new file mode 100644
index 0000000..8d20b69
--- /dev/null
+++ b/OpenSim/Framework/Servers/LLSDMethodString.cs
@@ -0,0 +1,33 @@
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 OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using libsecondlife.StructuredData;
29
30namespace OpenSim.Framework.Servers
31{
32 public delegate LLSD LLSDMethodString(LLSD request, string thePath);
33}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 9a3e431..20d0cbf 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Grid.UserServer
128 128
129 if (Cfg.EnableLLSDLogin) 129 if (Cfg.EnableLLSDLogin)
130 { 130 {
131 m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); 131 m_httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
132 } 132 }
133 133
134 m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); 134 m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 0dd037d..78064da 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -384,7 +384,7 @@ namespace OpenSim
384 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); 384 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
385 385
386 // Provides the LLSD login 386 // Provides the LLSD login
387 m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); 387 m_httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
388 388
389 // provide grid info 389 // provide grid info
390 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); 390 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini")));
diff --git a/OpenSim/Region/ClientStack/LindenUDP/KillPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/KillPacket.cs
new file mode 100644
index 0000000..dfdabc8
--- /dev/null
+++ b/OpenSim/Region/ClientStack/LindenUDP/KillPacket.cs
@@ -0,0 +1,42 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife.Packets;
5
6namespace OpenSim.Region.ClientStack.LindenUDP
7{
8 class KillPacket : Packet
9 {
10 private Header header;
11 public override void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)
12 {
13
14 }
15
16 public override void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)
17 {
18
19 }
20
21 public override Header Header { get { return header; } set { header = value; }}
22
23 public override byte[] ToBytes()
24 {
25 return new byte[0];
26 }
27 public KillPacket()
28 {
29 Header = new LowHeader();
30 Header.ID = 65531;
31 Header.Reliable = true;
32 }
33
34 public override PacketType Type
35 {
36 get
37 {
38 return PacketType.UseCircuitCode;
39 }
40 }
41 }
42}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 7c531f3..8214045 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -92,6 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
92 92
93 private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>(); 93 private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>();
94 94
95 private bool m_SendLogoutPacketWhenClosing = true;
96
95 /* protected variables */ 97 /* protected variables */
96 98
97 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = 99 protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
@@ -368,6 +370,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
368 set { m_IsActive = value; } 370 set { m_IsActive = value; }
369 } 371 }
370 372
373 public bool SendLogoutPacketWhenClosing
374 {
375 set { m_SendLogoutPacketWhenClosing = value; }
376 }
377
371 /* METHODS */ 378 /* METHODS */
372 379
373 public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer, 380 public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
@@ -451,7 +458,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
451 if (!(shutdownCircuit)) 458 if (!(shutdownCircuit))
452 { 459 {
453 GC.Collect(); 460 GC.Collect();
454 m_clientThread.Abort(); 461
462 // Sends a KillPacket object, with which, the
463 // blockingqueue dequeues and sees it's a killpacket
464 // and terminates within the context of the client thread.
465 // This ensures that it's done from within the context
466 // of the client thread regardless of where Close() is called.
467 KillEndDone();
455 } 468 }
456 } 469 }
457 470
@@ -752,7 +765,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
752 ClientLoop(); 765 ClientLoop();
753 } 766 }
754 } 767 }
755 catch (Exception e) 768 catch (System.Exception e)
756 { 769 {
757 if (e is ThreadAbortException) 770 if (e is ThreadAbortException)
758 throw e; 771 throw e;
@@ -3740,6 +3753,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3740 m_PacketHandler.InPacket((Packet) NewPack); 3753 m_PacketHandler.InPacket((Packet) NewPack);
3741 } 3754 }
3742 3755
3756
3743 /// <summary> 3757 /// <summary>
3744 /// The dreaded OutPacket. This should only be called from within 3758 /// The dreaded OutPacket. This should only be called from within
3745 /// the ClientStack itself right now 3759 /// the ClientStack itself right now
@@ -6093,15 +6107,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6093 6107
6094 public void SendLogoutPacket() 6108 public void SendLogoutPacket()
6095 { 6109 {
6096 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply); 6110 // I know this is a bit of a hack, however there are times when you don't
6097 // TODO: don't create new blocks if recycling an old packet 6111 // want to send this, but still need to do the rest of the shutdown process
6098 logReply.AgentData.AgentID = AgentId; 6112 // this method gets called from the packet server.. which makes it practically
6099 logReply.AgentData.SessionID = SessionId; 6113 // impossible to do any other way.
6100 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
6101 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
6102 logReply.InventoryData[0].ItemID = LLUUID.Zero;
6103 6114
6104 OutPacket(logReply, ThrottleOutPacketType.Task); 6115 if (m_SendLogoutPacketWhenClosing)
6116 {
6117 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
6118 // TODO: don't create new blocks if recycling an old packet
6119 logReply.AgentData.AgentID = AgentId;
6120 logReply.AgentData.SessionID = SessionId;
6121 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
6122 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
6123 logReply.InventoryData[0].ItemID = LLUUID.Zero;
6124
6125 OutPacket(logReply, ThrottleOutPacketType.Task);
6126 }
6105 } 6127 }
6106 6128
6107 public void SendHealth(float health) 6129 public void SendHealth(float health)
@@ -6443,5 +6465,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6443 6465
6444 OutPacket(reply, ThrottleOutPacketType.Land); 6466 OutPacket(reply, ThrottleOutPacketType.Land);
6445 } 6467 }
6468
6469 public void KillEndDone()
6470 {
6471 KillPacket kp = new KillPacket();
6472 OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
6473 }
6446 } 6474 }
6447} 6475}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index 209ec36..830074a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Net.Sockets; 32using System.Net.Sockets;
33using System.Threading;
33using System.Timers; 34using System.Timers;
34using System.Reflection; 35using System.Reflection;
35using libsecondlife; 36using libsecondlife;
@@ -233,6 +234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
233 // to. Packet drop notifies will not be triggered in this 234 // to. Packet drop notifies will not be triggered in this
234 // configuration! 235 // configuration!
235 // 236 //
237
236 if ((m_SynchronizeClient != null) && (!m_Client.IsActive)) 238 if ((m_SynchronizeClient != null) && (!m_Client.IsActive))
237 { 239 {
238 if (m_SynchronizeClient(m_Client.Scene, packet, 240 if (m_SynchronizeClient(m_Client.Scene, packet,
@@ -744,6 +746,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
744 } 746 }
745 } 747 }
746 748
749 // If we sent a killpacket
750 if (packet is KillPacket)
751 Thread.CurrentThread.Abort();
752
747 // Actually make the byte array and send it 753 // Actually make the byte array and send it
748 byte[] sendbuffer = packet.ToBytes(); 754 byte[] sendbuffer = packet.ToBytes();
749 755
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index a2e1e0c..a2c3c2c 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local
107 // connectivity errors. 107 // connectivity errors.
108 // Don't change this line below to 'm_regions[regionInfo.RegionHandle] = regionInfo' unless you 108 // Don't change this line below to 'm_regions[regionInfo.RegionHandle] = regionInfo' unless you
109 // *REALLY* know what you are doing here. 109 // *REALLY* know what you are doing here.
110 m_regions.Remove(regionInfo.RegionHandle); 110 m_regions[regionInfo.RegionHandle] = regionInfo;
111 111
112 m_log.Warn("[INTERREGION STANDALONE]: Region registered twice. Region went down and came back up."); 112 m_log.Warn("[INTERREGION STANDALONE]: Region registered twice. Region went down and came back up.");
113 113
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 4f60462..6e7ace5 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -49,6 +49,9 @@ namespace OpenSim.Region.Communications.Local
49 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); 49 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
50 50
51 List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID); 51 List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID);
52 if (skeletonFolders == null)
53 return;
54
52 InventoryFolderImpl rootFolder = null; 55 InventoryFolderImpl rootFolder = null;
53 56
54 List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); 57 List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
new file mode 100644
index 0000000..f6f0e8f
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -0,0 +1,881 @@
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 OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using System.IO;
31using System.Net;
32using System.Net.Security;
33using System.Net.Sockets;
34using System.Reflection;
35using System.Text.RegularExpressions;
36using System.Threading;
37
38using libsecondlife;
39using libsecondlife.StructuredData;
40
41using log4net;
42using Nini.Config;
43using Nwc.XmlRpc;
44
45using OpenSim.Framework;
46using OpenSim.Region.Environment.Interfaces;
47using OpenSim.Region.Environment.Scenes;
48using OpenSim.Framework.Communications.Cache;
49using OpenSim.Framework.Communications.Capabilities;
50using OpenSim.Framework.Statistics;
51using LLSD = libsecondlife.StructuredData.LLSD;
52using LLSDMap = libsecondlife.StructuredData.LLSDMap;
53using LLSDArray = libsecondlife.StructuredData.LLSDArray;
54
55namespace OpenSim.Region.Environment.Modules.InterGrid
56{
57 public struct OGPState
58 {
59 public string first_name;
60 public string last_name;
61 public LLUUID agent_id;
62 public LLUUID local_agent_id;
63 public LLUUID region_id;
64 public uint circuit_code;
65 public LLUUID secure_session_id;
66 public LLUUID session_id;
67 public bool agent_access;
68 public string sim_access;
69 public uint god_level;
70 public bool god_overide;
71 public bool identified;
72 public bool transacted;
73 public bool age_verified;
74 public bool allow_redirect;
75 public int limited_to_estate;
76 public string inventory_host;
77 public bool src_can_see_mainland;
78 public int src_estate_id;
79 }
80
81
82 public class OpenGridProtocolModule : IRegionModule
83 {
84 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
85 private List<Scene> m_scene = new List<Scene>();
86
87 private Dictionary<string, AgentCircuitData> CapsLoginID = new Dictionary<string, AgentCircuitData>();
88 private Dictionary<LLUUID, OGPState> m_OGPState = new Dictionary<LLUUID, OGPState>();
89
90
91
92 #region IRegionModule Members
93
94 public void Initialise(Scene scene, IConfigSource config)
95 {
96 bool enabled = false;
97 IConfig cfg = null;
98 try
99 {
100 cfg = config.Configs["OpenGridProtocol"];
101 } catch (NullReferenceException)
102 {
103 enabled = false;
104 }
105 if (cfg != null)
106 {
107 enabled = cfg.GetBoolean("ogp_enabled", false);
108 if (enabled)
109 {
110 m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/");
111 lock (m_scene)
112 {
113 if (m_scene.Count == 0)
114 {
115 scene.AddLLSDHandler("/agent/", ProcessAgentDomainMessage);
116 }
117
118 if (!m_scene.Contains(scene))
119 m_scene.Add(scene);
120 }
121 }
122 }
123 // Of interest to this module potentially
124 //scene.EventManager.OnNewClient += OnNewClient;
125 //scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
126 //scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
127 //scene.EventManager.OnMakeChildAgent += MakeChildAgent;
128 //scene.EventManager.OnClientClosed += ClientLoggedOut;
129 }
130
131 public void PostInitialise()
132 {
133 }
134
135 public void Close()
136 {
137 }
138
139 public string Name
140 {
141 get { return "OpenGridProtocolModule"; }
142 }
143
144 public bool IsSharedModule
145 {
146 get { return true; }
147 }
148
149 #endregion
150
151 public LLSD ProcessAgentDomainMessage(string path, LLSD request, string endpoint)
152 {
153 // /agent/*
154
155 string[] pathSegments = path.Split('/');
156 if (pathSegments.Length < 1)
157 {
158 return GenerateNoHandlerMessage();
159 }
160
161 m_log.InfoFormat("[OGP]: path {0}, segments {1} segment[1] {2} Last segment {3}",
162 path, pathSegments.Length, pathSegments[1], pathSegments[pathSegments.Length - 1]);
163
164 switch (pathSegments[pathSegments.Length - 1])
165 {
166 case "rez_avatar":
167 return RezAvatarMethod(path, request);
168 //break;
169 case "derez_avatar":
170 return DerezAvatarMethod(path, request);
171 //break;
172
173 }
174 if (path.Length < 2)
175 {
176 return GenerateNoHandlerMessage();
177 }
178
179 switch (pathSegments[pathSegments.Length - 2] + "/" + pathSegments[pathSegments.Length - 1])
180 {
181 case "rez_avatar/rez":
182 return RezAvatarMethod(path, request);
183 //break;
184 case "rez_avatar/request":
185 return RequestRezAvatarMethod(path, request);
186 //break;
187 default:
188 return GenerateNoHandlerMessage();
189 }
190 //return null;
191 }
192
193 public LLSD RequestRezAvatarMethod(string path, LLSD request)
194 {
195 m_log.WarnFormat("[REQUESTREZAVATAR]: {0}", request.ToString());
196
197 LLSDMap requestMap = (LLSDMap)request;
198
199 Scene homeScene = GetRootScene();
200
201
202
203 if (homeScene == null)
204 return GenerateNoHandlerMessage();
205
206
207 RegionInfo reg = homeScene.RegionInfo;
208 ulong regionhandle = GetOSCompatibleRegionHandle(reg);
209 string RegionURI = reg.ServerURI;
210 int RegionPort = (int)reg.HttpPort;
211
212 LLUUID RemoteAgentID = requestMap["agent_id"].AsUUID();
213
214 // will be used in the future. The client always connects with the aditi agentid currently
215 LLUUID LocalAgentID = RemoteAgentID;
216
217 string FirstName = requestMap["first_name"].AsString();
218 string LastName = requestMap["last_name"].AsString();
219
220
221 OGPState userState = GetOGPState(LocalAgentID);
222
223 userState.first_name = requestMap["first_name"].AsString();
224 userState.last_name = requestMap["last_name"].AsString();
225 userState.age_verified = requestMap["age_verified"].AsBoolean();
226 userState.transacted = requestMap["transacted"].AsBoolean();
227 userState.agent_access = requestMap["agent_access"].AsBoolean();
228 userState.allow_redirect = requestMap["allow_redirect"].AsBoolean();
229 userState.identified = requestMap["identified"].AsBoolean();
230 userState.god_level = (uint)requestMap["god_level"].AsInteger();
231 userState.sim_access = requestMap["sim_access"].AsString();
232 userState.agent_id = RemoteAgentID;
233 userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger();
234 userState.src_can_see_mainland = requestMap["src_can_see_mainland"].AsBoolean();
235 userState.src_estate_id = requestMap["src_estate_id"].AsInteger();
236 userState.local_agent_id = LocalAgentID;
237
238 UpdateOGPState(LocalAgentID, userState);
239
240 LLSDMap responseMap = new LLSDMap();
241 responseMap["sim_host"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());
242 responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());
243 responseMap["connect"] = LLSD.FromBoolean(true);
244 responseMap["sim_port"] = LLSD.FromInteger(reg.InternalEndPoint.Port);
245 responseMap["region_x"] = LLSD.FromInteger(reg.RegionLocX * (uint)Constants.RegionSize); // LLX
246 responseMap["region_Y"] = LLSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY
247 responseMap["region_id"] = LLSD.FromUUID(reg.originRegionID);
248 responseMap["sim_access"] = LLSD.FromString((reg.RegionSettings.Maturity == 1) ? "Mature" : "PG");
249
250 // Generate a dummy agent for the user so we can get back a CAPS path
251 AgentCircuitData agentData = new AgentCircuitData();
252 agentData.AgentID = LocalAgentID;
253 agentData.BaseFolder=LLUUID.Zero;
254 agentData.CapsPath=Util.GetRandomCapsPath();
255 agentData.child = false;
256 agentData.circuitcode = (uint)(Util.RandomClass.Next());
257 agentData.firstname = FirstName;
258 agentData.lastname = LastName;
259 agentData.SecureSessionID=LLUUID.Random();
260 agentData.SessionID=LLUUID.Random();
261 agentData.startpos=LLVector3.Zero;
262
263 // Pre-Fill our region cache with information on the agent.
264 UserAgentData useragent = new UserAgentData();
265 useragent.AgentIP="unknown";
266 useragent.AgentOnline=true;
267 useragent.AgentPort = (uint)0;
268 useragent.Handle = regionhandle;
269 useragent.InitialRegion = reg.originRegionID;
270 useragent.LoginTime=Util.UnixTimeSinceEpoch();
271 useragent.LogoutTime = 0;
272 useragent.Position=agentData.startpos;
273 useragent.PositionX=agentData.startpos.X;
274 useragent.PositionY=agentData.startpos.Y;
275 useragent.PositionZ=agentData.startpos.Z;
276 useragent.Region=reg.originRegionID;
277 useragent.SecureSessionID=agentData.SecureSessionID;
278 useragent.SessionID = agentData.SessionID;
279
280
281 UserProfileData userProfile = new UserProfileData();
282 userProfile.AboutText = "OGP User";
283 userProfile.CanDoMask = (uint)0;
284 userProfile.Created = Util.UnixTimeSinceEpoch();
285 userProfile.CurrentAgent = useragent;
286 userProfile.CustomType = "OGP";
287 userProfile.FirstLifeAboutText = "I'm testing OpenGrid Protocol";
288 userProfile.FirstLifeImage = LLUUID.Zero;
289 userProfile.FirstName = agentData.firstname;
290 userProfile.GodLevel = 0;
291 userProfile.HomeLocation = agentData.startpos;
292 userProfile.HomeLocationX = agentData.startpos.X;
293 userProfile.HomeLocationY = agentData.startpos.Y;
294 userProfile.HomeLocationZ = agentData.startpos.Z;
295 userProfile.HomeLookAt = LLVector3.Zero;
296 userProfile.HomeLookAtX = userProfile.HomeLookAt.X;
297 userProfile.HomeLookAtY = userProfile.HomeLookAt.Y;
298 userProfile.HomeLookAtZ = userProfile.HomeLookAt.Z;
299 userProfile.HomeRegion = reg.RegionHandle;
300 userProfile.HomeRegionID = reg.originRegionID;
301 userProfile.HomeRegionX = reg.RegionLocX;
302 userProfile.HomeRegionY = reg.RegionLocY;
303 userProfile.ID = agentData.AgentID;
304 userProfile.Image = LLUUID.Zero;
305 userProfile.LastLogin = Util.UnixTimeSinceEpoch();
306 userProfile.Partner = LLUUID.Zero;
307 userProfile.PasswordHash = "$1$";
308 userProfile.PasswordSalt = "";
309 userProfile.RootInventoryFolderID = LLUUID.Zero;
310 userProfile.SurName = agentData.lastname;
311 userProfile.UserAssetURI = homeScene.CommsManager.NetworkServersInfo.AssetURL;
312 userProfile.UserFlags = 0;
313 userProfile.UserInventoryURI = homeScene.CommsManager.NetworkServersInfo.InventoryURL;
314 userProfile.WantDoMask = 0;
315 userProfile.WebLoginKey = LLUUID.Random();
316
317 // Do caps registration
318 // get seed cap
319
320
321 // Stick our data in the cache so the region will know something about us
322 homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile);
323
324 // Call 'new user' event handler
325 homeScene.NewUserConnection(reg.RegionHandle, agentData);
326
327
328 string raCap = string.Empty;
329
330 LLUUID AvatarRezCapUUID = LLUUID.Random();
331 string rezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar";
332
333 // Get a reference to the user's cap so we can pull out the Caps Object Path
334 OpenSim.Framework.Communications.Capabilities.Caps userCap = homeScene.GetCapsHandlerForUser(agentData.AgentID);
335
336 responseMap["seed_capability"] = LLSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/");
337
338 responseMap["rez_avatar/rez"] = LLSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + rezAvatarPath);
339
340 // Add the user to the list of CAPS that are outstanding.
341 // well allow the caps hosts in this dictionary
342 lock (CapsLoginID)
343 {
344 if (CapsLoginID.ContainsKey(rezAvatarPath))
345 {
346 m_log.Error("[OGP]: Holy anomoly batman! Caps path already existed! All the UUID Duplication worries were founded!");
347 }
348 else
349 {
350 CapsLoginID.Add(rezAvatarPath, agentData);
351 }
352 }
353
354 return responseMap;
355 }
356
357 public LLSD RezAvatarMethod(string path, LLSD request)
358 {
359 m_log.WarnFormat("[REZAVATAR]: {0}", request.ToString());
360
361 LLSDMap responseMap = new LLSDMap();
362
363 AgentCircuitData userData = null;
364
365 // Only people we've issued a cap can go further
366 if (TryGetAgentCircuitData(path,out userData))
367 {
368 LLSDMap requestMap = (LLSDMap)request;
369
370 // take these values to start. There's a few more
371 LLUUID SecureSessionID=requestMap["secure_session_id"].AsUUID();
372 LLUUID SessionID = requestMap["session_id"].AsUUID();
373 int circuitcode = requestMap["circuit_code"].AsInteger();
374
375 //Update our Circuit data with the real values
376 userData.SecureSessionID = SecureSessionID;
377 userData.SessionID = SessionID;
378
379 // Locate a home scene suitable for the user.
380 Scene homeScene = GetRootScene();
381
382 if (homeScene != null)
383 {
384 // Get a reference to their Cap object so we can pull out the capobjectroot
385 OpenSim.Framework.Communications.Capabilities.Caps userCap =
386 homeScene.GetCapsHandlerForUser(userData.AgentID);
387
388 //Update the circuit data in the region so this user is authorized
389 homeScene.UpdateCircuitData(userData);
390 homeScene.ChangeCircuitCode(userData.circuitcode,(uint)circuitcode);
391
392 // Load state
393 OGPState userState = GetOGPState(userData.AgentID);
394
395 // Keep state changes
396 userState.first_name = requestMap["first_name"].AsString();
397 userState.secure_session_id = requestMap["secure_session_id"].AsUUID();
398 userState.age_verified = requestMap["age_verified"].AsBoolean();
399 userState.region_id = homeScene.RegionInfo.originRegionID; // replace 0000000 with our regionid
400 userState.transacted = requestMap["transacted"].AsBoolean();
401 userState.agent_access = requestMap["agent_access"].AsBoolean();
402 userState.inventory_host = requestMap["inventory_host"].AsString();
403 userState.identified = requestMap["identified"].AsBoolean();
404 userState.session_id = requestMap["session_id"].AsUUID();
405 userState.god_level = (uint)requestMap["god_level"].AsInteger();
406 userState.last_name = requestMap["last_name"].AsString();
407 userState.god_overide = requestMap["god_override"].AsBoolean();
408 userState.circuit_code = (uint)requestMap["circuit_code"].AsInteger();
409 userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger();
410
411 // Save state changes
412 UpdateOGPState(userData.AgentID, userState);
413
414 // Get the region information for the home region.
415 RegionInfo reg = homeScene.RegionInfo;
416
417 // Dummy positional and look at info.. we don't have it.
418 LLSDArray PositionArray = new LLSDArray();
419 PositionArray.Add(LLSD.FromInteger(128));
420 PositionArray.Add(LLSD.FromInteger(128));
421 PositionArray.Add(LLSD.FromInteger(40));
422
423 LLSDArray LookAtArray = new LLSDArray();
424 LookAtArray.Add(LLSD.FromInteger(1));
425 LookAtArray.Add(LLSD.FromInteger(1));
426 LookAtArray.Add(LLSD.FromInteger(1));
427
428 // Our region's X and Y position in OpenSimulator space.
429 uint fooX = reg.RegionLocX;
430 uint fooY = reg.RegionLocY;
431 m_log.InfoFormat("[OGP]: region x({0}) region y({1})", fooX, fooY);
432 m_log.InfoFormat("[OGP]: region http {0} {1}", reg.ServerURI, reg.HttpPort);
433 m_log.InfoFormat("[OGO]: region UUID {0} ", reg.RegionID);
434
435 // Convert the X and Y position to LL space
436 responseMap["region_x"] = LLSD.FromInteger(fooX * (uint)Constants.RegionSize); // convert it to LL X
437 responseMap["region_y"] = LLSD.FromInteger(fooY * (uint)Constants.RegionSize); // convert it to LL Y
438
439 // Give em a new seed capability
440 responseMap["seed_capability"] = LLSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/");
441 responseMap["region"] = LLSD.FromUUID(reg.originRegionID);
442 responseMap["look_at"] = LookAtArray;
443
444 responseMap["sim_port"] = LLSD.FromInteger(reg.InternalEndPoint.Port);
445 responseMap["sim_host"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());// + ":" + reg.InternalEndPoint.Port.ToString());
446 responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());
447
448 responseMap["session_id"] = LLSD.FromUUID(SessionID);
449 responseMap["secure_session_id"] = LLSD.FromUUID(SecureSessionID);
450 responseMap["circuit_code"] = LLSD.FromInteger(circuitcode);
451
452 responseMap["position"] = PositionArray;
453
454 responseMap["region_id"] = LLSD.FromUUID(reg.originRegionID);
455
456 responseMap["sim_access"] = LLSD.FromString("Mature");
457
458 responseMap["connect"] = LLSD.FromBoolean(true);
459
460 m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString());
461
462 }
463
464 }
465
466 return responseMap;
467 }
468
469
470
471 public LLSD DerezAvatarMethod(string path, LLSD request)
472 {
473
474
475 m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString());
476
477 LLSD llsdResponse = null;
478 LLSDMap responseMap = new LLSDMap();
479
480
481
482 string[] PathArray = path.Split('/');
483 m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]);
484 string uuidString = PathArray[2];
485 m_log.InfoFormat("[OGP]: Request to Derez avatar with UUID {0}", uuidString);
486 LLUUID userUUID = LLUUID.Zero;
487 if (Helpers.TryParse(uuidString, out userUUID))
488 {
489
490 LLUUID RemoteID = uuidString;
491 LLUUID LocalID = RemoteID;
492 // FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds
493 // would be done already.. but the client connects with the Aditi UUID
494 // regardless over the UDP stack
495
496 OGPState userState = GetOGPState(LocalID);
497 if (userState.agent_id != LLUUID.Zero)
498 {
499
500 LLSDMap outboundRequestMap = new LLSDMap();
501 LLSDMap inboundRequestMap = (LLSDMap)request;
502 string rezAvatarString = inboundRequestMap["rez_avatar"].AsString();
503
504 LLSDArray LookAtArray = new LLSDArray();
505 LookAtArray.Add(LLSD.FromInteger(1));
506 LookAtArray.Add(LLSD.FromInteger(1));
507 LookAtArray.Add(LLSD.FromInteger(1));
508
509
510 LLSDArray PositionArray = new LLSDArray();
511 PositionArray.Add(LLSD.FromInteger(128));
512 PositionArray.Add(LLSD.FromInteger(128));
513 PositionArray.Add(LLSD.FromInteger(40));
514
515 LLSDArray lookArray = new LLSDArray();
516 lookArray.Add(LLSD.FromInteger(128));
517 lookArray.Add(LLSD.FromInteger(128));
518 lookArray.Add(LLSD.FromInteger(40));
519
520 responseMap["connect"] = LLSD.FromBoolean(true);// it's okay to give this user up
521 responseMap["look_at"] = LookAtArray;
522
523 m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name);
524
525 LLSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState);
526
527 // If invoking it returned an error, parse and end
528 if (rezResponseMap.ContainsKey("connect"))
529 {
530 if (rezResponseMap["connect"].AsBoolean() == false)
531 {
532 return responseMap;
533 }
534 }
535
536 string rezRespSeedCap = rezResponseMap["seed_capability"].AsString();
537 string rezRespSim_ip = rezResponseMap["sim_ip"].AsString();
538 string rezRespSim_host = rezResponseMap["sim_host"].AsString();
539
540 int rrPort = rezResponseMap["sim_port"].AsInteger();
541 int rrX = rezResponseMap["region_x"].AsInteger();
542 int rrY = rezResponseMap["region_y"].AsInteger();
543 m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY);
544 LLUUID rrRID = rezResponseMap["region_id"].AsUUID();
545
546 string rrAccess = rezResponseMap["sim_access"].AsString();
547
548 LLSDArray RezResponsePositionArray = (LLSDArray)rezResponseMap["position"];
549
550 responseMap["seed_capability"] = LLSD.FromString(rezRespSeedCap);
551 responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString());
552 responseMap["sim_host"] = LLSD.FromString(Util.GetHostFromDNS(rezRespSim_host).ToString());
553 responseMap["sim_port"] = LLSD.FromInteger(rrPort);
554 responseMap["region_x"] = LLSD.FromInteger(rrX * (int)Constants.RegionSize);
555 responseMap["region_y"] = LLSD.FromInteger(rrY * (int)Constants.RegionSize);
556 responseMap["region_id"] = LLSD.FromUUID(rrRID);
557 responseMap["sim_access"] = LLSD.FromString(rrAccess);
558
559
560
561 responseMap["position"] = RezResponsePositionArray;
562 responseMap["look_at"] = lookArray;
563 responseMap["connect"] = LLSD.FromBoolean(true);
564
565 ShutdownConnection(LocalID,this);
566
567
568 m_log.Warn("RESPONSEDEREZ: " + responseMap.ToString());
569 return responseMap;
570
571 }
572 else
573 {
574
575 return GenerateNoHandlerMessage();
576 }
577 }
578 else
579 {
580 return GenerateNoHandlerMessage();
581 }
582
583 return responseMap;
584 }
585
586 private LLSDMap invokeRezAvatarCap(LLSDMap responseMap, string CapAddress, OGPState userState)
587 {
588
589 WebRequest DeRezRequest = WebRequest.Create(CapAddress);
590 DeRezRequest.Method = "POST";
591 DeRezRequest.ContentType = "application/xml+llsd";
592
593 LLSDMap RAMap = new LLSDMap();
594 LLSDMap AgentParms = new LLSDMap();
595 LLSDMap RegionParms = new LLSDMap();
596
597
598 AgentParms["first_name"] = LLSD.FromString(userState.first_name);
599 AgentParms["last_name"] = LLSD.FromString(userState.last_name);
600 AgentParms["agent_id"] = LLSD.FromUUID(userState.agent_id);
601 RegionParms["region_id"] = LLSD.FromUUID(userState.region_id);
602 AgentParms["circuit_code"] = LLSD.FromInteger(userState.circuit_code);
603 AgentParms["secure_session_id"] = LLSD.FromUUID(userState.secure_session_id);
604 AgentParms["session_id"] = LLSD.FromUUID(userState.session_id);
605 AgentParms["agent_access"] = LLSD.FromBoolean(userState.agent_access);
606 AgentParms["god_level"] = LLSD.FromInteger(userState.god_level);
607 AgentParms["god_overide"] = LLSD.FromBoolean(userState.god_overide);
608 AgentParms["identified"] = LLSD.FromBoolean(userState.identified);
609 AgentParms["transacted"] = LLSD.FromBoolean(userState.transacted);
610 AgentParms["age_verified"] = LLSD.FromBoolean(userState.age_verified);
611 AgentParms["limited_to_estate"] = LLSD.FromInteger(userState.limited_to_estate);
612 AgentParms["inventory_host"] = LLSD.FromString(userState.inventory_host);
613 RAMap["agent_params"] = AgentParms;
614 RAMap["region_params"] = RegionParms;
615
616 string RAMapString = AgentParms.ToString();
617 m_log.InfoFormat("[OGP] RAMap string {0}", RAMapString);
618 LLSD LLSDofRAMap = AgentParms; // RENAME if this works
619
620 m_log.InfoFormat("[OGP]: LLSD of map as string was {0}", LLSDofRAMap.ToString());
621 byte[] buffer = LLSDParser.SerializeXmlBytes(LLSDofRAMap);
622
623 //string bufferDump = System.Text.Encoding.ASCII.GetString(buffer);
624 //m_log.InfoFormat("[OGP]: buffer form is {0}",bufferDump);
625 //m_log.InfoFormat("[OGP]: LLSD of map was {0}",buffer.Length);
626
627 Stream os = null;
628 try
629 { // send the Post
630 DeRezRequest.ContentLength = buffer.Length; //Count bytes to send
631 os = DeRezRequest.GetRequestStream();
632 os.Write(buffer, 0, buffer.Length); //Send it
633 os.Close();
634 m_log.InfoFormat("[OGP]: Derez Avatar Posted Rez Avatar request to remote sim {0}", CapAddress);
635 }
636 catch (WebException ex)
637 {
638 m_log.InfoFormat("[OGP] Bad send on de_rez_avatar {0}", ex.Message);
639 responseMap["connect"] = LLSD.FromBoolean(false);
640
641 return responseMap;
642 }
643
644 m_log.Info("[OGP] waiting for a reply after rez avatar send");
645 string rez_avatar_reply = null;
646 { // get the response
647 try
648 {
649 WebResponse webResponse = DeRezRequest.GetResponse();
650 if (webResponse == null)
651 {
652 m_log.Info("[OGP:] Null reply on rez_avatar post");
653 }
654
655 StreamReader sr = new StreamReader(webResponse.GetResponseStream());
656 rez_avatar_reply = sr.ReadToEnd().Trim();
657 m_log.InfoFormat("[OGP]: rez_avatar reply was {0} ", rez_avatar_reply);
658
659 }
660 catch (WebException ex)
661 {
662 m_log.InfoFormat("[OGP]: exception on read after send of rez avatar {0}", ex.Message);
663 responseMap["connect"] = LLSD.FromBoolean(false);
664
665 return responseMap;
666 }
667 LLSD rezResponse = null;
668 try
669 {
670 rezResponse = LLSDParser.DeserializeXml(rez_avatar_reply);
671
672 responseMap = (LLSDMap)rezResponse;
673 }
674 catch (Exception ex)
675 {
676 m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message);
677 responseMap["connect"] = LLSD.FromBoolean(false);
678
679 return responseMap;
680 }
681 }
682 return responseMap;
683 }
684
685
686
687 public LLSD GenerateNoHandlerMessage()
688 {
689 LLSDMap map = new LLSDMap();
690 map["reason"] = LLSD.FromString("LLSDRequest");
691 map["message"] = LLSD.FromString("No handler registered for LLSD Requests");
692 map["login"] = LLSD.FromString("false");
693
694 return map;
695 }
696
697 private bool TryGetAgentCircuitData(string path, out AgentCircuitData userdata)
698 {
699 userdata = null;
700 lock (CapsLoginID)
701 {
702 if (CapsLoginID.ContainsKey(path))
703 {
704 userdata = CapsLoginID[path];
705 DiscardUsedCap(path);
706 return true;
707 }
708 }
709 return false;
710 }
711
712 private void DiscardUsedCap(string path)
713 {
714 CapsLoginID.Remove(path);
715 }
716
717
718 private Scene GetRootScene()
719 {
720 Scene ReturnScene = null;
721 lock (m_scene)
722 {
723 if (m_scene.Count > 0)
724 {
725 ReturnScene = m_scene[0];
726 }
727 }
728
729 return ReturnScene;
730
731 }
732
733 private ulong GetOSCompatibleRegionHandle(RegionInfo reg)
734 {
735 return Util.UIntsToLong(reg.RegionLocX, reg.RegionLocY);
736 }
737
738 private ulong GetOSCompatibleRegionHandle(uint x, uint y)
739 {
740 return Util.UIntsToLong(x, y);
741 }
742
743 private ulong GetOSCompatibleRegionHandle(ulong regionhandle)
744 {
745 uint x,y;
746 Helpers.LongToUInts(regionhandle,out x, out y);
747 return GetOSCompatibleRegionHandle(x,y);
748 }
749
750
751 private ulong GetOGPCompatibleRegionHandle(RegionInfo reg)
752 {
753 return Util.UIntsToLong((reg.RegionLocX * (uint)Constants.RegionSize), (reg.RegionLocY * (uint)Constants.RegionSize));
754 }
755
756 private ulong GetOGPCompatibleRegionHandle(uint x, uint y)
757 {
758 return Util.UIntsToLong((x * (uint)Constants.RegionSize), (y * (uint)Constants.RegionSize));
759 }
760
761 private ulong GetOGPCompatibleRegionHandle(ulong regionhandle)
762 {
763 uint x, y;
764 Helpers.LongToUInts(regionhandle, out x, out y);
765 return GetOGPCompatibleRegionHandle(x, y);
766 }
767
768 private OGPState InitializeNewState()
769 {
770 OGPState returnState = new OGPState();
771 returnState.first_name = "";
772 returnState.last_name = "";
773 returnState.agent_id = LLUUID.Zero;
774 returnState.local_agent_id = LLUUID.Zero;
775 returnState.region_id = LLUUID.Zero;
776 returnState.circuit_code = 0;
777 returnState.secure_session_id = LLUUID.Zero;
778 returnState.session_id = LLUUID.Zero;
779 returnState.agent_access = true;
780 returnState.god_level = 0;
781 returnState.god_overide = false;
782 returnState.identified = false;
783 returnState.transacted = false;
784 returnState.age_verified = false;
785 returnState.limited_to_estate = 1;
786 returnState.inventory_host = "http://inv4.mysql.aditi.lindenlab.com";
787 returnState.allow_redirect = true;
788 returnState.sim_access = "";
789 returnState.src_can_see_mainland = true;
790 returnState.src_estate_id = 1;
791
792 return returnState;
793 }
794
795 private OGPState GetOGPState(LLUUID agentId)
796 {
797 lock (m_OGPState)
798 {
799 if (m_OGPState.ContainsKey(agentId))
800 {
801 return m_OGPState[agentId];
802 }
803 else
804 {
805 return InitializeNewState();
806 }
807 }
808 }
809
810 public void DeleteOGPState(LLUUID agentId)
811 {
812 lock (m_OGPState)
813 if (m_OGPState.ContainsKey(agentId))
814 m_OGPState.Remove(agentId);
815
816 }
817
818 private void UpdateOGPState(LLUUID agentId, OGPState state)
819 {
820 lock (m_OGPState)
821 {
822 if (m_OGPState.ContainsKey(agentId))
823 {
824 m_OGPState[agentId] = state;
825 }
826 else
827 {
828 m_OGPState.Add(agentId,state);
829 }
830 }
831 }
832 public void ShutdownConnection(LLUUID avatarId, OpenGridProtocolModule mod)
833 {
834 Scene homeScene = GetRootScene();
835 ScenePresence avatar = null;
836 if (homeScene.TryGetAvatar(avatarId,out avatar))
837 {
838 KillAUser ku = new KillAUser(avatar,mod);
839 Thread ta = new Thread(ku.ShutdownNoLogout);
840 ta.IsBackground = true;
841 ta.Name = "ShutdownThread";
842 ta.Start();
843 }
844 }
845 }
846
847 public class KillAUser
848 {
849 private ScenePresence avToBeKilled = null;
850 private OpenGridProtocolModule m_mod = null;
851
852 public KillAUser(ScenePresence avatar, OpenGridProtocolModule mod)
853 {
854 avToBeKilled = avatar;
855 m_mod = mod;
856 }
857
858 public void ShutdownNoLogout()
859 {
860 LLUUID avUUID = LLUUID.Zero;
861
862 if (avToBeKilled != null)
863 {
864 avUUID = avToBeKilled.UUID;
865 avToBeKilled.MakeChildAgent();
866
867 avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false;
868
869 Thread.Sleep(30000);
870
871 // test for child agent because they might have come back
872 if (avToBeKilled.IsChildAgent)
873 {
874 m_mod.DeleteOGPState(avUUID);
875 avToBeKilled.ControllingClient.Close(true);
876 }
877 }
878 }
879
880 }
881}
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 4754a04..2d27b11 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
43 private readonly LLUUID m_uuid = LLUUID.Random(); 43 private readonly LLUUID m_uuid = LLUUID.Random();
44 private readonly Scene m_scene; 44 private readonly Scene m_scene;
45 45
46
46 public NPCAvatar(string firstname, string lastname, LLVector3 position, Scene scene) 47 public NPCAvatar(string firstname, string lastname, LLVector3 position, Scene scene)
47 { 48 {
48 m_firstname = firstname; 49 m_firstname = firstname;
@@ -124,6 +125,11 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
124 set { m_scene.Entities[m_uuid].AbsolutePosition = value; } 125 set { m_scene.Entities[m_uuid].AbsolutePosition = value; }
125 } 126 }
126 127
128 public bool SendLogoutPacketWhenClosing
129 {
130 set { }
131 }
132
127 #region Internal Functions 133 #region Internal Functions
128 134
129 private void SendOnChatFromViewer(string message, ChatTypeEnum chatType) 135 private void SendOnChatFromViewer(string message, ChatTypeEnum chatType)
@@ -857,5 +863,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
857 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y) 863 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y)
858 { 864 {
859 } 865 }
866
867 public void KillEndDone()
868 {
869 }
860 } 870 }
861} 871}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a21f701..6f3267a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2599,6 +2599,17 @@ namespace OpenSim.Region.Environment.Scenes
2599 "[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}", 2599 "[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}",
2600 agent.AgentID, regionHandle, RegionInfo.RegionName); 2600 agent.AgentID, regionHandle, RegionInfo.RegionName);
2601 } 2601 }
2602
2603 }
2604
2605 public void UpdateCircuitData(AgentCircuitData data)
2606 {
2607 m_authenticateHandler.UpdateAgentData(data);
2608 }
2609
2610 public bool ChangeCircuitCode(uint oldcc, uint newcc)
2611 {
2612 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
2602 } 2613 }
2603 2614
2604 protected void HandleLogOffUserFromGrid(ulong regionHandle, LLUUID AvatarID, LLUUID RegionSecret, string message) 2615 protected void HandleLogOffUserFromGrid(ulong regionHandle, LLUUID AvatarID, LLUUID RegionSecret, string message)
@@ -2664,6 +2675,18 @@ namespace OpenSim.Region.Environment.Scenes
2664 m_capsHandlers[agentId] = cap; 2675 m_capsHandlers[agentId] = cap;
2665 } 2676 }
2666 2677
2678 public Caps GetCapsHandlerForUser(LLUUID agentId)
2679 {
2680 lock (m_capsHandlers)
2681 {
2682 if (m_capsHandlers.ContainsKey(agentId))
2683 {
2684 return m_capsHandlers[agentId];
2685 }
2686 }
2687 return null;
2688 }
2689
2667 /// <summary> 2690 /// <summary>
2668 /// Remove the caps handler for a given agent. 2691 /// Remove the caps handler for a given agent.
2669 /// </summary> 2692 /// </summary>
@@ -3838,6 +3861,12 @@ namespace OpenSim.Region.Environment.Scenes
3838 m_httpListener.AddStreamHandler(handler); 3861 m_httpListener.AddStreamHandler(handler);
3839 } 3862 }
3840 3863
3864 public bool AddLLSDHandler(string path, LLSDMethod handler)
3865 {
3866 return m_httpListener.AddLLSDHandler(path, handler);
3867 }
3868
3869
3841 public void RemoveStreamHandler(string httpMethod, string path) 3870 public void RemoveStreamHandler(string httpMethod, string path)
3842 { 3871 {
3843 m_httpListener.RemoveStreamHandler(httpMethod, path); 3872 m_httpListener.RemoveStreamHandler(httpMethod, path);
@@ -3848,6 +3877,11 @@ namespace OpenSim.Region.Environment.Scenes
3848 m_httpListener.RemoveHTTPHandler(httpMethod, path); 3877 m_httpListener.RemoveHTTPHandler(httpMethod, path);
3849 } 3878 }
3850 3879
3880 public bool RemoveLLSDHandler(string path, LLSDMethod handler)
3881 {
3882 return m_httpListener.RemoveLLSDHandler(path, handler);
3883 }
3884
3851 #endregion 3885 #endregion
3852 3886
3853 #region Avatar Appearance Default 3887 #region Avatar Appearance Default
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 655dfe4..3ea518f 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -302,6 +302,11 @@ namespace OpenSim.Region.Examples.SimpleModule
302 get { return m_scene; } 302 get { return m_scene; }
303 } 303 }
304 304
305 public bool SendLogoutPacketWhenClosing
306 {
307 set { }
308 }
309
305 public virtual void ActivateGesture(LLUUID assetId, LLUUID gestureId) 310 public virtual void ActivateGesture(LLUUID assetId, LLUUID gestureId)
306 { 311 {
307 } 312 }
@@ -855,5 +860,9 @@ namespace OpenSim.Region.Examples.SimpleModule
855 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y) 860 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y)
856 { 861 {
857 } 862 }
863
864 public void KillEndDone()
865 {
866 }
858 } 867 }
859} 868}