aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2021-04-08Make const overloads available in sub-classes.Max Bires
Due to the overloading behavior in sub-classes, access to the methods returning const types in Item were not accessible from the Item subclasses. This change adds the using statements necessary to fix that. Test: cd hardware/interfaces/identity && mm -j48 Change-Id: I40bff6470c5fecfb308fec527540a8fbf1abf91a
2021-03-11Add view items for zero-copy parsing of CBOR stringsAndrei Homescu
This CL adds two new ViewTstr and ViewBstr Item types that hold strings as string_view and basic_string_view<uint8_t> types instead of std::string or std::vector<uint8_t>, respectively. This allows for zero-copy parsing of CBOR (mainly strings), which is useful in low-memory environments like the apploader where CBOR data can contain large bstr values. Bug: 115420908 Test: cppbor_host_test_external Change-Id: I69322f0de258e3583cbd842ce240398504a1973f
2020-12-14Change semantic tagging.Shawn Willden
Semantic tagging in libcppbor was a bit cumbersome to use, with tags treated as separate items, requiring code that analyzes tagged data to pay attention to the tags. Among other issues, that violates the intention of semantic tagging in CBOR, which, per the RFC, does not require decoders to understand tags. This CL changes that behavior so that code that walks a parsed Item tree will not "see" the tags unless it looks for them, by calling "Item::semanticTagCount()" and then "Item::semanticTag()". Nested tags are supported. Test: cppbor_test_external Change-Id: Ifa99475fd0d9f369f3e379251979446a2ec262b5
2020-12-14Remove downcastItem<>Shawn Willden
This safe downcast template was never used and is hard to implement with the coming SemanticTag changes, so this CL removes it. Test: cppbor_test_external Change-Id: I0d4dd8b7323653c3924080f8fb328282dbca4566
2020-12-14Improve Map canonicalization and add Map iterators.Shawn Willden
This CL changes Map storage to use a vector of pairs, which removes the need to copy the contents twice to sort them and makes it easy to support Map iteration. Support for recursive canonicalization is added as well, and Map::get() uses a binary search when the map is canonicalized. Test: cppbor_test_external Change-Id: Ie7cee5d504e205e1768a26ec5df8436805a6eefe
2020-12-01Add Array iterators.Shawn Willden
Test: cppbor_test_external Change-Id: Id47afed4927db47312b8bdf31a594b847448fb7d
2020-12-01Add non-const as*() methods.Shawn Willden
Other changes coming require non-const methods for safe downcasting, but this change stands alone since not having them was clearly an oversight. Test: cppbor_test_external Change-Id: I55b8206778f3c4de8e9fc5039efda0c2f45bfe00
2020-12-01Remove CompoundItem.Shawn Willden
Refactor to remove CompoundItem. It was a way to share some common code between Array and Map, and later Semantic, but the representations of those classes need to diverge so it adds no value. Test: cppbor_test_external Change-Id: I986e90c1d212f6d81debe4b2f650ba68f065a6ed
2020-11-24Improvements to cppborShawn Willden
1. Add pretty-printing (moved from IdentityCredentialSupport) 2. Add EncodedItem to make it easy to add already-encoded CBOR. 3. Add Map canonicalization. 4. Add support for adding enums as integers. Test: cppbor_test_external Change-Id: I641c87567a11de4641b2fcadebe72dd832fceb51
2020-04-10Adding initial commit for libcppborplatform-tools-30.0.1platform-tools-30.0.0Max Bires
This commit alters the binary names in the Android.bp file to avoid conflicts with the internal copy of libcppbor in hardware/interfaces. Once checked in, the copy will be removed and the binary names will be reverted back to normal. This is to avoid chicken and egg build errors. Test: tests are under tests/ Change-Id: I61355fb05d862a6809ac1e42bce714908da869b2
2020-04-09Revert "Adding the initial commit for libcppbor"Max Bires
This reverts commit a7b145a6a5d05b89e9769ffea84d1068ef32bd4e. Reason for revert: Need to submit with altered binary names Change-Id: I73a6e442fdbd955bbbd9ab03a7c3096deabbc786
2020-04-02Adding the initial commit for libcppborMax Bires
This commit just populates the repository with the code from the google github repository Test: tests/cppbor_test.cpp contains the relevant tests Change-Id: I693c70abbec6919ed0aa477604a0dd6a16f32df2