![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 #ifndef __RELIABILITY_LAYER_H 00019 #define __RELIABILITY_LAYER_H 00020 00021 #include "RakMemoryOverride.h" 00022 #include "MTUSize.h" 00023 #include "DS_LinkedList.h" 00024 #include "DS_List.h" 00025 #include "SocketLayer.h" 00026 #include "PacketPriority.h" 00027 #include "DS_Queue.h" 00028 #include "BitStream.h" 00029 #include "InternalPacket.h" 00030 #include "RakNetStatistics.h" 00031 #include "SHA1.h" 00032 #include "DS_OrderedList.h" 00033 #include "DS_RangeList.h" 00034 #include "DS_BPlusTree.h" 00035 #include "DS_MemoryPool.h" 00036 #include "DS_Multilist.h" 00037 #include "RakNetDefines.h" 00038 #include "DS_Heap.h" 00039 #include "BitStream.h" 00040 #include "NativeFeatureIncludes.h" 00041 #include "SecureHandshake.h" 00042 #include "PluginInterface2.h" 00043 #include "Rand.h" 00044 00045 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1 00046 #include "CCRakNetUDT.h" 00047 #define INCLUDE_TIMESTAMP_WITH_DATAGRAMS 1 00048 #else 00049 #include "CCRakNetSlidingWindow.h" 00050 #define INCLUDE_TIMESTAMP_WITH_DATAGRAMS 0 00051 #endif 00052 00054 #define NUMBER_OF_ORDERED_STREAMS 32 // 2^5 00055 00056 #define RESEND_TREE_ORDER 32 00057 00058 namespace RakNet { 00059 00061 class PluginInterface2; 00062 class RakNetRandom; 00063 typedef uint64_t reliabilityHeapWeightType; 00064 00065 // int SplitPacketIndexComp( SplitPacketIndexType const &key, InternalPacket* const &data ); 00066 struct SplitPacketChannel//<SplitPacketChannel> 00067 { 00068 CCTimeType lastUpdateTime; 00069 00070 DataStructures::List<InternalPacket*> splitPacketList; 00071 00072 #if PREALLOCATE_LARGE_MESSAGES==1 00073 InternalPacket *returnedPacket; 00074 bool gotFirstPacket; 00075 unsigned int stride; 00076 unsigned int splitPacketsArrived; 00077 #else 00078 // This is here for progress notifications, since progress notifications return the first packet data, if available 00079 InternalPacket *firstPacket; 00080 #endif 00081 00082 }; 00083 int RAK_DLL_EXPORT SplitPacketChannelComp( SplitPacketIdType const &key, SplitPacketChannel* const &data ); 00084 00085 // Helper class 00086 struct BPSTracker 00087 { 00088 BPSTracker(); 00089 ~BPSTracker(); 00090 void Reset(const char *file, unsigned int line); 00091 inline void Push1(CCTimeType time, uint64_t value1) {dataQueue.Push(TimeAndValue2(time,value1),_FILE_AND_LINE_); total1+=value1; lastSec1+=value1;} 00092 // void Push2(RakNet::TimeUS time, uint64_t value1, uint64_t value2); 00093 inline uint64_t GetBPS1(CCTimeType time) {(void) time; return lastSec1;} 00094 inline uint64_t GetBPS1Threadsafe(CCTimeType time) {(void) time; return lastSec1;} 00095 // uint64_t GetBPS2(RakNetTimeUS time); 00096 // void GetBPS1And2(RakNetTimeUS time, uint64_t &out1, uint64_t &out2); 00097 uint64_t GetTotal1(void) const; 00098 // uint64_t GetTotal2(void) const; 00099 00100 struct TimeAndValue2 00101 { 00102 TimeAndValue2(); 00103 ~TimeAndValue2(); 00104 TimeAndValue2(CCTimeType t, uint64_t v1); 00105 // TimeAndValue2(RakNet::TimeUS t, uint64_t v1, uint64_t v2); 00106 // uint64_t value1, value2; 00107 uint64_t value1; 00108 CCTimeType time; 00109 }; 00110 00111 uint64_t total1, lastSec1; 00112 // uint64_t total2, lastSec2; 00113 DataStructures::Queue<TimeAndValue2> dataQueue; 00114 void ClearExpired1(CCTimeType time); 00115 // void ClearExpired2(RakNet::TimeUS time); 00116 }; 00117 00119 class ReliabilityLayer//<ReliabilityLayer> 00120 { 00121 public: 00122 00123 // Constructor 00124 ReliabilityLayer(); 00125 00126 // Destructor 00127 ~ReliabilityLayer(); 00128 00130 void Reset( bool resetVariables, int MTUSize, bool _useSecurity ); 00131 00135 void SetTimeoutTime( RakNet::TimeMS time ); 00136 00139 RakNet::TimeMS GetTimeoutTime(void); 00140 00150 bool HandleSocketReceiveFromConnectedPlayer( 00151 const char *buffer, unsigned int length, SystemAddress &systemAddress, DataStructures::List<PluginInterface2*> &messageHandlerList, int MTUSize, 00152 SOCKET s, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3, unsigned int extraSocketOptions, CCTimeType timeRead); 00153 00157 BitSize_t Receive( unsigned char**data ); 00158 00170 bool Send( char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, CCTimeType currentTime, uint32_t receipt ); 00171 00179 void Update( SOCKET s, SystemAddress &systemAddress, int MTUSize, CCTimeType time, 00180 unsigned bitsPerSecondLimit, 00181 DataStructures::List<PluginInterface2*> &messageHandlerList, 00182 RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3, unsigned int extraSocketOptions); 00183 00186 bool IsDeadConnection( void ) const; 00187 00189 void KillConnection(void); 00190 00193 RakNetStatistics * GetStatistics( RakNetStatistics *rns ); 00194 00196 bool IsOutgoingDataWaiting(void); 00197 bool AreAcksWaiting(void); 00198 00199 // Set outgoing lag and packet loss properties 00200 void ApplyNetworkSimulator( double _maxSendBPS, RakNet::TimeMS _minExtraPing, RakNet::TimeMS _extraPingVariance ); 00201 00204 bool IsNetworkSimulatorActive( void ); 00205 00206 void SetSplitMessageProgressInterval(int interval); 00207 void SetUnreliableTimeout(RakNet::TimeMS timeoutMS); 00209 bool AckTimeout(RakNet::Time curTime); 00210 CCTimeType GetNextSendTime(void) const; 00211 CCTimeType GetTimeBetweenPackets(void) const; 00212 00213 00214 00215 RakNet::TimeMS GetTimeLastDatagramArrived(void) const {return timeLastDatagramArrived;} 00216 00217 // If true, will update time between packets quickly based on ping calculations 00218 //void SetDoFastThroughputReactions(bool fast); 00219 00220 // Encoded as numMessages[unsigned int], message1BitLength[unsigned int], message1Data (aligned), ... 00221 //void GetUndeliveredMessages(RakNet::BitStream *messages, int MTUSize); 00222 00223 private: 00228 void SendBitStream( SOCKET s, SystemAddress &systemAddress, RakNet::BitStream *bitStream, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3, unsigned int extraSocketOptions, CCTimeType currentTime); 00229 00232 BitSize_t WriteToBitStreamFromInternalPacket( RakNet::BitStream *bitStream, const InternalPacket *const internalPacket, CCTimeType curTime ); 00233 00234 00236 InternalPacket* CreateInternalPacketFromBitStream( RakNet::BitStream *bitStream, CCTimeType time ); 00237 00239 unsigned RemovePacketFromResendListAndDeleteOlderReliableSequenced( const MessageNumberType messageNumber, CCTimeType time, DataStructures::List<PluginInterface2*> &messageHandlerList, const SystemAddress &systemAddress ); 00240 00242 void SendAcknowledgementPacket( const DatagramSequenceNumberType messageNumber, CCTimeType time); 00243 00245 bool IsSendThrottled( int MTUSize ); 00246 00248 void UpdateWindowFromPacketloss( CCTimeType time ); 00249 00251 void UpdateWindowFromAck( CCTimeType time ); 00252 00254 BitSize_t GetMaxMessageHeaderLengthBits( void ); 00255 BitSize_t GetMessageHeaderLengthBits( const InternalPacket *const internalPacket ); 00256 00258 void GetSHA1( unsigned char * const buffer, unsigned int nbytes, char code[ SHA1_LENGTH ] ); 00259 00261 bool CheckSHA1( char code[ SHA1_LENGTH ], unsigned char * const buffer, unsigned int nbytes ); 00262 00264 void DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::List<InternalPacket*>&theList, int splitPacketId = -1 ); 00265 00267 void DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::Queue<InternalPacket*>&theList ); 00268 00270 bool IsOlderOrderedPacket( OrderingIndexType newPacketOrderingIndex, OrderingIndexType waitingForPacketOrderingIndex ); 00271 00273 void SplitPacket( InternalPacket *internalPacket ); 00274 00276 void InsertIntoSplitPacketList( InternalPacket * internalPacket, CCTimeType time ); 00277 00279 InternalPacket * BuildPacketFromSplitPacketList( SplitPacketIdType splitPacketId, CCTimeType time, 00280 SOCKET s, SystemAddress &systemAddress, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3, unsigned int extraSocketOptions); 00281 InternalPacket * BuildPacketFromSplitPacketList( SplitPacketChannel *splitPacketChannel, CCTimeType time ); 00282 00284 //void DeleteOldUnreliableSplitPackets( CCTimeType time ); 00285 00288 InternalPacket * CreateInternalPacketCopy( InternalPacket *original, int dataByteOffset, int dataByteLength, CCTimeType time ); 00289 00291 // DataStructures::LinkedList<InternalPacket*> *GetOrderingListAtOrderingStream( unsigned char orderingChannel ); 00292 00294 // void AddToOrderingList( InternalPacket * internalPacket ); 00295 00297 void InsertPacketIntoResendList( InternalPacket *internalPacket, CCTimeType time, bool firstResend, bool modifyUnacknowledgedBytes ); 00298 00300 void FreeMemory( bool freeAllImmediately ); 00301 00303 void FreeThreadSafeMemory( void ); 00304 00305 // Initialize the variables 00306 void InitializeVariables( void ); 00307 00309 bool IsExpiredTime(unsigned int input, CCTimeType currentTime) const; 00310 00311 // Make it so we don't do resends within a minimum threshold of time 00312 void UpdateNextActionTime(void); 00313 00314 00316 //unsigned int IsReceivedPacketHole(unsigned int input, RakNet::TimeMS currentTime) const; 00317 00319 //unsigned int MakeReceivedPacketHole(unsigned int input) const; 00320 00322 unsigned int GetResendListDataSize(void) const; 00323 00325 void UpdateThreadedMemory(void); 00326 00327 void CalculateHistogramAckSize(void); 00328 00329 // Used ONLY for RELIABLE_ORDERED 00330 // RELIABLE_SEQUENCED just returns the newest one 00331 // DataStructures::List<DataStructures::LinkedList<InternalPacket*>*> orderingList; 00332 DataStructures::Queue<InternalPacket*> outputQueue; 00333 int splitMessageProgressInterval; 00334 CCTimeType unreliableTimeout; 00335 00336 struct MessageNumberNode 00337 { 00338 DatagramSequenceNumberType messageNumber; 00339 MessageNumberNode *next; 00340 }; 00341 struct DatagramHistoryNode 00342 { 00343 DatagramHistoryNode() {} 00344 DatagramHistoryNode(MessageNumberNode *_head, CCTimeType ts 00345 ) : 00346 head(_head), timeSent(ts) 00347 {} 00348 MessageNumberNode *head; 00349 CCTimeType timeSent; 00350 }; 00351 // Queue length is programmatically restricted to DATAGRAM_MESSAGE_ID_ARRAY_LENGTH 00352 // This is essentially an O(1) lookup to get a DatagramHistoryNode given an index 00353 // datagramHistory holds a linked list of MessageNumberNode. Each MessageNumberNode refers to one element in resendList which can be cleared on an ack. 00354 DataStructures::Queue<DatagramHistoryNode> datagramHistory; 00355 DataStructures::MemoryPool<MessageNumberNode> datagramHistoryMessagePool; 00356 00357 00358 void RemoveFromDatagramHistory(DatagramSequenceNumberType index); 00359 MessageNumberNode* GetMessageNumberNodeByDatagramIndex(DatagramSequenceNumberType index, CCTimeType *timeSent); 00360 void AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, CCTimeType timeSent); 00361 MessageNumberNode* AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, DatagramSequenceNumberType messageNumber, CCTimeType timeSent); 00362 MessageNumberNode* AddSubsequentToDatagramHistory(MessageNumberNode *messageNumberNode, DatagramSequenceNumberType messageNumber); 00363 DatagramSequenceNumberType datagramHistoryPopCount; 00364 00365 DataStructures::MemoryPool<InternalPacket> internalPacketPool; 00366 // DataStructures::BPlusTree<DatagramSequenceNumberType, InternalPacket*, RESEND_TREE_ORDER> resendTree; 00367 InternalPacket *resendBuffer[RESEND_BUFFER_ARRAY_LENGTH]; 00368 InternalPacket *resendLinkedListHead; 00369 InternalPacket *unreliableLinkedListHead; 00370 void RemoveFromUnreliableLinkedList(InternalPacket *internalPacket); 00371 void AddToUnreliableLinkedList(InternalPacket *internalPacket); 00372 // unsigned int numPacketsOnResendBuffer; 00373 //unsigned int blockWindowIncreaseUntilTime; 00374 // DataStructures::RangeList<DatagramSequenceNumberType> acknowlegements; 00375 // Resend list is a tree of packets we need to resend 00376 00377 // Set to the current time when the resend queue is no longer empty 00378 // Set to zero when it becomes empty 00379 // Set to the current time if it is not zero, and we get incoming data 00380 // If the current time - timeResendQueueNonEmpty is greater than a threshold, we are disconnected 00381 // CCTimeType timeResendQueueNonEmpty; 00382 RakNet::TimeMS timeLastDatagramArrived; 00383 00384 00385 // If we backoff due to packetloss, don't remeasure until all waiting resends have gone out or else we overcount 00386 // bool packetlossThisSample; 00387 // int backoffThisSample; 00388 // unsigned packetlossThisSampleResendCount; 00389 // CCTimeType lastPacketlossTime; 00390 00391 //DataStructures::Queue<InternalPacket*> sendPacketSet[ NUMBER_OF_PRIORITIES ]; 00392 DataStructures::Heap<reliabilityHeapWeightType, InternalPacket*, false> outgoingPacketBuffer; 00393 reliabilityHeapWeightType outgoingPacketBufferNextWeights[NUMBER_OF_PRIORITIES]; 00394 void InitHeapWeights(void); 00395 reliabilityHeapWeightType GetNextWeight(int priorityLevel); 00396 // unsigned int messageInSendBuffer[NUMBER_OF_PRIORITIES]; 00397 // double bytesInSendBuffer[NUMBER_OF_PRIORITIES]; 00398 00399 00400 DataStructures::OrderedList<SplitPacketIdType, SplitPacketChannel*, SplitPacketChannelComp> splitPacketChannelList; 00401 00402 MessageNumberType sendReliableMessageNumberIndex; 00403 MessageNumberType internalOrderIndex; 00404 //unsigned int windowSize; 00405 RakNet::BitStream updateBitStream; 00406 bool deadConnection, cheater; 00407 SplitPacketIdType splitPacketId; 00408 RakNet::TimeMS timeoutTime; // How long to wait in MS before timing someone out 00409 //int MAX_AVERAGE_PACKETS_PER_SECOND; // Name says it all 00410 // int RECEIVED_PACKET_LOG_LENGTH, requestedReceivedPacketLogLength; // How big the receivedPackets array is 00411 // unsigned int *receivedPackets; 00412 RakNetStatistics statistics; 00413 00414 // Algorithm for blending ordered and sequenced on the same channel: 00415 // 1. Each ordered message transmits OrderingIndexType orderedWriteIndex. There are NUMBER_OF_ORDERED_STREAMS independent values of these. The value 00416 // starts at 0. Every time an ordered message is sent, the value increments by 1 00417 // 2. Each sequenced message contains the current value of orderedWriteIndex for that channel, and additionally OrderingIndexType sequencedWriteIndex. 00418 // sequencedWriteIndex resets to 0 every time orderedWriteIndex increments. It increments by 1 every time a sequenced message is sent. 00419 // 3. The receiver maintains the next expected value for the orderedWriteIndex, stored in orderedReadIndex. 00420 // 4. As messages arrive: 00421 // If a message has the current ordering index, and is sequenced, and is < the current highest sequence value, discard 00422 // If a message has the current ordering index, and is sequenced, and is >= the current highest sequence value, return immediately 00423 // If a message has a greater ordering index, and is sequenced or ordered, buffer it 00424 // If a message has the current ordering index, and is ordered, buffer, then push off messages from buffer 00425 // 5. Pushing off messages from buffer: 00426 // Messages in buffer are put in a minheap. The value of each node is calculated such that messages are returned: 00427 // A. (lowest ordering index, lowest sequence index) 00428 // B. (lowest ordering index, no sequence index) 00429 // Messages are pushed off until the heap is empty, or the next message to be returned does not preserve the ordered index 00430 // For an empty heap, the heap weight should start at the lowest value based on the next expected ordering index, to avoid variable overflow 00431 00432 // Sender increments this by 1 for every ordered message sent 00433 OrderingIndexType orderedWriteIndex[NUMBER_OF_ORDERED_STREAMS]; 00434 // Sender increments by 1 for every sequenced message sent. Resets to 0 when an ordered message is sent 00435 OrderingIndexType sequencedWriteIndex[NUMBER_OF_ORDERED_STREAMS]; 00436 // Next expected index for ordered messages. 00437 OrderingIndexType orderedReadIndex[NUMBER_OF_ORDERED_STREAMS]; 00438 // Highest value received for sequencedWriteIndex for the current value of orderedReadIndex on the same channel. 00439 OrderingIndexType highestSequencedReadIndex[NUMBER_OF_ORDERED_STREAMS]; 00440 DataStructures::Heap<reliabilityHeapWeightType, InternalPacket*, false> orderingHeaps[NUMBER_OF_ORDERED_STREAMS]; 00441 OrderingIndexType heapIndexOffsets[NUMBER_OF_ORDERED_STREAMS]; 00442 00443 00444 00445 00446 00447 00448 00449 // CCTimeType histogramStart; 00450 // unsigned histogramBitsSent; 00451 00452 00461 // DataStructures::Queue<CCTimeType> hasReceivedPacketQueue; 00462 DataStructures::Queue<bool> hasReceivedPacketQueue; 00463 DatagramSequenceNumberType receivedPacketsBaseIndex; 00464 bool resetReceivedPackets; 00465 00466 CCTimeType lastUpdateTime; 00467 CCTimeType timeBetweenPackets, nextSendTime; 00468 00469 00470 00471 // CCTimeType ackPingSamples[ACK_PING_SAMPLES_SIZE]; // Must be range of unsigned char to wrap ackPingIndex properly 00472 CCTimeType ackPingSum; 00473 unsigned char ackPingIndex; 00474 //CCTimeType nextLowestPingReset; 00475 RemoteSystemTimeType remoteSystemTime; 00476 // bool continuousSend; 00477 // CCTimeType lastTimeBetweenPacketsIncrease,lastTimeBetweenPacketsDecrease; 00478 // Limit changes in throughput to once per ping - otherwise even if lag starts we don't know about it 00479 // In the meantime the connection is flooded and overrun. 00480 CCTimeType nextAllowedThroughputSample; 00481 bool bandwidthExceededStatistic; 00482 00483 // If Update::maxBitsPerSecond > 0, then throughputCapCountdown is used as a timer to prevent sends for some amount of time after each send, depending on 00484 // the amount of data sent 00485 long long throughputCapCountdown; 00486 00487 unsigned receivePacketCount; 00488 00489 #ifdef _DEBUG 00490 struct DataAndTime//<InternalPacket> 00491 { 00492 SOCKET s; 00493 char data[ MAXIMUM_MTU_SIZE ]; 00494 unsigned int length; 00495 RakNet::TimeMS sendTime; 00496 // SystemAddress systemAddress; 00497 unsigned short remotePortRakNetWasStartedOn_PS3; 00498 unsigned int extraSocketOptions; 00499 }; 00500 DataStructures::Queue<DataAndTime*> delayList; 00501 00502 // Internet simulator 00503 double packetloss; 00504 RakNet::TimeMS minExtraPing, extraPingVariance; 00505 #endif 00506 00507 CCTimeType elapsedTimeSinceLastUpdate; 00508 00509 CCTimeType nextAckTimeToSend; 00510 00511 00512 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL==1 00513 RakNet::CCRakNetSlidingWindow congestionManager; 00514 #else 00515 RakNet::CCRakNetUDT congestionManager; 00516 #endif 00517 00518 00519 uint32_t unacknowledgedBytes; 00520 00521 bool ResendBufferOverflow(void) const; 00522 void ValidateResendList(void) const; 00523 void ResetPacketsAndDatagrams(void); 00524 void PushPacket(CCTimeType time, InternalPacket *internalPacket, bool isReliable); 00525 void PushDatagram(void); 00526 bool TagMostRecentPushAsSecondOfPacketPair(void); 00527 void ClearPacketsAndDatagrams(bool releaseToInternalPacketPoolIfNeedsAck); 00528 void MoveToListHead(InternalPacket *internalPacket); 00529 void RemoveFromList(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes); 00530 void AddToListTail(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes); 00531 void PopListHead(bool modifyUnacknowledgedBytes); 00532 bool IsResendQueueEmpty(void) const; 00533 void SortSplitPacketList(DataStructures::List<InternalPacket*> &data, unsigned int leftEdge, unsigned int rightEdge) const; 00534 void SendACKs(SOCKET s, SystemAddress &systemAddress, CCTimeType time, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3, unsigned int extraSocketOptions); 00535 00536 DataStructures::List<InternalPacket*> packetsToSendThisUpdate; 00537 DataStructures::List<bool> packetsToDeallocThisUpdate; 00538 // boundary is in packetsToSendThisUpdate, inclusive 00539 DataStructures::List<unsigned int> packetsToSendThisUpdateDatagramBoundaries; 00540 DataStructures::List<bool> datagramsToSendThisUpdateIsPair; 00541 DataStructures::List<unsigned int> datagramSizesInBytes; 00542 BitSize_t datagramSizeSoFar; 00543 BitSize_t allDatagramSizesSoFar; 00544 double totalUserDataBytesAcked; 00545 CCTimeType timeOfLastContinualSend; 00546 CCTimeType timeToNextUnreliableCull; 00547 00548 // This doesn't need to be a member, but I do it to avoid reallocations 00549 DataStructures::RangeList<DatagramSequenceNumberType> incomingAcks; 00550 00551 // Every 16 datagrams, we make sure the 17th datagram goes out the same update tick, and is the same size as the 16th 00552 int countdownToNextPacketPair; 00553 InternalPacket* AllocateFromInternalPacketPool(void); 00554 void ReleaseToInternalPacketPool(InternalPacket *ip); 00555 00556 DataStructures::RangeList<DatagramSequenceNumberType> acknowlegements; 00557 DataStructures::RangeList<DatagramSequenceNumberType> NAKs; 00558 bool remoteSystemNeedsBAndAS; 00559 00560 unsigned int GetMaxDatagramSizeExcludingMessageHeaderBytes(void); 00561 BitSize_t GetMaxDatagramSizeExcludingMessageHeaderBits(void); 00562 00563 // ourOffset refers to a section within externallyAllocatedPtr. Do not deallocate externallyAllocatedPtr until all references are lost 00564 void AllocInternalPacketData(InternalPacket *internalPacket, InternalPacketRefCountedData **refCounter, unsigned char *externallyAllocatedPtr, unsigned char *ourOffset); 00565 // Set the data pointer to externallyAllocatedPtr, do not allocate 00566 void AllocInternalPacketData(InternalPacket *internalPacket, unsigned char *externallyAllocatedPtr); 00567 // Allocate new 00568 void AllocInternalPacketData(InternalPacket *internalPacket, unsigned int numBytes, bool allowStack, const char *file, unsigned int line); 00569 void FreeInternalPacketData(InternalPacket *internalPacket, const char *file, unsigned int line); 00570 DataStructures::MemoryPool<InternalPacketRefCountedData> refCountedDataPool; 00571 00572 BPSTracker bpsMetrics[RNS_PER_SECOND_METRICS_COUNT]; 00573 CCTimeType lastBpsClear; 00574 00575 #if LIBCAT_SECURITY==1 00576 public: 00577 cat::AuthenticatedEncryption* GetAuthenticatedEncryption(void) { return &auth_enc; } 00578 00579 protected: 00580 cat::AuthenticatedEncryption auth_enc; 00581 bool useSecurity; 00582 #endif // LIBCAT_SECURITY 00583 }; 00584 00585 } // namespace RakNet 00586 00587 #endif
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.