aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.GridInterfaces/Local/LocalGridServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.GridInterfaces/Local/LocalGridServer.cs')
-rw-r--r--OpenSim.GridInterfaces/Local/LocalGridServer.cs156
1 files changed, 156 insertions, 0 deletions
diff --git a/OpenSim.GridInterfaces/Local/LocalGridServer.cs b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
new file mode 100644
index 0000000..d70e989
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/LocalGridServer.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.IO;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Assets;
33using libsecondlife;
34using Db4objects.Db4o;
35using Db4objects.Db4o.Query;
36
37namespace OpenSim.GridInterfaces.Local
38{
39 /// <summary>
40 ///
41 /// </summary>
42 ///
43 public class LocalGridPlugin : IGridPlugin
44 {
45 public LocalGridPlugin()
46 {
47
48 }
49
50 public IGridServer GetGridServer()
51 {
52 return(new LocalGridServer());
53 }
54 }
55
56 public class LocalGridServer : LocalGridBase
57 {
58 public List<Login> Sessions = new List<Login>();
59
60 public LocalGridServer()
61 {
62 Sessions = new List<Login>();
63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Grid Server class created");
64 }
65
66 public override bool RequestConnection()
67 {
68 return true;
69 }
70
71 public override string GetName()
72 {
73 return "Local";
74 }
75
76 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
77 {
78 //we are running local
79 AuthenticateResponse user = new AuthenticateResponse();
80
81 lock(this.Sessions)
82 {
83
84 for(int i = 0; i < Sessions.Count; i++)
85 {
86 if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID))
87 {
88 user.Authorised = true;
89 user.LoginInfo = Sessions[i];
90 }
91 }
92 }
93 return(user);
94 }
95
96 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
97 {
98 return(true);
99 }
100
101 public override UUIDBlock RequestUUIDBlock()
102 {
103 UUIDBlock uuidBlock = new UUIDBlock();
104 return(uuidBlock);
105 }
106
107 public override NeighbourInfo[] RequestNeighbours()
108 {
109 return null;
110 }
111
112 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
113 {
114
115 }
116
117 public override void Close()
118 {
119
120 }
121
122 /// <summary>
123 /// used by the local login server to inform us of new sessions
124 /// </summary>
125 /// <param name="session"></param>
126 public override void AddNewSession(Login session)
127 {
128 lock(this.Sessions)
129 {
130 this.Sessions.Add(session);
131 }
132 }
133 }
134
135 public class AssetUUIDQuery : Predicate
136 {
137 private LLUUID _findID;
138
139 public AssetUUIDQuery(LLUUID find)
140 {
141 _findID = find;
142 }
143 public bool Match(AssetStorage asset)
144 {
145 return (asset.UUID == _findID);
146 }
147 }
148
149 public class AssetStorage
150 {
151 public byte[] Data;
152 public sbyte Type;
153 public string Name;
154 public LLUUID UUID;
155 }
156}