aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs185
1 files changed, 125 insertions, 60 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
index 43f1782..cfa0a25 100644
--- a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
@@ -1,44 +1,44 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Net; 29using System.Net;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.StructuredData; 31using OpenMetaverse.StructuredData;
32 32
33namespace OpenSim.Region.Environment 33namespace OpenSim.Region.Environment
34{ 34{
35 public class EventQueueHelper 35 public class EventQueueHelper
36 { 36 {
37 private EventQueueHelper() {} // no construction possible, it's an utility class 37 private EventQueueHelper() {} // no construction possible, it's an utility class
38 38
39 public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint) 39 public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
40 { 40 {
41 LLSDMap llsdSimInfo = new LLSDMap(3); 41 LLSDMap llsdSimInfo = new LLSDMap(3);
42 byte[] regionhandle = new byte[8]; 42 byte[] regionhandle = new byte[8];
43 int i = 0; 43 int i = 0;
44 44
@@ -49,24 +49,89 @@ namespace OpenSim.Region.Environment
49 regionhandle[i++] = (byte)((Handle >> 32) % 256); 49 regionhandle[i++] = (byte)((Handle >> 32) % 256);
50 regionhandle[i++] = (byte)((Handle >> 24) % 256); 50 regionhandle[i++] = (byte)((Handle >> 24) % 256);
51 regionhandle[i++] = (byte)((Handle >> 16) % 256); 51 regionhandle[i++] = (byte)((Handle >> 16) % 256);
52 regionhandle[i++] = (byte)((Handle >> 8) % 256); 52 regionhandle[i++] = (byte)((Handle >> 8) % 256);
53 regionhandle[i++] = (byte)(Handle % 256); 53 regionhandle[i++] = (byte)(Handle % 256);
54 54
55 llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle)); 55 llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle));
56 llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes())); 56 llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
57 llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port)); 57 llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
58 58
59 LLSDArray arr = new LLSDArray(1); 59 LLSDArray arr = new LLSDArray(1);
60 arr.Add(llsdSimInfo); 60 arr.Add(llsdSimInfo);
61 61
62 LLSDMap llsdBody = new LLSDMap(1); 62 LLSDMap llsdBody = new LLSDMap(1);
63 llsdBody.Add("SimulatorInfo", arr); 63 llsdBody.Add("SimulatorInfo", arr);
64 64
65 LLSDMap llsdMessage = new LLSDMap(2); 65 LLSDMap llsdMessage = new LLSDMap(2);
66 llsdMessage.Add("message", new LLSDString("EnableSimulator")); 66 llsdMessage.Add("message", new LLSDString("EnableSimulator"));
67 llsdMessage.Add("body", llsdBody); 67 llsdMessage.Add("body", llsdBody);
68 68
69 return llsdMessage; 69 return llsdMessage;
70 }
71 public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt,
72 IPEndPoint newRegionExternalEndPoint,
73 string capsURL, UUID AgentID, UUID SessionID)
74 {
75 LLSDArray LookAtArr = new LLSDArray(3);
76 LookAtArr.Add(LLSD.FromReal(lookAt.X));
77 LookAtArr.Add(LLSD.FromReal(lookAt.Y));
78 LookAtArr.Add(LLSD.FromReal(lookAt.Z));
79
80 LLSDArray PositionArr = new LLSDArray(3);
81 PositionArr.Add(LLSD.FromReal(pos.X));
82 PositionArr.Add(LLSD.FromReal(pos.Y));
83 PositionArr.Add(LLSD.FromReal(pos.Z));
84
85 LLSDMap InfoMap = new LLSDMap(2);
86 InfoMap.Add("LookAt", LookAtArr);
87 InfoMap.Add("Position", PositionArr);
88
89 LLSDArray InfoArr = new LLSDArray(1);
90 InfoArr.Add(InfoMap);
91
92 LLSDMap AgentDataMap = new LLSDMap(2);
93 AgentDataMap.Add("AgentID", LLSD.FromUUID(AgentID));
94 AgentDataMap.Add("SessionID", LLSD.FromUUID(SessionID));
95
96 LLSDArray AgentDataArr = new LLSDArray(1);
97 AgentDataArr.Add(AgentDataMap);
98
99 LLSDMap RegionDataMap = new LLSDMap(4);
100 byte[] regionhandle = new byte[8];
101
102 {
103 int i = 0;
104 regionhandle[i++] = (byte)((Handle >> 56) % 256);
105 regionhandle[i++] = (byte)((Handle >> 48) % 256);
106 regionhandle[i++] = (byte)((Handle >> 40) % 256);
107 regionhandle[i++] = (byte)((Handle >> 32) % 256);
108 regionhandle[i++] = (byte)((Handle >> 24) % 256);
109 regionhandle[i++] = (byte)((Handle >> 16) % 256);
110 regionhandle[i++] = (byte)((Handle >> 8) % 256);
111 regionhandle[i++] = (byte)(Handle % 256);
112 }
113
114 RegionDataMap.Add("RegionHandle", LLSD.FromBinary(regionhandle));
115 RegionDataMap.Add("SeedCapability", LLSD.FromString(capsURL));
116 RegionDataMap.Add("SimIP", LLSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
117 RegionDataMap.Add("SimPort", LLSD.FromInteger(newRegionExternalEndPoint.Port));
118
119 LLSDArray RegionDataArr = new LLSDArray(1);
120 RegionDataArr.Add(RegionDataMap);
121
122
123
124
125 LLSDMap llsdBody = new LLSDMap(3);
126 llsdBody.Add("Info", InfoArr);
127 llsdBody.Add("AgentData", AgentDataArr);
128 llsdBody.Add("RegionData", RegionDataArr);
129
130 LLSDMap llsdMessage = new LLSDMap(2);
131 llsdMessage.Add("message", new LLSDString("CrossedRegion"));
132 llsdMessage.Add("body", llsdBody);
133
134 return llsdMessage;
70 } 135 }
71 public static LLSD KeepAliveEvent() 136 public static LLSD KeepAliveEvent()
72 { 137 {
@@ -76,6 +141,6 @@ namespace OpenSim.Region.Environment
76 llsdMessage.Add("body", llsdSimInfo); 141 llsdMessage.Add("body", llsdSimInfo);
77 142
78 return llsdMessage; 143 return llsdMessage;
79 } 144 }
80 } 145 }
81} 146}