class TLVReader

Defined at line 95 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

Provides a memory efficient parser for data encoded in Weave TLV format.

TLVReader implements a forward-only, “pull-style” parser for Weave TLV data. The TLVReader

object operates as a cursor that can be used to iterate over a sequence of TLV elements

and interpret their contents. When positioned on an element, applications can make calls

to the reader's Get() methods to query the current element’s type and tag, and to extract

any associated value. The reader’s Next() method is used to advance from element to element.

A TLVReader object is always positioned either before, on or after a TLV element. When first

initialized, a TLVReader is positioned immediately before the first element of the encoding.

To begin reading, an application must make an initial call to the Next() method to position

the reader on the first element. When a container element is encountered--either a structure,

an array or a path--the OpenContainer() or EnterContainer() methods can be used to iterate

through the contents of the container.

When the reader reaches the end of a TLV encoding, or the last element within a container,

it signals the application by returning a WEAVE_END_OF_TLV error from the Next() method.

The reader will continue to return WEAVE_END_OF_TLV until it is reinitialized, or the current

container is exited (via CloseContainer() / ExitContainer()).

A TLVReader object can parse data directly from a fixed input buffer, or from a chain of one

or more PacketBuffers. Additionally, applications can supply a

function to

feed data to the reader from an arbitrary source, e.g. a socket or a serial port.

Public Members

uint32_t ImplicitProfileId
void * AppData
GetNextBufferFunct GetNextBuffer

Protected Members

uint64_t mElemTag
uint64_t mElemLenOrVal
uintptr_t mBufHandle
const uint8_t * mReadPoint
const uint8_t * mBufEnd
uint32_t mLenRead
uint32_t mMaxLen
TLVType mContainerType
uint16_t mControlByte

Public Methods

WEAVE_ERROR Get (bool & v)
WEAVE_ERROR Get (int8_t & v)
WEAVE_ERROR Get (int16_t & v)
WEAVE_ERROR Get (int32_t & v)
WEAVE_ERROR Get (int64_t & v)
WEAVE_ERROR Get (uint8_t & v)
WEAVE_ERROR Get (uint16_t & v)
WEAVE_ERROR Get (uint32_t & v)
WEAVE_ERROR Get (uint64_t & v)
WEAVE_ERROR Get (float & v)
WEAVE_ERROR Get (double & v)
WEAVE_ERROR DupBytes (uint8_t *& buf, uint32_t & dataLen)
WEAVE_ERROR DupString (char *& buf)
uintptr_t GetBufHandle ()

Defined at line 144 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

void Init (const TLVReader & aReader)

*** See WeaveTLVReader.cpp file for API documentation ***

void Init (const uint8_t * data, uint32_t dataLen)
void Init (PacketBuffer * buf, uint32_t maxLen)
void Init (PacketBuffer * buf, uint32_t maxLen, bool allowDiscontiguousBuffers)
WEAVE_ERROR Next ()
WEAVE_ERROR Next (TLVType expectedType, uint64_t expectedTag)
TLVType GetType ()
uint64_t GetTag ()
uint32_t GetLength ()
uint16_t GetControlByte ()
WEAVE_ERROR GetBytes (uint8_t * buf, uint32_t bufSize)
WEAVE_ERROR GetString (char * buf, uint32_t bufSize)
WEAVE_ERROR GetDataPtr (const uint8_t *& data)
WEAVE_ERROR EnterContainer (TLVType & outerContainerType)
WEAVE_ERROR ExitContainer (TLVType outerContainerType)
WEAVE_ERROR OpenContainer (TLVReader & containerReader)
WEAVE_ERROR CloseContainer (TLVReader & containerReader)
TLVType GetContainerType ()
uint32_t GetLengthRead ()

Defined at line 140 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

uint32_t GetRemainingLength ()

Defined at line 141 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

const uint8_t * GetReadPoint ()

Defined at line 143 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

WEAVE_ERROR VerifyEndOfContainer ()
WEAVE_ERROR Skip ()

Protected Methods

bool IsContainerOpen ()

Defined at line 170 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

WEAVE_ERROR ReadElement ()
void ClearElementState ()
void SetContainerOpen (bool aContainerOpen)

Defined at line 171 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h

WEAVE_ERROR SkipData ()
WEAVE_ERROR SkipToEndOfContainer ()
WEAVE_ERROR VerifyElement ()
uint64_t ReadTag (TLVTagControl tagControl, const uint8_t *& p)
WEAVE_ERROR EnsureData (WEAVE_ERROR noDataErr)
WEAVE_ERROR ReadData (uint8_t * buf, uint32_t len)
WEAVE_ERROR GetElementHeadLength (uint8_t & elemHeadBytes)
TLVElementType ElementType ()
WEAVE_ERROR GetNextPacketBuffer (TLVReader & reader, uintptr_t & bufHandle, const uint8_t *& bufStart, uint32_t & bufLen)
WEAVE_ERROR FailGetNextBuffer (TLVReader & reader, uintptr_t & bufHandle, const uint8_t *& bufStart, uint32_t & bufLen)

Friends

class TLVUpdater
class TLVWriter