diff options
author | gareth | 2007-03-01 15:25:10 +0000 |
---|---|---|
committer | gareth | 2007-03-01 15:25:10 +0000 |
commit | d68d8a4b0ca1477addb3542c5fea828d0df0ea3d (patch) | |
tree | f7b61b34d224e59e43c2b2270bf0c6c28bdb5ca4 /src | |
parent | Cleaned up legacy code (i.e deleted the old stuff) (diff) | |
download | opensim-SC-d68d8a4b0ca1477addb3542c5fea828d0df0ea3d.zip opensim-SC-d68d8a4b0ca1477addb3542c5fea828d0df0ea3d.tar.gz opensim-SC-d68d8a4b0ca1477addb3542c5fea828d0df0ea3d.tar.bz2 opensim-SC-d68d8a4b0ca1477addb3542c5fea828d0df0ea3d.tar.xz |
Missed these 2
Diffstat (limited to 'src')
-rw-r--r-- | src/Login_manager.cs | 228 | ||||
-rw-r--r-- | src/SceneGraphManager.cs | 40 |
2 files changed, 0 insertions, 268 deletions
diff --git a/src/Login_manager.cs b/src/Login_manager.cs deleted file mode 100644 index dd741f5..0000000 --- a/src/Login_manager.cs +++ /dev/null | |||
@@ -1,228 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://osgrid.org/> | ||
3 | * All rights reserved. | ||
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 <organization> 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 <copyright holder> ``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 <copyright holder> 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 | using Nwc.XmlRpc; | ||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Net.Sockets; | ||
32 | using System.Text; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using System.Threading; | ||
35 | using System.Collections; | ||
36 | using System.Xml; | ||
37 | using libsecondlife; | ||
38 | |||
39 | namespace OpenSim | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Description of Login_manager. | ||
43 | /// </summary> | ||
44 | public class LoginManager | ||
45 | { | ||
46 | public LoginManager(Logon login) | ||
47 | { | ||
48 | Login=login; | ||
49 | } | ||
50 | public Logon Login; | ||
51 | public ushort loginPort = Globals.Instance.LoginServerPort; | ||
52 | public IPAddress clientAddress = IPAddress.Loopback; | ||
53 | public IPAddress remoteAddress = IPAddress.Any; | ||
54 | private Socket loginServer; | ||
55 | private Random RandomClass = new Random(); | ||
56 | private int NumClients; | ||
57 | |||
58 | // InitializeLoginProxy: initialize the login proxy | ||
59 | private void InitializeLoginProxy() { | ||
60 | loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | ||
61 | loginServer.Bind(new IPEndPoint(remoteAddress, loginPort)); | ||
62 | loginServer.Listen(1); | ||
63 | } | ||
64 | |||
65 | public void Startup() | ||
66 | { | ||
67 | this.InitializeLoginProxy(); | ||
68 | Thread runLoginProxy = new Thread(new ThreadStart(RunLoginProxy)); | ||
69 | runLoginProxy.IsBackground = true; | ||
70 | runLoginProxy.Start(); | ||
71 | } | ||
72 | |||
73 | private void RunLoginProxy() | ||
74 | { | ||
75 | try | ||
76 | { | ||
77 | for (;;) | ||
78 | { | ||
79 | Socket client = loginServer.Accept(); | ||
80 | IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint; | ||
81 | |||
82 | |||
83 | NetworkStream networkStream = new NetworkStream(client); | ||
84 | StreamReader networkReader = new StreamReader(networkStream); | ||
85 | StreamWriter networkWriter = new StreamWriter(networkStream); | ||
86 | |||
87 | try | ||
88 | { | ||
89 | ProxyLogin(networkReader, networkWriter); | ||
90 | } | ||
91 | catch (Exception e) | ||
92 | { | ||
93 | Console.WriteLine(e.Message); | ||
94 | } | ||
95 | |||
96 | networkWriter.Close(); | ||
97 | networkReader.Close(); | ||
98 | networkStream.Close(); | ||
99 | |||
100 | client.Close(); | ||
101 | |||
102 | // send any packets queued for injection | ||
103 | |||
104 | } | ||
105 | } | ||
106 | catch (Exception e) | ||
107 | { | ||
108 | Console.WriteLine(e.Message); | ||
109 | Console.WriteLine(e.StackTrace); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | // ProxyLogin: proxy a login request | ||
114 | private void ProxyLogin(StreamReader reader, StreamWriter writer) { lock(this) { | ||
115 | string line; | ||
116 | int contentLength = 0; | ||
117 | |||
118 | // read HTTP header | ||
119 | do | ||
120 | { | ||
121 | // read one line of the header | ||
122 | line = reader.ReadLine(); | ||
123 | |||
124 | // check for premature EOF | ||
125 | if (line == null) | ||
126 | throw new Exception("EOF in client HTTP header"); | ||
127 | |||
128 | // look for Content-Length | ||
129 | Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line); | ||
130 | if (match.Success) | ||
131 | contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString()); | ||
132 | } while (line != ""); | ||
133 | |||
134 | // read the HTTP body into a buffer | ||
135 | char[] content = new char[contentLength]; | ||
136 | reader.Read(content, 0, contentLength); | ||
137 | //System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
138 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); | ||
139 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
140 | |||
141 | string first; | ||
142 | string last; | ||
143 | LLUUID Agent; | ||
144 | LLUUID Session; | ||
145 | |||
146 | //get login name | ||
147 | if(requestData.Contains("first")) | ||
148 | { | ||
149 | first = (string)requestData["first"]; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | first = "test"; | ||
154 | } | ||
155 | if(requestData.Contains("last")) | ||
156 | { | ||
157 | last = (string)requestData["last"]; | ||
158 | } | ||
159 | else | ||
160 | { | ||
161 | last = "User"+NumClients.ToString(); | ||
162 | } | ||
163 | NumClients++; | ||
164 | |||
165 | //create a agent and session LLUUID | ||
166 | int AgentRand = this.RandomClass.Next(1,9999); | ||
167 | Agent = new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead"); | ||
168 | int SessionRand = this.RandomClass.Next(1,999); | ||
169 | Session = new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); | ||
170 | |||
171 | |||
172 | StreamReader SR; | ||
173 | string ResponseString = ""; | ||
174 | string lines; | ||
175 | SR=File.OpenText("new-login.dat"); | ||
176 | |||
177 | lines=SR.ReadLine(); | ||
178 | |||
179 | while(lines != "end-mfile") | ||
180 | { | ||
181 | |||
182 | ResponseString += lines; | ||
183 | lines = SR.ReadLine(); | ||
184 | } | ||
185 | SR.Close(); | ||
186 | |||
187 | XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString); | ||
188 | Hashtable responseData = (Hashtable)response.Value; | ||
189 | |||
190 | responseData["agent_id"] = Agent.ToStringHyphenated(); | ||
191 | responseData["session_id"] = Session.ToStringHyphenated(); | ||
192 | ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; | ||
193 | Hashtable Inventory1 = (Hashtable)InventoryList[0]; | ||
194 | Hashtable Inventory2 = (Hashtable)InventoryList[1]; | ||
195 | LLUUID BaseFolderID = LLUUID.Random(); | ||
196 | LLUUID InventoryFolderID = LLUUID.Random(); | ||
197 | Inventory2["name"] = "Base"; | ||
198 | Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); | ||
199 | Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); | ||
200 | |||
201 | ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; | ||
202 | Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; | ||
203 | Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); | ||
204 | |||
205 | |||
206 | //copy data to login object | ||
207 | lock(Login) | ||
208 | { | ||
209 | Login.First = first; | ||
210 | Login.Last = last; | ||
211 | Login.Agent = Agent; | ||
212 | Login.Session = Session; | ||
213 | Login.BaseFolder = BaseFolderID; | ||
214 | Login.InventoryFolder = InventoryFolderID; | ||
215 | } | ||
216 | |||
217 | // forward the XML-RPC response to the client | ||
218 | writer.WriteLine("HTTP/1.0 200 OK"); | ||
219 | writer.WriteLine("Content-type: text/xml"); | ||
220 | writer.WriteLine(); | ||
221 | |||
222 | XmlTextWriter responseWriter = new XmlTextWriter(writer); | ||
223 | XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response); | ||
224 | responseWriter.Close(); | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | } | ||
diff --git a/src/SceneGraphManager.cs b/src/SceneGraphManager.cs deleted file mode 100644 index c71ad54..0000000 --- a/src/SceneGraphManager.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.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 | using System; | ||
28 | |||
29 | namespace OpenSim | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// Description of SceneGraphManager. | ||
33 | /// </summary> | ||
34 | public class SceneGraphManager | ||
35 | { | ||
36 | public SceneGraphManager() | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } | ||