aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorlbsa712007-03-29 18:21:04 +0000
committerlbsa712007-03-29 18:21:04 +0000
commit761db20c5fdc155a8319c1a3efcad05eafe9acc2 (patch)
treefeb207190c56754ff6e18d02c5967e88d6c86f97 /OpenSim.RegionServer
parent* added user account info to README.txt (diff)
downloadopensim-SC_OLD-761db20c5fdc155a8319c1a3efcad05eafe9acc2.zip
opensim-SC_OLD-761db20c5fdc155a8319c1a3efcad05eafe9acc2.tar.gz
opensim-SC_OLD-761db20c5fdc155a8319c1a3efcad05eafe9acc2.tar.bz2
opensim-SC_OLD-761db20c5fdc155a8319c1a3efcad05eafe9acc2.tar.xz
* Tried to make the sandbox/useraccount sim setup a bit simpler
* Removed some comments
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs51
-rw-r--r--OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs27
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs145
3 files changed, 52 insertions, 171 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 651c0c6..51ec12b 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -73,7 +73,7 @@ namespace OpenSim
73 private EndPoint epSender; 73 private EndPoint epSender;
74 private AsyncCallback ReceivedData; 74 private AsyncCallback ReceivedData;
75 75
76 private System.Timers.Timer timer1 = new System.Timers.Timer(); 76 private System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
77 private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll"; 77 private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
78 public string m_physicsEngine; 78 public string m_physicsEngine;
79 public bool m_sandbox = false; 79 public bool m_sandbox = false;
@@ -176,40 +176,39 @@ namespace OpenSim
176 176
177 177
178 LoginServer loginServer = null; 178 LoginServer loginServer = null;
179 if (m_loginserver && m_sandbox) 179 LoginServer adminLoginServer = null;
180
181 bool sandBoxWithLoginServer = m_loginserver && m_sandbox;
182 if (sandBoxWithLoginServer)
180 { 183 {
181 loginServer = new LoginServer(gridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts); 184 loginServer = new LoginServer(gridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts);
182 loginServer.Startup(); 185 loginServer.Startup();
183 186
184 } 187 if( user_accounts )
185 188 {
186 if ((m_loginserver) && (m_sandbox) && (user_accounts)) 189 //sandbox mode with loginserver using accounts
187 { 190 this.GridServers.UserServer = loginServer;
188 //sandbox mode with loginserver using accounts 191 adminLoginServer = loginServer;
189 this.GridServers.UserServer = loginServer; 192
190 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, loginServer)); 193 HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
191 HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); 194 }
192 } 195 else
193 else if ((m_loginserver) && (m_sandbox)) 196 {
194 { 197 //sandbox mode with loginserver not using accounts
195 //sandbox mode with loginserver not using accounts 198 HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
196 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, null)); 199 }
197 HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
198 }
199 else
200 {
201 //not in sandbox mode so no loginserver, so we don't handle login attempts
202 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, null));
203 } 200 }
204 201
202 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, adminLoginServer ));
203
205 m_console.WriteLine("Main.cs:Startup() - Starting HTTP server"); 204 m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
206 HttpServer.Start(); 205 HttpServer.Start();
207 206
208 MainServerListener(); 207 MainServerListener();
209 208
210 timer1.Enabled = true; 209 m_heartbeatTimer.Enabled = true;
211 timer1.Interval = 100; 210 m_heartbeatTimer.Interval = 100;
212 timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick); 211 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
213 } 212 }
214 213
215 private SimConfig LoadConfigDll(string dllName) 214 private SimConfig LoadConfigDll(string dllName)
@@ -340,7 +339,7 @@ namespace OpenSim
340 Environment.Exit(0); 339 Environment.Exit(0);
341 } 340 }
342 341
343 void Timer1Tick(object sender, System.EventArgs e) 342 void Heartbeat(object sender, System.EventArgs e)
344 { 343 {
345 LocalWorld.Update(); 344 LocalWorld.Update();
346 } 345 }
diff --git a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
index 3ae7878..6166e02 100644
--- a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
+++ b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
@@ -1,3 +1,30 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (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*/
27
1using System; 28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Collections; 30using System.Collections;
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
index a68e013..4c77389 100644
--- a/OpenSim.RegionServer/UserServer/LoginServer.cs
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -84,28 +84,16 @@ namespace OpenSim.UserServer
84 84
85 public void Startup() 85 public void Startup()
86 { 86 {
87 this.InitializeLogin();
88 //Thread runLoginProxy = new Thread(new ThreadStart(RunLogin));
89 //runLoginProxy.IsBackground = true;
90 //runLoginProxy.Start();
91 }
92
93 // InitializeLogin: initialize the login
94 private void InitializeLogin()
95 {
96 this._needPasswd = false; 87 this._needPasswd = false;
97 //read in default response string 88 //read in default response string
98 StreamReader SR; 89 StreamReader SR;
99 string lines; 90 string lines;
100 SR = File.OpenText("new-login.dat"); 91 SR = File.OpenText("new-login.dat");
101 92
102 //lines=SR.ReadLine();
103
104 while (!SR.EndOfStream) 93 while (!SR.EndOfStream)
105 { 94 {
106 lines = SR.ReadLine(); 95 lines = SR.ReadLine();
107 _defaultResponse += lines; 96 _defaultResponse += lines;
108 //lines = SR.ReadLine();
109 } 97 }
110 SR.Close(); 98 SR.Close();
111 this._mpasswd = EncodePassword("testpass"); 99 this._mpasswd = EncodePassword("testpass");
@@ -113,118 +101,8 @@ namespace OpenSim.UserServer
113 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr); 101 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr);
114 userManager.InitUserProfiles(); 102 userManager.InitUserProfiles();
115 userManager.SetKeys("", "", "", "Welcome to OpenSim"); 103 userManager.SetKeys("", "", "", "Welcome to OpenSim");
116
117 //loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
118 // loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
119 //loginServer.Listen(1);
120 } 104 }
121 105
122 /* private void RunLogin()
123 {
124 Console.WriteLine("Starting Login Server");
125 try
126 {
127 for (; ; )
128 {
129 Socket client = loginServer.Accept();
130 IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
131
132
133 NetworkStream networkStream = new NetworkStream(client);
134 StreamReader networkReader = new StreamReader(networkStream);
135 StreamWriter networkWriter = new StreamWriter(networkStream);
136
137 try
138 {
139 LoginRequest(networkReader, networkWriter);
140 }
141 catch (Exception e)
142 {
143 Console.WriteLine(e.Message);
144 }
145
146 networkWriter.Close();
147 networkReader.Close();
148 networkStream.Close();
149
150 client.Close();
151
152 // send any packets queued for injection
153
154 }
155 }
156 catch (Exception e)
157 {
158 Console.WriteLine(e.Message);
159 Console.WriteLine(e.StackTrace);
160 }
161 }
162
163 // ProxyLogin: proxy a login request
164 private void LoginRequest(StreamReader reader, StreamWriter writer)
165 {
166 lock (this)
167 {
168 string line;
169 int contentLength = 0;
170 // read HTTP header
171 do
172 {
173 // read one line of the header
174 line = reader.ReadLine();
175
176 // check for premature EOF
177 if (line == null)
178 throw new Exception("EOF in client HTTP header");
179
180 // look for Content-Length
181 Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line);
182 if (match.Success)
183 contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString());
184 } while (line != "");
185
186 // read the HTTP body into a buffer
187 char[] content = new char[contentLength];
188 reader.Read(content, 0, contentLength);
189
190 if (this.userAccounts)
191 {
192 //ask the UserProfile Manager to process the request
193 string reply = this.userManager.ParseXMLRPC(new String(content));
194 // forward the XML-RPC response to the client
195 writer.WriteLine("HTTP/1.0 200 OK");
196 writer.WriteLine("Content-type: text/xml");
197 writer.WriteLine();
198 writer.WriteLine(reply);
199 }
200 else
201 {
202 //handle ourselves
203 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
204 if (request.MethodName == "login_to_simulator")
205 {
206 this.ProcessXmlRequest(request, writer);
207 }
208 else
209 {
210 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
211 Hashtable PresenceErrorRespData = new Hashtable();
212 PresenceErrorRespData["reason"] = "XmlRequest"; ;
213 PresenceErrorRespData["message"] = "Unknown Rpc request";
214 PresenceErrorRespData["login"] = "false";
215 PresenceErrorResp.Value = PresenceErrorRespData;
216 string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
217 writer.WriteLine("HTTP/1.0 200 OK");
218 writer.WriteLine("Content-type: text/xml");
219 writer.WriteLine();
220 writer.WriteLine(reply);
221 }
222 }
223 }
224 }
225 */
226 //public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
227
228 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 106 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
229 { 107 {
230 Console.WriteLine("login attempt"); 108 Console.WriteLine("login attempt");
@@ -267,19 +145,6 @@ namespace OpenSim.UserServer
267 145
268 if (!Authenticate(first, last, passwd)) 146 if (!Authenticate(first, last, passwd))
269 { 147 {
270 /* XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
271 Hashtable PresenceErrorRespData = new Hashtable();
272 PresenceErrorRespData["reason"] = "key"; ;
273 PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
274 PresenceErrorRespData["login"] = "false";
275 PresenceErrorResp.Value = PresenceErrorRespData;
276 string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
277 writer.WriteLine("HTTP/1.0 200 OK");
278 writer.WriteLine("Content-type: text/xml");
279 writer.WriteLine();
280 writer.WriteLine(reply);
281 return false;*/
282
283 Hashtable loginError = new Hashtable(); 148 Hashtable loginError = new Hashtable();
284 loginError["reason"] = "key"; ; 149 loginError["reason"] = "key"; ;
285 loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock."; 150 loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
@@ -356,15 +221,6 @@ namespace OpenSim.UserServer
356 ((LocalGridBase)m_gridServer).AddNewSession(_login); 221 ((LocalGridBase)m_gridServer).AddNewSession(_login);
357 } 222 }
358 223
359 /* // forward the XML-RPC response to the client
360 writer.WriteLine("HTTP/1.0 200 OK");
361 writer.WriteLine("Content-type: text/xml");
362 writer.WriteLine();
363
364 XmlTextWriter responseWriter = new XmlTextWriter(writer);
365 XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
366 responseWriter.Close();*/
367
368 return response; 224 return response;
369 } 225 }
370 226
@@ -445,7 +301,6 @@ namespace OpenSim.UserServer
445 { 301 {
446 302
447 } 303 }
448
449 } 304 }
450 305
451 306