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