aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.GridInterfaces
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.GridInterfaces')
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs20
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs158
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj3
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build1
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj3
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build1
-rw-r--r--OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs211
7 files changed, 17 insertions, 380 deletions
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
index ae394c4..70b14c2 100644
--- a/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
+++ b/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
@@ -66,16 +66,16 @@ namespace OpenSim.GridInterfaces.Local
66 this._assetRequests = new BlockingQueue<ARequest>(); 66 this._assetRequests = new BlockingQueue<ARequest>();
67 yapfile = System.IO.File.Exists("assets.yap"); 67 yapfile = System.IO.File.Exists("assets.yap");
68 68
69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"Local Asset Server class created"); 69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "Local Asset Server class created");
70 try 70 try
71 { 71 {
72 db = Db4oFactory.OpenFile("assets.yap"); 72 db = Db4oFactory.OpenFile("assets.yap");
73 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"Db4 Asset database creation"); 73 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "Db4 Asset database creation");
74 } 74 }
75 catch (Exception e) 75 catch (Exception e)
76 { 76 {
77 db.Close(); 77 db.Close();
78 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM,"Db4 Asset server :Constructor - Exception occured"); 78 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured");
79 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString()); 79 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
80 } 80 }
81 if (!yapfile) 81 if (!yapfile)
@@ -295,4 +295,18 @@ namespace OpenSim.GridInterfaces.Local
295 //info.loaded=true; 295 //info.loaded=true;
296 } 296 }
297 } 297 }
298 public class AssetUUIDQuery : Predicate
299 {
300 private LLUUID _findID;
301
302 public AssetUUIDQuery(LLUUID find)
303 {
304 _findID = find;
305 }
306 public bool Match(AssetStorage asset)
307 {
308 return (asset.UUID == _findID);
309 }
310 }
311
298} 312}
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs
deleted file mode 100644
index 01003fb..0000000
--- a/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs
+++ /dev/null
@@ -1,158 +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*/
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using System.IO;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types;
34using OpenSim.Framework.Console;
35using libsecondlife;
36using Db4objects.Db4o;
37using Db4objects.Db4o.Query;
38using System.Collections;
39
40namespace OpenSim.GridInterfaces.Local
41{
42 /// <summary>
43 ///
44 /// </summary>
45 ///
46 public class LocalGridPlugin : IGridPlugin
47 {
48 public LocalGridPlugin()
49 {
50
51 }
52
53 public IGridServer GetGridServer()
54 {
55 return(new LocalGridServer());
56 }
57 }
58
59 public class LocalGridServer : LocalGridBase
60 {
61 public List<Login> Sessions = new List<Login>();
62
63 public LocalGridServer()
64 {
65 Sessions = new List<Login>();
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"Local Grid Server class created");
67 }
68
69 public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port)
70 {
71 return true;
72 }
73
74 public override string GetName()
75 {
76 return "Local";
77 }
78
79 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
80 {
81 //we are running local
82 AuthenticateResponse user = new AuthenticateResponse();
83
84 lock(this.Sessions)
85 {
86
87 for(int i = 0; i < Sessions.Count; i++)
88 {
89 if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID))
90 {
91 user.Authorised = true;
92 user.LoginInfo = Sessions[i];
93 }
94 }
95 }
96 return(user);
97 }
98
99 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
100 {
101 return(true);
102 }
103
104 public override UUIDBlock RequestUUIDBlock()
105 {
106 UUIDBlock uuidBlock = new UUIDBlock();
107 return(uuidBlock);
108 }
109
110 public override NeighbourInfo[] RequestNeighbours()
111 {
112 return null;
113 }
114
115 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
116 {
117
118 }
119
120 public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY)
121 {
122 return new ArrayList();
123 }
124
125
126 public override void Close()
127 {
128
129 }
130
131 /// <summary>
132 /// used by the local login server to inform us of new sessions
133 /// </summary>
134 /// <param name="session"></param>
135 public override void AddNewSession(Login session)
136 {
137 lock(this.Sessions)
138 {
139 this.Sessions.Add(session);
140 }
141 }
142 }
143
144 public class AssetUUIDQuery : Predicate
145 {
146 private LLUUID _findID;
147
148 public AssetUUIDQuery(LLUUID find)
149 {
150 _findID = find;
151 }
152 public bool Match(AssetStorage asset)
153 {
154 return (asset.UUID == _findID);
155 }
156 }
157
158}
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
index 1acd1b5..77c76e3 100644
--- a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
+++ b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
@@ -96,9 +96,6 @@
96 <Compile Include="LocalAssetServer.cs"> 96 <Compile Include="LocalAssetServer.cs">
97 <SubType>Code</SubType> 97 <SubType>Code</SubType>
98 </Compile> 98 </Compile>
99 <Compile Include="LocalGridServer.cs">
100 <SubType>Code</SubType>
101 </Compile>
102 </ItemGroup> 99 </ItemGroup>
103 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 100 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
104 <PropertyGroup> 101 <PropertyGroup>
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
index c3c4ae4..1a72d0a 100644
--- a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
+++ b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
@@ -13,7 +13,6 @@
13 <sources failonempty="true"> 13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" /> 14 <include name="AssemblyInfo.cs" />
15 <include name="LocalAssetServer.cs" /> 15 <include name="LocalAssetServer.cs" />
16 <include name="LocalGridServer.cs" />
17 </sources> 16 </sources>
18 <references basedir="${project::get-base-directory()}"> 17 <references basedir="${project::get-base-directory()}">
19 <lib> 18 <lib>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
index 11aacac..0a918bd 100644
--- a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
@@ -98,9 +98,6 @@
98 <Compile Include="RemoteAssetServer.cs"> 98 <Compile Include="RemoteAssetServer.cs">
99 <SubType>Code</SubType> 99 <SubType>Code</SubType>
100 </Compile> 100 </Compile>
101 <Compile Include="RemoteGridServer.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 </ItemGroup> 101 </ItemGroup>
105 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 102 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
106 <PropertyGroup> 103 <PropertyGroup>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
index 860251f..7c3eb68 100644
--- a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
+++ b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
@@ -13,7 +13,6 @@
13 <sources failonempty="true"> 13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" /> 14 <include name="AssemblyInfo.cs" />
15 <include name="RemoteAssetServer.cs" /> 15 <include name="RemoteAssetServer.cs" />
16 <include name="RemoteGridServer.cs" />
17 </sources> 16 </sources>
18 <references basedir="${project::get-base-directory()}"> 17 <references basedir="${project::get-base-directory()}">
19 <lib> 18 <lib>
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
deleted file mode 100644
index 19f8f7d..0000000
--- a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
+++ /dev/null
@@ -1,211 +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*/
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Threading;
32using System.Net;
33using System.Net.Sockets;
34using System.IO;
35using libsecondlife;
36using Nwc.XmlRpc;
37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Types;
39
40namespace OpenSim.GridInterfaces.Remote
41{
42 public class RemoteGridServer : RemoteGridBase
43 {
44 private string GridServerUrl;
45 private string GridSendKey;
46 private string GridRecvKey;
47 private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
48 private ArrayList simneighbours = new ArrayList();
49 private Hashtable griddatahash;
50
51 public override Dictionary<uint, AgentCircuitData> agentcircuits
52 {
53 get { return AgentCircuits; }
54 set { AgentCircuits = value; }
55 }
56
57 public override ArrayList neighbours
58 {
59 get { return simneighbours; }
60 set { simneighbours = value; }
61 }
62
63 public override Hashtable GridData
64 {
65 get { return griddatahash; }
66 set { griddatahash = value; }
67 }
68
69
70 public RemoteGridServer()
71 {
72 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Remote Grid Server class created");
73 }
74
75 public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port)
76 {
77 Hashtable GridParams = new Hashtable();
78 GridParams["authkey"] = GridSendKey;
79 GridParams["UUID"] = SimUUID.ToString();
80 GridParams["sim_ip"] = sim_ip;
81 GridParams["sim_port"] = sim_port.ToString();
82 ArrayList SendParams = new ArrayList();
83 SendParams.Add(GridParams);
84
85 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
86 XmlRpcResponse GridResp = GridReq.Send(this.GridServerUrl, 3000);
87 Hashtable GridRespData = (Hashtable)GridResp.Value;
88 this.griddatahash = GridRespData;
89
90 if (GridRespData.ContainsKey("error"))
91 {
92 string errorstring = (string)GridRespData["error"];
93 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Error connecting to grid:");
94 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, errorstring);
95 return false;
96 }
97 this.neighbours = (ArrayList)GridRespData["neighbours"];
98 Console.WriteLine(simneighbours.Count);
99 return true;
100 }
101
102 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
103 {
104 AgentCircuitData validcircuit = null;
105 if (this.AgentCircuits.ContainsKey(circuitcode))
106 {
107 validcircuit = this.AgentCircuits[circuitcode];
108 }
109 AuthenticateResponse user = new AuthenticateResponse();
110 if (validcircuit == null)
111 {
112 //don't have this circuit code in our list
113 user.Authorised = false;
114 return (user);
115 }
116
117 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
118 {
119 // YAY! Valid login
120 user.Authorised = true;
121 user.LoginInfo = new Login();
122 user.LoginInfo.Agent = agentID;
123 user.LoginInfo.Session = sessionID;
124 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
125 user.LoginInfo.First = validcircuit.firstname;
126 user.LoginInfo.Last = validcircuit.lastname;
127 }
128 else
129 {
130 // Invalid
131 user.Authorised = false;
132 }
133
134 return (user);
135 }
136
137 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
138 {
139 WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString());
140 DeleteSession.Method = "DELETE";
141 DeleteSession.ContentType = "text/plaintext";
142 DeleteSession.ContentLength = 0;
143
144 StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
145 stOut.Write("");
146 stOut.Close();
147
148 StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
149 string GridResponse = stIn.ReadToEnd();
150 stIn.Close();
151 return (true);
152 }
153
154 public override UUIDBlock RequestUUIDBlock()
155 {
156 UUIDBlock uuidBlock = new UUIDBlock();
157 return (uuidBlock);
158 }
159
160 public override NeighbourInfo[] RequestNeighbours()
161 {
162 return null;
163 }
164
165 public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY)
166 {
167 Hashtable param = new Hashtable();
168 param["xmin"] = minX;
169 param["ymin"] = minY;
170 param["xmax"] = maxX;
171 param["ymax"] = maxY;
172 IList parameters = new ArrayList();
173 parameters.Add(param);
174 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
175 XmlRpcResponse resp = req.Send(GridServerUrl, 3000);
176 Hashtable respData = (Hashtable)resp.Value;
177 return (IList)respData["sim-profiles"];
178 }
179
180 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
181 {
182 this.GridServerUrl = ServerUrl;
183 this.GridSendKey = SendKey;
184 this.GridRecvKey = RecvKey;
185 }
186
187 public override string GetName()
188 {
189 return "Remote";
190 }
191
192 public override void Close()
193 {
194
195 }
196 }
197
198 public class RemoteGridPlugin : IGridPlugin
199 {
200 public RemoteGridPlugin()
201 {
202
203 }
204
205 public IGridServer GetGridServer()
206 {
207 return (new RemoteGridServer());
208 }
209 }
210
211}