TPacketPoker Class Reference

class TPacketPoker

Provides a utility for linear scanning of a chain of RMBuf objects (an RMBufChain).

An object of this type maintains a current point in the RMBufChain. This point can only move forward, and a leave occurs if the point advances beyond the end of the chain.

Any pointers and aligns arranged before the current point, remain valid: for example, you can save a reference and advance the pointer, and the reference remains usable.

If instead you need to go to a single specified offset, then use RMBufChain::Goto() or RMBufPacketPeek::Access().

Post-condition
A Generic implementation assert: after construct, iTail == 0 iff iCurrent == 0 (all scanned), or in other words: as long as there are bytes after current point, iTail will be non-zero (and More() returns ETrue). All methods maintain this invariant or leave, if impossible.
Some other utility methods, not directly related to scanning, are also included.
Since
v7.0
Public Member Functions
TPacketPoker(RMBufChain &)
TBool AtBegin()
IMPORT_C TBoolIsExtensionHeader(TInt)
TBool More()
TUint8 *Ptr()
TUint8 *ReferenceAndSkipL(TInt)
TUint8 *ReferenceL(TInt)
TInt Remainder()
voidSkipL(TInt)
Private Member Functions
IMPORT_C TUint8 *AdjustL(TInt)
IMPORT_C voidOverL(TInt)
Private Attributes
RMBuf *iCurrent
TInt iOffset
TInt iTail

Constructor & Destructor Documentation

TPacketPoker(RMBufChain &)

IMPORT_CTPacketPoker(RMBufChain &aChain)

Constructor.

Parameters

RMBufChain & aChainThe RMBuf chain to be poked.

Member Functions Documentation

AdjustL(TInt)

IMPORT_C TUint8 *AdjustL(TIntaSize)[private]

Arrange contiguous run of bytes.

Arragen content of RMBuf chain so that starting from the current offset, a number of bytes is accessible in contiguous memory.

leave
KErrEof, if request cannot be satisfied.

Parameters

TInt aSizeThe requested length,

AtBegin()

TBool AtBegin()const [inline]

Tests whether the current point is at the beginning of an RMBuf.

IsExtensionHeader(TInt)

IMPORT_C TBoolIsExtensionHeader(TIntaProtocolId)[static]

Tests whether a protocol is a known IPv6 extension header using the standard format.

Parameters

TInt aProtocolIdProtocol ID to test.

More()

TBool More()const [inline]

Tests whether there is more data to scan.

OverL(TInt)

IMPORT_C voidOverL(TIntaSize)[private]

Skip over bytes.

leave
KErrEof, if skipped past end of chain.

Parameters

TInt aSizeThe number of bytes to skip

Ptr()

TUint8 *Ptr()const [inline]

Raw pointer to the current point (can be invalid, if iTail = 0).

Note:

Internal "unsafe" method

ReferenceAndSkipL(TInt)

TUint8 *ReferenceAndSkipL(TIntaSize)[inline]

Gets a pointer to the current point, such that at least the specified minimum number of bytes can be read, and moves the point the specified number of bytes forward.

leave
KErrEof if the request cannot be satisfied.

Parameters

TInt aSizeSpecified minimum number of bytes to be read through the returned pointer, and the number of bytes to move forward

ReferenceL(TInt)

TUint8 *ReferenceL(TIntaSize = 1)[inline]

Gets a pointer to the current point, such that at least the specified minimum number of bytes can be read.

leave
KErrEof if the request cannot be satisfied.

Parameters

TInt aSize = 1Specified minimum number of bytes to be read through the returned pointer.

Remainder()

TInt Remainder()const [inline]

Gets the length of the contiguous space after the current point.

SkipL(TInt)

voidSkipL(TIntaSize)[inline]

Moves the current point forward a specified number of bytes.

leave
KErrEof if the request cannot be satisfied.

Parameters

TInt aSizeNumber of bytes to move forward

Member Data Documentation

RMBuf * iCurrent

RMBuf *iCurrent[private]

The RMBuf of the current point.

TInt iOffset

TInt iOffset[private]

The offset of the current point in the RMBuf.

TInt iTail

TInt iTail[private]

Remaining bytes starting from the current point in the RMBuf.