aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ConvertToPlugins/src/RemoteServers
diff options
context:
space:
mode:
authorgareth2007-03-07 18:49:20 +0000
committergareth2007-03-07 18:49:20 +0000
commit16476f06b867adf01fa0d17c6761f4a862fc17ad (patch)
treec3a1147578ae33d269812adfe8de5ece8c62d586 /ConvertToPlugins/src/RemoteServers
parentDeleted old trunk code (diff)
downloadopensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.zip
opensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.tar.gz
opensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.tar.bz2
opensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.tar.xz
Imported branch
Diffstat (limited to '')
-rw-r--r--ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs31
-rw-r--r--ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs241
-rw-r--r--ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj49
-rw-r--r--ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln7
-rw-r--r--ConvertToPlugins/src/RemoteServers/default.build51
5 files changed, 379 insertions, 0 deletions
diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs
new file mode 100644
index 0000000..0fa7d6e
--- /dev/null
+++ b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("RemoteGridServers")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("RemoteGridServers")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs
new file mode 100644
index 0000000..f7c33e8
--- /dev/null
+++ b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs
@@ -0,0 +1,241 @@
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*/
27using System;
28using System.Collections.Generic;
29using System.Threading;
30using System.Net;
31using System.Net.Sockets;
32using System.IO;
33using libsecondlife;
34using OpenSim.GridServers;
35
36namespace RemoteGridServers
37{
38 /// <summary>
39 ///
40 /// </summary>
41 ///
42
43 public class RemoteGridPlugin : IGridPlugin
44 {
45 public RemoteGridPlugin()
46 {
47
48 }
49
50 public IGridServer GetGridServer()
51 {
52 return(new RemoteGridServer());
53 }
54 }
55
56 public class RemoteAssetPlugin : IAssetPlugin
57 {
58 public RemoteAssetPlugin()
59 {
60
61 }
62
63 public IAssetServer GetAssetServer()
64 {
65 return(new RemoteAssetServer());
66 }
67 }
68 public class RemoteGridServer :IGridServer
69 {
70 private string GridServerUrl;
71 private string GridSendKey;
72
73 public RemoteGridServer()
74 {
75 ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created");
76 }
77
78 public bool RequestConnection()
79 {
80 return true;
81 }
82 public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
83 {
84 AuthenticateResponse user = new AuthenticateResponse();
85
86 WebRequest CheckSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/exists");
87 WebResponse GridResponse = CheckSession.GetResponse();
88 StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
89 String grTest = sr.ReadLine();
90 sr.Close();
91 GridResponse.Close();
92 if(String.IsNullOrEmpty(grTest) || grTest.Equals("1"))
93 {
94 // YAY! Valid login
95 user.Authorised = true;
96 user.LoginInfo = new Login();
97 user.LoginInfo.Agent = agentID;
98 user.LoginInfo.Session = sessionID;
99 user.LoginInfo.First = "";
100 user.LoginInfo.Last = "";
101
102 }
103 else
104 {
105 // Invalid
106 user.Authorised = false;
107 }
108
109 return(user);
110 }
111
112 public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
113 {
114 WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + circuitCode.ToString() + "/delete");
115 WebResponse GridResponse = DeleteSession.GetResponse();
116 StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
117 String grTest = sr.ReadLine();
118 sr.Close();
119 GridResponse.Close();
120 ServerConsole.MainConsole.Instance.WriteLine("DEBUG: " + grTest);
121 return(true);
122 }
123
124 public UUIDBlock RequestUUIDBlock()
125 {
126 UUIDBlock uuidBlock = new UUIDBlock();
127 return(uuidBlock);
128 }
129
130 public void RequestNeighbours()
131 {
132 return;
133 }
134
135 public void SetServerInfo(string ServerUrl, string ServerKey)
136 {
137 this.GridServerUrl = ServerUrl;
138 this.GridSendKey = ServerKey;
139 }
140
141 public void AddNewSession(Login session)
142 {
143
144 }
145 }
146
147
148 public class RemoteAssetServer : IAssetServer
149 {
150 private IAssetReceiver _receiver;
151 private BlockingQueue<ARequest> _assetRequests;
152 private Thread _remoteAssetServerThread;
153 private string AssetServerUrl;
154 private string AssetSendKey;
155
156 public RemoteAssetServer()
157 {
158 this._assetRequests = new BlockingQueue<ARequest>();
159 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
160 this._remoteAssetServerThread.IsBackground = true;
161 this._remoteAssetServerThread.Start();
162 ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created");
163 }
164
165 public void SetReceiver(IAssetReceiver receiver)
166 {
167 this._receiver = receiver;
168 }
169
170 public void RequestAsset(LLUUID assetID, bool isTexture)
171 {
172 ARequest req = new ARequest();
173 req.AssetID = assetID;
174 req.IsTexture = isTexture;
175 this._assetRequests.Enqueue(req);
176 }
177
178 public void UpdateAsset(AssetBase asset)
179 {
180
181 }
182
183 public void UploadNewAsset(AssetBase asset)
184 {
185
186 }
187
188 public void SetServerInfo(string ServerUrl, string ServerKey)
189 {
190 this.AssetServerUrl = ServerUrl;
191 this.AssetSendKey = ServerKey;
192 }
193
194 private void RunRequests()
195 {
196 while(true)
197 {
198 //we need to add support for the asset server not knowing about a requested asset
199 ARequest req = this._assetRequests.Dequeue();
200 LLUUID assetID = req.AssetID;
201 ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
202 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
203 WebResponse AssetResponse = AssetLoad.GetResponse();
204 byte[] idata = new byte[(int)AssetResponse.ContentLength];
205 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
206 idata = br.ReadBytes((int)AssetResponse.ContentLength);
207 br.Close();
208
209 AssetBase asset = new AssetBase();
210 asset.FullID = assetID;
211 asset.Data = idata;
212 _receiver.AssetReceived(asset, req.IsTexture );
213 }
214 }
215 }
216
217 public class BlockingQueue< T > {
218 private Queue< T > _queue = new Queue< T >();
219 private object _queueSync = new object();
220
221 public void Enqueue(T value)
222 {
223 lock(_queueSync)
224 {
225 _queue.Enqueue(value);
226 Monitor.Pulse(_queueSync);
227 }
228 }
229
230 public T Dequeue()
231 {
232 lock(_queueSync)
233 {
234 if( _queue.Count < 1)
235 Monitor.Wait(_queueSync);
236
237 return _queue.Dequeue();
238 }
239 }
240 }
241}
diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj
new file mode 100644
index 0000000..6fc1e5a
--- /dev/null
+++ b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj
@@ -0,0 +1,49 @@
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>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="RemoteGrid.cs" />
36 <Compile Include="AssemblyInfo.cs" />
37 </ItemGroup>
38 <ItemGroup>
39 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
40 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
41 <Name>ServerConsole</Name>
42 </ProjectReference>
43 <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
44 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
45 <Name>GridInterfaces</Name>
46 </ProjectReference>
47 </ItemGroup>
48 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
49</Project> \ No newline at end of file
diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln
new file mode 100644
index 0000000..a990022
--- /dev/null
+++ b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln
@@ -0,0 +1,7 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# SharpDevelop 2.1.0.2017
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}"
5EndProject
6Global
7EndGlobal
diff --git a/ConvertToPlugins/src/RemoteServers/default.build b/ConvertToPlugins/src/RemoteServers/default.build
new file mode 100644
index 0000000..8819600
--- /dev/null
+++ b/ConvertToPlugins/src/RemoteServers/default.build
@@ -0,0 +1,51 @@
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" />
41 <include name="System.Xml" />
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>