3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2015-2017 Nest Labs, Inc.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 * This file specifies types and utility interfaces for managing and
22 * working with CHIP TLV.
26 #ifndef CHIPTLVUTILITIES_HPP
27 #define CHIPTLVUTILITIES_HPP
32 #include <core/CHIPError.h>
33 #include <core/CHIPTLV.h>
40 * @namespace chip::TLV::Utilities
43 * This namespace includes types and utility interfaces for managing and
44 * working with CHIP TLV.
49 typedef CHIP_ERROR (*IterateHandler)(const TLVReader & aReader, size_t aDepth, void * aContext);
51 extern CHIP_ERROR Iterate(const TLVReader & aReader, IterateHandler aHandler, void * aContext);
52 extern CHIP_ERROR Iterate(const TLVReader & aReader, IterateHandler aHandler, void * aContext, bool aRecurse);
54 extern CHIP_ERROR Count(const TLVReader & aReader, size_t & aCount);
55 extern CHIP_ERROR Count(const TLVReader & aReader, size_t & aCount, bool aRecurse);
57 extern CHIP_ERROR Find(const TLVReader & aReader, const uint64_t & aTag, TLVReader & aResult);
58 extern CHIP_ERROR Find(const TLVReader & aReader, const uint64_t & aTag, TLVReader & aResult, bool aRecurse);
60 extern CHIP_ERROR Find(const TLVReader & aReader, IterateHandler aHandler, void * aContext, TLVReader & aResult);
61 extern CHIP_ERROR Find(const TLVReader & aReader, IterateHandler aHandler, void * aContext, TLVReader & aResult, bool aRecurse);
62 } // namespace Utilities
68 #endif // CHIPTLVUTILITIES_HPP