Permalink
Browse files

Anjay 1.12.0

Breaking changes:
- Updated AvsCommons to 3.8.0, which requires CMake 3.4.0 or higher. This
  means that Anjay requires CMake 3.4.0 or higher as well.
- Running tests requires grequests (https://github.com/kennethreitz/grequests)
  now

Features:
- Allowed configuration of UDP DTLS Handshake transmission parameters by
  anjay_configuration_t::udp_dtls_hs_tx_params field
- Allowed configuration of firmware download CoAP transmission parameters
  by anjay_fw_update_handlers_t::get_coap_tx_params handler implemented by
  the user
- Added sequence diagrams for library operations in documentation chapter
  "4.4. A few notes on general usage"

Improvements:
- Reformatted the entire codebase with clang-format
- Added more tests verifying demo client's behavior in situations with
  network connectivity issues
- Explained in the demo application why file descriptors other than 0, 1, 2,
  are being closed

Bugfixes:
- Fixed the cause of "could not stringify socket address" error
  • Loading branch information...
sznaider committed Sep 21, 2018
1 parent 0410f8f commit 0c384fc91b4efaf953e9be5dbc87982d68f81ee7
Showing with 9,393 additions and 8,503 deletions.
  1. +22 −0 .clang-format
  2. +1 −0 .gitignore
  3. +11 −20 CMakeLists.txt
  4. +3 −2 README.md
  5. +1 −1 avs_commons/git
  6. +67 −51 demo/demo.c
  7. +2 −2 demo/demo.h
  8. +259 −132 demo/demo_args.c
  9. +11 −1 demo/demo_args.h
  10. +28 −34 demo/demo_cmds.c
  11. +14 −16 demo/demo_utils.c
  12. +4 −5 demo/demo_utils.h
  13. +62 −47 demo/firmware_update.c
  14. +3 −2 demo/firmware_update.h
  15. +8 −13 demo/iosched.c
  16. +15 −15 demo/iosched.h
  17. +25 −24 demo/objects.h
  18. +71 −71 demo/objects/apn_conn_profile.c
  19. +70 −67 demo/objects/cell_connectivity.c
  20. +38 −31 demo/objects/conn_monitoring.c
  21. +37 −38 demo/objects/conn_statistics.c
  22. +117 −125 demo/objects/device.c
  23. +44 −45 demo/objects/download_diagnostics.c
  24. +41 −37 demo/objects/ext_dev_info.c
  25. +38 −40 demo/objects/geopoints.c
  26. +61 −61 demo/objects/ip_ping.c
  27. +48 −50 demo/objects/location.c
  28. +61 −61 demo/objects/portfolio.c
  29. +97 −100 demo/objects/test.c
  30. +0 −1 devconfig
  31. +128 −32 doc/sphinx/source/BasicTutorial/BT4.rst
  32. +53 −18 doc/sphinx/source/BasicTutorial/BT5_CustomObject.rst
  33. +5 −4 doc/sphinx/source/BasicTutorial/BT5_CustomObject/BT_CO5_MultiInstanceDynamic.rst
  34. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-block-client-request.svg
  35. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-block-response-to-server-request.svg
  36. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-client-request.svg
  37. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-firmware-download-coap-pull.svg
  38. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-firmware-handling.svg
  39. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-notification.svg
  40. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-read.svg
  41. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-server-block-request.svg
  42. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-server-request.svg
  43. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-write-replace-instance.svg
  44. +2 −0 doc/sphinx/source/BasicTutorial/_images/anjay-write-resource.svg
  45. +4 −4 examples/test_examples.md5
  46. +36 −36 include_modules/anjay_modules/dm/attributes.h
  47. +0 −1 include_modules/anjay_modules/dm/execute.h
  48. +0 −1 include_modules/anjay_modules/dm/modules.h
  49. +78 −69 include_modules/anjay_modules/dm_utils.h
  50. +5 −9 include_modules/anjay_modules/notify.h
  51. +1 −2 include_modules/anjay_modules/observe.h
  52. +9 −10 include_modules/anjay_modules/raw_buffer.h
  53. +2 −3 include_modules/anjay_modules/sched.h
  54. +6 −4 include_modules/anjay_modules/servers.h
  55. +1 −2 include_modules/anjay_modules/time_defs.h
  56. +11 −7 include_modules/anjay_modules/utils_core.h
  57. +1 −1 include_public/anjay/anjay.h
  58. +110 −45 include_public/anjay/core.h
  59. +190 −126 include_public/anjay/dm.h
  60. +9 −5 include_public/anjay/download.h
  61. +5 −5 include_public/anjay/io.h
  62. +6 −4 include_public/anjay/persistence.h
  63. +70 −71 modules/access_control/src/access_control_handlers.c
  64. +26 −27 modules/access_control/src/access_control_persistence.c
  65. +43 −40 modules/access_control/src/mod_access_control.c
  66. +2 −3 modules/access_control/src/mod_access_control.h
  67. +31 −35 modules/access_control/src/test/access_control.c
  68. +27 −16 modules/access_control/src/test/persistence.c
  69. +16 −20 modules/attr_storage/src/attr_storage_persistence.c
  70. +132 −142 modules/attr_storage/src/mod_attr_storage.c
  71. +3 −3 modules/attr_storage/src/mod_attr_storage.h
  72. +434 −483 modules/attr_storage/src/test/attr_storage.c
  73. +6 −10 modules/attr_storage/src/test/attr_storage_test.h
  74. +308 −341 modules/attr_storage/src/test/persistence.c
  75. +34 −14 modules/fw_update/include_public/anjay/fw_update.h
  76. +22 −16 modules/fw_update/src/fw_dm_security.c
  77. +150 −134 modules/fw_update/src/fw_update.c
  78. +4 −4 modules/security/include_public/anjay/security.h
  79. +61 −59 modules/security/src/mod_security.c
  80. +12 −12 modules/security/src/mod_security.h
  81. +19 −17 modules/security/src/security_persistence.c
  82. +6 −6 modules/security/src/security_transaction.c
  83. +2 −3 modules/security/src/test/api.c
  84. +24 −24 modules/security/src/test/persistence.c
  85. +4 −3 modules/server/include_public/anjay/server.h
  86. +27 −25 modules/server/src/mod_server.c
  87. +17 −15 modules/server/src/server_persistence.c
  88. +0 −1 modules/server/src/server_utils.c
  89. +1 −1 modules/server/src/server_utils.h
  90. +1 −2 modules/server/src/test/api.c
  91. +17 −14 modules/server/src/test/persistence.c
  92. +15 −19 src/access_control_utils.c
  93. +3 −2 src/access_control_utils.h
  94. +104 −90 src/anjay_core.c
  95. +7 −7 src/anjay_core.h
  96. +18 −14 src/coap/block/request.c
  97. +18 −17 src/coap/block/response.c
  98. +8 −7 src/coap/block/response.h
  99. +51 −46 src/coap/block/transfer.c
  100. +2 −2 src/coap/block/transfer.h
  101. +2 −2 src/coap/block/transfer_impl.h
  102. +12 −14 src/coap/coap_stream.h
  103. +4 −4 src/coap/content_format.h
  104. +7 −7 src/coap/id_source/auto.c
  105. +1 −1 src/coap/id_source/auto.h
  106. +1 −2 src/coap/id_source/id_source.h
  107. +11 −13 src/coap/id_source/static.c
  108. +2 −3 src/coap/id_source/static.h
  109. +44 −43 src/coap/stream/client_internal.c
  110. +4 −5 src/coap/stream/client_internal.h
  111. +3 −4 src/coap/stream/common.c
  112. +4 −3 src/coap/stream/common.h
  113. +4 −5 src/coap/stream/in.c
  114. +5 −6 src/coap/stream/in.h
  115. +3 −4 src/coap/stream/out.c
  116. +8 −8 src/coap/stream/out.h
  117. +52 −54 src/coap/stream/server_internal.c
  118. +5 −5 src/coap/stream/server_internal.h
  119. +41 −46 src/coap/stream/stream_internal.c
  120. +1 −1 src/coap/stream/stream_internal.h
  121. +35 −51 src/coap/test/block_response.c
  122. +87 −81 src/coap/test/servers.c
  123. +10 −5 src/coap/test/servers.h
  124. +118 −90 src/coap/test/stream.c
  125. +68 −61 src/coap/test/utils.h
  126. +27 −28 src/dm/discover.c
  127. +3 −3 src/dm/discover.h
  128. +20 −21 src/dm/dm_attributes.c
  129. +14 −7 src/dm/dm_attributes.h
  130. +13 −10 src/dm/dm_execute.c
  131. +127 −115 src/dm/dm_handlers.c
  132. +9 −11 src/dm/query.c
  133. +2 −3 src/dm/query.h
  134. +184 −172 src/dm_core.c
  135. +54 −55 src/dm_core.h
  136. +2 −3 src/downloader.h
  137. +83 −65 src/downloader/coap.c
  138. +16 −19 src/downloader/downloader.c
  139. +32 −27 src/downloader/http.c
  140. +2 −3 src/downloader/private.h
  141. +152 −125 src/downloader/test/downloader.c
  142. +1 −1 src/downloader/test/downloader_mock.h
  143. +80 −67 src/interface/bootstrap_core.c
  144. +8 −8 src/interface/bootstrap_core.h
  145. +31 −32 src/interface/register.c
  146. +2 −2 src/interface/register.h
  147. +60 −49 src/interface/test/bootstrap.c
  148. +4 −2 src/interface/test/bootstrap_mock.h
  149. +7 −11 src/io/base64_out.c
  150. +3 −6 src/io/base64_out.h
  151. +19 −19 src/io/dynamic.c
  152. +103 −96 src/io/json_out.c
  153. +4 −3 src/io/opaque.c
  154. +20 −23 src/io/output_buf.c
  155. +2 −1 src/io/test/bigdata.h
  156. +50 −49 src/io/test/dynamic.c
  157. +135 −120 src/io/test/text.c
  158. +205 −192 src/io/test/tlv_in.c
  159. +101 −83 src/io/test/tlv_out.c
  160. +29 −32 src/io/text.c
  161. +0 −1 src/io/tlv.h
  162. +83 −82 src/io/tlv_in.c
  163. +56 −56 src/io/tlv_out.c
  164. +14 −12 src/io/vtable.h
  165. +19 −15 src/io_core.c
  166. +14 −13 src/io_core.h
  167. +2 −1 src/io_utils.c
  168. +24 −28 src/notify.c
  169. +133 −112 src/observe/observe_core.c
  170. +8 −11 src/observe/observe_core.h
  171. +0 −1 src/observe/observe_internal.h
  172. +32 −29 src/observe/observe_io.c
  173. +458 −314 src/observe/test/observe.c
  174. +2 −1 src/observe/test/observe_mock.h
  175. +31 −34 src/sched.c
  176. +1 −2 src/sched_internal.h
  177. +42 −16 src/servers.h
  178. +31 −40 src/servers/activate.c
  179. +1 −1 src/servers/activate.h
  180. +0 −496 src/servers/connection_info.c
  181. +47 −39 src/servers/connection_udp.c
  182. +393 −0 src/servers/connections.c
  183. +60 −19 src/servers/{connection_info.h → connections.h}
  184. +11 −11 src/servers/connections_internal.h
  185. +6 −12 src/servers/offline.c
  186. +64 −68 src/servers/register_internal.c
  187. +3 −5 src/servers/register_internal.h
  188. +34 −37 src/servers/reload.c
  189. +1 −1 src/servers/reload.h
  190. +163 −0 src/servers/server_connections.c
  191. +46 −0 src/servers/server_connections.h
  192. +36 −55 src/servers/servers_internal.c
  193. +61 −78 src/servers/servers_internal.h
  194. +30 −82 src/servers_utils.c
  195. +3 −5 src/servers_utils.h
  196. +128 −288 src/test/anjay.c
  197. +374 −315 src/test/dm.c
  198. +9 −10 src/test/io.c
  199. +12 −14 src/test/sched.c
  200. +63 −64 src/test/utils.c
  201. +47 −42 src/utils_core.c
  202. +7 −8 src/utils_core.h
  203. +4 −0 test/codegen/CMakeLists.txt
  204. +22 −21 test/doc/runtest.py
  205. +37 −35 test/fuzz/coap/stream.c
  206. +72 −74 test/fuzz/coap/stream_request.c
  207. +67 −69 test/fuzz/coap/stream_response.c
  208. +153 −163 test/include/anjay_test/dm.h
  209. +209 −182 test/include/anjay_test/mock_dm.h
  210. +1 −2 test/include/anjay_test/utils.h
  211. +3 −5 test/integration/framework/nsh-lwm2m/pymbedtls/src/context.cpp
  212. +46 −49 test/integration/framework/nsh-lwm2m/pymbedtls/src/pymbedtls.cpp
  213. +10 −9 test/integration/framework/nsh-lwm2m/pymbedtls/src/security.cpp
  214. +12 −14 test/integration/framework/nsh-lwm2m/pymbedtls/src/socket.cpp
  215. +7 −2 test/integration/suites/default/access_control.py
  216. +11 −9 test/integration/suites/default/json_encoding.py
  217. +78 −0 test/integration/suites/default/queue_mode.py
  218. +51 −23 test/integration/suites/default/retransmissions.py
  219. +6 −6 test/integration/suites/testfest/dm/firmware_update.py
  220. +40 −28 test/src/dm.c
  221. +3 −2 test/src/mock_clock.c
  222. +196 −175 test/src/mock_dm.c
  223. +6 −6 tools/anjay_codegen.py
  224. +3 −1 tools/check-license-headers.py
  225. +1 −1 travis/centos7/Dockerfile
  226. +1 −1 travis/coverity/Dockerfile
  227. +1 −1 travis/prepare.sh
  228. +2 −1 travis/ubuntu-16.04/Dockerfile
View
@@ -0,0 +1,22 @@
BasedOnStyle: llvm
AccessModifierOffset: -4
AlignEscapedNewlinesLeft: true
AlignOperands: true
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: true
AvoidMisleadingControlStatementContinuationIndent: true
BinPackParameters: false
BinPackArguments: true
BreakBeforeBinaryOperators: NonAssignment
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
IndentWidth: 4
PenaltyBreakBeforeFirstCallParameter: 40
SpaceAfterCStyleCast: true
TypenameMacros: ['AVS_LIST', 'AVS_RBTREE', 'AVS_RBTREE_ELEM', 'AVS_VECTOR']
BreakDesignatedInitializers: true
IndentPPDirectives: AfterHash
CommentPragmas: "AVSYSTEM_ANJAY_COMMERCIAL.*"
ExperimentalAutoDetectBinPacking: true
View
@@ -61,6 +61,7 @@ compile_commands.json
/doc/sphinx/build
/doc/sphinx/html
/doc/doxygen
/doc/sphinx/source/.doctrees
!/doc/sphinx/Makefile
# built tutorials
View
@@ -15,7 +15,7 @@
cmake_minimum_required(VERSION 2.8.12)
project(anjay C)
set(ANJAY_VERSION "1.11.0" CACHE STRING "Anjay library version")
set(ANJAY_VERSION "1.12.0" CACHE STRING "Anjay library version")
set(ANJAY_BINARY_VERSION 1.0.0)
set(ANJAY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -75,9 +75,6 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/PosixFeatures.cmake)
option(WITH_LIBRARY_SHARED "Compile Anjay as shared library" "${UNIX}")
cmake_dependent_option(WITH_STATIC_DEPS_LINKED
"Directly link shared library with its static dependencies such as avs_commons (e.g. for interpreted language bindings)"
OFF WITH_LIBRARY_SHARED OFF)
option(WITH_ACCESS_CONTROL "Enable core support for Access Control mechanism" ON)
option(WITH_ATTR_STORAGE "Enable Attribute storage module" ON)
@@ -93,7 +90,7 @@ if(WITH_OBSERVE)
endif()
option(WITH_LEGACY_CONTENT_FORMAT_SUPPORT
"Enable support for pre-LwM2M 1.0 CoAP Content-Format values (1541-1543)" OFF)
option(WITH_JSON "Enable support for JSON content format (output only)" OFF)
option(WITH_JSON "Enable support for JSON content format (output only)" ON)
option(WITH_AVS_PERSISTENCE "Enable support for persisting objects data" ON)
@@ -187,11 +184,12 @@ set(CORE_SOURCES
src/raw_buffer.c
src/sched.c
src/servers/activate.c
src/servers/connection_info.c
src/servers/connections.c
src/servers/connection_udp.c
src/servers/offline.c
src/servers/register_internal.c
src/servers/reload.c
src/servers/server_connections.c
src/servers/servers_internal.c
src/servers_utils.c
src/utils_core.c)
@@ -227,7 +225,7 @@ if(WITH_OBSERVE)
src/observe/observe_core.c
src/observe/observe_io.c)
endif()
if(WITH_JSON)
if(WITH_JSON OR WITH_SENML_JSON)
set(CORE_SOURCES ${CORE_SOURCES}
src/io/json_out.c)
endif()
@@ -268,10 +266,11 @@ set(CORE_PRIVATE_HEADERS
src/sched_internal.h
src/servers.h
src/servers/activate.h
src/servers/connection_info.h
src/servers/connections.h
src/servers/connections_internal.h
src/servers/register_internal.h
src/servers/reload.h
src/servers/server_connections.h
src/servers/servers_internal.h
src/servers_utils.h
src/utils_core.h)
@@ -441,8 +440,6 @@ else()
add_subdirectory(avs_commons/git)
endif()
set(DEPS_INCLUDE_DIRS ${DEPS_INCLUDE_DIRS} ${avs_commons_INCLUDE_DIRS})
if(WITH_AVS_LOG)
set(DEPS_LIBRARIES_WEAK ${DEPS_LIBRARIES_WEAK} avs_log)
endif()
@@ -452,7 +449,6 @@ endif()
set(PUBLIC_INCLUDE_DIRS ${PUBLIC_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/include_public")
set(MODULES_INCLUDE_DIRS ${MODULES_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/include_modules")
include_directories(SYSTEM ${DEPS_INCLUDE_DIRS})
include_directories(${PUBLIC_INCLUDE_DIRS}
${MODULES_INCLUDE_DIRS})
@@ -505,16 +501,11 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/config")
if(WITH_LIBRARY_SHARED)
add_library(${PROJECT_NAME} SHARED ${ABSOLUTE_SOURCES})
if(WITH_STATIC_DEPS_LINKED)
target_link_libraries(${PROJECT_NAME} ${DEPS_LIBRARIES} ${DEPS_LIBRARIES_WEAK})
else()
target_link_libraries(${PROJECT_NAME} ${DEPS_LIBRARIES})
target_link_libraries(${PROJECT_NAME} LINK_INTERFACE_LIBRARIES ${DEPS_LIBRARIES_WEAK})
anjay_emit_deps(${PROJECT_NAME} ${DEPS_LIBRARIES_WEAK})
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE ${DEPS_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PUBLIC ${DEPS_LIBRARIES_WEAK})
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${ANJAY_BINARY_VERSION})
if(HAVE_VISIBILITY AND NOT WITH_STATIC_DEPS_LINKED)
if(HAVE_VISIBILITY)
get_property(LINK_FLAGS TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS)
set_property(TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS "${LINK_FLAGS} -Wl,--exclude-libs,ALL")
endif()
@@ -659,7 +650,7 @@ if(WITH_TEST)
# Symbol validation
add_custom_target(symbols_check COMMAND ${CMAKE_CTEST_COMMAND} -R "'^test_.*_symbols$$'" --output-on-failure)
if(WITH_LIBRARY_SHARED AND NOT WITH_STATIC_DEPS_LINKED)
if(WITH_LIBRARY_SHARED)
add_test(NAME test_so_symbols COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test_symbols.sh $<TARGET_FILE:${PROJECT_NAME}> anjay_ ANJAY_)
add_dependencies(symbols_check ${PROJECT_NAME})
endif()
View
@@ -114,6 +114,7 @@ More details about OMA LwM2M: [Brief introduction to LwM2M](https://AVSystem.git
sudo apt-get install git build-essential cmake libmbedtls-dev zlib1g-dev
# Optionally for tests:
sudo apt-get install libpython3-dev libssl-dev python3 python3-cryptography python3-jinja2 python3-sphinx python3-requests clang valgrind clang-tools
pip3 install grequests
```
#### CentOS 7
@@ -129,7 +130,7 @@ sudo yum install -y valgrind valgrind-devel openssl openssl-devel python35u pyth
# Use update-alternatives to create a /usr/bin/python3 symlink with priority 0
# (lowest possible)
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 0
sudo python3 -m pip install cryptography jinja2 requests
sudo python3 -m pip install cryptography jinja2 requests grequests
```
#### macOS Sierra with [Homebrew](https://brew.sh/)
@@ -138,7 +139,7 @@ sudo python3 -m pip install cryptography jinja2 requests
brew install cmake mbedtls
# Optionally for tests:
brew install python3 openssl llvm
pip3 install cryptography sphinx sphinx_rtd_theme requests
pip3 install cryptography sphinx sphinx_rtd_theme requests grequests
```
#### Windows
Oops, something went wrong.

0 comments on commit 0c384fc

Please sign in to comment.