Skip to content
Permalink
Browse files

Anjay 1.10.0

Features:
- Updated avs_commons to 3.6.0, which includes:
	* an abstraction layer over allocator routines, making it possible for the
	  user to provide custom allocation/deallocation functions to be used by
	  AvsCommons,

	* removal of ``AVS_LIST_CONFIG_ALLOC/FREE`` (they are now replaced with
	  calls to ``avs_calloc()`` and ``avs_free()`` respectively),

	* removal of use of all ``time()`` calls,

	* removal of use of variable length array language feature,

	* default socket implementation refactor to use a nonblocking socket API,

	* ``avs_compat_threading`` module, implementing necessary synchronization
	  primitives used across AvsCommons such as mutexes,

	* ``avs_cleanup_global_state()`` method, allowing to (optionally) free any
	  global state implicitly instantiated in AvsCommons,

	* various compatibility fixes for FreeBSD.

- Prevented ``anjay_schedule_reconnect()`` from sending Updates when they are
  not necessary,

- Introduced an API (``anjay_get_socket_entries()``) allowing to obtain different
  kinds of sockets used by Anjay.

Improvements:
- Removed all uses of ``malloc()/calloc()/realloc()/free()`` in favor of
  AvsCommons' memory layer abstraction,
- Removed all occurrences of ``time()``,
- Removed all uses of variable length arrays,
- Improved non-GNU compilers compatibility,
- Fixed multiple typos in documentation,
- Fixed LwM2M-level error reporting for some LwM2M requests with unexpected
  payloads/content-formats (sane error codes are now returned instead of Internal
  Server Error),
- Various compatibility fixes for FreeBSD.

Fixes:
- Made bind address family depend on resolved numeric address rather than
  domain name,
- Fixed project compilation when ``WITH_AVS_PERSISTENCE`` is disabled.
  • Loading branch information...
sznaider committed Jun 28, 2018
1 parent 2a970de commit 8691477380e66c8bed8b89a60d67deb4c8e471cd
Showing with 2,248 additions and 1,417 deletions.
  1. +1 −1 .gitignore
  2. +18 −13 CMakeLists.txt
  3. +2 −2 CONTRIBUTING.rst
  4. +2 −2 README.Windows.md
  5. +1 −1 avs_commons/git
  6. +1 −0 config/{config.h.in → anjay_config.h.in}
  7. +5 −5 demo/demo.c
  8. +74 −59 demo/demo_args.c
  9. +76 −8 demo/demo_cmds.c
  10. +3 −3 demo/demo_utils.c
  11. +3 −1 demo/demo_utils.h
  12. +19 −17 demo/firmware_update.c
  13. +16 −7 demo/iosched.c
  14. +1 −0 demo/objects.h
  15. +3 −3 demo/objects/apn_conn_profile.c
  16. +2 −2 demo/objects/cell_connectivity.c
  17. +2 −2 demo/objects/conn_monitoring.c
  18. +2 −2 demo/objects/conn_statistics.c
  19. +20 −9 demo/objects/device.c
  20. +2 −2 demo/objects/download_diagnostics.c
  21. +2 −2 demo/objects/ext_dev_info.c
  22. +2 −2 demo/objects/geopoints.c
  23. +3 −3 demo/objects/ip_ping.c
  24. +3 −3 demo/objects/location.c
  25. +2 −2 demo/objects/portfolio.c
  26. +61 −12 demo/objects/test.c
  27. +5 −5 doc/sphinx/source/AdvancedTutorial/AT3.rst
  28. +2 −2 doc/sphinx/source/BasicTutorial/BT4.rst
  29. +1 −1 doc/sphinx/source/BasicTutorial/BT5_CustomObject/BT_CO1_SingleInstanceReadOnly.rst
  30. +2 −2 doc/sphinx/source/BasicTutorial/BT5_CustomObject/BT_CO5_MultiInstanceDynamic.rst
  31. +2 −2 doc/sphinx/source/LwM2M.rst
  32. +3 −2 doc/sphinx/source/Tools.rst
  33. +5 −5 examples/test_examples.md5
  34. +5 −5 examples/tutorial/AT3-cert/src/main.c
  35. +2 −2 examples/tutorial/custom-object/multi-instance-dynamic/src/test_object.c
  36. +2 −2 examples/tutorial/custom-object/multi-instance-resources-dynamic/src/test_object.c
  37. +3 −1 examples/tutorial/custom-object/notifications/src/main.c
  38. +3 −1 examples/tutorial/custom-object/read-only/src/main.c
  39. +1 −1 include_modules/anjay_modules/io_utils.h
  40. +2 −2 include_modules/anjay_modules/raw_buffer.h
  41. +69 −1 include_public/anjay/core.h
  42. +4 −4 modules/access_control/src/access_control_handlers.c
  43. +22 −1 modules/access_control/src/access_control_persistence.c
  44. +1 −1 modules/access_control/src/mod_access_control.c
  45. +3 −3 modules/access_control/src/test/persistence.c
  46. +5 −6 modules/attr_storage/src/attr_storage_persistence.c
  47. +5 −6 modules/attr_storage/src/mod_attr_storage.c
  48. +1 −1 modules/fw_update/include_public/anjay/fw_update.h
  49. +5 −5 modules/fw_update/src/fw_dm_security.c
  50. +19 −16 modules/fw_update/src/fw_update.c
  51. +6 −5 modules/security/src/mod_security.c
  52. +1 −1 modules/security/src/mod_security.h
  53. +24 −1 modules/security/src/security_persistence.c
  54. +4 −2 modules/security/src/security_transaction.c
  55. +1 −1 modules/security/src/security_transaction.h
  56. +3 −3 modules/security/src/security_utils.c
  57. +1 −1 modules/security/src/security_utils.h
  58. +2 −2 modules/security/src/test/api.c
  59. +2 −2 modules/security/src/test/persistence.c
  60. +4 −4 modules/server/src/mod_server.c
  61. +1 −1 modules/server/src/mod_server.h
  62. +24 −1 modules/server/src/server_persistence.c
  63. +1 −1 modules/server/src/server_transaction.h
  64. +1 −1 modules/server/src/server_utils.h
  65. +2 −2 modules/server/src/test/api.c
  66. +2 −2 modules/server/src/test/persistence.c
  67. +1 −1 src/access_control_utils.c
  68. +9 −8 src/anjay_core.c
  69. +1 −1 src/coap/block/request.c
  70. +1 −1 src/coap/block/response.c
  71. +12 −8 src/coap/block/transfer.c
  72. +4 −2 src/coap/id_source/auto.c
  73. +2 −1 src/coap/id_source/id_source.h
  74. +4 −2 src/coap/id_source/static.c
  75. +1 −1 src/coap/stream/client_internal.c
  76. +1 −1 src/coap/stream/common.c
  77. +1 −1 src/coap/stream/in.c
  78. +1 −1 src/coap/stream/out.c
  79. +4 −3 src/coap/stream/server_internal.c
  80. +8 −6 src/coap/stream/stream_internal.c
  81. +1 −1 src/coap/test/block_response.c
  82. +1 −1 src/coap/test/servers.c
  83. +7 −7 src/coap/test/stream.c
  84. +2 −2 src/coap/test/utils.h
  85. +1 −1 src/dm/discover.c
  86. +1 −1 src/dm/dm_attributes.c
  87. +3 −3 src/dm/dm_execute.c
  88. +1 −1 src/dm/dm_handlers.c
  89. +1 −1 src/dm/modules.c
  90. +1 −1 src/dm/query.c
  91. +4 −3 src/dm_core.c
  92. +2 −3 src/downloader.h
  93. +12 −7 src/downloader/coap.c
  94. +31 −15 src/downloader/downloader.c
  95. +15 −7 src/downloader/http.c
  96. +4 −2 src/downloader/private.h
  97. +277 −248 src/downloader/test/downloader.c
  98. +9 −10 src/interface/bootstrap_core.c
  99. +3 −3 src/interface/register.c
  100. +8 −42 src/interface/test/bootstrap.c
  101. +8 −8 src/io/base64_out.c
  102. +5 −4 src/io/dynamic.c
  103. +3 −3 src/io/json_out.c
  104. +16 −5 src/io/opaque.c
  105. +1 −1 src/io/output_buf.c
  106. +4 −4 src/io/test/dynamic.c
  107. +1 −1 src/io/test/text.c
  108. +10 −5 src/io/test/tlv_in.c
  109. +6 −5 src/io/test/tlv_out.c
  110. +109 −86 src/io/text.c
  111. +21 −11 src/io/tlv_in.c
  112. +7 −6 src/io/tlv_out.c
  113. +6 −5 src/io_core.c
  114. +4 −4 src/io_utils.c
  115. +1 −1 src/notify.c
  116. +21 −7 src/observe/observe_core.c
  117. +2 −2 src/observe/observe_io.c
  118. +12 −21 src/observe/test/observe.c
  119. +5 −3 src/raw_buffer.c
  120. +3 −3 src/sched.c
  121. +6 −4 src/servers.h
  122. +4 −6 src/servers/activate.c
  123. +83 −120 src/servers/connection_info.c
  124. +3 −4 src/servers/connection_info.h
  125. +3 −19 src/servers/offline.c
  126. +57 −96 src/servers/register_internal.c
  127. +1 −3 src/servers/register_internal.h
  128. +72 −7 src/servers/reload.c
  129. +4 −0 src/servers/reload.h
  130. +53 −21 src/servers/servers_internal.c
  131. +2 −1 src/servers/servers_internal.h
  132. +37 −3 src/test/anjay.c
  133. +9 −6 src/test/dm.c
  134. +1 −1 src/test/io.c
  135. +1 −1 src/test/sched.c
  136. +1 −1 src/test/utils.c
  137. +78 −18 src/utils_core.c
  138. +23 −6 src/utils_core.h
  139. +1 −1 test/fuzz/coap/stream.c
  140. +1 −1 test/fuzz/coap/stream_request.c
  141. +1 −1 test/fuzz/coap/stream_response.c
  142. +2 −2 test/include/anjay_test/coap/stream.h
  143. +25 −9 test/integration/framework/nsh-lwm2m/lwm2m/coap/content_format.py
  144. +6 −2 test/integration/framework/nsh-lwm2m/lwm2m/messages.py
  145. +3 −0 test/integration/framework/nsh-lwm2m/lwm2m/server.py
  146. +22 −5 test/integration/framework/test_suite.py
  147. +5 −0 test/integration/framework/test_utils.py
  148. +133 −203 test/integration/suites/default/bootstrap_client.py
  149. +14 −0 test/integration/suites/default/downloader.py
  150. +4 −0 test/integration/suites/default/firmware_update.py
  151. +149 −0 test/integration/suites/default/formats.py
  152. +1 −2 test/integration/suites/default/offline.py
  153. +79 −0 test/integration/suites/default/port_rebind.py
  154. +89 −0 test/integration/suites/default/retransmissions.py
  155. +7 −12 test/integration/suites/default/update.py
  156. +1 −1 test/src/coap/socket.c
  157. +3 −3 test/src/coap/stream.c
  158. +2 −2 test/src/dm.c
  159. +1 −1 test/src/mock_clock.c
  160. +1 −1 test/src/mock_dm.c
  161. +1 −1 test_headers.py
  162. +3 −2 tools/anjay_codegen.py
@@ -27,7 +27,7 @@ CPackSourceConfig.cmake
CTestTestfile.cmake
Testing/
anjay_config_log.h
config.h
anjay_config.h
posix-config.h
anjay-*.cmake
Doxyfile
@@ -26,7 +26,7 @@ if(WITH_FUZZ_TESTS)
endif()

project(anjay C)
set(ANJAY_VERSION "1.9.3" CACHE STRING "Anjay library version")
set(ANJAY_VERSION "1.10.0" CACHE STRING "Anjay library version")
set(ANJAY_BINARY_VERSION 1.0.0)

set(ANJAY_BUILD_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/output")
@@ -76,7 +76,7 @@ endif()

option(WITH_EXTRA_WARNINGS "Enable extra compilation warnings" OFF)
if(WITH_EXTRA_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Winit-self -Wmissing-declarations -Wc++-compat -Wsign-conversion -Wconversion -Wcast-qual -Wno-variadic-macros -Wno-long-long")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Winit-self -Wmissing-declarations -Wc++-compat -Wsign-conversion -Wconversion -Wcast-qual -Wvla -Wno-variadic-macros -Wno-long-long")
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wjump-misses-init")
endif()
@@ -90,6 +90,7 @@ cmake_dependent_option(WITH_STATIC_DEPS_LINKED
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)
option(WITH_BLOCK_RECEIVE "Enable support for receiving CoAP BLOCK transfers" ON)
option(WITH_BLOCK_SEND "Enable support for sending data in CoAP BLOCK mode" ON)
option(WITH_BOOTSTRAP "Enable LwM2M Bootstrap Interface support" ON)
@@ -103,6 +104,7 @@ 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_AVS_PERSISTENCE "Enable support for persisting objects data" ON)


cmake_dependent_option(WITH_BLOCK_DOWNLOAD "Enable support for CoAP(S) downloads" ON "WITH_DOWNLOADER" OFF)
@@ -354,7 +356,13 @@ macro(DEFINE_MODULE MOD_NAME MOD_DEFAULT MOD_DESC)
endif()
endmacro()

DEFINE_MODULE(attr_storage ON "Automatic attribute storage module")
if(WITH_ATTR_STORAGE)
if(WITH_AVS_PERSISTENCE)
DEFINE_MODULE(attr_storage ON "Automatic attribute storage module")
else()
message(FATAL_ERROR "Attribute storage module cannot be used if persistence is turned off")
endif()
endif()
if(WITH_ACCESS_CONTROL)
DEFINE_MODULE(access_control ON "Access control object implementation module")
endif()
@@ -370,14 +378,11 @@ set(DEPS_LIBRARIES "")
set(DEPS_LIBRARIES_WEAK "")

# avs_commons required components.
set(AVS_COMMONS_COMPONENTS algorithm coap list vector rbtree buffer net stream utils)
set(AVS_COMMONS_COMPONENTS algorithm coap list vector rbtree buffer net stream utils compat_threading)
if(WITH_HTTP_DOWNLOAD)
list(APPEND AVS_COMMONS_COMPONENTS http)
endif()
if(WITH_MODULE_attr_storage
OR WITH_MODULE_access_control
OR WITH_MODULE_security
OR WITH_MODULE_server)
if(WITH_AVS_PERSISTENCE)
list(APPEND AVS_COMMONS_COMPONENTS persistence)
endif()

@@ -448,7 +453,7 @@ include_directories(${PUBLIC_INCLUDE_DIRS}

################# FEATURE LIST LOG #############################################

file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in" CONFIG_FILE_CONTENTS)
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/config/anjay_config.h.in" CONFIG_FILE_CONTENTS)
set(CONFIG_FILE_VARIABLES)
foreach(CONFIG_FILE_LINE IN LISTS CONFIG_FILE_CONTENTS)
if(CONFIG_FILE_LINE MATCHES "\#[ \t]*define[ \t]+([A-Za-z_0-9]+)[ \t]+\@([A-Za-z_0-9]+)\@")
@@ -458,7 +463,7 @@ foreach(CONFIG_FILE_LINE IN LISTS CONFIG_FILE_CONTENTS)
set(CONFIG_FILE_VARIABLE "${CMAKE_MATCH_1}")
set(CONFIG_FILE_VARIABLE_TYPE "FLAG")
elseif(CONFIG_FILE_LINE MATCHES "#[ \t]*cmakedefine" OR CONFIG_FILE_LINE MATCHES "\@[A-Za-z_0-9]+\@")
message(SEND_ERROR "Found unloggable line in config.h.in: ${CONFIG_FILE_LINE}")
message(SEND_ERROR "Found unloggable line in anjay_config.h.in: ${CONFIG_FILE_LINE}")
else()
set(CONFIG_FILE_VARIABLE "")
endif()
@@ -487,8 +492,8 @@ endforeach()

################# LINK #########################################################

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/config/config.h")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/anjay_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/config/anjay_config.h")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/anjay_config_log.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/config/anjay_config_log.h")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/config")
@@ -576,7 +581,7 @@ if(WITH_TEST)
ANJAY_TEST
"ANJAY_BIN_DIR=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}\"")

set(TEST_COMPILE_FLAGS "-Wno-pedantic -Wno-overlength-strings")
set(TEST_COMPILE_FLAGS "-Wno-pedantic -Wno-overlength-strings -Wno-vla")
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
set(TEST_COMPILE_FLAGS "${TEST_COMPILE_FLAGS} -Wno-jump-misses-init")
endif()
@@ -75,7 +75,7 @@ General guidelines
- When using bitfields, make sure they are not saved to persistent storage nor sent over the network - their memory layout is implementation-defined, making them non-portable.
- Avoid recursion - when writing code for an embedded platform, it is important to determine a hard limit on the stack space used by a program.
- Include license information at the top of each file you add.
- Use visibility macros defined in ``config.h`` to prevent internal symbols from being exported when using a GCC-compatible compiler. See `Visibility macros`_ section for examples.
- Use visibility macros defined in ``anjay_config.h`` to prevent internal symbols from being exported when using a GCC-compatible compiler. See `Visibility macros`_ section for examples.


Visibility macros
@@ -95,7 +95,7 @@ Visibility macros

- Source files (``.c``)::

#include <config.h>
#include <anjay_config.h>

// ... includes

@@ -9,13 +9,13 @@ Anjay is currently not supported or regularly tested (which means that builds ma
- Building as a shared library (DLL) is not currently supported
- Demo application has limited functionality - internal command line and IP Ping object are not available
- Testing frameworks are not supported
- SMS binding is not supported (applicable to commercial verion only)
- SMS binding is not supported (applicable to commercial version only)

## Prerequisites

### Note about symbolic links

Anjay repository on Github makes use of symbolic links. They are necessary for successful compilation of the project. You will need to either:
Anjay repository on GitHub makes use of symbolic links. They are necessary for successful compilation of the project. You will need to either:

- use Windows 10 version 1703 or later and enable developer mode, or
- run Git with elevated privileges
Submodule git updated 222 files
@@ -48,6 +48,7 @@
#cmakedefine WITH_CON_ATTR
#cmakedefine WITH_LEGACY_CONTENT_FORMAT_SUPPORT
#cmakedefine WITH_NET_STATS
#cmakedefine WITH_AVS_PERSISTENCE

#define ANJAY_MAX_PK_OR_IDENTITY_SIZE @MAX_PK_OR_IDENTITY_SIZE@
#define ANJAY_MAX_SERVER_PK_OR_IDENTITY_SIZE @MAX_SERVER_PK_OR_IDENTITY_SIZE@
@@ -146,7 +146,7 @@ static void demo_delete(anjay_demo_t *demo) {

iosched_release(demo->iosched);
AVS_LIST_CLEAR(&demo->allocated_strings);
free(demo);
avs_free(demo);
}

static bool has_bootstrap_server(anjay_demo_t *demo) {
@@ -373,7 +373,7 @@ static int demo_init(anjay_demo_t *demo,
}

static anjay_demo_t *demo_new(cmdline_args_t *cmdline_args) {
anjay_demo_t *demo = (anjay_demo_t*) calloc(1, sizeof(anjay_demo_t));
anjay_demo_t *demo = (anjay_demo_t*) avs_calloc(1, sizeof(anjay_demo_t));
if (!demo) {
return NULL;
}
@@ -519,9 +519,9 @@ static void log_handler(avs_log_level_t level,
}

static void cmdline_args_cleanup(cmdline_args_t *cmdline_args) {
free(cmdline_args->connection_args.public_cert_or_psk_identity);
free(cmdline_args->connection_args.private_cert_or_psk_key);
free(cmdline_args->connection_args.server_public_key);
avs_free(cmdline_args->connection_args.public_cert_or_psk_identity);
avs_free(cmdline_args->connection_args.private_cert_or_psk_key);
avs_free(cmdline_args->connection_args.server_public_key);
AVS_LIST_CLEAR(&cmdline_args->access_entries);
}

Oops, something went wrong.

0 comments on commit 8691477

Please sign in to comment.
You can’t perform that action at this time.