diff options
Diffstat (limited to 'OpenSim/Grid/GridServer.Modules/GridRestModule.cs')
-rw-r--r-- | OpenSim/Grid/GridServer.Modules/GridRestModule.cs | 564 |
1 files changed, 282 insertions, 282 deletions
diff --git a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs index cd6d4d5..716f923 100644 --- a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs | |||
@@ -1,282 +1,282 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Xml; | 33 | using System.Xml; |
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | 36 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | using OpenSim.Grid.Framework; | 40 | using OpenSim.Grid.Framework; |
41 | 41 | ||
42 | namespace OpenSim.Grid.GridServer.Modules | 42 | namespace OpenSim.Grid.GridServer.Modules |
43 | { | 43 | { |
44 | public class GridRestModule | 44 | public class GridRestModule |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private GridDBService m_gridDBService; | 48 | private GridDBService m_gridDBService; |
49 | private IUGAIMCore m_gridCore; | 49 | private IUGAIMCore m_gridCore; |
50 | 50 | ||
51 | protected GridConfig m_config; | 51 | protected GridConfig m_config; |
52 | 52 | ||
53 | /// <value> | 53 | /// <value> |
54 | /// Used to notify old regions as to which OpenSim version to upgrade to | 54 | /// Used to notify old regions as to which OpenSim version to upgrade to |
55 | /// </value> | 55 | /// </value> |
56 | private string m_opensimVersion; | 56 | private string m_opensimVersion; |
57 | 57 | ||
58 | protected BaseHttpServer m_httpServer; | 58 | protected BaseHttpServer m_httpServer; |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Constructor | 61 | /// Constructor |
62 | /// </summary> | 62 | /// </summary> |
63 | /// <param name="opensimVersion"> | 63 | /// <param name="opensimVersion"> |
64 | /// Used to notify old regions as to which OpenSim version to upgrade to | 64 | /// Used to notify old regions as to which OpenSim version to upgrade to |
65 | /// </param> | 65 | /// </param> |
66 | public GridRestModule() | 66 | public GridRestModule() |
67 | { | 67 | { |
68 | } | 68 | } |
69 | 69 | ||
70 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) | 70 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) |
71 | { | 71 | { |
72 | m_opensimVersion = opensimVersion; | 72 | m_opensimVersion = opensimVersion; |
73 | m_gridDBService = gridDBService; | 73 | m_gridDBService = gridDBService; |
74 | m_gridCore = gridCore; | 74 | m_gridCore = gridCore; |
75 | m_config = config; | 75 | m_config = config; |
76 | RegisterHandlers(); | 76 | RegisterHandlers(); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void PostInitialise() | 79 | public void PostInitialise() |
80 | { | 80 | { |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | public void RegisterHandlers() | 84 | public void RegisterHandlers() |
85 | { | 85 | { |
86 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 86 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
87 | m_httpServer = m_gridCore.GetHttpServer(); | 87 | m_httpServer = m_gridCore.GetHttpServer(); |
88 | 88 | ||
89 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod)); | 89 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod)); |
90 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod)); | 90 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod)); |
91 | 91 | ||
92 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", RestGetRegionMethod)); | 92 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", RestGetRegionMethod)); |
93 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod)); | 93 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod)); |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Performs a REST Get Operation | 97 | /// Performs a REST Get Operation |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="request"></param> | 99 | /// <param name="request"></param> |
100 | /// <param name="path"></param> | 100 | /// <param name="path"></param> |
101 | /// <param name="param"></param> | 101 | /// <param name="param"></param> |
102 | /// <param name="httpRequest">HTTP request header object</param> | 102 | /// <param name="httpRequest">HTTP request header object</param> |
103 | /// <param name="httpResponse">HTTP response header object</param> | 103 | /// <param name="httpResponse">HTTP response header object</param> |
104 | /// <returns></returns> | 104 | /// <returns></returns> |
105 | public string RestGetRegionMethod(string request, string path, string param, | 105 | public string RestGetRegionMethod(string request, string path, string param, |
106 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 106 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
107 | { | 107 | { |
108 | return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); | 108 | return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); |
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Performs a REST Set Operation | 112 | /// Performs a REST Set Operation |
113 | /// </summary> | 113 | /// </summary> |
114 | /// <param name="request"></param> | 114 | /// <param name="request"></param> |
115 | /// <param name="path"></param> | 115 | /// <param name="path"></param> |
116 | /// <param name="param"></param> | 116 | /// <param name="param"></param> |
117 | /// <param name="httpRequest">HTTP request header object</param> | 117 | /// <param name="httpRequest">HTTP request header object</param> |
118 | /// <param name="httpResponse">HTTP response header object</param> | 118 | /// <param name="httpResponse">HTTP response header object</param> |
119 | /// <returns></returns> | 119 | /// <returns></returns> |
120 | public string RestSetRegionMethod(string request, string path, string param, | 120 | public string RestSetRegionMethod(string request, string path, string param, |
121 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 121 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
122 | { | 122 | { |
123 | return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); | 123 | return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); |
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Returns information about a sim via a REST Request | 127 | /// Returns information about a sim via a REST Request |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <param name="request"></param> | 129 | /// <param name="request"></param> |
130 | /// <param name="path"></param> | 130 | /// <param name="path"></param> |
131 | /// <param name="param">A string representing the sim's UUID</param> | 131 | /// <param name="param">A string representing the sim's UUID</param> |
132 | /// <param name="httpRequest">HTTP request header object</param> | 132 | /// <param name="httpRequest">HTTP request header object</param> |
133 | /// <param name="httpResponse">HTTP response header object</param> | 133 | /// <param name="httpResponse">HTTP response header object</param> |
134 | /// <returns>Information about the sim in XML</returns> | 134 | /// <returns>Information about the sim in XML</returns> |
135 | public string RestGetSimMethod(string request, string path, string param, | 135 | public string RestGetSimMethod(string request, string path, string param, |
136 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 136 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
137 | { | 137 | { |
138 | string respstring = String.Empty; | 138 | string respstring = String.Empty; |
139 | 139 | ||
140 | RegionProfileData TheSim; | 140 | RegionProfileData TheSim; |
141 | 141 | ||
142 | UUID UUID; | 142 | UUID UUID; |
143 | if (UUID.TryParse(param, out UUID)) | 143 | if (UUID.TryParse(param, out UUID)) |
144 | { | 144 | { |
145 | TheSim = m_gridDBService.GetRegion(UUID); | 145 | TheSim = m_gridDBService.GetRegion(UUID); |
146 | 146 | ||
147 | if (!(TheSim == null)) | 147 | if (!(TheSim == null)) |
148 | { | 148 | { |
149 | respstring = "<Root>"; | 149 | respstring = "<Root>"; |
150 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; | 150 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; |
151 | respstring += "<sim>"; | 151 | respstring += "<sim>"; |
152 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | 152 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; |
153 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; | 153 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; |
154 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; | 154 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; |
155 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; | 155 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; |
156 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; | 156 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; |
157 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; | 157 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; |
158 | respstring += "<estate_id>1</estate_id>"; | 158 | respstring += "<estate_id>1</estate_id>"; |
159 | respstring += "</sim>"; | 159 | respstring += "</sim>"; |
160 | respstring += "</Root>"; | 160 | respstring += "</Root>"; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | else | 163 | else |
164 | { | 164 | { |
165 | respstring = "<Root>"; | 165 | respstring = "<Root>"; |
166 | respstring += "<error>Param must be a UUID</error>"; | 166 | respstring += "<error>Param must be a UUID</error>"; |
167 | respstring += "</Root>"; | 167 | respstring += "</Root>"; |
168 | } | 168 | } |
169 | 169 | ||
170 | return respstring; | 170 | return respstring; |
171 | } | 171 | } |
172 | 172 | ||
173 | /// <summary> | 173 | /// <summary> |
174 | /// Creates or updates a sim via a REST Method Request | 174 | /// Creates or updates a sim via a REST Method Request |
175 | /// BROKEN with SQL Update | 175 | /// BROKEN with SQL Update |
176 | /// </summary> | 176 | /// </summary> |
177 | /// <param name="request"></param> | 177 | /// <param name="request"></param> |
178 | /// <param name="path"></param> | 178 | /// <param name="path"></param> |
179 | /// <param name="param"></param> | 179 | /// <param name="param"></param> |
180 | /// <param name="httpRequest">HTTP request header object</param> | 180 | /// <param name="httpRequest">HTTP request header object</param> |
181 | /// <param name="httpResponse">HTTP response header object</param> | 181 | /// <param name="httpResponse">HTTP response header object</param> |
182 | /// <returns>"OK" or an error</returns> | 182 | /// <returns>"OK" or an error</returns> |
183 | public string RestSetSimMethod(string request, string path, string param, | 183 | public string RestSetSimMethod(string request, string path, string param, |
184 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 184 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
185 | { | 185 | { |
186 | m_log.Info("Processing region update via REST method"); | 186 | m_log.Info("Processing region update via REST method"); |
187 | RegionProfileData theSim; | 187 | RegionProfileData theSim; |
188 | theSim = m_gridDBService.GetRegion(new UUID(param)); | 188 | theSim = m_gridDBService.GetRegion(new UUID(param)); |
189 | if (theSim == null) | 189 | if (theSim == null) |
190 | { | 190 | { |
191 | theSim = new RegionProfileData(); | 191 | theSim = new RegionProfileData(); |
192 | UUID UUID = new UUID(param); | 192 | UUID UUID = new UUID(param); |
193 | theSim.UUID = UUID; | 193 | theSim.UUID = UUID; |
194 | theSim.regionRecvKey = m_config.SimRecvKey; | 194 | theSim.regionRecvKey = m_config.SimRecvKey; |
195 | } | 195 | } |
196 | 196 | ||
197 | XmlDocument doc = new XmlDocument(); | 197 | XmlDocument doc = new XmlDocument(); |
198 | doc.LoadXml(request); | 198 | doc.LoadXml(request); |
199 | XmlNode rootnode = doc.FirstChild; | 199 | XmlNode rootnode = doc.FirstChild; |
200 | XmlNode authkeynode = rootnode.ChildNodes[0]; | 200 | XmlNode authkeynode = rootnode.ChildNodes[0]; |
201 | if (authkeynode.Name != "authkey") | 201 | if (authkeynode.Name != "authkey") |
202 | { | 202 | { |
203 | return "ERROR! bad XML - expected authkey tag"; | 203 | return "ERROR! bad XML - expected authkey tag"; |
204 | } | 204 | } |
205 | 205 | ||
206 | XmlNode simnode = rootnode.ChildNodes[1]; | 206 | XmlNode simnode = rootnode.ChildNodes[1]; |
207 | if (simnode.Name != "sim") | 207 | if (simnode.Name != "sim") |
208 | { | 208 | { |
209 | return "ERROR! bad XML - expected sim tag"; | 209 | return "ERROR! bad XML - expected sim tag"; |
210 | } | 210 | } |
211 | 211 | ||
212 | //theSim.regionSendKey = Cfg; | 212 | //theSim.regionSendKey = Cfg; |
213 | theSim.regionRecvKey = m_config.SimRecvKey; | 213 | theSim.regionRecvKey = m_config.SimRecvKey; |
214 | theSim.regionSendKey = m_config.SimSendKey; | 214 | theSim.regionSendKey = m_config.SimSendKey; |
215 | theSim.regionSecret = m_config.SimRecvKey; | 215 | theSim.regionSecret = m_config.SimRecvKey; |
216 | theSim.regionDataURI = String.Empty; | 216 | theSim.regionDataURI = String.Empty; |
217 | theSim.regionAssetURI = m_config.DefaultAssetServer; | 217 | theSim.regionAssetURI = m_config.DefaultAssetServer; |
218 | theSim.regionAssetRecvKey = m_config.AssetRecvKey; | 218 | theSim.regionAssetRecvKey = m_config.AssetRecvKey; |
219 | theSim.regionAssetSendKey = m_config.AssetSendKey; | 219 | theSim.regionAssetSendKey = m_config.AssetSendKey; |
220 | theSim.regionUserURI = m_config.DefaultUserServer; | 220 | theSim.regionUserURI = m_config.DefaultUserServer; |
221 | theSim.regionUserSendKey = m_config.UserSendKey; | 221 | theSim.regionUserSendKey = m_config.UserSendKey; |
222 | theSim.regionUserRecvKey = m_config.UserRecvKey; | 222 | theSim.regionUserRecvKey = m_config.UserRecvKey; |
223 | 223 | ||
224 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | 224 | for (int i = 0; i < simnode.ChildNodes.Count; i++) |
225 | { | 225 | { |
226 | switch (simnode.ChildNodes[i].Name) | 226 | switch (simnode.ChildNodes[i].Name) |
227 | { | 227 | { |
228 | case "regionname": | 228 | case "regionname": |
229 | theSim.regionName = simnode.ChildNodes[i].InnerText; | 229 | theSim.regionName = simnode.ChildNodes[i].InnerText; |
230 | break; | 230 | break; |
231 | 231 | ||
232 | case "sim_ip": | 232 | case "sim_ip": |
233 | theSim.serverIP = simnode.ChildNodes[i].InnerText; | 233 | theSim.serverIP = simnode.ChildNodes[i].InnerText; |
234 | break; | 234 | break; |
235 | 235 | ||
236 | case "sim_port": | 236 | case "sim_port": |
237 | theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); | 237 | theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); |
238 | break; | 238 | break; |
239 | 239 | ||
240 | case "region_locx": | 240 | case "region_locx": |
241 | theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 241 | theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
242 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); | 242 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); |
243 | break; | 243 | break; |
244 | 244 | ||
245 | case "region_locy": | 245 | case "region_locy": |
246 | theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 246 | theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
247 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); | 247 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); |
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/"; | 252 | theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/"; |
253 | bool requirePublic = false; | 253 | bool requirePublic = false; |
254 | bool requireValid = true; | 254 | bool requireValid = true; |
255 | 255 | ||
256 | if (requirePublic && | 256 | if (requirePublic && |
257 | (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") || | 257 | (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") || |
258 | theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") || | 258 | theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") || |
259 | theSim.serverIP.StartsWith("255."))) | 259 | theSim.serverIP.StartsWith("255."))) |
260 | { | 260 | { |
261 | return "ERROR! Servers must register with public addresses."; | 261 | return "ERROR! Servers must register with public addresses."; |
262 | } | 262 | } |
263 | 263 | ||
264 | if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255."))) | 264 | if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255."))) |
265 | { | 265 | { |
266 | return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again"; | 266 | return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again"; |
267 | } | 267 | } |
268 | 268 | ||
269 | try | 269 | try |
270 | { | 270 | { |
271 | m_log.Info("[DATA]: " + | 271 | m_log.Info("[DATA]: " + |
272 | "Updating / adding via " + m_gridDBService.GetNumberOfPlugins() + " storage provider(s) registered."); | 272 | "Updating / adding via " + m_gridDBService.GetNumberOfPlugins() + " storage provider(s) registered."); |
273 | 273 | ||
274 | return m_gridDBService.CheckReservations(theSim, authkeynode); | 274 | return m_gridDBService.CheckReservations(theSim, authkeynode); |
275 | } | 275 | } |
276 | catch (Exception e) | 276 | catch (Exception e) |
277 | { | 277 | { |
278 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; | 278 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | } | 282 | } |