This namespace includes types and utility interfaces for managing and working with Weave TLV.
Functions
|
Count(const TLVReader & aReader, size_t & aCount)
|
Count the number of TLV elements within the specified TLV reader, descending into arrays or structures.
|
Count(const TLVReader & aReader, size_t & aCount, const bool aRecurse)
|
Count the number of TLV elements within the specified TLV reader, optionally descending into arrays or structures.
|
CountHandler(const TLVReader & aReader, size_t aDepth, void *aContext)
|
Increment the counter when iterating through the TLV data.
|
Find(const TLVReader & aReader, const uint64_t & aTag, TLVReader & aResult)
|
Search for the specified tag within the provided TLV reader.
|
Find(const TLVReader & aReader, const uint64_t & aTag, TLVReader & aResult, const bool aRecurse)
|
Search for the specified tag within the provided TLV reader, optionally descending into arrays or structures.
|
Find(const TLVReader & aReader, IterateHandler aPredicate, void *aContext, TLVReader & aResult)
|
Search for the first element matching the predicate within the TLV reader descending into arrays or structures.
|
Find(const TLVReader & aReader, IterateHandler aPredicate, void *aContext, TLVReader & aResult, const bool aRecurse)
|
Search for the first element matching the predicate within the TLV reader optionally descending into arrays or structures.
|
FindHandler(const TLVReader & aReader, size_t aDepth, void *aContext)
|
Search for the specified tag within the provided TLV reader.
|
FindPredicateHandler(const TLVReader & aReader, size_t aDepth, void *aContext)
|
|
Iterate(TLVReader & aReader, size_t aDepth, IterateHandler aHandler, void *aContext, bool aRecurse)
|
Iterate through the TLV data referenced by aReader and invoke aHandler for each visited TLV element in the context of aContext.
|
Iterate(const TLVReader & aReader, IterateHandler aHandler, void *aContext)
|
Iterate through the TLV data referenced by aReader and invoke aHandler for each visited TLV element in the context of aContext.
|
Iterate(const TLVReader & aReader, IterateHandler aHandler, void *aContext, const bool aRecurse)
|
Iterate through the TLV data referenced by aReader and invoke aHandler for each visited TLV element in the context of aContext.
|
Find
WEAVE_ERROR Find(
const TLVReader & aReader,
IterateHandler aPredicate,
void *aContext,
TLVReader & aResult
)
Search for the first element matching the predicate within the TLV reader descending into arrays or structures.
The aPredicate is applied to each visited TLV element; the aPredicate shall return WEAVE_ERROR_MAX for the matching elements, WEAVE_NO_ERROR for non-matching elements, and any other value to terminate the search.
Details |
Parameters |
[in] aReader
|
A read-only reference to the TLV reader in which to find the element matching the predicate.
|
[in] aPredicate
|
A predicate to be applied to each TLV element. To support the code reuse, aPredicate has the IterateHandler type. The return value of aPredicate controls the search: a WEAVE_ERROR_MAX signals that desired element has been found, WEAVE_NO_ERROR signals that the desired element has not been found, and all other values signal that the saerch should be terminated.
|
[in] aContext
|
An optional pointer to caller-provided context data.
|
[out] aResult
|
A reference to storage to a TLV reader which will be positioned at the specified tag on success.
|
|
Return Values |
WEAVE_NO_ERROR
|
On success.
|
WEAVE_ERROR_TLV_TAG_NOT_FOUND
|
If the specified aPredicate did not locate the specified element
|
|
Find
WEAVE_ERROR Find(
const TLVReader & aReader,
IterateHandler aPredicate,
void *aContext,
TLVReader & aResult,
const bool aRecurse
)
Search for the first element matching the predicate within the TLV reader optionally descending into arrays or structures.
The aPredicate is applied to each visited TLV element; the aPredicate shall return WEAVE_ERROR_MAX for the matching elements, WEAVE_NO_ERROR for non-matching elements, and any other value to terminate the search.
Details |
Parameters |
[in] aReader
|
A read-only reference to the TLV reader in which to find the element matching the predicate.
|
[in] aPredicate
|
A predicate to be applied to each TLV element. To support the code reuse, aPredicate has the IterateHandler type. The return value of aPredicate controls the search: a WEAVE_ERROR_MAX signals that desired element has been found, WEAVE_NO_ERROR signals that the desired element has not been found, and all other values signal that the saerch should be terminated.
|
[in] aContext
|
An optional pointer to caller-provided context data.
|
[out] aResult
|
A reference to storage to a TLV reader which will be positioned at the specified tag on success.
|
[in] aRecurse
|
A boolean indicating whether (true) or not (false) any encountered arrays or structures should be descended into.
|
|
Return Values |
WEAVE_NO_ERROR
|
On success.
|
WEAVE_ERROR_TLV_TAG_NOT_FOUND
|
If the specified aPredicate did not locate the specified element
|
|
Iterate
WEAVE_ERROR Iterate(
TLVReader & aReader,
size_t aDepth,
IterateHandler aHandler,
void *aContext,
bool aRecurse
)
Iterate through the TLV data referenced by aReader and invoke aHandler for each visited TLV element in the context of aContext.
The iteration is aborted if aHandler returns anything other than WEAVE_NO_ERROR
Details |
Parameters |
[in] aReader
|
A reference to the TLV reader containing the TLV data to iterate.
|
[in] aDepth
|
The current depth into the TLV data.
|
[in] aHandler
|
A callback to invoke for the current TLV element being visited.
|
[in,out] aContext
|
An optional pointer to caller-provided context data.
|
[in] aRecurse
|
A Boolean indicating whether (true) or not (false) any encountered arrays or structures should be descended into.
|
|
Return Values |
WEAVE_END_OF_TLV
|
On a successful iteration to the end of a TLV encoding, or to the end of a TLV container.
|
The
|
|
|
Iterate
WEAVE_ERROR Iterate(
const TLVReader & aReader,
IterateHandler aHandler,
void *aContext,
const bool aRecurse
)
Iterate through the TLV data referenced by aReader and invoke aHandler for each visited TLV element in the context of aContext.
The iteration is aborted if aHandler returns anything other than WEAVE_NO_ERROR
Details |
Parameters |
[in] aReader
|
A reference to the TLV reader containing the TLV data to iterate.
|
[in] aHandler
|
A callback to invoke for the current TLV element being visited.
|
[in,out] aContext
|
An optional pointer to caller-provided context data.
|
[in] aRecurse
|
A Boolean indicating whether (true) or not (false) any encountered arrays or structures should be descended into.
|
|
Return Values |
WEAVE_END_OF_TLV
|
On a successful iteration to the end of a TLV encoding, or to the end of a TLV container.
|
WEAVE_ERROR_INVALID_ARGUMENT
|
If aHandler is NULL.
|
The
|
|
|