aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-27 09:42:31 +0000
committerTeravus Ovares2008-09-27 09:42:31 +0000
commit85b280385fd7400da8bc721131d25eee9fd7f8da (patch)
treef0fdba12f4442e01c9a3032c6c0b8881194f3509 /OpenSim/Region
parentUpdate unit tests (diff)
downloadopensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.zip
opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.tar.gz
opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.tar.bz2
opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.tar.xz
* This is the very very early beginnings of an EventQueue:get module.
* This won't function yet as far as the client can tell.. because it doesn't respond to the first query with a 200 message. * We have to figure out how to encode those binary values in the example code in the module... * Committing this so we have a start point. Will continue to work on this more today.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs164
-rw-r--r--OpenSim/Region/Interfaces/IEventQueue.cs40
2 files changed, 204 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
new file mode 100644
index 0000000..ea6c663
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
@@ -0,0 +1,164 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Net;
5using System.Net.Sockets;
6using System.Reflection;
7using System.Xml;
8using OpenMetaverse;
9using OpenMetaverse.StructuredData;
10using log4net;
11using Nini.Config;
12using Nwc.XmlRpc;
13using OpenSim.Framework;
14using OpenSim.Framework.Communications.Cache;
15using OpenSim.Framework.Communications.Capabilities;
16using OpenSim.Framework.Servers;
17using OpenSim.Region.Environment.Interfaces;
18using OpenSim.Region.Interfaces;
19using OpenSim.Region.Environment.Scenes;
20
21using LLSD = OpenMetaverse.StructuredData.LLSD;
22using LLSDMap = OpenMetaverse.StructuredData.LLSDMap;
23using LLSDArray = OpenMetaverse.StructuredData.LLSDArray;
24using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
25
26namespace OpenSim.Region.Environment.Modules.Framework
27{
28 public class EventQueueGetModule : IEventQueue, IRegionModule
29 {
30 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
31 Scene m_scene = null;
32 IConfigSource m_gConfig;
33
34 #region IRegionModule methods
35 public void Initialise(Scene scene, IConfigSource config)
36 {
37 m_gConfig = config;
38 m_scene = scene;
39
40
41 IConfig startupConfig = m_gConfig.Configs["Startup"];
42
43 ReadConfigAndPopulate(scene, startupConfig, "Startup");
44
45 scene.RegisterModuleInterface<IEventQueue>(this);
46
47 scene.EventManager.OnNewClient += OnNewClient;
48 scene.EventManager.OnClientClosed += ClientClosed;
49 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
50 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
51 scene.EventManager.OnClientClosed += ClientLoggedOut;
52 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
53
54 }
55
56 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p)
57 {
58
59 }
60
61
62
63
64
65 public void PostInitialise()
66 {
67 }
68
69 public void Close()
70 {
71 }
72
73 public string Name
74 {
75 get { return "EventQueueGetModule"; }
76 }
77
78 public bool IsSharedModule
79 {
80 get { return false; }
81 }
82 #endregion
83
84 #region IEventQueue Members
85 public bool Enqueue(object o, UUID avatarID)
86 {
87
88 return false;
89 }
90 #endregion
91
92 private void OnNewClient(IClientAPI client)
93 {
94
95 client.OnLogout += ClientClosed;
96 }
97
98
99 public void ClientClosed(IClientAPI client)
100 {
101 ClientClosed(client.AgentId);
102 }
103
104 private void ClientLoggedOut(UUID AgentId)
105 {
106
107 }
108
109 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
110 {
111
112 }
113
114 public void ClientClosed(UUID AgentID)
115 {
116
117 }
118 private void MakeChildAgent(ScenePresence avatar)
119 {
120 }
121 public void OnRegisterCaps(UUID agentID, Caps caps)
122 {
123 m_log.DebugFormat("[EVENTQUEUE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
124 string capsBase = "/CAPS/";
125 caps.RegisterHandler("EventQueueGet",
126 new RestHTTPHandler("POST", capsBase + UUID.Random().ToString(),
127 delegate(Hashtable m_dhttpMethod)
128 {
129 return ProcessQueue(m_dhttpMethod,agentID, caps);
130 }));
131 }
132 public Hashtable ProcessQueue(Hashtable request,UUID agentID, Caps caps)
133 {
134
135 Hashtable responsedata = new Hashtable();
136 responsedata["int_response_code"] = 502;
137 responsedata["str_response_string"] = "Upstream error:";
138 responsedata["content_type"] = "text/plain";
139 responsedata["keepalive"] = true;
140
141 /*
142 responsedata["int_response_code"] = 200;
143 responsedata["content_type"] = "application/xml";
144 responsedata["keepalive"] = true;
145
146 responsedata["str_response_string"] = @"<llsd><map><key>events</key><array><map><key>body</key><map><key>AgentData</key><map><key>AgentID</key>
147 <uuid>0fd0e798-a54f-40b1-0000-000000000000</uuid><key>SessionID</key><uuid>cc91f1fe-9d52-435d-0000-000000000000
148 </uuid></map><key>Info</key><map><key>LookAt</key><array><real>0.9869639873504638671875</real><real>
149 -0.1609439998865127563476562</real><real>0</real></array><key>Position</key><array><real>1.43747997283935546875
150 </real><real>95.30560302734375</real><real>57.3480987548828125</real></array></map><key>RegionData</key><map>
151 <key>RegionHandle</key><binary encoding=" + "\"base64\"" + @">AAPnAAAD8AA=</binary><key>SeedCapability</key><string>
152 https://sim7.aditi.lindenlab.com:12043/cap/64015fb3-6fee-9205-0000-000000000000</string><key>SimIP</key><binary
153 encoding=" + "\"base64\"" + @">yA8FSA==</binary><key>SimPort</key><integer>13005</integer></map></map><key>message</key>
154 <string>CrossedRegion</string></map></array><key>id</key><integer>1</integer></map></llsd>";
155
156 */
157 //string requestbody = (string)request["requestbody"];
158 //LLSD llsdRequest = LLSDParser.DeserializeXml(request);
159 //System.Console.WriteLine(requestbody);
160 return responsedata;
161
162 }
163 }
164}
diff --git a/OpenSim/Region/Interfaces/IEventQueue.cs b/OpenSim/Region/Interfaces/IEventQueue.cs
new file mode 100644
index 0000000..a11eebe
--- /dev/null
+++ b/OpenSim/Region/Interfaces/IEventQueue.cs
@@ -0,0 +1,40 @@
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 System;
29using OpenSim.Framework;
30using OpenMetaverse;
31using System.Collections.Generic;
32using System.Text;
33
34namespace OpenSim.Region.Interfaces
35{
36 public interface IEventQueue
37 {
38 bool Enqueue(object o, UUID avatarID);
39 }
40}