diff options
author | gareth | 2007-04-30 02:48:05 +0000 |
---|---|---|
committer | gareth | 2007-04-30 02:48:05 +0000 |
commit | 002336e95c928405394c18eb7d7e77e7b15bd259 (patch) | |
tree | df9b61f3555866623bf8b2ddcd500914766f2f59 | |
parent | Copied gridserver ready to convert to asset server (diff) | |
download | opensim-SC_OLD-002336e95c928405394c18eb7d7e77e7b15bd259.zip opensim-SC_OLD-002336e95c928405394c18eb7d7e77e7b15bd259.tar.gz opensim-SC_OLD-002336e95c928405394c18eb7d7e77e7b15bd259.tar.bz2 opensim-SC_OLD-002336e95c928405394c18eb7d7e77e7b15bd259.tar.xz |
Done some more conversion work on the asset server
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices.AssetServer/Main.cs | 108 | ||||
-rw-r--r-- | OpenGridServices.AssetServer/Properties/AssemblyInfo.cs | 6 | ||||
-rw-r--r-- | OpenGridServices.AssetServer/SimProfiles.cs | 328 | ||||
-rw-r--r-- | OpenSim.Framework/OpenSim.Framework.dll.build | 1 | ||||
-rw-r--r-- | OpenSim.GridInterfaces/Local/LocalGridServer.cs | 9 | ||||
-rw-r--r-- | OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs | 7 | ||||
-rw-r--r-- | OpenSim.build | 3 | ||||
-rw-r--r-- | prebuild.xml | 29 |
8 files changed, 64 insertions, 427 deletions
diff --git a/OpenGridServices.AssetServer/Main.cs b/OpenGridServices.AssetServer/Main.cs index 69cba9c..473c483 100644 --- a/OpenGridServices.AssetServer/Main.cs +++ b/OpenGridServices.AssetServer/Main.cs | |||
@@ -37,24 +37,20 @@ using libsecondlife; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Sims; | 38 | using OpenSim.Framework.Sims; |
39 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | using OpenSim.Framework.Interfaces; | 40 | using OpenSim.Framework.Interfaces; |
41 | using OpenSim.GridInterfaces.Local; // REFACTORING IS NEEDED!!!!!!!!!!! | ||
41 | using OpenSim.Servers; | 42 | using OpenSim.Servers; |
42 | 43 | ||
43 | namespace OpenGridServices.GridServer | 44 | namespace OpenGridServices.AssetServer |
44 | { | 45 | { |
45 | /// <summary> | 46 | /// <summary> |
46 | /// </summary> | 47 | /// </summary> |
47 | public class OpenGrid_Main : BaseServer, conscmd_callback | 48 | public class OpenAsset_Main : BaseServer, conscmd_callback |
48 | { | 49 | { |
49 | private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; | 50 | private IObjectContainer db; |
50 | public GridConfig Cfg; | ||
51 | 51 | ||
52 | public static OpenGrid_Main thegrid; | 52 | public static OpenAsset_Main assetserver; |
53 | 53 | ||
54 | //public LLUUID highestUUID; | ||
55 | |||
56 | private SimProfileManager m_simProfileManager; | ||
57 | |||
58 | private ConsoleBase m_console; | 54 | private ConsoleBase m_console; |
59 | 55 | ||
60 | [STAThread] | 56 | [STAThread] |
@@ -62,10 +58,10 @@ namespace OpenGridServices.GridServer | |||
62 | { | 58 | { |
63 | Console.WriteLine("Starting...\n"); | 59 | Console.WriteLine("Starting...\n"); |
64 | 60 | ||
65 | thegrid = new OpenGrid_Main(); | 61 | assetserver = new OpenAsset_Main(); |
66 | thegrid.Startup(); | 62 | assetserver.Startup(); |
67 | 63 | ||
68 | thegrid.Work(); | 64 | assetserver.Work(); |
69 | } | 65 | } |
70 | 66 | ||
71 | private void Work() | 67 | private void Work() |
@@ -78,57 +74,34 @@ namespace OpenGridServices.GridServer | |||
78 | } | 74 | } |
79 | } | 75 | } |
80 | 76 | ||
81 | private OpenGrid_Main() | 77 | private OpenAsset_Main() |
82 | { | 78 | { |
83 | m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false); | 79 | m_console = new ConsoleBase("opengrid-AssetServer-console.log", "OpenGrid", this, false); |
84 | MainConsole.Instance = m_console; | 80 | MainConsole.Instance = m_console; |
85 | } | 81 | } |
86 | 82 | ||
87 | public void Startup() | 83 | public void Startup() |
88 | { | 84 | { |
89 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); | 85 | /*m_console.WriteLine("Main.cs:Startup() - Loading configuration"); |
90 | Cfg = this.LoadConfigDll(this.ConfigDll); | 86 | Cfg = this.LoadConfigDll(this.ConfigDll); |
91 | Cfg.InitConfig(); | 87 | Cfg.InitConfig(); */ |
92 | 88 | ||
93 | m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database"); | ||
94 | m_simProfileManager = new SimProfileManager( this ); | ||
95 | m_simProfileManager.LoadProfiles(); | ||
96 | 89 | ||
97 | m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); | 90 | m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); |
98 | BaseHttpServer httpServer = new BaseHttpServer(8001); | 91 | BaseHttpServer httpServer = new BaseHttpServer(8003); |
99 | |||
100 | httpServer.AddXmlRPCHandler("simulator_login", m_simProfileManager.XmlRpcLoginToSimulatorMethod); | ||
101 | 92 | ||
102 | httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod); | 93 | /*httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod); |
103 | httpServer.AddRestHandler("POST", "/sims/", m_simProfileManager.RestSetSimMethod); | 94 | httpServer.AddRestHandler("POST", "/sims/", m_simProfileManager.RestSetSimMethod); |
104 | httpServer.AddRestHandler("GET", "/regions/", m_simProfileManager.RestGetRegionMethod); | 95 | httpServer.AddRestHandler("GET", "/regions/", m_simProfileManager.RestGetRegionMethod); |
105 | httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod); | 96 | httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod); */ |
106 | 97 | httpServer.AddRestHAndler("GET", "/assets/", this.assetGetMethod); | |
107 | |||
108 | // lbsa71 : This code snippet taken from old http server. | ||
109 | // I have no idea what this was supposed to do - looks like an infinite recursion to me. | ||
110 | // case "regions": | ||
111 | //// DIRTY HACK ALERT | ||
112 | //Console.WriteLine("/regions/ accessed"); | ||
113 | //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1])); | ||
114 | //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod); | ||
115 | //break; | ||
116 | |||
117 | // lbsa71 : I guess these were never used? | ||
118 | //Listener.Prefixes.Add("http://+:8001/gods/"); | ||
119 | //Listener.Prefixes.Add("http://+:8001/highestuuid/"); | ||
120 | //Listener.Prefixes.Add("http://+:8001/uuidblocks/"); | ||
121 | 98 | ||
122 | httpServer.Start(); | ||
123 | 99 | ||
124 | m_console.WriteLine("Main.cs:Startup() - Starting sim status checker"); | 100 | httpServer.Start(); |
125 | 101 | ||
126 | Timer simCheckTimer = new Timer( 300000 ); // 5 minutes | ||
127 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | ||
128 | simCheckTimer.Enabled = true; | ||
129 | } | 102 | } |
130 | 103 | ||
131 | private GridConfig LoadConfigDll(string dllName) | 104 | /*private GridConfig LoadConfigDll(string dllName) |
132 | { | 105 | { |
133 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 106 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
134 | GridConfig config = null; | 107 | GridConfig config = null; |
@@ -154,49 +127,14 @@ namespace OpenGridServices.GridServer | |||
154 | } | 127 | } |
155 | pluginAssembly = null; | 128 | pluginAssembly = null; |
156 | return config; | 129 | return config; |
157 | } | 130 | }*/ |
158 | |||
159 | public void CheckSims(object sender, ElapsedEventArgs e) | ||
160 | { | ||
161 | foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) | ||
162 | { | ||
163 | string SimResponse = ""; | ||
164 | try | ||
165 | { | ||
166 | WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); | ||
167 | CheckSim.Method = "GET"; | ||
168 | CheckSim.ContentType = "text/plaintext"; | ||
169 | CheckSim.ContentLength = 0; | ||
170 | |||
171 | StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); | ||
172 | stOut.Write(""); | ||
173 | stOut.Close(); | ||
174 | |||
175 | StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); | ||
176 | SimResponse = stIn.ReadToEnd(); | ||
177 | stIn.Close(); | ||
178 | } | ||
179 | catch | ||
180 | { | ||
181 | } | ||
182 | |||
183 | if (SimResponse == "OK") | ||
184 | { | ||
185 | m_simProfileManager.SimProfiles[sim.UUID].online = true; | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | m_simProfileManager.SimProfiles[sim.UUID].online = false; | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | 131 | ||
194 | public void RunCmd(string cmd, string[] cmdparams) | 132 | public void RunCmd(string cmd, string[] cmdparams) |
195 | { | 133 | { |
196 | switch (cmd) | 134 | switch (cmd) |
197 | { | 135 | { |
198 | case "help": | 136 | case "help": |
199 | m_console.WriteLine("shutdown - shutdown the grid (USE CAUTION!)"); | 137 | m_console.WriteLine("shutdown - shutdown this asset server (USE CAUTION!)"); |
200 | break; | 138 | break; |
201 | 139 | ||
202 | case "shutdown": | 140 | case "shutdown": |
diff --git a/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs b/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs index 8471e6b..7014284 100644 --- a/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs +++ b/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs | |||
@@ -1,15 +1,15 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OGS-GridServer")] | 8 | [assembly: AssemblyTitle("OGS-AssetServer")] |
9 | [assembly: AssemblyDescription("")] | 9 | [assembly: AssemblyDescription("")] |
10 | [assembly: AssemblyConfiguration("")] | 10 | [assembly: AssemblyConfiguration("")] |
11 | [assembly: AssemblyCompany("")] | 11 | [assembly: AssemblyCompany("")] |
12 | [assembly: AssemblyProduct("OGS-GridServer")] | 12 | [assembly: AssemblyProduct("OGS-AssetServer")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 13 | [assembly: AssemblyCopyright("Copyright © 2007")] |
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
diff --git a/OpenGridServices.AssetServer/SimProfiles.cs b/OpenGridServices.AssetServer/SimProfiles.cs deleted file mode 100644 index ae40133..0000000 --- a/OpenGridServices.AssetServer/SimProfiles.cs +++ /dev/null | |||
@@ -1,328 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenGrid project, http://osgrid.org/ | ||
3 | |||
4 | |||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using System.Collections; | ||
33 | using System.Collections.Generic; | ||
34 | using libsecondlife; | ||
35 | using OpenSim.Framework.Utilities; | ||
36 | using OpenSim.Framework.Console; | ||
37 | using OpenSim.Framework.Sims; | ||
38 | using Db4objects.Db4o; | ||
39 | using Nwc.XmlRpc; | ||
40 | using System.Xml; | ||
41 | |||
42 | namespace OpenGridServices.GridServer | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// </summary> | ||
46 | public class SimProfileManager | ||
47 | { | ||
48 | |||
49 | public Dictionary<LLUUID, SimProfileBase> SimProfiles = new Dictionary<LLUUID, SimProfileBase>(); | ||
50 | private OpenGrid_Main m_gridManager; | ||
51 | |||
52 | public SimProfileManager(OpenGrid_Main gridManager) | ||
53 | { | ||
54 | m_gridManager = gridManager; | ||
55 | } | ||
56 | |||
57 | public void LoadProfiles() | ||
58 | { // should abstract this out | ||
59 | IObjectContainer db; | ||
60 | db = Db4oFactory.OpenFile("simprofiles.yap"); | ||
61 | IObjectSet result = db.Get(typeof(SimProfileBase)); | ||
62 | foreach (SimProfileBase simprof in result) | ||
63 | { | ||
64 | SimProfiles.Add(simprof.UUID, simprof); | ||
65 | } | ||
66 | MainConsole.Instance.WriteLine("SimProfiles.Cs:LoadProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); | ||
67 | db.Close(); | ||
68 | } | ||
69 | |||
70 | public SimProfileBase GetProfileByHandle(ulong reqhandle) | ||
71 | { | ||
72 | foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) | ||
73 | { | ||
74 | if (SimProfiles[UUID].regionhandle == reqhandle) return SimProfiles[UUID]; | ||
75 | } | ||
76 | return null; | ||
77 | } | ||
78 | |||
79 | public SimProfileBase GetProfileByLLUUID(LLUUID ProfileLLUUID) | ||
80 | { | ||
81 | foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) | ||
82 | { | ||
83 | if (SimProfiles[UUID].UUID == ProfileLLUUID) return SimProfiles[UUID]; | ||
84 | } | ||
85 | return null; | ||
86 | } | ||
87 | |||
88 | public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) | ||
89 | { | ||
90 | SimProfileBase TheSim = GetProfileByHandle(regionhandle); | ||
91 | if (TheSim != null) | ||
92 | if (TheSim.recvkey == simrecvkey) | ||
93 | { | ||
94 | return true; | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | return false; | ||
99 | } | ||
100 | else return false; | ||
101 | |||
102 | } | ||
103 | |||
104 | public string GetXMLNeighbours(ulong reqhandle) | ||
105 | { | ||
106 | string response = ""; | ||
107 | SimProfileBase central_region = GetProfileByHandle(reqhandle); | ||
108 | SimProfileBase neighbour; | ||
109 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | ||
110 | { | ||
111 | if (GetProfileByHandle(Util.UIntsToLong((uint)((central_region.RegionLocX + x) * 256), (uint)(central_region.RegionLocY + y) * 256)) != null) | ||
112 | { | ||
113 | neighbour = GetProfileByHandle(Util.UIntsToLong((uint)((central_region.RegionLocX + x) * 256), (uint)(central_region.RegionLocY + y) * 256)); | ||
114 | response += "<neighbour>"; | ||
115 | response += "<sim_ip>" + neighbour.sim_ip + "</sim_ip>"; | ||
116 | response += "<sim_port>" + neighbour.sim_port.ToString() + "</sim_port>"; | ||
117 | response += "<locx>" + neighbour.RegionLocX.ToString() + "</locx>"; | ||
118 | response += "<locy>" + neighbour.RegionLocY.ToString() + "</locy>"; | ||
119 | response += "<regionhandle>" + neighbour.regionhandle.ToString() + "</regionhandle>"; | ||
120 | response += "</neighbour>"; | ||
121 | |||
122 | } | ||
123 | } | ||
124 | return response; | ||
125 | } | ||
126 | |||
127 | public SimProfileBase CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) | ||
128 | { | ||
129 | SimProfileBase newprofile = new SimProfileBase(); | ||
130 | newprofile.regionname = regionname; | ||
131 | newprofile.sim_ip = sim_ip; | ||
132 | newprofile.sim_port = sim_port; | ||
133 | newprofile.RegionLocX = RegionLocX; | ||
134 | newprofile.RegionLocY = RegionLocY; | ||
135 | newprofile.caps_url = "http://" + sim_ip + ":9000/"; | ||
136 | newprofile.sendkey = sendkey; | ||
137 | newprofile.recvkey = recvkey; | ||
138 | newprofile.regionhandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
139 | newprofile.UUID = LLUUID.Random(); | ||
140 | this.SimProfiles.Add(newprofile.UUID, newprofile); | ||
141 | return newprofile; | ||
142 | } | ||
143 | |||
144 | public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request) | ||
145 | { | ||
146 | XmlRpcResponse response = new XmlRpcResponse(); | ||
147 | Hashtable responseData = new Hashtable(); | ||
148 | response.Value = responseData; | ||
149 | |||
150 | SimProfileBase TheSim = null; | ||
151 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
152 | |||
153 | if (requestData.ContainsKey("UUID")) | ||
154 | { | ||
155 | TheSim = GetProfileByLLUUID(new LLUUID((string)requestData["UUID"])); | ||
156 | } | ||
157 | else if (requestData.ContainsKey("region_handle")) | ||
158 | { | ||
159 | TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(requestData["region_handle"])); | ||
160 | } | ||
161 | |||
162 | if (TheSim == null) | ||
163 | { | ||
164 | responseData["error"] = "sim not found"; | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | |||
169 | ArrayList SimNeighboursData = new ArrayList(); | ||
170 | |||
171 | SimProfileBase neighbour; | ||
172 | Hashtable NeighbourBlock; | ||
173 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | ||
174 | { | ||
175 | if (GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256)) != null) | ||
176 | { | ||
177 | neighbour = GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256)); | ||
178 | |||
179 | NeighbourBlock = new Hashtable(); | ||
180 | NeighbourBlock["sim_ip"] = neighbour.sim_ip; | ||
181 | NeighbourBlock["sim_port"] = neighbour.sim_port.ToString(); | ||
182 | NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString(); | ||
183 | NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString(); | ||
184 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); | ||
185 | |||
186 | if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | responseData["UUID"] = TheSim.UUID.ToString(); | ||
191 | responseData["region_locx"] = TheSim.RegionLocX.ToString(); | ||
192 | responseData["region_locy"] = TheSim.RegionLocY.ToString(); | ||
193 | responseData["regionname"] = TheSim.regionname; | ||
194 | responseData["estate_id"] = "1"; | ||
195 | responseData["neighbours"] = SimNeighboursData; | ||
196 | |||
197 | responseData["sim_ip"] = TheSim.sim_ip; | ||
198 | responseData["sim_port"] = TheSim.sim_port.ToString(); | ||
199 | responseData["asset_url"] = m_gridManager.Cfg.DefaultAssetServer; | ||
200 | responseData["asset_sendkey"] = m_gridManager.Cfg.AssetSendKey; | ||
201 | responseData["asset_recvkey"] = m_gridManager.Cfg.AssetRecvKey; | ||
202 | responseData["user_url"] = m_gridManager.Cfg.DefaultUserServer; | ||
203 | responseData["user_sendkey"] = m_gridManager.Cfg.UserSendKey; | ||
204 | responseData["user_recvkey"] = m_gridManager.Cfg.UserRecvKey; | ||
205 | responseData["authkey"] = m_gridManager.Cfg.SimSendKey; | ||
206 | } | ||
207 | |||
208 | return response; | ||
209 | } | ||
210 | |||
211 | public string RestSetSimMethod(string request, string path, string param) | ||
212 | { | ||
213 | Console.WriteLine("SimProfiles.cs:RestSetSimMethod() - processing request......"); | ||
214 | SimProfileBase TheSim; | ||
215 | TheSim = GetProfileByLLUUID(new LLUUID(param)); | ||
216 | if ((TheSim) == null) | ||
217 | { | ||
218 | TheSim = new SimProfileBase(); | ||
219 | LLUUID UUID = new LLUUID(param); | ||
220 | TheSim.UUID = UUID; | ||
221 | } | ||
222 | |||
223 | XmlDocument doc = new XmlDocument(); | ||
224 | doc.LoadXml(request); | ||
225 | XmlNode rootnode = doc.FirstChild; | ||
226 | XmlNode authkeynode = rootnode.ChildNodes[0]; | ||
227 | if (authkeynode.Name != "authkey") | ||
228 | { | ||
229 | return "ERROR! bad XML - expected authkey tag"; | ||
230 | } | ||
231 | |||
232 | XmlNode simnode = rootnode.ChildNodes[1]; | ||
233 | if (simnode.Name != "sim") | ||
234 | { | ||
235 | return "ERROR! bad XML - expected sim tag"; | ||
236 | } | ||
237 | |||
238 | if (authkeynode.InnerText != m_gridManager.Cfg.SimRecvKey) | ||
239 | { | ||
240 | return "ERROR! invalid key"; | ||
241 | } | ||
242 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | ||
243 | { | ||
244 | switch (simnode.ChildNodes[i].Name) | ||
245 | { | ||
246 | case "regionname": | ||
247 | TheSim.regionname = simnode.ChildNodes[i].InnerText; | ||
248 | break; | ||
249 | |||
250 | case "sim_ip": | ||
251 | TheSim.sim_ip = simnode.ChildNodes[i].InnerText; | ||
252 | break; | ||
253 | |||
254 | case "sim_port": | ||
255 | TheSim.sim_port = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); | ||
256 | break; | ||
257 | |||
258 | case "region_locx": | ||
259 | TheSim.RegionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | ||
260 | TheSim.regionhandle = Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256)); | ||
261 | break; | ||
262 | |||
263 | case "region_locy": | ||
264 | TheSim.RegionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | ||
265 | TheSim.regionhandle = Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256)); | ||
266 | break; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | try | ||
271 | { | ||
272 | SimProfiles.Add(TheSim.UUID, TheSim); | ||
273 | IObjectContainer db; | ||
274 | db = Db4oFactory.OpenFile("simprofiles.yap"); | ||
275 | db.Set(TheSim); | ||
276 | db.Close(); | ||
277 | return "OK"; | ||
278 | } | ||
279 | catch (Exception e) | ||
280 | { | ||
281 | return "ERROR! could not save to database!"; | ||
282 | } | ||
283 | |||
284 | } | ||
285 | |||
286 | public string RestGetRegionMethod(string request, string path, string param) | ||
287 | { | ||
288 | SimProfileBase TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(param)); | ||
289 | return RestGetSimMethod("", "/sims/", param); | ||
290 | } | ||
291 | |||
292 | public string RestSetRegionMethod(string request, string path, string param) | ||
293 | { | ||
294 | SimProfileBase TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(param)); | ||
295 | return RestSetSimMethod("", "/sims/", param); | ||
296 | } | ||
297 | |||
298 | public string RestGetSimMethod(string request, string path, string param) | ||
299 | { | ||
300 | string respstring = String.Empty; | ||
301 | |||
302 | SimProfileBase TheSim; | ||
303 | LLUUID UUID = new LLUUID(param); | ||
304 | TheSim = GetProfileByLLUUID(UUID); | ||
305 | |||
306 | if (!(TheSim == null)) | ||
307 | { | ||
308 | respstring = "<Root>"; | ||
309 | respstring += "<authkey>" + m_gridManager.Cfg.SimSendKey + "</authkey>"; | ||
310 | respstring += "<sim>"; | ||
311 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | ||
312 | respstring += "<regionname>" + TheSim.regionname + "</regionname>"; | ||
313 | respstring += "<sim_ip>" + TheSim.sim_ip + "</sim_ip>"; | ||
314 | respstring += "<sim_port>" + TheSim.sim_port.ToString() + "</sim_port>"; | ||
315 | respstring += "<region_locx>" + TheSim.RegionLocX.ToString() + "</region_locx>"; | ||
316 | respstring += "<region_locy>" + TheSim.RegionLocY.ToString() + "</region_locy>"; | ||
317 | respstring += "<estate_id>1</estate_id>"; | ||
318 | respstring += "</sim>"; | ||
319 | respstring += "</Root>"; | ||
320 | } | ||
321 | |||
322 | return respstring; | ||
323 | } | ||
324 | |||
325 | } | ||
326 | |||
327 | |||
328 | } | ||
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build index 84f7e1f..69ea10a 100644 --- a/OpenSim.Framework/OpenSim.Framework.dll.build +++ b/OpenSim.Framework/OpenSim.Framework.dll.build | |||
@@ -37,6 +37,7 @@ | |||
37 | <include name="Properties/AssemblyInfo.cs" /> | 37 | <include name="Properties/AssemblyInfo.cs" /> |
38 | <include name="Types/AgentCiruitData.cs" /> | 38 | <include name="Types/AgentCiruitData.cs" /> |
39 | <include name="Types/AssetBase.cs" /> | 39 | <include name="Types/AssetBase.cs" /> |
40 | <include name="Types/AssetStorage.cs" /> | ||
40 | <include name="Types/Login.cs" /> | 41 | <include name="Types/Login.cs" /> |
41 | <include name="Types/NeighbourInfo.cs" /> | 42 | <include name="Types/NeighbourInfo.cs" /> |
42 | <include name="Types/OSVector3.cs" /> | 43 | <include name="Types/OSVector3.cs" /> |
diff --git a/OpenSim.GridInterfaces/Local/LocalGridServer.cs b/OpenSim.GridInterfaces/Local/LocalGridServer.cs index f4b8872..e08d635 100644 --- a/OpenSim.GridInterfaces/Local/LocalGridServer.cs +++ b/OpenSim.GridInterfaces/Local/LocalGridServer.cs | |||
@@ -145,12 +145,5 @@ namespace OpenSim.GridInterfaces.Local | |||
145 | return (asset.UUID == _findID); | 145 | return (asset.UUID == _findID); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | public class AssetStorage | ||
150 | { | ||
151 | public byte[] Data; | ||
152 | public sbyte Type; | ||
153 | public string Name; | ||
154 | public LLUUID UUID; | ||
155 | } | ||
156 | } | 149 | } |
diff --git a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs index d2f8de1..bcebf82 100644 --- a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs +++ b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs | |||
@@ -62,11 +62,12 @@ namespace OpenSim.GridInterfaces.Remote | |||
62 | { | 62 | { |
63 | while (true) | 63 | while (true) |
64 | { | 64 | { |
65 | //we need to add support for the asset server not knowing about a requested asset | 65 | //we need to add support for the asset server not knowing about a requested asset |
66 | // 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 | ||
66 | ARequest req = this._assetRequests.Dequeue(); | 67 | ARequest req = this._assetRequests.Dequeue(); |
67 | LLUUID assetID = req.AssetID; | 68 | LLUUID assetID = req.AssetID; |
68 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data"); | 69 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID + "/data"); |
69 | WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data"); | 70 | WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID + "/data"); |
70 | WebResponse AssetResponse = AssetLoad.GetResponse(); | 71 | WebResponse AssetResponse = AssetLoad.GetResponse(); |
71 | byte[] idata = new byte[(int)AssetResponse.ContentLength]; | 72 | byte[] idata = new byte[(int)AssetResponse.ContentLength]; |
72 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); | 73 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); |
diff --git a/OpenSim.build b/OpenSim.build index 15b6371..656d788 100644 --- a/OpenSim.build +++ b/OpenSim.build | |||
@@ -61,6 +61,7 @@ | |||
61 | <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="clean" /> | 61 | <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="clean" /> |
62 | <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="clean" /> | 62 | <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="clean" /> |
63 | <nant buildfile="OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="clean" /> | 63 | <nant buildfile="OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="clean" /> |
64 | <nant buildfile="OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="clean" /> | ||
64 | <nant buildfile="OpenSim/OpenSim.exe.build" target="clean" /> | 65 | <nant buildfile="OpenSim/OpenSim.exe.build" target="clean" /> |
65 | <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="clean" /> | 66 | <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="clean" /> |
66 | <nant buildfile="OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="clean" /> | 67 | <nant buildfile="OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="clean" /> |
@@ -76,6 +77,7 @@ | |||
76 | <nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="build" /> | 77 | <nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="build" /> |
77 | <nant buildfile="OpenSim.Servers/OpenSim.Servers.dll.build" target="build" /> | 78 | <nant buildfile="OpenSim.Servers/OpenSim.Servers.dll.build" target="build" /> |
78 | <nant buildfile="OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="build" /> | 79 | <nant buildfile="OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="build" /> |
80 | <nant buildfile="OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="build" /> | ||
79 | <nant buildfile="OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="build" /> | 81 | <nant buildfile="OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="build" /> |
80 | <nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="build" /> | 82 | <nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="build" /> |
81 | <nant buildfile="OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="build" /> | 83 | <nant buildfile="OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="build" /> |
@@ -118,6 +120,7 @@ | |||
118 | <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="doc" /> | 120 | <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="doc" /> |
119 | <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="doc" /> | 121 | <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="doc" /> |
120 | <nant buildfile="OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="doc" /> | 122 | <nant buildfile="OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="doc" /> |
123 | <nant buildfile="OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="doc" /> | ||
121 | <nant buildfile="OpenSim/OpenSim.exe.build" target="doc" /> | 124 | <nant buildfile="OpenSim/OpenSim.exe.build" target="doc" /> |
122 | <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="doc" /> | 125 | <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="doc" /> |
123 | <nant buildfile="OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="doc" /> | 126 | <nant buildfile="OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="doc" /> |
diff --git a/prebuild.xml b/prebuild.xml index 741fc6d..3d5c4bc 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -153,6 +153,35 @@ | |||
153 | </Files> | 153 | </Files> |
154 | </Project> | 154 | </Project> |
155 | 155 | ||
156 | <Project name="OpenGridServices.AssetServer" path="OpenGridServices.AssetServer" type="Exe"> | ||
157 | <Configuration name="Debug"> | ||
158 | <Options> | ||
159 | <OutputPath>../bin/</OutputPath> | ||
160 | </Options> | ||
161 | </Configuration> | ||
162 | <Configuration name="Release"> | ||
163 | <Options> | ||
164 | <OutputPath>../bin/</OutputPath> | ||
165 | </Options> | ||
166 | </Configuration> | ||
167 | |||
168 | <ReferencePath>../bin/</ReferencePath> | ||
169 | <Reference name="System" localCopy="false"/> | ||
170 | <Reference name="System.Data" localCopy="false"/> | ||
171 | <Reference name="System.Xml" localCopy="false"/> | ||
172 | <Reference name="OpenSim.Framework"/> | ||
173 | <Reference name="OpenSim.Framework.Console"/> | ||
174 | <Reference name="OpenSim.GridInterfaces.Local"/> | ||
175 | <Reference name="OpenSim.Servers"/> | ||
176 | <Reference name="libsecondlife.dll"/> | ||
177 | <Reference name="Db4objects.Db4o.dll"/> | ||
178 | <Reference name="XMLRPC"/> | ||
179 | |||
180 | <Files> | ||
181 | <Match pattern="*.cs" recurse="true"/> | ||
182 | </Files> | ||
183 | </Project> | ||
184 | |||
156 | <Project name="OpenGridServices.UserServer" path="OpenGridServices.UserServer" type="Exe"> | 185 | <Project name="OpenGridServices.UserServer" path="OpenGridServices.UserServer" type="Exe"> |
157 | <Configuration name="Debug"> | 186 | <Configuration name="Debug"> |
158 | <Options> | 187 | <Options> |