aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs246
1 files changed, 29 insertions, 217 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index 0c4af6e..206c0de 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -41,40 +41,23 @@ namespace OpenSim.Region.ClientStack.Linden
41 { 41 {
42 private EventQueueHelper() {} // no construction possible, it's an utility class 42 private EventQueueHelper() {} // no construction possible, it's an utility class
43 43
44 public static byte[] ulongToByteArray(ulong uLongValue)
45 {
46 // Reverse endianness of RegionHandle
47 return new byte[8]
48 {
49 (byte)((uLongValue >> 56) & 0xff),
50 (byte)((uLongValue >> 48) & 0xff),
51 (byte)((uLongValue >> 40) & 0xff),
52 (byte)((uLongValue >> 32) & 0xff),
53 (byte)((uLongValue >> 24) & 0xff),
54 (byte)((uLongValue >> 16) & 0xff),
55 (byte)((uLongValue >> 8) & 0xff),
56 (byte)(uLongValue & 0xff)
57 };
58 }
59
60 public static StringBuilder StartEvent(string eventName) 44 public static StringBuilder StartEvent(string eventName)
61 { 45 {
62 StringBuilder sb = new StringBuilder(256); 46 StringBuilder sb = new StringBuilder(256);
63 LLSDxmlEncode.AddMap(sb); 47 LLSDxmlEncode.AddMap(sb);
64 LLSDxmlEncode.AddElem("message", eventName, sb); 48 LLSDxmlEncode.AddElem("message", eventName, sb);
65 LLSDxmlEncode.AddMap("body", sb); 49 LLSDxmlEncode.AddMap("body", sb);
66 50
67 return sb; 51 return sb;
68 } 52 }
69 53
70 public static string EndEvent(StringBuilder sb) 54 public static string EndEvent(StringBuilder sb)
71 { 55 {
72 LLSDxmlEncode.AddEndMap(sb); // close body 56 LLSDxmlEncode.AddEndMap(sb); // close body
73 LLSDxmlEncode.AddEndMap(sb); // close event 57 LLSDxmlEncode.AddEndMap(sb); // close event
74 return sb.ToString(); 58 return sb.ToString();
75 } 59 }
76 60
77
78 public static OSD BuildEvent(string eventName, OSD eventBody) 61 public static OSD BuildEvent(string eventName, OSD eventBody)
79 { 62 {
80 OSDMap llsdEvent = new OSDMap(2); 63 OSDMap llsdEvent = new OSDMap(2);
@@ -84,137 +67,6 @@ namespace OpenSim.Region.ClientStack.Linden
84 return llsdEvent; 67 return llsdEvent;
85 } 68 }
86 69
87 public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY)
88 {
89 OSDMap llsdSimInfo = new OSDMap(5);
90
91 llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
92 llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
93 llsdSimInfo.Add("Port", OSD.FromInteger(endPoint.Port));
94 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
95 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
96
97 OSDArray arr = new OSDArray(1);
98 arr.Add(llsdSimInfo);
99
100 OSDMap llsdBody = new OSDMap(1);
101 llsdBody.Add("SimulatorInfo", arr);
102
103 return BuildEvent("EnableSimulator", llsdBody);
104 }
105/*
106 public static OSD DisableSimulator(ulong handle)
107 {
108 //OSDMap llsdSimInfo = new OSDMap(1);
109
110 //llsdSimInfo.Add("Handle", new OSDBinary(regionHandleToByteArray(handle)));
111
112 //OSDArray arr = new OSDArray(1);
113 //arr.Add(llsdSimInfo);
114
115 OSDMap llsdBody = new OSDMap(0);
116 //llsdBody.Add("SimulatorInfo", arr);
117
118 return BuildEvent("DisableSimulator", llsdBody);
119 }
120*/
121 public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
122 IPEndPoint newRegionExternalEndPoint,
123 string capsURL, UUID agentID, UUID sessionID,
124 int regionSizeX, int regionSizeY)
125 {
126 OSDArray lookAtArr = new OSDArray(3);
127 lookAtArr.Add(OSD.FromReal(lookAt.X));
128 lookAtArr.Add(OSD.FromReal(lookAt.Y));
129 lookAtArr.Add(OSD.FromReal(lookAt.Z));
130
131 OSDArray positionArr = new OSDArray(3);
132 positionArr.Add(OSD.FromReal(pos.X));
133 positionArr.Add(OSD.FromReal(pos.Y));
134 positionArr.Add(OSD.FromReal(pos.Z));
135
136 OSDMap infoMap = new OSDMap(2);
137 infoMap.Add("LookAt", lookAtArr);
138 infoMap.Add("Position", positionArr);
139
140 OSDArray infoArr = new OSDArray(1);
141 infoArr.Add(infoMap);
142
143 OSDMap agentDataMap = new OSDMap(2);
144 agentDataMap.Add("AgentID", OSD.FromUUID(agentID));
145 agentDataMap.Add("SessionID", OSD.FromUUID(sessionID));
146
147 OSDArray agentDataArr = new OSDArray(1);
148 agentDataArr.Add(agentDataMap);
149
150 OSDMap regionDataMap = new OSDMap(6);
151 regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle)));
152 regionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
153 regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
154 regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));
155 regionDataMap.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
156 regionDataMap.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
157
158 OSDArray regionDataArr = new OSDArray(1);
159 regionDataArr.Add(regionDataMap);
160
161 OSDMap llsdBody = new OSDMap(3);
162 llsdBody.Add("Info", infoArr);
163 llsdBody.Add("AgentData", agentDataArr);
164 llsdBody.Add("RegionData", regionDataArr);
165
166 return BuildEvent("CrossedRegion", llsdBody);
167 }
168
169 public static OSD TeleportFinishEvent(
170 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
171 uint locationID, uint flags, string capsURL, UUID agentID,
172 int regionSizeX, int regionSizeY)
173 {
174 // not sure why flags get overwritten here
175 if ((flags & (uint)TeleportFlags.IsFlying) != 0)
176 flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying;
177 else
178 flags = (uint)TeleportFlags.ViaLocation;
179
180 OSDMap info = new OSDMap();
181 info.Add("AgentID", OSD.FromUUID(agentID));
182 info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this?
183 info.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle)));
184 info.Add("SeedCapability", OSD.FromString(capsURL));
185 info.Add("SimAccess", OSD.FromInteger(simAccess));
186 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
187 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
188// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
189 info.Add("TeleportFlags", OSD.FromUInteger(flags));
190 info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
191 info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
192
193 OSDArray infoArr = new OSDArray();
194 infoArr.Add(info);
195
196 OSDMap body = new OSDMap();
197 body.Add("Info", infoArr);
198
199 return BuildEvent("TeleportFinish", body);
200 }
201
202 public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap,
203 ulong regionHandle, int regionSizeX, int regionSizeY)
204 {
205 OSDMap body = new OSDMap(6)
206 {
207 {"agent-id", new OSDUUID(agentID)},
208 {"sim-ip-and-port", new OSDString(simIpAndPort)},
209 {"seed-capability", new OSDString(seedcap)},
210 {"region-handle", OSD.FromULong(regionHandle)},
211 {"region-size-x", OSD.FromUInteger((uint)regionSizeX)},
212 {"region-size-y", OSD.FromUInteger((uint)regionSizeY)}
213 };
214
215 return BuildEvent("EstablishAgentCommunication", body);
216 }
217
218 public static OSD KeepAliveEvent() 70 public static OSD KeepAliveEvent()
219 { 71 {
220 return BuildEvent("FAKEEVENT", new OSDMap()); 72 return BuildEvent("FAKEEVENT", new OSDMap());
@@ -261,7 +113,33 @@ namespace OpenSim.Region.ClientStack.Linden
261 messageParams.Add("ttl", new OSDInteger((int)ttl)); 113 messageParams.Add("ttl", new OSDInteger((int)ttl));
262 messageParams.Add("from_id", new OSDUUID(fromAgent)); 114 messageParams.Add("from_id", new OSDUUID(fromAgent));
263 messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0)); 115 messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0));
264 116/*
117 StringBuilder sb = new StringBuilder(256);
118 LLSDxmlEncode.AddMap(sb); //messageParams
119
120 LLSDxmlEncode.AddElem("type", dialog, sb);
121 LLSDxmlEncode.AddElem("position", position, sb);
122 LLSDxmlEncode.AddElem("region_id", UUID.Zero, sb);
123 LLSDxmlEncode.AddElem("to_id", toAgent, sb);
124 LLSDxmlEncode.AddElem("source", 0, sb);
125
126 LLSDxmlEncode.AddMap("data", sb); //messageParams data
127 LLSDxmlEncode.AddElem("binary_bucket", binaryBucket, sb);
128 LLSDxmlEncode.AddEndMap(sb); //messageParams data
129
130 LLSDxmlEncode.AddElem("message", message, sb);
131 LLSDxmlEncode.AddElem("id", transactionID, sb);
132 LLSDxmlEncode.AddElem("from_name", fromName, sb);
133 LLSDxmlEncode.AddElem("timestamp", timeStamp, sb);
134 LLSDxmlEncode.AddElem("offline", (offline ? 1 : 0), sb);
135 LLSDxmlEncode.AddElem("parent_estate_id", parentEstateID, sb);
136 LLSDxmlEncode.AddElem("ttl", (int)ttl, sb);
137 LLSDxmlEncode.AddElem("from_id", fromAgent, sb);
138 LLSDxmlEncode.AddElem("from_group",fromGroup, sb);
139
140 LLSDxmlEncode.AddEndMap(sb); //messageParams
141 string tt = sb.ToString();
142*/
265 return messageParams; 143 return messageParams;
266 } 144 }
267 145
@@ -349,42 +227,6 @@ namespace OpenSim.Region.ClientStack.Linden
349 return chatterBoxForceClose; 227 return chatterBoxForceClose;
350 } 228 }
351 229
352 public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data)
353 {
354 OSDArray AgentData = new OSDArray(1);
355 OSDMap AgentDataMap = new OSDMap(1);
356 AgentDataMap.Add("AgentID", OSD.FromUUID(receiverAgent));
357 AgentData.Add(AgentDataMap);
358
359 OSDArray GroupData = new OSDArray(data.Length);
360 OSDArray NewGroupData = new OSDArray(data.Length);
361
362 foreach (GroupMembershipData membership in data)
363 {
364 OSDMap GroupDataMap = new OSDMap(6);
365 OSDMap NewGroupDataMap = new OSDMap(1);
366
367 GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
368 GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
369 GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
370 GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
371 GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
372 GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
373 NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
374
375 GroupData.Add(GroupDataMap);
376 NewGroupData.Add(NewGroupDataMap);
377 }
378
379 OSDMap llDataStruct = new OSDMap(3);
380 llDataStruct.Add("AgentData", AgentData);
381 llDataStruct.Add("GroupData", GroupData);
382 llDataStruct.Add("NewGroupData", NewGroupData);
383
384 return BuildEvent("AgentGroupDataUpdate", llDataStruct);
385
386 }
387
388 public static OSD PlacesQuery(PlacesReplyPacket PlacesReply) 230 public static OSD PlacesQuery(PlacesReplyPacket PlacesReply)
389 { 231 {
390 OSDMap placesReply = new OSDMap(); 232 OSDMap placesReply = new OSDMap();
@@ -426,35 +268,5 @@ namespace OpenSim.Region.ClientStack.Linden
426 268
427 return placesReply; 269 return placesReply;
428 } 270 }
429
430 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
431 {
432 OSDMap message = new OSDMap();
433 message.Add("message", OSD.FromString("ParcelProperties"));
434 OSD message_body = parcelPropertiesMessage.Serialize();
435 message.Add("body", message_body);
436 return message;
437 }
438
439 public static OSD partPhysicsProperties(uint localID, byte physhapetype,
440 float density, float friction, float bounce, float gravmod)
441 {
442
443 OSDMap physinfo = new OSDMap(6);
444 physinfo["LocalID"] = localID;
445 physinfo["Density"] = density;
446 physinfo["Friction"] = friction;
447 physinfo["GravityMultiplier"] = gravmod;
448 physinfo["Restitution"] = bounce;
449 physinfo["PhysicsShapeType"] = (int)physhapetype;
450
451 OSDArray array = new OSDArray(1);
452 array.Add(physinfo);
453
454 OSDMap llsdBody = new OSDMap(1);
455 llsdBody.Add("ObjectData", array);
456
457 return BuildEvent("ObjectPhysicsProperties", llsdBody);
458 }
459 } 271 }
460} 272}