diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs) | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs index c45d11f..1a1a1cb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -25,27 +25,46 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
28 | using OpenMetaverse; | 30 | using OpenMetaverse; |
29 | 31 | ||
30 | namespace OpenSim.Region.ClientStack.LindenUDP | 32 | namespace OpenSim.Region.ClientStack.LindenUDP |
31 | { | 33 | { |
32 | public class LLUtil | 34 | /// <summary> |
35 | /// Holds a reference to the <seealso cref="LLUDPClient"/> this packet is | ||
36 | /// destined for, along with the serialized packet data, sequence number | ||
37 | /// (if this is a resend), number of times this packet has been resent, | ||
38 | /// the time of the last resend, and the throttling category for this | ||
39 | /// packet | ||
40 | /// </summary> | ||
41 | public sealed class OutgoingPacket | ||
33 | { | 42 | { |
43 | /// <summary>Client this packet is destined for</summary> | ||
44 | public LLUDPClient Client; | ||
45 | /// <summary>Packet data to send</summary> | ||
46 | public UDPPacketBuffer Buffer; | ||
47 | /// <summary>Sequence number of the wrapped packet</summary> | ||
48 | public uint SequenceNumber; | ||
49 | /// <summary>Number of times this packet has been resent</summary> | ||
50 | public int ResendCount; | ||
51 | /// <summary>Environment.TickCount when this packet was last sent over the wire</summary> | ||
52 | public int TickCount; | ||
53 | /// <summary>Category this packet belongs to</summary> | ||
54 | public ThrottleOutPacketType Category; | ||
55 | |||
34 | /// <summary> | 56 | /// <summary> |
35 | /// Convert a string to bytes suitable for use in an LL UDP packet. | 57 | /// Default constructor |
36 | /// </summary> | 58 | /// </summary> |
37 | /// <param name="s">Truncated to 254 characters if necessary</param> | 59 | /// <param name="client">Reference to the client this packet is destined for</param> |
38 | /// <returns></returns> | 60 | /// <param name="buffer">Serialized packet data. If the flags or sequence number |
39 | public static byte[] StringToPacketBytes(string s) | 61 | /// need to be updated, they will be injected directly into this binary buffer</param> |
62 | /// <param name="category">Throttling category for this packet</param> | ||
63 | public OutgoingPacket(LLUDPClient client, UDPPacketBuffer buffer, ThrottleOutPacketType category) | ||
40 | { | 64 | { |
41 | // Anything more than 254 will cause libsecondlife to barf | 65 | Client = client; |
42 | // (libsl 1550) adds an \0 on the Utils.StringToBytes conversion if it isn't present | 66 | Buffer = buffer; |
43 | if (s.Length > 254) | 67 | Category = category; |
44 | { | ||
45 | s = s.Remove(254); | ||
46 | } | ||
47 | |||
48 | return Utils.StringToBytes(s); | ||
49 | } | 68 | } |
50 | } | 69 | } |
51 | } | 70 | } |