diff options
Diffstat (limited to 'src/LocalServers/LocalGridServers')
4 files changed, 292 insertions, 0 deletions
diff --git a/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/src/LocalServers/LocalGridServers/AssemblyInfo.cs new file mode 100644 index 0000000..103b49a --- /dev/null +++ b/src/LocalServers/LocalGridServers/AssemblyInfo.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using 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/src/LocalServers/LocalGridServers/LocalGrid.cs b/src/LocalServers/LocalGridServers/LocalGrid.cs new file mode 100644 index 0000000..5adce27 --- /dev/null +++ b/src/LocalServers/LocalGridServers/LocalGrid.cs | |||
@@ -0,0 +1,205 @@ | |||
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 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Threading; | ||
30 | using OpenSim.GridServers; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace LocalGridServers | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | /// | ||
39 | public class LocalGridPlugin : IGridPlugin | ||
40 | { | ||
41 | public LocalGridPlugin() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public IGridServer GetGridServer() | ||
47 | { | ||
48 | return(new LocalGridServer()); | ||
49 | } | ||
50 | } | ||
51 | |||
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 ServerKey) | ||
100 | { | ||
101 | |||
102 | } | ||
103 | |||
104 | private void RunRequests() | ||
105 | { | ||
106 | while(true) | ||
107 | { | ||
108 | |||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public class LocalGridServer :IGridServer | ||
114 | { | ||
115 | public List<Login> Sessions = new List<Login>(); | ||
116 | |||
117 | public LocalGridServer() | ||
118 | { | ||
119 | Sessions = new List<Login>(); | ||
120 | ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); | ||
121 | } | ||
122 | |||
123 | public bool RequestConnection() | ||
124 | { | ||
125 | return true; | ||
126 | } | ||
127 | public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
128 | { | ||
129 | //we are running local | ||
130 | AuthenticateResponse user = new AuthenticateResponse(); | ||
131 | |||
132 | lock(this.Sessions) | ||
133 | { | ||
134 | |||
135 | for(int i = 0; i < Sessions.Count; i++) | ||
136 | { | ||
137 | if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID)) | ||
138 | { | ||
139 | user.Authorised = true; | ||
140 | user.LoginInfo = Sessions[i]; | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | return(user); | ||
145 | } | ||
146 | |||
147 | public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
148 | { | ||
149 | return(true); | ||
150 | } | ||
151 | |||
152 | public UUIDBlock RequestUUIDBlock() | ||
153 | { | ||
154 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
155 | return(uuidBlock); | ||
156 | } | ||
157 | |||
158 | public void RequestNeighbours() | ||
159 | { | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
164 | { | ||
165 | |||
166 | } | ||
167 | /// <summary> | ||
168 | /// used by the local login server to inform us of new sessions | ||
169 | /// </summary> | ||
170 | /// <param name="session"></param> | ||
171 | public void AddNewSession(Login session) | ||
172 | { | ||
173 | lock(this.Sessions) | ||
174 | { | ||
175 | this.Sessions.Add(session); | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | public class BlockingQueue< T > { | ||
181 | private Queue< T > _queue = new Queue< T >(); | ||
182 | private object _queueSync = new object(); | ||
183 | |||
184 | public void Enqueue(T value) | ||
185 | { | ||
186 | lock(_queueSync) | ||
187 | { | ||
188 | _queue.Enqueue(value); | ||
189 | Monitor.Pulse(_queueSync); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | public T Dequeue() | ||
194 | { | ||
195 | lock(_queueSync) | ||
196 | { | ||
197 | if( _queue.Count < 1) | ||
198 | Monitor.Wait(_queueSync); | ||
199 | |||
200 | return _queue.Dequeue(); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | } | ||
diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.csproj b/src/LocalServers/LocalGridServers/LocalGridServers.csproj new file mode 100644 index 0000000..dc9c566 --- /dev/null +++ b/src/LocalServers/LocalGridServers/LocalGridServers.csproj | |||
@@ -0,0 +1,49 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>LocalGridServers</RootNamespace> | ||
5 | <AssemblyName>LocalGridServers</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="libsecondlife"> | ||
30 | <HintPath>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="LocalGrid.cs" /> | ||
36 | <Compile Include="AssemblyInfo.cs" /> | ||
37 | </ItemGroup> | ||
38 | <ItemGroup> | ||
39 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
40 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
41 | <Name>ServerConsole</Name> | ||
42 | </ProjectReference> | ||
43 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
44 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
45 | <Name>GridInterfaces</Name> | ||
46 | </ProjectReference> | ||
47 | </ItemGroup> | ||
48 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
49 | </Project> \ No newline at end of file | ||
diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.sln b/src/LocalServers/LocalGridServers/LocalGridServers.sln new file mode 100644 index 0000000..659e1d5 --- /dev/null +++ b/src/LocalServers/LocalGridServers/LocalGridServers.sln | |||
@@ -0,0 +1,7 @@ | |||
1 | | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # SharpDevelop 2.1.0.2017 | ||
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" | ||
5 | EndProject | ||
6 | Global | ||
7 | EndGlobal | ||