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

Constructor & Destructor Documentation

TPacketPoker(RMBufChain &)

IMPORT_C TPacketPoker ( RMBufChain & aChain )

Constructor.

Parameters

RMBufChain & aChain The RMBuf chain to be poked.

Member Functions Documentation

AdjustL(TInt)

IMPORT_C TUint8 * AdjustL ( TInt aSize ) [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 aSize The requested length,

AtBegin()

TBool AtBegin ( ) const [inline]

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

IsExtensionHeader(TInt)

IMPORT_C TBool IsExtensionHeader ( TInt aProtocolId ) [static]

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

Parameters

TInt aProtocolId Protocol ID to test.

More()

TBool More ( ) const [inline]

Tests whether there is more data to scan.

OverL(TInt)

IMPORT_C void OverL ( TInt aSize ) [private]

Skip over bytes.

leave
KErrEof, if skipped past end of chain.

Parameters

TInt aSize The 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 ( TInt aSize ) [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 aSize Specified minimum number of bytes to be read through the returned pointer, and the number of bytes to move forward

ReferenceL(TInt)

TUint8 * ReferenceL ( TInt aSize = 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 = 1 Specified 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)

void SkipL ( TInt aSize ) [inline]

Moves the current point forward a specified number of bytes.

leave
KErrEof if the request cannot be satisfied.

Parameters

TInt aSize Number 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 .