diff options
Diffstat (limited to 'OpenSim.RegionServer/CAPS')
-rw-r--r-- | OpenSim.RegionServer/CAPS/AdminWebFront.cs | 11 | ||||
-rw-r--r-- | OpenSim.RegionServer/CAPS/SimHttp.cs | 41 |
2 files changed, 30 insertions, 22 deletions
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs index ea32589..03f8692 100644 --- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs | |||
@@ -2,6 +2,7 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using OpenSim.world; | ||
5 | 6 | ||
6 | namespace OpenSim.CAPS | 7 | namespace OpenSim.CAPS |
7 | { | 8 | { |
@@ -11,9 +12,11 @@ namespace OpenSim.CAPS | |||
11 | private string NewAccountForm; | 12 | private string NewAccountForm; |
12 | private string LoginForm; | 13 | private string LoginForm; |
13 | private string passWord = "Admin"; | 14 | private string passWord = "Admin"; |
15 | private World m_world; | ||
14 | 16 | ||
15 | public AdminWebFront(string password) | 17 | public AdminWebFront(string password, World world) |
16 | { | 18 | { |
19 | m_world = world; | ||
17 | passWord = password; | 20 | passWord = password; |
18 | LoadAdminPage(); | 21 | LoadAdminPage(); |
19 | } | 22 | } |
@@ -45,11 +48,11 @@ namespace OpenSim.CAPS | |||
45 | { | 48 | { |
46 | responseString = " <p> Listing connected Clients </p>"; | 49 | responseString = " <p> Listing connected Clients </p>"; |
47 | OpenSim.world.Avatar TempAv; | 50 | OpenSim.world.Avatar TempAv; |
48 | foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) | 51 | foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys) |
49 | { | 52 | { |
50 | if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | 53 | if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar") |
51 | { | 54 | { |
52 | TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; | 55 | TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID]; |
53 | responseString += "<p>"; | 56 | responseString += "<p>"; |
54 | responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); | 57 | responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); |
55 | responseString += "</p>"; | 58 | responseString += "</p>"; |
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs index a1073f0..92bbc6f 100644 --- a/OpenSim.RegionServer/CAPS/SimHttp.cs +++ b/OpenSim.RegionServer/CAPS/SimHttp.cs | |||
@@ -39,22 +39,27 @@ using System.Collections.Generic; | |||
39 | using libsecondlife; | 39 | using libsecondlife; |
40 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Framework.Interfaces; | 41 | using OpenSim.Framework.Interfaces; |
42 | using OpenSim.Servers; | ||
42 | 43 | ||
43 | namespace OpenSim.CAPS | 44 | namespace OpenSim.CAPS |
44 | { | 45 | { |
45 | // Dummy HTTP server, does nothing useful for now | 46 | // Dummy HTTP server, does nothing useful for now |
46 | 47 | ||
47 | public class SimCAPSHTTPServer | 48 | public class SimCAPSHTTPServer : BaseHttpServer |
48 | { | 49 | { |
49 | public Thread HTTPD; | 50 | private Thread m_workerThread; |
50 | public HttpListener Listener; | 51 | private HttpListener m_httpListener; |
51 | private Dictionary<string, IRestHandler> restHandlers = new Dictionary<string, IRestHandler>(); | 52 | private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>(); |
53 | private IGridServer m_gridServer; | ||
54 | private int m_port; | ||
52 | 55 | ||
53 | public SimCAPSHTTPServer() | 56 | public SimCAPSHTTPServer(IGridServer gridServer, int port) |
54 | { | 57 | { |
55 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); | 58 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); |
56 | HTTPD = new Thread(new ThreadStart(StartHTTP)); | 59 | m_workerThread = new Thread(new ThreadStart(StartHTTP)); |
57 | HTTPD.Start(); | 60 | m_workerThread.Start(); |
61 | m_gridServer = gridServer; | ||
62 | m_port = port; | ||
58 | } | 63 | } |
59 | 64 | ||
60 | public void StartHTTP() | 65 | public void StartHTTP() |
@@ -62,15 +67,15 @@ namespace OpenSim.CAPS | |||
62 | try | 67 | try |
63 | { | 68 | { |
64 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); | 69 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); |
65 | Listener = new HttpListener(); | 70 | m_httpListener = new HttpListener(); |
66 | 71 | ||
67 | Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/"); | 72 | m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); |
68 | Listener.Start(); | 73 | m_httpListener.Start(); |
69 | 74 | ||
70 | HttpListenerContext context; | 75 | HttpListenerContext context; |
71 | while (true) | 76 | while (true) |
72 | { | 77 | { |
73 | context = Listener.GetContext(); | 78 | context = m_httpListener.GetContext(); |
74 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); | 79 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); |
75 | } | 80 | } |
76 | } | 81 | } |
@@ -82,9 +87,9 @@ namespace OpenSim.CAPS | |||
82 | 87 | ||
83 | public bool AddRestHandler(string path, IRestHandler handler) | 88 | public bool AddRestHandler(string path, IRestHandler handler) |
84 | { | 89 | { |
85 | if (!this.restHandlers.ContainsKey(path)) | 90 | if (!this.m_restHandlers.ContainsKey(path)) |
86 | { | 91 | { |
87 | this.restHandlers.Add(path, handler); | 92 | this.m_restHandlers.Add(path, handler); |
88 | return true; | 93 | return true; |
89 | } | 94 | } |
90 | 95 | ||
@@ -108,12 +113,12 @@ namespace OpenSim.CAPS | |||
108 | agent_data.lastname = (string)requestData["lastname"]; | 113 | agent_data.lastname = (string)requestData["lastname"]; |
109 | agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); | 114 | agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); |
110 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 115 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
111 | if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote") | 116 | if (m_gridServer.GetName() == "Remote") |
112 | { | 117 | { |
113 | ((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | 118 | |
119 | ((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | ||
114 | } | 120 | } |
115 | return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; | 121 | return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; |
116 | break; | ||
117 | } | 122 | } |
118 | } | 123 | } |
119 | catch (Exception e) | 124 | catch (Exception e) |
@@ -135,9 +140,9 @@ namespace OpenSim.CAPS | |||
135 | //path[0] should be empty so we are interested in path[1] | 140 | //path[0] should be empty so we are interested in path[1] |
136 | if (path.Length > 1) | 141 | if (path.Length > 1) |
137 | { | 142 | { |
138 | if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1]))) | 143 | if ((path[1] != "") && (this.m_restHandlers.ContainsKey(path[1]))) |
139 | { | 144 | { |
140 | responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); | 145 | responseString = this.m_restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); |
141 | } | 146 | } |
142 | } | 147 | } |
143 | 148 | ||