diff options
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | 263 |
1 files changed, 0 insertions, 263 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs deleted file mode 100644 index dd4d0aa..0000000 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ /dev/null | |||
@@ -1,263 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Runtime.Remoting; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | namespace OpenSim.Region.Communications.OGS1 | ||
36 | { | ||
37 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); | ||
38 | |||
39 | public delegate bool ExpectArrival(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying); | ||
40 | |||
41 | public delegate bool InformRegionPrimGroup(ulong regionHandle, UUID primID, Vector3 Positon, bool isPhysical); | ||
42 | |||
43 | public delegate bool PrimGroupArrival(ulong regionHandle, UUID primID, string objData, int XMLMethod); | ||
44 | |||
45 | public delegate bool RegionUp(RegionUpData region, ulong regionhandle); | ||
46 | |||
47 | public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); | ||
48 | |||
49 | public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID); | ||
50 | |||
51 | public sealed class InterRegionSingleton | ||
52 | { | ||
53 | private static readonly InterRegionSingleton instance = new InterRegionSingleton(); | ||
54 | |||
55 | public event InformRegionChild OnChildAgent; | ||
56 | public event ExpectArrival OnArrival; | ||
57 | public event InformRegionPrimGroup OnPrimGroupNear; | ||
58 | public event PrimGroupArrival OnPrimGroupArrival; | ||
59 | public event RegionUp OnRegionUp; | ||
60 | public event ChildAgentUpdate OnChildAgentUpdate; | ||
61 | public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection; | ||
62 | |||
63 | private InformRegionChild handlerChildAgent = null; // OnChildAgent; | ||
64 | private ExpectArrival handlerArrival = null; // OnArrival; | ||
65 | private InformRegionPrimGroup handlerPrimGroupNear = null; // OnPrimGroupNear; | ||
66 | private PrimGroupArrival handlerPrimGroupArrival = null; // OnPrimGroupArrival; | ||
67 | private RegionUp handlerRegionUp = null; // OnRegionUp; | ||
68 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; | ||
69 | private TellRegionToCloseChildConnection handlerTellRegionToCloseChildConnection = null; // OnTellRegionToCloseChildConnection; | ||
70 | |||
71 | |||
72 | static InterRegionSingleton() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | private InterRegionSingleton() | ||
77 | { | ||
78 | } | ||
79 | |||
80 | public static InterRegionSingleton Instance | ||
81 | { | ||
82 | get { return instance; } | ||
83 | } | ||
84 | |||
85 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
86 | { | ||
87 | handlerChildAgent = OnChildAgent; | ||
88 | if (handlerChildAgent != null) | ||
89 | { | ||
90 | return handlerChildAgent(regionHandle, agentData); | ||
91 | } | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | public bool RegionUp(RegionUpData sregion, ulong regionhandle) | ||
96 | { | ||
97 | handlerRegionUp = OnRegionUp; | ||
98 | if (handlerRegionUp != null) | ||
99 | { | ||
100 | return handlerRegionUp(sregion, regionhandle); | ||
101 | } | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate) | ||
106 | { | ||
107 | handlerChildAgentUpdate = OnChildAgentUpdate; | ||
108 | if (handlerChildAgentUpdate != null) | ||
109 | { | ||
110 | return handlerChildAgentUpdate(regionHandle, cAgentUpdate); | ||
111 | } | ||
112 | return false; | ||
113 | } | ||
114 | |||
115 | public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
116 | { | ||
117 | handlerArrival = OnArrival; | ||
118 | if (handlerArrival != null) | ||
119 | { | ||
120 | return handlerArrival(regionHandle, agentID, position, isFlying); | ||
121 | } | ||
122 | return false; | ||
123 | } | ||
124 | |||
125 | public bool InformRegionPrim(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical) | ||
126 | { | ||
127 | handlerPrimGroupNear = OnPrimGroupNear; | ||
128 | if (handlerPrimGroupNear != null) | ||
129 | { | ||
130 | return handlerPrimGroupNear(regionHandle, primID, position, isPhysical); | ||
131 | } | ||
132 | return false; | ||
133 | } | ||
134 | |||
135 | public bool ExpectPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
136 | { | ||
137 | handlerPrimGroupArrival = OnPrimGroupArrival; | ||
138 | if (handlerPrimGroupArrival != null) | ||
139 | { | ||
140 | return handlerPrimGroupArrival(regionHandle, primID, objData, XMLMethod); | ||
141 | } | ||
142 | return false; | ||
143 | } | ||
144 | |||
145 | public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
146 | { | ||
147 | handlerTellRegionToCloseChildConnection = OnTellRegionToCloseChildConnection; | ||
148 | if (handlerTellRegionToCloseChildConnection != null) | ||
149 | { | ||
150 | return handlerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
151 | } | ||
152 | return false; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public class OGS1InterRegionRemoting : MarshalByRefObject | ||
157 | { | ||
158 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
159 | |||
160 | public OGS1InterRegionRemoting() | ||
161 | { | ||
162 | } | ||
163 | |||
164 | public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData) | ||
165 | { | ||
166 | try | ||
167 | { | ||
168 | return | ||
169 | InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); | ||
170 | } | ||
171 | catch (RemotingException e) | ||
172 | { | ||
173 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
174 | return false; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | public bool RegionUp(RegionUpData region, ulong regionhandle) | ||
179 | { | ||
180 | try | ||
181 | { | ||
182 | return InterRegionSingleton.Instance.RegionUp(region, regionhandle); | ||
183 | } | ||
184 | catch (RemotingException e) | ||
185 | { | ||
186 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
187 | return false; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
192 | { | ||
193 | try | ||
194 | { | ||
195 | return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData); | ||
196 | } | ||
197 | catch (RemotingException e) | ||
198 | { | ||
199 | Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); | ||
200 | return false; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | |||
205 | public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) | ||
206 | { | ||
207 | try | ||
208 | { | ||
209 | return | ||
210 | InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new UUID(agentID), | ||
211 | new Vector3(position.x, position.y, position.z), | ||
212 | isFlying); | ||
213 | } | ||
214 | catch (RemotingException e) | ||
215 | { | ||
216 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
217 | return false; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) | ||
222 | { | ||
223 | try | ||
224 | { | ||
225 | return | ||
226 | InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new UUID(SceneObjectGroupID), | ||
227 | new Vector3(position.x, position.y, position.z), | ||
228 | isPhysical); | ||
229 | } | ||
230 | catch (RemotingException e) | ||
231 | { | ||
232 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
233 | return false; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData, int XMLMethod) | ||
238 | { | ||
239 | try | ||
240 | { | ||
241 | return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new UUID(primID), objData, XMLMethod); | ||
242 | } | ||
243 | catch (RemotingException e) | ||
244 | { | ||
245 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
246 | return false; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID) | ||
251 | { | ||
252 | try | ||
253 | { | ||
254 | return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new UUID(agentID)); | ||
255 | } | ||
256 | catch (RemotingException) | ||
257 | { | ||
258 | m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to remote region: " + regionHandle.ToString()); | ||
259 | return false; | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | } | ||