aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.GridInterfaces
diff options
context:
space:
mode:
authorMW2007-05-26 13:40:19 +0000
committerMW2007-05-26 13:40:19 +0000
commit3436961bb5c01d659d09be134368f4f69460cef9 (patch)
tree3753ba4d7818df2a6bce0bbe863ff033cdfd568a /OpenSim/OpenSim.GridInterfaces
downloadopensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.zip
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.gz
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.bz2
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.xz
Start of rewrite 5279!
Diffstat (limited to 'OpenSim/OpenSim.GridInterfaces')
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/AssemblyInfo.cs31
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs271
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs157
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj110
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj.user12
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build46
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs31
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj112
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj.user12
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build46
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs108
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs210
12 files changed, 1146 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/OpenSim.GridInterfaces/Local/AssemblyInfo.cs
new file mode 100644
index 0000000..103b49a
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Local/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("LocalGridServers")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("LocalGridServers")]
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/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
new file mode 100644
index 0000000..5f75821
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
@@ -0,0 +1,271 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading;
5using System.IO;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types;
8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.Console;
10using libsecondlife;
11using Db4objects.Db4o;
12using Db4objects.Db4o.Query;
13
14namespace OpenSim.GridInterfaces.Local
15{
16 public class LocalAssetPlugin : IAssetPlugin
17 {
18 public LocalAssetPlugin()
19 {
20
21 }
22
23 public IAssetServer GetAssetServer()
24 {
25 return (new LocalAssetServer());
26 }
27 }
28
29 public class LocalAssetServer : IAssetServer
30 {
31 private IAssetReceiver _receiver;
32 private BlockingQueue<ARequest> _assetRequests;
33 private IObjectContainer db;
34 private Thread _localAssetServerThread;
35
36 public LocalAssetServer()
37 {
38 bool yapfile;
39 this._assetRequests = new BlockingQueue<ARequest>();
40 yapfile = System.IO.File.Exists("assets.yap");
41
42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"Local Asset Server class created");
43 try
44 {
45 db = Db4oFactory.OpenFile("assets.yap");
46 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"Db4 Asset database creation");
47 }
48 catch (Exception e)
49 {
50 db.Close();
51 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM,"Db4 Asset server :Constructor - Exception occured");
52 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
53 }
54 if (!yapfile)
55 {
56 this.SetUpAssetDatabase();
57 }
58 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
59 this._localAssetServerThread.IsBackground = true;
60 this._localAssetServerThread.Start();
61
62 }
63
64 public void SetReceiver(IAssetReceiver receiver)
65 {
66 this._receiver = receiver;
67 }
68
69 public void RequestAsset(LLUUID assetID, bool isTexture)
70 {
71 ARequest req = new ARequest();
72 req.AssetID = assetID;
73 req.IsTexture = isTexture;
74 this._assetRequests.Enqueue(req);
75 }
76
77 public void UpdateAsset(AssetBase asset)
78 {
79
80 }
81
82 public void UploadNewAsset(AssetBase asset)
83 {
84 AssetStorage store = new AssetStorage();
85 store.Data = asset.Data;
86 store.Name = asset.Name;
87 store.UUID = asset.FullID;
88 db.Set(store);
89 db.Commit();
90 }
91
92 public void SetServerInfo(string ServerUrl, string ServerKey)
93 {
94
95 }
96 public void Close()
97 {
98 if (db != null)
99 {
100 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "Closing local asset server database");
101 db.Close();
102 }
103 }
104
105 private void RunRequests()
106 {
107 while (true)
108 {
109 byte[] idata = null;
110 bool found = false;
111 AssetStorage foundAsset = null;
112 ARequest req = this._assetRequests.Dequeue();
113 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
114 if (result.Count > 0)
115 {
116 foundAsset = (AssetStorage)result.Next();
117 found = true;
118 }
119
120 AssetBase asset = new AssetBase();
121 if (found)
122 {
123 asset.FullID = foundAsset.UUID;
124 asset.Type = foundAsset.Type;
125 asset.InvType = foundAsset.Type;
126 asset.Name = foundAsset.Name;
127 idata = foundAsset.Data;
128 }
129 else
130 {
131 asset.FullID = LLUUID.Zero;
132 }
133 asset.Data = idata;
134 _receiver.AssetReceived(asset, req.IsTexture);
135 }
136
137 }
138
139 private void SetUpAssetDatabase()
140 {
141 try
142 {
143
144 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "Setting up asset database");
145
146 AssetBase Image = new AssetBase();
147 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
148 Image.Name = "Bricks";
149 this.LoadAsset(Image, true, "bricks.jp2");
150 AssetStorage store = new AssetStorage();
151 store.Data = Image.Data;
152 store.Name = Image.Name;
153 store.UUID = Image.FullID;
154 db.Set(store);
155 db.Commit();
156
157 Image = new AssetBase();
158 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
159 Image.Name = "Plywood";
160 this.LoadAsset(Image, true, "plywood.jp2");
161 store = new AssetStorage();
162 store.Data = Image.Data;
163 store.Name = Image.Name;
164 store.UUID = Image.FullID;
165 db.Set(store);
166 db.Commit();
167
168 Image = new AssetBase();
169 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
170 Image.Name = "Rocks";
171 this.LoadAsset(Image, true, "rocks.jp2");
172 store = new AssetStorage();
173 store.Data = Image.Data;
174 store.Name = Image.Name;
175 store.UUID = Image.FullID;
176 db.Set(store);
177 db.Commit();
178
179 Image = new AssetBase();
180 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
181 Image.Name = "Granite";
182 this.LoadAsset(Image, true, "granite.jp2");
183 store = new AssetStorage();
184 store.Data = Image.Data;
185 store.Name = Image.Name;
186 store.UUID = Image.FullID;
187 db.Set(store);
188 db.Commit();
189
190 Image = new AssetBase();
191 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
192 Image.Name = "Hardwood";
193 this.LoadAsset(Image, true, "hardwood.jp2");
194 store = new AssetStorage();
195 store.Data = Image.Data;
196 store.Name = Image.Name;
197 store.UUID = Image.FullID;
198 db.Set(store);
199 db.Commit();
200
201 Image = new AssetBase();
202 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
203 Image.Name = "Prim Base Texture";
204 this.LoadAsset(Image, true, "plywood.jp2");
205 store = new AssetStorage();
206 store.Data = Image.Data;
207 store.Name = Image.Name;
208 store.UUID = Image.FullID;
209 db.Set(store);
210 db.Commit();
211
212 Image = new AssetBase();
213 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
214 Image.Name = "Map Base Texture";
215 this.LoadAsset(Image, true, "map_base.jp2");
216 store = new AssetStorage();
217 store.Data = Image.Data;
218 store.Name = Image.Name;
219 store.UUID = Image.FullID;
220 db.Set(store);
221 db.Commit();
222
223 Image = new AssetBase();
224 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
225 Image.Name = "Map Texture";
226 this.LoadAsset(Image, true, "map1.jp2");
227 store = new AssetStorage();
228 store.Data = Image.Data;
229 store.Name = Image.Name;
230 store.UUID = Image.FullID;
231 db.Set(store);
232 db.Commit();
233
234 Image = new AssetBase();
235 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
236 Image.Name = "Shape";
237 this.LoadAsset(Image, false, "base_shape.dat");
238 store = new AssetStorage();
239 store.Data = Image.Data;
240 store.Name = Image.Name;
241 store.UUID = Image.FullID;
242 db.Set(store);
243 db.Commit();
244 }
245 catch (Exception e)
246 {
247 Console.WriteLine(e.Message);
248 }
249
250 }
251
252 private void LoadAsset(AssetBase info, bool image, string filename)
253 {
254 //should request Asset from storage manager
255 //but for now read from file
256
257 string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
258 string fileName = Path.Combine(dataPath, filename);
259 FileInfo fInfo = new FileInfo(fileName);
260 long numBytes = fInfo.Length;
261 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
262 byte[] idata = new byte[numBytes];
263 BinaryReader br = new BinaryReader(fStream);
264 idata = br.ReadBytes((int)numBytes);
265 br.Close();
266 fStream.Close();
267 info.Data = idata;
268 //info.loaded=true;
269 }
270 }
271}
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs
new file mode 100644
index 0000000..fdd6ba4
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs
@@ -0,0 +1,157 @@
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.IO;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Types;
33using OpenSim.Framework.Console;
34using libsecondlife;
35using Db4objects.Db4o;
36using Db4objects.Db4o.Query;
37using System.Collections;
38
39namespace OpenSim.GridInterfaces.Local
40{
41 /// <summary>
42 ///
43 /// </summary>
44 ///
45 public class LocalGridPlugin : IGridPlugin
46 {
47 public LocalGridPlugin()
48 {
49
50 }
51
52 public IGridServer GetGridServer()
53 {
54 return(new LocalGridServer());
55 }
56 }
57
58 public class LocalGridServer : LocalGridBase
59 {
60 public List<Login> Sessions = new List<Login>();
61
62 public LocalGridServer()
63 {
64 Sessions = new List<Login>();
65 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"Local Grid Server class created");
66 }
67
68 public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port)
69 {
70 return true;
71 }
72
73 public override string GetName()
74 {
75 return "Local";
76 }
77
78 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
79 {
80 //we are running local
81 AuthenticateResponse user = new AuthenticateResponse();
82
83 lock(this.Sessions)
84 {
85
86 for(int i = 0; i < Sessions.Count; i++)
87 {
88 if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID))
89 {
90 user.Authorised = true;
91 user.LoginInfo = Sessions[i];
92 }
93 }
94 }
95 return(user);
96 }
97
98 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
99 {
100 return(true);
101 }
102
103 public override UUIDBlock RequestUUIDBlock()
104 {
105 UUIDBlock uuidBlock = new UUIDBlock();
106 return(uuidBlock);
107 }
108
109 public override NeighbourInfo[] RequestNeighbours()
110 {
111 return null;
112 }
113
114 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
115 {
116
117 }
118
119 public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY)
120 {
121 return new ArrayList();
122 }
123
124
125 public override void Close()
126 {
127
128 }
129
130 /// <summary>
131 /// used by the local login server to inform us of new sessions
132 /// </summary>
133 /// <param name="session"></param>
134 public override void AddNewSession(Login session)
135 {
136 lock(this.Sessions)
137 {
138 this.Sessions.Add(session);
139 }
140 }
141 }
142
143 public class AssetUUIDQuery : Predicate
144 {
145 private LLUUID _findID;
146
147 public AssetUUIDQuery(LLUUID find)
148 {
149 _findID = find;
150 }
151 public bool Match(AssetStorage asset)
152 {
153 return (asset.UUID == _findID);
154 }
155 }
156
157}
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
new file mode 100644
index 0000000..c6ec476
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
@@ -0,0 +1,110 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{546099CD-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.GridInterfaces.Local</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.GridInterfaces.Local</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="Db4objects.Db4o.dll" >
70 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 </ItemGroup>
78 <ItemGroup>
79 <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
80 <Name>OpenSim.Framework</Name>
81 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private>
84 </ProjectReference>
85 <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
86 <Name>OpenSim.Framework.Console</Name>
87 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
88 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
89 <Private>False</Private>
90 </ProjectReference>
91 </ItemGroup>
92 <ItemGroup>
93 <Compile Include="AssemblyInfo.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="LocalAssetServer.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 <Compile Include="LocalGridServer.cs">
100 <SubType>Code</SubType>
101 </Compile>
102 </ItemGroup>
103 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
104 <PropertyGroup>
105 <PreBuildEvent>
106 </PreBuildEvent>
107 <PostBuildEvent>
108 </PostBuildEvent>
109 </PropertyGroup>
110</Project>
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj.user b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
new file mode 100644
index 0000000..fc2d94b
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.GridInterfaces.Local" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.GridInterfaces.Local" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="LocalAssetServer.cs" />
16 <include name="LocalGridServer.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll" />
25 <include name="../../../bin/Db4objects.Db4o.dll" />
26 <include name="../../../bin/libsecondlife.dll" />
27 <include name="../../../bin/OpenSim.Framework.dll" />
28 <include name="../../../bin/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs
new file mode 100644
index 0000000..0fa7d6e
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/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/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
new file mode 100644
index 0000000..28e0bb8
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
@@ -0,0 +1,112 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{B55C0B5D-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.GridInterfaces.Remote</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.GridInterfaces.Remote</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="libsecondlife.dll" >
70 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
76 <Name>OpenSim.Framework</Name>
77 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 <Private>False</Private>
80 </ProjectReference>
81 <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
82 <Name>OpenSim.Framework.Console</Name>
83 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
84 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
85 <Private>False</Private>
86 </ProjectReference>
87 <ProjectReference Include="..\..\..\Common\XmlRpcCS\XMLRPC.csproj">
88 <Name>XMLRPC</Name>
89 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
90 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
91 <Private>False</Private>
92 </ProjectReference>
93 </ItemGroup>
94 <ItemGroup>
95 <Compile Include="AssemblyInfo.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="RemoteAssetServer.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="RemoteGridServer.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 </ItemGroup>
105 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
106 <PropertyGroup>
107 <PreBuildEvent>
108 </PreBuildEvent>
109 <PostBuildEvent>
110 </PostBuildEvent>
111 </PropertyGroup>
112</Project>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj.user b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
new file mode 100644
index 0000000..daf35c6
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.GridInterfaces.Remote" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.GridInterfaces.Remote" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="RemoteAssetServer.cs" />
16 <include name="RemoteGridServer.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll" />
25 <include name="../../../bin/libsecondlife.dll" />
26 <include name="../../../bin/OpenSim.Framework.dll" />
27 <include name="../../../bin/OpenSim.Framework.Console.dll" />
28 <include name="../../../bin/XMLRPC.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
new file mode 100644
index 0000000..7432dee
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
@@ -0,0 +1,108 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading;
5using System.Net;
6using System.Net.Sockets;
7using System.IO;
8using libsecondlife;
9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Types;
11using OpenSim.Framework.Utilities;
12
13namespace OpenSim.GridInterfaces.Remote
14{
15 public class RemoteAssetServer : IAssetServer
16 {
17 private IAssetReceiver _receiver;
18 private BlockingQueue<ARequest> _assetRequests;
19 private Thread _remoteAssetServerThread;
20 private string AssetServerUrl;
21 private string AssetSendKey;
22
23 public RemoteAssetServer()
24 {
25 this._assetRequests = new BlockingQueue<ARequest>();
26 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
27 this._remoteAssetServerThread.IsBackground = true;
28 this._remoteAssetServerThread.Start();
29 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Remote Asset Server class created");
30 }
31
32 public void SetReceiver(IAssetReceiver receiver)
33 {
34 this._receiver = receiver;
35 }
36
37 public void RequestAsset(LLUUID assetID, bool isTexture)
38 {
39 ARequest req = new ARequest();
40 req.AssetID = assetID;
41 req.IsTexture = isTexture;
42 this._assetRequests.Enqueue(req);
43 }
44
45 public void UpdateAsset(AssetBase asset)
46 {
47
48 }
49
50 public void UploadNewAsset(AssetBase asset)
51 {
52 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
53 string ret = Windows1252Encoding.GetString(asset.Data);
54 byte[] buffer = Windows1252Encoding.GetBytes(ret);
55 WebClient client = new WebClient();
56 client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer);
57
58 }
59
60 public void SetServerInfo(string ServerUrl, string ServerKey)
61 {
62 this.AssetServerUrl = ServerUrl;
63 this.AssetSendKey = ServerKey;
64 }
65
66 private void RunRequests()
67 {
68 while (true)
69 {
70 //we need to add support for the asset server not knowing about a requested asset
71 // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM
72 ARequest req = this._assetRequests.Dequeue();
73 LLUUID assetID = req.AssetID;
74 // OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW," RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID);
75 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID);
76 WebResponse AssetResponse = AssetLoad.GetResponse();
77 byte[] idata = new byte[(int)AssetResponse.ContentLength];
78 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
79 idata = br.ReadBytes((int)AssetResponse.ContentLength);
80 br.Close();
81
82 AssetBase asset = new AssetBase();
83 asset.FullID = assetID;
84 asset.Data = idata;
85 _receiver.AssetReceived(asset, req.IsTexture);
86 }
87 }
88
89 public void Close()
90 {
91
92 }
93 }
94
95 public class RemoteAssetPlugin : IAssetPlugin
96 {
97 public RemoteAssetPlugin()
98 {
99
100 }
101
102 public IAssetServer GetAssetServer()
103 {
104 return (new RemoteAssetServer());
105 }
106 }
107
108}
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
new file mode 100644
index 0000000..7f911d8
--- /dev/null
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
@@ -0,0 +1,210 @@
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;
29using System.Collections.Generic;
30using System.Threading;
31using System.Net;
32using System.Net.Sockets;
33using System.IO;
34using libsecondlife;
35using Nwc.XmlRpc;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types;
38
39namespace OpenSim.GridInterfaces.Remote
40{
41 public class RemoteGridServer : RemoteGridBase
42 {
43 private string GridServerUrl;
44 private string GridSendKey;
45 private string GridRecvKey;
46 private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
47 private ArrayList simneighbours = new ArrayList();
48 private Hashtable griddatahash;
49
50 public override Dictionary<uint, AgentCircuitData> agentcircuits
51 {
52 get { return AgentCircuits; }
53 set { AgentCircuits = value; }
54 }
55
56 public override ArrayList neighbours
57 {
58 get { return simneighbours; }
59 set { simneighbours = value; }
60 }
61
62 public override Hashtable GridData
63 {
64 get { return griddatahash; }
65 set { griddatahash = value; }
66 }
67
68
69 public RemoteGridServer()
70 {
71 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Remote Grid Server class created");
72 }
73
74 public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port)
75 {
76 Hashtable GridParams = new Hashtable();
77 GridParams["authkey"] = GridSendKey;
78 GridParams["UUID"] = SimUUID.ToString();
79 GridParams["sim_ip"] = sim_ip;
80 GridParams["sim_port"] = sim_port.ToString();
81 ArrayList SendParams = new ArrayList();
82 SendParams.Add(GridParams);
83
84 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
85 XmlRpcResponse GridResp = GridReq.Send(this.GridServerUrl, 3000);
86 Hashtable GridRespData = (Hashtable)GridResp.Value;
87 this.griddatahash = GridRespData;
88
89 if (GridRespData.ContainsKey("error"))
90 {
91 string errorstring = (string)GridRespData["error"];
92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Error connecting to grid:");
93 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, errorstring);
94 return false;
95 }
96 this.neighbours = (ArrayList)GridRespData["neighbours"];
97 Console.WriteLine(simneighbours.Count);
98 return true;
99 }
100
101 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
102 {
103 AgentCircuitData validcircuit = null;
104 if (this.AgentCircuits.ContainsKey(circuitcode))
105 {
106 validcircuit = this.AgentCircuits[circuitcode];
107 }
108 AuthenticateResponse user = new AuthenticateResponse();
109 if (validcircuit == null)
110 {
111 //don't have this circuit code in our list
112 user.Authorised = false;
113 return (user);
114 }
115
116 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
117 {
118 // YAY! Valid login
119 user.Authorised = true;
120 user.LoginInfo = new Login();
121 user.LoginInfo.Agent = agentID;
122 user.LoginInfo.Session = sessionID;
123 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
124 user.LoginInfo.First = validcircuit.firstname;
125 user.LoginInfo.Last = validcircuit.lastname;
126 }
127 else
128 {
129 // Invalid
130 user.Authorised = false;
131 }
132
133 return (user);
134 }
135
136 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
137 {
138 WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString());
139 DeleteSession.Method = "DELETE";
140 DeleteSession.ContentType = "text/plaintext";
141 DeleteSession.ContentLength = 0;
142
143 StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
144 stOut.Write("");
145 stOut.Close();
146
147 StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
148 string GridResponse = stIn.ReadToEnd();
149 stIn.Close();
150 return (true);
151 }
152
153 public override UUIDBlock RequestUUIDBlock()
154 {
155 UUIDBlock uuidBlock = new UUIDBlock();
156 return (uuidBlock);
157 }
158
159 public override NeighbourInfo[] RequestNeighbours()
160 {
161 return null;
162 }
163
164 public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY)
165 {
166 Hashtable param = new Hashtable();
167 param["xmin"] = minX;
168 param["ymin"] = minY;
169 param["xmax"] = maxX;
170 param["ymax"] = maxY;
171 IList parameters = new ArrayList();
172 parameters.Add(param);
173 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
174 XmlRpcResponse resp = req.Send(GridServerUrl, 3000);
175 Hashtable respData = (Hashtable)resp.Value;
176 return (IList)respData["sim-profiles"];
177 }
178
179 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
180 {
181 this.GridServerUrl = ServerUrl;
182 this.GridSendKey = SendKey;
183 this.GridRecvKey = RecvKey;
184 }
185
186 public override string GetName()
187 {
188 return "Remote";
189 }
190
191 public override void Close()
192 {
193
194 }
195 }
196
197 public class RemoteGridPlugin : IGridPlugin
198 {
199 public RemoteGridPlugin()
200 {
201
202 }
203
204 public IGridServer GetGridServer()
205 {
206 return (new RemoteGridServer());
207 }
208 }
209
210}