diff options
Diffstat (limited to '')
10 files changed, 1264 insertions, 1264 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index 6f2b354..f16bc46 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs | |||
@@ -1,135 +1,135 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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 log4net; | 28 | using log4net; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Server.Base; | 34 | using OpenSim.Server.Base; |
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | 38 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | 39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour |
40 | { | 40 | { |
41 | public class LocalNeighbourServicesConnector : | 41 | public class LocalNeighbourServicesConnector : |
42 | ISharedRegionModule, INeighbourService | 42 | ISharedRegionModule, INeighbourService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private List<Scene> m_Scenes = new List<Scene>(); | 48 | private List<Scene> m_Scenes = new List<Scene>(); |
49 | 49 | ||
50 | private bool m_Enabled = false; | 50 | private bool m_Enabled = false; |
51 | 51 | ||
52 | public LocalNeighbourServicesConnector() | 52 | public LocalNeighbourServicesConnector() |
53 | { | 53 | { |
54 | } | 54 | } |
55 | 55 | ||
56 | public LocalNeighbourServicesConnector(List<Scene> scenes) | 56 | public LocalNeighbourServicesConnector(List<Scene> scenes) |
57 | { | 57 | { |
58 | m_Scenes = scenes; | 58 | m_Scenes = scenes; |
59 | } | 59 | } |
60 | 60 | ||
61 | #region ISharedRegionModule | 61 | #region ISharedRegionModule |
62 | 62 | ||
63 | public string Name | 63 | public string Name |
64 | { | 64 | { |
65 | get { return "LocalNeighbourServicesConnector"; } | 65 | get { return "LocalNeighbourServicesConnector"; } |
66 | } | 66 | } |
67 | 67 | ||
68 | public void Initialise(IConfigSource source) | 68 | public void Initialise(IConfigSource source) |
69 | { | 69 | { |
70 | IConfig moduleConfig = source.Configs["Modules"]; | 70 | IConfig moduleConfig = source.Configs["Modules"]; |
71 | if (moduleConfig != null) | 71 | if (moduleConfig != null) |
72 | { | 72 | { |
73 | string name = moduleConfig.GetString("NeighbourServices", this.Name); | 73 | string name = moduleConfig.GetString("NeighbourServices", this.Name); |
74 | if (name == Name) | 74 | if (name == Name) |
75 | { | 75 | { |
76 | // m_Enabled rules whether this module registers as INeighbourService or not | 76 | // m_Enabled rules whether this module registers as INeighbourService or not |
77 | m_Enabled = true; | 77 | m_Enabled = true; |
78 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled"); | 78 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled"); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void Close() | 83 | public void Close() |
84 | { | 84 | { |
85 | } | 85 | } |
86 | 86 | ||
87 | public void AddRegion(Scene scene) | 87 | public void AddRegion(Scene scene) |
88 | { | 88 | { |
89 | m_Scenes.Add(scene); | 89 | m_Scenes.Add(scene); |
90 | 90 | ||
91 | if (!m_Enabled) | 91 | if (!m_Enabled) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | scene.RegisterModuleInterface<INeighbourService>(this); | 94 | scene.RegisterModuleInterface<INeighbourService>(this); |
95 | } | 95 | } |
96 | 96 | ||
97 | public void RegionLoaded(Scene scene) | 97 | public void RegionLoaded(Scene scene) |
98 | { | 98 | { |
99 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName); | 99 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName); |
100 | } | 100 | } |
101 | 101 | ||
102 | public void PostInitialise() | 102 | public void PostInitialise() |
103 | { | 103 | { |
104 | } | 104 | } |
105 | 105 | ||
106 | public void RemoveRegion(Scene scene) | 106 | public void RemoveRegion(Scene scene) |
107 | { | 107 | { |
108 | // Always remove | 108 | // Always remove |
109 | if (m_Scenes.Contains(scene)) | 109 | if (m_Scenes.Contains(scene)) |
110 | m_Scenes.Remove(scene); | 110 | m_Scenes.Remove(scene); |
111 | } | 111 | } |
112 | 112 | ||
113 | #endregion ISharedRegionModule | 113 | #endregion ISharedRegionModule |
114 | 114 | ||
115 | #region INeighbourService | 115 | #region INeighbourService |
116 | 116 | ||
117 | public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 117 | public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
118 | { | 118 | { |
119 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", | 119 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", |
120 | thisRegion.RegionName, regionHandle, m_Scenes.Count); | 120 | thisRegion.RegionName, regionHandle, m_Scenes.Count); |
121 | foreach (Scene s in m_Scenes) | 121 | foreach (Scene s in m_Scenes) |
122 | { | 122 | { |
123 | if (s.RegionInfo.RegionHandle == regionHandle) | 123 | if (s.RegionInfo.RegionHandle == regionHandle) |
124 | { | 124 | { |
125 | m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); | 125 | m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); |
126 | return s.IncomingHelloNeighbour(thisRegion); | 126 | return s.IncomingHelloNeighbour(thisRegion); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); | 129 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); |
130 | return false; | 130 | return false; |
131 | } | 131 | } |
132 | 132 | ||
133 | #endregion INeighbourService | 133 | #endregion INeighbourService |
134 | } | 134 | } |
135 | } | 135 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs index 9145d11..d584a98 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs | |||
@@ -1,148 +1,148 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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 log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Services.Connectors; | 34 | using OpenSim.Services.Connectors; |
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | 39 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | 40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour |
41 | { | 41 | { |
42 | public class RemoteNeighbourServicesConnector : | 42 | public class RemoteNeighbourServicesConnector : |
43 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService | 43 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService |
44 | { | 44 | { |
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
47 | MethodBase.GetCurrentMethod().DeclaringType); | 47 | MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private bool m_Enabled = false; | 49 | private bool m_Enabled = false; |
50 | private LocalNeighbourServicesConnector m_LocalService; | 50 | private LocalNeighbourServicesConnector m_LocalService; |
51 | private string serviceDll; | 51 | private string serviceDll; |
52 | private List<Scene> m_Scenes = new List<Scene>(); | 52 | private List<Scene> m_Scenes = new List<Scene>(); |
53 | 53 | ||
54 | public string Name | 54 | public string Name |
55 | { | 55 | { |
56 | get { return "RemoteNeighbourServicesConnector"; } | 56 | get { return "RemoteNeighbourServicesConnector"; } |
57 | } | 57 | } |
58 | 58 | ||
59 | public void Initialise(IConfigSource source) | 59 | public void Initialise(IConfigSource source) |
60 | { | 60 | { |
61 | IConfig moduleConfig = source.Configs["Modules"]; | 61 | IConfig moduleConfig = source.Configs["Modules"]; |
62 | if (moduleConfig != null) | 62 | if (moduleConfig != null) |
63 | { | 63 | { |
64 | string name = moduleConfig.GetString("NeighbourServices"); | 64 | string name = moduleConfig.GetString("NeighbourServices"); |
65 | if (name == Name) | 65 | if (name == Name) |
66 | { | 66 | { |
67 | m_LocalService = new LocalNeighbourServicesConnector(); | 67 | m_LocalService = new LocalNeighbourServicesConnector(); |
68 | 68 | ||
69 | //IConfig neighbourConfig = source.Configs["NeighbourService"]; | 69 | //IConfig neighbourConfig = source.Configs["NeighbourService"]; |
70 | //if (neighbourConfig == null) | 70 | //if (neighbourConfig == null) |
71 | //{ | 71 | //{ |
72 | // m_log.Error("[NEIGHBOUR CONNECTOR]: NeighbourService missing from OpenSim.ini"); | 72 | // m_log.Error("[NEIGHBOUR CONNECTOR]: NeighbourService missing from OpenSim.ini"); |
73 | // return; | 73 | // return; |
74 | //} | 74 | //} |
75 | //serviceDll = neighbourConfig.GetString("LocalServiceModule", String.Empty); | 75 | //serviceDll = neighbourConfig.GetString("LocalServiceModule", String.Empty); |
76 | //if (serviceDll == String.Empty) | 76 | //if (serviceDll == String.Empty) |
77 | //{ | 77 | //{ |
78 | // m_log.Error("[NEIGHBOUR CONNECTOR]: No LocalServiceModule named in section NeighbourService"); | 78 | // m_log.Error("[NEIGHBOUR CONNECTOR]: No LocalServiceModule named in section NeighbourService"); |
79 | // return; | 79 | // return; |
80 | //} | 80 | //} |
81 | 81 | ||
82 | m_Enabled = true; | 82 | m_Enabled = true; |
83 | 83 | ||
84 | m_log.Info("[NEIGHBOUR CONNECTOR]: Remote Neighbour connector enabled"); | 84 | m_log.Info("[NEIGHBOUR CONNECTOR]: Remote Neighbour connector enabled"); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | public void PostInitialise() | 89 | public void PostInitialise() |
90 | { | 90 | { |
91 | //if (m_Enabled) | 91 | //if (m_Enabled) |
92 | //{ | 92 | //{ |
93 | // Object[] args = new Object[] { m_Scenes }; | 93 | // Object[] args = new Object[] { m_Scenes }; |
94 | // m_LocalService = | 94 | // m_LocalService = |
95 | // ServerUtils.LoadPlugin<INeighbourService>(serviceDll, | 95 | // ServerUtils.LoadPlugin<INeighbourService>(serviceDll, |
96 | // args); | 96 | // args); |
97 | 97 | ||
98 | // if (m_LocalService == null) | 98 | // if (m_LocalService == null) |
99 | // { | 99 | // { |
100 | // m_log.Error("[NEIGHBOUR CONNECTOR]: Can't load neighbour service"); | 100 | // m_log.Error("[NEIGHBOUR CONNECTOR]: Can't load neighbour service"); |
101 | // Unregister(); | 101 | // Unregister(); |
102 | // return; | 102 | // return; |
103 | // } | 103 | // } |
104 | //} | 104 | //} |
105 | } | 105 | } |
106 | 106 | ||
107 | public void Close() | 107 | public void Close() |
108 | { | 108 | { |
109 | } | 109 | } |
110 | 110 | ||
111 | public void AddRegion(Scene scene) | 111 | public void AddRegion(Scene scene) |
112 | { | 112 | { |
113 | if (!m_Enabled) | 113 | if (!m_Enabled) |
114 | return; | 114 | return; |
115 | 115 | ||
116 | m_MapService = scene.CommsManager.GridService; | 116 | m_MapService = scene.CommsManager.GridService; |
117 | m_LocalService.AddRegion(scene); | 117 | m_LocalService.AddRegion(scene); |
118 | scene.RegisterModuleInterface<INeighbourService>(this); | 118 | scene.RegisterModuleInterface<INeighbourService>(this); |
119 | } | 119 | } |
120 | 120 | ||
121 | public void RemoveRegion(Scene scene) | 121 | public void RemoveRegion(Scene scene) |
122 | { | 122 | { |
123 | if (m_Enabled && m_Scenes.Contains(scene)) | 123 | if (m_Enabled && m_Scenes.Contains(scene)) |
124 | m_LocalService.RemoveRegion(scene); | 124 | m_LocalService.RemoveRegion(scene); |
125 | } | 125 | } |
126 | 126 | ||
127 | public void RegionLoaded(Scene scene) | 127 | public void RegionLoaded(Scene scene) |
128 | { | 128 | { |
129 | if (!m_Enabled) | 129 | if (!m_Enabled) |
130 | return; | 130 | return; |
131 | 131 | ||
132 | m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); | 132 | m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); |
133 | 133 | ||
134 | } | 134 | } |
135 | 135 | ||
136 | #region INeighbourService | 136 | #region INeighbourService |
137 | 137 | ||
138 | public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 138 | public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
139 | { | 139 | { |
140 | if (m_LocalService.HelloNeighbour(regionHandle, thisRegion)) | 140 | if (m_LocalService.HelloNeighbour(regionHandle, thisRegion)) |
141 | return true; | 141 | return true; |
142 | 142 | ||
143 | return base.HelloNeighbour(regionHandle, thisRegion); | 143 | return base.HelloNeighbour(regionHandle, thisRegion); |
144 | } | 144 | } |
145 | 145 | ||
146 | #endregion INeighbourService | 146 | #endregion INeighbourService |
147 | } | 147 | } |
148 | } | 148 | } |
diff --git a/OpenSim/Server/Handlers/Base/Utils.cs b/OpenSim/Server/Handlers/Base/Utils.cs index f1610ff..92372a0 100644 --- a/OpenSim/Server/Handlers/Base/Utils.cs +++ b/OpenSim/Server/Handlers/Base/Utils.cs | |||
@@ -1,97 +1,97 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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.Net; | 30 | using System.Net; |
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | 36 | ||
37 | namespace OpenSim.Server.Handlers.Base | 37 | namespace OpenSim.Server.Handlers.Base |
38 | { | 38 | { |
39 | public class RestHandlerUtils | 39 | public class RestHandlerUtils |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Extract the param from an uri. | 42 | /// Extract the param from an uri. |
43 | /// </summary> | 43 | /// </summary> |
44 | /// <param name="uri">Something like this: /uuid/ or /uuid/handle/release</param> | 44 | /// <param name="uri">Something like this: /uuid/ or /uuid/handle/release</param> |
45 | /// <param name="uri">uuid on uuid field</param> | 45 | /// <param name="uri">uuid on uuid field</param> |
46 | /// <param name="action">optional action</param> | 46 | /// <param name="action">optional action</param> |
47 | public static bool GetParams(string path, out UUID uuid, out ulong regionHandle, out string action) | 47 | public static bool GetParams(string path, out UUID uuid, out ulong regionHandle, out string action) |
48 | { | 48 | { |
49 | uuid = UUID.Zero; | 49 | uuid = UUID.Zero; |
50 | action = ""; | 50 | action = ""; |
51 | regionHandle = 0; | 51 | regionHandle = 0; |
52 | 52 | ||
53 | path = path.Trim(new char[] { '/' }); | 53 | path = path.Trim(new char[] { '/' }); |
54 | string[] parts = path.Split('/'); | 54 | string[] parts = path.Split('/'); |
55 | if (parts.Length <= 1) | 55 | if (parts.Length <= 1) |
56 | { | 56 | { |
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | else | 59 | else |
60 | { | 60 | { |
61 | if (!UUID.TryParse(parts[0], out uuid)) | 61 | if (!UUID.TryParse(parts[0], out uuid)) |
62 | return false; | 62 | return false; |
63 | 63 | ||
64 | if (parts.Length >= 2) | 64 | if (parts.Length >= 2) |
65 | UInt64.TryParse(parts[1], out regionHandle); | 65 | UInt64.TryParse(parts[1], out regionHandle); |
66 | if (parts.Length >= 3) | 66 | if (parts.Length >= 3) |
67 | action = parts[2]; | 67 | action = parts[2]; |
68 | 68 | ||
69 | return true; | 69 | return true; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | public static bool GetAuthentication(OSHttpRequest httpRequest, out string authority, out string authKey) | 73 | public static bool GetAuthentication(OSHttpRequest httpRequest, out string authority, out string authKey) |
74 | { | 74 | { |
75 | authority = string.Empty; | 75 | authority = string.Empty; |
76 | authKey = string.Empty; | 76 | authKey = string.Empty; |
77 | 77 | ||
78 | Uri authUri; | 78 | Uri authUri; |
79 | 79 | ||
80 | string auth = httpRequest.Headers["authentication"]; | 80 | string auth = httpRequest.Headers["authentication"]; |
81 | // Authentication keys look like this: | 81 | // Authentication keys look like this: |
82 | // http://orgrid.org:8002/<uuid> | 82 | // http://orgrid.org:8002/<uuid> |
83 | if ((auth != null) && (!string.Empty.Equals(auth)) && auth != "None") | 83 | if ((auth != null) && (!string.Empty.Equals(auth)) && auth != "None") |
84 | { | 84 | { |
85 | if (Uri.TryCreate(auth, UriKind.Absolute, out authUri)) | 85 | if (Uri.TryCreate(auth, UriKind.Absolute, out authUri)) |
86 | { | 86 | { |
87 | authority = authUri.Authority; | 87 | authority = authUri.Authority; |
88 | authKey = authUri.PathAndQuery.Trim('/'); | 88 | authKey = authUri.PathAndQuery.Trim('/'); |
89 | return true; | 89 | return true; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | return false; | 93 | return false; |
94 | } | 94 | } |
95 | 95 | ||
96 | } | 96 | } |
97 | } | 97 | } |
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index 6336f4f..83fa995 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs | |||
@@ -1,203 +1,203 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Text; | 32 | using System.Text; |
33 | 33 | ||
34 | using OpenSim.Server.Base; | 34 | using OpenSim.Server.Base; |
35 | using OpenSim.Server.Handlers.Base; | 35 | using OpenSim.Server.Handlers.Base; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | 39 | ||
40 | using OpenMetaverse; | 40 | using OpenMetaverse; |
41 | using OpenMetaverse.StructuredData; | 41 | using OpenMetaverse.StructuredData; |
42 | using Nini.Config; | 42 | using Nini.Config; |
43 | using log4net; | 43 | using log4net; |
44 | 44 | ||
45 | 45 | ||
46 | namespace OpenSim.Server.Handlers.Neighbour | 46 | namespace OpenSim.Server.Handlers.Neighbour |
47 | { | 47 | { |
48 | public class NeighbourGetHandler : BaseStreamHandler | 48 | public class NeighbourGetHandler : BaseStreamHandler |
49 | { | 49 | { |
50 | // TODO: unused: private ISimulationService m_SimulationService; | 50 | // TODO: unused: private ISimulationService m_SimulationService; |
51 | // TODO: unused: private IAuthenticationService m_AuthenticationService; | 51 | // TODO: unused: private IAuthenticationService m_AuthenticationService; |
52 | 52 | ||
53 | public NeighbourGetHandler(INeighbourService service, IAuthenticationService authentication) : | 53 | public NeighbourGetHandler(INeighbourService service, IAuthenticationService authentication) : |
54 | base("GET", "/region") | 54 | base("GET", "/region") |
55 | { | 55 | { |
56 | // TODO: unused: m_SimulationService = service; | 56 | // TODO: unused: m_SimulationService = service; |
57 | // TODO: unused: m_AuthenticationService = authentication; | 57 | // TODO: unused: m_AuthenticationService = authentication; |
58 | } | 58 | } |
59 | 59 | ||
60 | public override byte[] Handle(string path, Stream request, | 60 | public override byte[] Handle(string path, Stream request, |
61 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 61 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
62 | { | 62 | { |
63 | // Not implemented yet | 63 | // Not implemented yet |
64 | Console.WriteLine("--- Get region --- " + path); | 64 | Console.WriteLine("--- Get region --- " + path); |
65 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; | 65 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; |
66 | return new byte[] { }; | 66 | return new byte[] { }; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | public class NeighbourPostHandler : BaseStreamHandler | 70 | public class NeighbourPostHandler : BaseStreamHandler |
71 | { | 71 | { |
72 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 72 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
73 | private INeighbourService m_NeighbourService; | 73 | private INeighbourService m_NeighbourService; |
74 | private IAuthenticationService m_AuthenticationService; | 74 | private IAuthenticationService m_AuthenticationService; |
75 | // TODO: unused: private bool m_AllowForeignGuests; | 75 | // TODO: unused: private bool m_AllowForeignGuests; |
76 | 76 | ||
77 | public NeighbourPostHandler(INeighbourService service, IAuthenticationService authentication) : | 77 | public NeighbourPostHandler(INeighbourService service, IAuthenticationService authentication) : |
78 | base("POST", "/region") | 78 | base("POST", "/region") |
79 | { | 79 | { |
80 | m_NeighbourService = service; | 80 | m_NeighbourService = service; |
81 | m_AuthenticationService = authentication; | 81 | m_AuthenticationService = authentication; |
82 | // TODO: unused: m_AllowForeignGuests = foreignGuests; | 82 | // TODO: unused: m_AllowForeignGuests = foreignGuests; |
83 | } | 83 | } |
84 | 84 | ||
85 | public override byte[] Handle(string path, Stream request, | 85 | public override byte[] Handle(string path, Stream request, |
86 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 86 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
87 | { | 87 | { |
88 | byte[] result = new byte[0]; | 88 | byte[] result = new byte[0]; |
89 | 89 | ||
90 | UUID regionID; | 90 | UUID regionID; |
91 | string action; | 91 | string action; |
92 | ulong regionHandle; | 92 | ulong regionHandle; |
93 | if (RestHandlerUtils.GetParams(path, out regionID, out regionHandle, out action)) | 93 | if (RestHandlerUtils.GetParams(path, out regionID, out regionHandle, out action)) |
94 | { | 94 | { |
95 | m_log.InfoFormat("[RegionPostHandler]: Invalid parameters for neighbour message {0}", path); | 95 | m_log.InfoFormat("[RegionPostHandler]: Invalid parameters for neighbour message {0}", path); |
96 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | 96 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; |
97 | httpResponse.StatusDescription = "Invalid parameters for neighbour message " + path; | 97 | httpResponse.StatusDescription = "Invalid parameters for neighbour message " + path; |
98 | 98 | ||
99 | return result; | 99 | return result; |
100 | } | 100 | } |
101 | 101 | ||
102 | if (m_AuthenticationService != null) | 102 | if (m_AuthenticationService != null) |
103 | { | 103 | { |
104 | // Authentication | 104 | // Authentication |
105 | string authority = string.Empty; | 105 | string authority = string.Empty; |
106 | string authToken = string.Empty; | 106 | string authToken = string.Empty; |
107 | if (!RestHandlerUtils.GetAuthentication(httpRequest, out authority, out authToken)) | 107 | if (!RestHandlerUtils.GetAuthentication(httpRequest, out authority, out authToken)) |
108 | { | 108 | { |
109 | m_log.InfoFormat("[RegionPostHandler]: Authentication failed for neighbour message {0}", path); | 109 | m_log.InfoFormat("[RegionPostHandler]: Authentication failed for neighbour message {0}", path); |
110 | httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; | 110 | httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; |
111 | return result; | 111 | return result; |
112 | } | 112 | } |
113 | if (!m_AuthenticationService.VerifyUserKey(regionID, authToken)) | 113 | if (!m_AuthenticationService.VerifyUserKey(regionID, authToken)) |
114 | { | 114 | { |
115 | m_log.InfoFormat("[RegionPostHandler]: Authentication failed for neighbour message {0}", path); | 115 | m_log.InfoFormat("[RegionPostHandler]: Authentication failed for neighbour message {0}", path); |
116 | httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; | 116 | httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; |
117 | return result; | 117 | return result; |
118 | } | 118 | } |
119 | m_log.DebugFormat("[RegionPostHandler]: Authentication succeeded for {0}", regionID); | 119 | m_log.DebugFormat("[RegionPostHandler]: Authentication succeeded for {0}", regionID); |
120 | } | 120 | } |
121 | 121 | ||
122 | OSDMap args = Util.GetOSDMap(request, (int)httpRequest.ContentLength); | 122 | OSDMap args = Util.GetOSDMap(request, (int)httpRequest.ContentLength); |
123 | if (args == null) | 123 | if (args == null) |
124 | { | 124 | { |
125 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | 125 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; |
126 | httpResponse.StatusDescription = "Unable to retrieve data"; | 126 | httpResponse.StatusDescription = "Unable to retrieve data"; |
127 | m_log.DebugFormat("[RegionPostHandler]: Unable to retrieve data for post {0}", path); | 127 | m_log.DebugFormat("[RegionPostHandler]: Unable to retrieve data for post {0}", path); |
128 | return result; | 128 | return result; |
129 | } | 129 | } |
130 | 130 | ||
131 | // retrieve the regionhandle | 131 | // retrieve the regionhandle |
132 | ulong regionhandle = 0; | 132 | ulong regionhandle = 0; |
133 | if (args["destination_handle"] != null) | 133 | if (args["destination_handle"] != null) |
134 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | 134 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); |
135 | 135 | ||
136 | RegionInfo aRegion = new RegionInfo(); | 136 | RegionInfo aRegion = new RegionInfo(); |
137 | try | 137 | try |
138 | { | 138 | { |
139 | aRegion.UnpackRegionInfoData(args); | 139 | aRegion.UnpackRegionInfoData(args); |
140 | } | 140 | } |
141 | catch (Exception ex) | 141 | catch (Exception ex) |
142 | { | 142 | { |
143 | m_log.InfoFormat("[RegionPostHandler]: exception on unpacking region info {0}", ex.Message); | 143 | m_log.InfoFormat("[RegionPostHandler]: exception on unpacking region info {0}", ex.Message); |
144 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | 144 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; |
145 | httpResponse.StatusDescription = "Problems with data deserialization"; | 145 | httpResponse.StatusDescription = "Problems with data deserialization"; |
146 | return result; | 146 | return result; |
147 | } | 147 | } |
148 | 148 | ||
149 | // Finally! | 149 | // Finally! |
150 | bool success = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); | 150 | bool success = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); |
151 | 151 | ||
152 | OSDMap resp = new OSDMap(1); | 152 | OSDMap resp = new OSDMap(1); |
153 | 153 | ||
154 | resp["success"] = OSD.FromBoolean(success); | 154 | resp["success"] = OSD.FromBoolean(success); |
155 | 155 | ||
156 | httpResponse.StatusCode = (int)HttpStatusCode.OK; | 156 | httpResponse.StatusCode = (int)HttpStatusCode.OK; |
157 | 157 | ||
158 | return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); | 158 | return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | public class NeighbourPutHandler : BaseStreamHandler | 162 | public class NeighbourPutHandler : BaseStreamHandler |
163 | { | 163 | { |
164 | // TODO: unused: private ISimulationService m_SimulationService; | 164 | // TODO: unused: private ISimulationService m_SimulationService; |
165 | // TODO: unused: private IAuthenticationService m_AuthenticationService; | 165 | // TODO: unused: private IAuthenticationService m_AuthenticationService; |
166 | 166 | ||
167 | public NeighbourPutHandler(INeighbourService service, IAuthenticationService authentication) : | 167 | public NeighbourPutHandler(INeighbourService service, IAuthenticationService authentication) : |
168 | base("PUT", "/region") | 168 | base("PUT", "/region") |
169 | { | 169 | { |
170 | // TODO: unused: m_SimulationService = service; | 170 | // TODO: unused: m_SimulationService = service; |
171 | // TODO: unused: m_AuthenticationService = authentication; | 171 | // TODO: unused: m_AuthenticationService = authentication; |
172 | } | 172 | } |
173 | 173 | ||
174 | public override byte[] Handle(string path, Stream request, | 174 | public override byte[] Handle(string path, Stream request, |
175 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 175 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
176 | { | 176 | { |
177 | // Not implemented yet | 177 | // Not implemented yet |
178 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; | 178 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; |
179 | return new byte[] { }; | 179 | return new byte[] { }; |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | public class NeighbourDeleteHandler : BaseStreamHandler | 183 | public class NeighbourDeleteHandler : BaseStreamHandler |
184 | { | 184 | { |
185 | // TODO: unused: private ISimulationService m_SimulationService; | 185 | // TODO: unused: private ISimulationService m_SimulationService; |
186 | // TODO: unused: private IAuthenticationService m_AuthenticationService; | 186 | // TODO: unused: private IAuthenticationService m_AuthenticationService; |
187 | 187 | ||
188 | public NeighbourDeleteHandler(INeighbourService service, IAuthenticationService authentication) : | 188 | public NeighbourDeleteHandler(INeighbourService service, IAuthenticationService authentication) : |
189 | base("DELETE", "/region") | 189 | base("DELETE", "/region") |
190 | { | 190 | { |
191 | // TODO: unused: m_SimulationService = service; | 191 | // TODO: unused: m_SimulationService = service; |
192 | // TODO: unused: m_AuthenticationService = authentication; | 192 | // TODO: unused: m_AuthenticationService = authentication; |
193 | } | 193 | } |
194 | 194 | ||
195 | public override byte[] Handle(string path, Stream request, | 195 | public override byte[] Handle(string path, Stream request, |
196 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 196 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
197 | { | 197 | { |
198 | // Not implemented yet | 198 | // Not implemented yet |
199 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; | 199 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; |
200 | return new byte[] { }; | 200 | return new byte[] { }; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | } | 203 | } |
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs index a708b37..b3a91cf 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs | |||
@@ -1,68 +1,68 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Server.Base; | 33 | using OpenSim.Server.Base; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Servers.HttpServer; | 36 | using OpenSim.Framework.Servers.HttpServer; |
37 | using OpenSim.Server.Handlers.Base; | 37 | using OpenSim.Server.Handlers.Base; |
38 | 38 | ||
39 | namespace OpenSim.Server.Handlers.Neighbour | 39 | namespace OpenSim.Server.Handlers.Neighbour |
40 | { | 40 | { |
41 | public class NeighbourServiceInConnector : ServiceConnector | 41 | public class NeighbourServiceInConnector : ServiceConnector |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | private INeighbourService m_NeighbourService; | 45 | private INeighbourService m_NeighbourService; |
46 | private IAuthenticationService m_AuthenticationService = null; | 46 | private IAuthenticationService m_AuthenticationService = null; |
47 | 47 | ||
48 | public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : | 48 | public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : |
49 | base(source, server) | 49 | base(source, server) |
50 | { | 50 | { |
51 | 51 | ||
52 | m_NeighbourService = nService; | 52 | m_NeighbourService = nService; |
53 | if (m_NeighbourService == null) | 53 | if (m_NeighbourService == null) |
54 | { | 54 | { |
55 | m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided"); | 55 | m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided"); |
56 | return; | 56 | return; |
57 | } | 57 | } |
58 | 58 | ||
59 | //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false); | 59 | //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false); |
60 | //if (authentication) | 60 | //if (authentication) |
61 | // m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>(); | 61 | // m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>(); |
62 | 62 | ||
63 | 63 | ||
64 | server.AddStreamHandler(new NeighbourPostHandler(m_NeighbourService, m_AuthenticationService)); | 64 | server.AddStreamHandler(new NeighbourPostHandler(m_NeighbourService, m_AuthenticationService)); |
65 | server.AddStreamHandler(new NeighbourGetHandler(m_NeighbourService, m_AuthenticationService)); | 65 | server.AddStreamHandler(new NeighbourGetHandler(m_NeighbourService, m_AuthenticationService)); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | } | 68 | } |
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index fbb2707..e95b83d 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | |||
@@ -1,170 +1,170 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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 log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
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 Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Servers.HttpServer; | 35 | using OpenSim.Framework.Servers.HttpServer; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | namespace OpenSim.Services.Connectors | 39 | namespace OpenSim.Services.Connectors |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// This connector is temporary. It's used by the user server, before that server is refactored. | 42 | /// This connector is temporary. It's used by the user server, before that server is refactored. |
43 | /// </summary> | 43 | /// </summary> |
44 | public class QuickAndDirtyInventoryServiceConnector : IInventoryService | 44 | public class QuickAndDirtyInventoryServiceConnector : IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private string m_ServerURI = String.Empty; | 50 | private string m_ServerURI = String.Empty; |
51 | 51 | ||
52 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); | 52 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); |
53 | 53 | ||
54 | public QuickAndDirtyInventoryServiceConnector() | 54 | public QuickAndDirtyInventoryServiceConnector() |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | public QuickAndDirtyInventoryServiceConnector(string serverURI) | 58 | public QuickAndDirtyInventoryServiceConnector(string serverURI) |
59 | { | 59 | { |
60 | m_ServerURI = serverURI.TrimEnd('/'); | 60 | m_ServerURI = serverURI.TrimEnd('/'); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | 64 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <param name="userId"></param> | 66 | /// <param name="userId"></param> |
67 | /// <returns></returns> | 67 | /// <returns></returns> |
68 | public bool CreateUserInventory(UUID userId) | 68 | public bool CreateUserInventory(UUID userId) |
69 | { | 69 | { |
70 | return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( | 70 | return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( |
71 | "POST", m_ServerURI + "CreateInventory/", userId.Guid); | 71 | "POST", m_ServerURI + "CreateInventory/", userId.Guid); |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | 75 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <param name="userId"></param> | 77 | /// <param name="userId"></param> |
78 | /// <returns></returns> | 78 | /// <returns></returns> |
79 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 79 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
80 | { | 80 | { |
81 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( | 81 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( |
82 | "POST", m_ServerURI + "RootFolders/", userId.Guid); | 82 | "POST", m_ServerURI + "RootFolders/", userId.Guid); |
83 | } | 83 | } |
84 | 84 | ||
85 | /// <summary> | 85 | /// <summary> |
86 | /// Returns a list of all the active gestures in a user's inventory. | 86 | /// Returns a list of all the active gestures in a user's inventory. |
87 | /// </summary> | 87 | /// </summary> |
88 | /// <param name="userId"> | 88 | /// <param name="userId"> |
89 | /// The <see cref="UUID"/> of the user | 89 | /// The <see cref="UUID"/> of the user |
90 | /// </param> | 90 | /// </param> |
91 | /// <returns> | 91 | /// <returns> |
92 | /// A flat list of the gesture items. | 92 | /// A flat list of the gesture items. |
93 | /// </returns> | 93 | /// </returns> |
94 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | 94 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
95 | { | 95 | { |
96 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>( | 96 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>( |
97 | "POST", m_ServerURI + "ActiveGestures/", userId.Guid); | 97 | "POST", m_ServerURI + "ActiveGestures/", userId.Guid); |
98 | } | 98 | } |
99 | 99 | ||
100 | public InventoryCollection GetUserInventory(UUID userID) | 100 | public InventoryCollection GetUserInventory(UUID userID) |
101 | { | 101 | { |
102 | return null; | 102 | return null; |
103 | } | 103 | } |
104 | 104 | ||
105 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 105 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
106 | { | 106 | { |
107 | } | 107 | } |
108 | 108 | ||
109 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 109 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
110 | { | 110 | { |
111 | return null; | 111 | return null; |
112 | } | 112 | } |
113 | 113 | ||
114 | public bool AddFolder(InventoryFolderBase folder) | 114 | public bool AddFolder(InventoryFolderBase folder) |
115 | { | 115 | { |
116 | return false; | 116 | return false; |
117 | } | 117 | } |
118 | 118 | ||
119 | public bool UpdateFolder(InventoryFolderBase folder) | 119 | public bool UpdateFolder(InventoryFolderBase folder) |
120 | { | 120 | { |
121 | return false; | 121 | return false; |
122 | } | 122 | } |
123 | 123 | ||
124 | public bool MoveFolder(InventoryFolderBase folder) | 124 | public bool MoveFolder(InventoryFolderBase folder) |
125 | { | 125 | { |
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | 128 | ||
129 | public bool PurgeFolder(InventoryFolderBase folder) | 129 | public bool PurgeFolder(InventoryFolderBase folder) |
130 | { | 130 | { |
131 | return false; | 131 | return false; |
132 | } | 132 | } |
133 | 133 | ||
134 | public bool AddItem(InventoryItemBase item) | 134 | public bool AddItem(InventoryItemBase item) |
135 | { | 135 | { |
136 | return false; | 136 | return false; |
137 | } | 137 | } |
138 | 138 | ||
139 | public bool UpdateItem(InventoryItemBase item) | 139 | public bool UpdateItem(InventoryItemBase item) |
140 | { | 140 | { |
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | public bool DeleteItem(InventoryItemBase item) | 144 | public bool DeleteItem(InventoryItemBase item) |
145 | { | 145 | { |
146 | return false; | 146 | return false; |
147 | } | 147 | } |
148 | 148 | ||
149 | public InventoryItemBase QueryItem(InventoryItemBase item) | 149 | public InventoryItemBase QueryItem(InventoryItemBase item) |
150 | { | 150 | { |
151 | return null; | 151 | return null; |
152 | } | 152 | } |
153 | 153 | ||
154 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | 154 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) |
155 | { | 155 | { |
156 | return null; | 156 | return null; |
157 | } | 157 | } |
158 | 158 | ||
159 | public bool HasInventoryForUser(UUID userID) | 159 | public bool HasInventoryForUser(UUID userID) |
160 | { | 160 | { |
161 | return false; | 161 | return false; |
162 | } | 162 | } |
163 | 163 | ||
164 | public InventoryFolderBase RequestRootFolder(UUID userID) | 164 | public InventoryFolderBase RequestRootFolder(UUID userID) |
165 | { | 165 | { |
166 | return null; | 166 | return null; |
167 | } | 167 | } |
168 | 168 | ||
169 | } | 169 | } |
170 | } | 170 | } |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 26f606d..7fff537 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs | |||
@@ -1,166 +1,166 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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 log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Reflection; | 34 | using System.Reflection; |
35 | using System.Text; | 35 | using System.Text; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenMetaverse; | 41 | using OpenMetaverse; |
42 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
43 | 43 | ||
44 | namespace OpenSim.Services.Connectors | 44 | namespace OpenSim.Services.Connectors |
45 | { | 45 | { |
46 | public class NeighbourServicesConnector : INeighbourService | 46 | public class NeighbourServicesConnector : INeighbourService |
47 | { | 47 | { |
48 | private static readonly ILog m_log = | 48 | private static readonly ILog m_log = |
49 | LogManager.GetLogger( | 49 | LogManager.GetLogger( |
50 | MethodBase.GetCurrentMethod().DeclaringType); | 50 | MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | protected IGridServices m_MapService = null; | 52 | protected IGridServices m_MapService = null; |
53 | 53 | ||
54 | public NeighbourServicesConnector() | 54 | public NeighbourServicesConnector() |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | public NeighbourServicesConnector(IGridServices gridServices) | 58 | public NeighbourServicesConnector(IGridServices gridServices) |
59 | { | 59 | { |
60 | Initialise(gridServices); | 60 | Initialise(gridServices); |
61 | } | 61 | } |
62 | 62 | ||
63 | public virtual void Initialise(IGridServices gridServices) | 63 | public virtual void Initialise(IGridServices gridServices) |
64 | { | 64 | { |
65 | m_MapService = gridServices; | 65 | m_MapService = gridServices; |
66 | } | 66 | } |
67 | 67 | ||
68 | public virtual bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 68 | public virtual bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
69 | { | 69 | { |
70 | RegionInfo regInfo = m_MapService.RequestNeighbourInfo(regionHandle); | 70 | RegionInfo regInfo = m_MapService.RequestNeighbourInfo(regionHandle); |
71 | if ((regInfo != null) && | 71 | if ((regInfo != null) && |
72 | // Don't remote-call this instance; that's a startup hickup | 72 | // Don't remote-call this instance; that's a startup hickup |
73 | !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) | 73 | !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) |
74 | { | 74 | { |
75 | return DoHelloNeighbourCall(regInfo, thisRegion); | 75 | return DoHelloNeighbourCall(regInfo, thisRegion); |
76 | } | 76 | } |
77 | //else | 77 | //else |
78 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | 78 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | 81 | ||
82 | public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) | 82 | public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) |
83 | { | 83 | { |
84 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | 84 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; |
85 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); | 85 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); |
86 | 86 | ||
87 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | 87 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); |
88 | HelloNeighbourRequest.Method = "POST"; | 88 | HelloNeighbourRequest.Method = "POST"; |
89 | HelloNeighbourRequest.ContentType = "application/json"; | 89 | HelloNeighbourRequest.ContentType = "application/json"; |
90 | HelloNeighbourRequest.Timeout = 10000; | 90 | HelloNeighbourRequest.Timeout = 10000; |
91 | 91 | ||
92 | // Fill it in | 92 | // Fill it in |
93 | OSDMap args = null; | 93 | OSDMap args = null; |
94 | try | 94 | try |
95 | { | 95 | { |
96 | args = thisRegion.PackRegionInfoData(); | 96 | args = thisRegion.PackRegionInfoData(); |
97 | } | 97 | } |
98 | catch (Exception e) | 98 | catch (Exception e) |
99 | { | 99 | { |
100 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); | 100 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); |
101 | } | 101 | } |
102 | // Add the regionhandle of the destination region | 102 | // Add the regionhandle of the destination region |
103 | args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString()); | 103 | args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString()); |
104 | 104 | ||
105 | string strBuffer = ""; | 105 | string strBuffer = ""; |
106 | byte[] buffer = new byte[1]; | 106 | byte[] buffer = new byte[1]; |
107 | try | 107 | try |
108 | { | 108 | { |
109 | strBuffer = OSDParser.SerializeJsonString(args); | 109 | strBuffer = OSDParser.SerializeJsonString(args); |
110 | UTF8Encoding str = new UTF8Encoding(); | 110 | UTF8Encoding str = new UTF8Encoding(); |
111 | buffer = str.GetBytes(strBuffer); | 111 | buffer = str.GetBytes(strBuffer); |
112 | 112 | ||
113 | } | 113 | } |
114 | catch (Exception e) | 114 | catch (Exception e) |
115 | { | 115 | { |
116 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); | 116 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); |
117 | // ignore. buffer will be empty, caller should check. | 117 | // ignore. buffer will be empty, caller should check. |
118 | } | 118 | } |
119 | 119 | ||
120 | Stream os = null; | 120 | Stream os = null; |
121 | try | 121 | try |
122 | { // send the Post | 122 | { // send the Post |
123 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send | 123 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send |
124 | os = HelloNeighbourRequest.GetRequestStream(); | 124 | os = HelloNeighbourRequest.GetRequestStream(); |
125 | os.Write(buffer, 0, strBuffer.Length); //Send it | 125 | os.Write(buffer, 0, strBuffer.Length); //Send it |
126 | os.Close(); | 126 | os.Close(); |
127 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); | 127 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); |
128 | } | 128 | } |
129 | //catch (WebException ex) | 129 | //catch (WebException ex) |
130 | catch | 130 | catch |
131 | { | 131 | { |
132 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); | 132 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); |
133 | 133 | ||
134 | return false; | 134 | return false; |
135 | } | 135 | } |
136 | 136 | ||
137 | // Let's wait for the response | 137 | // Let's wait for the response |
138 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | 138 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); |
139 | 139 | ||
140 | try | 140 | try |
141 | { | 141 | { |
142 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); | 142 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); |
143 | if (webResponse == null) | 143 | if (webResponse == null) |
144 | { | 144 | { |
145 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); | 145 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); |
146 | } | 146 | } |
147 | 147 | ||
148 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 148 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
149 | //reply = sr.ReadToEnd().Trim(); | 149 | //reply = sr.ReadToEnd().Trim(); |
150 | sr.ReadToEnd().Trim(); | 150 | sr.ReadToEnd().Trim(); |
151 | sr.Close(); | 151 | sr.Close(); |
152 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | 152 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); |
153 | 153 | ||
154 | } | 154 | } |
155 | catch (WebException ex) | 155 | catch (WebException ex) |
156 | { | 156 | { |
157 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); | 157 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); |
158 | // ignore, really | 158 | // ignore, really |
159 | } | 159 | } |
160 | 160 | ||
161 | return true; | 161 | return true; |
162 | 162 | ||
163 | } | 163 | } |
164 | 164 | ||
165 | } | 165 | } |
166 | } | 166 | } |
diff --git a/OpenSim/Services/Interfaces/INeighbourService.cs b/OpenSim/Services/Interfaces/INeighbourService.cs index 841d700..3944486 100644 --- a/OpenSim/Services/Interfaces/INeighbourService.cs +++ b/OpenSim/Services/Interfaces/INeighbourService.cs | |||
@@ -1,38 +1,38 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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 OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | 31 | ||
32 | namespace OpenSim.Services.Interfaces | 32 | namespace OpenSim.Services.Interfaces |
33 | { | 33 | { |
34 | public interface INeighbourService | 34 | public interface INeighbourService |
35 | { | 35 | { |
36 | bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion); | 36 | bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion); |
37 | } | 37 | } |
38 | } | 38 | } |
diff --git a/OpenSim/SimulatorServices/NeighbourServiceInConnectorModule.cs b/OpenSim/SimulatorServices/NeighbourServiceInConnectorModule.cs index e281ebb..8da2e45 100644 --- a/OpenSim/SimulatorServices/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/SimulatorServices/NeighbourServiceInConnectorModule.cs | |||
@@ -1,137 +1,137 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | 34 | using OpenSim.Framework.Servers.HttpServer; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenSim.Server.Handlers.Base; | 38 | using OpenSim.Server.Handlers.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | 40 | ||
41 | 41 | ||
42 | namespace OpenSim.SimulatorServices | 42 | namespace OpenSim.SimulatorServices |
43 | { | 43 | { |
44 | public class NeighbourServiceInConnectorModule : ISharedRegionModule, INeighbourService | 44 | public class NeighbourServiceInConnectorModule : ISharedRegionModule, INeighbourService |
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 | private static bool m_Enabled = false; | 47 | private static bool m_Enabled = false; |
48 | private static bool m_Registered = false; | 48 | private static bool m_Registered = false; |
49 | 49 | ||
50 | private IConfigSource m_Config; | 50 | private IConfigSource m_Config; |
51 | private List<Scene> m_Scenes = new List<Scene>(); | 51 | private List<Scene> m_Scenes = new List<Scene>(); |
52 | 52 | ||
53 | #region IRegionModule interface | 53 | #region IRegionModule interface |
54 | 54 | ||
55 | public void Initialise(IConfigSource config) | 55 | public void Initialise(IConfigSource config) |
56 | { | 56 | { |
57 | m_Config = config; | 57 | m_Config = config; |
58 | 58 | ||
59 | IConfig moduleConfig = config.Configs["Modules"]; | 59 | IConfig moduleConfig = config.Configs["Modules"]; |
60 | if (moduleConfig != null) | 60 | if (moduleConfig != null) |
61 | { | 61 | { |
62 | m_Enabled = moduleConfig.GetBoolean("NeighbourServiceInConnector", false); | 62 | m_Enabled = moduleConfig.GetBoolean("NeighbourServiceInConnector", false); |
63 | if (m_Enabled) | 63 | if (m_Enabled) |
64 | { | 64 | { |
65 | m_log.Info("[NEIGHBOUR IN CONNECTOR]: NeighbourServiceInConnector enabled"); | 65 | m_log.Info("[NEIGHBOUR IN CONNECTOR]: NeighbourServiceInConnector enabled"); |
66 | } | 66 | } |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | public void PostInitialise() | 72 | public void PostInitialise() |
73 | { | 73 | { |
74 | if (!m_Enabled) | 74 | if (!m_Enabled) |
75 | return; | 75 | return; |
76 | 76 | ||
77 | m_log.Info("[NEIGHBOUR IN CONNECTOR]: Starting..."); | 77 | m_log.Info("[NEIGHBOUR IN CONNECTOR]: Starting..."); |
78 | } | 78 | } |
79 | 79 | ||
80 | public void Close() | 80 | public void Close() |
81 | { | 81 | { |
82 | } | 82 | } |
83 | 83 | ||
84 | public string Name | 84 | public string Name |
85 | { | 85 | { |
86 | get { return "NeighbourServiceInConnectorModule"; } | 86 | get { return "NeighbourServiceInConnectorModule"; } |
87 | } | 87 | } |
88 | 88 | ||
89 | public void AddRegion(Scene scene) | 89 | public void AddRegion(Scene scene) |
90 | { | 90 | { |
91 | if (!m_Enabled) | 91 | if (!m_Enabled) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | if (!m_Registered) | 94 | if (!m_Registered) |
95 | { | 95 | { |
96 | m_Registered = true; | 96 | m_Registered = true; |
97 | Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer, this, scene }; | 97 | Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer, this, scene }; |
98 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:NeighbourServiceInConnector", args); | 98 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:NeighbourServiceInConnector", args); |
99 | } | 99 | } |
100 | 100 | ||
101 | m_Scenes.Add(scene); | 101 | m_Scenes.Add(scene); |
102 | 102 | ||
103 | } | 103 | } |
104 | 104 | ||
105 | public void RemoveRegion(Scene scene) | 105 | public void RemoveRegion(Scene scene) |
106 | { | 106 | { |
107 | if (m_Enabled && m_Scenes.Contains(scene)) | 107 | if (m_Enabled && m_Scenes.Contains(scene)) |
108 | m_Scenes.Remove(scene); | 108 | m_Scenes.Remove(scene); |
109 | } | 109 | } |
110 | 110 | ||
111 | public void RegionLoaded(Scene scene) | 111 | public void RegionLoaded(Scene scene) |
112 | { | 112 | { |
113 | } | 113 | } |
114 | 114 | ||
115 | #endregion | 115 | #endregion |
116 | 116 | ||
117 | #region INeighbourService | 117 | #region INeighbourService |
118 | 118 | ||
119 | public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 119 | public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
120 | { | 120 | { |
121 | m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", | 121 | m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", |
122 | thisRegion.RegionName, regionHandle, m_Scenes.Count); | 122 | thisRegion.RegionName, regionHandle, m_Scenes.Count); |
123 | foreach (Scene s in m_Scenes) | 123 | foreach (Scene s in m_Scenes) |
124 | { | 124 | { |
125 | if (s.RegionInfo.RegionHandle == regionHandle) | 125 | if (s.RegionInfo.RegionHandle == regionHandle) |
126 | { | 126 | { |
127 | m_log.Debug("[NEIGHBOUR IN CONNECTOR]: Found region to SendHelloNeighbour"); | 127 | m_log.Debug("[NEIGHBOUR IN CONNECTOR]: Found region to SendHelloNeighbour"); |
128 | return s.IncomingHelloNeighbour(thisRegion); | 128 | return s.IncomingHelloNeighbour(thisRegion); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle); | 131 | m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle); |
132 | return false; | 132 | return false; |
133 | } | 133 | } |
134 | 134 | ||
135 | #endregion INeighbourService | 135 | #endregion INeighbourService |
136 | } | 136 | } |
137 | } | 137 | } |
diff --git a/OpenSim/SimulatorServices/RegionInventoryService.cs b/OpenSim/SimulatorServices/RegionInventoryService.cs index 8422a92..d95058e 100644 --- a/OpenSim/SimulatorServices/RegionInventoryService.cs +++ b/OpenSim/SimulatorServices/RegionInventoryService.cs | |||
@@ -1,102 +1,102 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | 34 | using OpenSim.Framework.Servers.HttpServer; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenSim.Server.Handlers.Base; | 38 | using OpenSim.Server.Handlers.Base; |
39 | 39 | ||
40 | namespace OpenSim.SimulatorServices | 40 | namespace OpenSim.SimulatorServices |
41 | { | 41 | { |
42 | public class RegionInventoryService : ISharedRegionModule | 42 | public class RegionInventoryService : ISharedRegionModule |
43 | { | 43 | { |
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 | private static bool enabled = false; | 45 | private static bool enabled = false; |
46 | 46 | ||
47 | private IConfigSource m_Config; | 47 | private IConfigSource m_Config; |
48 | bool m_Registered = false; | 48 | bool m_Registered = false; |
49 | 49 | ||
50 | #region IRegionModule interface | 50 | #region IRegionModule interface |
51 | 51 | ||
52 | public void Initialise(IConfigSource config) | 52 | public void Initialise(IConfigSource config) |
53 | { | 53 | { |
54 | // This module is only on for standalones in hypergrid mode | 54 | // This module is only on for standalones in hypergrid mode |
55 | enabled = (!config.Configs["Startup"].GetBoolean("gridmode", true)) && | 55 | enabled = (!config.Configs["Startup"].GetBoolean("gridmode", true)) && |
56 | config.Configs["Startup"].GetBoolean("hypergrid", true); | 56 | config.Configs["Startup"].GetBoolean("hypergrid", true); |
57 | m_log.DebugFormat("[RegionInventoryService]: enabled? {0}", enabled); | 57 | m_log.DebugFormat("[RegionInventoryService]: enabled? {0}", enabled); |
58 | m_Config = config; | 58 | m_Config = config; |
59 | } | 59 | } |
60 | 60 | ||
61 | public void PostInitialise() | 61 | public void PostInitialise() |
62 | { | 62 | { |
63 | } | 63 | } |
64 | 64 | ||
65 | public void Close() | 65 | public void Close() |
66 | { | 66 | { |
67 | } | 67 | } |
68 | 68 | ||
69 | public string Name | 69 | public string Name |
70 | { | 70 | { |
71 | get { return "RegionInventoryService"; } | 71 | get { return "RegionInventoryService"; } |
72 | } | 72 | } |
73 | 73 | ||
74 | public void AddRegion(Scene scene) | 74 | public void AddRegion(Scene scene) |
75 | { | 75 | { |
76 | if (!enabled) | 76 | if (!enabled) |
77 | return; | 77 | return; |
78 | 78 | ||
79 | if (!m_Registered) | 79 | if (!m_Registered) |
80 | { | 80 | { |
81 | m_Registered = true; | 81 | m_Registered = true; |
82 | 82 | ||
83 | m_log.Info("[RegionInventoryService]: Starting..."); | 83 | m_log.Info("[RegionInventoryService]: Starting..."); |
84 | 84 | ||
85 | Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer }; | 85 | Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer }; |
86 | 86 | ||
87 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args); | 87 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | public void RemoveRegion(Scene scene) | 91 | public void RemoveRegion(Scene scene) |
92 | { | 92 | { |
93 | } | 93 | } |
94 | 94 | ||
95 | public void RegionLoaded(Scene scene) | 95 | public void RegionLoaded(Scene scene) |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
99 | #endregion | 99 | #endregion |
100 | 100 | ||
101 | } | 101 | } |
102 | } | 102 | } |