aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Client/VWoHTTP/VWoHTTPModule.cs')
-rw-r--r--OpenSim/Client/VWoHTTP/VWoHTTPModule.cs133
1 files changed, 0 insertions, 133 deletions
diff --git a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs b/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
deleted file mode 100644
index 31385ba..0000000
--- a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
+++ /dev/null
@@ -1,133 +0,0 @@
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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27using System;
28using System.Collections.Generic;
29using System.Text;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Client.VWoHTTP.ClientStack;
33using OpenSim.Framework;
34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38
39namespace OpenSim.Client.VWoHTTP
40{
41 class VWoHTTPModule : IRegionModule, IHttpAgentHandler
42 {
43 private bool m_disabled = true;
44
45 private IHttpServer m_httpd;
46
47 private readonly List<Scene> m_scenes = new List<Scene>();
48
49 private Dictionary<UUID, VWHClientView> m_clients = new Dictionary<UUID, VWHClientView>();
50
51 #region Implementation of IRegionModule
52
53 public void Initialise(Scene scene, IConfigSource source)
54 {
55 if (m_disabled)
56 return;
57
58 m_scenes.Add(scene);
59
60 m_httpd = MainServer.Instance;
61 }
62
63 public void PostInitialise()
64 {
65 if (m_disabled)
66 return;
67
68 m_httpd.AddAgentHandler("vwohttp", this);
69 }
70
71 public void Close()
72 {
73 if (m_disabled)
74 return;
75
76 m_httpd.RemoveAgentHandler("vwohttp", this);
77 }
78
79 public string Name
80 {
81 get { return "VWoHTTP ClientStack"; }
82 }
83
84 public bool IsSharedModule
85 {
86 get { return true; }
87 }
88
89 #endregion
90
91 #region Implementation of IHttpAgentHandler
92
93 public bool Handle(OSHttpRequest req, OSHttpResponse resp)
94 {
95 string[] urlparts = req.Url.AbsolutePath.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
96
97 if (urlparts.Length < 2)
98 return false;
99
100 if (urlparts[1] == "connect")
101 {
102 UUID sessID = UUID.Random();
103
104 VWHClientView client = new VWHClientView(sessID, UUID.Random(), "VWoHTTPClient", m_scenes[0]);
105
106 m_clients.Add(sessID, client);
107
108 return true;
109 }
110 else
111 {
112 if (urlparts.Length < 3)
113 return false;
114
115 UUID sessionID;
116 if (!UUID.TryParse(urlparts[1], out sessionID))
117 return false;
118
119 if (!m_clients.ContainsKey(sessionID))
120 return false;
121
122 return m_clients[sessionID].ProcessInMsg(req, resp);
123 }
124 }
125
126 public bool Match(OSHttpRequest req, OSHttpResponse resp)
127 {
128 return req.Url.ToString().Contains("vwohttp");
129 }
130
131 #endregion
132 }
133}