SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InternalPacket.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #ifndef __INTERNAL_PACKET_H
21 #define __INTERNAL_PACKET_H
22
23 #include "PacketPriority.h"
24 #include "types.h"
25 #include "memoryoverride.h"
26 #include "defines.h"
27 #include "NativeTypes.h"
28 #include "defines.h"
29 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
30 #include "CCRakNetUDT.h"
31 #else
32 #include "CCRakNetSlidingWindow.h"
33 #endif
34
35 namespace SLNet {
36
37 typedef uint16_t SplitPacketIdType;
38 typedef uint32_t SplitPacketIndexType;
39
42 typedef uint24_t MessageNumberType;
43
46 typedef MessageNumberType OrderingIndexType;
47
48 typedef SLNet::TimeUS RemoteSystemTimeType;
49
50 struct InternalPacketFixedSizeTransmissionHeader
51 {
53 MessageNumberType reliableMessageNumber;
55 OrderingIndexType orderingIndex;
56 // Used only with sequenced messages
57 OrderingIndexType sequencingIndex;
59 unsigned char orderingChannel;
61 SplitPacketIdType splitPacketId;
63 SplitPacketIndexType splitPacketIndex;
65 SplitPacketIndexType splitPacketCount;;
67 BitSize_t dataBitLength;
69 PacketReliability reliability;
70 // Not endian safe
71 // unsigned char priority : 3;
72 // unsigned char reliability : 5;
73 };
74
76 struct InternalPacketRefCountedData
77 {
78 unsigned char *sharedDataBlock;
79 unsigned int refCount;
80 };
81
84 struct InternalPacket : public InternalPacketFixedSizeTransmissionHeader
85 {
87 MessageNumberType messageInternalOrder;
91 bool messageNumberAssigned;
93 // bool allowWindowUpdate;
95 SLNet::TimeUS creationTime;
97 SLNet::TimeUS nextActionTime;
98 // For debugging
99 SLNet::TimeUS retransmissionTime;
100 // Size of the header when encoded into a bitstream
101 BitSize_t headerLength;
103 unsigned char *data;
105 enum AllocationScheme
106 {
108 NORMAL,
109
111 REF_COUNTED,
112
115 STACK
116 } allocationScheme;
117 InternalPacketRefCountedData *refCountedData;
119 unsigned char timesSent;
121 PacketPriority priority;
123 uint32_t sendReceiptSerial;
124
125 // Used for the resend queue
126 // Linked list implementation so I can remove from the list via a pointer, without finding it in the list
127 InternalPacket *resendPrev, *resendNext,*unreliablePrev,*unreliableNext;
128
129 unsigned char stackData[128];
130 };
131
132 } // namespace SLNet
133
134 #endif
135