diff options
author | gareth | 2007-03-22 10:11:15 +0000 |
---|---|---|
committer | gareth | 2007-03-22 10:11:15 +0000 |
commit | 7daa3955bc3a1918e40962851f9e8d38597a245e (patch) | |
tree | bee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /src/RemoteServers | |
parent | Load XML for neighbourinfo from grid (diff) | |
download | opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.zip opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2 opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz |
brought zircon branch into trunk
Diffstat (limited to 'src/RemoteServers')
-rw-r--r-- | src/RemoteServers/RemoteGridServers/AssemblyInfo.cs | 21 | ||||
-rw-r--r-- | src/RemoteServers/RemoteGridServers/RemoteGrid.cs | 279 | ||||
-rw-r--r-- | src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj | 48 | ||||
-rw-r--r-- | src/RemoteServers/default.build | 51 |
4 files changed, 0 insertions, 399 deletions
diff --git a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs deleted file mode 100644 index 7d3f314..0000000 --- a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-remoteservers")] | ||
19 | [assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs deleted file mode 100644 index adb3d0f..0000000 --- a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs +++ /dev/null | |||
@@ -1,279 +0,0 @@ | |||
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 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Threading; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.IO; | ||
34 | using System.Xml; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.GridServers; | ||
37 | |||
38 | namespace RemoteGridServers | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// | ||
42 | /// </summary> | ||
43 | /// | ||
44 | |||
45 | public class RemoteGridPlugin : IGridPlugin | ||
46 | { | ||
47 | public RemoteGridPlugin() | ||
48 | { | ||
49 | |||
50 | } | ||
51 | |||
52 | public IGridServer GetGridServer() | ||
53 | { | ||
54 | return(new RemoteGridServer()); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | public class RemoteAssetPlugin : IAssetPlugin | ||
59 | { | ||
60 | public RemoteAssetPlugin() | ||
61 | { | ||
62 | |||
63 | } | ||
64 | |||
65 | public IAssetServer GetAssetServer() | ||
66 | { | ||
67 | return(new RemoteAssetServer()); | ||
68 | } | ||
69 | } | ||
70 | public class RemoteGridServer : RemoteGridBase | ||
71 | { | ||
72 | private string GridServerUrl; | ||
73 | private string GridSendKey; | ||
74 | private string GridRecvKey; | ||
75 | private string UserServerUrl; | ||
76 | private string UserSendKey; | ||
77 | private string UserRecvKey; | ||
78 | |||
79 | private Dictionary<uint, agentcircuitdata> AgentCircuits = new Dictionary<uint, agentcircuitdata>(); | ||
80 | |||
81 | public override Dictionary<uint, agentcircuitdata> agentcircuits { | ||
82 | get {return AgentCircuits;} | ||
83 | set {AgentCircuits=value;} | ||
84 | } | ||
85 | |||
86 | public RemoteGridServer() | ||
87 | { | ||
88 | ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); | ||
89 | } | ||
90 | |||
91 | public override bool RequestConnection() | ||
92 | { | ||
93 | return true; | ||
94 | } | ||
95 | |||
96 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
97 | { | ||
98 | agentcircuitdata validcircuit=this.AgentCircuits[circuitcode]; | ||
99 | AuthenticateResponse user = new AuthenticateResponse(); | ||
100 | if((sessionID==validcircuit.SessionID) && (agentID==validcircuit.AgentID)) | ||
101 | { | ||
102 | // YAY! Valid login | ||
103 | user.Authorised = true; | ||
104 | user.LoginInfo = new Login(); | ||
105 | user.LoginInfo.Agent = agentID; | ||
106 | user.LoginInfo.Session = sessionID; | ||
107 | user.LoginInfo.First = validcircuit.firstname; | ||
108 | user.LoginInfo.Last = validcircuit.lastname; | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | // Invalid | ||
113 | user.Authorised = false; | ||
114 | } | ||
115 | |||
116 | return(user); | ||
117 | } | ||
118 | |||
119 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
120 | { | ||
121 | WebRequest DeleteSession = WebRequest.Create(UserServerUrl + "/usersessions/" + sessionID.ToString()); | ||
122 | DeleteSession.Method="DELETE"; | ||
123 | DeleteSession.ContentType="text/plaintext"; | ||
124 | DeleteSession.ContentLength=0; | ||
125 | |||
126 | StreamWriter stOut = new StreamWriter (DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII); | ||
127 | stOut.Write(""); | ||
128 | stOut.Close(); | ||
129 | |||
130 | StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream()); | ||
131 | string GridResponse = stIn.ReadToEnd(); | ||
132 | stIn.Close(); | ||
133 | return(true); | ||
134 | } | ||
135 | |||
136 | public override UUIDBlock RequestUUIDBlock() | ||
137 | { | ||
138 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
139 | return(uuidBlock); | ||
140 | } | ||
141 | |||
142 | public override neighbourinfo[] RequestNeighbours(ulong regionhandle) | ||
143 | { | ||
144 | ArrayList neighbourlist = new ArrayList(); | ||
145 | |||
146 | WebRequest FindNeighbours = WebRequest.Create(GridServerUrl + "/regions/" + regionhandle.ToString() + "/neighbours"); | ||
147 | FindNeighbours.ContentType="text/plaintext"; | ||
148 | FindNeighbours.ContentLength=0; | ||
149 | |||
150 | StreamWriter stOut = new StreamWriter (FindNeighbours.GetRequestStream(), System.Text.Encoding.ASCII); | ||
151 | stOut.Write(""); | ||
152 | stOut.Close(); | ||
153 | |||
154 | |||
155 | XmlDocument GridRespXml = new XmlDocument(); | ||
156 | GridRespXml.Load(FindNeighbours.GetResponse().GetResponseStream()); | ||
157 | |||
158 | |||
159 | XmlNode NeighboursRoot = GridRespXml.FirstChild; | ||
160 | if(NeighboursRoot.Name != "neighbours") { | ||
161 | return new neighbourinfo[0]; | ||
162 | } | ||
163 | |||
164 | FindNeighbours.GetResponse().GetResponseStream().Close(); | ||
165 | |||
166 | return new neighbourinfo[0]; | ||
167 | } | ||
168 | |||
169 | public override void SetServerInfo(string UserServerUrl, string UserSendKey, string UserRecvKey, string GridServerUrl, string GridSendKey, string GridRecvKey) | ||
170 | { | ||
171 | this.UserServerUrl = UserServerUrl; | ||
172 | this.UserSendKey = UserSendKey; | ||
173 | this.UserRecvKey = UserRecvKey; | ||
174 | this.GridServerUrl = GridServerUrl; | ||
175 | this.GridSendKey = GridSendKey; | ||
176 | this.GridRecvKey = GridRecvKey; | ||
177 | } | ||
178 | |||
179 | public override string GetName() | ||
180 | { | ||
181 | return "Remote"; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | |||
186 | public class RemoteAssetServer : IAssetServer | ||
187 | { | ||
188 | private IAssetReceiver _receiver; | ||
189 | private BlockingQueue<ARequest> _assetRequests; | ||
190 | private Thread _remoteAssetServerThread; | ||
191 | private string AssetServerUrl; | ||
192 | private string AssetSendKey; | ||
193 | |||
194 | public RemoteAssetServer() | ||
195 | { | ||
196 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
197 | this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
198 | this._remoteAssetServerThread.IsBackground = true; | ||
199 | this._remoteAssetServerThread.Start(); | ||
200 | ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created"); | ||
201 | } | ||
202 | |||
203 | public void SetReceiver(IAssetReceiver receiver) | ||
204 | { | ||
205 | this._receiver = receiver; | ||
206 | } | ||
207 | |||
208 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
209 | { | ||
210 | ARequest req = new ARequest(); | ||
211 | req.AssetID = assetID; | ||
212 | req.IsTexture = isTexture; | ||
213 | this._assetRequests.Enqueue(req); | ||
214 | } | ||
215 | |||
216 | public void UpdateAsset(AssetBase asset) | ||
217 | { | ||
218 | |||
219 | } | ||
220 | |||
221 | public void UploadNewAsset(AssetBase asset) | ||
222 | { | ||
223 | |||
224 | } | ||
225 | |||
226 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
227 | { | ||
228 | this.AssetServerUrl = ServerUrl; | ||
229 | this.AssetSendKey = ServerKey; | ||
230 | } | ||
231 | |||
232 | private void RunRequests() | ||
233 | { | ||
234 | while(true) | ||
235 | { | ||
236 | //we need to add support for the asset server not knowing about a requested asset | ||
237 | ARequest req = this._assetRequests.Dequeue(); | ||
238 | LLUUID assetID = req.AssetID; | ||
239 | ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it"); | ||
240 | WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data"); | ||
241 | WebResponse AssetResponse = AssetLoad.GetResponse(); | ||
242 | byte[] idata = new byte[(int)AssetResponse.ContentLength]; | ||
243 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); | ||
244 | idata = br.ReadBytes((int)AssetResponse.ContentLength); | ||
245 | br.Close(); | ||
246 | |||
247 | AssetBase asset = new AssetBase(); | ||
248 | asset.FullID = assetID; | ||
249 | asset.Data = idata; | ||
250 | _receiver.AssetReceived(asset, req.IsTexture ); | ||
251 | } | ||
252 | } | ||
253 | } | ||
254 | |||
255 | public class BlockingQueue< T > { | ||
256 | private Queue< T > _queue = new Queue< T >(); | ||
257 | private object _queueSync = new object(); | ||
258 | |||
259 | public void Enqueue(T value) | ||
260 | { | ||
261 | lock(_queueSync) | ||
262 | { | ||
263 | _queue.Enqueue(value); | ||
264 | Monitor.Pulse(_queueSync); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | public T Dequeue() | ||
269 | { | ||
270 | lock(_queueSync) | ||
271 | { | ||
272 | if( _queue.Count < 1) | ||
273 | Monitor.Wait(_queueSync); | ||
274 | |||
275 | return _queue.Dequeue(); | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | } | ||
diff --git a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj deleted file mode 100644 index f1c5649..0000000 --- a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>RemoteGridServers</RootNamespace> | ||
5 | <AssemblyName>RemoteGridServers</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="libsecondlife"> | ||
30 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="RemoteGrid.cs" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
39 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
40 | <Name>ServerConsole</Name> | ||
41 | </ProjectReference> | ||
42 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
43 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
44 | <Name>GridInterfaces</Name> | ||
45 | </ProjectReference> | ||
46 | </ItemGroup> | ||
47 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
48 | </Project> \ No newline at end of file | ||
diff --git a/src/RemoteServers/default.build b/src/RemoteServers/default.build deleted file mode 100644 index f8e6977..0000000 --- a/src/RemoteServers/default.build +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/RemoteGridServers.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="RemoteGridServers/AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-remoteservers" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="Connects to remote OGS installation" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/RemoteGridServers.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | <include name="libsecondlife.dll" /> | ||
43 | <include name="GridInterfaces.dll" /> | ||
44 | <include name="ServerConsole.dll" /> | ||
45 | </references> | ||
46 | <sources basedir="RemoteGridServers/"> | ||
47 | <include name="*.cs" /> | ||
48 | </sources> | ||
49 | </csc> | ||
50 | </target> | ||
51 | </project> | ||