aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/ILLClientStackNetworkHandler.cs38
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs83
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2989
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs1003
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs2
11 files changed, 1814 insertions, 2327 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLClientStackNetworkHandler.cs
deleted file mode 100644
index ee15171..0000000
--- a/OpenSim/Region/ClientStack/LindenUDP/ILLClientStackNetworkHandler.cs
+++ /dev/null
@@ -1,38 +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 OpenSimulator 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
28using System.Net.Sockets;
29
30namespace OpenSim.Region.ClientStack.LindenUDP
31{
32 public interface ILLClientStackNetworkHandler
33 {
34 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
35 void RemoveClientCircuit(uint circuitcode);
36 void RegisterPacketServer(LLPacketServer server);
37 }
38}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
deleted file mode 100644
index 31f9580..0000000
--- a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
+++ /dev/null
@@ -1,83 +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 OpenSimulator 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
28using System;
29using OpenMetaverse;
30using OpenMetaverse.Packets;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.ClientStack.LindenUDP
34{
35 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
36 public delegate void PacketDrop(Packet pack, Object id);
37 public delegate void QueueEmpty(ThrottleOutPacketType queue);
38 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
39
40 /// <summary>
41 /// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks,
42 /// resends, pings, etc.)
43 /// </summary>
44 public interface ILLPacketHandler : IDisposable
45 {
46 event PacketStats OnPacketStats;
47 event PacketDrop OnPacketDrop;
48 event QueueEmpty OnQueueEmpty;
49 SynchronizeClientHandler SynchronizeClient { set; }
50
51 int PacketsReceived { get; }
52 int PacketsReceivedReported { get; }
53 uint ResendTimeout { get; set; }
54 bool ReliableIsImportant { get; set; }
55 int MaxReliableResends { get; set; }
56
57 /// <summary>
58 /// Initial handling of a received packet. It will be processed later in ProcessInPacket()
59 /// </summary>
60 /// <param name="packet"></param>
61 void InPacket(Packet packet);
62
63 /// <summary>
64 /// Take action depending on the type and contents of an received packet.
65 /// </summary>
66 /// <param name="item"></param>
67 void ProcessInPacket(LLQueItem item);
68
69 void ProcessOutPacket(LLQueItem item);
70 void OutPacket(Packet NewPack,
71 ThrottleOutPacketType throttlePacketType);
72 void OutPacket(Packet NewPack,
73 ThrottleOutPacketType throttlePacketType, Object id);
74 LLPacketQueue PacketQueue { get; }
75 void Flush();
76 void Clear();
77 ClientInfo GetClientInfo();
78 void SetClientInfo(ClientInfo info);
79 void AddImportantPacket(PacketType type);
80 void RemoveImportantPacket(PacketType type);
81 int GetQueueCount(ThrottleOutPacketType queue);
82 }
83}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 19ad0b4..000f455 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -197,12 +197,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
197 m_currentPacket = StartPacket; 197 m_currentPacket = StartPacket;
198 } 198 }
199 199
200 if ((m_imageManager != null) && (m_imageManager.Client != null) && (m_imageManager.Client.PacketHandler != null)) 200 if (m_imageManager != null && m_imageManager.Client != null)
201 if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0) 201 {
202 if (m_imageManager.Client.IsThrottleEmpty(ThrottleOutPacketType.Texture))
202 { 203 {
203 //m_log.Debug("No textures queued, sending one packet to kickstart it"); 204 //m_log.Debug("No textures queued, sending one packet to kickstart it");
204 SendPacket(m_imageManager.Client); 205 SendPacket(m_imageManager.Client);
205 } 206 }
207 }
206 } 208 }
207 } 209 }
208 } 210 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 0052729..31cd53f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -58,442 +58,120 @@ namespace OpenSim.Region.ClientStack.LindenUDP
58 /// </summary> 58 /// </summary>
59 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector 59 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
60 { 60 {
61 // LLClientView Only
62 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
63
64 /// <summary>Used to adjust Sun Orbit values so Linden based viewers properly position sun</summary>
65 private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f;
66
61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
68 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
62 69
63 /* static variables */ 70 private readonly LLUDPServer m_udpServer;
64 public static SynchronizeClientHandler SynchronizeClient; 71 private readonly LLUDPClient m_udpClient;
65 /* private variables */
66 private readonly UUID m_sessionId; 72 private readonly UUID m_sessionId;
67 private readonly UUID m_secureSessionId = UUID.Zero; 73 private readonly UUID m_secureSessionId = UUID.Zero;
74 private readonly UUID m_agentId;
75 private readonly uint m_circuitCode;
76 private readonly byte[] m_channelVersion = Utils.StringToBytes("OpenSimulator Server"); // Dummy value needed by libSL
77 private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
78 private readonly IGroupsModule m_GroupsModule;
68 79
69 private int m_debugPacketLevel; 80 private int m_debugPacketLevel;
70
71 //private readonly IAssetCache m_assetCache;
72 private int m_cachedTextureSerial; 81 private int m_cachedTextureSerial;
73 private Timer m_clientPingTimer; 82 private Timer m_clientPingTimer;
74
75 private Timer m_avatarTerseUpdateTimer; 83 private Timer m_avatarTerseUpdateTimer;
76 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 84 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
77
78 private Timer m_primTerseUpdateTimer; 85 private Timer m_primTerseUpdateTimer;
79 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 86 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
80 private Timer m_primFullUpdateTimer; 87 private Timer m_primFullUpdateTimer;
81 private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = 88 private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = new List<ObjectUpdatePacket.ObjectDataBlock>();
82 new List<ObjectUpdatePacket.ObjectDataBlock>();
83
84 private bool m_clientBlocked; 89 private bool m_clientBlocked;
85
86 private int m_probesWithNoIngressPackets; 90 private int m_probesWithNoIngressPackets;
87
88 private readonly UUID m_agentId;
89 private readonly uint m_circuitCode;
90 private int m_moneyBalance; 91 private int m_moneyBalance;
91 private readonly ILLPacketHandler m_PacketHandler;
92
93 private int m_animationSequenceNumber = 1; 92 private int m_animationSequenceNumber = 1;
94
95 private readonly byte[] m_channelVersion = Utils.StringToBytes("OpenSimulator Server"); // Dummy value needed by libSL
96
97 private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
98
99 private bool m_SendLogoutPacketWhenClosing = true; 93 private bool m_SendLogoutPacketWhenClosing = true;
100
101 private int m_inPacketsChecked; 94 private int m_inPacketsChecked;
102 95 private AgentUpdateArgs lastarg;
103 // Used to adjust Sun Orbit values so Linden based viewers properly position sun 96 private bool m_IsActive = true;
104 private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f;
105
106
107 /* protected variables */
108
109 protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
110 new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
111 97
112 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); 98 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>();
113 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 99 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
114
115 protected IScene m_scene; 100 protected IScene m_scene;
116
117 protected LLPacketServer m_networkServer;
118
119 protected LLImageManager m_imageManager; 101 protected LLImageManager m_imageManager;
120
121 /* public variables */
122 protected string m_firstName; 102 protected string m_firstName;
123 protected string m_lastName; 103 protected string m_lastName;
124 protected Thread m_clientThread; 104 protected Thread m_clientThread;
125 protected Vector3 m_startpos; 105 protected Vector3 m_startpos;
126 protected EndPoint m_userEndPoint; 106 protected EndPoint m_userEndPoint;
127 protected EndPoint m_proxyEndPoint;
128 protected UUID m_activeGroupID = UUID.Zero; 107 protected UUID m_activeGroupID = UUID.Zero;
129 protected string m_activeGroupName = String.Empty; 108 protected string m_activeGroupName = String.Empty;
130 protected ulong m_activeGroupPowers; 109 protected ulong m_activeGroupPowers;
131 protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>(); 110 protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>();
132 protected int m_avatarTerseUpdateRate = 50; 111 protected int m_terrainCheckerCount;
133 protected int m_avatarTerseUpdatesPerPacket = 5;
134 112
135 // LL uses these limits, apparently. Compressed terse would be 113 // LL uses these limits, apparently. Compressed terse would be 23, but we don't have that yet
136 // 23, but we don't have that yet
137 //
138 protected int m_primTerseUpdatesPerPacket = 10; 114 protected int m_primTerseUpdatesPerPacket = 10;
139 protected int m_primFullUpdatesPerPacket = 14; 115 protected int m_primFullUpdatesPerPacket = 14;
140
141 protected int m_primTerseUpdateRate = 10; 116 protected int m_primTerseUpdateRate = 10;
142 protected int m_primFullUpdateRate = 14; 117 protected int m_primFullUpdateRate = 14;
143
144 protected int m_textureSendLimit = 20; 118 protected int m_textureSendLimit = 20;
145 protected int m_textureDataLimit = 10; 119 protected int m_textureDataLimit = 10;
146 120 protected int m_avatarTerseUpdateRate = 50;
121 protected int m_avatarTerseUpdatesPerPacket = 5;
147 protected int m_packetMTU = 1400; 122 protected int m_packetMTU = 1400;
148
149 protected IAssetService m_assetService; 123 protected IAssetService m_assetService;
150 124
151 // LLClientView Only 125 #region Properties
152 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
153
154 /* Instantiated Designated Event Delegates */
155 //- used so we don't create new objects for each incoming packet and then toss it out later */
156
157 private GenericMessage handlerGenericMessage;
158 private RequestAvatarProperties handlerRequestAvatarProperties; //OnRequestAvatarProperties;
159 private UpdateAvatarProperties handlerUpdateAvatarProperties; // OnUpdateAvatarProperties;
160 private ChatMessage handlerChatFromClient; //OnChatFromClient;
161 private ChatMessage handlerChatFromClient2; //OnChatFromClient;
162 private ImprovedInstantMessage handlerInstantMessage; //OnInstantMessage;
163 private FriendActionDelegate handlerApproveFriendRequest; //OnApproveFriendRequest;
164 private FriendshipTermination handlerTerminateFriendship; //OnTerminateFriendship;
165 private RezObject handlerRezObject; //OnRezObject;
166 private DeRezObject handlerDeRezObject; //OnDeRezObject;
167 private ModifyTerrain handlerModifyTerrain;
168 private BakeTerrain handlerBakeTerrain;
169 private EstateChangeInfo handlerEstateChangeInfo;
170 private Action<IClientAPI> handlerRegionHandShakeReply; //OnRegionHandShakeReply;
171 private GenericCall2 handlerRequestWearables; //OnRequestWearables;
172 private Action<IClientAPI> handlerRequestAvatarsData; //OnRequestAvatarsData;
173 private SetAppearance handlerSetAppearance; //OnSetAppearance;
174 private AvatarNowWearing handlerAvatarNowWearing; //OnAvatarNowWearing;
175 private RezSingleAttachmentFromInv handlerRezSingleAttachment; //OnRezSingleAttachmentFromInv;
176 private RezMultipleAttachmentsFromInv handlerRezMultipleAttachments; //OnRezMultipleAttachmentsFromInv;
177 private UUIDNameRequest handlerDetachAttachmentIntoInv; // Detach attachment!
178 private ObjectAttach handlerObjectAttach; //OnObjectAttach;
179 private SetAlwaysRun handlerSetAlwaysRun; //OnSetAlwaysRun;
180 private GenericCall2 handlerCompleteMovementToRegion; //OnCompleteMovementToRegion;
181 private UpdateAgent handlerAgentUpdate; //OnAgentUpdate;
182 private StartAnim handlerStartAnim;
183 private StopAnim handlerStopAnim;
184 private AgentRequestSit handlerAgentRequestSit; //OnAgentRequestSit;
185 private AgentSit handlerAgentSit; //OnAgentSit;
186 private AvatarPickerRequest handlerAvatarPickerRequest; //OnAvatarPickerRequest;
187 private FetchInventory handlerAgentDataUpdateRequest; //OnAgentDataUpdateRequest;
188 private TeleportLocationRequest handlerSetStartLocationRequest; //OnSetStartLocationRequest;
189 private TeleportLandmarkRequest handlerTeleportLandmarkRequest; //OnTeleportLandmarkRequest;
190 private LinkObjects handlerLinkObjects; //OnLinkObjects;
191 private DelinkObjects handlerDelinkObjects; //OnDelinkObjects;
192 private AddNewPrim handlerAddPrim; //OnAddPrim;
193 private UpdateShape handlerUpdatePrimShape; //null;
194 private ObjectExtraParams handlerUpdateExtraParams; //OnUpdateExtraParams;
195 private ObjectDuplicate handlerObjectDuplicate;
196 private ObjectDuplicateOnRay handlerObjectDuplicateOnRay;
197 private ObjectRequest handlerObjectRequest;
198 private ObjectSelect handlerObjectSelect;
199 private ObjectDeselect handlerObjectDeselect;
200 private ObjectIncludeInSearch handlerObjectIncludeInSearch;
201 private UpdatePrimFlags handlerUpdatePrimFlags; //OnUpdatePrimFlags;
202 private UpdatePrimTexture handlerUpdatePrimTexture;
203 private GrabObject handlerGrabObject; //OnGrabObject;
204 private MoveObject handlerGrabUpdate; //OnGrabUpdate;
205 private DeGrabObject handlerDeGrabObject; //OnDeGrabObject;
206 private SpinStart handlerSpinStart; //OnSpinStart;
207 private SpinObject handlerSpinUpdate; //OnSpinUpdate;
208 private SpinStop handlerSpinStop; //OnSpinStop;
209 private GenericCall7 handlerObjectDescription;
210 private GenericCall7 handlerObjectName;
211 private GenericCall7 handlerObjectClickAction;
212 private GenericCall7 handlerObjectMaterial;
213 private ObjectPermissions handlerObjectPermissions;
214 private RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily; //OnRequestObjectPropertiesFamily;
215 //private TextureRequest handlerTextureRequest;
216 private UDPAssetUploadRequest handlerAssetUploadRequest; //OnAssetUploadRequest;
217 private RequestXfer handlerRequestXfer; //OnRequestXfer;
218 private XferReceive handlerXferReceive; //OnXferReceive;
219 private ConfirmXfer handlerConfirmXfer; //OnConfirmXfer;
220 private AbortXfer handlerAbortXfer;
221 private CreateInventoryFolder handlerCreateInventoryFolder; //OnCreateNewInventoryFolder;
222 private UpdateInventoryFolder handlerUpdateInventoryFolder;
223 private MoveInventoryFolder handlerMoveInventoryFolder;
224 private CreateNewInventoryItem handlerCreateNewInventoryItem; //OnCreateNewInventoryItem;
225 private FetchInventory handlerFetchInventory;
226 private FetchInventoryDescendents handlerFetchInventoryDescendents; //OnFetchInventoryDescendents;
227 private PurgeInventoryDescendents handlerPurgeInventoryDescendents; //OnPurgeInventoryDescendents;
228 private UpdateInventoryItem handlerUpdateInventoryItem;
229 private CopyInventoryItem handlerCopyInventoryItem;
230 private MoveInventoryItem handlerMoveInventoryItem;
231 private RemoveInventoryItem handlerRemoveInventoryItem;
232 private RemoveInventoryFolder handlerRemoveInventoryFolder;
233 private RequestTaskInventory handlerRequestTaskInventory; //OnRequestTaskInventory;
234 private UpdateTaskInventory handlerUpdateTaskInventory; //OnUpdateTaskInventory;
235 private MoveTaskInventory handlerMoveTaskItem;
236 private RemoveTaskInventory handlerRemoveTaskItem; //OnRemoveTaskItem;
237 private RezScript handlerRezScript; //OnRezScript;
238 private RequestMapBlocks handlerRequestMapBlocks; //OnRequestMapBlocks;
239 private RequestMapName handlerMapNameRequest; //OnMapNameRequest;
240 private TeleportLocationRequest handlerTeleportLocationRequest; //OnTeleportLocationRequest;
241 private MoneyBalanceRequest handlerMoneyBalanceRequest; //OnMoneyBalanceRequest;
242 private UUIDNameRequest handlerNameRequest;
243 private ParcelAccessListRequest handlerParcelAccessListRequest; //OnParcelAccessListRequest;
244 private ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest; //OnParcelAccessListUpdateRequest;
245 private ParcelPropertiesRequest handlerParcelPropertiesRequest; //OnParcelPropertiesRequest;
246 private ParcelDivideRequest handlerParcelDivideRequest; //OnParcelDivideRequest;
247 private ParcelJoinRequest handlerParcelJoinRequest; //OnParcelJoinRequest;
248 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest; //OnParcelPropertiesUpdateRequest;
249 private ParcelSelectObjects handlerParcelSelectObjects; //OnParcelSelectObjects;
250 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest; //OnParcelObjectOwnerRequest;
251 private ParcelAbandonRequest handlerParcelAbandonRequest;
252 private ParcelGodForceOwner handlerParcelGodForceOwner;
253 private ParcelReclaim handlerParcelReclaim;
254 private RequestTerrain handlerRequestTerrain;
255 private RequestTerrain handlerUploadTerrain;
256 private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest;
257 private RegionInfoRequest handlerRegionInfoRequest; //OnRegionInfoRequest;
258 private EstateCovenantRequest handlerEstateCovenantRequest; //OnEstateCovenantRequest;
259 private RequestGodlikePowers handlerReqGodlikePowers; //OnRequestGodlikePowers;
260 private GodKickUser handlerGodKickUser; //OnGodKickUser;
261 private ViewerEffectEventHandler handlerViewerEffect; //OnViewerEffect;
262 private Action<IClientAPI> handlerLogout; //OnLogout;
263 private MoneyTransferRequest handlerMoneyTransferRequest; //OnMoneyTransferRequest;
264 private ParcelBuy handlerParcelBuy;
265 private EconomyDataRequest handlerEconomoyDataRequest;
266
267 private UpdateVector handlerUpdatePrimSinglePosition; //OnUpdatePrimSinglePosition;
268 private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation; //OnUpdatePrimSingleRotation;
269 private UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition; //OnUpdatePrimSingleRotation;
270 private UpdateVector handlerUpdatePrimScale; //OnUpdatePrimScale;
271 private UpdateVector handlerUpdatePrimGroupScale; //OnUpdateGroupScale;
272 private UpdateVector handlerUpdateVector; //OnUpdatePrimGroupPosition;
273 private UpdatePrimRotation handlerUpdatePrimRotation; //OnUpdatePrimGroupRotation;
274 // private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; //OnUpdatePrimGroupMouseRotation;
275 // private RequestAsset handlerRequestAsset; // OnRequestAsset;
276 private UUIDNameRequest handlerTeleportHomeRequest;
277
278 private RegionHandleRequest handlerRegionHandleRequest; // OnRegionHandleRequest
279 private ParcelInfoRequest handlerParcelInfoRequest; // OnParcelInfoRequest
280
281 private ScriptAnswer handlerScriptAnswer;
282 private RequestPayPrice handlerRequestPayPrice;
283 private ObjectSaleInfo handlerObjectSaleInfo;
284 private ObjectBuy handlerObjectBuy;
285 //private BuyObjectInventory handlerBuyObjectInventory;
286 private ObjectDeselect handlerObjectDetach;
287 private ObjectDrop handlerObjectDrop;
288 private AgentSit handlerOnUndo;
289
290 private ForceReleaseControls handlerForceReleaseControls;
291
292 private GodLandStatRequest handlerLandStatRequest;
293
294 private UUIDNameRequest handlerUUIDGroupNameRequest;
295
296 private ParcelDeedToGroup handlerParcelDeedToGroup;
297
298 private RequestObjectPropertiesFamily handlerObjectGroupRequest;
299 private ScriptReset handlerScriptReset;
300 private GetScriptRunning handlerGetScriptRunning;
301 private SetScriptRunning handlerSetScriptRunning;
302 private UpdateVector handlerAutoPilotGo;
303 //Gesture
304 private ActivateGesture handlerActivateGesture;
305 private DeactivateGesture handlerDeactivateGesture;
306 //Sound
307 private SoundTrigger handlerSoundTrigger;
308 private ObjectOwner handlerObjectOwner;
309
310 private DirPlacesQuery handlerDirPlacesQuery;
311 private DirFindQuery handlerDirFindQuery;
312 private DirLandQuery handlerDirLandQuery;
313 private DirPopularQuery handlerDirPopularQuery;
314 private DirClassifiedQuery handlerDirClassifiedQuery;
315 private ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime;
316
317 private MapItemRequest handlerMapItemRequest;
318
319 private StartLure handlerStartLure;
320 private TeleportLureRequest handlerTeleportLureRequest;
321
322 private NetworkStats handlerNetworkStatsUpdate;
323
324 private ClassifiedInfoRequest handlerClassifiedInfoRequest;
325 private ClassifiedInfoUpdate handlerClassifiedInfoUpdate;
326 private ClassifiedDelete handlerClassifiedDelete;
327 private ClassifiedDelete handlerClassifiedGodDelete;
328
329 private EventNotificationAddRequest handlerEventNotificationAddRequest;
330 private EventNotificationRemoveRequest handlerEventNotificationRemoveRequest;
331 private EventGodDelete handlerEventGodDelete;
332
333 private ParcelDwellRequest handlerParcelDwellRequest;
334
335 private UserInfoRequest handlerUserInfoRequest;
336 private UpdateUserInfo handlerUpdateUserInfo;
337
338 private RetrieveInstantMessages handlerRetrieveInstantMessages;
339
340 private PickDelete handlerPickDelete;
341 private PickGodDelete handlerPickGodDelete;
342 private PickInfoUpdate handlerPickInfoUpdate;
343 private AvatarNotesUpdate handlerAvatarNotesUpdate;
344
345 private MuteListRequest handlerMuteListRequest;
346
347 //private AvatarInterestUpdate handlerAvatarInterestUpdate;
348
349 private PlacesQuery handlerPlacesQuery;
350
351 private readonly IGroupsModule m_GroupsModule;
352
353 private AgentUpdateArgs lastarg = null;
354
355 //private TerrainUnacked handlerUnackedTerrain = null;
356
357 //**
358
359 /* Properties */
360
361 public UUID SecureSessionId
362 {
363 get { return m_secureSessionId; }
364 }
365
366 public IScene Scene
367 {
368 get { return m_scene; }
369 }
370
371 public UUID SessionId
372 {
373 get { return m_sessionId; }
374 }
375 126
127 public UUID SecureSessionId { get { return m_secureSessionId; } }
128 public IScene Scene { get { return m_scene; } }
129 public UUID SessionId { get { return m_sessionId; } }
376 public Vector3 StartPos 130 public Vector3 StartPos
377 { 131 {
378 get { return m_startpos; } 132 get { return m_startpos; }
379 set { m_startpos = value; } 133 set { m_startpos = value; }
380 } 134 }
381 135 public UUID AgentId { get { return m_agentId; } }
382 public UUID AgentId 136 public UUID ActiveGroupId { get { return m_activeGroupID; } }
383 { 137 public string ActiveGroupName { get { return m_activeGroupName; } }
384 get { return m_agentId; } 138 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
385 } 139 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
386
387 public UUID ActiveGroupId
388 {
389 get { return m_activeGroupID; }
390 }
391
392 public string ActiveGroupName
393 {
394 get { return m_activeGroupName; }
395 }
396
397 public ulong ActiveGroupPowers
398 {
399 get { return m_activeGroupPowers; }
400 }
401
402 public bool IsGroupMember(UUID groupID)
403 {
404 return m_groupPowers.ContainsKey(groupID);
405 }
406
407 public ulong GetGroupPowers(UUID groupID)
408 {
409 if (groupID == m_activeGroupID)
410 return m_activeGroupPowers;
411
412 if (m_groupPowers.ContainsKey(groupID))
413 return m_groupPowers[groupID];
414
415 return 0;
416 }
417
418 /// <summary>
419 /// This is a utility method used by single states to not duplicate kicks and blue card of death messages.
420 /// </summary>
421 public bool ChildAgentStatus()
422 {
423 return m_scene.PresenceChildStatus(AgentId);
424 }
425
426 /// <summary> 140 /// <summary>
427 /// First name of the agent/avatar represented by the client 141 /// First name of the agent/avatar represented by the client
428 /// </summary> 142 /// </summary>
429 public string FirstName 143 public string FirstName { get { return m_firstName; } }
430 {
431 get { return m_firstName; }
432 }
433
434 /// <summary> 144 /// <summary>
435 /// Last name of the agent/avatar represented by the client 145 /// Last name of the agent/avatar represented by the client
436 /// </summary> 146 /// </summary>
437 public string LastName 147 public string LastName { get { return m_lastName; } }
438 {
439 get { return m_lastName; }
440 }
441
442 /// <summary> 148 /// <summary>
443 /// Full name of the client (first name and last name) 149 /// Full name of the client (first name and last name)
444 /// </summary> 150 /// </summary>
445 public string Name 151 public string Name { get { return FirstName + " " + LastName; } }
446 { 152 public uint CircuitCode { get { return m_circuitCode; } }
447 get { return FirstName + " " + LastName; } 153 public int MoneyBalance { get { return m_moneyBalance; } }
448 } 154 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
449
450 public uint CircuitCode
451 {
452 get { return m_circuitCode; }
453 }
454
455 public int MoneyBalance
456 {
457 get { return m_moneyBalance; }
458 }
459
460 public int NextAnimationSequenceNumber
461 {
462 get { return m_animationSequenceNumber++; }
463 }
464
465 public ILLPacketHandler PacketHandler
466 {
467 get { return m_PacketHandler; }
468 }
469
470 bool m_IsActive = true;
471
472 public bool IsActive 155 public bool IsActive
473 { 156 {
474 get { return m_IsActive; } 157 get { return m_IsActive; }
475 set { m_IsActive = value; } 158 set { m_IsActive = value; }
476 } 159 }
160 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
477 161
478 public bool SendLogoutPacketWhenClosing 162 #endregion Properties
479 {
480 set { m_SendLogoutPacketWhenClosing = value; }
481 }
482
483 /* METHODS */
484 163
485 /// <summary> 164 /// <summary>
486 /// Constructor 165 /// Constructor
487 /// </summary> 166 /// </summary>
488 public LLClientView( 167 public LLClientView(EndPoint remoteEP, IScene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo,
489 EndPoint remoteEP, IScene scene, LLPacketServer packServer, 168 UUID agentId, UUID sessionId, uint circuitCode)
490 AuthenticateResponse sessionInfo, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP,
491 ClientStackUserSettings userSettings)
492 { 169 {
493 // Should be called first? 170 RegisterInterface<IClientIM>(this);
494 RegisterInterfaces(); 171 RegisterInterface<IClientChat>(this);
495 172 RegisterInterface<IClientIPEndpoint>(this);
496 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 173 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
174
497 m_moneyBalance = 1000; 175 m_moneyBalance = 1000;
498 176
499 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); 177 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion());
@@ -505,14 +183,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
505 183
506 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 184 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
507 185
508 m_networkServer = packServer; 186 m_udpServer = udpServer;
187 m_udpClient = udpClient;
509 188
510 m_agentId = agentId; 189 m_agentId = agentId;
511 m_sessionId = sessionId; 190 m_sessionId = sessionId;
512 m_circuitCode = circuitCode; 191 m_circuitCode = circuitCode;
513 192
514 m_userEndPoint = remoteEP; 193 m_userEndPoint = remoteEP;
515 m_proxyEndPoint = proxyEP;
516 194
517 m_firstName = sessionInfo.LoginInfo.First; 195 m_firstName = sessionInfo.LoginInfo.First;
518 m_lastName = sessionInfo.LoginInfo.Last; 196 m_lastName = sessionInfo.LoginInfo.Last;
@@ -528,40 +206,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
528 // in it to process. It's an on-purpose threadlock though because 206 // in it to process. It's an on-purpose threadlock though because
529 // without it, the clientloop will suck up all sim resources. 207 // without it, the clientloop will suck up all sim resources.
530 208
531 m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); 209 //m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings);
532 m_PacketHandler.SynchronizeClient = SynchronizeClient; 210 //m_PacketHandler.SynchronizeClient = SynchronizeClient;
533 m_PacketHandler.OnPacketStats += PopulateStats; 211 //m_PacketHandler.OnPacketStats += PopulateStats;
534 m_PacketHandler.OnQueueEmpty += HandleQueueEmpty; 212 //m_PacketHandler.OnQueueEmpty += HandleQueueEmpty;
535
536 if (scene.Config != null)
537 {
538 IConfig clientConfig = scene.Config.Configs["LLClient"];
539 if (clientConfig != null)
540 {
541 m_PacketHandler.ReliableIsImportant =
542 clientConfig.GetBoolean("ReliableIsImportant",
543 false);
544 m_PacketHandler.MaxReliableResends = clientConfig.GetInt("MaxReliableResends",
545 m_PacketHandler.MaxReliableResends);
546 m_primTerseUpdatesPerPacket = clientConfig.GetInt("TerseUpdatesPerPacket",
547 m_primTerseUpdatesPerPacket);
548 m_primFullUpdatesPerPacket = clientConfig.GetInt("FullUpdatesPerPacket",
549 m_primFullUpdatesPerPacket);
550
551 m_primTerseUpdateRate = clientConfig.GetInt("TerseUpdateRate",
552 m_primTerseUpdateRate);
553 m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate",
554 m_primFullUpdateRate);
555
556 m_textureSendLimit = clientConfig.GetInt("TextureSendLimit",
557 m_textureSendLimit);
558
559 m_textureDataLimit = clientConfig.GetInt("TextureDataLimit",
560 m_textureDataLimit);
561
562 m_packetMTU = clientConfig.GetInt("PacketMTU", 1400);
563 }
564 }
565 213
566 RegisterLocalPacketHandlers(); 214 RegisterLocalPacketHandlers();
567 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); 215 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
@@ -572,12 +220,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
572 m_debugPacketLevel = newDebugPacketLevel; 220 m_debugPacketLevel = newDebugPacketLevel;
573 } 221 }
574 222
575 # region Client Methods 223 #region Client Methods
576 224
577 private void CloseCleanup(bool shutdownCircuit) 225 private void CloseCleanup(bool shutdownCircuit)
578 { 226 {
579
580
581 m_scene.RemoveClient(AgentId); 227 m_scene.RemoveClient(AgentId);
582 228
583 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 229 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
@@ -645,8 +291,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
645 if (m_imageManager != null) 291 if (m_imageManager != null)
646 m_imageManager.Close(); 292 m_imageManager.Close();
647 293
648 if (m_PacketHandler != null) 294 if (m_udpServer != null)
649 m_PacketHandler.Flush(); 295 m_udpServer.Flush();
650 296
651 // raise an event on the packet server to Shutdown the circuit 297 // raise an event on the packet server to Shutdown the circuit
652 // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup 298 // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup
@@ -700,28 +346,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
700 m_primFullUpdateTimer.Stop(); 346 m_primFullUpdateTimer.Stop();
701 } 347 }
702 348
703 public void Restart()
704 {
705 // re-construct
706 m_PacketHandler.Clear();
707
708 m_clientPingTimer = new Timer(5000);
709 m_clientPingTimer.Elapsed += CheckClientConnectivity;
710 m_clientPingTimer.Enabled = true;
711
712 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate);
713 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates);
714 m_avatarTerseUpdateTimer.AutoReset = false;
715
716 m_primTerseUpdateTimer = new Timer(m_primTerseUpdateRate);
717 m_primTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimTerseUpdates);
718 m_primTerseUpdateTimer.AutoReset = false;
719
720 m_primFullUpdateTimer = new Timer(m_primFullUpdateRate);
721 m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates);
722 m_primFullUpdateTimer.AutoReset = false;
723 }
724
725 private void Terminate() 349 private void Terminate()
726 { 350 {
727 IsActive = false; 351 IsActive = false;
@@ -730,9 +354,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
730 m_avatarTerseUpdateTimer.Close(); 354 m_avatarTerseUpdateTimer.Close();
731 m_primTerseUpdateTimer.Close(); 355 m_primTerseUpdateTimer.Close();
732 m_primFullUpdateTimer.Close(); 356 m_primFullUpdateTimer.Close();
733 357
734 m_PacketHandler.OnPacketStats -= PopulateStats; 358 //m_udpServer.OnPacketStats -= PopulateStats;
735 m_PacketHandler.Dispose(); 359 m_udpClient.Shutdown();
736 360
737 // wait for thread stoped 361 // wait for thread stoped
738 // m_clientThread.Join(); 362 // m_clientThread.Join();
@@ -741,13 +365,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
741 //m_networkServer.CloseClient(this); 365 //m_networkServer.CloseClient(this);
742 } 366 }
743 367
744 #endregion 368 #endregion Client Methods
745 369
746 # region Packet Handling 370 #region Packet Handling
747 371
748 public void PopulateStats(int inPackets, int outPackets, int unAckedBytes) 372 public void PopulateStats(int inPackets, int outPackets, int unAckedBytes)
749 { 373 {
750 handlerNetworkStatsUpdate = OnNetworkStatsUpdate; 374 NetworkStats handlerNetworkStatsUpdate = OnNetworkStatsUpdate;
751 if (handlerNetworkStatsUpdate != null) 375 if (handlerNetworkStatsUpdate != null)
752 { 376 {
753 handlerNetworkStatsUpdate(inPackets, outPackets, unAckedBytes); 377 handlerNetworkStatsUpdate(inPackets, outPackets, unAckedBytes);
@@ -856,86 +480,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
856 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); 480 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
857 } 481 }
858 482
859 /// <summary> 483 #endregion Packet Handling
860 /// Main packet processing loop for the UDP component of the client session. Both incoming and outgoing
861 /// packets are processed here.
862 /// </summary>
863 protected virtual void ClientLoop()
864 {
865 m_log.DebugFormat(
866 "[CLIENT]: Entered main packet processing loop for {0} in {1}", Name, Scene.RegionInfo.RegionName);
867
868 while (IsActive)
869 {
870 LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue();
871
872 if (nextPacket == null) {
873 m_log.DebugFormat("[CLIENT]: PacketQueue return null LLQueItem");
874 continue;
875 }
876
877 if (nextPacket.Incoming)
878 {
879 if (m_debugPacketLevel > 0)
880 DebugPacket("IN", nextPacket.Packet);
881 m_PacketHandler.ProcessInPacket(nextPacket);
882 }
883 else
884 {
885 if (m_debugPacketLevel > 0)
886 DebugPacket("OUT", nextPacket.Packet);
887 m_PacketHandler.ProcessOutPacket(nextPacket);
888 }
889 }
890 }
891
892 # endregion
893
894 protected int m_terrainCheckerCount;
895
896 /// <summary>
897 /// Event handler for check client timer
898 /// Checks to ensure that the client is still connected. If the client has failed to respond to many pings
899 /// in succession then close down the connection.
900 /// </summary>
901 /// <param name="sender"></param>
902 /// <param name="e"></param>
903 protected void CheckClientConnectivity(object sender, ElapsedEventArgs e)
904 {
905 if (m_PacketHandler.PacketsReceived == m_inPacketsChecked)
906 {
907 // no packet came in since the last time we checked...
908
909 m_probesWithNoIngressPackets++;
910 if ((m_probesWithNoIngressPackets > 30 && !m_clientBlocked) // agent active
911 || (m_probesWithNoIngressPackets > 90 && m_clientBlocked)) // agent paused
912 {
913 m_clientPingTimer.Enabled = false;
914
915 m_log.WarnFormat(
916 "[CLIENT]: Client for agent {0} {1} has stopped responding to pings. Closing connection",
917 Name, AgentId);
918
919 if (OnConnectionClosed != null)
920 {
921 OnConnectionClosed(this);
922 }
923 }
924 else
925 {
926 // this will normally trigger at least one packet (ping response)
927 SendStartPingCheck(0);
928 }
929 }
930 else
931 {
932 // Something received in the meantime - we can reset the counters
933 m_probesWithNoIngressPackets = 0;
934 // ... and store the current number of packets received to find out if another one got in on the next cycle
935 m_inPacketsChecked = m_PacketHandler.PacketsReceived;
936 }
937
938 }
939 484
940 # region Setup 485 # region Setup
941 486
@@ -947,11 +492,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
947 { 492 {
948 //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); 493 //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
949 494
950 // Ping the client regularly to check that it's still there
951 m_clientPingTimer = new Timer(5000);
952 m_clientPingTimer.Elapsed += CheckClientConnectivity;
953 m_clientPingTimer.Enabled = true;
954
955 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); 495 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate);
956 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); 496 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates);
957 m_avatarTerseUpdateTimer.AutoReset = false; 497 m_avatarTerseUpdateTimer.AutoReset = false;
@@ -981,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
981 /// <summary> 521 /// <summary>
982 /// Run a user session. This method lies at the base of the entire client thread. 522 /// Run a user session. This method lies at the base of the entire client thread.
983 /// </summary> 523 /// </summary>
984 protected virtual void RunUserSession() 524 protected void RunUserSession()
985 { 525 {
986 //tell this thread we are using the culture set up for the sim (currently hardcoded to en_US) 526 //tell this thread we are using the culture set up for the sim (currently hardcoded to en_US)
987 //otherwise it will override this and use the system default 527 //otherwise it will override this and use the system default
@@ -991,7 +531,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
991 { 531 {
992 // This sets up all the timers 532 // This sets up all the timers
993 InitNewClient(); 533 InitNewClient();
994 ClientLoop();
995 } 534 }
996 catch (Exception e) 535 catch (Exception e)
997 { 536 {
@@ -1015,11 +554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1015 + "Any further actions taken will not be processed.\n" 554 + "Any further actions taken will not be processed.\n"
1016 + "Please relog", true); 555 + "Please relog", true);
1017 556
1018 LLQueItem item = new LLQueItem(); 557 m_udpServer.SendPacket(m_agentId, packet, ThrottleOutPacketType.Unknown, false);
1019 item.Packet = packet;
1020 item.Sequence = packet.Header.Sequence;
1021
1022 m_PacketHandler.ProcessOutPacket(item);
1023 558
1024 // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to 559 // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to
1025 // listeners yet, though. 560 // listeners yet, though.
@@ -1037,7 +572,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1037 572
1038 # endregion 573 # endregion
1039 574
1040 // Previously ClientView.API partial class 575 #region Events
576
1041 public event GenericMessage OnGenericMessage; 577 public event GenericMessage OnGenericMessage;
1042 public event BinaryGenericMessage OnBinaryGenericMessage; 578 public event BinaryGenericMessage OnBinaryGenericMessage;
1043 public event Action<IClientAPI> OnLogout; 579 public event Action<IClientAPI> OnLogout;
@@ -1197,13 +733,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1197 public event GetScriptRunning OnGetScriptRunning; 733 public event GetScriptRunning OnGetScriptRunning;
1198 public event SetScriptRunning OnSetScriptRunning; 734 public event SetScriptRunning OnSetScriptRunning;
1199 public event UpdateVector OnAutoPilotGo; 735 public event UpdateVector OnAutoPilotGo;
1200
1201 public event TerrainUnacked OnUnackedTerrain; 736 public event TerrainUnacked OnUnackedTerrain;
1202
1203 public event ActivateGesture OnActivateGesture; 737 public event ActivateGesture OnActivateGesture;
1204 public event DeactivateGesture OnDeactivateGesture; 738 public event DeactivateGesture OnDeactivateGesture;
1205 public event ObjectOwner OnObjectOwner; 739 public event ObjectOwner OnObjectOwner;
1206
1207 public event DirPlacesQuery OnDirPlacesQuery; 740 public event DirPlacesQuery OnDirPlacesQuery;
1208 public event DirFindQuery OnDirFindQuery; 741 public event DirFindQuery OnDirFindQuery;
1209 public event DirLandQuery OnDirLandQuery; 742 public event DirLandQuery OnDirLandQuery;
@@ -1211,45 +744,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1211 public event DirClassifiedQuery OnDirClassifiedQuery; 744 public event DirClassifiedQuery OnDirClassifiedQuery;
1212 public event EventInfoRequest OnEventInfoRequest; 745 public event EventInfoRequest OnEventInfoRequest;
1213 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime; 746 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
1214
1215 public event MapItemRequest OnMapItemRequest; 747 public event MapItemRequest OnMapItemRequest;
1216
1217 public event OfferCallingCard OnOfferCallingCard; 748 public event OfferCallingCard OnOfferCallingCard;
1218 public event AcceptCallingCard OnAcceptCallingCard; 749 public event AcceptCallingCard OnAcceptCallingCard;
1219 public event DeclineCallingCard OnDeclineCallingCard; 750 public event DeclineCallingCard OnDeclineCallingCard;
1220 public event SoundTrigger OnSoundTrigger; 751 public event SoundTrigger OnSoundTrigger;
1221
1222 public event StartLure OnStartLure; 752 public event StartLure OnStartLure;
1223 public event TeleportLureRequest OnTeleportLureRequest; 753 public event TeleportLureRequest OnTeleportLureRequest;
1224 public event NetworkStats OnNetworkStatsUpdate; 754 public event NetworkStats OnNetworkStatsUpdate;
1225
1226 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 755 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
1227 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 756 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
1228 public event ClassifiedDelete OnClassifiedDelete; 757 public event ClassifiedDelete OnClassifiedDelete;
1229 public event ClassifiedDelete OnClassifiedGodDelete; 758 public event ClassifiedDelete OnClassifiedGodDelete;
1230
1231 public event EventNotificationAddRequest OnEventNotificationAddRequest; 759 public event EventNotificationAddRequest OnEventNotificationAddRequest;
1232 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 760 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
1233 public event EventGodDelete OnEventGodDelete; 761 public event EventGodDelete OnEventGodDelete;
1234
1235 public event ParcelDwellRequest OnParcelDwellRequest; 762 public event ParcelDwellRequest OnParcelDwellRequest;
1236
1237 public event UserInfoRequest OnUserInfoRequest; 763 public event UserInfoRequest OnUserInfoRequest;
1238 public event UpdateUserInfo OnUpdateUserInfo; 764 public event UpdateUserInfo OnUpdateUserInfo;
1239
1240 public event RetrieveInstantMessages OnRetrieveInstantMessages; 765 public event RetrieveInstantMessages OnRetrieveInstantMessages;
1241
1242 public event PickDelete OnPickDelete; 766 public event PickDelete OnPickDelete;
1243 public event PickGodDelete OnPickGodDelete; 767 public event PickGodDelete OnPickGodDelete;
1244 public event PickInfoUpdate OnPickInfoUpdate; 768 public event PickInfoUpdate OnPickInfoUpdate;
1245 public event AvatarNotesUpdate OnAvatarNotesUpdate; 769 public event AvatarNotesUpdate OnAvatarNotesUpdate;
1246
1247 public event MuteListRequest OnMuteListRequest; 770 public event MuteListRequest OnMuteListRequest;
1248 771 public event AvatarInterestUpdate OnAvatarInterestUpdate;
1249 //public event AvatarInterestUpdate OnAvatarInterestUpdate;
1250
1251 public event PlacesQuery OnPlacesQuery; 772 public event PlacesQuery OnPlacesQuery;
1252 773
774 #endregion Events
775
1253 public void ActivateGesture(UUID assetId, UUID gestureId) 776 public void ActivateGesture(UUID assetId, UUID gestureId)
1254 { 777 {
1255 } 778 }
@@ -2768,7 +2291,953 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2768 OutPacket(avatarReply, ThrottleOutPacketType.Task); 2291 OutPacket(avatarReply, ThrottleOutPacketType.Task);
2769 } 2292 }
2770 2293
2771 #endregion 2294 /// <summary>
2295 /// Send the client an Estate message blue box pop-down with a single OK button
2296 /// </summary>
2297 /// <param name="FromAvatarID"></param>
2298 /// <param name="fromSessionID"></param>
2299 /// <param name="FromAvatarName"></param>
2300 /// <param name="Message"></param>
2301 public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
2302 {
2303 if (!ChildAgentStatus())
2304 SendInstantMessage(new GridInstantMessage(null, FromAvatarID, FromAvatarName, AgentId, 1, Message, false, new Vector3()));
2305
2306 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
2307 }
2308
2309 public void SendLogoutPacket()
2310 {
2311 // I know this is a bit of a hack, however there are times when you don't
2312 // want to send this, but still need to do the rest of the shutdown process
2313 // this method gets called from the packet server.. which makes it practically
2314 // impossible to do any other way.
2315
2316 if (m_SendLogoutPacketWhenClosing)
2317 {
2318 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
2319 // TODO: don't create new blocks if recycling an old packet
2320 logReply.AgentData.AgentID = AgentId;
2321 logReply.AgentData.SessionID = SessionId;
2322 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
2323 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
2324 logReply.InventoryData[0].ItemID = UUID.Zero;
2325
2326 OutPacket(logReply, ThrottleOutPacketType.Task);
2327 }
2328 }
2329
2330 public void SendHealth(float health)
2331 {
2332 HealthMessagePacket healthpacket = (HealthMessagePacket)PacketPool.Instance.GetPacket(PacketType.HealthMessage);
2333 healthpacket.HealthData.Health = health;
2334 OutPacket(healthpacket, ThrottleOutPacketType.Task);
2335 }
2336
2337 public void SendAgentOnline(UUID[] agentIDs)
2338 {
2339 OnlineNotificationPacket onp = new OnlineNotificationPacket();
2340 OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length];
2341 for (int i = 0; i < agentIDs.Length; i++)
2342 {
2343 OnlineNotificationPacket.AgentBlockBlock onpbl = new OnlineNotificationPacket.AgentBlockBlock();
2344 onpbl.AgentID = agentIDs[i];
2345 onpb[i] = onpbl;
2346 }
2347 onp.AgentBlock = onpb;
2348 onp.Header.Reliable = true;
2349 OutPacket(onp, ThrottleOutPacketType.Task);
2350 }
2351
2352 public void SendAgentOffline(UUID[] agentIDs)
2353 {
2354 OfflineNotificationPacket offp = new OfflineNotificationPacket();
2355 OfflineNotificationPacket.AgentBlockBlock[] offpb = new OfflineNotificationPacket.AgentBlockBlock[agentIDs.Length];
2356 for (int i = 0; i < agentIDs.Length; i++)
2357 {
2358 OfflineNotificationPacket.AgentBlockBlock onpbl = new OfflineNotificationPacket.AgentBlockBlock();
2359 onpbl.AgentID = agentIDs[i];
2360 offpb[i] = onpbl;
2361 }
2362 offp.AgentBlock = offpb;
2363 offp.Header.Reliable = true;
2364 OutPacket(offp, ThrottleOutPacketType.Task);
2365 }
2366
2367 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
2368 Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
2369 {
2370 AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
2371 avatarSitResponse.SitObject.ID = TargetID;
2372 if (CameraAtOffset != Vector3.Zero)
2373 {
2374 avatarSitResponse.SitTransform.CameraAtOffset = CameraAtOffset;
2375 avatarSitResponse.SitTransform.CameraEyeOffset = CameraEyeOffset;
2376 }
2377 avatarSitResponse.SitTransform.ForceMouselook = ForceMouseLook;
2378 avatarSitResponse.SitTransform.AutoPilot = autopilot;
2379 avatarSitResponse.SitTransform.SitPosition = OffsetPos;
2380 avatarSitResponse.SitTransform.SitRotation = SitOrientation;
2381
2382 OutPacket(avatarSitResponse, ThrottleOutPacketType.Task);
2383 }
2384
2385 public void SendAdminResponse(UUID Token, uint AdminLevel)
2386 {
2387 GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket();
2388 GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock();
2389 GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock();
2390
2391 adb.AgentID = AgentId;
2392 adb.SessionID = SessionId; // More security
2393 gdb.GodLevel = (byte)AdminLevel;
2394 gdb.Token = Token;
2395 //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock;
2396 respondPacket.GrantData = gdb;
2397 respondPacket.AgentData = adb;
2398 OutPacket(respondPacket, ThrottleOutPacketType.Task);
2399 }
2400
2401 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
2402 {
2403 m_groupPowers.Clear();
2404
2405 AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket();
2406 AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length];
2407 for (int i = 0; i < GroupMembership.Length; i++)
2408 {
2409 m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers;
2410
2411 AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock();
2412 Group.AcceptNotices = GroupMembership[i].AcceptNotices;
2413 Group.Contribution = GroupMembership[i].Contribution;
2414 Group.GroupID = GroupMembership[i].GroupID;
2415 Group.GroupInsigniaID = GroupMembership[i].GroupPicture;
2416 Group.GroupName = Utils.StringToBytes(GroupMembership[i].GroupName);
2417 Group.GroupPowers = GroupMembership[i].GroupPowers;
2418 Groups[i] = Group;
2419
2420
2421 }
2422 Groupupdate.GroupData = Groups;
2423 Groupupdate.AgentData = new AgentGroupDataUpdatePacket.AgentDataBlock();
2424 Groupupdate.AgentData.AgentID = AgentId;
2425 OutPacket(Groupupdate, ThrottleOutPacketType.Task);
2426
2427 try
2428 {
2429 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
2430 if (eq != null)
2431 {
2432 eq.GroupMembership(Groupupdate, this.AgentId);
2433 }
2434 }
2435 catch (Exception ex)
2436 {
2437 m_log.Error("Unable to send group membership data via eventqueue - exception: " + ex.ToString());
2438 m_log.Warn("sending group membership data via UDP");
2439 OutPacket(Groupupdate, ThrottleOutPacketType.Task);
2440 }
2441 }
2442
2443
2444 public void SendGroupNameReply(UUID groupLLUID, string GroupName)
2445 {
2446 UUIDGroupNameReplyPacket pack = new UUIDGroupNameReplyPacket();
2447 UUIDGroupNameReplyPacket.UUIDNameBlockBlock[] uidnameblock = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock[1];
2448 UUIDGroupNameReplyPacket.UUIDNameBlockBlock uidnamebloc = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock();
2449 uidnamebloc.ID = groupLLUID;
2450 uidnamebloc.GroupName = Utils.StringToBytes(GroupName);
2451 uidnameblock[0] = uidnamebloc;
2452 pack.UUIDNameBlock = uidnameblock;
2453 OutPacket(pack, ThrottleOutPacketType.Task);
2454 }
2455
2456 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
2457 {
2458 LandStatReplyPacket lsrp = new LandStatReplyPacket();
2459 // LandStatReplyPacket.RequestDataBlock lsreqdpb = new LandStatReplyPacket.RequestDataBlock();
2460 LandStatReplyPacket.ReportDataBlock[] lsrepdba = new LandStatReplyPacket.ReportDataBlock[lsrpia.Length];
2461 //LandStatReplyPacket.ReportDataBlock lsrepdb = new LandStatReplyPacket.ReportDataBlock();
2462 // lsrepdb.
2463 lsrp.RequestData.ReportType = reportType;
2464 lsrp.RequestData.RequestFlags = requestFlags;
2465 lsrp.RequestData.TotalObjectCount = resultCount;
2466 for (int i = 0; i < lsrpia.Length; i++)
2467 {
2468 LandStatReplyPacket.ReportDataBlock lsrepdb = new LandStatReplyPacket.ReportDataBlock();
2469 lsrepdb.LocationX = lsrpia[i].LocationX;
2470 lsrepdb.LocationY = lsrpia[i].LocationY;
2471 lsrepdb.LocationZ = lsrpia[i].LocationZ;
2472 lsrepdb.Score = lsrpia[i].Score;
2473 lsrepdb.TaskID = lsrpia[i].TaskID;
2474 lsrepdb.TaskLocalID = lsrpia[i].TaskLocalID;
2475 lsrepdb.TaskName = Utils.StringToBytes(lsrpia[i].TaskName);
2476 lsrepdb.OwnerName = Utils.StringToBytes(lsrpia[i].OwnerName);
2477 lsrepdba[i] = lsrepdb;
2478 }
2479 lsrp.ReportData = lsrepdba;
2480 OutPacket(lsrp, ThrottleOutPacketType.Task);
2481 }
2482
2483 public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
2484 {
2485 ScriptRunningReplyPacket scriptRunningReply = new ScriptRunningReplyPacket();
2486 scriptRunningReply.Script.ObjectID = objectID;
2487 scriptRunningReply.Script.ItemID = itemID;
2488 scriptRunningReply.Script.Running = running;
2489
2490 OutPacket(scriptRunningReply, ThrottleOutPacketType.Task);
2491 }
2492
2493 public void SendAsset(AssetRequestToClient req)
2494 {
2495 //m_log.Debug("sending asset " + req.RequestAssetID);
2496 TransferInfoPacket Transfer = new TransferInfoPacket();
2497 Transfer.TransferInfo.ChannelType = 2;
2498 Transfer.TransferInfo.Status = 0;
2499 Transfer.TransferInfo.TargetType = 0;
2500 if (req.AssetRequestSource == 2)
2501 {
2502 Transfer.TransferInfo.Params = new byte[20];
2503 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
2504 int assType = req.AssetInf.Type;
2505 Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
2506 }
2507 else if (req.AssetRequestSource == 3)
2508 {
2509 Transfer.TransferInfo.Params = req.Params;
2510 // Transfer.TransferInfo.Params = new byte[100];
2511 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
2512 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
2513 }
2514 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
2515 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2516 Transfer.Header.Zerocoded = true;
2517 OutPacket(Transfer, ThrottleOutPacketType.Asset);
2518
2519 if (req.NumPackets == 1)
2520 {
2521 TransferPacketPacket TransferPacket = new TransferPacketPacket();
2522 TransferPacket.TransferData.Packet = 0;
2523 TransferPacket.TransferData.ChannelType = 2;
2524 TransferPacket.TransferData.TransferID = req.TransferRequestID;
2525 TransferPacket.TransferData.Data = req.AssetInf.Data;
2526 TransferPacket.TransferData.Status = 1;
2527 TransferPacket.Header.Zerocoded = true;
2528 OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
2529 }
2530 else
2531 {
2532 int processedLength = 0;
2533 int maxChunkSize = Settings.MAX_PACKET_SIZE - 100;
2534 int packetNumber = 0;
2535
2536 while (processedLength < req.AssetInf.Data.Length)
2537 {
2538 TransferPacketPacket TransferPacket = new TransferPacketPacket();
2539 TransferPacket.TransferData.Packet = packetNumber;
2540 TransferPacket.TransferData.ChannelType = 2;
2541 TransferPacket.TransferData.TransferID = req.TransferRequestID;
2542
2543 int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize);
2544 byte[] chunk = new byte[chunkSize];
2545 Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length);
2546
2547 TransferPacket.TransferData.Data = chunk;
2548
2549 // 0 indicates more packets to come, 1 indicates last packet
2550 if (req.AssetInf.Data.Length - processedLength > maxChunkSize)
2551 {
2552 TransferPacket.TransferData.Status = 0;
2553 }
2554 else
2555 {
2556 TransferPacket.TransferData.Status = 1;
2557 }
2558 TransferPacket.Header.Zerocoded = true;
2559 OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
2560
2561 processedLength += chunkSize;
2562 packetNumber++;
2563 }
2564 }
2565 }
2566
2567 public void SendTexture(AssetBase TextureAsset)
2568 {
2569
2570 }
2571
2572 public void SendRegionHandle(UUID regionID, ulong handle)
2573 {
2574 RegionIDAndHandleReplyPacket reply = (RegionIDAndHandleReplyPacket)PacketPool.Instance.GetPacket(PacketType.RegionIDAndHandleReply);
2575 reply.ReplyBlock.RegionID = regionID;
2576 reply.ReplyBlock.RegionHandle = handle;
2577 OutPacket(reply, ThrottleOutPacketType.Land);
2578 }
2579
2580 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
2581 {
2582 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
2583 reply.AgentData.AgentID = m_agentId;
2584 reply.Data.ParcelID = parcelID;
2585 reply.Data.OwnerID = land.OwnerID;
2586 reply.Data.Name = Utils.StringToBytes(land.Name);
2587 reply.Data.Desc = Utils.StringToBytes(land.Description);
2588 reply.Data.ActualArea = land.Area;
2589 reply.Data.BillableArea = land.Area; // TODO: what is this?
2590
2591 // Bit 0: Mature, bit 7: on sale, other bits: no idea
2592 reply.Data.Flags = (byte)(
2593 ((land.Flags & (uint)ParcelFlags.MaturePublish) != 0 ? (1 << 0) : 0) +
2594 ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0));
2595
2596 Vector3 pos = land.UserLocation;
2597 if (pos.Equals(Vector3.Zero))
2598 {
2599 pos = (land.AABBMax + land.AABBMin) * 0.5f;
2600 }
2601 reply.Data.GlobalX = info.RegionLocX * Constants.RegionSize + x;
2602 reply.Data.GlobalY = info.RegionLocY * Constants.RegionSize + y;
2603 reply.Data.GlobalZ = pos.Z;
2604 reply.Data.SimName = Utils.StringToBytes(info.RegionName);
2605 reply.Data.SnapshotID = land.SnapshotID;
2606 reply.Data.Dwell = land.Dwell;
2607 reply.Data.SalePrice = land.SalePrice;
2608 reply.Data.AuctionID = (int)land.AuctionID;
2609
2610 OutPacket(reply, ThrottleOutPacketType.Land);
2611 }
2612
2613 public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
2614 {
2615 ScriptTeleportRequestPacket packet = (ScriptTeleportRequestPacket)PacketPool.Instance.GetPacket(PacketType.ScriptTeleportRequest);
2616
2617 packet.Data.ObjectName = Utils.StringToBytes(objName);
2618 packet.Data.SimName = Utils.StringToBytes(simName);
2619 packet.Data.SimPosition = pos;
2620 packet.Data.LookAt = lookAt;
2621
2622 OutPacket(packet, ThrottleOutPacketType.Task);
2623 }
2624
2625 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
2626 {
2627 DirPlacesReplyPacket packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply);
2628
2629 packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock();
2630
2631 packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
2632 packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
2633
2634 packet.QueryReplies =
2635 new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
2636
2637 packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[
2638 data.Length];
2639
2640 packet.AgentData.AgentID = AgentId;
2641
2642 packet.QueryData[0].QueryID = queryID;
2643
2644 int i = 0;
2645 foreach (DirPlacesReplyData d in data)
2646 {
2647 packet.QueryReplies[i] =
2648 new DirPlacesReplyPacket.QueryRepliesBlock();
2649 packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock();
2650 packet.QueryReplies[i].ParcelID = d.parcelID;
2651 packet.QueryReplies[i].Name = Utils.StringToBytes(d.name);
2652 packet.QueryReplies[i].ForSale = d.forSale;
2653 packet.QueryReplies[i].Auction = d.auction;
2654 packet.QueryReplies[i].Dwell = d.dwell;
2655 packet.StatusData[i].Status = d.Status;
2656 i++;
2657 }
2658
2659 OutPacket(packet, ThrottleOutPacketType.Task);
2660 }
2661
2662 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
2663 {
2664 DirPeopleReplyPacket packet = (DirPeopleReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPeopleReply);
2665
2666 packet.AgentData = new DirPeopleReplyPacket.AgentDataBlock();
2667 packet.AgentData.AgentID = AgentId;
2668
2669 packet.QueryData = new DirPeopleReplyPacket.QueryDataBlock();
2670 packet.QueryData.QueryID = queryID;
2671
2672 packet.QueryReplies = new DirPeopleReplyPacket.QueryRepliesBlock[
2673 data.Length];
2674
2675 int i = 0;
2676 foreach (DirPeopleReplyData d in data)
2677 {
2678 packet.QueryReplies[i] = new DirPeopleReplyPacket.QueryRepliesBlock();
2679 packet.QueryReplies[i].AgentID = d.agentID;
2680 packet.QueryReplies[i].FirstName =
2681 Utils.StringToBytes(d.firstName);
2682 packet.QueryReplies[i].LastName =
2683 Utils.StringToBytes(d.lastName);
2684 packet.QueryReplies[i].Group =
2685 Utils.StringToBytes(d.group);
2686 packet.QueryReplies[i].Online = d.online;
2687 packet.QueryReplies[i].Reputation = d.reputation;
2688 i++;
2689 }
2690
2691 OutPacket(packet, ThrottleOutPacketType.Task);
2692 }
2693
2694 public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
2695 {
2696 DirEventsReplyPacket packet = (DirEventsReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirEventsReply);
2697
2698 packet.AgentData = new DirEventsReplyPacket.AgentDataBlock();
2699 packet.AgentData.AgentID = AgentId;
2700
2701 packet.QueryData = new DirEventsReplyPacket.QueryDataBlock();
2702 packet.QueryData.QueryID = queryID;
2703
2704 packet.QueryReplies = new DirEventsReplyPacket.QueryRepliesBlock[
2705 data.Length];
2706
2707 packet.StatusData = new DirEventsReplyPacket.StatusDataBlock[
2708 data.Length];
2709
2710 int i = 0;
2711 foreach (DirEventsReplyData d in data)
2712 {
2713 packet.QueryReplies[i] = new DirEventsReplyPacket.QueryRepliesBlock();
2714 packet.StatusData[i] = new DirEventsReplyPacket.StatusDataBlock();
2715 packet.QueryReplies[i].OwnerID = d.ownerID;
2716 packet.QueryReplies[i].Name =
2717 Utils.StringToBytes(d.name);
2718 packet.QueryReplies[i].EventID = d.eventID;
2719 packet.QueryReplies[i].Date =
2720 Utils.StringToBytes(d.date);
2721 packet.QueryReplies[i].UnixTime = d.unixTime;
2722 packet.QueryReplies[i].EventFlags = d.eventFlags;
2723 packet.StatusData[i].Status = d.Status;
2724 i++;
2725 }
2726
2727 OutPacket(packet, ThrottleOutPacketType.Task);
2728 }
2729
2730 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
2731 {
2732 DirGroupsReplyPacket packet = (DirGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirGroupsReply);
2733
2734 packet.AgentData = new DirGroupsReplyPacket.AgentDataBlock();
2735 packet.AgentData.AgentID = AgentId;
2736
2737 packet.QueryData = new DirGroupsReplyPacket.QueryDataBlock();
2738 packet.QueryData.QueryID = queryID;
2739
2740 packet.QueryReplies = new DirGroupsReplyPacket.QueryRepliesBlock[
2741 data.Length];
2742
2743 int i = 0;
2744 foreach (DirGroupsReplyData d in data)
2745 {
2746 packet.QueryReplies[i] = new DirGroupsReplyPacket.QueryRepliesBlock();
2747 packet.QueryReplies[i].GroupID = d.groupID;
2748 packet.QueryReplies[i].GroupName =
2749 Utils.StringToBytes(d.groupName);
2750 packet.QueryReplies[i].Members = d.members;
2751 packet.QueryReplies[i].SearchOrder = d.searchOrder;
2752 i++;
2753 }
2754
2755 OutPacket(packet, ThrottleOutPacketType.Task);
2756 }
2757
2758 public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
2759 {
2760 DirClassifiedReplyPacket packet = (DirClassifiedReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirClassifiedReply);
2761
2762 packet.AgentData = new DirClassifiedReplyPacket.AgentDataBlock();
2763 packet.AgentData.AgentID = AgentId;
2764
2765 packet.QueryData = new DirClassifiedReplyPacket.QueryDataBlock();
2766 packet.QueryData.QueryID = queryID;
2767
2768 packet.QueryReplies = new DirClassifiedReplyPacket.QueryRepliesBlock[
2769 data.Length];
2770 packet.StatusData = new DirClassifiedReplyPacket.StatusDataBlock[
2771 data.Length];
2772
2773 int i = 0;
2774 foreach (DirClassifiedReplyData d in data)
2775 {
2776 packet.QueryReplies[i] = new DirClassifiedReplyPacket.QueryRepliesBlock();
2777 packet.StatusData[i] = new DirClassifiedReplyPacket.StatusDataBlock();
2778 packet.QueryReplies[i].ClassifiedID = d.classifiedID;
2779 packet.QueryReplies[i].Name =
2780 Utils.StringToBytes(d.name);
2781 packet.QueryReplies[i].ClassifiedFlags = d.classifiedFlags;
2782 packet.QueryReplies[i].CreationDate = d.creationDate;
2783 packet.QueryReplies[i].ExpirationDate = d.expirationDate;
2784 packet.QueryReplies[i].PriceForListing = d.price;
2785 packet.StatusData[i].Status = d.Status;
2786 i++;
2787 }
2788
2789 OutPacket(packet, ThrottleOutPacketType.Task);
2790 }
2791
2792 public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
2793 {
2794 DirLandReplyPacket packet = (DirLandReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirLandReply);
2795
2796 packet.AgentData = new DirLandReplyPacket.AgentDataBlock();
2797 packet.AgentData.AgentID = AgentId;
2798
2799 packet.QueryData = new DirLandReplyPacket.QueryDataBlock();
2800 packet.QueryData.QueryID = queryID;
2801
2802 packet.QueryReplies = new DirLandReplyPacket.QueryRepliesBlock[
2803 data.Length];
2804
2805 int i = 0;
2806 foreach (DirLandReplyData d in data)
2807 {
2808 packet.QueryReplies[i] = new DirLandReplyPacket.QueryRepliesBlock();
2809 packet.QueryReplies[i].ParcelID = d.parcelID;
2810 packet.QueryReplies[i].Name =
2811 Utils.StringToBytes(d.name);
2812 packet.QueryReplies[i].Auction = d.auction;
2813 packet.QueryReplies[i].ForSale = d.forSale;
2814 packet.QueryReplies[i].SalePrice = d.salePrice;
2815 packet.QueryReplies[i].ActualArea = d.actualArea;
2816 i++;
2817 }
2818
2819 OutPacket(packet, ThrottleOutPacketType.Task);
2820 }
2821
2822 public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
2823 {
2824 DirPopularReplyPacket packet = (DirPopularReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPopularReply);
2825
2826 packet.AgentData = new DirPopularReplyPacket.AgentDataBlock();
2827 packet.AgentData.AgentID = AgentId;
2828
2829 packet.QueryData = new DirPopularReplyPacket.QueryDataBlock();
2830 packet.QueryData.QueryID = queryID;
2831
2832 packet.QueryReplies = new DirPopularReplyPacket.QueryRepliesBlock[
2833 data.Length];
2834
2835 int i = 0;
2836 foreach (DirPopularReplyData d in data)
2837 {
2838 packet.QueryReplies[i] = new DirPopularReplyPacket.QueryRepliesBlock();
2839 packet.QueryReplies[i].ParcelID = d.parcelID;
2840 packet.QueryReplies[i].Name =
2841 Utils.StringToBytes(d.name);
2842 packet.QueryReplies[i].Dwell = d.dwell;
2843 i++;
2844 }
2845
2846 OutPacket(packet, ThrottleOutPacketType.Task);
2847 }
2848
2849 public void SendEventInfoReply(EventData data)
2850 {
2851 EventInfoReplyPacket packet = (EventInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.EventInfoReply);
2852
2853 packet.AgentData = new EventInfoReplyPacket.AgentDataBlock();
2854 packet.AgentData.AgentID = AgentId;
2855
2856 packet.EventData = new EventInfoReplyPacket.EventDataBlock();
2857 packet.EventData.EventID = data.eventID;
2858 packet.EventData.Creator = Utils.StringToBytes(data.creator);
2859 packet.EventData.Name = Utils.StringToBytes(data.name);
2860 packet.EventData.Category = Utils.StringToBytes(data.category);
2861 packet.EventData.Desc = Utils.StringToBytes(data.description);
2862 packet.EventData.Date = Utils.StringToBytes(data.date);
2863 packet.EventData.DateUTC = data.dateUTC;
2864 packet.EventData.Duration = data.duration;
2865 packet.EventData.Cover = data.cover;
2866 packet.EventData.Amount = data.amount;
2867 packet.EventData.SimName = Utils.StringToBytes(data.simName);
2868 packet.EventData.GlobalPos = new Vector3d(data.globalPos);
2869 packet.EventData.EventFlags = data.eventFlags;
2870
2871 OutPacket(packet, ThrottleOutPacketType.Task);
2872 }
2873
2874 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
2875 {
2876 MapItemReplyPacket mirplk = new MapItemReplyPacket();
2877 mirplk.AgentData.AgentID = AgentId;
2878 mirplk.RequestData.ItemType = mapitemtype;
2879 mirplk.Data = new MapItemReplyPacket.DataBlock[replies.Length];
2880 for (int i = 0; i < replies.Length; i++)
2881 {
2882 MapItemReplyPacket.DataBlock mrdata = new MapItemReplyPacket.DataBlock();
2883 mrdata.X = replies[i].x;
2884 mrdata.Y = replies[i].y;
2885 mrdata.ID = replies[i].id;
2886 mrdata.Extra = replies[i].Extra;
2887 mrdata.Extra2 = replies[i].Extra2;
2888 mrdata.Name = Utils.StringToBytes(replies[i].name);
2889 mirplk.Data[i] = mrdata;
2890 }
2891 //m_log.Debug(mirplk.ToString());
2892 OutPacket(mirplk, ThrottleOutPacketType.Task);
2893
2894 }
2895
2896 public void SendOfferCallingCard(UUID srcID, UUID transactionID)
2897 {
2898 // a bit special, as this uses AgentID to store the source instead
2899 // of the destination. The destination (the receiver) goes into destID
2900 OfferCallingCardPacket p = (OfferCallingCardPacket)PacketPool.Instance.GetPacket(PacketType.OfferCallingCard);
2901 p.AgentData.AgentID = srcID;
2902 p.AgentData.SessionID = UUID.Zero;
2903 p.AgentBlock.DestID = AgentId;
2904 p.AgentBlock.TransactionID = transactionID;
2905 OutPacket(p, ThrottleOutPacketType.Task);
2906 }
2907
2908 public void SendAcceptCallingCard(UUID transactionID)
2909 {
2910 AcceptCallingCardPacket p = (AcceptCallingCardPacket)PacketPool.Instance.GetPacket(PacketType.AcceptCallingCard);
2911 p.AgentData.AgentID = AgentId;
2912 p.AgentData.SessionID = UUID.Zero;
2913 p.FolderData = new AcceptCallingCardPacket.FolderDataBlock[1];
2914 p.FolderData[0] = new AcceptCallingCardPacket.FolderDataBlock();
2915 p.FolderData[0].FolderID = UUID.Zero;
2916 OutPacket(p, ThrottleOutPacketType.Task);
2917 }
2918
2919 public void SendDeclineCallingCard(UUID transactionID)
2920 {
2921 DeclineCallingCardPacket p = (DeclineCallingCardPacket)PacketPool.Instance.GetPacket(PacketType.DeclineCallingCard);
2922 p.AgentData.AgentID = AgentId;
2923 p.AgentData.SessionID = UUID.Zero;
2924 p.TransactionBlock.TransactionID = transactionID;
2925 OutPacket(p, ThrottleOutPacketType.Task);
2926 }
2927
2928 public void SendTerminateFriend(UUID exFriendID)
2929 {
2930 TerminateFriendshipPacket p = (TerminateFriendshipPacket)PacketPool.Instance.GetPacket(PacketType.TerminateFriendship);
2931 p.AgentData.AgentID = AgentId;
2932 p.AgentData.SessionID = SessionId;
2933 p.ExBlock.OtherID = exFriendID;
2934 OutPacket(p, ThrottleOutPacketType.Task);
2935 }
2936
2937 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
2938 {
2939 AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply);
2940
2941 p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock();
2942 p.AgentData.AgentID = AgentId;
2943 p.AgentData.AvatarID = avatarID;
2944
2945 p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length];
2946 int i = 0;
2947 foreach (GroupMembershipData m in data)
2948 {
2949 p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock();
2950 p.GroupData[i].GroupPowers = m.GroupPowers;
2951 p.GroupData[i].AcceptNotices = m.AcceptNotices;
2952 p.GroupData[i].GroupTitle = Utils.StringToBytes(m.GroupTitle);
2953 p.GroupData[i].GroupID = m.GroupID;
2954 p.GroupData[i].GroupName = Utils.StringToBytes(m.GroupName);
2955 p.GroupData[i].GroupInsigniaID = m.GroupPicture;
2956 i++;
2957 }
2958
2959 p.NewGroupData = new AvatarGroupsReplyPacket.NewGroupDataBlock();
2960 p.NewGroupData.ListInProfile = true;
2961
2962 OutPacket(p, ThrottleOutPacketType.Task);
2963 }
2964
2965 public void SendJoinGroupReply(UUID groupID, bool success)
2966 {
2967 JoinGroupReplyPacket p = (JoinGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.JoinGroupReply);
2968
2969 p.AgentData = new JoinGroupReplyPacket.AgentDataBlock();
2970 p.AgentData.AgentID = AgentId;
2971
2972 p.GroupData = new JoinGroupReplyPacket.GroupDataBlock();
2973 p.GroupData.GroupID = groupID;
2974 p.GroupData.Success = success;
2975
2976 OutPacket(p, ThrottleOutPacketType.Task);
2977 }
2978
2979 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
2980 {
2981 EjectGroupMemberReplyPacket p = (EjectGroupMemberReplyPacket)PacketPool.Instance.GetPacket(PacketType.EjectGroupMemberReply);
2982
2983 p.AgentData = new EjectGroupMemberReplyPacket.AgentDataBlock();
2984 p.AgentData.AgentID = agentID;
2985
2986 p.GroupData = new EjectGroupMemberReplyPacket.GroupDataBlock();
2987 p.GroupData.GroupID = groupID;
2988
2989 p.EjectData = new EjectGroupMemberReplyPacket.EjectDataBlock();
2990 p.EjectData.Success = success;
2991
2992 OutPacket(p, ThrottleOutPacketType.Task);
2993 }
2994
2995 public void SendLeaveGroupReply(UUID groupID, bool success)
2996 {
2997 LeaveGroupReplyPacket p = (LeaveGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.LeaveGroupReply);
2998
2999 p.AgentData = new LeaveGroupReplyPacket.AgentDataBlock();
3000 p.AgentData.AgentID = AgentId;
3001
3002 p.GroupData = new LeaveGroupReplyPacket.GroupDataBlock();
3003 p.GroupData.GroupID = groupID;
3004 p.GroupData.Success = success;
3005
3006 OutPacket(p, ThrottleOutPacketType.Task);
3007 }
3008
3009 public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
3010 {
3011 if (classifiedID.Length != name.Length)
3012 return;
3013
3014 AvatarClassifiedReplyPacket ac =
3015 (AvatarClassifiedReplyPacket)PacketPool.Instance.GetPacket(
3016 PacketType.AvatarClassifiedReply);
3017
3018 ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock();
3019 ac.AgentData.AgentID = AgentId;
3020 ac.AgentData.TargetID = targetID;
3021
3022 ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifiedID.Length];
3023 int i;
3024 for (i = 0; i < classifiedID.Length; i++)
3025 {
3026 ac.Data[i].ClassifiedID = classifiedID[i];
3027 ac.Data[i].Name = Utils.StringToBytes(name[i]);
3028 }
3029
3030 OutPacket(ac, ThrottleOutPacketType.Task);
3031 }
3032
3033 public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
3034 {
3035 ClassifiedInfoReplyPacket cr =
3036 (ClassifiedInfoReplyPacket)PacketPool.Instance.GetPacket(
3037 PacketType.ClassifiedInfoReply);
3038
3039 cr.AgentData = new ClassifiedInfoReplyPacket.AgentDataBlock();
3040 cr.AgentData.AgentID = AgentId;
3041
3042 cr.Data = new ClassifiedInfoReplyPacket.DataBlock();
3043 cr.Data.ClassifiedID = classifiedID;
3044 cr.Data.CreatorID = creatorID;
3045 cr.Data.CreationDate = creationDate;
3046 cr.Data.ExpirationDate = expirationDate;
3047 cr.Data.Category = category;
3048 cr.Data.Name = Utils.StringToBytes(name);
3049 cr.Data.Desc = Utils.StringToBytes(description);
3050 cr.Data.ParcelID = parcelID;
3051 cr.Data.ParentEstate = parentEstate;
3052 cr.Data.SnapshotID = snapshotID;
3053 cr.Data.SimName = Utils.StringToBytes(simName);
3054 cr.Data.PosGlobal = new Vector3d(globalPos);
3055 cr.Data.ParcelName = Utils.StringToBytes(parcelName);
3056 cr.Data.ClassifiedFlags = classifiedFlags;
3057 cr.Data.PriceForListing = price;
3058
3059 OutPacket(cr, ThrottleOutPacketType.Task);
3060 }
3061
3062 public void SendAgentDropGroup(UUID groupID)
3063 {
3064 AgentDropGroupPacket dg =
3065 (AgentDropGroupPacket)PacketPool.Instance.GetPacket(
3066 PacketType.AgentDropGroup);
3067
3068 dg.AgentData = new AgentDropGroupPacket.AgentDataBlock();
3069 dg.AgentData.AgentID = AgentId;
3070 dg.AgentData.GroupID = groupID;
3071
3072 OutPacket(dg, ThrottleOutPacketType.Task);
3073 }
3074
3075 public void SendAvatarNotesReply(UUID targetID, string text)
3076 {
3077 AvatarNotesReplyPacket an =
3078 (AvatarNotesReplyPacket)PacketPool.Instance.GetPacket(
3079 PacketType.AvatarNotesReply);
3080
3081 an.AgentData = new AvatarNotesReplyPacket.AgentDataBlock();
3082 an.AgentData.AgentID = AgentId;
3083
3084 an.Data = new AvatarNotesReplyPacket.DataBlock();
3085 an.Data.TargetID = targetID;
3086 an.Data.Notes = Utils.StringToBytes(text);
3087
3088 OutPacket(an, ThrottleOutPacketType.Task);
3089 }
3090
3091 public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
3092 {
3093 AvatarPicksReplyPacket ap =
3094 (AvatarPicksReplyPacket)PacketPool.Instance.GetPacket(
3095 PacketType.AvatarPicksReply);
3096
3097 ap.AgentData = new AvatarPicksReplyPacket.AgentDataBlock();
3098 ap.AgentData.AgentID = AgentId;
3099 ap.AgentData.TargetID = targetID;
3100
3101 ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
3102
3103 int i = 0;
3104 foreach (KeyValuePair<UUID, string> pick in picks)
3105 {
3106 ap.Data[i] = new AvatarPicksReplyPacket.DataBlock();
3107 ap.Data[i].PickID = pick.Key;
3108 ap.Data[i].PickName = Utils.StringToBytes(pick.Value);
3109 i++;
3110 }
3111
3112 OutPacket(ap, ThrottleOutPacketType.Task);
3113 }
3114
3115 public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
3116 {
3117 AvatarClassifiedReplyPacket ac =
3118 (AvatarClassifiedReplyPacket)PacketPool.Instance.GetPacket(
3119 PacketType.AvatarClassifiedReply);
3120
3121 ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock();
3122 ac.AgentData.AgentID = AgentId;
3123 ac.AgentData.TargetID = targetID;
3124
3125 ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
3126
3127 int i = 0;
3128 foreach (KeyValuePair<UUID, string> classified in classifieds)
3129 {
3130 ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock();
3131 ac.Data[i].ClassifiedID = classified.Key;
3132 ac.Data[i].Name = Utils.StringToBytes(classified.Value);
3133 i++;
3134 }
3135
3136 OutPacket(ac, ThrottleOutPacketType.Task);
3137 }
3138
3139 public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
3140 {
3141 ParcelDwellReplyPacket pd =
3142 (ParcelDwellReplyPacket)PacketPool.Instance.GetPacket(
3143 PacketType.ParcelDwellReply);
3144
3145 pd.AgentData = new ParcelDwellReplyPacket.AgentDataBlock();
3146 pd.AgentData.AgentID = AgentId;
3147
3148 pd.Data = new ParcelDwellReplyPacket.DataBlock();
3149 pd.Data.LocalID = localID;
3150 pd.Data.ParcelID = parcelID;
3151 pd.Data.Dwell = dwell;
3152
3153 OutPacket(pd, ThrottleOutPacketType.Land);
3154 }
3155
3156 public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
3157 {
3158 UserInfoReplyPacket ur =
3159 (UserInfoReplyPacket)PacketPool.Instance.GetPacket(
3160 PacketType.UserInfoReply);
3161
3162 string Visible = "hidden";
3163 if (visible)
3164 Visible = "default";
3165
3166 ur.AgentData = new UserInfoReplyPacket.AgentDataBlock();
3167 ur.AgentData.AgentID = AgentId;
3168
3169 ur.UserData = new UserInfoReplyPacket.UserDataBlock();
3170 ur.UserData.IMViaEMail = imViaEmail;
3171 ur.UserData.DirectoryVisibility = Utils.StringToBytes(Visible);
3172 ur.UserData.EMail = Utils.StringToBytes(email);
3173
3174 OutPacket(ur, ThrottleOutPacketType.Task);
3175 }
3176
3177 public void SendCreateGroupReply(UUID groupID, bool success, string message)
3178 {
3179 CreateGroupReplyPacket createGroupReply = (CreateGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.CreateGroupReply);
3180
3181 createGroupReply.AgentData =
3182 new CreateGroupReplyPacket.AgentDataBlock();
3183 createGroupReply.ReplyData =
3184 new CreateGroupReplyPacket.ReplyDataBlock();
3185
3186 createGroupReply.AgentData.AgentID = AgentId;
3187 createGroupReply.ReplyData.GroupID = groupID;
3188
3189 createGroupReply.ReplyData.Success = success;
3190 createGroupReply.ReplyData.Message = Utils.StringToBytes(message);
3191 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
3192 }
3193
3194 public void SendUseCachedMuteList()
3195 {
3196 UseCachedMuteListPacket useCachedMuteList = (UseCachedMuteListPacket)PacketPool.Instance.GetPacket(PacketType.UseCachedMuteList);
3197
3198 useCachedMuteList.AgentData = new UseCachedMuteListPacket.AgentDataBlock();
3199 useCachedMuteList.AgentData.AgentID = AgentId;
3200
3201 OutPacket(useCachedMuteList, ThrottleOutPacketType.Task);
3202 }
3203
3204 public void SendMuteListUpdate(string filename)
3205 {
3206 MuteListUpdatePacket muteListUpdate = (MuteListUpdatePacket)PacketPool.Instance.GetPacket(PacketType.MuteListUpdate);
3207
3208 muteListUpdate.MuteData = new MuteListUpdatePacket.MuteDataBlock();
3209 muteListUpdate.MuteData.AgentID = AgentId;
3210 muteListUpdate.MuteData.Filename = Utils.StringToBytes(filename);
3211
3212 OutPacket(muteListUpdate, ThrottleOutPacketType.Task);
3213 }
3214
3215 public void SendPickInfoReply(UUID pickID, UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled)
3216 {
3217 PickInfoReplyPacket pickInfoReply = (PickInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.PickInfoReply);
3218
3219 pickInfoReply.AgentData = new PickInfoReplyPacket.AgentDataBlock();
3220 pickInfoReply.AgentData.AgentID = AgentId;
3221
3222 pickInfoReply.Data = new PickInfoReplyPacket.DataBlock();
3223 pickInfoReply.Data.PickID = pickID;
3224 pickInfoReply.Data.CreatorID = creatorID;
3225 pickInfoReply.Data.TopPick = topPick;
3226 pickInfoReply.Data.ParcelID = parcelID;
3227 pickInfoReply.Data.Name = Utils.StringToBytes(name);
3228 pickInfoReply.Data.Desc = Utils.StringToBytes(desc);
3229 pickInfoReply.Data.SnapshotID = snapshotID;
3230 pickInfoReply.Data.User = Utils.StringToBytes(user);
3231 pickInfoReply.Data.OriginalName = Utils.StringToBytes(originalName);
3232 pickInfoReply.Data.SimName = Utils.StringToBytes(simName);
3233 pickInfoReply.Data.PosGlobal = new Vector3d(posGlobal);
3234 pickInfoReply.Data.SortOrder = sortOrder;
3235 pickInfoReply.Data.Enabled = enabled;
3236
3237 OutPacket(pickInfoReply, ThrottleOutPacketType.Task);
3238 }
3239
3240 #endregion Scene/Avatar to Client
2772 3241
2773 // Gesture 3242 // Gesture
2774 3243
@@ -3201,7 +3670,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3201 } 3670 }
3202 3671
3203 outPacket.Header.Zerocoded = true; 3672 outPacket.Header.Zerocoded = true;
3204 OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); 3673 OutPacket(outPacket, ThrottleOutPacketType.Task);
3205 3674
3206 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3675 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3207 lock (m_primFullUpdateTimer) 3676 lock (m_primFullUpdateTimer)
@@ -3291,7 +3760,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3291 3760
3292 outPacket.Header.Reliable = false; 3761 outPacket.Header.Reliable = false;
3293 outPacket.Header.Zerocoded = true; 3762 outPacket.Header.Zerocoded = true;
3294 OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); 3763 OutPacket(outPacket, ThrottleOutPacketType.Task);
3295 3764
3296 if (m_primTerseUpdates.Count == 0) 3765 if (m_primTerseUpdates.Count == 0)
3297 lock (m_primTerseUpdateTimer) 3766 lock (m_primTerseUpdateTimer)
@@ -4242,6 +4711,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4242 OutPacket(packet, ThrottleOutPacketType.Task); 4711 OutPacket(packet, ThrottleOutPacketType.Task);
4243 } 4712 }
4244 4713
4714 public ulong GetGroupPowers(UUID groupID)
4715 {
4716 if (groupID == m_activeGroupID)
4717 return m_activeGroupPowers;
4718
4719 if (m_groupPowers.ContainsKey(groupID))
4720 return m_groupPowers[groupID];
4721
4722 return 0;
4723 }
4724
4725 /// <summary>
4726 /// This is a utility method used by single states to not duplicate kicks and blue card of death messages.
4727 /// </summary>
4728 public bool ChildAgentStatus()
4729 {
4730 return m_scene.PresenceChildStatus(AgentId);
4731 }
4732
4245 #endregion 4733 #endregion
4246 4734
4247 /// <summary> 4735 /// <summary>
@@ -4260,6 +4748,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4260 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); 4748 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage);
4261 } 4749 }
4262 4750
4751 #region Packet Handlers
4752
4263 private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) 4753 private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
4264 { 4754 {
4265 MoneyTransferRequestPacket money = (MoneyTransferRequestPacket) Pack; 4755 MoneyTransferRequestPacket money = (MoneyTransferRequestPacket) Pack;
@@ -4267,7 +4757,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4267 if (money.MoneyData.SourceID == sender.AgentId && money.AgentData.AgentID == sender.AgentId && 4757 if (money.MoneyData.SourceID == sender.AgentId && money.AgentData.AgentID == sender.AgentId &&
4268 money.AgentData.SessionID == sender.SessionId) 4758 money.AgentData.SessionID == sender.SessionId)
4269 { 4759 {
4270 handlerMoneyTransferRequest = OnMoneyTransferRequest; 4760 MoneyTransferRequest handlerMoneyTransferRequest = OnMoneyTransferRequest;
4271 if (handlerMoneyTransferRequest != null) 4761 if (handlerMoneyTransferRequest != null)
4272 { 4762 {
4273 handlerMoneyTransferRequest(money.MoneyData.SourceID, money.MoneyData.DestID, 4763 handlerMoneyTransferRequest(money.MoneyData.SourceID, money.MoneyData.DestID,
@@ -4286,7 +4776,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4286 ParcelBuyPacket parcel = (ParcelBuyPacket) Pack; 4776 ParcelBuyPacket parcel = (ParcelBuyPacket) Pack;
4287 if (parcel.AgentData.AgentID == AgentId && parcel.AgentData.SessionID == SessionId) 4777 if (parcel.AgentData.AgentID == AgentId && parcel.AgentData.SessionID == SessionId)
4288 { 4778 {
4289 handlerParcelBuy = OnParcelBuy; 4779 ParcelBuy handlerParcelBuy = OnParcelBuy;
4290 if (handlerParcelBuy != null) 4780 if (handlerParcelBuy != null)
4291 { 4781 {
4292 handlerParcelBuy(parcel.AgentData.AgentID, parcel.Data.GroupID, parcel.Data.Final, 4782 handlerParcelBuy(parcel.AgentData.AgentID, parcel.Data.GroupID, parcel.Data.Final,
@@ -4307,7 +4797,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4307 4797
4308 for (int i = 0; i < upack.UUIDNameBlock.Length; i++) 4798 for (int i = 0; i < upack.UUIDNameBlock.Length; i++)
4309 { 4799 {
4310 handlerUUIDGroupNameRequest = OnUUIDGroupNameRequest; 4800 UUIDNameRequest handlerUUIDGroupNameRequest = OnUUIDGroupNameRequest;
4311 if (handlerUUIDGroupNameRequest != null) 4801 if (handlerUUIDGroupNameRequest != null)
4312 { 4802 {
4313 handlerUUIDGroupNameRequest(upack.UUIDNameBlock[i].ID, this); 4803 handlerUUIDGroupNameRequest(upack.UUIDNameBlock[i].ID, this);
@@ -4323,7 +4813,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4323 if (m_genericPacketHandlers.Count == 0) return false; 4813 if (m_genericPacketHandlers.Count == 0) return false;
4324 if (gmpack.AgentData.SessionID != SessionId) return false; 4814 if (gmpack.AgentData.SessionID != SessionId) return false;
4325 4815
4326 handlerGenericMessage = null; 4816 GenericMessage handlerGenericMessage = null;
4327 4817
4328 string method = Util.FieldToString(gmpack.MethodData.Method).ToLower().Trim(); 4818 string method = Util.FieldToString(gmpack.MethodData.Method).ToLower().Trim();
4329 4819
@@ -4364,7 +4854,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4364 ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack; 4854 ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack;
4365 if (ogpack.AgentData.SessionID != SessionId) return false; 4855 if (ogpack.AgentData.SessionID != SessionId) return false;
4366 4856
4367 handlerObjectGroupRequest = OnObjectGroupRequest; 4857 RequestObjectPropertiesFamily handlerObjectGroupRequest = OnObjectGroupRequest;
4368 if (handlerObjectGroupRequest != null) 4858 if (handlerObjectGroupRequest != null)
4369 { 4859 {
4370 for (int i = 0; i < ogpack.ObjectData.Length; i++) 4860 for (int i = 0; i < ogpack.ObjectData.Length; i++)
@@ -4379,7 +4869,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4379 { 4869 {
4380 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; 4870 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
4381 if (viewer.AgentData.SessionID != SessionId) return false; 4871 if (viewer.AgentData.SessionID != SessionId) return false;
4382 handlerViewerEffect = OnViewerEffect; 4872 ViewerEffectEventHandler handlerViewerEffect = OnViewerEffect;
4383 if (handlerViewerEffect != null) 4873 if (handlerViewerEffect != null)
4384 { 4874 {
4385 int length = viewer.Effect.Length; 4875 int length = viewer.Effect.Length;
@@ -4403,6 +4893,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4403 return true; 4893 return true;
4404 } 4894 }
4405 4895
4896 #endregion Packet Handlers
4897
4406 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question) 4898 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
4407 { 4899 {
4408 ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion); 4900 ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion);
@@ -4468,7 +4960,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4468 { 4960 {
4469 m_log.InfoFormat("[CLIENT]: Got a logout request for {0} in {1}", Name, Scene.RegionInfo.RegionName); 4961 m_log.InfoFormat("[CLIENT]: Got a logout request for {0} in {1}", Name, Scene.RegionInfo.RegionName);
4470 4962
4471 handlerLogout = OnLogout; 4963 Action<IClientAPI> handlerLogout = OnLogout;
4472 4964
4473 if (handlerLogout != null) 4965 if (handlerLogout != null)
4474 { 4966 {
@@ -4550,7 +5042,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4550 case 1: 5042 case 1:
4551 Vector3 pos1 = new Vector3(block.Data, 0); 5043 Vector3 pos1 = new Vector3(block.Data, 0);
4552 5044
4553 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 5045 UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
4554 if (handlerUpdatePrimSinglePosition != null) 5046 if (handlerUpdatePrimSinglePosition != null)
4555 { 5047 {
4556 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 5048 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
@@ -4560,7 +5052,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4560 case 2: 5052 case 2:
4561 Quaternion rot1 = new Quaternion(block.Data, 0, true); 5053 Quaternion rot1 = new Quaternion(block.Data, 0, true);
4562 5054
4563 handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 5055 UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation;
4564 if (handlerUpdatePrimSingleRotation != null) 5056 if (handlerUpdatePrimSingleRotation != null)
4565 { 5057 {
4566 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); 5058 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
@@ -4571,7 +5063,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4571 Vector3 rotPos = new Vector3(block.Data, 0); 5063 Vector3 rotPos = new Vector3(block.Data, 0);
4572 Quaternion rot2 = new Quaternion(block.Data, 12, true); 5064 Quaternion rot2 = new Quaternion(block.Data, 12, true);
4573 5065
4574 handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; 5066 UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition;
4575 if (handlerUpdatePrimSingleRotationPosition != null) 5067 if (handlerUpdatePrimSingleRotationPosition != null)
4576 { 5068 {
4577 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); 5069 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
@@ -4583,7 +5075,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4583 case 20: 5075 case 20:
4584 Vector3 scale4 = new Vector3(block.Data, 0); 5076 Vector3 scale4 = new Vector3(block.Data, 0);
4585 5077
4586 handlerUpdatePrimScale = OnUpdatePrimScale; 5078 UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale;
4587 if (handlerUpdatePrimScale != null) 5079 if (handlerUpdatePrimScale != null)
4588 { 5080 {
4589// m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); 5081// m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z);
@@ -4611,7 +5103,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4611 case 9: 5103 case 9:
4612 Vector3 pos2 = new Vector3(block.Data, 0); 5104 Vector3 pos2 = new Vector3(block.Data, 0);
4613 5105
4614 handlerUpdateVector = OnUpdatePrimGroupPosition; 5106 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition;
4615 5107
4616 if (handlerUpdateVector != null) 5108 if (handlerUpdateVector != null)
4617 { 5109 {
@@ -4622,7 +5114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4622 case 10: 5114 case 10:
4623 Quaternion rot3 = new Quaternion(block.Data, 0, true); 5115 Quaternion rot3 = new Quaternion(block.Data, 0, true);
4624 5116
4625 handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 5117 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
4626 if (handlerUpdatePrimRotation != null) 5118 if (handlerUpdatePrimRotation != null)
4627 { 5119 {
4628 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); 5120 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
@@ -4645,7 +5137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4645 case 28: 5137 case 28:
4646 Vector3 scale7 = new Vector3(block.Data, 0); 5138 Vector3 scale7 = new Vector3(block.Data, 0);
4647 5139
4648 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 5140 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
4649 if (handlerUpdatePrimGroupScale != null) 5141 if (handlerUpdatePrimGroupScale != null)
4650 { 5142 {
4651// m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); 5143// m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
@@ -4765,45 +5257,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4765 } 5257 }
4766 5258
4767 /// <summary> 5259 /// <summary>
4768 /// returns a byte array of the client set throttles Gets multiplied by the multiplier 5260 /// Sets the throttles from values supplied by the client
4769 ///
4770 /// </summary> 5261 /// </summary>
4771 /// <param name="multiplier">non 1 multiplier for subdividing the throttles between individual regions</param> 5262 /// <param name="throttles"></param>
4772 /// <returns></returns> 5263 public void SetChildAgentThrottle(byte[] throttles)
5264 {
5265 m_udpClient.SetThrottles(throttles);
5266 }
5267
4773 public byte[] GetThrottlesPacked(float multiplier) 5268 public byte[] GetThrottlesPacked(float multiplier)
4774 { 5269 {
4775 return m_PacketHandler.PacketQueue.GetThrottlesPacked(multiplier); 5270 return m_udpClient.GetThrottlesPacked();
4776 } 5271 }
4777 /// <summary> 5272
4778 /// sets the throttles from values supplied by the client 5273 public bool IsThrottleEmpty(ThrottleOutPacketType category)
4779 /// </summary>
4780 /// <param name="throttles"></param>
4781 public void SetChildAgentThrottle(byte[] throttles)
4782 { 5274 {
4783 m_PacketHandler.PacketQueue.SetThrottleFromClient(throttles); 5275 return m_udpClient.IsThrottleEmpty(category);
4784 } 5276 }
4785 5277
4786 /// <summary> 5278 /// <summary>
4787 /// Method gets called when a new packet has arrived from the UDP 5279 /// Unused
4788 /// server. This happens after it's been decoded into a libsl object.
4789 /// </summary> 5280 /// </summary>
4790 /// <param name="NewPack">object containing the packet.</param>
4791 public virtual void InPacket(object NewPack) 5281 public virtual void InPacket(object NewPack)
4792 { 5282 {
4793 // Cast NewPack to Packet. 5283 throw new NotImplementedException();
4794 m_PacketHandler.InPacket((Packet) NewPack);
4795 } 5284 }
4796 5285
4797 /// <summary> 5286 /// <summary>
4798 /// This is the starting point for sending a simulator packet out to the client. 5287 /// This is the starting point for sending a simulator packet out to the client
4799 ///
4800 /// Please do not call this from outside the LindenUDP client stack.
4801 /// </summary> 5288 /// </summary>
4802 /// <param name="NewPack"></param> 5289 /// <param name="packet">Packet to send</param>
4803 /// <param name="throttlePacketType">Corresponds to the type of data that is going out. Enum</param> 5290 /// <param name="throttlePacketType">Throttling category for the packet</param>
4804 public void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) 5291 private void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType)
4805 { 5292 {
4806 m_PacketHandler.OutPacket(NewPack, throttlePacketType); 5293 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true);
4807 } 5294 }
4808 5295
4809 public bool AddMoney(int debit) 5296 public bool AddMoney(int debit)
@@ -4847,7 +5334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4847 return; 5334 return;
4848 } 5335 }
4849 5336
4850 handlerAutoPilotGo = OnAutoPilotGo; 5337 UpdateVector handlerAutoPilotGo = OnAutoPilotGo;
4851 if (handlerAutoPilotGo != null) 5338 if (handlerAutoPilotGo != null)
4852 { 5339 {
4853 handlerAutoPilotGo(0, new Vector3(locx, locy, locz), this); 5340 handlerAutoPilotGo(0, new Vector3(locx, locy, locz), this);
@@ -4899,7 +5386,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4899 } 5386 }
4900 #endregion 5387 #endregion
4901 5388
4902 handlerRequestAvatarProperties = OnRequestAvatarProperties; 5389 RequestAvatarProperties handlerRequestAvatarProperties = OnRequestAvatarProperties;
4903 if (handlerRequestAvatarProperties != null) 5390 if (handlerRequestAvatarProperties != null)
4904 { 5391 {
4905 handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); 5392 handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
@@ -4940,7 +5427,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4940 args.Sender = this; 5427 args.Sender = this;
4941 args.SenderUUID = this.AgentId; 5428 args.SenderUUID = this.AgentId;
4942 5429
4943 handlerChatFromClient = OnChatFromClient; 5430 ChatMessage handlerChatFromClient = OnChatFromClient;
4944 if (handlerChatFromClient != null) 5431 if (handlerChatFromClient != null)
4945 handlerChatFromClient(this, args); 5432 handlerChatFromClient(this, args);
4946 } 5433 }
@@ -4958,7 +5445,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4958 } 5445 }
4959 #endregion 5446 #endregion
4960 5447
4961 handlerUpdateAvatarProperties = OnUpdateAvatarProperties; 5448 UpdateAvatarProperties handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
4962 if (handlerUpdateAvatarProperties != null) 5449 if (handlerUpdateAvatarProperties != null)
4963 { 5450 {
4964 AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData; 5451 AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData;
@@ -4998,7 +5485,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4998 args.Position = new Vector3(); 5485 args.Position = new Vector3();
4999 args.Scene = Scene; 5486 args.Scene = Scene;
5000 args.Sender = this; 5487 args.Sender = this;
5001 handlerChatFromClient2 = OnChatFromClient; 5488 ChatMessage handlerChatFromClient2 = OnChatFromClient;
5002 if (handlerChatFromClient2 != null) 5489 if (handlerChatFromClient2 != null)
5003 handlerChatFromClient2(this, args); 5490 handlerChatFromClient2(this, args);
5004 } 5491 }
@@ -5019,7 +5506,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5019 5506
5020 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 5507 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
5021 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message); 5508 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message);
5022 handlerInstantMessage = OnInstantMessage; 5509 ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
5023 5510
5024 if (handlerInstantMessage != null) 5511 if (handlerInstantMessage != null)
5025 { 5512 {
@@ -5062,7 +5549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5062 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID); 5549 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID);
5063 } 5550 }
5064 5551
5065 handlerApproveFriendRequest = OnApproveFriendRequest; 5552 FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest;
5066 if (handlerApproveFriendRequest != null) 5553 if (handlerApproveFriendRequest != null)
5067 { 5554 {
5068 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders); 5555 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders);
@@ -5105,7 +5592,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5105 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; 5592 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
5106 UUID exFriendID = tfriendpack.ExBlock.OtherID; 5593 UUID exFriendID = tfriendpack.ExBlock.OtherID;
5107 5594
5108 handlerTerminateFriendship = OnTerminateFriendship; 5595 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship;
5109 if (handlerTerminateFriendship != null) 5596 if (handlerTerminateFriendship != null)
5110 { 5597 {
5111 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 5598 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
@@ -5124,7 +5611,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5124 } 5611 }
5125 #endregion 5612 #endregion
5126 5613
5127 handlerRezObject = OnRezObject; 5614 RezObject handlerRezObject = OnRezObject;
5128 if (handlerRezObject != null) 5615 if (handlerRezObject != null)
5129 { 5616 {
5130 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, 5617 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
@@ -5147,7 +5634,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5147 } 5634 }
5148 #endregion 5635 #endregion
5149 5636
5150 handlerDeRezObject = OnDeRezObject; 5637 DeRezObject handlerDeRezObject = OnDeRezObject;
5151 if (handlerDeRezObject != null) 5638 if (handlerDeRezObject != null)
5152 { 5639 {
5153 List<uint> deRezIDs = new List<uint>(); 5640 List<uint> deRezIDs = new List<uint>();
@@ -5186,7 +5673,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5186 { 5673 {
5187 for (int i = 0; i < modify.ParcelData.Length; i++) 5674 for (int i = 0; i < modify.ParcelData.Length; i++)
5188 { 5675 {
5189 handlerModifyTerrain = OnModifyTerrain; 5676 ModifyTerrain handlerModifyTerrain = OnModifyTerrain;
5190 if (handlerModifyTerrain != null) 5677 if (handlerModifyTerrain != null)
5191 { 5678 {
5192 handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, 5679 handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
@@ -5203,7 +5690,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5203 5690
5204 case PacketType.RegionHandshakeReply: 5691 case PacketType.RegionHandshakeReply:
5205 5692
5206 handlerRegionHandShakeReply = OnRegionHandShakeReply; 5693 Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply;
5207 if (handlerRegionHandShakeReply != null) 5694 if (handlerRegionHandShakeReply != null)
5208 { 5695 {
5209 handlerRegionHandShakeReply(this); 5696 handlerRegionHandShakeReply(this);
@@ -5212,14 +5699,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5212 break; 5699 break;
5213 5700
5214 case PacketType.AgentWearablesRequest: 5701 case PacketType.AgentWearablesRequest:
5215 handlerRequestWearables = OnRequestWearables; 5702 GenericCall2 handlerRequestWearables = OnRequestWearables;
5216 5703
5217 if (handlerRequestWearables != null) 5704 if (handlerRequestWearables != null)
5218 { 5705 {
5219 handlerRequestWearables(); 5706 handlerRequestWearables();
5220 } 5707 }
5221 5708
5222 handlerRequestAvatarsData = OnRequestAvatarsData; 5709 Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData;
5223 5710
5224 if (handlerRequestAvatarsData != null) 5711 if (handlerRequestAvatarsData != null)
5225 { 5712 {
@@ -5240,7 +5727,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5240 } 5727 }
5241 #endregion 5728 #endregion
5242 5729
5243 handlerSetAppearance = OnSetAppearance; 5730 SetAppearance handlerSetAppearance = OnSetAppearance;
5244 if (handlerSetAppearance != null) 5731 if (handlerSetAppearance != null)
5245 { 5732 {
5246 // Temporarily protect ourselves from the mantis #951 failure. 5733 // Temporarily protect ourselves from the mantis #951 failure.
@@ -5291,7 +5778,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5291 wearingArgs.NowWearing.Add(wearable); 5778 wearingArgs.NowWearing.Add(wearable);
5292 } 5779 }
5293 5780
5294 handlerAvatarNowWearing = OnAvatarNowWearing; 5781 AvatarNowWearing handlerAvatarNowWearing = OnAvatarNowWearing;
5295 if (handlerAvatarNowWearing != null) 5782 if (handlerAvatarNowWearing != null)
5296 { 5783 {
5297 handlerAvatarNowWearing(this, wearingArgs); 5784 handlerAvatarNowWearing(this, wearingArgs);
@@ -5300,7 +5787,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5300 break; 5787 break;
5301 5788
5302 case PacketType.RezSingleAttachmentFromInv: 5789 case PacketType.RezSingleAttachmentFromInv:
5303 handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; 5790 RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
5304 if (handlerRezSingleAttachment != null) 5791 if (handlerRezSingleAttachment != null)
5305 { 5792 {
5306 RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack; 5793 RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack;
@@ -5321,7 +5808,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5321 break; 5808 break;
5322 5809
5323 case PacketType.RezMultipleAttachmentsFromInv: 5810 case PacketType.RezMultipleAttachmentsFromInv:
5324 handlerRezMultipleAttachments = OnRezMultipleAttachmentsFromInv; 5811 RezMultipleAttachmentsFromInv handlerRezMultipleAttachments = OnRezMultipleAttachmentsFromInv;
5325 if (handlerRezMultipleAttachments != null) 5812 if (handlerRezMultipleAttachments != null)
5326 { 5813 {
5327 RezMultipleAttachmentsFromInvPacket rez = (RezMultipleAttachmentsFromInvPacket)Pack; 5814 RezMultipleAttachmentsFromInvPacket rez = (RezMultipleAttachmentsFromInvPacket)Pack;
@@ -5332,7 +5819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5332 break; 5819 break;
5333 5820
5334 case PacketType.DetachAttachmentIntoInv: 5821 case PacketType.DetachAttachmentIntoInv:
5335 handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; 5822 UUIDNameRequest handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv;
5336 if (handlerDetachAttachmentIntoInv != null) 5823 if (handlerDetachAttachmentIntoInv != null)
5337 { 5824 {
5338 DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack; 5825 DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack;
@@ -5362,7 +5849,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5362 } 5849 }
5363 #endregion 5850 #endregion
5364 5851
5365 handlerObjectAttach = OnObjectAttach; 5852 ObjectAttach handlerObjectAttach = OnObjectAttach;
5366 5853
5367 if (handlerObjectAttach != null) 5854 if (handlerObjectAttach != null)
5368 { 5855 {
@@ -5389,7 +5876,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5389 for (int j = 0; j < dett.ObjectData.Length; j++) 5876 for (int j = 0; j < dett.ObjectData.Length; j++)
5390 { 5877 {
5391 uint obj = dett.ObjectData[j].ObjectLocalID; 5878 uint obj = dett.ObjectData[j].ObjectLocalID;
5392 handlerObjectDetach = OnObjectDetach; 5879 ObjectDeselect handlerObjectDetach = OnObjectDetach;
5393 if (handlerObjectDetach != null) 5880 if (handlerObjectDetach != null)
5394 { 5881 {
5395 handlerObjectDetach(obj, this); 5882 handlerObjectDetach(obj, this);
@@ -5413,7 +5900,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5413 for (int j = 0; j < dropp.ObjectData.Length; j++) 5900 for (int j = 0; j < dropp.ObjectData.Length; j++)
5414 { 5901 {
5415 uint obj = dropp.ObjectData[j].ObjectLocalID; 5902 uint obj = dropp.ObjectData[j].ObjectLocalID;
5416 handlerObjectDrop = OnObjectDrop; 5903 ObjectDrop handlerObjectDrop = OnObjectDrop;
5417 if (handlerObjectDrop != null) 5904 if (handlerObjectDrop != null)
5418 { 5905 {
5419 handlerObjectDrop(obj, this); 5906 handlerObjectDrop(obj, this);
@@ -5433,14 +5920,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5433 } 5920 }
5434 #endregion 5921 #endregion
5435 5922
5436 handlerSetAlwaysRun = OnSetAlwaysRun; 5923 SetAlwaysRun handlerSetAlwaysRun = OnSetAlwaysRun;
5437 if (handlerSetAlwaysRun != null) 5924 if (handlerSetAlwaysRun != null)
5438 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); 5925 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
5439 5926
5440 break; 5927 break;
5441 5928
5442 case PacketType.CompleteAgentMovement: 5929 case PacketType.CompleteAgentMovement:
5443 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 5930 GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
5444 if (handlerCompleteMovementToRegion != null) 5931 if (handlerCompleteMovementToRegion != null)
5445 { 5932 {
5446 handlerCompleteMovementToRegion(); 5933 handlerCompleteMovementToRegion();
@@ -5509,7 +5996,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5509 arg.HeadRotation = x.HeadRotation; 5996 arg.HeadRotation = x.HeadRotation;
5510 arg.SessionID = x.SessionID; 5997 arg.SessionID = x.SessionID;
5511 arg.State = x.State; 5998 arg.State = x.State;
5512 handlerAgentUpdate = OnAgentUpdate; 5999 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
5513 lastarg = arg; // save this set of arguments for nexttime 6000 lastarg = arg; // save this set of arguments for nexttime
5514 if (handlerAgentUpdate != null) 6001 if (handlerAgentUpdate != null)
5515 OnAgentUpdate(this, arg); 6002 OnAgentUpdate(this, arg);
@@ -5532,8 +6019,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5532 } 6019 }
5533 #endregion 6020 #endregion
5534 6021
5535 handlerStartAnim = null; 6022 StartAnim handlerStartAnim = null;
5536 handlerStopAnim = null; 6023 StopAnim handlerStopAnim = null;
5537 6024
5538 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 6025 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
5539 { 6026 {
@@ -5570,7 +6057,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5570 } 6057 }
5571 #endregion 6058 #endregion
5572 6059
5573 handlerAgentRequestSit = OnAgentRequestSit; 6060 AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
5574 if (handlerAgentRequestSit != null) 6061 if (handlerAgentRequestSit != null)
5575 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, 6062 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
5576 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); 6063 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
@@ -5591,7 +6078,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5591 } 6078 }
5592 #endregion 6079 #endregion
5593 6080
5594 handlerAgentSit = OnAgentSit; 6081 AgentSit handlerAgentSit = OnAgentSit;
5595 if (handlerAgentSit != null) 6082 if (handlerAgentSit != null)
5596 { 6083 {
5597 OnAgentSit(this, agentSit.AgentData.AgentID); 6084 OnAgentSit(this, agentSit.AgentData.AgentID);
@@ -5609,7 +6096,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5609 } 6096 }
5610 #endregion 6097 #endregion
5611 6098
5612 handlerSoundTrigger = OnSoundTrigger; 6099 SoundTrigger handlerSoundTrigger = OnSoundTrigger;
5613 if (handlerSoundTrigger != null) 6100 if (handlerSoundTrigger != null)
5614 { 6101 {
5615 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, 6102 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID,
@@ -5636,7 +6123,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5636 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data; 6123 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data;
5637 //m_log.Debug("Agent Sends:" + Utils.BytesToString(querydata.Name)); 6124 //m_log.Debug("Agent Sends:" + Utils.BytesToString(querydata.Name));
5638 6125
5639 handlerAvatarPickerRequest = OnAvatarPickerRequest; 6126 AvatarPickerRequest handlerAvatarPickerRequest = OnAvatarPickerRequest;
5640 if (handlerAvatarPickerRequest != null) 6127 if (handlerAvatarPickerRequest != null)
5641 { 6128 {
5642 handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID, 6129 handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
@@ -5656,7 +6143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5656 } 6143 }
5657 #endregion 6144 #endregion
5658 6145
5659 handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest; 6146 FetchInventory handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest;
5660 6147
5661 if (handlerAgentDataUpdateRequest != null) 6148 if (handlerAgentDataUpdateRequest != null)
5662 { 6149 {
@@ -5666,7 +6153,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5666 break; 6153 break;
5667 6154
5668 case PacketType.UserInfoRequest: 6155 case PacketType.UserInfoRequest:
5669 handlerUserInfoRequest = OnUserInfoRequest; 6156 UserInfoRequest handlerUserInfoRequest = OnUserInfoRequest;
5670 if (handlerUserInfoRequest != null) 6157 if (handlerUserInfoRequest != null)
5671 { 6158 {
5672 handlerUserInfoRequest(this); 6159 handlerUserInfoRequest(this);
@@ -5689,7 +6176,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5689 } 6176 }
5690 #endregion 6177 #endregion
5691 6178
5692 handlerUpdateUserInfo = OnUpdateUserInfo; 6179 UpdateUserInfo handlerUpdateUserInfo = OnUpdateUserInfo;
5693 if (handlerUpdateUserInfo != null) 6180 if (handlerUpdateUserInfo != null)
5694 { 6181 {
5695 bool visible = true; 6182 bool visible = true;
@@ -5718,7 +6205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5718 6205
5719 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId) 6206 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId)
5720 { 6207 {
5721 handlerSetStartLocationRequest = OnSetStartLocationRequest; 6208 TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest;
5722 if (handlerSetStartLocationRequest != null) 6209 if (handlerSetStartLocationRequest != null)
5723 { 6210 {
5724 handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos, 6211 handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
@@ -5740,7 +6227,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5740 } 6227 }
5741 #endregion 6228 #endregion
5742 6229
5743 m_PacketHandler.PacketQueue.SetThrottleFromClient(atpack.Throttle.Throttles); 6230 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
5744 break; 6231 break;
5745 6232
5746 case PacketType.AgentPause: 6233 case PacketType.AgentPause:
@@ -5756,7 +6243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5756 break; 6243 break;
5757 6244
5758 case PacketType.ForceScriptControlRelease: 6245 case PacketType.ForceScriptControlRelease:
5759 handlerForceReleaseControls = OnForceReleaseControls; 6246 ForceReleaseControls handlerForceReleaseControls = OnForceReleaseControls;
5760 if (handlerForceReleaseControls != null) 6247 if (handlerForceReleaseControls != null)
5761 { 6248 {
5762 handlerForceReleaseControls(this, AgentId); 6249 handlerForceReleaseControls(this, AgentId);
@@ -5790,7 +6277,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5790 childrenprims.Add(link.ObjectData[i].ObjectLocalID); 6277 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
5791 } 6278 }
5792 } 6279 }
5793 handlerLinkObjects = OnLinkObjects; 6280 LinkObjects handlerLinkObjects = OnLinkObjects;
5794 if (handlerLinkObjects != null) 6281 if (handlerLinkObjects != null)
5795 { 6282 {
5796 handlerLinkObjects(this, parentprimid, childrenprims); 6283 handlerLinkObjects(this, parentprimid, childrenprims);
@@ -5818,7 +6305,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5818 { 6305 {
5819 prims.Add(delink.ObjectData[i].ObjectLocalID); 6306 prims.Add(delink.ObjectData[i].ObjectLocalID);
5820 } 6307 }
5821 handlerDelinkObjects = OnDelinkObjects; 6308 DelinkObjects handlerDelinkObjects = OnDelinkObjects;
5822 if (handlerDelinkObjects != null) 6309 if (handlerDelinkObjects != null)
5823 { 6310 {
5824 handlerDelinkObjects(prims); 6311 handlerDelinkObjects(prims);
@@ -5850,7 +6337,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5850 //Check to see if adding the prim is allowed; useful for any module wanting to restrict the 6337 //Check to see if adding the prim is allowed; useful for any module wanting to restrict the
5851 //object from rezing initially 6338 //object from rezing initially
5852 6339
5853 handlerAddPrim = OnAddPrim; 6340 AddNewPrim handlerAddPrim = OnAddPrim;
5854 if (handlerAddPrim != null) 6341 if (handlerAddPrim != null)
5855 handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); 6342 handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
5856 } 6343 }
@@ -5868,7 +6355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5868 } 6355 }
5869 #endregion 6356 #endregion
5870 6357
5871 handlerUpdatePrimShape = null; 6358 UpdateShape handlerUpdatePrimShape = null;
5872 for (int i = 0; i < shapePacket.ObjectData.Length; i++) 6359 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
5873 { 6360 {
5874 handlerUpdatePrimShape = OnUpdatePrimShape; 6361 handlerUpdatePrimShape = OnUpdatePrimShape;
@@ -5913,7 +6400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5913 } 6400 }
5914 #endregion 6401 #endregion
5915 6402
5916 handlerUpdateExtraParams = OnUpdateExtraParams; 6403 ObjectExtraParams handlerUpdateExtraParams = OnUpdateExtraParams;
5917 if (handlerUpdateExtraParams != null) 6404 if (handlerUpdateExtraParams != null)
5918 { 6405 {
5919 for (int i = 0 ; i < extraPar.ObjectData.Length ; i++) 6406 for (int i = 0 ; i < extraPar.ObjectData.Length ; i++)
@@ -5938,7 +6425,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5938 6425
5939 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData; 6426 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
5940 6427
5941 handlerObjectDuplicate = null; 6428 ObjectDuplicate handlerObjectDuplicate = null;
5942 6429
5943 for (int i = 0; i < dupe.ObjectData.Length; i++) 6430 for (int i = 0; i < dupe.ObjectData.Length; i++)
5944 { 6431 {
@@ -5965,7 +6452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5965 } 6452 }
5966 #endregion 6453 #endregion
5967 6454
5968 handlerObjectRequest = null; 6455 ObjectRequest handlerObjectRequest = null;
5969 6456
5970 for (int i = 0; i < incomingRequest.ObjectData.Length; i++) 6457 for (int i = 0; i < incomingRequest.ObjectData.Length; i++)
5971 { 6458 {
@@ -5988,7 +6475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5988 } 6475 }
5989 #endregion 6476 #endregion
5990 6477
5991 handlerObjectSelect = null; 6478 ObjectSelect handlerObjectSelect = null;
5992 6479
5993 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 6480 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
5994 { 6481 {
@@ -6011,7 +6498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6011 } 6498 }
6012 #endregion 6499 #endregion
6013 6500
6014 handlerObjectDeselect = null; 6501 ObjectDeselect handlerObjectDeselect = null;
6015 6502
6016 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 6503 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
6017 { 6504 {
@@ -6038,7 +6525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6038 6525
6039 for (int i = 0; i < position.ObjectData.Length; i++) 6526 for (int i = 0; i < position.ObjectData.Length; i++)
6040 { 6527 {
6041 handlerUpdateVector = OnUpdatePrimGroupPosition; 6528 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition;
6042 if (handlerUpdateVector != null) 6529 if (handlerUpdateVector != null)
6043 handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this); 6530 handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this);
6044 } 6531 }
@@ -6059,7 +6546,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6059 6546
6060 for (int i = 0; i < scale.ObjectData.Length; i++) 6547 for (int i = 0; i < scale.ObjectData.Length; i++)
6061 { 6548 {
6062 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 6549 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
6063 if (handlerUpdatePrimGroupScale != null) 6550 if (handlerUpdatePrimGroupScale != null)
6064 handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this); 6551 handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this);
6065 } 6552 }
@@ -6080,7 +6567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6080 6567
6081 for (int i = 0; i < rotation.ObjectData.Length; i++) 6568 for (int i = 0; i < rotation.ObjectData.Length; i++)
6082 { 6569 {
6083 handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 6570 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
6084 if (handlerUpdatePrimRotation != null) 6571 if (handlerUpdatePrimRotation != null)
6085 handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this); 6572 handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this);
6086 } 6573 }
@@ -6098,7 +6585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6098 } 6585 }
6099 #endregion 6586 #endregion
6100 6587
6101 handlerUpdatePrimFlags = OnUpdatePrimFlags; 6588 UpdatePrimFlags handlerUpdatePrimFlags = OnUpdatePrimFlags;
6102 6589
6103 if (handlerUpdatePrimFlags != null) 6590 if (handlerUpdatePrimFlags != null)
6104 { 6591 {
@@ -6115,7 +6602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6115 case PacketType.ObjectImage: 6602 case PacketType.ObjectImage:
6116 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 6603 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
6117 6604
6118 handlerUpdatePrimTexture = null; 6605 UpdatePrimTexture handlerUpdatePrimTexture = null;
6119 for (int i = 0; i < imagePack.ObjectData.Length; i++) 6606 for (int i = 0; i < imagePack.ObjectData.Length; i++)
6120 { 6607 {
6121 handlerUpdatePrimTexture = OnUpdatePrimTexture; 6608 handlerUpdatePrimTexture = OnUpdatePrimTexture;
@@ -6138,7 +6625,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6138 } 6625 }
6139 #endregion 6626 #endregion
6140 6627
6141 handlerGrabObject = OnGrabObject; 6628 GrabObject handlerGrabObject = OnGrabObject;
6142 6629
6143 if (handlerGrabObject != null) 6630 if (handlerGrabObject != null)
6144 { 6631 {
@@ -6172,7 +6659,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6172 } 6659 }
6173 #endregion 6660 #endregion
6174 6661
6175 handlerGrabUpdate = OnGrabUpdate; 6662 MoveObject handlerGrabUpdate = OnGrabUpdate;
6176 6663
6177 if (handlerGrabUpdate != null) 6664 if (handlerGrabUpdate != null)
6178 { 6665 {
@@ -6207,7 +6694,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6207 } 6694 }
6208 #endregion 6695 #endregion
6209 6696
6210 handlerDeGrabObject = OnDeGrabObject; 6697 DeGrabObject handlerDeGrabObject = OnDeGrabObject;
6211 if (handlerDeGrabObject != null) 6698 if (handlerDeGrabObject != null)
6212 { 6699 {
6213 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); 6700 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
@@ -6241,7 +6728,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6241 } 6728 }
6242 #endregion 6729 #endregion
6243 6730
6244 handlerSpinStart = OnSpinStart; 6731 SpinStart handlerSpinStart = OnSpinStart;
6245 if (handlerSpinStart != null) 6732 if (handlerSpinStart != null)
6246 { 6733 {
6247 handlerSpinStart(spinStart.ObjectData.ObjectID, this); 6734 handlerSpinStart(spinStart.ObjectData.ObjectID, this);
@@ -6265,7 +6752,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6265 spinUpdate.ObjectData.Rotation.GetAxisAngle(out axis, out angle); 6752 spinUpdate.ObjectData.Rotation.GetAxisAngle(out axis, out angle);
6266 //m_log.Warn("[CLIENT]: ObjectSpinUpdate packet rot axis:" + axis + " angle:" + angle); 6753 //m_log.Warn("[CLIENT]: ObjectSpinUpdate packet rot axis:" + axis + " angle:" + angle);
6267 6754
6268 handlerSpinUpdate = OnSpinUpdate; 6755 SpinObject handlerSpinUpdate = OnSpinUpdate;
6269 if (handlerSpinUpdate != null) 6756 if (handlerSpinUpdate != null)
6270 { 6757 {
6271 handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this); 6758 handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this);
@@ -6284,7 +6771,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6284 } 6771 }
6285 #endregion 6772 #endregion
6286 6773
6287 handlerSpinStop = OnSpinStop; 6774 SpinStop handlerSpinStop = OnSpinStop;
6288 if (handlerSpinStop != null) 6775 if (handlerSpinStop != null)
6289 { 6776 {
6290 handlerSpinStop(spinStop.ObjectData.ObjectID, this); 6777 handlerSpinStop(spinStop.ObjectData.ObjectID, this);
@@ -6303,7 +6790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6303 } 6790 }
6304 #endregion 6791 #endregion
6305 6792
6306 handlerObjectDescription = null; 6793 GenericCall7 handlerObjectDescription = null;
6307 6794
6308 for (int i = 0; i < objDes.ObjectData.Length; i++) 6795 for (int i = 0; i < objDes.ObjectData.Length; i++)
6309 { 6796 {
@@ -6327,7 +6814,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6327 } 6814 }
6328 #endregion 6815 #endregion
6329 6816
6330 handlerObjectName = null; 6817 GenericCall7 handlerObjectName = null;
6331 for (int i = 0; i < objName.ObjectData.Length; i++) 6818 for (int i = 0; i < objName.ObjectData.Length; i++)
6332 { 6819 {
6333 handlerObjectName = OnObjectName; 6820 handlerObjectName = OnObjectName;
@@ -6355,7 +6842,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6355 UUID AgentID = newobjPerms.AgentData.AgentID; 6842 UUID AgentID = newobjPerms.AgentData.AgentID;
6356 UUID SessionID = newobjPerms.AgentData.SessionID; 6843 UUID SessionID = newobjPerms.AgentData.SessionID;
6357 6844
6358 handlerObjectPermissions = null; 6845 ObjectPermissions handlerObjectPermissions = null;
6359 6846
6360 for (int i = 0; i < newobjPerms.ObjectData.Length; i++) 6847 for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
6361 { 6848 {
@@ -6404,7 +6891,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6404 for (int i = 0; i < undoitem.ObjectData.Length; i++) 6891 for (int i = 0; i < undoitem.ObjectData.Length; i++)
6405 { 6892 {
6406 UUID objiD = undoitem.ObjectData[i].ObjectID; 6893 UUID objiD = undoitem.ObjectData[i].ObjectID;
6407 handlerOnUndo = OnUndo; 6894 AgentSit handlerOnUndo = OnUndo;
6408 if (handlerOnUndo != null) 6895 if (handlerOnUndo != null)
6409 { 6896 {
6410 handlerOnUndo(this, objiD); 6897 handlerOnUndo(this, objiD);
@@ -6425,8 +6912,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6425 } 6912 }
6426 #endregion 6913 #endregion
6427 6914
6428 handlerObjectDuplicateOnRay = null; 6915 ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null;
6429
6430 6916
6431 for (int i = 0; i < dupeOnRay.ObjectData.Length; i++) 6917 for (int i = 0; i < dupeOnRay.ObjectData.Length; i++)
6432 { 6918 {
@@ -6456,7 +6942,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6456 6942
6457 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; 6943 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
6458 6944
6459 handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily; 6945 RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily;
6460 6946
6461 if (handlerRequestObjectPropertiesFamily != null) 6947 if (handlerRequestObjectPropertiesFamily != null)
6462 { 6948 {
@@ -6468,7 +6954,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6468 case PacketType.ObjectIncludeInSearch: 6954 case PacketType.ObjectIncludeInSearch:
6469 //This lets us set objects to appear in search (stuff like DataSnapshot, etc) 6955 //This lets us set objects to appear in search (stuff like DataSnapshot, etc)
6470 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; 6956 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack;
6471 handlerObjectIncludeInSearch = null; 6957 ObjectIncludeInSearch handlerObjectIncludeInSearch = null;
6472 6958
6473 #region Packet Session and User Check 6959 #region Packet Session and User Check
6474 if (m_checkPackets) 6960 if (m_checkPackets)
@@ -6505,7 +6991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6505 } 6991 }
6506 #endregion 6992 #endregion
6507 6993
6508 handlerScriptAnswer = OnScriptAnswer; 6994 ScriptAnswer handlerScriptAnswer = OnScriptAnswer;
6509 if (handlerScriptAnswer != null) 6995 if (handlerScriptAnswer != null)
6510 { 6996 {
6511 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); 6997 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions);
@@ -6524,7 +7010,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6524 } 7010 }
6525 #endregion 7011 #endregion
6526 7012
6527 handlerObjectClickAction = OnObjectClickAction; 7013 GenericCall7 handlerObjectClickAction = OnObjectClickAction;
6528 if (handlerObjectClickAction != null) 7014 if (handlerObjectClickAction != null)
6529 { 7015 {
6530 foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData) 7016 foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData)
@@ -6548,7 +7034,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6548 } 7034 }
6549 #endregion 7035 #endregion
6550 7036
6551 handlerObjectMaterial = OnObjectMaterial; 7037 GenericCall7 handlerObjectMaterial = OnObjectMaterial;
6552 if (handlerObjectMaterial != null) 7038 if (handlerObjectMaterial != null)
6553 { 7039 {
6554 foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData) 7040 foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData)
@@ -6702,7 +7188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6702 // m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString()); 7188 // m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
6703 UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId); 7189 UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
6704 7190
6705 handlerAssetUploadRequest = OnAssetUploadRequest; 7191 UDPAssetUploadRequest handlerAssetUploadRequest = OnAssetUploadRequest;
6706 7192
6707 if (handlerAssetUploadRequest != null) 7193 if (handlerAssetUploadRequest != null)
6708 { 7194 {
@@ -6715,7 +7201,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6715 case PacketType.RequestXfer: 7201 case PacketType.RequestXfer:
6716 RequestXferPacket xferReq = (RequestXferPacket)Pack; 7202 RequestXferPacket xferReq = (RequestXferPacket)Pack;
6717 7203
6718 handlerRequestXfer = OnRequestXfer; 7204 RequestXfer handlerRequestXfer = OnRequestXfer;
6719 7205
6720 if (handlerRequestXfer != null) 7206 if (handlerRequestXfer != null)
6721 { 7207 {
@@ -6725,7 +7211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6725 case PacketType.SendXferPacket: 7211 case PacketType.SendXferPacket:
6726 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; 7212 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
6727 7213
6728 handlerXferReceive = OnXferReceive; 7214 XferReceive handlerXferReceive = OnXferReceive;
6729 if (handlerXferReceive != null) 7215 if (handlerXferReceive != null)
6730 { 7216 {
6731 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); 7217 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
@@ -6734,7 +7220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6734 case PacketType.ConfirmXferPacket: 7220 case PacketType.ConfirmXferPacket:
6735 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; 7221 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack;
6736 7222
6737 handlerConfirmXfer = OnConfirmXfer; 7223 ConfirmXfer handlerConfirmXfer = OnConfirmXfer;
6738 if (handlerConfirmXfer != null) 7224 if (handlerConfirmXfer != null)
6739 { 7225 {
6740 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); 7226 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
@@ -6742,7 +7228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6742 break; 7228 break;
6743 case PacketType.AbortXfer: 7229 case PacketType.AbortXfer:
6744 AbortXferPacket abortXfer = (AbortXferPacket)Pack; 7230 AbortXferPacket abortXfer = (AbortXferPacket)Pack;
6745 handlerAbortXfer = OnAbortXfer; 7231 AbortXfer handlerAbortXfer = OnAbortXfer;
6746 if (handlerAbortXfer != null) 7232 if (handlerAbortXfer != null)
6747 { 7233 {
6748 handlerAbortXfer(this, abortXfer.XferID.ID); 7234 handlerAbortXfer(this, abortXfer.XferID.ID);
@@ -6761,7 +7247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6761 } 7247 }
6762 #endregion 7248 #endregion
6763 7249
6764 handlerCreateInventoryFolder = OnCreateNewInventoryFolder; 7250 CreateInventoryFolder handlerCreateInventoryFolder = OnCreateNewInventoryFolder;
6765 if (handlerCreateInventoryFolder != null) 7251 if (handlerCreateInventoryFolder != null)
6766 { 7252 {
6767 handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID, 7253 handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID,
@@ -6784,7 +7270,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6784 } 7270 }
6785 #endregion 7271 #endregion
6786 7272
6787 handlerUpdateInventoryFolder = null; 7273 UpdateInventoryFolder handlerUpdateInventoryFolder = null;
6788 7274
6789 for (int i = 0; i < invFolderx.FolderData.Length; i++) 7275 for (int i = 0; i < invFolderx.FolderData.Length; i++)
6790 { 7276 {
@@ -6813,7 +7299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6813 } 7299 }
6814 #endregion 7300 #endregion
6815 7301
6816 handlerMoveInventoryFolder = null; 7302 MoveInventoryFolder handlerMoveInventoryFolder = null;
6817 7303
6818 for (int i = 0; i < invFoldery.InventoryData.Length; i++) 7304 for (int i = 0; i < invFoldery.InventoryData.Length; i++)
6819 { 7305 {
@@ -6838,7 +7324,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6838 } 7324 }
6839 #endregion 7325 #endregion
6840 7326
6841 handlerCreateNewInventoryItem = OnCreateNewInventoryItem; 7327 CreateNewInventoryItem handlerCreateNewInventoryItem = OnCreateNewInventoryItem;
6842 if (handlerCreateNewInventoryItem != null) 7328 if (handlerCreateNewInventoryItem != null)
6843 { 7329 {
6844 handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, 7330 handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
@@ -6867,7 +7353,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6867 } 7353 }
6868 #endregion 7354 #endregion
6869 7355
6870 handlerFetchInventory = null; 7356 FetchInventory handlerFetchInventory = null;
6871 7357
6872 for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++) 7358 for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++)
6873 { 7359 {
@@ -6893,7 +7379,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6893 } 7379 }
6894 #endregion 7380 #endregion
6895 7381
6896 handlerFetchInventoryDescendents = OnFetchInventoryDescendents; 7382 FetchInventoryDescendents handlerFetchInventoryDescendents = OnFetchInventoryDescendents;
6897 if (handlerFetchInventoryDescendents != null) 7383 if (handlerFetchInventoryDescendents != null)
6898 { 7384 {
6899 handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, 7385 handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
@@ -6913,7 +7399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6913 } 7399 }
6914 #endregion 7400 #endregion
6915 7401
6916 handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents; 7402 PurgeInventoryDescendents handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents;
6917 if (handlerPurgeInventoryDescendents != null) 7403 if (handlerPurgeInventoryDescendents != null)
6918 { 7404 {
6919 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID); 7405 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
@@ -6933,7 +7419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6933 7419
6934 if (OnUpdateInventoryItem != null) 7420 if (OnUpdateInventoryItem != null)
6935 { 7421 {
6936 handlerUpdateInventoryItem = null; 7422 UpdateInventoryItem handlerUpdateInventoryItem = null;
6937 for (int i = 0; i < inventoryItemUpdate.InventoryData.Length; i++) 7423 for (int i = 0; i < inventoryItemUpdate.InventoryData.Length; i++)
6938 { 7424 {
6939 handlerUpdateInventoryItem = OnUpdateInventoryItem; 7425 handlerUpdateInventoryItem = OnUpdateInventoryItem;
@@ -6955,49 +7441,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6955 itemUpd.SalePrice = inventoryItemUpdate.InventoryData[i].SalePrice; 7441 itemUpd.SalePrice = inventoryItemUpdate.InventoryData[i].SalePrice;
6956 itemUpd.SaleType = inventoryItemUpdate.InventoryData[i].SaleType; 7442 itemUpd.SaleType = inventoryItemUpdate.InventoryData[i].SaleType;
6957 itemUpd.Flags = inventoryItemUpdate.InventoryData[i].Flags; 7443 itemUpd.Flags = inventoryItemUpdate.InventoryData[i].Flags;
6958 /* 7444
6959 OnUpdateInventoryItem(this, inventoryItemUpdate.InventoryData[i].TransactionID,
6960 inventoryItemUpdate.InventoryData[i].ItemID,
6961 Util.FieldToString(inventoryItemUpdate.InventoryData[i].Name),
6962 Util.FieldToString(inventoryItemUpdate.InventoryData[i].Description),
6963 inventoryItemUpdate.InventoryData[i].NextOwnerMask);
6964 */
6965 OnUpdateInventoryItem(this, inventoryItemUpdate.InventoryData[i].TransactionID, 7445 OnUpdateInventoryItem(this, inventoryItemUpdate.InventoryData[i].TransactionID,
6966 inventoryItemUpdate.InventoryData[i].ItemID, 7446 inventoryItemUpdate.InventoryData[i].ItemID,
6967 itemUpd); 7447 itemUpd);
6968 } 7448 }
6969 } 7449 }
6970 } 7450 }
6971 //m_log.Debug(Pack.ToString());
6972 /*for (int i = 0; i < inventoryItemUpdate.InventoryData.Length; i++)
6973 {
6974 if (inventoryItemUpdate.InventoryData[i].TransactionID != UUID.Zero)
6975 {
6976 AssetBase asset = m_assetCache.GetAsset(inventoryItemUpdate.InventoryData[i].TransactionID.Combine(this.SecureSessionId));
6977 if (asset != null)
6978 {
6979 // m_log.Debug("updating inventory item, found asset" + asset.FullID.ToString() + " already in cache");
6980 m_inventoryCache.UpdateInventoryItemAsset(this, inventoryItemUpdate.InventoryData[i].ItemID, asset);
6981 }
6982 else
6983 {
6984 asset = this.UploadAssets.AddUploadToAssetCache(inventoryItemUpdate.InventoryData[i].TransactionID);
6985 if (asset != null)
6986 {
6987 //m_log.Debug("updating inventory item, adding asset" + asset.FullID.ToString() + " to cache");
6988 m_inventoryCache.UpdateInventoryItemAsset(this, inventoryItemUpdate.InventoryData[i].ItemID, asset);
6989 }
6990 else
6991 {
6992 //m_log.Debug("trying to update inventory item, but asset is null");
6993 }
6994 }
6995 }
6996 else
6997 {
6998 m_inventoryCache.UpdateInventoryItemDetails(this, inventoryItemUpdate.InventoryData[i].ItemID, inventoryItemUpdate.InventoryData[i]); ;
6999 }
7000 }*/
7001 break; 7451 break;
7002 case PacketType.CopyInventoryItem: 7452 case PacketType.CopyInventoryItem:
7003 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack; 7453 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack;
@@ -7011,7 +7461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7011 } 7461 }
7012 #endregion 7462 #endregion
7013 7463
7014 handlerCopyInventoryItem = null; 7464 CopyInventoryItem handlerCopyInventoryItem = null;
7015 if (OnCopyInventoryItem != null) 7465 if (OnCopyInventoryItem != null)
7016 { 7466 {
7017 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData) 7467 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData)
@@ -7040,7 +7490,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7040 7490
7041 if (OnMoveInventoryItem != null) 7491 if (OnMoveInventoryItem != null)
7042 { 7492 {
7043 handlerMoveInventoryItem = null; 7493 MoveInventoryItem handlerMoveInventoryItem = null;
7044 InventoryItemBase itm = null; 7494 InventoryItemBase itm = null;
7045 List<InventoryItemBase> items = new List<InventoryItemBase>(); 7495 List<InventoryItemBase> items = new List<InventoryItemBase>();
7046 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 7496 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
@@ -7073,7 +7523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7073 7523
7074 if (OnRemoveInventoryItem != null) 7524 if (OnRemoveInventoryItem != null)
7075 { 7525 {
7076 handlerRemoveInventoryItem = null; 7526 RemoveInventoryItem handlerRemoveInventoryItem = null;
7077 List<UUID> uuids = new List<UUID>(); 7527 List<UUID> uuids = new List<UUID>();
7078 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) 7528 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
7079 { 7529 {
@@ -7101,7 +7551,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7101 7551
7102 if (OnRemoveInventoryFolder != null) 7552 if (OnRemoveInventoryFolder != null)
7103 { 7553 {
7104 handlerRemoveInventoryFolder = null; 7554 RemoveInventoryFolder handlerRemoveInventoryFolder = null;
7105 List<UUID> uuids = new List<UUID>(); 7555 List<UUID> uuids = new List<UUID>();
7106 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) 7556 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
7107 { 7557 {
@@ -7126,7 +7576,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7126 #endregion 7576 #endregion
7127 if (OnRemoveInventoryFolder != null) 7577 if (OnRemoveInventoryFolder != null)
7128 { 7578 {
7129 handlerRemoveInventoryFolder = null; 7579 RemoveInventoryFolder handlerRemoveInventoryFolder = null;
7130 List<UUID> uuids = new List<UUID>(); 7580 List<UUID> uuids = new List<UUID>();
7131 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) 7581 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
7132 { 7582 {
@@ -7141,7 +7591,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7141 7591
7142 if (OnRemoveInventoryItem != null) 7592 if (OnRemoveInventoryItem != null)
7143 { 7593 {
7144 handlerRemoveInventoryItem = null; 7594 RemoveInventoryItem handlerRemoveInventoryItem = null;
7145 List<UUID> uuids = new List<UUID>(); 7595 List<UUID> uuids = new List<UUID>();
7146 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData) 7596 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData)
7147 { 7597 {
@@ -7166,7 +7616,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7166 } 7616 }
7167 #endregion 7617 #endregion
7168 7618
7169 handlerRequestTaskInventory = OnRequestTaskInventory; 7619 RequestTaskInventory handlerRequestTaskInventory = OnRequestTaskInventory;
7170 if (handlerRequestTaskInventory != null) 7620 if (handlerRequestTaskInventory != null)
7171 { 7621 {
7172 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID); 7622 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID);
@@ -7188,7 +7638,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7188 { 7638 {
7189 if (updatetask.UpdateData.Key == 0) 7639 if (updatetask.UpdateData.Key == 0)
7190 { 7640 {
7191 handlerUpdateTaskInventory = OnUpdateTaskInventory; 7641 UpdateTaskInventory handlerUpdateTaskInventory = OnUpdateTaskInventory;
7192 if (handlerUpdateTaskInventory != null) 7642 if (handlerUpdateTaskInventory != null)
7193 { 7643 {
7194 TaskInventoryItem newTaskItem = new TaskInventoryItem(); 7644 TaskInventoryItem newTaskItem = new TaskInventoryItem();
@@ -7232,7 +7682,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7232 } 7682 }
7233 #endregion 7683 #endregion
7234 7684
7235 handlerRemoveTaskItem = OnRemoveTaskItem; 7685 RemoveTaskInventory handlerRemoveTaskItem = OnRemoveTaskItem;
7236 7686
7237 if (handlerRemoveTaskItem != null) 7687 if (handlerRemoveTaskItem != null)
7238 { 7688 {
@@ -7254,7 +7704,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7254 } 7704 }
7255 #endregion 7705 #endregion
7256 7706
7257 handlerMoveTaskItem = OnMoveTaskItem; 7707 MoveTaskInventory handlerMoveTaskItem = OnMoveTaskItem;
7258 7708
7259 if (handlerMoveTaskItem != null) 7709 if (handlerMoveTaskItem != null)
7260 { 7710 {
@@ -7279,7 +7729,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7279 } 7729 }
7280 #endregion 7730 #endregion
7281 7731
7282 handlerRezScript = OnRezScript; 7732 RezScript handlerRezScript = OnRezScript;
7283 InventoryItemBase item = new InventoryItemBase(); 7733 InventoryItemBase item = new InventoryItemBase();
7284 item.ID = rezScriptx.InventoryBlock.ItemID; 7734 item.ID = rezScriptx.InventoryBlock.ItemID;
7285 item.Folder = rezScriptx.InventoryBlock.FolderID; 7735 item.Folder = rezScriptx.InventoryBlock.FolderID;
@@ -7322,7 +7772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7322 } 7772 }
7323 #endregion 7773 #endregion
7324 7774
7325 handlerRequestMapBlocks = OnRequestMapBlocks; 7775 RequestMapBlocks handlerRequestMapBlocks = OnRequestMapBlocks;
7326 if (handlerRequestMapBlocks != null) 7776 if (handlerRequestMapBlocks != null)
7327 { 7777 {
7328 handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, 7778 handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
@@ -7343,7 +7793,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7343 7793
7344 string mapName = Util.UTF8.GetString(map.NameData.Name, 0, 7794 string mapName = Util.UTF8.GetString(map.NameData.Name, 0,
7345 map.NameData.Name.Length - 1); 7795 map.NameData.Name.Length - 1);
7346 handlerMapNameRequest = OnMapNameRequest; 7796 RequestMapName handlerMapNameRequest = OnMapNameRequest;
7347 if (handlerMapNameRequest != null) 7797 if (handlerMapNameRequest != null)
7348 { 7798 {
7349 handlerMapNameRequest(this, mapName); 7799 handlerMapNameRequest(this, mapName);
@@ -7394,7 +7844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7394 else 7844 else
7395 { 7845 {
7396 // Teleport home request 7846 // Teleport home request
7397 handlerTeleportHomeRequest = OnTeleportHomeRequest; 7847 UUIDNameRequest handlerTeleportHomeRequest = OnTeleportHomeRequest;
7398 if (handlerTeleportHomeRequest != null) 7848 if (handlerTeleportHomeRequest != null)
7399 { 7849 {
7400 handlerTeleportHomeRequest(AgentId, this); 7850 handlerTeleportHomeRequest(AgentId, this);
@@ -7402,7 +7852,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7402 break; 7852 break;
7403 } 7853 }
7404 7854
7405 handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; 7855 TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
7406 if (handlerTeleportLandmarkRequest != null) 7856 if (handlerTeleportLandmarkRequest != null)
7407 { 7857 {
7408 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position); 7858 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position);
@@ -7433,7 +7883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7433 } 7883 }
7434 #endregion 7884 #endregion
7435 7885
7436 handlerTeleportLocationRequest = OnTeleportLocationRequest; 7886 TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest;
7437 if (handlerTeleportLocationRequest != null) 7887 if (handlerTeleportLocationRequest != null)
7438 { 7888 {
7439 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, 7889 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
@@ -7456,7 +7906,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7456 7906
7457 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) 7907 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
7458 { 7908 {
7459 handlerNameRequest = OnNameFromUUIDRequest; 7909 UUIDNameRequest handlerNameRequest = OnNameFromUUIDRequest;
7460 if (handlerNameRequest != null) 7910 if (handlerNameRequest != null)
7461 { 7911 {
7462 handlerNameRequest(UUIDBlock.ID, this); 7912 handlerNameRequest(UUIDBlock.ID, this);
@@ -7469,7 +7919,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7469 case PacketType.RegionHandleRequest: 7919 case PacketType.RegionHandleRequest:
7470 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 7920 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
7471 7921
7472 handlerRegionHandleRequest = OnRegionHandleRequest; 7922 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
7473 if (handlerRegionHandleRequest != null) 7923 if (handlerRegionHandleRequest != null)
7474 { 7924 {
7475 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); 7925 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID);
@@ -7488,7 +7938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7488 } 7938 }
7489 #endregion 7939 #endregion
7490 7940
7491 handlerParcelInfoRequest = OnParcelInfoRequest; 7941 ParcelInfoRequest handlerParcelInfoRequest = OnParcelInfoRequest;
7492 if (handlerParcelInfoRequest != null) 7942 if (handlerParcelInfoRequest != null)
7493 { 7943 {
7494 handlerParcelInfoRequest(this, pirPack.Data.ParcelID); 7944 handlerParcelInfoRequest(this, pirPack.Data.ParcelID);
@@ -7507,7 +7957,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7507 } 7957 }
7508 #endregion 7958 #endregion
7509 7959
7510 handlerParcelAccessListRequest = OnParcelAccessListRequest; 7960 ParcelAccessListRequest handlerParcelAccessListRequest = OnParcelAccessListRequest;
7511 7961
7512 if (handlerParcelAccessListRequest != null) 7962 if (handlerParcelAccessListRequest != null)
7513 { 7963 {
@@ -7539,7 +7989,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7539 entries.Add(entry); 7989 entries.Add(entry);
7540 } 7990 }
7541 7991
7542 handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest; 7992 ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest;
7543 if (handlerParcelAccessListUpdateRequest != null) 7993 if (handlerParcelAccessListUpdateRequest != null)
7544 { 7994 {
7545 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, 7995 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
@@ -7560,7 +8010,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7560 } 8010 }
7561 #endregion 8011 #endregion
7562 8012
7563 handlerParcelPropertiesRequest = OnParcelPropertiesRequest; 8013 ParcelPropertiesRequest handlerParcelPropertiesRequest = OnParcelPropertiesRequest;
7564 if (handlerParcelPropertiesRequest != null) 8014 if (handlerParcelPropertiesRequest != null)
7565 { 8015 {
7566 handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), 8016 handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West),
@@ -7583,7 +8033,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7583 } 8033 }
7584 #endregion 8034 #endregion
7585 8035
7586 handlerParcelDivideRequest = OnParcelDivideRequest; 8036 ParcelDivideRequest handlerParcelDivideRequest = OnParcelDivideRequest;
7587 if (handlerParcelDivideRequest != null) 8037 if (handlerParcelDivideRequest != null)
7588 { 8038 {
7589 handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), 8039 handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West),
@@ -7604,7 +8054,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7604 } 8054 }
7605 #endregion 8055 #endregion
7606 8056
7607 handlerParcelJoinRequest = OnParcelJoinRequest; 8057 ParcelJoinRequest handlerParcelJoinRequest = OnParcelJoinRequest;
7608 8058
7609 if (handlerParcelJoinRequest != null) 8059 if (handlerParcelJoinRequest != null)
7610 { 8060 {
@@ -7626,7 +8076,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7626 } 8076 }
7627 #endregion 8077 #endregion
7628 8078
7629 handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest; 8079 ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest;
7630 8080
7631 if (handlerParcelPropertiesUpdateRequest != null) 8081 if (handlerParcelPropertiesUpdateRequest != null)
7632 { 8082 {
@@ -7672,7 +8122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7672 returnIDs.Add(rb.ReturnID); 8122 returnIDs.Add(rb.ReturnID);
7673 } 8123 }
7674 8124
7675 handlerParcelSelectObjects = OnParcelSelectObjects; 8125 ParcelSelectObjects handlerParcelSelectObjects = OnParcelSelectObjects;
7676 8126
7677 if (handlerParcelSelectObjects != null) 8127 if (handlerParcelSelectObjects != null)
7678 { 8128 {
@@ -7693,7 +8143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7693 } 8143 }
7694 #endregion 8144 #endregion
7695 8145
7696 handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest; 8146 ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest;
7697 8147
7698 if (handlerParcelObjectOwnerRequest != null) 8148 if (handlerParcelObjectOwnerRequest != null)
7699 { 8149 {
@@ -7712,7 +8162,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7712 } 8162 }
7713 #endregion 8163 #endregion
7714 8164
7715 handlerParcelGodForceOwner = OnParcelGodForceOwner; 8165 ParcelGodForceOwner handlerParcelGodForceOwner = OnParcelGodForceOwner;
7716 if (handlerParcelGodForceOwner != null) 8166 if (handlerParcelGodForceOwner != null)
7717 { 8167 {
7718 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this); 8168 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this);
@@ -7730,7 +8180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7730 } 8180 }
7731 #endregion 8181 #endregion
7732 8182
7733 handlerParcelAbandonRequest = OnParcelAbandonRequest; 8183 ParcelAbandonRequest handlerParcelAbandonRequest = OnParcelAbandonRequest;
7734 if (handlerParcelAbandonRequest != null) 8184 if (handlerParcelAbandonRequest != null)
7735 { 8185 {
7736 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this); 8186 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
@@ -7748,7 +8198,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7748 } 8198 }
7749 #endregion 8199 #endregion
7750 8200
7751 handlerParcelReclaim = OnParcelReclaim; 8201 ParcelReclaim handlerParcelReclaim = OnParcelReclaim;
7752 if (handlerParcelReclaim != null) 8202 if (handlerParcelReclaim != null)
7753 { 8203 {
7754 handlerParcelReclaim(reclaimPacket.Data.LocalID, this); 8204 handlerParcelReclaim(reclaimPacket.Data.LocalID, this);
@@ -7777,7 +8227,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7777 for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++) 8227 for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++)
7778 puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID; 8228 puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID;
7779 8229
7780 handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest; 8230 ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest;
7781 if (handlerParcelReturnObjectsRequest != null) 8231 if (handlerParcelReturnObjectsRequest != null)
7782 { 8232 {
7783 handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this); 8233 handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this);
@@ -7797,7 +8247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7797 } 8247 }
7798 #endregion 8248 #endregion
7799 8249
7800 handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime; 8250 ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime;
7801 if (handlerParcelSetOtherCleanTime != null) 8251 if (handlerParcelSetOtherCleanTime != null)
7802 { 8252 {
7803 handlerParcelSetOtherCleanTime(this, 8253 handlerParcelSetOtherCleanTime(this,
@@ -7818,7 +8268,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7818 } 8268 }
7819 #endregion 8269 #endregion
7820 8270
7821 handlerLandStatRequest = OnLandStatRequest; 8271 GodLandStatRequest handlerLandStatRequest = OnLandStatRequest;
7822 if (handlerLandStatRequest != null) 8272 if (handlerLandStatRequest != null)
7823 { 8273 {
7824 handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this); 8274 handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this);
@@ -7838,7 +8288,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7838 } 8288 }
7839 #endregion 8289 #endregion
7840 8290
7841 handlerParcelDwellRequest = OnParcelDwellRequest; 8291 ParcelDwellRequest handlerParcelDwellRequest = OnParcelDwellRequest;
7842 if (handlerParcelDwellRequest != null) 8292 if (handlerParcelDwellRequest != null)
7843 { 8293 {
7844 handlerParcelDwellRequest(dwellrq.Data.LocalID, this); 8294 handlerParcelDwellRequest(dwellrq.Data.LocalID, this);
@@ -8082,7 +8532,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8082 { 8532 {
8083 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake") 8533 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake")
8084 { 8534 {
8085 handlerBakeTerrain = OnBakeTerrain; 8535 BakeTerrain handlerBakeTerrain = OnBakeTerrain;
8086 if (handlerBakeTerrain != null) 8536 if (handlerBakeTerrain != null)
8087 { 8537 {
8088 handlerBakeTerrain(this); 8538 handlerBakeTerrain(this);
@@ -8092,7 +8542,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8092 { 8542 {
8093 if (messagePacket.ParamList.Length > 1) 8543 if (messagePacket.ParamList.Length > 1)
8094 { 8544 {
8095 handlerRequestTerrain = OnRequestTerrain; 8545 RequestTerrain handlerRequestTerrain = OnRequestTerrain;
8096 if (handlerRequestTerrain != null) 8546 if (handlerRequestTerrain != null)
8097 { 8547 {
8098 handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter)); 8548 handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
@@ -8103,7 +8553,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8103 { 8553 {
8104 if (messagePacket.ParamList.Length > 1) 8554 if (messagePacket.ParamList.Length > 1)
8105 { 8555 {
8106 handlerUploadTerrain = OnUploadTerrain; 8556 RequestTerrain handlerUploadTerrain = OnUploadTerrain;
8107 if (handlerUploadTerrain != null) 8557 if (handlerUploadTerrain != null)
8108 { 8558 {
8109 handlerUploadTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter)); 8559 handlerUploadTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
@@ -8125,7 +8575,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8125 UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); 8575 UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
8126 UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); 8576 UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
8127 8577
8128 handlerEstateChangeInfo = OnEstateChangeInfo; 8578 EstateChangeInfo handlerEstateChangeInfo = OnEstateChangeInfo;
8129 if (handlerEstateChangeInfo != null) 8579 if (handlerEstateChangeInfo != null)
8130 { 8580 {
8131 handlerEstateChangeInfo(this, invoice, SenderID, param1, param2); 8581 handlerEstateChangeInfo(this, invoice, SenderID, param1, param2);
@@ -8159,7 +8609,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8159 } 8609 }
8160 #endregion 8610 #endregion
8161 8611
8162 handlerRegionInfoRequest = OnRegionInfoRequest; 8612 RegionInfoRequest handlerRegionInfoRequest = OnRegionInfoRequest;
8163 if (handlerRegionInfoRequest != null) 8613 if (handlerRegionInfoRequest != null)
8164 { 8614 {
8165 handlerRegionInfoRequest(this); 8615 handlerRegionInfoRequest(this);
@@ -8170,7 +8620,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8170 //EstateCovenantRequestPacket.AgentDataBlock epack = 8620 //EstateCovenantRequestPacket.AgentDataBlock epack =
8171 // ((EstateCovenantRequestPacket)Pack).AgentData; 8621 // ((EstateCovenantRequestPacket)Pack).AgentData;
8172 8622
8173 handlerEstateCovenantRequest = OnEstateCovenantRequest; 8623 EstateCovenantRequest handlerEstateCovenantRequest = OnEstateCovenantRequest;
8174 if (handlerEstateCovenantRequest != null) 8624 if (handlerEstateCovenantRequest != null)
8175 { 8625 {
8176 handlerEstateCovenantRequest(this); 8626 handlerEstateCovenantRequest(this);
@@ -8188,7 +8638,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8188 8638
8189 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; 8639 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData;
8190 8640
8191 handlerReqGodlikePowers = OnRequestGodlikePowers; 8641 RequestGodlikePowers handlerReqGodlikePowers = OnRequestGodlikePowers;
8192 8642
8193 if (handlerReqGodlikePowers != null) 8643 if (handlerReqGodlikePowers != null)
8194 { 8644 {
@@ -8201,7 +8651,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8201 8651
8202 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID) 8652 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
8203 { 8653 {
8204 handlerGodKickUser = OnGodKickUser; 8654 GodKickUser handlerGodKickUser = OnGodKickUser;
8205 if (handlerGodKickUser != null) 8655 if (handlerGodKickUser != null)
8206 { 8656 {
8207 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, 8657 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
@@ -8241,7 +8691,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8241 } 8691 }
8242 #endregion 8692 #endregion
8243 8693
8244 handlerMoneyBalanceRequest = OnMoneyBalanceRequest; 8694 MoneyBalanceRequest handlerMoneyBalanceRequest = OnMoneyBalanceRequest;
8245 8695
8246 if (handlerMoneyBalanceRequest != null) 8696 if (handlerMoneyBalanceRequest != null)
8247 { 8697 {
@@ -8252,7 +8702,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8252 case PacketType.EconomyDataRequest: 8702 case PacketType.EconomyDataRequest:
8253 8703
8254 8704
8255 handlerEconomoyDataRequest = OnEconomyDataRequest; 8705 EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest;
8256 if (handlerEconomoyDataRequest != null) 8706 if (handlerEconomoyDataRequest != null)
8257 { 8707 {
8258 handlerEconomoyDataRequest(AgentId); 8708 handlerEconomoyDataRequest(AgentId);
@@ -8261,7 +8711,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8261 case PacketType.RequestPayPrice: 8711 case PacketType.RequestPayPrice:
8262 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; 8712 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack;
8263 8713
8264 handlerRequestPayPrice = OnRequestPayPrice; 8714 RequestPayPrice handlerRequestPayPrice = OnRequestPayPrice;
8265 if (handlerRequestPayPrice != null) 8715 if (handlerRequestPayPrice != null)
8266 { 8716 {
8267 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); 8717 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID);
@@ -8280,7 +8730,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8280 } 8730 }
8281 #endregion 8731 #endregion
8282 8732
8283 handlerObjectSaleInfo = OnObjectSaleInfo; 8733 ObjectSaleInfo handlerObjectSaleInfo = OnObjectSaleInfo;
8284 if (handlerObjectSaleInfo != null) 8734 if (handlerObjectSaleInfo != null)
8285 { 8735 {
8286 foreach (ObjectSaleInfoPacket.ObjectDataBlock d 8736 foreach (ObjectSaleInfoPacket.ObjectDataBlock d
@@ -8308,7 +8758,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8308 } 8758 }
8309 #endregion 8759 #endregion
8310 8760
8311 handlerObjectBuy = OnObjectBuy; 8761 ObjectBuy handlerObjectBuy = OnObjectBuy;
8312 8762
8313 if (handlerObjectBuy != null) 8763 if (handlerObjectBuy != null)
8314 { 8764 {
@@ -8334,7 +8784,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8334 case PacketType.GetScriptRunning: 8784 case PacketType.GetScriptRunning:
8335 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack; 8785 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack;
8336 8786
8337 handlerGetScriptRunning = OnGetScriptRunning; 8787 GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning;
8338 if (handlerGetScriptRunning != null) 8788 if (handlerGetScriptRunning != null)
8339 { 8789 {
8340 handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID); 8790 handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID);
@@ -8353,7 +8803,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8353 } 8803 }
8354 #endregion 8804 #endregion
8355 8805
8356 handlerSetScriptRunning = OnSetScriptRunning; 8806 SetScriptRunning handlerSetScriptRunning = OnSetScriptRunning;
8357 if (handlerSetScriptRunning != null) 8807 if (handlerSetScriptRunning != null)
8358 { 8808 {
8359 handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running); 8809 handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running);
@@ -8372,7 +8822,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8372 } 8822 }
8373 #endregion 8823 #endregion
8374 8824
8375 handlerScriptReset = OnScriptReset; 8825 ScriptReset handlerScriptReset = OnScriptReset;
8376 if (handlerScriptReset != null) 8826 if (handlerScriptReset != null)
8377 { 8827 {
8378 handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID); 8828 handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID);
@@ -8395,7 +8845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8395 } 8845 }
8396 #endregion 8846 #endregion
8397 8847
8398 handlerActivateGesture = OnActivateGesture; 8848 ActivateGesture handlerActivateGesture = OnActivateGesture;
8399 if (handlerActivateGesture != null) 8849 if (handlerActivateGesture != null)
8400 { 8850 {
8401 handlerActivateGesture(this, 8851 handlerActivateGesture(this,
@@ -8418,7 +8868,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8418 } 8868 }
8419 #endregion 8869 #endregion
8420 8870
8421 handlerDeactivateGesture = OnDeactivateGesture; 8871 DeactivateGesture handlerDeactivateGesture = OnDeactivateGesture;
8422 if (handlerDeactivateGesture != null) 8872 if (handlerDeactivateGesture != null)
8423 { 8873 {
8424 handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID); 8874 handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID);
@@ -8441,7 +8891,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8441 foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData) 8891 foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData)
8442 localIDs.Add(d.ObjectLocalID); 8892 localIDs.Add(d.ObjectLocalID);
8443 8893
8444 handlerObjectOwner = OnObjectOwner; 8894 ObjectOwner handlerObjectOwner = OnObjectOwner;
8445 if (handlerObjectOwner != null) 8895 if (handlerObjectOwner != null)
8446 { 8896 {
8447 handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs); 8897 handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs);
@@ -8482,7 +8932,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8482 #endregion 8932 #endregion
8483 8933
8484 //m_log.Debug(mirpk.ToString()); 8934 //m_log.Debug(mirpk.ToString());
8485 handlerMapItemRequest = OnMapItemRequest; 8935 MapItemRequest handlerMapItemRequest = OnMapItemRequest;
8486 if (handlerMapItemRequest != null) 8936 if (handlerMapItemRequest != null)
8487 { 8937 {
8488 handlerMapItemRequest(this,mirpk.AgentData.Flags, mirpk.AgentData.EstateID, 8938 handlerMapItemRequest(this,mirpk.AgentData.Flags, mirpk.AgentData.EstateID,
@@ -8509,7 +8959,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8509 } 8959 }
8510 #endregion 8960 #endregion
8511 8961
8512 handlerMuteListRequest = OnMuteListRequest; 8962 MuteListRequest handlerMuteListRequest = OnMuteListRequest;
8513 if (handlerMuteListRequest != null) 8963 if (handlerMuteListRequest != null)
8514 { 8964 {
8515 handlerMuteListRequest(this, muteListRequest.MuteData.MuteCRC); 8965 handlerMuteListRequest(this, muteListRequest.MuteData.MuteCRC);
@@ -8546,7 +8996,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8546 } 8996 }
8547 #endregion 8997 #endregion
8548 8998
8549 handlerDirPlacesQuery = OnDirPlacesQuery; 8999 DirPlacesQuery handlerDirPlacesQuery = OnDirPlacesQuery;
8550 if (handlerDirPlacesQuery != null) 9000 if (handlerDirPlacesQuery != null)
8551 { 9001 {
8552 handlerDirPlacesQuery(this, 9002 handlerDirPlacesQuery(this,
@@ -8572,7 +9022,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8572 } 9022 }
8573 #endregion 9023 #endregion
8574 9024
8575 handlerDirFindQuery = OnDirFindQuery; 9025 DirFindQuery handlerDirFindQuery = OnDirFindQuery;
8576 if (handlerDirFindQuery != null) 9026 if (handlerDirFindQuery != null)
8577 { 9027 {
8578 handlerDirFindQuery(this, 9028 handlerDirFindQuery(this,
@@ -8595,7 +9045,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8595 } 9045 }
8596 #endregion 9046 #endregion
8597 9047
8598 handlerDirLandQuery = OnDirLandQuery; 9048 DirLandQuery handlerDirLandQuery = OnDirLandQuery;
8599 if (handlerDirLandQuery != null) 9049 if (handlerDirLandQuery != null)
8600 { 9050 {
8601 handlerDirLandQuery(this, 9051 handlerDirLandQuery(this,
@@ -8619,7 +9069,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8619 } 9069 }
8620 #endregion 9070 #endregion
8621 9071
8622 handlerDirPopularQuery = OnDirPopularQuery; 9072 DirPopularQuery handlerDirPopularQuery = OnDirPopularQuery;
8623 if (handlerDirPopularQuery != null) 9073 if (handlerDirPopularQuery != null)
8624 { 9074 {
8625 handlerDirPopularQuery(this, 9075 handlerDirPopularQuery(this,
@@ -8639,7 +9089,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8639 } 9089 }
8640 #endregion 9090 #endregion
8641 9091
8642 handlerDirClassifiedQuery = OnDirClassifiedQuery; 9092 DirClassifiedQuery handlerDirClassifiedQuery = OnDirClassifiedQuery;
8643 if (handlerDirClassifiedQuery != null) 9093 if (handlerDirClassifiedQuery != null)
8644 { 9094 {
8645 handlerDirClassifiedQuery(this, 9095 handlerDirClassifiedQuery(this,
@@ -9155,7 +9605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9155 ParcelDeedToGroupPacket parcelDeedToGroup = (ParcelDeedToGroupPacket)Pack; 9605 ParcelDeedToGroupPacket parcelDeedToGroup = (ParcelDeedToGroupPacket)Pack;
9156 if (m_GroupsModule != null) 9606 if (m_GroupsModule != null)
9157 { 9607 {
9158 handlerParcelDeedToGroup = OnParcelDeedToGroup; 9608 ParcelDeedToGroup handlerParcelDeedToGroup = OnParcelDeedToGroup;
9159 if (handlerParcelDeedToGroup != null) 9609 if (handlerParcelDeedToGroup != null)
9160 { 9610 {
9161 handlerParcelDeedToGroup(parcelDeedToGroup.Data.LocalID, parcelDeedToGroup.Data.GroupID,this); 9611 handlerParcelDeedToGroup(parcelDeedToGroup.Data.LocalID, parcelDeedToGroup.Data.GroupID,this);
@@ -9399,7 +9849,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9399 } 9849 }
9400 #endregion 9850 #endregion
9401 9851
9402 handlerStartLure = OnStartLure; 9852 StartLure handlerStartLure = OnStartLure;
9403 if (handlerStartLure != null) 9853 if (handlerStartLure != null)
9404 handlerStartLure(startLureRequest.Info.LureType, 9854 handlerStartLure(startLureRequest.Info.LureType,
9405 Utils.BytesToString( 9855 Utils.BytesToString(
@@ -9421,7 +9871,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9421 } 9871 }
9422 #endregion 9872 #endregion
9423 9873
9424 handlerTeleportLureRequest = OnTeleportLureRequest; 9874 TeleportLureRequest handlerTeleportLureRequest = OnTeleportLureRequest;
9425 if (handlerTeleportLureRequest != null) 9875 if (handlerTeleportLureRequest != null)
9426 handlerTeleportLureRequest( 9876 handlerTeleportLureRequest(
9427 teleportLureRequest.Info.LureID, 9877 teleportLureRequest.Info.LureID,
@@ -9442,7 +9892,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9442 } 9892 }
9443 #endregion 9893 #endregion
9444 9894
9445 handlerClassifiedInfoRequest = OnClassifiedInfoRequest; 9895 ClassifiedInfoRequest handlerClassifiedInfoRequest = OnClassifiedInfoRequest;
9446 if (handlerClassifiedInfoRequest != null) 9896 if (handlerClassifiedInfoRequest != null)
9447 handlerClassifiedInfoRequest( 9897 handlerClassifiedInfoRequest(
9448 classifiedInfoRequest.Data.ClassifiedID, 9898 classifiedInfoRequest.Data.ClassifiedID,
@@ -9462,7 +9912,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9462 } 9912 }
9463 #endregion 9913 #endregion
9464 9914
9465 handlerClassifiedInfoUpdate = OnClassifiedInfoUpdate; 9915 ClassifiedInfoUpdate handlerClassifiedInfoUpdate = OnClassifiedInfoUpdate;
9466 if (handlerClassifiedInfoUpdate != null) 9916 if (handlerClassifiedInfoUpdate != null)
9467 handlerClassifiedInfoUpdate( 9917 handlerClassifiedInfoUpdate(
9468 classifiedInfoUpdate.Data.ClassifiedID, 9918 classifiedInfoUpdate.Data.ClassifiedID,
@@ -9494,7 +9944,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9494 } 9944 }
9495 #endregion 9945 #endregion
9496 9946
9497 handlerClassifiedDelete = OnClassifiedDelete; 9947 ClassifiedDelete handlerClassifiedDelete = OnClassifiedDelete;
9498 if (handlerClassifiedDelete != null) 9948 if (handlerClassifiedDelete != null)
9499 handlerClassifiedDelete( 9949 handlerClassifiedDelete(
9500 classifiedDelete.Data.ClassifiedID, 9950 classifiedDelete.Data.ClassifiedID,
@@ -9514,7 +9964,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9514 } 9964 }
9515 #endregion 9965 #endregion
9516 9966
9517 handlerClassifiedGodDelete = OnClassifiedGodDelete; 9967 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
9518 if (handlerClassifiedGodDelete != null) 9968 if (handlerClassifiedGodDelete != null)
9519 handlerClassifiedGodDelete( 9969 handlerClassifiedGodDelete(
9520 classifiedGodDelete.Data.ClassifiedID, 9970 classifiedGodDelete.Data.ClassifiedID,
@@ -9534,7 +9984,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9534 } 9984 }
9535 #endregion 9985 #endregion
9536 9986
9537 handlerEventGodDelete = OnEventGodDelete; 9987 EventGodDelete handlerEventGodDelete = OnEventGodDelete;
9538 if (handlerEventGodDelete != null) 9988 if (handlerEventGodDelete != null)
9539 handlerEventGodDelete( 9989 handlerEventGodDelete(
9540 eventGodDelete.EventData.EventID, 9990 eventGodDelete.EventData.EventID,
@@ -9559,7 +10009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9559 } 10009 }
9560 #endregion 10010 #endregion
9561 10011
9562 handlerEventNotificationAddRequest = OnEventNotificationAddRequest; 10012 EventNotificationAddRequest handlerEventNotificationAddRequest = OnEventNotificationAddRequest;
9563 if (handlerEventNotificationAddRequest != null) 10013 if (handlerEventNotificationAddRequest != null)
9564 handlerEventNotificationAddRequest( 10014 handlerEventNotificationAddRequest(
9565 eventNotificationAdd.EventData.EventID, this); 10015 eventNotificationAdd.EventData.EventID, this);
@@ -9578,7 +10028,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9578 } 10028 }
9579 #endregion 10029 #endregion
9580 10030
9581 handlerEventNotificationRemoveRequest = OnEventNotificationRemoveRequest; 10031 EventNotificationRemoveRequest handlerEventNotificationRemoveRequest = OnEventNotificationRemoveRequest;
9582 if (handlerEventNotificationRemoveRequest != null) 10032 if (handlerEventNotificationRemoveRequest != null)
9583 handlerEventNotificationRemoveRequest( 10033 handlerEventNotificationRemoveRequest(
9584 eventNotificationRemove.EventData.EventID, this); 10034 eventNotificationRemove.EventData.EventID, this);
@@ -9596,7 +10046,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9596 } 10046 }
9597 #endregion 10047 #endregion
9598 10048
9599 handlerRetrieveInstantMessages = OnRetrieveInstantMessages; 10049 RetrieveInstantMessages handlerRetrieveInstantMessages = OnRetrieveInstantMessages;
9600 if (handlerRetrieveInstantMessages != null) 10050 if (handlerRetrieveInstantMessages != null)
9601 handlerRetrieveInstantMessages(this); 10051 handlerRetrieveInstantMessages(this);
9602 break; 10052 break;
@@ -9614,7 +10064,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9614 } 10064 }
9615 #endregion 10065 #endregion
9616 10066
9617 handlerPickDelete = OnPickDelete; 10067 PickDelete handlerPickDelete = OnPickDelete;
9618 if (handlerPickDelete != null) 10068 if (handlerPickDelete != null)
9619 handlerPickDelete(this, pickDelete.Data.PickID); 10069 handlerPickDelete(this, pickDelete.Data.PickID);
9620 break; 10070 break;
@@ -9631,7 +10081,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9631 } 10081 }
9632 #endregion 10082 #endregion
9633 10083
9634 handlerPickGodDelete = OnPickGodDelete; 10084 PickGodDelete handlerPickGodDelete = OnPickGodDelete;
9635 if (handlerPickGodDelete != null) 10085 if (handlerPickGodDelete != null)
9636 handlerPickGodDelete(this, 10086 handlerPickGodDelete(this,
9637 pickGodDelete.AgentData.AgentID, 10087 pickGodDelete.AgentData.AgentID,
@@ -9651,7 +10101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9651 } 10101 }
9652 #endregion 10102 #endregion
9653 10103
9654 handlerPickInfoUpdate = OnPickInfoUpdate; 10104 PickInfoUpdate handlerPickInfoUpdate = OnPickInfoUpdate;
9655 if (handlerPickInfoUpdate != null) 10105 if (handlerPickInfoUpdate != null)
9656 handlerPickInfoUpdate(this, 10106 handlerPickInfoUpdate(this,
9657 pickInfoUpdate.Data.PickID, 10107 pickInfoUpdate.Data.PickID,
@@ -9676,7 +10126,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9676 } 10126 }
9677 #endregion 10127 #endregion
9678 10128
9679 handlerAvatarNotesUpdate = OnAvatarNotesUpdate; 10129 AvatarNotesUpdate handlerAvatarNotesUpdate = OnAvatarNotesUpdate;
9680 if (handlerAvatarNotesUpdate != null) 10130 if (handlerAvatarNotesUpdate != null)
9681 handlerAvatarNotesUpdate(this, 10131 handlerAvatarNotesUpdate(this,
9682 avatarNotesUpdate.Data.TargetID, 10132 avatarNotesUpdate.Data.TargetID,
@@ -9693,7 +10143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9693 PlacesQueryPacket placesQueryPacket = 10143 PlacesQueryPacket placesQueryPacket =
9694 (PlacesQueryPacket)Pack; 10144 (PlacesQueryPacket)Pack;
9695 10145
9696 handlerPlacesQuery = OnPlacesQuery; 10146 PlacesQuery handlerPlacesQuery = OnPlacesQuery;
9697 10147
9698 if (handlerPlacesQuery != null) 10148 if (handlerPlacesQuery != null)
9699 handlerPlacesQuery(placesQueryPacket.AgentData.QueryID, 10149 handlerPlacesQuery(placesQueryPacket.AgentData.QueryID,
@@ -9747,291 +10197,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9747 //shape.Textures = ntex; 10197 //shape.Textures = ntex;
9748 return shape; 10198 return shape;
9749 } 10199 }
9750 10200
9751 /// <summary>
9752 /// Send the client an Estate message blue box pop-down with a single OK button
9753 /// </summary>
9754 /// <param name="FromAvatarID"></param>
9755 /// <param name="fromSessionID"></param>
9756 /// <param name="FromAvatarName"></param>
9757 /// <param name="Message"></param>
9758 public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
9759 {
9760 if (!ChildAgentStatus())
9761 SendInstantMessage(new GridInstantMessage(null, FromAvatarID, FromAvatarName, AgentId, 1, Message, false, new Vector3()));
9762
9763 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
9764 }
9765
9766 public void SendLogoutPacket()
9767 {
9768 // I know this is a bit of a hack, however there are times when you don't
9769 // want to send this, but still need to do the rest of the shutdown process
9770 // this method gets called from the packet server.. which makes it practically
9771 // impossible to do any other way.
9772
9773 if (m_SendLogoutPacketWhenClosing)
9774 {
9775 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
9776 // TODO: don't create new blocks if recycling an old packet
9777 logReply.AgentData.AgentID = AgentId;
9778 logReply.AgentData.SessionID = SessionId;
9779 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
9780 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
9781 logReply.InventoryData[0].ItemID = UUID.Zero;
9782
9783 OutPacket(logReply, ThrottleOutPacketType.Task);
9784 }
9785 }
9786
9787 public void SendHealth(float health)
9788 {
9789 HealthMessagePacket healthpacket = (HealthMessagePacket)PacketPool.Instance.GetPacket(PacketType.HealthMessage);
9790 healthpacket.HealthData.Health = health;
9791 OutPacket(healthpacket, ThrottleOutPacketType.Task);
9792 }
9793
9794 public void SendAgentOnline(UUID[] agentIDs)
9795 {
9796 OnlineNotificationPacket onp = new OnlineNotificationPacket();
9797 OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length];
9798 for (int i = 0; i < agentIDs.Length; i++)
9799 {
9800 OnlineNotificationPacket.AgentBlockBlock onpbl = new OnlineNotificationPacket.AgentBlockBlock();
9801 onpbl.AgentID = agentIDs[i];
9802 onpb[i] = onpbl;
9803 }
9804 onp.AgentBlock = onpb;
9805 onp.Header.Reliable = true;
9806 OutPacket(onp, ThrottleOutPacketType.Task);
9807 }
9808
9809 public void SendAgentOffline(UUID[] agentIDs)
9810 {
9811 OfflineNotificationPacket offp = new OfflineNotificationPacket();
9812 OfflineNotificationPacket.AgentBlockBlock[] offpb = new OfflineNotificationPacket.AgentBlockBlock[agentIDs.Length];
9813 for (int i = 0; i < agentIDs.Length; i++)
9814 {
9815 OfflineNotificationPacket.AgentBlockBlock onpbl = new OfflineNotificationPacket.AgentBlockBlock();
9816 onpbl.AgentID = agentIDs[i];
9817 offpb[i] = onpbl;
9818 }
9819 offp.AgentBlock = offpb;
9820 offp.Header.Reliable = true;
9821 OutPacket(offp, ThrottleOutPacketType.Task);
9822 }
9823
9824 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
9825 Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
9826 {
9827 AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
9828 avatarSitResponse.SitObject.ID = TargetID;
9829 if (CameraAtOffset != Vector3.Zero)
9830 {
9831 avatarSitResponse.SitTransform.CameraAtOffset = CameraAtOffset;
9832 avatarSitResponse.SitTransform.CameraEyeOffset = CameraEyeOffset;
9833 }
9834 avatarSitResponse.SitTransform.ForceMouselook = ForceMouseLook;
9835 avatarSitResponse.SitTransform.AutoPilot = autopilot;
9836 avatarSitResponse.SitTransform.SitPosition = OffsetPos;
9837 avatarSitResponse.SitTransform.SitRotation = SitOrientation;
9838
9839 OutPacket(avatarSitResponse, ThrottleOutPacketType.Task);
9840 }
9841
9842 public void SendAdminResponse(UUID Token, uint AdminLevel)
9843 {
9844 GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket();
9845 GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock();
9846 GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock();
9847
9848 adb.AgentID = AgentId;
9849 adb.SessionID = SessionId; // More security
9850 gdb.GodLevel = (byte)AdminLevel;
9851 gdb.Token = Token;
9852 //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock;
9853 respondPacket.GrantData = gdb;
9854 respondPacket.AgentData = adb;
9855 OutPacket(respondPacket, ThrottleOutPacketType.Task);
9856 }
9857
9858 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
9859 {
9860 m_groupPowers.Clear();
9861
9862 AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket();
9863 AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length];
9864 for (int i = 0; i < GroupMembership.Length; i++)
9865 {
9866 m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers;
9867
9868 AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock();
9869 Group.AcceptNotices = GroupMembership[i].AcceptNotices;
9870 Group.Contribution = GroupMembership[i].Contribution;
9871 Group.GroupID = GroupMembership[i].GroupID;
9872 Group.GroupInsigniaID = GroupMembership[i].GroupPicture;
9873 Group.GroupName = Utils.StringToBytes(GroupMembership[i].GroupName);
9874 Group.GroupPowers = GroupMembership[i].GroupPowers;
9875 Groups[i] = Group;
9876
9877
9878 }
9879 Groupupdate.GroupData = Groups;
9880 Groupupdate.AgentData = new AgentGroupDataUpdatePacket.AgentDataBlock();
9881 Groupupdate.AgentData.AgentID = AgentId;
9882 OutPacket(Groupupdate, ThrottleOutPacketType.Task);
9883
9884 try
9885 {
9886 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
9887 if (eq != null)
9888 {
9889 eq.GroupMembership(Groupupdate, this.AgentId);
9890 }
9891 }
9892 catch (Exception ex)
9893 {
9894 m_log.Error("Unable to send group membership data via eventqueue - exception: " + ex.ToString());
9895 m_log.Warn("sending group membership data via UDP");
9896 OutPacket(Groupupdate, ThrottleOutPacketType.Task);
9897 }
9898 }
9899
9900
9901 public void SendGroupNameReply(UUID groupLLUID, string GroupName)
9902 {
9903 UUIDGroupNameReplyPacket pack = new UUIDGroupNameReplyPacket();
9904 UUIDGroupNameReplyPacket.UUIDNameBlockBlock[] uidnameblock = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock[1];
9905 UUIDGroupNameReplyPacket.UUIDNameBlockBlock uidnamebloc = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock();
9906 uidnamebloc.ID = groupLLUID;
9907 uidnamebloc.GroupName = Utils.StringToBytes(GroupName);
9908 uidnameblock[0] = uidnamebloc;
9909 pack.UUIDNameBlock = uidnameblock;
9910 OutPacket(pack, ThrottleOutPacketType.Task);
9911 }
9912
9913 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
9914 {
9915 LandStatReplyPacket lsrp = new LandStatReplyPacket();
9916 // LandStatReplyPacket.RequestDataBlock lsreqdpb = new LandStatReplyPacket.RequestDataBlock();
9917 LandStatReplyPacket.ReportDataBlock[] lsrepdba = new LandStatReplyPacket.ReportDataBlock[lsrpia.Length];
9918 //LandStatReplyPacket.ReportDataBlock lsrepdb = new LandStatReplyPacket.ReportDataBlock();
9919 // lsrepdb.
9920 lsrp.RequestData.ReportType = reportType;
9921 lsrp.RequestData.RequestFlags = requestFlags;
9922 lsrp.RequestData.TotalObjectCount = resultCount;
9923 for (int i = 0; i < lsrpia.Length; i++)
9924 {
9925 LandStatReplyPacket.ReportDataBlock lsrepdb = new LandStatReplyPacket.ReportDataBlock();
9926 lsrepdb.LocationX = lsrpia[i].LocationX;
9927 lsrepdb.LocationY = lsrpia[i].LocationY;
9928 lsrepdb.LocationZ = lsrpia[i].LocationZ;
9929 lsrepdb.Score = lsrpia[i].Score;
9930 lsrepdb.TaskID = lsrpia[i].TaskID;
9931 lsrepdb.TaskLocalID = lsrpia[i].TaskLocalID;
9932 lsrepdb.TaskName = Utils.StringToBytes(lsrpia[i].TaskName);
9933 lsrepdb.OwnerName = Utils.StringToBytes(lsrpia[i].OwnerName);
9934 lsrepdba[i] = lsrepdb;
9935 }
9936 lsrp.ReportData = lsrepdba;
9937 OutPacket(lsrp, ThrottleOutPacketType.Task);
9938 }
9939
9940 public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
9941 {
9942 ScriptRunningReplyPacket scriptRunningReply = new ScriptRunningReplyPacket();
9943 scriptRunningReply.Script.ObjectID = objectID;
9944 scriptRunningReply.Script.ItemID = itemID;
9945 scriptRunningReply.Script.Running = running;
9946
9947 OutPacket(scriptRunningReply, ThrottleOutPacketType.Task);
9948 }
9949
9950 public void SendAsset(AssetRequestToClient req)
9951 {
9952 //m_log.Debug("sending asset " + req.RequestAssetID);
9953 TransferInfoPacket Transfer = new TransferInfoPacket();
9954 Transfer.TransferInfo.ChannelType = 2;
9955 Transfer.TransferInfo.Status = 0;
9956 Transfer.TransferInfo.TargetType = 0;
9957 if (req.AssetRequestSource == 2)
9958 {
9959 Transfer.TransferInfo.Params = new byte[20];
9960 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
9961 int assType = req.AssetInf.Type;
9962 Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
9963 }
9964 else if (req.AssetRequestSource == 3)
9965 {
9966 Transfer.TransferInfo.Params = req.Params;
9967 // Transfer.TransferInfo.Params = new byte[100];
9968 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
9969 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
9970 }
9971 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
9972 Transfer.TransferInfo.TransferID = req.TransferRequestID;
9973 Transfer.Header.Zerocoded = true;
9974 OutPacket(Transfer, ThrottleOutPacketType.Asset);
9975
9976 if (req.NumPackets == 1)
9977 {
9978 TransferPacketPacket TransferPacket = new TransferPacketPacket();
9979 TransferPacket.TransferData.Packet = 0;
9980 TransferPacket.TransferData.ChannelType = 2;
9981 TransferPacket.TransferData.TransferID = req.TransferRequestID;
9982 TransferPacket.TransferData.Data = req.AssetInf.Data;
9983 TransferPacket.TransferData.Status = 1;
9984 TransferPacket.Header.Zerocoded = true;
9985 OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
9986 }
9987 else
9988 {
9989 int processedLength = 0;
9990 int maxChunkSize = Settings.MAX_PACKET_SIZE - 100;
9991 int packetNumber = 0;
9992
9993 while (processedLength < req.AssetInf.Data.Length)
9994 {
9995 TransferPacketPacket TransferPacket = new TransferPacketPacket();
9996 TransferPacket.TransferData.Packet = packetNumber;
9997 TransferPacket.TransferData.ChannelType = 2;
9998 TransferPacket.TransferData.TransferID = req.TransferRequestID;
9999
10000 int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize);
10001 byte[] chunk = new byte[chunkSize];
10002 Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length);
10003
10004 TransferPacket.TransferData.Data = chunk;
10005
10006 // 0 indicates more packets to come, 1 indicates last packet
10007 if (req.AssetInf.Data.Length - processedLength > maxChunkSize)
10008 {
10009 TransferPacket.TransferData.Status = 0;
10010 }
10011 else
10012 {
10013 TransferPacket.TransferData.Status = 1;
10014 }
10015 TransferPacket.Header.Zerocoded = true;
10016 OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
10017
10018 processedLength += chunkSize;
10019 packetNumber++;
10020 }
10021 }
10022 }
10023
10024 public void SendTexture(AssetBase TextureAsset)
10025 {
10026
10027 }
10028
10029 public ClientInfo GetClientInfo() 10201 public ClientInfo GetClientInfo()
10030 { 10202 {
10031 ClientInfo info = m_PacketHandler.GetClientInfo(); 10203 ClientInfo info = m_udpClient.GetClientInfo();
10032 10204
10033 info.userEP = m_userEndPoint; 10205 info.userEP = m_userEndPoint;
10034 info.proxyEP = m_proxyEndPoint; 10206 info.proxyEP = null;
10035 info.agentcircuit = new sAgentCircuitData(RequestClientInfo()); 10207 info.agentcircuit = new sAgentCircuitData(RequestClientInfo());
10036 10208
10037 return info; 10209 return info;
@@ -10044,7 +10216,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10044 10216
10045 public void SetClientInfo(ClientInfo info) 10217 public void SetClientInfo(ClientInfo info)
10046 { 10218 {
10047 m_PacketHandler.SetClientInfo(info); 10219 m_udpClient.SetClientInfo(info);
10048 } 10220 }
10049 10221
10050 #region Media Parcel Members 10222 #region Media Parcel Members
@@ -10079,7 +10251,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10079 10251
10080 #endregion 10252 #endregion
10081 10253
10082
10083 #region Camera 10254 #region Camera
10084 10255
10085 public void SendSetFollowCamProperties (UUID objectID, SortedDictionary<int, float> parameters) 10256 public void SendSetFollowCamProperties (UUID objectID, SortedDictionary<int, float> parameters)
@@ -10109,70 +10280,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10109 10280
10110 #endregion 10281 #endregion
10111 10282
10112 public void SendRegionHandle(UUID regionID, ulong handle) {
10113 RegionIDAndHandleReplyPacket reply = (RegionIDAndHandleReplyPacket)PacketPool.Instance.GetPacket(PacketType.RegionIDAndHandleReply);
10114 reply.ReplyBlock.RegionID = regionID;
10115 reply.ReplyBlock.RegionHandle = handle;
10116 OutPacket(reply, ThrottleOutPacketType.Land);
10117 }
10118
10119 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
10120 {
10121 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
10122 reply.AgentData.AgentID = m_agentId;
10123 reply.Data.ParcelID = parcelID;
10124 reply.Data.OwnerID = land.OwnerID;
10125 reply.Data.Name = Utils.StringToBytes(land.Name);
10126 reply.Data.Desc = Utils.StringToBytes(land.Description);
10127 reply.Data.ActualArea = land.Area;
10128 reply.Data.BillableArea = land.Area; // TODO: what is this?
10129
10130 // Bit 0: Mature, bit 7: on sale, other bits: no idea
10131 reply.Data.Flags = (byte)(
10132 ((land.Flags & (uint)ParcelFlags.MaturePublish) != 0 ? (1 << 0) : 0) +
10133 ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0));
10134
10135 Vector3 pos = land.UserLocation;
10136 if (pos.Equals(Vector3.Zero))
10137 {
10138 pos = (land.AABBMax + land.AABBMin) * 0.5f;
10139 }
10140 reply.Data.GlobalX = info.RegionLocX * Constants.RegionSize + x;
10141 reply.Data.GlobalY = info.RegionLocY * Constants.RegionSize + y;
10142 reply.Data.GlobalZ = pos.Z;
10143 reply.Data.SimName = Utils.StringToBytes(info.RegionName);
10144 reply.Data.SnapshotID = land.SnapshotID;
10145 reply.Data.Dwell = land.Dwell;
10146 reply.Data.SalePrice = land.SalePrice;
10147 reply.Data.AuctionID = (int)land.AuctionID;
10148
10149 OutPacket(reply, ThrottleOutPacketType.Land);
10150 }
10151
10152 public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
10153 {
10154 ScriptTeleportRequestPacket packet = (ScriptTeleportRequestPacket)PacketPool.Instance.GetPacket(PacketType.ScriptTeleportRequest);
10155
10156 packet.Data.ObjectName = Utils.StringToBytes(objName);
10157 packet.Data.SimName = Utils.StringToBytes(simName);
10158 packet.Data.SimPosition = pos;
10159 packet.Data.LookAt = lookAt;
10160
10161 OutPacket(packet, ThrottleOutPacketType.Task);
10162 }
10163
10164 public void SetClientOption(string option, string value) 10283 public void SetClientOption(string option, string value)
10165 { 10284 {
10166 switch (option) 10285 switch (option)
10167 { 10286 {
10168 case "ReliableIsImportant": 10287 default:
10169 bool val; 10288 break;
10170
10171 if (bool.TryParse(value, out val))
10172 m_PacketHandler.ReliableIsImportant = val;
10173 break;
10174 default:
10175 break;
10176 } 10289 }
10177 } 10290 }
10178 10291
@@ -10180,571 +10293,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10180 { 10293 {
10181 switch (option) 10294 switch (option)
10182 { 10295 {
10183 case "ReliableIsImportant":
10184 return m_PacketHandler.ReliableIsImportant.ToString();
10185
10186 default: 10296 default:
10187 break; 10297 break;
10188 } 10298 }
10189 return string.Empty; 10299 return string.Empty;
10190 } 10300 }
10191 10301
10192 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
10193 {
10194 DirPlacesReplyPacket packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply);
10195
10196 packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock();
10197
10198 packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
10199 packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
10200
10201 packet.QueryReplies =
10202 new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
10203
10204 packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[
10205 data.Length];
10206
10207 packet.AgentData.AgentID = AgentId;
10208
10209 packet.QueryData[0].QueryID = queryID;
10210
10211 int i = 0;
10212 foreach (DirPlacesReplyData d in data)
10213 {
10214 packet.QueryReplies[i] =
10215 new DirPlacesReplyPacket.QueryRepliesBlock();
10216 packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock();
10217 packet.QueryReplies[i].ParcelID = d.parcelID;
10218 packet.QueryReplies[i].Name = Utils.StringToBytes(d.name);
10219 packet.QueryReplies[i].ForSale = d.forSale;
10220 packet.QueryReplies[i].Auction = d.auction;
10221 packet.QueryReplies[i].Dwell = d.dwell;
10222 packet.StatusData[i].Status = d.Status;
10223 i++;
10224 }
10225
10226 OutPacket(packet, ThrottleOutPacketType.Task);
10227 }
10228
10229 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
10230 {
10231 DirPeopleReplyPacket packet = (DirPeopleReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPeopleReply);
10232
10233 packet.AgentData = new DirPeopleReplyPacket.AgentDataBlock();
10234 packet.AgentData.AgentID = AgentId;
10235
10236 packet.QueryData = new DirPeopleReplyPacket.QueryDataBlock();
10237 packet.QueryData.QueryID = queryID;
10238
10239 packet.QueryReplies = new DirPeopleReplyPacket.QueryRepliesBlock[
10240 data.Length];
10241
10242 int i = 0;
10243 foreach (DirPeopleReplyData d in data)
10244 {
10245 packet.QueryReplies[i] = new DirPeopleReplyPacket.QueryRepliesBlock();
10246 packet.QueryReplies[i].AgentID = d.agentID;
10247 packet.QueryReplies[i].FirstName =
10248 Utils.StringToBytes(d.firstName);
10249 packet.QueryReplies[i].LastName =
10250 Utils.StringToBytes(d.lastName);
10251 packet.QueryReplies[i].Group =
10252 Utils.StringToBytes(d.group);
10253 packet.QueryReplies[i].Online = d.online;
10254 packet.QueryReplies[i].Reputation = d.reputation;
10255 i++;
10256 }
10257
10258 OutPacket(packet, ThrottleOutPacketType.Task);
10259 }
10260
10261 public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
10262 {
10263 DirEventsReplyPacket packet = (DirEventsReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirEventsReply);
10264
10265 packet.AgentData = new DirEventsReplyPacket.AgentDataBlock();
10266 packet.AgentData.AgentID = AgentId;
10267
10268 packet.QueryData = new DirEventsReplyPacket.QueryDataBlock();
10269 packet.QueryData.QueryID = queryID;
10270
10271 packet.QueryReplies = new DirEventsReplyPacket.QueryRepliesBlock[
10272 data.Length];
10273
10274 packet.StatusData = new DirEventsReplyPacket.StatusDataBlock[
10275 data.Length];
10276
10277 int i = 0;
10278 foreach (DirEventsReplyData d in data)
10279 {
10280 packet.QueryReplies[i] = new DirEventsReplyPacket.QueryRepliesBlock();
10281 packet.StatusData[i] = new DirEventsReplyPacket.StatusDataBlock();
10282 packet.QueryReplies[i].OwnerID = d.ownerID;
10283 packet.QueryReplies[i].Name =
10284 Utils.StringToBytes(d.name);
10285 packet.QueryReplies[i].EventID = d.eventID;
10286 packet.QueryReplies[i].Date =
10287 Utils.StringToBytes(d.date);
10288 packet.QueryReplies[i].UnixTime = d.unixTime;
10289 packet.QueryReplies[i].EventFlags = d.eventFlags;
10290 packet.StatusData[i].Status = d.Status;
10291 i++;
10292 }
10293
10294 OutPacket(packet, ThrottleOutPacketType.Task);
10295 }
10296
10297 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
10298 {
10299 DirGroupsReplyPacket packet = (DirGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirGroupsReply);
10300
10301 packet.AgentData = new DirGroupsReplyPacket.AgentDataBlock();
10302 packet.AgentData.AgentID = AgentId;
10303
10304 packet.QueryData = new DirGroupsReplyPacket.QueryDataBlock();
10305 packet.QueryData.QueryID = queryID;
10306
10307 packet.QueryReplies = new DirGroupsReplyPacket.QueryRepliesBlock[
10308 data.Length];
10309
10310 int i = 0;
10311 foreach (DirGroupsReplyData d in data)
10312 {
10313 packet.QueryReplies[i] = new DirGroupsReplyPacket.QueryRepliesBlock();
10314 packet.QueryReplies[i].GroupID = d.groupID;
10315 packet.QueryReplies[i].GroupName =
10316 Utils.StringToBytes(d.groupName);
10317 packet.QueryReplies[i].Members = d.members;
10318 packet.QueryReplies[i].SearchOrder = d.searchOrder;
10319 i++;
10320 }
10321
10322 OutPacket(packet, ThrottleOutPacketType.Task);
10323 }
10324
10325 public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
10326 {
10327 DirClassifiedReplyPacket packet = (DirClassifiedReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirClassifiedReply);
10328
10329 packet.AgentData = new DirClassifiedReplyPacket.AgentDataBlock();
10330 packet.AgentData.AgentID = AgentId;
10331
10332 packet.QueryData = new DirClassifiedReplyPacket.QueryDataBlock();
10333 packet.QueryData.QueryID = queryID;
10334
10335 packet.QueryReplies = new DirClassifiedReplyPacket.QueryRepliesBlock[
10336 data.Length];
10337 packet.StatusData = new DirClassifiedReplyPacket.StatusDataBlock[
10338 data.Length];
10339
10340 int i = 0;
10341 foreach (DirClassifiedReplyData d in data)
10342 {
10343 packet.QueryReplies[i] = new DirClassifiedReplyPacket.QueryRepliesBlock();
10344 packet.StatusData[i] = new DirClassifiedReplyPacket.StatusDataBlock();
10345 packet.QueryReplies[i].ClassifiedID = d.classifiedID;
10346 packet.QueryReplies[i].Name =
10347 Utils.StringToBytes(d.name);
10348 packet.QueryReplies[i].ClassifiedFlags = d.classifiedFlags;
10349 packet.QueryReplies[i].CreationDate = d.creationDate;
10350 packet.QueryReplies[i].ExpirationDate = d.expirationDate;
10351 packet.QueryReplies[i].PriceForListing = d.price;
10352 packet.StatusData[i].Status = d.Status;
10353 i++;
10354 }
10355
10356 OutPacket(packet, ThrottleOutPacketType.Task);
10357 }
10358
10359 public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
10360 {
10361 DirLandReplyPacket packet = (DirLandReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirLandReply);
10362
10363 packet.AgentData = new DirLandReplyPacket.AgentDataBlock();
10364 packet.AgentData.AgentID = AgentId;
10365
10366 packet.QueryData = new DirLandReplyPacket.QueryDataBlock();
10367 packet.QueryData.QueryID = queryID;
10368
10369 packet.QueryReplies = new DirLandReplyPacket.QueryRepliesBlock[
10370 data.Length];
10371
10372 int i = 0;
10373 foreach (DirLandReplyData d in data)
10374 {
10375 packet.QueryReplies[i] = new DirLandReplyPacket.QueryRepliesBlock();
10376 packet.QueryReplies[i].ParcelID = d.parcelID;
10377 packet.QueryReplies[i].Name =
10378 Utils.StringToBytes(d.name);
10379 packet.QueryReplies[i].Auction = d.auction;
10380 packet.QueryReplies[i].ForSale = d.forSale;
10381 packet.QueryReplies[i].SalePrice = d.salePrice;
10382 packet.QueryReplies[i].ActualArea = d.actualArea;
10383 i++;
10384 }
10385
10386 OutPacket(packet, ThrottleOutPacketType.Task);
10387 }
10388
10389 public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
10390 {
10391 DirPopularReplyPacket packet = (DirPopularReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPopularReply);
10392
10393 packet.AgentData = new DirPopularReplyPacket.AgentDataBlock();
10394 packet.AgentData.AgentID = AgentId;
10395
10396 packet.QueryData = new DirPopularReplyPacket.QueryDataBlock();
10397 packet.QueryData.QueryID = queryID;
10398
10399 packet.QueryReplies = new DirPopularReplyPacket.QueryRepliesBlock[
10400 data.Length];
10401
10402 int i = 0;
10403 foreach (DirPopularReplyData d in data)
10404 {
10405 packet.QueryReplies[i] = new DirPopularReplyPacket.QueryRepliesBlock();
10406 packet.QueryReplies[i].ParcelID = d.parcelID;
10407 packet.QueryReplies[i].Name =
10408 Utils.StringToBytes(d.name);
10409 packet.QueryReplies[i].Dwell = d.dwell;
10410 i++;
10411 }
10412
10413 OutPacket(packet, ThrottleOutPacketType.Task);
10414 }
10415
10416 public void SendEventInfoReply(EventData data)
10417 {
10418 EventInfoReplyPacket packet = (EventInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.EventInfoReply);
10419
10420 packet.AgentData = new EventInfoReplyPacket.AgentDataBlock();
10421 packet.AgentData.AgentID = AgentId;
10422
10423 packet.EventData = new EventInfoReplyPacket.EventDataBlock();
10424 packet.EventData.EventID = data.eventID;
10425 packet.EventData.Creator = Utils.StringToBytes(data.creator);
10426 packet.EventData.Name = Utils.StringToBytes(data.name);
10427 packet.EventData.Category = Utils.StringToBytes(data.category);
10428 packet.EventData.Desc = Utils.StringToBytes(data.description);
10429 packet.EventData.Date = Utils.StringToBytes(data.date);
10430 packet.EventData.DateUTC = data.dateUTC;
10431 packet.EventData.Duration = data.duration;
10432 packet.EventData.Cover = data.cover;
10433 packet.EventData.Amount = data.amount;
10434 packet.EventData.SimName = Utils.StringToBytes(data.simName);
10435 packet.EventData.GlobalPos = new Vector3d(data.globalPos);
10436 packet.EventData.EventFlags = data.eventFlags;
10437
10438 OutPacket(packet, ThrottleOutPacketType.Task);
10439 }
10440
10441 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
10442 {
10443 MapItemReplyPacket mirplk = new MapItemReplyPacket();
10444 mirplk.AgentData.AgentID = AgentId;
10445 mirplk.RequestData.ItemType = mapitemtype;
10446 mirplk.Data = new MapItemReplyPacket.DataBlock[replies.Length];
10447 for (int i = 0; i < replies.Length; i++)
10448 {
10449 MapItemReplyPacket.DataBlock mrdata = new MapItemReplyPacket.DataBlock();
10450 mrdata.X = replies[i].x;
10451 mrdata.Y = replies[i].y;
10452 mrdata.ID = replies[i].id;
10453 mrdata.Extra = replies[i].Extra;
10454 mrdata.Extra2 = replies[i].Extra2;
10455 mrdata.Name = Utils.StringToBytes(replies[i].name);
10456 mirplk.Data[i] = mrdata;
10457 }
10458 //m_log.Debug(mirplk.ToString());
10459 OutPacket(mirplk, ThrottleOutPacketType.Task);
10460
10461 }
10462
10463 public void SendOfferCallingCard(UUID srcID, UUID transactionID)
10464 {
10465 // a bit special, as this uses AgentID to store the source instead
10466 // of the destination. The destination (the receiver) goes into destID
10467 OfferCallingCardPacket p = (OfferCallingCardPacket)PacketPool.Instance.GetPacket(PacketType.OfferCallingCard);
10468 p.AgentData.AgentID = srcID;
10469 p.AgentData.SessionID = UUID.Zero;
10470 p.AgentBlock.DestID = AgentId;
10471 p.AgentBlock.TransactionID = transactionID;
10472 OutPacket(p, ThrottleOutPacketType.Task);
10473 }
10474
10475 public void SendAcceptCallingCard(UUID transactionID)
10476 {
10477 AcceptCallingCardPacket p = (AcceptCallingCardPacket)PacketPool.Instance.GetPacket(PacketType.AcceptCallingCard);
10478 p.AgentData.AgentID = AgentId;
10479 p.AgentData.SessionID = UUID.Zero;
10480 p.FolderData = new AcceptCallingCardPacket.FolderDataBlock[1];
10481 p.FolderData[0] = new AcceptCallingCardPacket.FolderDataBlock();
10482 p.FolderData[0].FolderID = UUID.Zero;
10483 OutPacket(p, ThrottleOutPacketType.Task);
10484 }
10485
10486 public void SendDeclineCallingCard(UUID transactionID)
10487 {
10488 DeclineCallingCardPacket p = (DeclineCallingCardPacket)PacketPool.Instance.GetPacket(PacketType.DeclineCallingCard);
10489 p.AgentData.AgentID = AgentId;
10490 p.AgentData.SessionID = UUID.Zero;
10491 p.TransactionBlock.TransactionID = transactionID;
10492 OutPacket(p, ThrottleOutPacketType.Task);
10493 }
10494
10495 public void SendTerminateFriend(UUID exFriendID)
10496 {
10497 TerminateFriendshipPacket p = (TerminateFriendshipPacket)PacketPool.Instance.GetPacket(PacketType.TerminateFriendship);
10498 p.AgentData.AgentID = AgentId;
10499 p.AgentData.SessionID = SessionId;
10500 p.ExBlock.OtherID = exFriendID;
10501 OutPacket(p, ThrottleOutPacketType.Task);
10502 }
10503
10504 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
10505 {
10506 AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply);
10507
10508 p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock();
10509 p.AgentData.AgentID = AgentId;
10510 p.AgentData.AvatarID = avatarID;
10511
10512 p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length];
10513 int i = 0;
10514 foreach (GroupMembershipData m in data)
10515 {
10516 p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock();
10517 p.GroupData[i].GroupPowers = m.GroupPowers;
10518 p.GroupData[i].AcceptNotices = m.AcceptNotices;
10519 p.GroupData[i].GroupTitle = Utils.StringToBytes(m.GroupTitle);
10520 p.GroupData[i].GroupID = m.GroupID;
10521 p.GroupData[i].GroupName = Utils.StringToBytes(m.GroupName);
10522 p.GroupData[i].GroupInsigniaID = m.GroupPicture;
10523 i++;
10524 }
10525
10526 p.NewGroupData = new AvatarGroupsReplyPacket.NewGroupDataBlock();
10527 p.NewGroupData.ListInProfile = true;
10528
10529 OutPacket(p, ThrottleOutPacketType.Task);
10530 }
10531
10532 public void SendJoinGroupReply(UUID groupID, bool success)
10533 {
10534 JoinGroupReplyPacket p = (JoinGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.JoinGroupReply);
10535
10536 p.AgentData = new JoinGroupReplyPacket.AgentDataBlock();
10537 p.AgentData.AgentID = AgentId;
10538
10539 p.GroupData = new JoinGroupReplyPacket.GroupDataBlock();
10540 p.GroupData.GroupID = groupID;
10541 p.GroupData.Success = success;
10542
10543 OutPacket(p, ThrottleOutPacketType.Task);
10544 }
10545
10546 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
10547 {
10548 EjectGroupMemberReplyPacket p = (EjectGroupMemberReplyPacket)PacketPool.Instance.GetPacket(PacketType.EjectGroupMemberReply);
10549
10550 p.AgentData = new EjectGroupMemberReplyPacket.AgentDataBlock();
10551 p.AgentData.AgentID = agentID;
10552
10553 p.GroupData = new EjectGroupMemberReplyPacket.GroupDataBlock();
10554 p.GroupData.GroupID = groupID;
10555
10556 p.EjectData = new EjectGroupMemberReplyPacket.EjectDataBlock();
10557 p.EjectData.Success = success;
10558
10559 OutPacket(p, ThrottleOutPacketType.Task);
10560 }
10561
10562 public void SendLeaveGroupReply(UUID groupID, bool success)
10563 {
10564 LeaveGroupReplyPacket p = (LeaveGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.LeaveGroupReply);
10565
10566 p.AgentData = new LeaveGroupReplyPacket.AgentDataBlock();
10567 p.AgentData.AgentID = AgentId;
10568
10569 p.GroupData = new LeaveGroupReplyPacket.GroupDataBlock();
10570 p.GroupData.GroupID = groupID;
10571 p.GroupData.Success = success;
10572
10573 OutPacket(p, ThrottleOutPacketType.Task);
10574 }
10575
10576 public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
10577 {
10578 if (classifiedID.Length != name.Length)
10579 return;
10580
10581 AvatarClassifiedReplyPacket ac =
10582 (AvatarClassifiedReplyPacket)PacketPool.Instance.GetPacket(
10583 PacketType.AvatarClassifiedReply);
10584
10585 ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock();
10586 ac.AgentData.AgentID = AgentId;
10587 ac.AgentData.TargetID = targetID;
10588
10589 ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifiedID.Length];
10590 int i;
10591 for (i = 0 ; i < classifiedID.Length ; i++)
10592 {
10593 ac.Data[i].ClassifiedID = classifiedID[i];
10594 ac.Data[i].Name = Utils.StringToBytes(name[i]);
10595 }
10596
10597 OutPacket(ac, ThrottleOutPacketType.Task);
10598 }
10599
10600 public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
10601 {
10602 ClassifiedInfoReplyPacket cr =
10603 (ClassifiedInfoReplyPacket)PacketPool.Instance.GetPacket(
10604 PacketType.ClassifiedInfoReply);
10605
10606 cr.AgentData = new ClassifiedInfoReplyPacket.AgentDataBlock();
10607 cr.AgentData.AgentID = AgentId;
10608
10609 cr.Data = new ClassifiedInfoReplyPacket.DataBlock();
10610 cr.Data.ClassifiedID = classifiedID;
10611 cr.Data.CreatorID = creatorID;
10612 cr.Data.CreationDate = creationDate;
10613 cr.Data.ExpirationDate = expirationDate;
10614 cr.Data.Category = category;
10615 cr.Data.Name = Utils.StringToBytes(name);
10616 cr.Data.Desc = Utils.StringToBytes(description);
10617 cr.Data.ParcelID = parcelID;
10618 cr.Data.ParentEstate = parentEstate;
10619 cr.Data.SnapshotID = snapshotID;
10620 cr.Data.SimName = Utils.StringToBytes(simName);
10621 cr.Data.PosGlobal = new Vector3d(globalPos);
10622 cr.Data.ParcelName = Utils.StringToBytes(parcelName);
10623 cr.Data.ClassifiedFlags = classifiedFlags;
10624 cr.Data.PriceForListing = price;
10625
10626 OutPacket(cr, ThrottleOutPacketType.Task);
10627 }
10628
10629 public void SendAgentDropGroup(UUID groupID)
10630 {
10631 AgentDropGroupPacket dg =
10632 (AgentDropGroupPacket)PacketPool.Instance.GetPacket(
10633 PacketType.AgentDropGroup);
10634
10635 dg.AgentData = new AgentDropGroupPacket.AgentDataBlock();
10636 dg.AgentData.AgentID = AgentId;
10637 dg.AgentData.GroupID = groupID;
10638
10639 OutPacket(dg, ThrottleOutPacketType.Task);
10640 }
10641
10642 public void SendAvatarNotesReply(UUID targetID, string text)
10643 {
10644 AvatarNotesReplyPacket an =
10645 (AvatarNotesReplyPacket)PacketPool.Instance.GetPacket(
10646 PacketType.AvatarNotesReply);
10647
10648 an.AgentData = new AvatarNotesReplyPacket.AgentDataBlock();
10649 an.AgentData.AgentID = AgentId;
10650
10651 an.Data = new AvatarNotesReplyPacket.DataBlock();
10652 an.Data.TargetID = targetID;
10653 an.Data.Notes = Utils.StringToBytes(text);
10654
10655 OutPacket(an, ThrottleOutPacketType.Task);
10656 }
10657
10658 public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
10659 {
10660 AvatarPicksReplyPacket ap =
10661 (AvatarPicksReplyPacket)PacketPool.Instance.GetPacket(
10662 PacketType.AvatarPicksReply);
10663
10664 ap.AgentData = new AvatarPicksReplyPacket.AgentDataBlock();
10665 ap.AgentData.AgentID = AgentId;
10666 ap.AgentData.TargetID = targetID;
10667
10668 ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
10669
10670 int i = 0;
10671 foreach (KeyValuePair<UUID, string> pick in picks)
10672 {
10673 ap.Data[i] = new AvatarPicksReplyPacket.DataBlock();
10674 ap.Data[i].PickID = pick.Key;
10675 ap.Data[i].PickName = Utils.StringToBytes(pick.Value);
10676 i++;
10677 }
10678
10679 OutPacket(ap, ThrottleOutPacketType.Task);
10680 }
10681
10682 public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
10683 {
10684 AvatarClassifiedReplyPacket ac =
10685 (AvatarClassifiedReplyPacket)PacketPool.Instance.GetPacket(
10686 PacketType.AvatarClassifiedReply);
10687
10688 ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock();
10689 ac.AgentData.AgentID = AgentId;
10690 ac.AgentData.TargetID = targetID;
10691
10692 ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
10693
10694 int i = 0;
10695 foreach (KeyValuePair<UUID, string> classified in classifieds)
10696 {
10697 ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock();
10698 ac.Data[i].ClassifiedID = classified.Key;
10699 ac.Data[i].Name = Utils.StringToBytes(classified.Value);
10700 i++;
10701 }
10702
10703 OutPacket(ac, ThrottleOutPacketType.Task);
10704 }
10705
10706 public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
10707 {
10708 ParcelDwellReplyPacket pd =
10709 (ParcelDwellReplyPacket)PacketPool.Instance.GetPacket(
10710 PacketType.ParcelDwellReply);
10711
10712 pd.AgentData = new ParcelDwellReplyPacket.AgentDataBlock();
10713 pd.AgentData.AgentID = AgentId;
10714
10715 pd.Data = new ParcelDwellReplyPacket.DataBlock();
10716 pd.Data.LocalID = localID;
10717 pd.Data.ParcelID = parcelID;
10718 pd.Data.Dwell = dwell;
10719
10720 OutPacket(pd, ThrottleOutPacketType.Land);
10721 }
10722
10723 public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
10724 {
10725 UserInfoReplyPacket ur =
10726 (UserInfoReplyPacket)PacketPool.Instance.GetPacket(
10727 PacketType.UserInfoReply);
10728
10729 string Visible = "hidden";
10730 if (visible)
10731 Visible = "default";
10732
10733 ur.AgentData = new UserInfoReplyPacket.AgentDataBlock();
10734 ur.AgentData.AgentID = AgentId;
10735
10736 ur.UserData = new UserInfoReplyPacket.UserDataBlock();
10737 ur.UserData.IMViaEMail = imViaEmail;
10738 ur.UserData.DirectoryVisibility = Utils.StringToBytes(Visible);
10739 ur.UserData.EMail = Utils.StringToBytes(email);
10740
10741 OutPacket(ur, ThrottleOutPacketType.Task);
10742 }
10743
10744 public void KillEndDone() 10302 public void KillEndDone()
10745 { 10303 {
10746 KillPacket kp = new KillPacket(); 10304 m_udpClient.Shutdown();
10747 OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
10748 } 10305 }
10749 10306
10750 #region IClientCore 10307 #region IClientCore
@@ -10767,13 +10324,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10767 } 10324 }
10768 } 10325 }
10769 10326
10770 protected virtual void RegisterInterfaces()
10771 {
10772 RegisterInterface<IClientIM>(this);
10773 RegisterInterface<IClientChat>(this);
10774 RegisterInterface<IClientIPEndpoint>(this);
10775 }
10776
10777 public bool TryGet<T>(out T iface) 10327 public bool TryGet<T>(out T iface)
10778 { 10328 {
10779 if (m_clientInterfaces.ContainsKey(typeof(T))) 10329 if (m_clientInterfaces.ContainsKey(typeof(T)))
@@ -10821,78 +10371,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10821 } 10371 }
10822 } 10372 }
10823 10373
10824 public void SendCreateGroupReply(UUID groupID, bool success, string message)
10825 {
10826 CreateGroupReplyPacket createGroupReply = (CreateGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.CreateGroupReply);
10827
10828 createGroupReply.AgentData =
10829 new CreateGroupReplyPacket.AgentDataBlock();
10830 createGroupReply.ReplyData =
10831 new CreateGroupReplyPacket.ReplyDataBlock();
10832
10833 createGroupReply.AgentData.AgentID = AgentId;
10834 createGroupReply.ReplyData.GroupID = groupID;
10835
10836 createGroupReply.ReplyData.Success = success;
10837 createGroupReply.ReplyData.Message = Utils.StringToBytes(message);
10838 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
10839 }
10840
10841 public void SendUseCachedMuteList()
10842 {
10843 UseCachedMuteListPacket useCachedMuteList = (UseCachedMuteListPacket)PacketPool.Instance.GetPacket(PacketType.UseCachedMuteList);
10844
10845 useCachedMuteList.AgentData = new UseCachedMuteListPacket.AgentDataBlock();
10846 useCachedMuteList.AgentData.AgentID = AgentId;
10847
10848 OutPacket(useCachedMuteList, ThrottleOutPacketType.Task);
10849 }
10850
10851 public void SendMuteListUpdate(string filename)
10852 {
10853 MuteListUpdatePacket muteListUpdate = (MuteListUpdatePacket)PacketPool.Instance.GetPacket(PacketType.MuteListUpdate);
10854
10855 muteListUpdate.MuteData = new MuteListUpdatePacket.MuteDataBlock();
10856 muteListUpdate.MuteData.AgentID = AgentId;
10857 muteListUpdate.MuteData.Filename = Utils.StringToBytes(filename);
10858
10859 OutPacket(muteListUpdate, ThrottleOutPacketType.Task);
10860 }
10861
10862 public void SendPickInfoReply(UUID pickID,UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled)
10863 {
10864 PickInfoReplyPacket pickInfoReply = (PickInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.PickInfoReply);
10865
10866 pickInfoReply.AgentData = new PickInfoReplyPacket.AgentDataBlock();
10867 pickInfoReply.AgentData.AgentID = AgentId;
10868
10869 pickInfoReply.Data = new PickInfoReplyPacket.DataBlock();
10870 pickInfoReply.Data.PickID = pickID;
10871 pickInfoReply.Data.CreatorID = creatorID;
10872 pickInfoReply.Data.TopPick = topPick;
10873 pickInfoReply.Data.ParcelID = parcelID;
10874 pickInfoReply.Data.Name = Utils.StringToBytes(name);
10875 pickInfoReply.Data.Desc = Utils.StringToBytes(desc);
10876 pickInfoReply.Data.SnapshotID = snapshotID;
10877 pickInfoReply.Data.User = Utils.StringToBytes(user);
10878 pickInfoReply.Data.OriginalName = Utils.StringToBytes(originalName);
10879 pickInfoReply.Data.SimName = Utils.StringToBytes(simName);
10880 pickInfoReply.Data.PosGlobal = new Vector3d(posGlobal);
10881 pickInfoReply.Data.SortOrder = sortOrder;
10882 pickInfoReply.Data.Enabled = enabled;
10883
10884 OutPacket(pickInfoReply, ThrottleOutPacketType.Task);
10885 }
10886
10887 public string Report() 10374 public string Report()
10888 { 10375 {
10889 LLPacketHandler handler = (LLPacketHandler) m_PacketHandler; 10376 return m_udpClient.GetStats();
10890 return handler.PacketQueue.GetStats();
10891 } 10377 }
10892 10378
10893 public string XReport(string uptime, string version) 10379 public string XReport(string uptime, string version)
10894 { 10380 {
10895 return ""; 10381 return String.Empty;
10896 } 10382 }
10897 10383
10898 public void MakeAssetRequest(TransferRequestPacket transferRequest) 10384 public void MakeAssetRequest(TransferRequestPacket transferRequest)
@@ -10981,7 +10467,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10981 return numPackets; 10467 return numPackets;
10982 } 10468 }
10983 10469
10984
10985 #region IClientIPEndpoint Members 10470 #region IClientIPEndpoint Members
10986 10471
10987 public IPAddress EndPoint 10472 public IPAddress EndPoint
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index facfb9d..5219df7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -172,7 +172,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
172 m_lastloopprocessed = DateTime.Now.Ticks; 172 m_lastloopprocessed = DateTime.Now.Ticks;
173 173
174 // This can happen during Close() 174 // This can happen during Close()
175 if (m_client == null || m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null) 175 if (m_client == null)
176 return false; 176 return false;
177 177
178 while ((imagereq = GetHighestPriorityImage()) != null) 178 while ((imagereq = GetHighestPriorityImage()) != null)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index e98a360..f30df4d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -39,7 +39,12 @@ using Timer=System.Timers.Timer;
39 39
40namespace OpenSim.Region.ClientStack.LindenUDP 40namespace OpenSim.Region.ClientStack.LindenUDP
41{ 41{
42 public class LLPacketHandler : ILLPacketHandler 42 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
43 public delegate void PacketDrop(Packet pack, Object id);
44 public delegate void QueueEmpty(ThrottleOutPacketType queue);
45 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
46
47 public class LLPacketHandler
43 { 48 {
44 private static readonly ILog m_log 49 private static readonly ILog m_log
45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
index 70d94e7..f08b7be 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
42// private static readonly log4net.ILog m_log 42// private static readonly log4net.ILog m_log
43// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 protected readonly ILLClientStackNetworkHandler m_networkHandler; 45 protected readonly LLUDPServer m_networkHandler;
46 protected IScene m_scene; 46 protected IScene m_scene;
47 47
48 /// <summary> 48 /// <summary>
@@ -50,7 +50,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
50 /// </summary> 50 /// </summary>
51 private ClientStackUserSettings m_userSettings; 51 private ClientStackUserSettings m_userSettings;
52 52
53 public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings) 53 public LLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
54 { 54 {
55 m_userSettings = userSettings; 55 m_userSettings = userSettings;
56 m_networkHandler = networkHandler; 56 m_networkHandler = networkHandler;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index c779b08..7964c50 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -26,616 +26,727 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Net; 30using System.Net;
32using System.Net.Sockets; 31using System.Net.Sockets;
33using System.Reflection; 32using System.Reflection;
33using System.Threading;
34using log4net; 34using log4net;
35using Nini.Config; 35using Nini.Config;
36using OpenMetaverse.Packets; 36using OpenMetaverse.Packets;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenMetaverse;
39 40
40namespace OpenSim.Region.ClientStack.LindenUDP 41namespace OpenSim.Region.ClientStack.LindenUDP
41{ 42{
42 /// <summary> 43 public class LLUDPServerShim : IClientNetworkServer
43 /// This class handles the initial UDP circuit setup with a client and passes on subsequent packets to the LLPacketServer
44 /// </summary>
45 public class LLUDPServer : ILLClientStackNetworkHandler, IClientNetworkServer
46 { 44 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 LLUDPServer m_udpServer;
48
49 /// <value>
50 /// The client circuits established with this UDP server. If a client exists here we can also assume that
51 /// it is populated in clientCircuits_reverse and proxyCircuits (if relevant)
52 /// </value>
53 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
54 public Hashtable clientCircuits_reverse = Hashtable.Synchronized(new Hashtable());
55 protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>();
56
57 private Socket m_socket;
58 protected IPEndPoint ServerIncoming;
59 protected byte[] RecvBuffer = new byte[4096];
60 protected byte[] ZeroBuffer = new byte[8192];
61
62 /// <value>
63 /// This is an endpoint that is reused where we don't need to protect the information from potentially
64 /// being stomped on by other threads.
65 /// </value>
66 protected EndPoint reusedEpSender = new IPEndPoint(IPAddress.Any, 0);
67
68 protected int proxyPortOffset;
69
70 protected AsyncCallback ReceivedData;
71 protected LLPacketServer m_packetServer;
72 protected Location m_location;
73
74 protected uint listenPort;
75 protected bool Allow_Alternate_Port;
76 protected IPAddress listenIP = IPAddress.Parse("0.0.0.0");
77 protected IScene m_localScene;
78 protected int m_clientSocketReceiveBuffer = 0;
79 46
80 /// <value> 47 public LLUDPServerShim()
81 /// Manages authentication for agent circuits
82 /// </value>
83 protected AgentCircuitManager m_circuitManager;
84
85 public IScene LocalScene
86 { 48 {
87 set
88 {
89 m_localScene = value;
90 m_packetServer.LocalScene = m_localScene;
91
92 m_location = new Location(m_localScene.RegionInfo.RegionHandle);
93 }
94 } 49 }
95 50
96 public ulong RegionHandle 51 public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
97 { 52 {
98 get { return m_location.RegionHandle; } 53 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager);
99 } 54 }
100 55
101 Socket IClientNetworkServer.Server 56 public void NetworkStop()
102 { 57 {
103 get { return m_socket; } 58 m_udpServer.Stop();
104 } 59 }
105 60
106 public bool HandlesRegion(Location x) 61 public void AddScene(IScene scene)
107 { 62 {
108 //return x.RegionHandle == m_location.RegionHandle; 63 m_udpServer.AddScene(scene);
109 return x == m_location;
110 } 64 }
111 65
112 public void AddScene(IScene x) 66 public bool HandlesRegion(Location x)
113 { 67 {
114 LocalScene = x; 68 return m_udpServer.HandlesRegion(x);
115 } 69 }
116 70
117 public void Start() 71 public void Start()
118 { 72 {
119 ServerListener(); 73 m_udpServer.Start();
120 } 74 }
121 75
122 public void Stop() 76 public void Stop()
123 { 77 {
124 m_socket.Close(); 78 m_udpServer.Stop();
125 } 79 }
80 }
81
82 public class LLUDPServer : UDPBase
83 {
84 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 85
127 public LLUDPServer() 86 /// <summary>Handlers for incoming packets</summary>
87 //PacketEventDictionary packetEvents = new PacketEventDictionary();
88 /// <summary>Incoming packets that are awaiting handling</summary>
89 private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
90 /// <summary></summary>
91 private UDPClientCollection clients = new UDPClientCollection();
92 /// <summary>Bandwidth throttle for this UDP server</summary>
93 private TokenBucket m_throttle;
94 /// <summary>Bandwidth throttle rates for this UDP server</summary>
95 private ThrottleRates m_throttleRates;
96 /// <summary>Manages authentication for agent circuits</summary>
97 private AgentCircuitManager m_circuitManager;
98 /// <summary>Reference to the scene this UDP server is attached to</summary>
99 private IScene m_scene;
100 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary>
101 private Location m_location;
102 /// <summary>The measured resolution of Environment.TickCount</summary>
103 private float m_tickCountResolution;
104
105 /// <summary>The measured resolution of Environment.TickCount</summary>
106 public float TickCountResolution { get { return m_tickCountResolution; } }
107 public Socket Server { get { return null; } }
108
109 public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
110 : base((int)port)
128 { 111 {
112 #region Environment.TickCount Measurement
113
114 // Measure the resolution of Environment.TickCount
115 m_tickCountResolution = 0f;
116 for (int i = 0; i < 5; i++)
117 {
118 int start = Environment.TickCount;
119 int now = start;
120 while (now == start)
121 now = Environment.TickCount;
122 m_tickCountResolution += (float)(now - start) * 0.2f;
123 }
124 m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
125
126 #endregion Environment.TickCount Measurement
127
128 m_circuitManager = circuitManager;
129
130 // TODO: Config support for throttling the entire connection
131 m_throttle = new TokenBucket(null, 0, 0);
132 m_throttleRates = new ThrottleRates(configSource);
129 } 133 }
130 134
131 public LLUDPServer( 135 public new void Start()
132 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource,
133 AgentCircuitManager authenticateClass)
134 { 136 {
135 Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, configSource, authenticateClass); 137 if (m_scene == null)
138 throw new InvalidOperationException("Cannot LLUDPServer.Start() without an IScene reference");
139
140 base.Start();
141
142 // Start the incoming packet processing thread
143 Thread incomingThread = new Thread(IncomingPacketHandler);
144 incomingThread.Name = "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")";
145 incomingThread.Start();
146
147 Thread outgoingThread = new Thread(OutgoingPacketHandler);
148 outgoingThread.Name = "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")";
149 outgoingThread.Start();
136 } 150 }
137 151
138 /// <summary> 152 public new void Stop()
139 /// Initialize the server
140 /// </summary>
141 /// <param name="_listenIP"></param>
142 /// <param name="port"></param>
143 /// <param name="proxyPortOffsetParm"></param>
144 /// <param name="allow_alternate_port"></param>
145 /// <param name="configSource"></param>
146 /// <param name="assetCache"></param>
147 /// <param name="circuitManager"></param>
148 public void Initialise(
149 IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource,
150 AgentCircuitManager circuitManager)
151 { 153 {
152 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 154 base.Stop();
153 155 }
154 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
155 156
156 if (config != null) 157 public void AddScene(IScene scene)
158 {
159 if (m_scene == null)
157 { 160 {
158 if (config.Contains("client_throttle_max_bps")) 161 m_scene = scene;
159 { 162 m_location = new Location(m_scene.RegionInfo.RegionHandle);
160 int maxBPS = config.GetInt("client_throttle_max_bps", 1500000); 163 }
161 userSettings.TotalThrottleSettings = new ThrottleSettings(0, maxBPS, 164 else
162 maxBPS > 28000 ? maxBPS : 28000); 165 {
163 } 166 m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
164 167 }
165 if (config.Contains("client_throttle_multiplier"))
166 userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier");
167 if (config.Contains("client_socket_rcvbuf_size"))
168 m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size");
169 }
170
171 m_log.DebugFormat("[CLIENT]: client_throttle_multiplier = {0}", userSettings.ClientThrottleMultipler);
172 m_log.DebugFormat("[CLIENT]: client_socket_rcvbuf_size = {0}", (m_clientSocketReceiveBuffer != 0 ?
173 m_clientSocketReceiveBuffer.ToString() : "OS default"));
174
175 proxyPortOffset = proxyPortOffsetParm;
176 listenPort = (uint) (port + proxyPortOffsetParm);
177 listenIP = _listenIP;
178 Allow_Alternate_Port = allow_alternate_port;
179 m_circuitManager = circuitManager;
180 CreatePacketServer(userSettings);
181
182 // Return new port
183 // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered.
184 // So the option allow_alternate_ports="true" was added to default.xml
185 port = (uint)(listenPort - proxyPortOffsetParm);
186 } 168 }
187 169
188 protected virtual void CreatePacketServer(ClientStackUserSettings userSettings) 170 public bool HandlesRegion(Location x)
189 { 171 {
190 new LLPacketServer(this, userSettings); 172 return x == m_location;
191 } 173 }
192 174
193 /// <summary> 175 public void RemoveClient(IClientAPI client)
194 /// This method is called every time that we receive new UDP data.
195 /// </summary>
196 /// <param name="result"></param>
197 protected virtual void OnReceivedData(IAsyncResult result)
198 { 176 {
199 Packet packet = null; 177 m_scene.ClientManager.Remove(client.CircuitCode);
200 int numBytes = 1; 178 client.Close(false);
201 EndPoint epSender = new IPEndPoint(IPAddress.Any, 0);
202 EndPoint epProxy = null;
203 179
204 try 180 LLUDPClient udpClient;
181 if (clients.TryGetValue(client.AgentId, out udpClient))
205 { 182 {
206 if (EndReceive(out numBytes, result, ref epSender)) 183 m_log.Debug("[LLUDPSERVER]: Removing LLUDPClient for " + client.Name);
207 { 184 udpClient.Shutdown();
208 // Make sure we are getting zeroes when running off the 185 clients.Remove(client.AgentId, udpClient.RemoteEndPoint);
209 // end of grab / degrab packets from old clients
210 Array.Clear(RecvBuffer, numBytes, RecvBuffer.Length - numBytes);
211
212 int packetEnd = numBytes - 1;
213 if (proxyPortOffset != 0) packetEnd -= 6;
214
215 try
216 {
217 packet = PacketPool.Instance.GetPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
218 }
219 catch (MalformedDataException e)
220 {
221 m_log.DebugFormat("[CLIENT]: Dropped Malformed Packet due to MalformedDataException: {0}", e.StackTrace);
222 }
223 catch (IndexOutOfRangeException e)
224 {
225 m_log.DebugFormat("[CLIENT]: Dropped Malformed Packet due to IndexOutOfRangeException: {0}", e.StackTrace);
226 }
227 catch (Exception e)
228 {
229 m_log.Debug("[CLIENT]: " + e);
230 }
231 }
232
233
234 if (proxyPortOffset != 0)
235 {
236 // If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists,
237 // before allowing the RecvBuffer to be overwritten by the next packet.
238 if (packet != null && packet.Type == PacketType.UseCircuitCode)
239 {
240 epProxy = epSender;
241 }
242
243 // Now decode the message from the proxy server
244 epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes);
245 }
246 } 186 }
247 catch (Exception ex) 187 else
248 { 188 {
249 m_log.ErrorFormat("[CLIENT]: Exception thrown during EndReceive(): {0}", ex); 189 m_log.Warn("[LLUDPSERVER]: Failed to remove LLUDPClient for " + client.Name);
250 } 190 }
191 }
251 192
252 BeginRobustReceive(); 193 public void RemoveClient(LLUDPClient udpClient)
194 {
195 IClientAPI client;
196
197 if (m_scene.ClientManager.TryGetClient(udpClient.CircuitCode, out client))
198 RemoveClient(client);
199 else
200 m_log.Warn("[LLUDPSERVER]: Failed to lookup IClientAPI for LLUDPClient " + udpClient.AgentID);
201 }
253 202
254 if (packet != null) 203 public void SetClientPaused(UUID agentID, bool paused)
204 {
205 LLUDPClient client;
206 if (clients.TryGetValue(agentID, out client))
255 { 207 {
256 if (packet.Type == PacketType.UseCircuitCode) 208 client.IsPaused = paused;
257 AddNewClient((UseCircuitCodePacket)packet, epSender, epProxy); 209 }
258 else 210 else
259 ProcessInPacket(packet, epSender); 211 {
212 m_log.Warn("[LLUDPSERVER]: Attempted to pause/unpause unknown agent " + agentID);
260 } 213 }
261 } 214 }
262 215
263 /// <summary> 216 public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
264 /// Process a successfully received packet.
265 /// </summary>
266 /// <param name="packet"></param>
267 /// <param name="epSender"></param>
268 protected virtual void ProcessInPacket(Packet packet, EndPoint epSender)
269 { 217 {
270 try 218 if (allowSplitting && packet.HasVariableBlocks)
271 { 219 {
272 // do we already have a circuit for this endpoint 220 byte[][] datas = packet.ToBytesMultiple();
273 uint circuit; 221 int packetCount = datas.Length;
274 bool ret;
275
276 lock (clientCircuits)
277 {
278 ret = clientCircuits.TryGetValue(epSender, out circuit);
279 }
280 222
281 if (ret) 223 if (packetCount > 1)
282 { 224 m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets");
283 //if so then send packet to the packetserver
284 //m_log.DebugFormat(
285 // "[UDPSERVER]: For circuit {0} {1} got packet {2}", circuit, epSender, packet.Type);
286 225
287 m_packetServer.InPacket(circuit, packet); 226 for (int i = 0; i < packetCount; i++)
227 {
228 byte[] data = datas[i];
229 clients.ForEach(
230 delegate(LLUDPClient client)
231 { SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); });
288 } 232 }
289 } 233 }
290 catch (Exception e) 234 else
291 { 235 {
292 m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e); 236 byte[] data = packet.ToBytes();
237 clients.ForEach(
238 delegate(LLUDPClient client)
239 { SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); });
293 } 240 }
294 } 241 }
295 242
296 /// <summary> 243 public void SendPacket(UUID agentID, Packet packet, ThrottleOutPacketType category, bool allowSplitting)
297 /// Begin an asynchronous receive of the next bit of raw data
298 /// </summary>
299 protected virtual void BeginReceive()
300 { 244 {
301 m_socket.BeginReceiveFrom( 245 LLUDPClient client;
302 RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null); 246 if (clients.TryGetValue(agentID, out client))
247 SendPacket(client, packet, category, allowSplitting);
248 else
249 m_log.Warn("[LLUDPSERVER]: Attempted to send a packet to unknown agentID " + agentID);
303 } 250 }
304 251
305 /// <summary> 252 public void SendPacket(LLUDPClient client, Packet packet, ThrottleOutPacketType category, bool allowSplitting)
306 /// Begin a robust asynchronous receive of the next bit of raw data. Robust means that SocketExceptions are
307 /// automatically dealt with until the next set of valid UDP data is received.
308 /// </summary>
309 private void BeginRobustReceive()
310 { 253 {
311 bool done = false; 254 if (allowSplitting && packet.HasVariableBlocks)
312
313 while (!done)
314 { 255 {
315 try 256 byte[][] datas = packet.ToBytesMultiple();
257 int packetCount = datas.Length;
258
259 if (packetCount > 1)
260 m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets");
261
262 for (int i = 0; i < packetCount; i++)
316 { 263 {
317 BeginReceive(); 264 byte[] data = datas[i];
318 done = true; 265 SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category);
319 } 266 }
320 catch (SocketException e) 267 }
321 { 268 else
322 // ENDLESS LOOP ON PURPOSE! 269 {
323 // Reset connection and get next UDP packet off the buffer 270 byte[] data = packet.ToBytes();
324 // If the UDP packet is part of the same stream, this will happen several hundreds of times before 271 SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category);
325 // the next set of UDP data is for a valid client. 272 }
273 }
326 274
327 try 275 public void SendPacketData(LLUDPClient client, byte[] data, int dataLength, PacketType type, bool doZerocode, ThrottleOutPacketType category)
328 { 276 {
329 CloseCircuit(e); 277 // Frequency analysis of outgoing packet sizes shows a large clump of packets at each end of the spectrum.
330 } 278 // The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting
331 catch (Exception e2) 279 // there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here
332 { 280 // to accomodate for both common scenarios and provide ample room for ACK appending in both
333 m_log.ErrorFormat( 281 int bufferSize = (dataLength > 180) ? Packet.MTU : 200;
334 "[CLIENT]: Exception thrown when trying to close the circuit for {0} - {1}", reusedEpSender, 282
335 e2); 283 UDPPacketBuffer buffer = new UDPPacketBuffer(client.RemoteEndPoint, bufferSize);
336 }
337 }
338 catch (ObjectDisposedException)
339 {
340 m_log.Info(
341 "[UDPSERVER]: UDP Object disposed. No need to worry about this if you're restarting the simulator.");
342 284
343 done = true; 285 // Zerocode if needed
286 if (doZerocode)
287 {
288 try { dataLength = Helpers.ZeroEncode(data, dataLength, buffer.Data); }
289 catch (IndexOutOfRangeException)
290 {
291 // The packet grew larger than the bufferSize while zerocoding.
292 // Remove the MSG_ZEROCODED flag and send the unencoded data
293 // instead
294 m_log.Info("[LLUDPSERVER]: Packet exceeded buffer size during zerocoding. Removing MSG_ZEROCODED flag");
295 data[0] = (byte)(data[0] & ~Helpers.MSG_ZEROCODED);
296 Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
344 } 297 }
345 catch (Exception ex) 298 }
299 else
300 {
301 Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
302 }
303 buffer.DataLength = dataLength;
304
305 #region Queue or Send
306
307 // Look up the UDPClient this is going to
308 OutgoingPacket outgoingPacket = new OutgoingPacket(client, buffer, category);
309
310 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
311 SendPacketFinal(outgoingPacket);
312
313 #endregion Queue or Send
314 }
315
316 public void SendAcks(LLUDPClient client)
317 {
318 uint ack;
319
320 if (client.PendingAcks.Dequeue(out ack))
321 {
322 List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>();
323 PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock();
324 block.ID = ack;
325 blocks.Add(block);
326
327 while (client.PendingAcks.Dequeue(out ack))
346 { 328 {
347 m_log.ErrorFormat("[CLIENT]: Exception thrown during BeginReceive(): {0}", ex); 329 block = new PacketAckPacket.PacketsBlock();
330 block.ID = ack;
331 blocks.Add(block);
348 } 332 }
333
334 PacketAckPacket packet = new PacketAckPacket();
335 packet.Header.Reliable = false;
336 packet.Packets = blocks.ToArray();
337
338 SendPacket(client, packet, ThrottleOutPacketType.Unknown, true);
349 } 339 }
350 } 340 }
351 341
352 /// <summary> 342 public void ResendUnacked(LLUDPClient client)
353 /// Close a client circuit. This is done in response to an exception on receive, and should not be called
354 /// normally.
355 /// </summary>
356 /// <param name="e">The exception that caused the close. Can be null if there was no exception</param>
357 private void CloseCircuit(Exception e)
358 { 343 {
359 uint circuit; 344 if (client.NeedAcks.Count > 0)
360 lock (clientCircuits)
361 { 345 {
362 if (clientCircuits.TryGetValue(reusedEpSender, out circuit)) 346 List<OutgoingPacket> expiredPackets = client.NeedAcks.GetExpiredPackets(client.RTO);
347
348 if (expiredPackets != null)
363 { 349 {
364 m_packetServer.CloseCircuit(circuit); 350 // Resend packets
365 351 for (int i = 0; i < expiredPackets.Count; i++)
366 if (e != null) 352 {
367 m_log.ErrorFormat( 353 OutgoingPacket outgoingPacket = expiredPackets[i];
368 "[CLIENT]: Closed circuit {0} {1} due to exception {2}", circuit, reusedEpSender, e); 354
355 // FIXME: Make this an .ini setting
356 if (outgoingPacket.ResendCount < 3)
357 {
358 //Logger.Debug(String.Format("Resending packet #{0} (attempt {1}), {2}ms have passed",
359 // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount));
360
361 // Set the resent flag
362 outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT);
363 outgoingPacket.Category = ThrottleOutPacketType.Resend;
364
365 // The TickCount will be set to the current time when the packet
366 // is actually sent out again
367 outgoingPacket.TickCount = 0;
368
369 Interlocked.Increment(ref outgoingPacket.ResendCount);
370 //Interlocked.Increment(ref Stats.ResentPackets);
371
372 // Queue or (re)send the packet
373 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
374 SendPacketFinal(outgoingPacket);
375 }
376 else
377 {
378 m_log.DebugFormat("[LLUDPSERVER]: Dropping packet #{0} for agent {1} after {2} failed attempts",
379 outgoingPacket.SequenceNumber, outgoingPacket.Client.RemoteEndPoint, outgoingPacket.ResendCount);
380
381 lock (client.NeedAcks.SyncRoot)
382 client.NeedAcks.RemoveUnsafe(outgoingPacket.SequenceNumber);
383
384 //Interlocked.Increment(ref Stats.DroppedPackets);
385
386 // Disconnect an agent if no packets are received for some time
387 //FIXME: Make 60 an .ini setting
388 if (Environment.TickCount - client.TickLastPacketReceived > 1000 * 60)
389 {
390 m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + client.RemoteEndPoint);
391
392 RemoveClient(client);
393 return;
394 }
395 }
396 }
369 } 397 }
370 } 398 }
371 } 399 }
372 400
373 /// <summary> 401 public void Flush()
374 /// Finish the process of asynchronously receiving the next bit of raw data 402 {
375 /// </summary> 403 }
376 /// <param name="numBytes">The number of bytes received. Will return 0 if no bytes were recieved 404
377 /// <param name="result"></param> 405 protected override void PacketReceived(UDPPacketBuffer buffer)
378 /// <param name="epSender">The sender of the data</param>
379 /// <returns></returns>
380 protected virtual bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender)
381 { 406 {
382 bool hasReceivedOkay = false; 407 // Debugging/Profiling
383 numBytes = 0; 408 //try { Thread.CurrentThread.Name = "PacketReceived (" + scene.RegionName + ")"; }
384 409 //catch (Exception) { }
410
411 LLUDPClient client = null;
412 Packet packet = null;
413 int packetEnd = buffer.DataLength - 1;
414 IPEndPoint address = (IPEndPoint)buffer.RemoteEndPoint;
415
416 #region Decoding
417
385 try 418 try
386 { 419 {
387 numBytes = m_socket.EndReceiveFrom(result, ref epSender); 420 packet = Packet.BuildPacket(buffer.Data, ref packetEnd,
388 hasReceivedOkay = true; 421 // Only allocate a buffer for zerodecoding if the packet is zerocoded
422 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null);
389 } 423 }
390 catch (SocketException e) 424 catch (MalformedDataException)
391 { 425 {
392 // TODO : Actually only handle those states that we have control over, re-throw everything else, 426 m_log.ErrorFormat("[LLUDPSERVER]: Malformed data, cannot parse packet:\n{0}",
393 // TODO: implement cases as we encounter them. 427 Utils.BytesToHexString(buffer.Data, buffer.DataLength, null));
394 //m_log.Error("[CLIENT]: Connection Error! - " + e.ToString()); 428 }
395 switch (e.SocketErrorCode) 429
396 { 430 // Fail-safe check
397 case SocketError.AlreadyInProgress: 431 if (packet == null)
398 return hasReceivedOkay; 432 {
433 m_log.Warn("[LLUDPSERVER]: Couldn't build a message from the incoming data");
434 return;
435 }
399 436
400 case SocketError.NetworkReset: 437 //Stats.RecvBytes += (ulong)buffer.DataLength;
401 case SocketError.ConnectionReset: 438 //++Stats.RecvPackets;
402 case SocketError.OperationAborted:
403 break;
404 439
405 default: 440 #endregion Decoding
406 throw; 441
442 #region UseCircuitCode Handling
443
444 if (packet.Type == PacketType.UseCircuitCode)
445 {
446 UseCircuitCodePacket useCircuitCode = (UseCircuitCodePacket)packet;
447 IClientAPI newuser;
448 uint circuitCode = useCircuitCode.CircuitCode.Code;
449
450 // Check if the client is already established
451 if (!m_scene.ClientManager.TryGetClient(circuitCode, out newuser))
452 {
453 AddNewClient(useCircuitCode, (IPEndPoint)buffer.RemoteEndPoint);
407 } 454 }
408 } 455 }
409 catch (ObjectDisposedException e) 456
457 // Determine which agent this packet came from
458 if (!clients.TryGetValue(address, out client))
410 { 459 {
411 m_log.DebugFormat("[CLIENT]: ObjectDisposedException: Object {0} disposed.", e.ObjectName); 460 m_log.Warn("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address);
412 // Uhh, what object, and why? this needs better handling. 461 return;
413 } 462 }
414
415 return hasReceivedOkay;
416 }
417 463
418 /// <summary> 464 #endregion UseCircuitCode Handling
419 /// Add a new client circuit. 465
420 /// </summary> 466 //if (packet.Header.Resent)
421 /// <param name="packet"></param> 467 // Interlocked.Increment(ref Stats.ReceivedResends);
422 /// <param name="epSender"></param> 468
423 /// <param name="epProxy"></param> 469 #region ACK Receiving
424 protected virtual void AddNewClient(UseCircuitCodePacket useCircuit, EndPoint epSender, EndPoint epProxy) 470
425 { 471 int now = Environment.TickCount;
426 //Slave regions don't accept new clients 472 client.TickLastPacketReceived = now;
427 if (m_localScene.RegionStatus != RegionStatus.SlaveScene) 473
474 // Handle appended ACKs
475 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
428 { 476 {
429 AuthenticateResponse sessionInfo; 477 lock (client.NeedAcks.SyncRoot)
430 bool isNewCircuit = false;
431
432 if (!m_packetServer.IsClientAuthorized(useCircuit, m_circuitManager, out sessionInfo))
433 { 478 {
434 m_log.WarnFormat( 479 for (int i = 0; i < packet.Header.AckList.Length; i++)
435 "[CONNECTION FAILURE]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", 480 AcknowledgePacket(client, packet.Header.AckList[i], now, packet.Header.Resent);
436 useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code, epSender);
437
438 return;
439 } 481 }
440 482 }
441 lock (clientCircuits) 483
484 // Handle PacketAck packets
485 if (packet.Type == PacketType.PacketAck)
486 {
487 PacketAckPacket ackPacket = (PacketAckPacket)packet;
488
489 lock (client.NeedAcks.SyncRoot)
442 { 490 {
443 if (!clientCircuits.ContainsKey(epSender)) 491 for (int i = 0; i < ackPacket.Packets.Length; i++)
444 { 492 AcknowledgePacket(client, ackPacket.Packets[i].ID, now, packet.Header.Resent);
445 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
446 isNewCircuit = true;
447 }
448 } 493 }
494 }
449 495
450 if (isNewCircuit) 496 #endregion ACK Receiving
451 {
452 // This doesn't need locking as it's synchronized data
453 clientCircuits_reverse[useCircuit.CircuitCode.Code] = epSender;
454 497
455 lock (proxyCircuits) 498 #region ACK Sending
456 { 499
457 proxyCircuits[useCircuit.CircuitCode.Code] = epProxy; 500 if (packet.Header.Reliable)
458 } 501 client.PendingAcks.Enqueue((uint)packet.Header.Sequence);
459 502
460 m_packetServer.AddNewClient(epSender, useCircuit, sessionInfo, epProxy); 503 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out,
461 504 // add the current received bytes to it, test if 2*MTU bytes have been sent, if so remove
462 //m_log.DebugFormat( 505 // 2*MTU bytes from the value and send ACKs, and finally add the local value back to
463 // "[CONNECTION SUCCESS]: Incoming client {0} (circuit code {1}) received and authenticated for {2}", 506 // client.BytesSinceLastACK. Lockless thread safety
464 // useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code, m_localScene.RegionInfo.RegionName); 507 int bytesSinceLastACK = Interlocked.Exchange(ref client.BytesSinceLastACK, 0);
465 } 508 bytesSinceLastACK += buffer.DataLength;
509 if (bytesSinceLastACK > Packet.MTU * 2)
510 {
511 bytesSinceLastACK -= Packet.MTU * 2;
512 SendAcks(client);
513 }
514 Interlocked.Add(ref client.BytesSinceLastACK, bytesSinceLastACK);
515
516 #endregion ACK Sending
517
518 #region Incoming Packet Accounting
519
520 // Check the archive of received reliable packet IDs to see whether we already received this packet
521 if (packet.Header.Reliable && !client.PacketArchive.TryEnqueue(packet.Header.Sequence))
522 {
523 if (packet.Header.Resent)
524 m_log.Debug("[LLUDPSERVER]: Received a resend of already processed packet #" + packet.Header.Sequence + ", type: " + packet.Type);
525 else
526 m_log.Warn("[LLUDPSERVER]: Received a duplicate (not marked as resend) of packet #" + packet.Header.Sequence + ", type: " + packet.Type);
527
528 // Avoid firing a callback twice for the same packet
529 return;
466 } 530 }
467
468 // Ack the UseCircuitCode packet
469 PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
470 // TODO: don't create new blocks if recycling an old packet
471 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
472 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
473 ack_it.Packets[0].ID = useCircuit.Header.Sequence;
474 // ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) is just a failsafe to ensure that we don't overflow.
475 ack_it.Header.Sequence = ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) + 1;
476 ack_it.Header.Reliable = false;
477 531
478 byte[] ackmsg = ack_it.ToBytes(); 532 #endregion Incoming Packet Accounting
479 533
480 // Need some extra space in case we need to add proxy 534 // Don't bother clogging up the queue with PacketAck packets that are already handled here
481 // information to the message later 535 if (packet.Type != PacketType.PacketAck)
482 byte[] msg = new byte[4096]; 536 {
483 Buffer.BlockCopy(ackmsg, 0, msg, 0, ackmsg.Length); 537 // Inbox insertion
538 IncomingPacket incomingPacket;
539 incomingPacket.Client = client;
540 incomingPacket.Packet = packet;
484 541
485 SendPacketTo(msg, ackmsg.Length, SocketFlags.None, useCircuit.CircuitCode.Code); 542 packetInbox.Enqueue(incomingPacket);
543 }
544 }
486 545
487 PacketPool.Instance.ReturnPacket(useCircuit); 546 protected override void PacketSent(UDPPacketBuffer buffer, int bytesSent)
547 {
488 } 548 }
489 549
490 public void ServerListener() 550 private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo)
491 { 551 {
492 uint newPort = listenPort; 552 UUID agentID = useCircuitCode.CircuitCode.ID;
493 m_log.Info("[UDPSERVER]: Opening UDP socket on " + listenIP + " " + newPort + "."); 553 UUID sessionID = useCircuitCode.CircuitCode.SessionID;
554 uint circuitCode = useCircuitCode.CircuitCode.Code;
494 555
495 ServerIncoming = new IPEndPoint(listenIP, (int)newPort); 556 sessionInfo = m_circuitManager.AuthenticateSession(sessionID, agentID, circuitCode);
496 m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 557 return sessionInfo.Authorised;
497 if (0 != m_clientSocketReceiveBuffer) 558 }
498 m_socket.ReceiveBufferSize = m_clientSocketReceiveBuffer;
499 m_socket.Bind(ServerIncoming);
500 // Add flags to the UDP socket to prevent "Socket forcibly closed by host"
501 // uint IOC_IN = 0x80000000;
502 // uint IOC_VENDOR = 0x18000000;
503 // uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
504 // TODO: this apparently works in .NET but not in Mono, need to sort out the right flags here.
505 // m_socket.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null);
506 559
507 listenPort = newPort; 560 private void AddNewClient(UseCircuitCodePacket useCircuitCode, IPEndPoint remoteEndPoint)
561 {
562 //Slave regions don't accept new clients
563 if (m_scene.RegionStatus != RegionStatus.SlaveScene)
564 {
565 AuthenticateResponse sessionInfo;
566 bool isNewCircuit = !clients.ContainsKey(remoteEndPoint);
508 567
509 m_log.Info("[UDPSERVER]: UDP socket bound, getting ready to listen"); 568 if (!IsClientAuthorized(useCircuitCode, out sessionInfo))
569 {
570 m_log.WarnFormat(
571 "[CONNECTION FAILURE]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
572 useCircuitCode.CircuitCode.ID, useCircuitCode.CircuitCode.Code, remoteEndPoint);
573 return;
574 }
510 575
511 ReceivedData = OnReceivedData; 576 if (isNewCircuit)
512 BeginReceive(); 577 {
578 UUID agentID = useCircuitCode.CircuitCode.ID;
579 UUID sessionID = useCircuitCode.CircuitCode.SessionID;
580 uint circuitCode = useCircuitCode.CircuitCode.Code;
513 581
514 m_log.Info("[UDPSERVER]: Listening on port " + newPort); 582 AddClient(circuitCode, agentID, sessionID, remoteEndPoint, sessionInfo);
583 }
584 }
515 } 585 }
516 586
517 public virtual void RegisterPacketServer(LLPacketServer server) 587 private void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
518 { 588 {
519 m_packetServer = server; 589 // Create the LLUDPClient
590 LLUDPClient client = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint);
591 clients.Add(agentID, client.RemoteEndPoint, client);
592
593 // Create the IClientAPI
594 IClientAPI clientApi = new LLClientView(remoteEndPoint, m_scene, this, client, sessionInfo, agentID, sessionID, circuitCode);
595 clientApi.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
596 clientApi.OnLogout += LogoutHandler;
597 clientApi.OnConnectionClosed += RemoveClient;
598
599 // Give LLUDPClient a reference to IClientAPI
600 client.ClientAPI = clientApi;
601
602 // Start the IClientAPI
603 m_scene.ClientManager.Add(circuitCode, clientApi);
604 clientApi.Start();
520 } 605 }
521 606
522 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 607 private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend)
523 //EndPoint packetSender)
524 { 608 {
525 // find the endpoint for this circuit 609 OutgoingPacket ackedPacket;
526 EndPoint sendto; 610 if (client.NeedAcks.RemoveUnsafe(ack, out ackedPacket) && !fromResend)
527 try
528 {
529 sendto = (EndPoint)clientCircuits_reverse[circuitcode];
530 }
531 catch
532 { 611 {
533 // Exceptions here mean there is no circuit 612 // Calculate the round-trip time for this packet and its ACK
534 m_log.Warn("[CLIENT]: Circuit not found, not sending packet"); 613 int rtt = currentTime - ackedPacket.TickCount;
535 return; 614 if (rtt > 0)
615 client.UpdateRoundTrip(rtt);
536 } 616 }
617 }
618
619 private void IncomingPacketHandler()
620 {
621 IncomingPacket incomingPacket = new IncomingPacket();
622 Packet packet = null;
623 LLUDPClient client = null;
537 624
538 if (sendto != null) 625 while (base.IsRunning)
539 { 626 {
540 //we found the endpoint so send the packet to it 627 // Reset packet to null for the check below
541 if (proxyPortOffset != 0) 628 packet = null;
542 { 629
543 //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); 630 if (packetInbox.Dequeue(100, ref incomingPacket))
544 ProxyCodec.EncodeProxyMessage(buffer, ref size, sendto);
545 m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
546 }
547 else
548 { 631 {
549 //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString()); 632 packet = incomingPacket.Packet;
550 try 633 client = incomingPacket.Client;
551 { 634
552 m_socket.SendTo(buffer, size, flags, sendto); 635 if (packet != null && client != null)
553 } 636 client.ClientAPI.ProcessInPacket(packet);
554 catch (SocketException SockE)
555 {
556 m_log.ErrorFormat("[UDPSERVER]: Caught Socket Error in the send buffer!. {0}",SockE.ToString());
557 }
558 } 637 }
559 } 638 }
639
640 if (packetInbox.Count > 0)
641 m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets");
642 packetInbox.Clear();
560 } 643 }
561 644
562 public virtual void RemoveClientCircuit(uint circuitcode) 645 private void OutgoingPacketHandler()
563 { 646 {
564 EndPoint sendto; 647 int now = Environment.TickCount;
565 if (clientCircuits_reverse.Contains(circuitcode)) 648 int elapsedMS = 0;
649 int elapsed100MS = 0;
650
651 while (base.IsRunning)
566 { 652 {
567 sendto = (EndPoint)clientCircuits_reverse[circuitcode]; 653 bool resendUnacked = false;
654 bool sendAcks = false;
655 bool packetSent = false;
568 656
569 clientCircuits_reverse.Remove(circuitcode); 657 elapsedMS += Environment.TickCount - now;
570 658
571 lock (clientCircuits) 659 // Check for packets that need to be resent every 100ms
660 if (elapsedMS >= 100)
572 { 661 {
573 if (sendto != null) 662 resendUnacked = true;
574 { 663 elapsedMS -= 100;
575 clientCircuits.Remove(sendto); 664 ++elapsed100MS;
576 }
577 else
578 {
579 m_log.DebugFormat(
580 "[CLIENT]: endpoint for circuit code {0} in RemoveClientCircuit() was unexpectedly null!", circuitcode);
581 }
582 } 665 }
583 lock (proxyCircuits) 666 // Check for ACKs that need to be sent out every 500ms
667 if (elapsed100MS >= 5)
584 { 668 {
585 proxyCircuits.Remove(circuitcode); 669 sendAcks = true;
670 elapsed100MS = 0;
586 } 671 }
672
673 clients.ForEach(
674 delegate(LLUDPClient client)
675 {
676 if (client.DequeueOutgoing())
677 packetSent = true;
678 if (resendUnacked)
679 ResendUnacked(client);
680 if (sendAcks)
681 SendAcks(client);
682 }
683 );
684
685 if (!packetSent)
686 Thread.Sleep(20);
587 } 687 }
588 } 688 }
589 689
590 public void RestoreClient(AgentCircuitData circuit, EndPoint userEP, EndPoint proxyEP) 690 private void LogoutHandler(IClientAPI client)
591 { 691 {
592 //MainLog.Instance.Verbose("UDPSERVER", "RestoreClient"); 692 client.SendLogoutPacket();
693 RemoveClient(client);
694 }
695
696 internal void SendPacketFinal(OutgoingPacket outgoingPacket)
697 {
698 UDPPacketBuffer buffer = outgoingPacket.Buffer;
699 byte flags = buffer.Data[0];
700 bool isResend = (flags & Helpers.MSG_RESENT) != 0;
701 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
702 LLUDPClient client = outgoingPacket.Client;
703
704 // Keep track of when this packet was sent out (right now)
705 outgoingPacket.TickCount = Environment.TickCount;
593 706
594 UseCircuitCodePacket useCircuit = new UseCircuitCodePacket(); 707 #region ACK Appending
595 useCircuit.CircuitCode.Code = circuit.circuitcode; 708
596 useCircuit.CircuitCode.ID = circuit.AgentID; 709 int dataLength = buffer.DataLength;
597 useCircuit.CircuitCode.SessionID = circuit.SessionID; 710
598 711 // Keep appending ACKs until there is no room left in the packet or there are
599 AuthenticateResponse sessionInfo; 712 // no more ACKs to append
600 713 uint ackCount = 0;
601 if (!m_packetServer.IsClientAuthorized(useCircuit, m_circuitManager, out sessionInfo)) 714 uint ack;
715 while (dataLength + 5 < buffer.Data.Length && client.PendingAcks.Dequeue(out ack))
602 { 716 {
603 m_log.WarnFormat( 717 Utils.UIntToBytesBig(ack, buffer.Data, dataLength);
604 "[CLIENT]: Restore request denied to avatar {0} connecting with unauthorized circuit code {1}", 718 dataLength += 4;
605 useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code); 719 ++ackCount;
606
607 return;
608 } 720 }
609 721
610 lock (clientCircuits) 722 if (ackCount > 0)
611 { 723 {
612 if (!clientCircuits.ContainsKey(userEP)) 724 // Set the last byte of the packet equal to the number of appended ACKs
613 clientCircuits.Add(userEP, useCircuit.CircuitCode.Code); 725 buffer.Data[dataLength++] = (byte)ackCount;
614 else 726 // Set the appended ACKs flag on this packet
615 m_log.Error("[CLIENT]: clientCircuits already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding."); 727 buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS);
616 } 728 }
617 729
618 // This data structure is synchronized, so we don't need the lock 730 buffer.DataLength = dataLength;
619 if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
620 clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP);
621 else
622 m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding.");
623 731
624 lock (proxyCircuits) 732 #endregion ACK Appending
733
734 if (!isResend)
625 { 735 {
626 if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code)) 736 // Not a resend, assign a new sequence number
627 { 737 uint sequenceNumber = (uint)Interlocked.Increment(ref client.CurrentSequence);
628 proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP); 738 Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1);
629 } 739 outgoingPacket.SequenceNumber = sequenceNumber;
630 else 740
741 if (isReliable)
631 { 742 {
632 // re-set proxy endpoint 743 // Add this packet to the list of ACK responses we are waiting on from the server
633 proxyCircuits.Remove(useCircuit.CircuitCode.Code); 744 client.NeedAcks.Add(outgoingPacket);
634 proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP);
635 } 745 }
636 } 746 }
637 747
638 m_packetServer.AddNewClient(userEP, useCircuit, sessionInfo, proxyEP); 748 // Put the UDP payload on the wire
749 AsyncBeginSend(buffer);
639 } 750 }
640 } 751 }
641} 752}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
index c45d11f..066b19d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
@@ -25,8 +25,13 @@
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;
29using System.Collections.Generic;
30using System.Net;
28using OpenMetaverse; 31using OpenMetaverse;
29 32
33using ReaderWriterLockImpl = OpenMetaverse.ReaderWriterLockSlim;
34
30namespace OpenSim.Region.ClientStack.LindenUDP 35namespace OpenSim.Region.ClientStack.LindenUDP
31{ 36{
32 public class LLUtil 37 public class LLUtil
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
index cde155b..7d0757f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
70 70
71 TestClient testClient = new TestClient(agent, scene); 71 TestClient testClient = new TestClient(agent, scene);
72 72
73 ILLPacketHandler packetHandler 73 LLPacketHandler packetHandler
74 = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings()); 74 = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
75 75
76 packetHandler.InPacket(new AgentAnimationPacket()); 76 packetHandler.InPacket(new AgentAnimationPacket());
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
index 1fba847..e995d65 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
37 /// </summary> 37 /// </summary>
38 protected Dictionary<PacketType, int> m_packetsReceived = new Dictionary<PacketType, int>(); 38 protected Dictionary<PacketType, int> m_packetsReceived = new Dictionary<PacketType, int>();
39 39
40 public TestLLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings) 40 public TestLLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
41 : base(networkHandler, userSettings) 41 : base(networkHandler, userSettings)
42 {} 42 {}
43 43