|
1 // Copyright (c) 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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: Chain of shared buffers |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __COMMSBUFCHAIN_H__ |
|
17 #define __COMMSBUFCHAIN_H__ |
|
18 #include <e32base.h> |
|
19 |
|
20 class TCommsBufAllocator; |
|
21 class RCommsBuf; |
|
22 |
|
23 /* |
|
24 Chain of RCommsBufs. |
|
25 @publishedPartner |
|
26 **/ |
|
27 |
|
28 class RCommsBufChain |
|
29 { |
|
30 |
|
31 friend class TCommsBufIter; |
|
32 friend class RCommsBufQ; |
|
33 |
|
34 public: |
|
35 inline RCommsBufChain(); |
|
36 inline RCommsBufChain(RCommsBuf* aHeadBuf); |
|
37 |
|
38 inline TBool IsEmpty() const; |
|
39 |
|
40 IMPORT_C TInt Length() const; |
|
41 |
|
42 |
|
43 IMPORT_C void Assign(RCommsBufChain& aChain); |
|
44 |
|
45 IMPORT_C void Append(RCommsBufChain& aChain); |
|
46 IMPORT_C void Append(RCommsBuf* aBuf); |
|
47 IMPORT_C TInt Append(TInt aLen); |
|
48 |
|
49 IMPORT_C void Prepend(RCommsBufChain& aChain); |
|
50 IMPORT_C void Prepend(RCommsBuf* aBuf); |
|
51 IMPORT_C TInt Prepend(TInt aLen); |
|
52 |
|
53 IMPORT_C TInt Alloc(TInt aSize, TCommsBufAllocator& aAccessor); |
|
54 IMPORT_C TInt Alloc(TInt aSize, TInt aMinBufSize, TCommsBufAllocator& aAccessor); |
|
55 IMPORT_C TInt Alloc(TInt aSize, TInt aMinBufSize, TInt aMaxBufSize, TCommsBufAllocator& aAccessor); |
|
56 |
|
57 IMPORT_C TInt Split(TInt aOffset, RCommsBufChain& aNewChain); |
|
58 |
|
59 IMPORT_C TInt Align(TInt aSize); |
|
60 |
|
61 IMPORT_C void Write(const TDesC8& aDes, TInt aOffset =0); |
|
62 IMPORT_C void Read(TDes8& aDes, TInt aOffset =0) const; |
|
63 |
|
64 |
|
65 IMPORT_C void Free(); // Free the chain. |
|
66 |
|
67 IMPORT_C void TrimStart(TInt nBytes); |
|
68 IMPORT_C void TrimEnd(TInt anOffset); |
|
69 |
|
70 |
|
71 protected: |
|
72 IMPORT_C RCommsBuf* Goto(TInt aDataOffset, TInt& aBufDataOffset, TInt& aBufDataLen, RCommsBuf* &resPrevBuf) const; |
|
73 inline RCommsBuf* Goto(TInt aDataOffset, TInt& aBufDataOffset, TInt& aBufDataLen) const; |
|
74 IMPORT_C RCommsBuf* Last() const; |
|
75 |
|
76 private: |
|
77 inline RCommsBuf* First(); |
|
78 inline const RCommsBuf* First() const; |
|
79 RCommsBuf* Last(); |
|
80 |
|
81 |
|
82 protected: |
|
83 RCommsBuf* iNext; |
|
84 }; |
|
85 |
|
86 #include <comms-infras/commsbufchain.inl> |
|
87 #endif // __COMMSBUFCHAIN_H__ |
|
88 |
|
89 |