diff options
Diffstat (limited to 'OpenSim/OpenSim.GridInterfaces/Remote')
5 files changed, 0 insertions, 563 deletions
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs deleted file mode 100644 index 51596d0..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
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/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj deleted file mode 100644 index 11aacac..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
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="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 | </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.dll.build b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build deleted file mode 100644 index 860251f..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
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="../../../bin/libsecondlife.dll" /> | ||
24 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
25 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
26 | <include name="System.dll" /> | ||
27 | <include name="System.Xml.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 deleted file mode 100644 index 550fec6..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
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.MainConsole.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.MainConsole.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 | } | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs deleted file mode 100644 index 7c93d43..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Threading; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.IO; | ||
35 | using libsecondlife; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Console; | ||
40 | |||
41 | namespace OpenSim.GridInterfaces.Remote | ||
42 | { | ||
43 | public class RemoteGridServer : RemoteGridBase | ||
44 | { | ||
45 | private string GridServerUrl; | ||
46 | private string GridSendKey; | ||
47 | private string GridRecvKey; | ||
48 | private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); | ||
49 | private ArrayList simneighbours = new ArrayList(); | ||
50 | private Hashtable griddatahash; | ||
51 | |||
52 | public override Dictionary<uint, AgentCircuitData> agentcircuits | ||
53 | { | ||
54 | get { return AgentCircuits; } | ||
55 | set { AgentCircuits = value; } | ||
56 | } | ||
57 | |||
58 | public override ArrayList neighbours | ||
59 | { | ||
60 | get { return simneighbours; } | ||
61 | set { simneighbours = value; } | ||
62 | } | ||
63 | |||
64 | public override Hashtable GridData | ||
65 | { | ||
66 | get { return griddatahash; } | ||
67 | set { griddatahash = value; } | ||
68 | } | ||
69 | |||
70 | |||
71 | public RemoteGridServer() | ||
72 | { | ||
73 | MainConsole.Instance.Notice("Remote Grid Server class created"); | ||
74 | } | ||
75 | |||
76 | public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port) | ||
77 | { | ||
78 | Hashtable GridParams = new Hashtable(); | ||
79 | GridParams["authkey"] = GridSendKey; | ||
80 | GridParams["UUID"] = SimUUID.ToString(); | ||
81 | GridParams["sim_ip"] = sim_ip; | ||
82 | GridParams["sim_port"] = sim_port.ToString(); | ||
83 | ArrayList SendParams = new ArrayList(); | ||
84 | SendParams.Add(GridParams); | ||
85 | |||
86 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
87 | XmlRpcResponse GridResp = GridReq.Send(this.GridServerUrl, 3000); | ||
88 | Hashtable GridRespData = (Hashtable)GridResp.Value; | ||
89 | this.griddatahash = GridRespData; | ||
90 | |||
91 | if (GridRespData.ContainsKey("error")) | ||
92 | { | ||
93 | string errorstring = (string)GridRespData["error"]; | ||
94 | MainConsole.Instance.Warn("Error connecting to grid:"); | ||
95 | MainConsole.Instance.Warn(errorstring); | ||
96 | return false; | ||
97 | } | ||
98 | this.neighbours = (ArrayList)GridRespData["neighbours"]; | ||
99 | Console.WriteLine(simneighbours.Count); | ||
100 | return true; | ||
101 | } | ||
102 | |||
103 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
104 | { | ||
105 | AgentCircuitData validcircuit = null; | ||
106 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
107 | { | ||
108 | validcircuit = this.AgentCircuits[circuitcode]; | ||
109 | } | ||
110 | AuthenticateResponse user = new AuthenticateResponse(); | ||
111 | if (validcircuit == null) | ||
112 | { | ||
113 | //don't have this circuit code in our list | ||
114 | user.Authorised = false; | ||
115 | return (user); | ||
116 | } | ||
117 | |||
118 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) | ||
119 | { | ||
120 | // YAY! Valid login | ||
121 | user.Authorised = true; | ||
122 | user.LoginInfo = new Login(); | ||
123 | user.LoginInfo.Agent = agentID; | ||
124 | user.LoginInfo.Session = sessionID; | ||
125 | user.LoginInfo.SecureSession = validcircuit.SecureSessionID; | ||
126 | user.LoginInfo.First = validcircuit.firstname; | ||
127 | user.LoginInfo.Last = validcircuit.lastname; | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | // Invalid | ||
132 | user.Authorised = false; | ||
133 | } | ||
134 | |||
135 | return (user); | ||
136 | } | ||
137 | |||
138 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
139 | { | ||
140 | WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString()); | ||
141 | DeleteSession.Method = "DELETE"; | ||
142 | DeleteSession.ContentType = "text/plaintext"; | ||
143 | DeleteSession.ContentLength = 0; | ||
144 | |||
145 | StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII); | ||
146 | stOut.Write(""); | ||
147 | stOut.Close(); | ||
148 | |||
149 | StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream()); | ||
150 | string GridResponse = stIn.ReadToEnd(); | ||
151 | stIn.Close(); | ||
152 | return (true); | ||
153 | } | ||
154 | |||
155 | public override UUIDBlock RequestUUIDBlock() | ||
156 | { | ||
157 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
158 | return (uuidBlock); | ||
159 | } | ||
160 | |||
161 | public override NeighbourInfo[] RequestNeighbours() | ||
162 | { | ||
163 | return null; | ||
164 | } | ||
165 | |||
166 | public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY) | ||
167 | { | ||
168 | Hashtable param = new Hashtable(); | ||
169 | param["xmin"] = minX; | ||
170 | param["ymin"] = minY; | ||
171 | param["xmax"] = maxX; | ||
172 | param["ymax"] = maxY; | ||
173 | IList parameters = new ArrayList(); | ||
174 | parameters.Add(param); | ||
175 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); | ||
176 | XmlRpcResponse resp = req.Send(GridServerUrl, 3000); | ||
177 | Hashtable respData = (Hashtable)resp.Value; | ||
178 | return (IList)respData["sim-profiles"]; | ||
179 | } | ||
180 | |||
181 | public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) | ||
182 | { | ||
183 | this.GridServerUrl = ServerUrl; | ||
184 | this.GridSendKey = SendKey; | ||
185 | this.GridRecvKey = RecvKey; | ||
186 | } | ||
187 | |||
188 | public override string GetName() | ||
189 | { | ||
190 | return "Remote"; | ||
191 | } | ||
192 | |||
193 | public override void Close() | ||
194 | { | ||
195 | |||
196 | } | ||
197 | } | ||
198 | |||
199 | public class RemoteGridPlugin : IGridPlugin | ||
200 | { | ||
201 | public RemoteGridPlugin() | ||
202 | { | ||
203 | |||
204 | } | ||
205 | |||
206 | public IGridServer GetGridServer() | ||
207 | { | ||
208 | return (new RemoteGridServer()); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | } | ||