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