|
1 /** |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Buffer Manager for Protocols |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 */ |
|
25 |
|
26 #if !defined(__MBufChain_inl__) |
|
27 #define __MBufChain_inl__ |
|
28 |
|
29 //////////////////////////////////////////////////////////////////////////////// |
|
30 // MBUF CHAIN |
|
31 //////////////////////////////////////////////////////////////////////////////// |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 inline RMBufChain::RMBufChain() |
|
37 { iNext = NULL; } |
|
38 |
|
39 /** |
|
40 Constructor |
|
41 */ |
|
42 inline RMBufChain::RMBufChain(RMBuf* aChain) : iNext(aChain) |
|
43 { iNext = aChain; } |
|
44 |
|
45 /** |
|
46 Rerurns the first in the chain |
|
47 @return the first in the chain |
|
48 */ |
|
49 inline RMBuf* RMBufChain::First() |
|
50 { return iNext; } |
|
51 |
|
52 /** |
|
53 Returns the first in the chain |
|
54 @return the first in the chain |
|
55 */ |
|
56 inline const RMBuf* RMBufChain::First() const |
|
57 { return iNext; } |
|
58 |
|
59 /** |
|
60 operator = |
|
61 */ |
|
62 inline RMBufChain& RMBufChain::operator =(RMBuf* aChain) |
|
63 { iNext = aChain; return *this; } |
|
64 |
|
65 /** |
|
66 Initializes the members (iNext = NULL) |
|
67 */ |
|
68 inline void RMBufChain::Init() |
|
69 { iNext = NULL; } |
|
70 |
|
71 /** |
|
72 Check if empty, if empty returns true |
|
73 */ |
|
74 inline TBool RMBufChain::IsEmpty() const |
|
75 { return iNext==NULL; } |
|
76 |
|
77 #ifndef __KERNEL_MODE__ |
|
78 /** |
|
79 Links a chain to the chain in the chain |
|
80 @param aChain The chain to be linked |
|
81 */ |
|
82 inline void RMBufChain::Link(RMBufChain &aChain) |
|
83 { if (!IsEmpty()) iNext->LinkPkt(aChain); } |
|
84 |
|
85 /** |
|
86 Unlink the nfirst in the chain |
|
87 */ |
|
88 inline void RMBufChain::Unlink() |
|
89 { if (!IsEmpty()) iNext->UnlinkPkt(); } |
|
90 |
|
91 /** |
|
92 Returns next in the chain if there is next else returns the current |
|
93 */ |
|
94 inline RMBufChain& RMBufChain::Next() |
|
95 { return IsEmpty() ? *this : iNext->NextPkt(); } |
|
96 |
|
97 /** |
|
98 Returns next in the chain if there is next else returns the current |
|
99 */ |
|
100 inline const RMBufChain& RMBufChain::Next() const |
|
101 { return IsEmpty() ? *this : iNext->NextPkt(); } |
|
102 |
|
103 /** |
|
104 Goto specified byte offset into an Mbuf chain |
|
105 Used as part of copyin/out, split etc to position |
|
106 MBuf pointer and offset from start of iBuffer. |
|
107 @param anOffset The offset |
|
108 @param resBuf result buffer |
|
109 @param resOffset result offset |
|
110 @param resLength result length |
|
111 @param resPrevBuf result previous Buf in the chain |
|
112 @return ETrue if successful |
|
113 */ |
|
114 inline TBool RMBufChain::Goto(TInt anOffset, RMBuf* &resBuf, TInt& resOffset, TInt& resLength) const |
|
115 { RMBuf* prev; return Goto(anOffset, resBuf, resOffset, resLength, prev); } |
|
116 |
|
117 #endif // KERNEL_MODE |
|
118 |
|
119 #endif // __MBufChain_inl__ |