diff options
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | 11 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 34 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs | 110 | ||||
-rw-r--r-- | bin/OpenSim.Server.ini.example | 5 | ||||
-rw-r--r-- | bin/config-include/GridHypergrid.ini | 13 |
5 files changed, 158 insertions, 15 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index 15b29d2..940ec7a 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -51,6 +51,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
51 | get { return m_GatekeeperService; } | 51 | get { return m_GatekeeperService; } |
52 | } | 52 | } |
53 | 53 | ||
54 | private IHypergridService m_HypergridService; | ||
55 | |||
54 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : | 56 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : |
55 | base(config, server, String.Empty) | 57 | base(config, server, String.Empty) |
56 | { | 58 | { |
@@ -60,12 +62,17 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
60 | string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty); | 62 | string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty); |
61 | Object[] args = new Object[] { config, simService }; | 63 | Object[] args = new Object[] { config, simService }; |
62 | m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args); | 64 | m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args); |
65 | |||
66 | serviceDll = gridConfig.GetString("HypergridService", string.Empty); | ||
67 | m_HypergridService = ServerUtils.LoadPlugin<IHypergridService>(serviceDll, args); | ||
68 | |||
63 | } | 69 | } |
64 | if (m_GatekeeperService == null) | 70 | if (m_GatekeeperService == null || m_HypergridService == null) |
65 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); | 71 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); |
66 | 72 | ||
67 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); | 73 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService, m_HypergridService); |
68 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); | 74 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); |
75 | server.AddXmlRPCHandler("link_region_by_desc", hghandlers.LinkRegionByDescRequest, false); | ||
69 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | 76 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); |
70 | server.AddXmlRPCHandler("get_home_region", hghandlers.GetHomeRegion, false); | 77 | server.AddXmlRPCHandler("get_home_region", hghandlers.GetHomeRegion, false); |
71 | 78 | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index 846d1c2..1d711a8 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | |||
@@ -44,10 +44,12 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private IGatekeeperService m_GatekeeperService; | 46 | private IGatekeeperService m_GatekeeperService; |
47 | private IHypergridService m_HypergridService; | ||
47 | 48 | ||
48 | public HypergridHandlers(IGatekeeperService gatekeeper) | 49 | public HypergridHandlers(IGatekeeperService gatekeeper, IHypergridService hyper) |
49 | { | 50 | { |
50 | m_GatekeeperService = gatekeeper; | 51 | m_GatekeeperService = gatekeeper; |
52 | m_HypergridService = hyper; | ||
51 | } | 53 | } |
52 | 54 | ||
53 | /// <summary> | 55 | /// <summary> |
@@ -80,6 +82,36 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
80 | return response; | 82 | return response; |
81 | } | 83 | } |
82 | 84 | ||
85 | /// <summary> | ||
86 | /// A local region wants to establish a grid-wide hyperlink to another region | ||
87 | /// </summary> | ||
88 | /// <param name="request"></param> | ||
89 | /// <returns></returns> | ||
90 | public XmlRpcResponse LinkRegionByDescRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
91 | { | ||
92 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
93 | //string host = (string)requestData["host"]; | ||
94 | //string portstr = (string)requestData["port"]; | ||
95 | string descriptor = (string)requestData["region_desc"]; | ||
96 | |||
97 | UUID regionID = UUID.Zero; | ||
98 | string imageURL = string.Empty; | ||
99 | ulong regionHandle = 0; | ||
100 | string reason = string.Empty; | ||
101 | |||
102 | bool success = m_HypergridService.LinkRegion(descriptor, out regionID, out regionHandle, out imageURL, out reason); | ||
103 | |||
104 | Hashtable hash = new Hashtable(); | ||
105 | hash["result"] = success.ToString(); | ||
106 | hash["uuid"] = regionID.ToString(); | ||
107 | hash["handle"] = regionHandle.ToString(); | ||
108 | hash["region_image"] = imageURL; | ||
109 | |||
110 | XmlRpcResponse response = new XmlRpcResponse(); | ||
111 | response.Value = hash; | ||
112 | return response; | ||
113 | } | ||
114 | |||
83 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | 115 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) |
84 | { | 116 | { |
85 | Hashtable requestData = (Hashtable)request.Params[0]; | 117 | Hashtable requestData = (Hashtable)request.Params[0]; |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs index 953c7bd..1786d38 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs | |||
@@ -41,22 +41,49 @@ using OpenMetaverse; | |||
41 | using OpenMetaverse.Imaging; | 41 | using OpenMetaverse.Imaging; |
42 | using log4net; | 42 | using log4net; |
43 | using Nwc.XmlRpc; | 43 | using Nwc.XmlRpc; |
44 | using Nini.Config; | ||
44 | 45 | ||
45 | namespace OpenSim.Services.Connectors.Hypergrid | 46 | namespace OpenSim.Services.Connectors.Hypergrid |
46 | { | 47 | { |
47 | public class HypergridServiceConnector | 48 | public class HypergridServiceConnector : IHypergridService |
48 | { | 49 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 51 | ||
51 | private IAssetService m_AssetService; | 52 | private IAssetService m_AssetService; |
53 | private string m_ServerURL; | ||
52 | 54 | ||
53 | public HypergridServiceConnector() : this(null) { } | 55 | public HypergridServiceConnector() { } |
54 | 56 | ||
55 | public HypergridServiceConnector(IAssetService assService) | 57 | public HypergridServiceConnector(IAssetService assService) |
56 | { | 58 | { |
57 | m_AssetService = assService; | 59 | m_AssetService = assService; |
58 | } | 60 | } |
59 | 61 | ||
62 | public HypergridServiceConnector(IConfigSource source) | ||
63 | { | ||
64 | Initialise(source); | ||
65 | } | ||
66 | |||
67 | public virtual void Initialise(IConfigSource source) | ||
68 | { | ||
69 | IConfig hgConfig = source.Configs["HypergridService"]; | ||
70 | if (hgConfig == null) | ||
71 | { | ||
72 | m_log.Error("[HYPERGRID CONNECTOR]: HypergridService missing from OpenSim.ini"); | ||
73 | throw new Exception("Hypergrid connector init error"); | ||
74 | } | ||
75 | |||
76 | string serviceURI = hgConfig.GetString("HypergridServerURI", | ||
77 | String.Empty); | ||
78 | |||
79 | if (serviceURI == String.Empty) | ||
80 | { | ||
81 | m_log.Error("[HYPERGRID CONNECTOR]: No Server URI named in section HypergridService"); | ||
82 | throw new Exception("Hypergrid connector init error"); | ||
83 | } | ||
84 | m_ServerURL = serviceURI; | ||
85 | } | ||
86 | |||
60 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) | 87 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) |
61 | { | 88 | { |
62 | regionID = UUID.Zero; | 89 | regionID = UUID.Zero; |
@@ -246,5 +273,82 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
246 | 273 | ||
247 | return null; | 274 | return null; |
248 | } | 275 | } |
276 | |||
277 | #region From local regions to grid-wide hypergrid service | ||
278 | |||
279 | public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) | ||
280 | { | ||
281 | regionID = UUID.Zero; | ||
282 | imageURL = string.Empty; | ||
283 | realHandle = 0; | ||
284 | reason = string.Empty; | ||
285 | |||
286 | Hashtable hash = new Hashtable(); | ||
287 | hash["region_desc"] = regionDescriptor; | ||
288 | |||
289 | IList paramList = new ArrayList(); | ||
290 | paramList.Add(hash); | ||
291 | |||
292 | XmlRpcRequest request = new XmlRpcRequest("link_region_by_desc", paramList); | ||
293 | XmlRpcResponse response = null; | ||
294 | try | ||
295 | { | ||
296 | response = request.Send(m_ServerURL, 10000); | ||
297 | } | ||
298 | catch (Exception e) | ||
299 | { | ||
300 | m_log.Debug("[HGrid]: Exception " + e.Message); | ||
301 | reason = "Error contacting remote server"; | ||
302 | return false; | ||
303 | } | ||
304 | |||
305 | if (response.IsFault) | ||
306 | { | ||
307 | reason = response.FaultString; | ||
308 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | ||
309 | return false; | ||
310 | } | ||
311 | |||
312 | hash = (Hashtable)response.Value; | ||
313 | //foreach (Object o in hash) | ||
314 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
315 | try | ||
316 | { | ||
317 | bool success = false; | ||
318 | Boolean.TryParse((string)hash["result"], out success); | ||
319 | if (success) | ||
320 | { | ||
321 | UUID.TryParse((string)hash["uuid"], out regionID); | ||
322 | //m_log.Debug(">> HERE, uuid: " + uuid); | ||
323 | if ((string)hash["handle"] != null) | ||
324 | { | ||
325 | realHandle = Convert.ToUInt64((string)hash["handle"]); | ||
326 | //m_log.Debug(">> HERE, realHandle: " + realHandle); | ||
327 | } | ||
328 | if (hash["region_image"] != null) | ||
329 | { | ||
330 | imageURL = (string)hash["region_image"]; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | } | ||
335 | catch (Exception e) | ||
336 | { | ||
337 | reason = "Error parsing return arguments"; | ||
338 | m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace); | ||
339 | return false; | ||
340 | } | ||
341 | |||
342 | return true; | ||
343 | } | ||
344 | |||
345 | // TODO !!! | ||
346 | public GridRegion GetRegionByUUID(UUID regionID) { return null; } | ||
347 | public GridRegion GetRegionByPosition(int x, int y) { return null; } | ||
348 | public GridRegion GetRegionByName(string name) { return null; } | ||
349 | public List<GridRegion> GetRegionsByName(string name) { return null; } | ||
350 | public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax) { return null; } | ||
351 | |||
352 | #endregion | ||
249 | } | 353 | } |
250 | } | 354 | } |
diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index 3d2a5ba..0c6046f 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example | |||
@@ -42,7 +42,6 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S | |||
42 | ; * | 42 | ; * |
43 | [InventoryService] | 43 | [InventoryService] |
44 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService" | 44 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService" |
45 | UserServerURI = "http://127.0.0.1:8002" | ||
46 | SessionAuthentication = "false" | 45 | SessionAuthentication = "false" |
47 | StorageProvider = "OpenSim.Data.MySQL.dll" | 46 | StorageProvider = "OpenSim.Data.MySQL.dll" |
48 | ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" | 47 | ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" |
@@ -58,10 +57,12 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S | |||
58 | Realm = "regions" | 57 | Realm = "regions" |
59 | ; AllowDuplicateNames = "True" | 58 | ; AllowDuplicateNames = "True" |
60 | ;; Next, we can specify properties of regions, including default and fallback regions | 59 | ;; Next, we can specify properties of regions, including default and fallback regions |
61 | ;; The syntax is: Region_<RegioName> = "<flags>" | 60 | ;; The syntax is: Region_<RegionName> = "<flags>" |
61 | ;; or: Region_<RegionID> = "<flags>" | ||
62 | ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut,Reservation,NoMove,Authenticate | 62 | ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut,Reservation,NoMove,Authenticate |
63 | ;; For example: | 63 | ;; For example: |
64 | ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" | 64 | ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" |
65 | ; (replace spaces with underscore) | ||
65 | 66 | ||
66 | ; * This is the configuration for the freeswitch server in grid mode | 67 | ; * This is the configuration for the freeswitch server in grid mode |
67 | [FreeswitchService] | 68 | [FreeswitchService] |
diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index 4b6bc17..4885a41 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini | |||
@@ -17,18 +17,17 @@ | |||
17 | AvatarServices = "RemoteAvatarServicesConnector" | 17 | AvatarServices = "RemoteAvatarServicesConnector" |
18 | NeighbourServices = "RemoteNeighbourServicesConnector" | 18 | NeighbourServices = "RemoteNeighbourServicesConnector" |
19 | AuthenticationServices = "RemoteAuthenticationServicesConnector" | 19 | AuthenticationServices = "RemoteAuthenticationServicesConnector" |
20 | AuthorizationServices = "LocalAuthorizationServicesConnector" | ||
20 | PresenceServices = "RemotePresenceServicesConnector" | 21 | PresenceServices = "RemotePresenceServicesConnector" |
21 | UserAccountServices = "RemoteUserAccountServicesConnector" | 22 | UserAccountServices = "RemoteUserAccountServicesConnector" |
22 | SimulationServices = "RemoteSimulationConnectorModule" | 23 | SimulationServices = "RemoteSimulationConnectorModule" |
23 | EntityTransferModule = "BasicEntityTransferModule" | 24 | EntityTransferModule = "HGEntityTransferModule" |
24 | LandServiceInConnector = true | 25 | LandServiceInConnector = true |
25 | NeighbourServiceInConnector = true | 26 | NeighbourServiceInConnector = true |
26 | HypergridServiceInConnector = true | ||
27 | SimulationServiceInConnector = true | 27 | SimulationServiceInConnector = true |
28 | LibraryModule = true | 28 | LibraryModule = true |
29 | InventoryServiceInConnector = false | 29 | InventoryServiceInConnector = false |
30 | AssetServiceInConnector = false | 30 | AssetServiceInConnector = false |
31 | LLLoginServiceInConnector = false | ||
32 | 31 | ||
33 | [AssetService] | 32 | [AssetService] |
34 | LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" | 33 | LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" |
@@ -41,12 +40,12 @@ | |||
41 | [GridService] | 40 | [GridService] |
42 | ; for the HGGridServicesConnector to instantiate | 41 | ; for the HGGridServicesConnector to instantiate |
43 | GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector" | 42 | GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector" |
43 | HypergridService = "OpenSim.Services.HypergridService.dll:HypergridService" | ||
44 | ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, | 44 | ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, |
45 | ; which in turn uses this | 45 | ; which in turn uses this |
46 | LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" | 46 | LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" |
47 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" | 47 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" |
48 | 48 | ||
49 | [LibraryService] | 49 | [HypergridService] |
50 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" | 50 | GridService = "OpenSim.Services.GridService.dll:GridService" |
51 | LibraryName = "OpenSim Library" | 51 | AssetService = "OpenSim.Services.AssetService.dll:AssetService" |
52 | DefaultLibrary = "./inventory/Libraries.xml" | ||