aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.GridInterfaces
diff options
context:
space:
mode:
authorgareth2007-03-22 10:11:15 +0000
committergareth2007-03-22 10:11:15 +0000
commit7daa3955bc3a1918e40962851f9e8d38597a245e (patch)
treebee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /OpenSim.GridInterfaces
parentLoad XML for neighbourinfo from grid (diff)
downloadopensim-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 '')
-rw-r--r--OpenSim.GridInterfaces/Local/AssemblyInfo.cs31
-rw-r--r--OpenSim.GridInterfaces/Local/LocalAssetServer.cs208
-rw-r--r--OpenSim.GridInterfaces/Local/LocalGridServer.cs (renamed from src/LocalServers/LocalGridServers/LocalGrid.cs)135
-rw-r--r--OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj104
-rw-r--r--OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build46
-rw-r--r--OpenSim.GridInterfaces/Remote/AssemblyInfo.cs31
-rw-r--r--OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj101
-rw-r--r--OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build45
-rw-r--r--OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs102
-rw-r--r--OpenSim.GridInterfaces/Remote/RemoteGridServer.cs156
10 files changed, 864 insertions, 95 deletions
diff --git a/OpenSim.GridInterfaces/Local/AssemblyInfo.cs b/OpenSim.GridInterfaces/Local/AssemblyInfo.cs
new file mode 100644
index 0000000..103b49a
--- /dev/null
+++ b/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.GridInterfaces/Local/LocalAssetServer.cs b/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
new file mode 100644
index 0000000..6cd954a
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
@@ -0,0 +1,208 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading;
5using System.IO;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Assets;
8using OpenSim.Framework.Utilities;
9using libsecondlife;
10using Db4objects.Db4o;
11using Db4objects.Db4o.Query;
12
13namespace OpenSim.GridInterfaces.Local
14{
15 public class LocalAssetPlugin : IAssetPlugin
16 {
17 public LocalAssetPlugin()
18 {
19
20 }
21
22 public IAssetServer GetAssetServer()
23 {
24 return (new LocalAssetServer());
25 }
26 }
27
28 public class LocalAssetServer : IAssetServer
29 {
30 private IAssetReceiver _receiver;
31 private BlockingQueue<ARequest> _assetRequests;
32 private IObjectContainer db;
33 private Thread _localAssetServerThread;
34
35 public LocalAssetServer()
36 {
37 bool yapfile;
38 this._assetRequests = new BlockingQueue<ARequest>();
39 yapfile = System.IO.File.Exists("assets.yap");
40
41 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Asset Server class created");
42 try
43 {
44 db = Db4oFactory.OpenFile("assets.yap");
45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4 Asset database creation");
46 }
47 catch (Exception e)
48 {
49 db.Close();
50 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4 Asset server :Constructor - Exception occured");
51 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
52 }
53 if (!yapfile)
54 {
55 this.SetUpAssetDatabase();
56 }
57 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
58 this._localAssetServerThread.IsBackground = true;
59 this._localAssetServerThread.Start();
60
61 }
62
63 public void SetReceiver(IAssetReceiver receiver)
64 {
65 this._receiver = receiver;
66 }
67
68 public void RequestAsset(LLUUID assetID, bool isTexture)
69 {
70 ARequest req = new ARequest();
71 req.AssetID = assetID;
72 req.IsTexture = isTexture;
73 this._assetRequests.Enqueue(req);
74 }
75
76 public void UpdateAsset(AssetBase asset)
77 {
78
79 }
80
81 public void UploadNewAsset(AssetBase asset)
82 {
83 AssetStorage store = new AssetStorage();
84 store.Data = asset.Data;
85 store.Name = asset.Name;
86 store.UUID = asset.FullID;
87 db.Set(store);
88 db.Commit();
89 }
90
91 public void SetServerInfo(string ServerUrl, string ServerKey)
92 {
93
94 }
95 public void Close()
96 {
97 if (db != null)
98 {
99 Console.WriteLine("Closing local Asset server database");
100 db.Close();
101 }
102 }
103
104 private void RunRequests()
105 {
106 while (true)
107 {
108 byte[] idata = null;
109 bool found = false;
110 AssetStorage foundAsset = null;
111 ARequest req = this._assetRequests.Dequeue();
112 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
113 if (result.Count > 0)
114 {
115 foundAsset = (AssetStorage)result.Next();
116 found = true;
117 }
118
119 AssetBase asset = new AssetBase();
120 if (found)
121 {
122 asset.FullID = foundAsset.UUID;
123 asset.Type = foundAsset.Type;
124 asset.InvType = foundAsset.Type;
125 asset.Name = foundAsset.Name;
126 idata = foundAsset.Data;
127 }
128 else
129 {
130 asset.FullID = LLUUID.Zero;
131 }
132 asset.Data = idata;
133 _receiver.AssetReceived(asset, req.IsTexture);
134 }
135
136 }
137
138 private void SetUpAssetDatabase()
139 {
140 Console.WriteLine("setting up Asset database");
141
142 AssetBase Image = new AssetBase();
143 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
144 Image.Name = "test Texture";
145 this.LoadAsset(Image, true, "testpic2.jp2");
146 AssetStorage store = new AssetStorage();
147 store.Data = Image.Data;
148 store.Name = Image.Name;
149 store.UUID = Image.FullID;
150 db.Set(store);
151 db.Commit();
152
153 Image = new AssetBase();
154 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
155 Image.Name = "test Texture2";
156 this.LoadAsset(Image, true, "map_base.jp2");
157 store = new AssetStorage();
158 store.Data = Image.Data;
159 store.Name = Image.Name;
160 store.UUID = Image.FullID;
161 db.Set(store);
162 db.Commit();
163
164 Image = new AssetBase();
165 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
166 Image.Name = "Prim Base Texture";
167 this.LoadAsset(Image, true, "testpic2.jp2");
168 store = new AssetStorage();
169 store.Data = Image.Data;
170 store.Name = Image.Name;
171 store.UUID = Image.FullID;
172 db.Set(store);
173 db.Commit();
174
175 Image = new AssetBase();
176 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
177 Image.Name = "Shape";
178 this.LoadAsset(Image, false, "base_shape.dat");
179 store = new AssetStorage();
180 store.Data = Image.Data;
181 store.Name = Image.Name;
182 store.UUID = Image.FullID;
183 db.Set(store);
184 db.Commit();
185
186
187 }
188
189 private void LoadAsset(AssetBase info, bool image, string filename)
190 {
191 //should request Asset from storage manager
192 //but for now read from file
193
194 string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
195 string fileName = Path.Combine(dataPath, filename);
196 FileInfo fInfo = new FileInfo(fileName);
197 long numBytes = fInfo.Length;
198 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
199 byte[] idata = new byte[numBytes];
200 BinaryReader br = new BinaryReader(fStream);
201 idata = br.ReadBytes((int)numBytes);
202 br.Close();
203 fStream.Close();
204 info.Data = idata;
205 //info.loaded=true;
206 }
207 }
208}
diff --git a/src/LocalServers/LocalGridServers/LocalGrid.cs b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
index bd377d3..d70e989 100644
--- a/src/LocalServers/LocalGridServers/LocalGrid.cs
+++ b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
@@ -27,10 +27,14 @@
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Threading; 29using System.Threading;
30using OpenSim.GridServers; 30using System.IO;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Assets;
31using libsecondlife; 33using libsecondlife;
34using Db4objects.Db4o;
35using Db4objects.Db4o.Query;
32 36
33namespace LocalGridServers 37namespace OpenSim.GridInterfaces.Local
34{ 38{
35 /// <summary> 39 /// <summary>
36 /// 40 ///
@@ -49,86 +53,26 @@ namespace LocalGridServers
49 } 53 }
50 } 54 }
51 55
52 public class LocalAssetPlugin : IAssetPlugin
53 {
54 public LocalAssetPlugin()
55 {
56
57 }
58
59 public IAssetServer GetAssetServer()
60 {
61 return(new LocalAssetServer());
62 }
63 }
64
65 public class LocalAssetServer : IAssetServer
66 {
67 private IAssetReceiver _receiver;
68 private BlockingQueue<ARequest> _assetRequests;
69
70 public LocalAssetServer()
71 {
72 this._assetRequests = new BlockingQueue<ARequest>();
73 ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created");
74 }
75
76 public void SetReceiver(IAssetReceiver receiver)
77 {
78 this._receiver = receiver;
79 }
80
81 public void RequestAsset(LLUUID assetID, bool isTexture)
82 {
83 ARequest req = new ARequest();
84 req.AssetID = assetID;
85 req.IsTexture = isTexture;
86 //this._assetRequests.Enqueue(req);
87 }
88
89 public void UpdateAsset(AssetBase asset)
90 {
91
92 }
93
94 public void UploadNewAsset(AssetBase asset)
95 {
96
97 }
98
99 public void SetServerInfo(string ServerUrl, string SendKey)
100 {
101
102 }
103
104 private void RunRequests()
105 {
106 while(true)
107 {
108 Thread.Sleep(1000);
109 }
110 }
111 }
112
113 public class LocalGridServer : LocalGridBase 56 public class LocalGridServer : LocalGridBase
114 { 57 {
115 public List<Login> Sessions = new List<Login>(); 58 public List<Login> Sessions = new List<Login>();
116 59
117 public LocalGridServer() 60 public LocalGridServer()
118 { 61 {
119 Sessions = new List<Login>(); 62 Sessions = new List<Login>();
120 ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); 63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Grid Server class created");
121 }
122
123 public override string GetName()
124 {
125 return "Local";
126 } 64 }
127 65
128 public override bool RequestConnection() 66 public override bool RequestConnection()
129 { 67 {
130 return true; 68 return true;
131 } 69 }
70
71 public override string GetName()
72 {
73 return "Local";
74 }
75
132 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) 76 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
133 { 77 {
134 //we are running local 78 //we are running local
@@ -159,17 +103,22 @@ namespace LocalGridServers
159 UUIDBlock uuidBlock = new UUIDBlock(); 103 UUIDBlock uuidBlock = new UUIDBlock();
160 return(uuidBlock); 104 return(uuidBlock);
161 } 105 }
162 106
163 public override neighbourinfo[] RequestNeighbours(ulong regionhandle) 107 public override NeighbourInfo[] RequestNeighbours()
164 { 108 {
165 return new neighbourinfo[8]; 109 return null;
166 } 110 }
167 111
168 public override void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey) 112 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
169 { 113 {
170 114
171 } 115 }
172 116
117 public override void Close()
118 {
119
120 }
121
173 /// <summary> 122 /// <summary>
174 /// used by the local login server to inform us of new sessions 123 /// used by the local login server to inform us of new sessions
175 /// </summary> 124 /// </summary>
@@ -182,30 +131,26 @@ namespace LocalGridServers
182 } 131 }
183 } 132 }
184 } 133 }
185
186 public class BlockingQueue< T > {
187 private Queue< T > _queue = new Queue< T >();
188 private object _queueSync = new object();
189 134
190 public void Enqueue(T value) 135 public class AssetUUIDQuery : Predicate
136 {
137 private LLUUID _findID;
138
139 public AssetUUIDQuery(LLUUID find)
191 { 140 {
192 lock(_queueSync) 141 _findID = find;
193 {
194 _queue.Enqueue(value);
195 Monitor.Pulse(_queueSync);
196 }
197 } 142 }
198 143 public bool Match(AssetStorage asset)
199 public T Dequeue()
200 { 144 {
201 lock(_queueSync) 145 return (asset.UUID == _findID);
202 {
203 if( _queue.Count < 1)
204 Monitor.Wait(_queueSync);
205
206 return _queue.Dequeue();
207 }
208 } 146 }
209 } 147 }
210 148
149 public class AssetStorage
150 {
151 public byte[] Data;
152 public sbyte Type;
153 public string Name;
154 public LLUUID UUID;
155 }
211} 156}
diff --git a/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
new file mode 100644
index 0000000..b3318af
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
@@ -0,0 +1,104 @@
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>{FBF3DA4B-5176-4602-AA52-482D077EEC88}</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 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="Db4objects.Db4o.dll" >
68 <HintPath>\Db4objects.Db4o.dll.dll</HintPath>
69 </Reference>
70 <Reference Include="libsecondlife.dll" >
71 <HintPath>\libsecondlife.dll.dll</HintPath>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
76 <Name>OpenSim.Framework</Name>
77 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 </ProjectReference>
80 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
81 <Name>OpenSim.Framework.Console</Name>
82 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
83 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
84 </ProjectReference>
85 </ItemGroup>
86 <ItemGroup>
87 <Compile Include="AssemblyInfo.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="LocalAssetServer.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="LocalGridServer.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 </ItemGroup>
97 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
98 <PropertyGroup>
99 <PreBuildEvent>
100 </PreBuildEvent>
101 <PostBuildEvent>
102 </PostBuildEvent>
103 </PropertyGroup>
104</Project>
diff --git a/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
new file mode 100644
index 0000000..eff1fac
--- /dev/null
+++ b/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.dll" />
25 <include name="../../bin/Db4objects.Db4o.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
28 <include name="../../OpenSim.Framework.Console/${build.dir}/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.GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs
new file mode 100644
index 0000000..0fa7d6e
--- /dev/null
+++ b/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.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
new file mode 100644
index 0000000..37d1d12
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
@@ -0,0 +1,101 @@
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>{2AF1E37E-064D-4590-8D7E-B6390F721BAE}</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 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="libsecondlife.dll" >
68 <HintPath>\libsecondlife.dll.dll</HintPath>
69 </Reference>
70 </ItemGroup>
71 <ItemGroup>
72 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
73 <Name>OpenSim.Framework</Name>
74 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
75 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
76 </ProjectReference>
77 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
78 <Name>OpenSim.Framework.Console</Name>
79 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
80 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
81 </ProjectReference>
82 </ItemGroup>
83 <ItemGroup>
84 <Compile Include="AssemblyInfo.cs">
85 <SubType>Code</SubType>
86 </Compile>
87 <Compile Include="RemoteAssetServer.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="RemoteGridServer.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 </ItemGroup>
94 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
95 <PropertyGroup>
96 <PreBuildEvent>
97 </PreBuildEvent>
98 <PostBuildEvent>
99 </PostBuildEvent>
100 </PropertyGroup>
101</Project>
diff --git a/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
new file mode 100644
index 0000000..e0d24ff
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
@@ -0,0 +1,45 @@
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.dll" />
25 <include name="../../bin/libsecondlife.dll" />
26 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
27 <include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
28 </references>
29 </csc>
30 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
31 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
32 <copy todir="${project::get-base-directory()}/../../bin/">
33 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
34 <include name="*.dll"/>
35 <include name="*.exe"/>
36 </fileset>
37 </copy>
38 </target>
39 <target name="clean">
40 <delete dir="${bin.dir}" failonerror="false" />
41 <delete dir="${obj.dir}" failonerror="false" />
42 </target>
43 <target name="doc" description="Creates documentation.">
44 </target>
45</project>
diff --git a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
new file mode 100644
index 0000000..528e9fa
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
@@ -0,0 +1,102 @@
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.Assets;
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("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
53 }
54
55 public void SetServerInfo(string ServerUrl, string ServerKey)
56 {
57 this.AssetServerUrl = ServerUrl;
58 this.AssetSendKey = ServerKey;
59 }
60
61 private void RunRequests()
62 {
63 while (true)
64 {
65 //we need to add support for the asset server not knowing about a requested asset
66 ARequest req = this._assetRequests.Dequeue();
67 LLUUID assetID = req.AssetID;
68 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
69 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
70 WebResponse AssetResponse = AssetLoad.GetResponse();
71 byte[] idata = new byte[(int)AssetResponse.ContentLength];
72 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
73 idata = br.ReadBytes((int)AssetResponse.ContentLength);
74 br.Close();
75
76 AssetBase asset = new AssetBase();
77 asset.FullID = assetID;
78 asset.Data = idata;
79 _receiver.AssetReceived(asset, req.IsTexture);
80 }
81 }
82
83 public void Close()
84 {
85
86 }
87 }
88
89 public class RemoteAssetPlugin : IAssetPlugin
90 {
91 public RemoteAssetPlugin()
92 {
93
94 }
95
96 public IAssetServer GetAssetServer()
97 {
98 return (new RemoteAssetServer());
99 }
100 }
101
102}
diff --git a/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs b/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
new file mode 100644
index 0000000..5f48916
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
@@ -0,0 +1,156 @@
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.Framework.Interfaces;
35using OpenSim.Framework.Assets;
36
37namespace OpenSim.GridInterfaces.Remote
38{
39 public class RemoteGridServer : RemoteGridBase
40 {
41 private string GridServerUrl;
42 private string GridSendKey;
43 private string GridRecvKey;
44 private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
45
46 public override Dictionary<uint, AgentCircuitData> agentcircuits
47 {
48 get { return AgentCircuits; }
49 set { AgentCircuits = value; }
50 }
51
52 public RemoteGridServer()
53 {
54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Grid Server class created");
55 }
56
57 public override bool RequestConnection()
58 {
59 return true;
60 }
61
62 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
63 {
64 AgentCircuitData validcircuit = null;
65 if (this.AgentCircuits.ContainsKey(circuitcode))
66 {
67 validcircuit = this.AgentCircuits[circuitcode];
68 }
69 AuthenticateResponse user = new AuthenticateResponse();
70 if (validcircuit == null)
71 {
72 //don't have this circuit code in our list
73 user.Authorised = false;
74 return (user);
75 }
76
77 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
78 {
79 // YAY! Valid login
80 user.Authorised = true;
81 user.LoginInfo = new Login();
82 user.LoginInfo.Agent = agentID;
83 user.LoginInfo.Session = sessionID;
84 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
85 user.LoginInfo.First = validcircuit.firstname;
86 user.LoginInfo.Last = validcircuit.lastname;
87 }
88 else
89 {
90 // Invalid
91 user.Authorised = false;
92 }
93
94 return (user);
95 }
96
97 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
98 {
99 WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString());
100 DeleteSession.Method = "DELETE";
101 DeleteSession.ContentType = "text/plaintext";
102 DeleteSession.ContentLength = 0;
103
104 StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
105 stOut.Write("");
106 stOut.Close();
107
108 StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
109 string GridResponse = stIn.ReadToEnd();
110 stIn.Close();
111 return (true);
112 }
113
114 public override UUIDBlock RequestUUIDBlock()
115 {
116 UUIDBlock uuidBlock = new UUIDBlock();
117 return (uuidBlock);
118 }
119
120 public override NeighbourInfo[] RequestNeighbours()
121 {
122 return null;
123 }
124
125 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
126 {
127 this.GridServerUrl = ServerUrl;
128 this.GridSendKey = SendKey;
129 this.GridRecvKey = RecvKey;
130 }
131
132 public override string GetName()
133 {
134 return "Remote";
135 }
136
137 public override void Close()
138 {
139
140 }
141 }
142
143 public class RemoteGridPlugin : IGridPlugin
144 {
145 public RemoteGridPlugin()
146 {
147
148 }
149
150 public IGridServer GetGridServer()
151 {
152 return (new RemoteGridServer());
153 }
154 }
155
156}