diff options
Diffstat (limited to 'OpenSim/Region/GridInterfaces/Remote')
4 files changed, 312 insertions, 0 deletions
diff --git a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs new file mode 100644 index 0000000..51596d0 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("RemoteGridServers")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("RemoteGridServers")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj new file mode 100644 index 0000000..793fde2 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj | |||
@@ -0,0 +1,107 @@ | |||
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>{98C7B681-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.Region.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.Region.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="libsecondlife.dll" > | ||
62 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Xml" > | ||
70 | <HintPath>System.Xml.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="XMLRPC.dll" > | ||
74 | <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <ProjectReference Include="..\..\..\Framework\General\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="..\..\..\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="RemoteAssetServer.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | </ItemGroup> | ||
100 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
101 | <PropertyGroup> | ||
102 | <PreBuildEvent> | ||
103 | </PreBuildEvent> | ||
104 | <PostBuildEvent> | ||
105 | </PostBuildEvent> | ||
106 | </PropertyGroup> | ||
107 | </Project> | ||
diff --git a/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.GridInterfaces.Remote.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/OpenSim.Region.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-06\NameSpaceChanges\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/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs new file mode 100644 index 0000000..ca01c68 --- /dev/null +++ b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Threading; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.IO; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Types; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | |||
40 | namespace OpenSim.GridInterfaces.Remote | ||
41 | { | ||
42 | public class RemoteAssetServer : IAssetServer | ||
43 | { | ||
44 | private IAssetReceiver _receiver; | ||
45 | private BlockingQueue<ARequest> _assetRequests; | ||
46 | private Thread _remoteAssetServerThread; | ||
47 | private string AssetServerUrl; | ||
48 | private string AssetSendKey; | ||
49 | |||
50 | public RemoteAssetServer() | ||
51 | { | ||
52 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
53 | this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
54 | this._remoteAssetServerThread.IsBackground = true; | ||
55 | this._remoteAssetServerThread.Start(); | ||
56 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Remote Asset Server class created"); | ||
57 | } | ||
58 | |||
59 | public void SetReceiver(IAssetReceiver receiver) | ||
60 | { | ||
61 | this._receiver = receiver; | ||
62 | } | ||
63 | |||
64 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
65 | { | ||
66 | ARequest req = new ARequest(); | ||
67 | req.AssetID = assetID; | ||
68 | req.IsTexture = isTexture; | ||
69 | this._assetRequests.Enqueue(req); | ||
70 | } | ||
71 | |||
72 | public void UpdateAsset(AssetBase asset) | ||
73 | { | ||
74 | |||
75 | } | ||
76 | |||
77 | public void UploadNewAsset(AssetBase asset) | ||
78 | { | ||
79 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
80 | string ret = Windows1252Encoding.GetString(asset.Data); | ||
81 | byte[] buffer = Windows1252Encoding.GetBytes(ret); | ||
82 | WebClient client = new WebClient(); | ||
83 | client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer); | ||
84 | |||
85 | } | ||
86 | |||
87 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
88 | { | ||
89 | this.AssetServerUrl = ServerUrl; | ||
90 | this.AssetSendKey = ServerKey; | ||
91 | } | ||
92 | |||
93 | private void RunRequests() | ||
94 | { | ||
95 | while (true) | ||
96 | { | ||
97 | //we need to add support for the asset server not knowing about a requested asset | ||
98 | // 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 | ||
99 | ARequest req = this._assetRequests.Dequeue(); | ||
100 | LLUUID assetID = req.AssetID; | ||
101 | // OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID); | ||
102 | WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID); | ||
103 | WebResponse AssetResponse = AssetLoad.GetResponse(); | ||
104 | byte[] idata = new byte[(int)AssetResponse.ContentLength]; | ||
105 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); | ||
106 | idata = br.ReadBytes((int)AssetResponse.ContentLength); | ||
107 | br.Close(); | ||
108 | |||
109 | AssetBase asset = new AssetBase(); | ||
110 | asset.FullID = assetID; | ||
111 | asset.Data = idata; | ||
112 | _receiver.AssetReceived(asset, req.IsTexture); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public void Close() | ||
117 | { | ||
118 | |||
119 | } | ||
120 | } | ||
121 | |||
122 | public class RemoteAssetPlugin : IAssetPlugin | ||
123 | { | ||
124 | public RemoteAssetPlugin() | ||
125 | { | ||
126 | |||
127 | } | ||
128 | |||
129 | public IAssetServer GetAssetServer() | ||
130 | { | ||
131 | return (new RemoteAssetServer()); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | } | ||