diff options
author | Justin Clarke Casey | 2009-01-12 17:31:30 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-01-12 17:31:30 +0000 |
commit | 6e9d5e4ea79eed54e1e88a8e8d209149418021ed (patch) | |
tree | 09a8c4f130861e1448b2ab011ca9f6fc9691bd80 /OpenSim/Region/ClientStack | |
parent | Added WearableItem class to the framework. This class can be used to: load fr... (diff) | |
download | opensim-SC-6e9d5e4ea79eed54e1e88a8e8d209149418021ed.zip opensim-SC-6e9d5e4ea79eed54e1e88a8e8d209149418021ed.tar.gz opensim-SC-6e9d5e4ea79eed54e1e88a8e8d209149418021ed.tar.bz2 opensim-SC-6e9d5e4ea79eed54e1e88a8e8d209149418021ed.tar.xz |
* refactor: move packet handler interface into a separate class
Diffstat (limited to 'OpenSim/Region/ClientStack')
3 files changed, 70 insertions, 36 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs new file mode 100644 index 0000000..b857163 --- /dev/null +++ b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenMetaverse.Packets; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace 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 bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType); | ||
38 | |||
39 | public interface ILLPacketHandler | ||
40 | { | ||
41 | event PacketStats OnPacketStats; | ||
42 | event PacketDrop OnPacketDrop; | ||
43 | SynchronizeClientHandler SynchronizeClient { set; } | ||
44 | |||
45 | int PacketsReceived { get; } | ||
46 | int PacketsReceivedReported { get; } | ||
47 | uint ResendTimeout { get; set; } | ||
48 | bool ReliableIsImportant { get; set; } | ||
49 | int MaxReliableResends { get; set; } | ||
50 | |||
51 | void InPacket(Packet packet); | ||
52 | void ProcessInPacket(LLQueItem item); | ||
53 | void ProcessOutPacket(LLQueItem item); | ||
54 | void OutPacket(Packet NewPack, | ||
55 | ThrottleOutPacketType throttlePacketType); | ||
56 | void OutPacket(Packet NewPack, | ||
57 | ThrottleOutPacketType throttlePacketType, Object id); | ||
58 | LLPacketQueue PacketQueue { get; } | ||
59 | void Stop(); | ||
60 | void Flush(); | ||
61 | void Clear(); | ||
62 | ClientInfo GetClientInfo(); | ||
63 | void SetClientInfo(ClientInfo info); | ||
64 | void AddImportantPacket(PacketType type); | ||
65 | void RemoveImportantPacket(PacketType type); | ||
66 | } | ||
67 | } | ||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c88e6b5..c70163c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
75 | private readonly UUID m_agentId; | 75 | private readonly UUID m_agentId; |
76 | private readonly uint m_circuitCode; | 76 | private readonly uint m_circuitCode; |
77 | private int m_moneyBalance; | 77 | private int m_moneyBalance; |
78 | private readonly IPacketHandler m_PacketHandler; | 78 | private readonly ILLPacketHandler m_PacketHandler; |
79 | 79 | ||
80 | private int m_animationSequenceNumber = 1; | 80 | private int m_animationSequenceNumber = 1; |
81 | 81 | ||
@@ -402,7 +402,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
402 | get { return m_animationSequenceNumber++; } | 402 | get { return m_animationSequenceNumber++; } |
403 | } | 403 | } |
404 | 404 | ||
405 | public IPacketHandler PacketHandler | 405 | public ILLPacketHandler PacketHandler |
406 | { | 406 | { |
407 | get { return m_PacketHandler; } | 407 | get { return m_PacketHandler; } |
408 | } | 408 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 29cfd99..7b102ec 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | |||
@@ -42,40 +42,7 @@ using log4net; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.ClientStack.LindenUDP | 43 | namespace OpenSim.Region.ClientStack.LindenUDP |
44 | { | 44 | { |
45 | public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); | 45 | public class LLPacketHandler : ILLPacketHandler |
46 | public delegate void PacketDrop(Packet pack, Object id); | ||
47 | public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType); | ||
48 | |||
49 | public interface IPacketHandler | ||
50 | { | ||
51 | event PacketStats OnPacketStats; | ||
52 | event PacketDrop OnPacketDrop; | ||
53 | SynchronizeClientHandler SynchronizeClient { set; } | ||
54 | |||
55 | int PacketsReceived { get; } | ||
56 | int PacketsReceivedReported { get; } | ||
57 | uint ResendTimeout { get; set; } | ||
58 | bool ReliableIsImportant { get; set; } | ||
59 | int MaxReliableResends { get; set; } | ||
60 | |||
61 | void InPacket(Packet packet); | ||
62 | void ProcessInPacket(LLQueItem item); | ||
63 | void ProcessOutPacket(LLQueItem item); | ||
64 | void OutPacket(Packet NewPack, | ||
65 | ThrottleOutPacketType throttlePacketType); | ||
66 | void OutPacket(Packet NewPack, | ||
67 | ThrottleOutPacketType throttlePacketType, Object id); | ||
68 | LLPacketQueue PacketQueue { get; } | ||
69 | void Stop(); | ||
70 | void Flush(); | ||
71 | void Clear(); | ||
72 | ClientInfo GetClientInfo(); | ||
73 | void SetClientInfo(ClientInfo info); | ||
74 | void AddImportantPacket(PacketType type); | ||
75 | void RemoveImportantPacket(PacketType type); | ||
76 | } | ||
77 | |||
78 | public class LLPacketHandler : IPacketHandler | ||
79 | { | 46 | { |
80 | //private static readonly ILog m_log | 47 | //private static readonly ILog m_log |
81 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |