-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tinyCBOR external library and apply mynewt upstream patch from intel/tinycbor#83 #5912
Merged
carlescufi
merged 4 commits into
zephyrproject-rtos:master
from
vrahane:tinycbor-mynewt-patch
Feb 8, 2018
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a5f7809
ext: lib: tinycbor: Add tinyCBOR as an ext lib
vrahane bc0a91d
ext: lib: tinycbor: Apply req patch to 0.5.0-beta1
vrahane 717ad15
ext: lib: tinycbor: half/full-FP support changes
vrahane d57e9bd
ext: lib: tinycbor: Add req Zephyr specific files
vrahane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(crypto) | ||
add_subdirectory(encoding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory_if_kconfig(tinycbor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
menu "Encoding" | ||
|
||
source "ext/lib/encoding/tinycbor/Kconfig" | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
zephyr_interface_library_named(TINYCBOR) | ||
|
||
target_include_directories(TINYCBOR INTERFACE src) | ||
|
||
zephyr_library() | ||
zephyr_library_sources( | ||
src/cbor_buf_reader.c | ||
src/cbor_buf_writer.c | ||
src/cborencoder.c | ||
src/cborerrorstrings.c | ||
src/cborparser.c | ||
) | ||
zephyr_library_sources_ifdef(CONFIG_NEWLIB_LIBC src/cborparser_dup_string.c) | ||
|
||
zephyr_library_link_libraries(TINYCBOR) | ||
target_link_libraries(TINYCBOR INTERFACE zephyr_interface) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
config TINYCBOR | ||
bool | ||
prompt "tinyCBOR Support" | ||
default n | ||
help | ||
This option enables the tinyCBOR library. | ||
|
||
if TINYCBOR | ||
|
||
config CBOR_NO_DFLT_WRITER | ||
bool | ||
prompt "No default writer support" | ||
default n | ||
help | ||
This option specifies whether a default writer exists. | ||
|
||
config CBOR_NO_DFLT_READER | ||
bool | ||
prompt "No default reader support" | ||
default n | ||
help | ||
This option specifies whether a default reader exists. | ||
|
||
config CBOR_ENCODER_NO_CHECK_USER | ||
bool | ||
prompt "No encoder checks for user args for validity" | ||
default n | ||
help | ||
This option specifies whether a check user exists for a cbor encoder. | ||
|
||
config CBOR_PARSER_MAX_RECURSIONS | ||
int | ||
prompt "Parser max recursions" | ||
default 1024 | ||
help | ||
This option specifies max recursions for the parser. | ||
|
||
config CBOR_PARSER_NO_STRICT_CHECKS | ||
bool | ||
prompt "No strict parser checks" | ||
default n | ||
help | ||
This option enables the strict parser checks. | ||
|
||
config CBOR_NO_FLOATING_POINT | ||
bool | ||
select NEWLIB_LIBC | ||
prompt "No Floating point support" | ||
default y | ||
help | ||
This option enables floating point support. | ||
|
||
config CBOR_NO_HALF_FLOAT_TYPE | ||
bool | ||
select NEWLIB_LIBC | ||
prompt "No Half float type support" | ||
default y | ||
help | ||
This option enables half float type support. | ||
|
||
config CBOR_WITHOUT_OPEN_MEMSTREAM | ||
bool | ||
prompt "Without open memstream" | ||
default y | ||
help | ||
This option enables open memstream support. | ||
|
||
endif #TINYCBOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Intel Corporation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Concise Binary Object Representation (CBOR) Library | ||
--------------------------------------------------- | ||
|
||
To build TinyCBOR: | ||
|
||
make | ||
|
||
If you want to change the compiler or pass extra compiler flags: | ||
|
||
make CC=clang CFLAGS="-m32 -Oz" LDFLAGS="-m32" | ||
|
||
Documentation: https://intel.github.io/tinycbor/current/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2016 Intel Corporation | ||
** | ||
** Permission is hereby granted, free of charge, to any person obtaining a copy | ||
** of this software and associated documentation files (the "Software"), to deal | ||
** in the Software without restriction, including without limitation the rights | ||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
** copies of the Software, and to permit persons to whom the Software is | ||
** furnished to do so, subject to the following conditions: | ||
** | ||
** The above copyright notice and this permission notice shall be included in | ||
** all copies or substantial portions of the Software. | ||
** | ||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
** THE SOFTWARE. | ||
** | ||
****************************************************************************/ | ||
|
||
/** | ||
* \mainpage | ||
* The TinyCBOR $(VERSION) library is a small CBOR encoder and decoder library, | ||
* optimized for very fast operation with very small footprint. The main encoder | ||
* and decoder functions do not allocate memory. | ||
* | ||
* TinyCBOR is divided into the following groups of functions and structures: | ||
* - \ref CborGlobals | ||
* - \ref CborEncoding | ||
* - \ref CborParsing | ||
* - \ref CborPretty | ||
* - \ref CborToJson | ||
*/ | ||
|
||
/** | ||
* \file <cbor.h> | ||
* The <cbor.h> is the main header in TinyCBOR and defines the constants used by most functions | ||
* as well as the structures for encoding (CborEncoder) and decoding (CborValue). | ||
* | ||
* \sa <cborjson.h> | ||
*/ | ||
|
||
/** | ||
* \file <cborjson.h> | ||
* The <cborjson.h> file contains the routines that are used to convert a CBOR | ||
* data stream into JSON. | ||
* | ||
* \sa <cbor.h> | ||
*/ | ||
|
||
/** | ||
* \defgroup CborGlobals Global constants | ||
* \brief Constants used by all TinyCBOR function groups. | ||
*/ | ||
|
||
/** | ||
* \addtogroup CborGlobals | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* \var size_t CborIndefiniteLength | ||
* | ||
* This variable is a constant used to indicate that the length of the map or | ||
* array is not yet determined. It is used in functions | ||
* cbor_encoder_create_map() and cbor_encoder_create_array() | ||
*/ | ||
|
||
/** | ||
* \enum CborType | ||
* The CborType enum contains the types known to TinyCBOR. | ||
* | ||
* \value CborIntegerType Type is an integer value, positive, negative or zero | ||
* \value CborByteStringType Type is a string of arbitrary raw bytes | ||
* \value CborTextStringType Type is a text string encoded in UTF-8 | ||
* \value CborArrayType Type is a CBOR array | ||
* \value CborMapType Type is a CBOR map (an associative container with key and value pairs) | ||
* \value CborTagType Type is a CBOR tag (a 64-bit integer describing the item that follows, see CborKnownTags) | ||
* \value CborSimpleType Type is one of CBOR Simple Types | ||
* \value CborBooleanType Type is a boolean (true or false) | ||
* \value CborNullType Type encodes a null | ||
* \value CborUndefinedType Type encodes an undefined value | ||
* \value CborHalfFloatType Type is an IEEE 754 half precision (16-bit) floating point type | ||
* \value CborFloatType Type is an IEEE 754 single precision (32-bit) floating point type | ||
* \value CborDoubleType Type is an IEEE 754 double precision (64-bit) floating point type | ||
* \value CborInvalidType Type is not valid (this value is used to indicate error conditions) | ||
*/ | ||
|
||
/** | ||
* \enum CborKnownTags | ||
* The CborKnownTags enum contains known tags specified in RFC 7049, for use by the application. | ||
* TinyCBOR does not usually interpret the meaning of these tags and does not add them to the | ||
* output stream, unless specifically instructed to do so in functions for that effect. | ||
* | ||
* \value CborDateTimeStringTag Text string contains a date-time encoded in RFC 3339 format, "YYYY-MM-DD hh:mm:ss+zzzz" | ||
* \value CborUnixTime_tTag Number is a Unix time_t quantity, the number of seconds since 1970-01-01 midnight UTC | ||
* \value CborPositiveBignumTag Item is a CBOR byte string encoding a positive integer of arbitrary precision | ||
* \value CborNegativeBignumTag Item is a CBOR byte string encoding a negative integer of arbitrary precision | ||
* \value CborDecimalTag Item is a CBOR array of two integers encoding a fixed-point decimal | ||
* \value CborBigfloatTag Item is a bigfloat | ||
* \value CborExpectedBase64urlTag Item is a CBOR byte string that is expected to be encoded as Base64Url | ||
* \value CborExpectedBase64Tag Item is a CBOR byte string that is expected to be encoded as Base64 | ||
* \value CborExpectedBase16Tag Item is a CBOR byte string that is expected to be encoded as Base16 (also known as "hexdump") | ||
* \value CborUriTag Item is a CBOR text string containing an URI (RFC 3986) or IRI (RFC 3987) | ||
* \value CborBase64urlTag Item is a CBOR text string that was encoded as Base64Url | ||
* \value CborBase64Tag Item is a CBOR text string that was encoded as Base64 | ||
* \value CborRegularExpressionTag Item is a CBOR text string containing a regular expression | ||
* \value CborMimeMessageTag Item is a CBOR text string containing a MIME message (RFC 2045, 2046, 2047, 2822) | ||
* \value CborSignatureTag Item contains CBOR-encoded data. | ||
* This tag is also used as "file magic," marking a file as containing CBOR | ||
*/ | ||
|
||
/** | ||
* \typedef CborTag | ||
* This typedef is an unsigned 64-bit integer. Known CBOR tags can be used from the CborKnownTags enum | ||
* but the user application may use other tag values than the ones specified in RFC 7049. | ||
*/ | ||
|
||
/** @} */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe find a better name for this? At least get rid of the acronym.
I've been calling this the ability to encode to a linear buffer, as opposed to a
net_buf
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestion ?