epoc32/include/sbque.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // sbque.h - TCP sequence block queue
       
    15 // Defines a queue for keeping tabs on contiguous blocks of sequence numbers.
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file sbque.h
       
    22  @publishedAll
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __SBQUE_H__
       
    27 #define __SBQUE_H__
       
    28 
       
    29 #include "tcpseq.h"
       
    30 
       
    31 /** Sequence Block.
       
    32 @publishedAll
       
    33 @released
       
    34 */
       
    35 class SequenceBlock
       
    36 	{
       
    37   	friend class SequenceBlockQueue;
       
    38 
       
    39 private:
       
    40 
       
    41     SequenceBlock(TTcpSeqNum aLeft, TTcpSeqNum aRight) : iLeft(aLeft), iRight(aRight) {}
       
    42     TDblQueLink iLink;
       
    43 
       
    44 public:
       
    45 
       
    46     TTcpSeqNum  iLeft;
       
    47     TTcpSeqNum  iRight;
       
    48 	};
       
    49 
       
    50 /** Sequence Block Queue.
       
    51 @publishedAll
       
    52 @released
       
    53 */
       
    54 class SequenceBlockQueue : public TDblQue<SequenceBlock>
       
    55 	{
       
    56  public:
       
    57     SequenceBlockQueue() : TDblQue<SequenceBlock>(_FOFF(SequenceBlock, iLink)) { iCount = 0; iOrdered = ETrue; }
       
    58     inline ~SequenceBlockQueue() { Clear(); }
       
    59     IMPORT_C SequenceBlock *AddOrdered(TTcpSeqNum aLeft, TTcpSeqNum aRight);
       
    60     IMPORT_C SequenceBlock *AddUnordered(TTcpSeqNum aLeft, TTcpSeqNum aRight);
       
    61     inline SequenceBlock *AddOrdered(const SequenceBlock *aBlock) { return AddOrdered(aBlock->iLeft, aBlock->iRight); }
       
    62     inline SequenceBlock *AddUnordered(const SequenceBlock *aBlock) { return AddUnordered(aBlock->iLeft, aBlock->iRight); }
       
    63     IMPORT_C SequenceBlock *Find(TTcpSeqNum aSeq);
       
    64     IMPORT_C TInt FindGap(TTcpSeqNum& aLeft, TTcpSeqNum& aRight);
       
    65     IMPORT_C void Prune(TTcpSeqNum aLeft);
       
    66     IMPORT_C void Limit(TInt aCount);
       
    67     IMPORT_C void Clear();
       
    68     inline TInt Count() const { return iCount; }
       
    69     inline TInt ByteCount() const { return iBytes; }
       
    70 
       
    71 private:
       
    72     TInt iCount;
       
    73     TInt iBytes;
       
    74     TBool iOrdered;
       
    75 	};
       
    76 
       
    77 typedef TDblQueIter<SequenceBlock> SequenceBlockQueueIter;
       
    78 
       
    79 #endif