├── .dockerignore ├── .github └── workflows │ ├── anjay-tests.yml │ └── coverity.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── CONTRIBUTING.rst ├── Dockerfile ├── Doxyfile.in ├── LICENSE ├── NOTICE ├── README.Windows.md ├── README.md ├── cmake ├── anjay-config.cmake.in ├── anjay-version.cmake.in ├── sphinx.cmake └── toolchain │ └── afl-gcc.cmake ├── demo ├── CMakeLists.txt ├── advanced_firmware_update.c ├── advanced_firmware_update.h ├── advanced_firmware_update_addimg.c ├── advanced_firmware_update_app.c ├── demo.c ├── demo.h ├── demo_args.c ├── demo_args.h ├── demo_cmds.c ├── demo_cmds.h ├── demo_time.c ├── demo_utils.c ├── demo_utils.h ├── firmware_update.c ├── firmware_update.h ├── lwm2m_gateway.c ├── lwm2m_gateway.h ├── objects.h ├── objects │ ├── apn_conn_profile.c │ ├── binary_app_data_container.c │ ├── cell_connectivity.c │ ├── conn_monitoring.c │ ├── conn_statistics.c │ ├── device.c │ ├── download_diagnostics.c │ ├── event_log.c │ ├── ext_dev_info.c │ ├── gateway_end_devices │ │ ├── binary_app_data_container.c │ │ ├── binary_app_data_container.h │ │ ├── push_button_object.c │ │ ├── push_button_object.h │ │ ├── temperature_object.c │ │ └── temperature_object.h │ ├── geopoints.c │ ├── ip_ping.c │ ├── ipso_objects.c │ ├── location.c │ ├── portfolio.c │ └── test.c ├── software_mgmt.c └── software_mgmt.h ├── deps └── avs_coap │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Doxyfile.in │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── cmake │ ├── AddHeaderSelfSufficiencyTests.cmake │ ├── avs_coap-config.cmake.in │ └── fill-placeholders.cmake │ ├── devconfig │ ├── doc │ ├── CMakeLists.txt │ └── sphinx │ │ ├── make.bat │ │ └── source │ │ ├── ErrorHandling.rst │ │ ├── Fuzzing.rst │ │ ├── Overview.rst │ │ ├── _static │ │ └── theme_overrides.css │ │ ├── avsystem_header.png │ │ ├── conf.py.in │ │ └── index.rst │ ├── examples │ ├── CMakeLists.txt │ └── async-client │ │ ├── CMakeLists.txt │ │ └── src │ │ └── main.c │ ├── include_public │ └── avsystem │ │ └── coap │ │ ├── async.h │ │ ├── async_client.h │ │ ├── async_exchange.h │ │ ├── async_server.h │ │ ├── avs_coap_config.h.in │ │ ├── coap.h │ │ ├── code.h │ │ ├── ctx.h │ │ ├── observe.h │ │ ├── option.h │ │ ├── streaming.h │ │ ├── tcp.h │ │ ├── token.h │ │ ├── udp.h │ │ └── writer.h │ ├── src │ ├── async │ │ ├── avs_coap_async_client.c │ │ ├── avs_coap_async_client.h │ │ ├── avs_coap_async_server.c │ │ ├── avs_coap_async_server.h │ │ ├── avs_coap_exchange.c │ │ └── avs_coap_exchange.h │ ├── avs_coap_code_utils.c │ ├── avs_coap_code_utils.h │ ├── avs_coap_common_utils.c │ ├── avs_coap_common_utils.h │ ├── avs_coap_ctx.c │ ├── avs_coap_ctx.h │ ├── avs_coap_ctx_vtable.h │ ├── avs_coap_init.h │ ├── avs_coap_observe.c │ ├── avs_coap_observe.h │ ├── avs_coap_parse_utils.h │ ├── avs_coap_poison.h │ ├── avs_coap_x_log_config.h │ ├── options │ │ ├── avs_coap_iterator.c │ │ ├── avs_coap_iterator.h │ │ ├── avs_coap_option.c │ │ ├── avs_coap_option.h │ │ ├── avs_coap_options.c │ │ └── avs_coap_options.h │ ├── streaming │ │ ├── avs_coap_streaming_client.c │ │ ├── avs_coap_streaming_client.h │ │ ├── avs_coap_streaming_server.c │ │ └── avs_coap_streaming_server.h │ ├── tcp │ │ ├── avs_coap_tcp_ctx.c │ │ ├── avs_coap_tcp_ctx.h │ │ ├── avs_coap_tcp_header.c │ │ ├── avs_coap_tcp_header.h │ │ ├── avs_coap_tcp_msg.c │ │ ├── avs_coap_tcp_msg.h │ │ ├── avs_coap_tcp_pending_requests.c │ │ ├── avs_coap_tcp_pending_requests.h │ │ ├── avs_coap_tcp_signaling.c │ │ ├── avs_coap_tcp_signaling.h │ │ ├── avs_coap_tcp_utils.c │ │ └── avs_coap_tcp_utils.h │ └── udp │ │ ├── avs_coap_udp_ctx.c │ │ ├── avs_coap_udp_ctx.h │ │ ├── avs_coap_udp_header.h │ │ ├── avs_coap_udp_msg.c │ │ ├── avs_coap_udp_msg.h │ │ ├── avs_coap_udp_msg_cache.c │ │ ├── avs_coap_udp_msg_cache.h │ │ ├── avs_coap_udp_tx_params.c │ │ └── avs_coap_udp_tx_params.h │ ├── tests │ ├── fuzz │ │ ├── CMakeLists.txt │ │ ├── coap_async_api_tcp.c │ │ ├── coap_async_api_udp.c │ │ ├── coap_parse.c │ │ └── input │ │ │ ├── coap_async_api_tcp.hex │ │ │ └── recv_get_send_content │ │ │ ├── coap_async_api_tcp │ │ │ └── recv_get_send_content │ │ │ ├── coap_async_api_udp.hex │ │ │ ├── recv_get_send_content │ │ │ ├── send_block_put_recv_changed │ │ │ ├── send_get_recv_block_content │ │ │ └── send_get_recv_content │ │ │ ├── coap_async_api_udp │ │ │ ├── recv_get_send_content │ │ │ ├── send_block_put_recv_changed │ │ │ ├── send_get_recv_block_content │ │ │ └── send_get_recv_content │ │ │ ├── coap_parse │ │ │ └── empty │ │ │ └── hex-to-fuzz-input.sh │ ├── mock_clock.c │ ├── mock_clock.h │ ├── options │ │ ├── option.c │ │ └── options.c │ ├── socket.c │ ├── socket.h │ ├── tcp │ │ ├── async_client.c │ │ ├── async_server.c │ │ ├── csm.c │ │ ├── ctx.c │ │ ├── env.h │ │ ├── header.c │ │ ├── helper_functions.h │ │ ├── payload_escaper.c │ │ ├── requesting.c │ │ ├── responding.c │ │ ├── setsock.c │ │ └── utils.h │ ├── udp │ │ ├── async_client.c │ │ ├── async_client_with_big_data.c │ │ ├── async_observe.c │ │ ├── async_server.c │ │ ├── big_data.h │ │ ├── fuzzer_cases.c │ │ ├── msg.c │ │ ├── msg_cache.c │ │ ├── setsock.c │ │ ├── streaming_client.c │ │ ├── streaming_observe.c │ │ ├── streaming_server.c │ │ ├── tx_params_mock.h │ │ ├── udp_tx_params.c │ │ └── utils.h │ ├── utils.c │ └── utils.h │ └── tools │ ├── avs_common.py │ ├── conditional_headers_whitelist.json │ ├── coverage │ └── license_headers.py ├── devconfig ├── doc ├── CMakeLists.txt └── sphinx │ ├── Makefile │ ├── extensions │ ├── builders │ │ ├── __init__.py │ │ ├── dummy.py │ │ ├── snippet_source_linter.py │ │ └── snippet_source_list_references.py │ ├── file_dirtiness_checker.py │ ├── small_literal.py │ └── snippet_source.py │ ├── make.bat │ ├── snippet_sources.md5 │ └── source │ ├── API_description.rst │ ├── AdvancedTopics.rst │ ├── AdvancedTopics │ ├── AT-AccessControl.rst │ ├── AT-AttributeStorage.rst │ ├── AT-Certificates.rst │ ├── AT-CustomEventLoop.rst │ ├── AT-CustomObjects.rst │ ├── AT-CustomObjects │ │ ├── AT_CO1_SingleInstanceReadOnly.rst │ │ ├── AT_CO2_SingleInstanceExecutableAndReadOnly.rst │ │ ├── AT_CO3_MultiInstanceReadOnlyFixed.rst │ │ ├── AT_CO4_FixedInstanceWritable.rst │ │ ├── AT_CO5_MultiInstanceDynamic.rst │ │ ├── AT_CO6_MultipleResourceInstances.rst │ │ ├── AT_CO7_BootstrapAwareness.rst │ │ ├── AT_CO_BootstrapAwareness.rst │ │ ├── AT_CO_FixedInstanceWritable.rst │ │ ├── AT_CO_MultiInstanceDynamic.rst │ │ ├── AT_CO_MultiInstanceReadOnlyFixed.rst │ │ ├── AT_CO_MultipleResourceInstances.rst │ │ ├── AT_CO_SingleInstanceExecutableAndReadOnly.rst │ │ ├── AT_CO_SingleInstanceReadOnly.rst │ │ └── Anjay_codegen_note.rst │ ├── AT-EventLoopNotes.rst │ ├── AT-IpsoObjects.rst │ ├── AT-NetworkErrorHandling.rst │ ├── AT-OtherFeatures.rst │ ├── AT-Persistence.rst │ ├── AT-RetransmissionsTimeoutsCaching.rst │ └── _images │ │ ├── anjay-block-client-request.svg │ │ ├── anjay-block-response-to-server-request.svg │ │ ├── anjay-client-request.svg │ │ ├── anjay-firmware-handling.svg │ │ ├── anjay-notification.svg │ │ ├── anjay-read.svg │ │ ├── anjay-server-block-request.svg │ │ ├── anjay-server-request.svg │ │ ├── anjay-write-replace-instance.svg │ │ └── anjay-write-resource.svg │ ├── BasicClient.rst │ ├── BasicClient │ ├── BC-Initialization.rst │ ├── BC-MandatoryObjects.rst │ ├── BC-Notifications.rst │ ├── BC-ObjectImplementation.rst │ ├── BC-Security.rst │ ├── BC-Send.rst │ └── BC-ThreadSafety.rst │ ├── CommercialFeatures.rst │ ├── CommercialFeatures │ ├── CF-CorePersistence.rst │ ├── CF-CustomHardwareSupport.rst │ ├── CF-EST.rst │ ├── CF-FSDM.rst │ ├── CF-HSM.rst │ ├── CF-IoTSAFE.rst │ ├── CF-NIDD.rst │ ├── CF-OSCORE.rst │ ├── CF-SMSBinding.rst │ └── CF-SmartCardBootstrap.rst │ ├── Compiling_client_applications.rst │ ├── FirmwareUpdateTutorial.rst │ ├── FirmwareUpdateTutorial │ ├── FU-AdvancedFirmwareUpdate.rst │ ├── FU-AdvancedFirmwareUpdate │ │ ├── FU-AFU-BasicImplementation.rst │ │ ├── FU-AFU-Examples.rst │ │ ├── FU-AFU-ResourceDefinitions.rst │ │ ├── FU-AFU-StateDiagram.rst │ │ ├── _files │ │ │ └── 33629.xml │ │ └── _images │ │ │ └── FU-AFU-StateDiagram.svg │ ├── FU-BasicImplementation.rst │ ├── FU-DownloadResumption.rst │ ├── FU-Introduction.rst │ ├── FU-ModesAndProtocols.rst │ ├── FU-PoorConnectivity.rst │ ├── FU-SecureDownloads.rst │ ├── FU1.rst │ ├── FU2.rst │ ├── FU3.rst │ ├── FU4.rst │ ├── FU5.rst │ ├── FU6.rst │ └── _images │ │ └── anjay-firmware-download-coap-pull.svg │ ├── Introduction.rst │ ├── LwM2M.rst │ ├── LwM2MGateway.rst │ ├── LwM2MGateway │ ├── LwM2MGatewayAPI.rst │ ├── LwM2MGatewayIntro.rst │ ├── LwM2MGatewayNotifications.rst │ └── LwM2MGatewaySend.rst │ ├── Migrating.rst │ ├── Migrating │ ├── MigratingCustomEntropy.rst │ ├── MigratingFromAnjay214.rst │ ├── MigratingFromAnjay215.rst │ ├── MigratingFromAnjay225.rst │ ├── MigratingFromAnjay24.rst │ ├── MigratingFromAnjay26.rst │ ├── MigratingFromAnjay27.rst │ ├── MigratingFromAnjay28.rst │ ├── MigratingFromAnjay30.rst │ ├── MigratingFromAnjay32.rst │ ├── MigratingFromAnjay33.rst │ ├── MigratingFromAnjay34.rst │ └── MigratingFromAnjay37.rst │ ├── PortingGuideForNonPOSIXPlatforms.rst │ ├── PortingGuideForNonPOSIXPlatforms │ ├── CustomTLS.rst │ ├── CustomTLS │ │ ├── CustomTLS-CertificatesAdvanced.rst │ │ ├── CustomTLS-CertificatesBasic.rst │ │ ├── CustomTLS-ConfigFeatures.rst │ │ ├── CustomTLS-Minimal.rst │ │ ├── CustomTLS-Resumption.rst │ │ ├── CustomTLS-Stub.rst │ │ └── CustomTLS-TCPSupport.rst │ ├── NetworkingAPI.rst │ ├── NetworkingAPI │ │ ├── NetworkingAPI-Bind.rst │ │ ├── NetworkingAPI-EventLoopSupport.rst │ │ ├── NetworkingAPI-IpStickiness.rst │ │ ├── NetworkingAPI-Minimal.rst │ │ ├── NetworkingAPI-OtherFeatures.rst │ │ ├── NetworkingAPI-RemoteHostPort.rst │ │ ├── NetworkingAPI-ShutdownRemoteHostname.rst │ │ ├── NetworkingAPI-Stats.rst │ │ ├── NetworkingAPI1.rst │ │ ├── NetworkingAPI2.rst │ │ ├── NetworkingAPI3.rst │ │ ├── NetworkingAPI4.rst │ │ ├── NetworkingAPI5.rst │ │ ├── NetworkingAPI6.rst │ │ └── NetworkingAPI7.rst │ ├── ThreadingAPI.rst │ └── TimeAPI.rst │ ├── Tools.rst │ ├── Tools │ ├── CliLwM2MServer.rst │ ├── FactoryProvisioning.rst │ ├── PackagesGenerator.rst │ ├── StandaloneObjects.rst │ └── StubGenerator.rst │ ├── _static │ └── theme_overrides.css │ ├── avsystem_header.png │ ├── avsystem_logo.png │ ├── conf.py.in │ └── index.rst ├── example_configs ├── README.md ├── embedded_lwm2m10 │ ├── anjay │ │ └── anjay_config.h │ └── avsystem │ │ ├── coap │ │ └── avs_coap_config.h │ │ └── commons │ │ ├── avs_commons_config.h │ │ └── lwip-posix-compat.h ├── embedded_lwm2m11 │ ├── anjay │ │ └── anjay_config.h │ └── avsystem │ │ ├── coap │ │ └── avs_coap_config.h │ │ └── commons │ │ ├── avs_commons_config.h │ │ └── lwip-posix-compat.h ├── linux_lwm2m10 │ ├── anjay │ │ └── anjay_config.h │ └── avsystem │ │ ├── coap │ │ └── avs_coap_config.h │ │ └── commons │ │ └── avs_commons_config.h └── linux_lwm2m11 │ ├── anjay │ └── anjay_config.h │ └── avsystem │ ├── coap │ └── avs_coap_config.h │ └── commons │ └── avs_commons_config.h ├── examples ├── CMakeLists.txt ├── commercial-features │ ├── CF-CorePersistence │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-EST-PKCS11 │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-EST │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-NIDD │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── nidd_demo_driver.c │ │ │ └── nidd_demo_driver.h │ ├── CF-OSCORE │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-PKCS11 │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-PSA-PKI │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-PSA-PSK │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-PSA-bootstrap │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-PSA-management │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-SMS-PSK │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-SMS-UDP │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-SMS │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── CF-SmartCardBootstrap │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ └── CMakeLists.txt ├── custom-network │ ├── CMakeLists.txt │ ├── bind │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ └── net_impl.c │ ├── ip-stickiness │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ └── net_impl.c │ ├── minimal │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ └── net_impl.c │ ├── remote-host-port │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ └── net_impl.c │ ├── shutdown-remote-hostname │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ └── net_impl.c │ └── stats │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── main.c │ │ └── net_impl.c ├── custom-tls │ ├── CMakeLists.txt │ ├── certificates-advanced-fake-dane │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── certificates-advanced │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── certificates-basic │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── config-features │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── minimal │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── resumption-buffer │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── resumption-simple │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ ├── stub │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── net_impl.c │ │ │ └── tls_impl.c │ └── tcp-support │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── firmware_update.c │ │ ├── firmware_update.h │ │ ├── main.c │ │ ├── net_impl.c │ │ ├── time_object.c │ │ ├── time_object.h │ │ └── tls_impl.c └── tutorial │ ├── AT-AccessControl │ ├── CMakeLists.txt │ └── src │ │ ├── main.c │ │ ├── test_object.c │ │ └── test_object.h │ ├── AT-Certificates │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── AT-CustomEventLoop │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── AT-CustomObjects │ ├── CMakeLists.txt │ ├── bootstrap-awareness │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── multi-instance-dynamic │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── test_object.c │ │ │ └── test_object.h │ ├── multi-instance-resources-dynamic │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── main.c │ │ │ ├── test_object.c │ │ │ └── test_object.h │ ├── read-only-multiple-fixed │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── read-only-with-executable │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── read-only │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── writable-multiple-fixed-transactional │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ └── writable-multiple-fixed │ │ ├── CMakeLists.txt │ │ └── src │ │ └── main.c │ ├── AT-Downloader │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── AT-IpsoObjects │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── AT-Persistence │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── BC-Initialization │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── BC-MandatoryObjects │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── BC-Notifications │ ├── CMakeLists.txt │ └── src │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ ├── BC-ObjectImplementation │ ├── CMakeLists.txt │ └── src │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ ├── BC-Security │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── BC-Send │ ├── CMakeLists.txt │ └── src │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ ├── BC-ThreadSafety │ ├── CMakeLists.txt │ └── src │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ ├── CMakeLists.txt │ ├── LwM2M-Gateway │ ├── CMakeLists.txt │ ├── end_device.py │ └── src │ │ ├── gateway_server.c │ │ ├── gateway_server.h │ │ ├── main.c │ │ ├── temperature_object.c │ │ └── temperature_object.h │ └── firmware-update │ ├── CMakeLists.txt │ ├── advanced-firmware-update │ ├── CMakeLists.txt │ └── src │ │ ├── advanced_firmware_update.c │ │ ├── advanced_firmware_update.h │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ ├── basic-implementation │ ├── CMakeLists.txt │ └── src │ │ ├── firmware_update.c │ │ ├── firmware_update.h │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ ├── download-resumption │ ├── CMakeLists.txt │ └── src │ │ ├── firmware_update.c │ │ ├── firmware_update.h │ │ ├── main.c │ │ ├── time_object.c │ │ └── time_object.h │ └── secure-downloads │ ├── CMakeLists.txt │ └── src │ ├── firmware_update.c │ ├── firmware_update.h │ ├── main.c │ ├── time_object.c │ └── time_object.h ├── include_public └── anjay │ ├── access_control.h │ ├── advanced_fw_update.h │ ├── anjay.h │ ├── anjay_config.h.in │ ├── attr_storage.h │ ├── core.h │ ├── dm.h │ ├── download.h │ ├── factory_provisioning.h │ ├── fw_update.h │ ├── io.h │ ├── ipso_objects.h │ ├── ipso_objects_v2.h │ ├── lwm2m_gateway.h │ ├── lwm2m_send.h │ ├── security.h │ ├── server.h │ ├── stats.h │ └── sw_mgmt.h ├── ltoconfig ├── requirements.txt ├── src ├── anjay_config_log.h ├── anjay_init.h ├── anjay_modules │ ├── anjay_access_utils.h │ ├── anjay_attr_storage_utils.h │ ├── anjay_bootstrap.h │ ├── anjay_dm_utils.h │ ├── anjay_io_utils.h │ ├── anjay_lwm2m_gateway.h │ ├── anjay_notify.h │ ├── anjay_raw_buffer.h │ ├── anjay_sched.h │ ├── anjay_servers.h │ ├── anjay_time_defs.h │ ├── anjay_utils_core.h │ └── dm │ │ ├── anjay_execute.h │ │ └── anjay_modules.h ├── core │ ├── anjay_access_utils.c │ ├── anjay_access_utils_private.h │ ├── anjay_bootstrap_core.c │ ├── anjay_bootstrap_core.h │ ├── anjay_core.c │ ├── anjay_core.h │ ├── anjay_dm_core.c │ ├── anjay_dm_core.h │ ├── anjay_downloader.h │ ├── anjay_event_loop.c │ ├── anjay_io_core.c │ ├── anjay_io_core.h │ ├── anjay_io_utils.c │ ├── anjay_lwm2m_send.c │ ├── anjay_lwm2m_send.h │ ├── anjay_notify.c │ ├── anjay_raw_buffer.c │ ├── anjay_servers_inactive.h │ ├── anjay_servers_private.h │ ├── anjay_servers_reload.h │ ├── anjay_servers_utils.c │ ├── anjay_servers_utils.h │ ├── anjay_stats.c │ ├── anjay_stats.h │ ├── anjay_utils_core.c │ ├── anjay_utils_private.h │ ├── attr_storage │ │ ├── anjay_attr_storage.c │ │ ├── anjay_attr_storage.h │ │ ├── anjay_attr_storage_persistence.c │ │ └── anjay_attr_storage_private.h │ ├── coap │ │ ├── anjay_content_format.h │ │ └── anjay_msg_details.h │ ├── dm │ │ ├── anjay_discover.c │ │ ├── anjay_discover.h │ │ ├── anjay_dm_attributes.c │ │ ├── anjay_dm_attributes.h │ │ ├── anjay_dm_create.c │ │ ├── anjay_dm_create.h │ │ ├── anjay_dm_execute.c │ │ ├── anjay_dm_execute.h │ │ ├── anjay_dm_handlers.c │ │ ├── anjay_dm_read.c │ │ ├── anjay_dm_read.h │ │ ├── anjay_dm_write.c │ │ ├── anjay_dm_write.h │ │ ├── anjay_dm_write_attrs.c │ │ ├── anjay_dm_write_attrs.h │ │ ├── anjay_modules.c │ │ ├── anjay_query.c │ │ └── anjay_query.h │ ├── downloader │ │ ├── anjay_coap.c │ │ ├── anjay_downloader.c │ │ ├── anjay_http.c │ │ └── anjay_private.h │ ├── io │ │ ├── anjay_base64_out.c │ │ ├── anjay_base64_out.h │ │ ├── anjay_batch_builder.c │ │ ├── anjay_batch_builder.h │ │ ├── anjay_cbor_in.c │ │ ├── anjay_cbor_out.c │ │ ├── anjay_common.c │ │ ├── anjay_common.h │ │ ├── anjay_corelnk.c │ │ ├── anjay_corelnk.h │ │ ├── anjay_dynamic.c │ │ ├── anjay_input_buf.c │ │ ├── anjay_json_encoder.c │ │ ├── anjay_json_like_decoder.c │ │ ├── anjay_json_like_decoder.h │ │ ├── anjay_json_like_decoder_vtable.h │ │ ├── anjay_opaque.c │ │ ├── anjay_output_buf.c │ │ ├── anjay_senml_in.c │ │ ├── anjay_senml_like_encoder.c │ │ ├── anjay_senml_like_encoder.h │ │ ├── anjay_senml_like_encoder_vtable.h │ │ ├── anjay_senml_like_out.c │ │ ├── anjay_text.c │ │ ├── anjay_tlv.h │ │ ├── anjay_tlv_in.c │ │ ├── anjay_tlv_out.c │ │ ├── anjay_vtable.h │ │ ├── cbor │ │ │ ├── anjay_cbor_encoder_ll.c │ │ │ ├── anjay_cbor_encoder_ll.h │ │ │ ├── anjay_cbor_types.h │ │ │ ├── anjay_json_like_cbor_decoder.c │ │ │ ├── anjay_json_like_cbor_decoder.h │ │ │ └── anjay_senml_cbor_encoder.c │ │ └── json │ │ │ ├── anjay_json_decoder.c │ │ │ └── anjay_json_decoder.h │ ├── observe │ │ ├── anjay_observe_core.c │ │ ├── anjay_observe_core.h │ │ ├── anjay_observe_internal.h │ │ └── anjay_observe_planning.c │ └── servers │ │ ├── anjay_activate.c │ │ ├── anjay_activate.h │ │ ├── anjay_connection_ip.c │ │ ├── anjay_connections.c │ │ ├── anjay_connections.h │ │ ├── anjay_connections_internal.h │ │ ├── anjay_register.c │ │ ├── anjay_register.h │ │ ├── anjay_reload.c │ │ ├── anjay_security.h │ │ ├── anjay_security_generic.c │ │ ├── anjay_server_connections.c │ │ ├── anjay_server_connections.h │ │ ├── anjay_servers_internal.c │ │ └── anjay_servers_internal.h └── modules │ ├── access_control │ ├── anjay_access_control_handlers.c │ ├── anjay_access_control_persistence.c │ ├── anjay_mod_access_control.c │ └── anjay_mod_access_control.h │ ├── advanced_fw_update │ └── anjay_advanced_fw_update.c │ ├── factory_provisioning │ └── anjay_provisioning.c │ ├── fw_update │ └── anjay_fw_update.c │ ├── ipso │ ├── anjay_ipso_3d_sensor.c │ ├── anjay_ipso_basic_sensor.c │ └── anjay_ipso_button.c │ ├── ipso_v2 │ ├── anjay_ipso_v2_3d_sensor.c │ └── anjay_ipso_v2_basic_sensor.c │ ├── lwm2m_gateway │ └── anjay_lwm2m_gateway.c │ ├── security │ ├── anjay_mod_security.c │ ├── anjay_mod_security.h │ ├── anjay_security_persistence.c │ ├── anjay_security_transaction.c │ ├── anjay_security_transaction.h │ ├── anjay_security_utils.c │ └── anjay_security_utils.h │ ├── server │ ├── anjay_mod_server.c │ ├── anjay_mod_server.h │ ├── anjay_server_persistence.c │ ├── anjay_server_transaction.c │ ├── anjay_server_transaction.h │ ├── anjay_server_utils.c │ └── anjay_server_utils.h │ └── sw_mgmt │ └── anjay_sw_mgmt.c ├── standalone ├── security │ ├── standalone_mod_security.c │ ├── standalone_mod_security.h │ ├── standalone_security.h │ ├── standalone_security_persistence.c │ ├── standalone_security_transaction.c │ ├── standalone_security_transaction.h │ ├── standalone_security_utils.c │ └── standalone_security_utils.h └── server │ ├── standalone_mod_server.c │ ├── standalone_mod_server.h │ ├── standalone_server.h │ ├── standalone_server_persistence.c │ ├── standalone_server_transaction.c │ ├── standalone_server_transaction.h │ ├── standalone_server_utils.c │ └── standalone_server_utils.h ├── tests ├── codegen │ ├── CMakeLists.txt │ ├── check_with_object_registry.sh │ └── input │ │ ├── execute.xml │ │ ├── multiple-object.xml │ │ ├── read.xml │ │ ├── sanitization.xml │ │ └── write.xml ├── core │ ├── anjay.c │ ├── attr_storage │ │ ├── attr_storage.c │ │ ├── attr_storage_test.h │ │ └── persistence.c │ ├── bootstrap.c │ ├── bootstrap_mock.h │ ├── coap │ │ ├── utils.c │ │ └── utils.h │ ├── dm.c │ ├── downloader │ │ └── downloader.c │ ├── io.c │ ├── io │ │ ├── batch_builder.c │ │ ├── bigdata.h │ │ ├── cbor │ │ │ ├── cbor_decoder.c │ │ │ └── cbor_encoder.c │ │ ├── cbor_in.c │ │ ├── corelnk.c │ │ ├── dm_batch.c │ │ ├── dynamic.c │ │ ├── json │ │ │ └── json_decoder.c │ │ ├── json_in.c │ │ ├── lwm2m_cbor_out.c │ │ ├── raw_cbor_in.c │ │ ├── senml_cbor_encoder.c │ │ ├── senml_cbor_out.c │ │ ├── senml_in_common.h │ │ ├── senml_json_encoder.c │ │ ├── text.c │ │ ├── tlv_in.c │ │ └── tlv_out.c │ ├── lwm2m_send.c │ ├── observe │ │ ├── observe.c │ │ └── observe_mock.h │ ├── socket_mock.c │ ├── socket_mock.h │ └── utils.c ├── doc │ └── runtest.py ├── fuzz │ ├── CMakeLists.txt │ ├── cbor │ │ └── decoder.c │ └── test_cases │ │ ├── cbor_decoder │ │ ├── boring │ │ └── invalid │ │ ├── coap_stream │ │ └── valid_coap_msg │ │ ├── coap_stream_request │ │ └── basic │ │ └── coap_stream_response │ │ └── basic ├── integration │ ├── CMakeLists.txt │ ├── framework │ │ ├── __init__.py │ │ ├── asserts.py │ │ ├── coap_file_server.py │ │ ├── create_package.py │ │ ├── create_xlsx_test_report.py │ │ ├── lwm2m │ │ │ ├── __init__.py │ │ │ ├── coap │ │ │ │ ├── __init__.py │ │ │ │ ├── code.py │ │ │ │ ├── content_format.py │ │ │ │ ├── option.py │ │ │ │ ├── packet.py │ │ │ │ ├── server.py │ │ │ │ ├── transport.py │ │ │ │ ├── type.py │ │ │ │ └── utils.py │ │ │ ├── messages.py │ │ │ ├── path.py │ │ │ ├── senml_cbor.py │ │ │ ├── server.py │ │ │ └── tlv.py │ │ ├── lwm2m_test.py │ │ ├── nsh-lwm2m │ │ │ ├── cbor_shell.py │ │ │ ├── nsh_lwm2m.py │ │ │ ├── pymbedtls │ │ │ │ ├── setup.py │ │ │ │ └── src │ │ │ │ │ ├── common.cpp │ │ │ │ │ ├── common.hpp │ │ │ │ │ ├── context.cpp │ │ │ │ │ ├── context.hpp │ │ │ │ │ ├── pybind11_interop.hpp │ │ │ │ │ ├── pymbedtls.cpp │ │ │ │ │ ├── security.cpp │ │ │ │ │ ├── security.hpp │ │ │ │ │ ├── socket.cpp │ │ │ │ │ └── socket.hpp │ │ │ └── tlv_shell.py │ │ ├── pretty_test_runner.py │ │ ├── serialize_senml_cbor.py │ │ ├── test_suite.py │ │ └── test_utils.py │ ├── run_tests.sh.in │ ├── runtest.py │ └── suites │ │ ├── __init__.py │ │ ├── default │ │ ├── __init__.py │ │ ├── access_control.py │ │ ├── advanced_firmware_update.py │ │ ├── async.py │ │ ├── block_response.py │ │ ├── block_write.py │ │ ├── bootstrap_client.py │ │ ├── bootstrap_discover.py │ │ ├── bootstrap_factory.py │ │ ├── bootstrap_server.py │ │ ├── bootstrap_sync.py │ │ ├── bootstrap_transaction.py │ │ ├── buffer_sizes.py │ │ ├── cbor_encoding.py │ │ ├── cbor_requests.py │ │ ├── client_block_request.py │ │ ├── coap.py │ │ ├── con_attr.py │ │ ├── conn_status_api.py │ │ ├── connection_id.py │ │ ├── crash.py │ │ ├── create.py │ │ ├── critical_opts.py │ │ ├── disable_server.py │ │ ├── downloader.py │ │ ├── factory_provisioning.py │ │ ├── firmware_update.py │ │ ├── forbidden_on_register.py │ │ ├── formats.py │ │ ├── hierarchical_cbor_encoding.py │ │ ├── ipso_objects.py │ │ ├── json_encoding.py │ │ ├── json_requests.py │ │ ├── lwm2m_gateway.py │ │ ├── lwm2m_gateway_observe_attributes.py │ │ ├── modify_servers.py │ │ ├── msg_cache.py │ │ ├── notification_timestamps.py │ │ ├── notifications.py │ │ ├── observe_attributes.py │ │ ├── offline.py │ │ ├── plaintext_base64.py │ │ ├── port_rebind.py │ │ ├── queue_mode.py │ │ ├── read_composite.py │ │ ├── reboot.py │ │ ├── register.py │ │ ├── request_too_large.py │ │ ├── retransmissions.py │ │ ├── security.py │ │ ├── send.py │ │ ├── senml_json_encoding.py │ │ ├── separate_response.py │ │ ├── software_mgmt.py │ │ ├── stats.py │ │ ├── test_object.py │ │ ├── time_api.py │ │ ├── unregister.py │ │ ├── update.py │ │ ├── uri_change_reregister.py │ │ └── write_composite.py │ │ ├── sensitive │ │ ├── __init__.py │ │ ├── advanced_firmware_update.py │ │ ├── bootstrap_client.py │ │ ├── firmware_update.py │ │ └── update.py │ │ └── testfest │ │ ├── __init__.py │ │ ├── bootstrap.py │ │ ├── dm │ │ ├── __init__.py │ │ ├── advanced_firmware_update.py │ │ ├── connectivity_management.py │ │ ├── connectivity_monitoring.py │ │ ├── connectivity_statistics.py │ │ ├── device.py │ │ ├── firmware_update.py │ │ ├── location.py │ │ ├── portfolio.py │ │ └── utils.py │ │ ├── management.py │ │ ├── multi_servers.py │ │ ├── register.py │ │ ├── reporting.py │ │ └── security.py ├── modules │ ├── access_control │ │ ├── access_control.c │ │ └── persistence.c │ ├── factory_provisioning │ │ └── provisioning.c │ ├── lwm2m_gateway │ │ └── lwm2m_gateway.c │ ├── security │ │ ├── api.c │ │ └── persistence.c │ └── server │ │ ├── api.c │ │ └── persistence.c └── utils │ ├── coap │ ├── socket.c │ └── socket.h │ ├── dm.c │ ├── dm.h │ ├── mock_clock.c │ ├── mock_clock.h │ ├── mock_dm.c │ ├── mock_dm.h │ └── utils.h ├── tools ├── analyze ├── anjay_codegen.py ├── anjay_config_log_tool.py ├── avs_common.py ├── ci-psa │ ├── Dockerfile │ └── README.md ├── ci │ ├── build-docker-images.sh │ ├── rockylinux-9 │ │ └── Dockerfile │ ├── ubuntu-20.04 │ │ └── Dockerfile │ └── ubuntu-22.04 │ │ └── Dockerfile ├── conditional_headers_whitelist.json ├── coverage ├── find_unused_code.py ├── generate-certs.sh ├── generate_doxygen_config.sh ├── license_headers.py ├── lwm2m_object_registry.py ├── markdown-toc.py ├── provisioning-tool │ ├── configs │ │ ├── cert_info.json │ │ ├── endpoint_cfg │ │ └── lwm2m_server.json │ ├── factory_prov │ │ ├── __init__.py │ │ ├── cert_gen.py │ │ └── factory_prov.py │ └── ptool.py ├── symlink-check.sh ├── test_duplicates.py ├── test_ghactions.py └── utils.sh └── valgrind_test.supp /.dockerignore: -------------------------------------------------------------------------------- 1 | # binaries 2 | *.a 3 | *.so 4 | *.so.* 5 | /demo/demo 6 | 7 | # NetBeans Project 8 | nbproject 9 | 10 | # IDEA-based IDE project 11 | .idea/ 12 | 13 | # VSCode 14 | .vscode/ 15 | 16 | # build configuration autogenerated files 17 | /build 18 | /output 19 | *.swp 20 | CMakeFiles/ 21 | CMakeTmp/ 22 | CMakeCache.txt 23 | CMakeDoxyfile.in 24 | CMakeDoxygenDefaults.cmake 25 | cmake_install.cmake 26 | install_manifest.txt 27 | _CPack_Packages/ 28 | CPackConfig.cmake 29 | CPackSourceConfig.cmake 30 | CTestTestfile.cmake 31 | Testing/ 32 | /include_public/anjay/anjay_config.h 33 | posix-config.h 34 | anjay-*.cmake 35 | Doxyfile 36 | /doc/sphinx/source/conf.py 37 | tests/integration/framework/nsh-lwm2m/pymbedtls/build/ 38 | 39 | # other 40 | Makefile 41 | *.log 42 | *.gcda 43 | *.gcno 44 | *.gcov 45 | *~ 46 | tags 47 | .ycm_extra_conf.py 48 | .ycm_extra_conf.pyc 49 | /tests/codegen/*.c 50 | /tests/codegen/*.cpp 51 | /tests/integration/build 52 | __pycache__/ 53 | .gdb_history 54 | *.orig 55 | *.egg-info 56 | *.pyc 57 | /tests/integration/framework/nsh-lwm2m/coap/pymbedtls* 58 | compile_commands.json 59 | 60 | /avs_commons/install 61 | /doc/sphinx/build 62 | /doc/sphinx/html 63 | /doc/doxygen 64 | /doc/sphinx/source/.doctrees 65 | !/doc/sphinx/Makefile 66 | 67 | # built tutorials 68 | examples/build 69 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # binaries 2 | *.a 3 | *.so 4 | *.so.* 5 | /demo/demo 6 | 7 | # NetBeans Project 8 | nbproject 9 | 10 | # IDEA-based IDE project 11 | .idea/ 12 | 13 | # VSCode 14 | .vscode/ 15 | 16 | # build configuration autogenerated files 17 | /build 18 | /coverage 19 | /output 20 | *.swp 21 | CMakeFiles/ 22 | CMakeTmp/ 23 | CMakeCache.txt 24 | CMakeDoxyfile.in 25 | CMakeDoxygenDefaults.cmake 26 | cmake_install.cmake 27 | install_manifest.txt 28 | _CPack_Packages/ 29 | CPackConfig.cmake 30 | CPackSourceConfig.cmake 31 | CTestTestfile.cmake 32 | Testing/ 33 | /include_public/anjay/anjay_config.h 34 | posix-config.h 35 | anjay-*.cmake 36 | Doxyfile 37 | /doc/sphinx/source/conf.py 38 | tests/integration/run_tests.sh 39 | tests/integration/framework/nsh-lwm2m/pymbedtls/build/ 40 | 41 | # other 42 | Makefile 43 | *.log 44 | *.gcda 45 | *.gcno 46 | *.gcov 47 | *~ 48 | tags 49 | .ycm_extra_conf.py 50 | .ycm_extra_conf.pyc 51 | /tests/codegen/*.c 52 | /tests/codegen/*.cpp 53 | /tests/integration/build 54 | __pycache__/ 55 | .gdb_history 56 | *.orig 57 | *.egg-info 58 | *.pyc 59 | *.cache 60 | /tests/integration/framework/nsh-lwm2m/coap/pymbedtls* 61 | compile_commands.json 62 | 63 | /avs_commons/install 64 | /doc/sphinx/build 65 | /doc/sphinx/html 66 | /doc/doxygen 67 | /doc/sphinx/source/.doctrees 68 | !/doc/sphinx/Makefile 69 | 70 | # built tutorials 71 | examples/*-build 72 | 73 | # Anjay persistence files 74 | *-persistence.dat 75 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tests/integration/framework/nsh-lwm2m/pymbedtls/src/pybind11"] 2 | path = tests/integration/framework/nsh-lwm2m/pymbedtls/src/pybind11 3 | url = https://github.com/pybind/pybind11.git 4 | ignore = untracked 5 | [submodule "tests/integration/framework/nsh-lwm2m/powercmd"] 6 | path = tests/integration/framework/nsh-lwm2m/powercmd 7 | url = https://github.com/dextero/powercmd.git 8 | [submodule "deps/avs_commons"] 9 | path = deps/avs_commons 10 | url = https://github.com/AVSystem/avs_commons.git 11 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | 9 | FROM ubuntu:20.04 10 | 11 | WORKDIR /Anjay 12 | 13 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq git build-essential cmake libmbedtls-dev zlib1g-dev 14 | 15 | COPY . . 16 | 17 | RUN cmake . 18 | RUN make -j 19 | 20 | ENV HOME /Anjay 21 | 22 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Anjay 2 | Copyright 2017-2025 AVSystem 3 | 4 | This product includes software developed at AVSystem (www.avsystem.com). 5 | 6 | This product bundles the AVSystem Commons Library 7 | (https://github.com/AVSystem/avs_commons), licensed under the terms of the 8 | Apache License, version 2.0. See deps/avs_commons/NOTICE file for details. 9 | 10 | This product's integration testing framework uses pybind11 11 | (https://github.com/pybind/pybind11), licensed under the terms of 12 | a 3-clause BSD-style license. For details, see the 13 | tests/integration/framework/nsh-lwm2m/pymbedtls/src/pybind11/LICENSE file. 14 | -------------------------------------------------------------------------------- /cmake/anjay-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | set(ANJAY_VERSION "@ANJAY_VERSION@") 9 | 10 | get_filename_component(CURR_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 11 | 12 | if(NOT DEFINED avs_commons_DIR) 13 | set(avs_commons_DIR "${CMAKE_CURRENT_LIST_DIR}/../avs_commons") 14 | endif() 15 | find_package(avs_commons REQUIRED COMPONENTS @AVS_COMMONS_COMPONENTS@) 16 | 17 | if(NOT DEFINED avs_coap_DIR) 18 | set(avs_coap_DIR "${CMAKE_CURRENT_LIST_DIR}/../avs_coap") 19 | endif() 20 | find_package(avs_coap REQUIRED) 21 | 22 | include(${CURR_DIR}/@PROJECT_NAME@-targets.cmake) 23 | 24 | get_filename_component(ANJAY_INCLUDE_DIRS "${CURR_DIR}/../../@INCLUDE_INSTALL_DIR@" ABSOLUTE) 25 | set(ANJAY_INCLUDE_DIRS "${ANJAY_INCLUDE_DIRS}" "${AVS_COMMONS_INCLUDE_DIRS}") 26 | set(ANJAY_LIBRARIES @PROJECT_NAME@) 27 | set(ANJAY_LIBRARIES_STATIC @PROJECT_NAME@) 28 | 29 | unset(CURR_DIR) 30 | -------------------------------------------------------------------------------- /cmake/anjay-version.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | set(PACKAGE_VERSION "@ANJAY_VERSION@") 9 | 10 | if (${PACKAGE_VERSION} VERSION_LESS ${PACKAGE_FIND_VERSION}) 11 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 12 | else() 13 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 14 | if (${PACKAGE_FIND_VERSION} STREQUAL ${PACKAGE_VERSION}) 15 | set(PACKAGE_VERSION_EXACT TRUE) 16 | endif() 17 | endif() 18 | -------------------------------------------------------------------------------- /cmake/sphinx.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | function(sphinx_generate 9 | OUTBASE 10 | OUTTITLE 11 | INCLUDE_FILES 12 | INCLUDE_ROOT_PATH) 13 | message(STATUS "generating sphinx sources for ${OUTBASE}") 14 | 15 | file(MAKE_DIRECTORY "${OUTBASE}") 16 | set(SHORTNAMES) 17 | foreach(FNAME ${INCLUDE_FILES}) 18 | string(REGEX REPLACE "^.*/([^.]*)[.]h$" "\\1" SHORTNAME "${FNAME}") 19 | list(APPEND SHORTNAMES "${SHORTNAME}") 20 | 21 | file(RELATIVE_PATH RELATIVE_FNAME ${INCLUDE_ROOT_PATH} ${FNAME}) 22 | 23 | set(TITLE "``${RELATIVE_FNAME}``") 24 | string(LENGTH "${TITLE}" TITLELEN) 25 | string(RANDOM LENGTH ${TITLELEN} ALPHABET "#" TITLEHEAD) 26 | 27 | message(STATUS "generating ${OUTBASE}/${SHORTNAME}.rst") 28 | 29 | file(WRITE "${OUTBASE}/${SHORTNAME}.rst" 30 | "${TITLEHEAD} 31 | ${TITLE} 32 | ${TITLEHEAD} 33 | 34 | .. contents:: :local: 35 | 36 | .. highlight:: c 37 | 38 | .. doxygenfile:: ${RELATIVE_FNAME}") 39 | endforeach() 40 | 41 | string(LENGTH "${OUTTITLE}" TITLELEN) 42 | string(RANDOM LENGTH ${TITLELEN} ALPHABET "#" OUTTITLEHEADER) 43 | string(REGEX REPLACE "^.*/" "" SHORTOUTBASE "${OUTBASE}") 44 | 45 | set(OUTPUT 46 | "${OUTTITLEHEADER} 47 | ${OUTTITLE} 48 | ${OUTTITLEHEADER} 49 | 50 | .. toctree:: 51 | ") 52 | 53 | foreach(SHORTNAME ${SHORTNAMES}) 54 | set(OUTPUT "${OUTPUT} 55 | ${SHORTOUTBASE}/${SHORTNAME}") 56 | endforeach() 57 | file(WRITE "${OUTBASE}.rst" "${OUTPUT}") 58 | endfunction() 59 | -------------------------------------------------------------------------------- /cmake/toolchain/afl-gcc.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | set(AFL_FUZZER_DIR "" CACHE STRING "AFL fuzzer binary directory") 9 | if(AFL_FUZZER_DIR) 10 | set(CMAKE_C_COMPILER "${AFL_FUZZER_DIR}/afl-gcc") 11 | else() 12 | set(CMAKE_C_COMPILER afl-gcc) 13 | endif() 14 | -------------------------------------------------------------------------------- /demo/demo_cmds.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef DEMO_CMDS_H 11 | #define DEMO_CMDS_H 12 | 13 | typedef struct { 14 | struct anjay_demo_struct *demo; 15 | char cmd[]; 16 | } demo_command_invocation_t; 17 | 18 | void demo_command_dispatch(const demo_command_invocation_t *invocation); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /demo/lwm2m_gateway.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef LWM2M_GATEWAY_H 11 | #define LWM2M_GATEWAY_H 12 | 13 | #include 14 | 15 | #ifdef ANJAY_WITH_LWM2M_GATEWAY 16 | 17 | # include 18 | 19 | # define LWM2M_GATEWAY_END_DEVICE_COUNT 2 20 | // keep it equal to LWM2M_GATEWAY_END_DEVICE_COUNT - 1 21 | # define LWM2M_GATEWAY_END_DEVICE_RANGE 1 22 | 23 | int lwm2m_gateway_setup(anjay_t *anjay); 24 | void lwm2m_gateway_cleanup(anjay_t *anjay); 25 | 26 | int lwm2m_gateway_setup_end_device(anjay_t *anjay, anjay_iid_t iid); 27 | void lwm2m_gateway_cleanup_end_device(anjay_t *anjay, anjay_iid_t iid); 28 | 29 | void lwm2m_gateway_press_button_end_device(anjay_t *anjay, anjay_iid_t iid); 30 | void lwm2m_gateway_release_button_end_device(anjay_t *anjay, anjay_iid_t iid); 31 | 32 | void lwm2m_gateway_binary_app_data_container_write(anjay_t *anjay, 33 | uint16_t dev_no, 34 | anjay_iid_t iid, 35 | anjay_riid_t riid, 36 | const char *value); 37 | 38 | #endif // ANJAY_WITH_LWM2M_GATEWAY 39 | 40 | #endif // LWM2M_GATEWAY_H 41 | -------------------------------------------------------------------------------- /demo/objects/gateway_end_devices/binary_app_data_container.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | #ifndef GW_BINARY_APP_DATA_CONTAINER_H 10 | #define GW_BINARY_APP_DATA_CONTAINER_H 11 | 12 | #include 13 | 14 | #include 15 | 16 | const anjay_dm_object_def_t ** 17 | gw_binary_app_data_container_object_create(anjay_iid_t id); 18 | void gw_binary_app_data_container_object_release( 19 | const anjay_dm_object_def_t **def); 20 | int gw_binary_app_data_container_write(anjay_t *anjay, 21 | const anjay_dm_object_def_t **def, 22 | anjay_iid_t iid, 23 | anjay_riid_t riid, 24 | const char *value); 25 | 26 | #endif // GW_BINARY_APP_DATA_CONTAINER_H 27 | -------------------------------------------------------------------------------- /demo/objects/gateway_end_devices/push_button_object.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | #ifndef PUSH_BUTTON_OBJECT_H 10 | #define PUSH_BUTTON_OBJECT_H 11 | 12 | #include 13 | 14 | const anjay_dm_object_def_t **push_button_object_create(anjay_iid_t id); 15 | void push_button_object_release(const anjay_dm_object_def_t **def); 16 | void push_button_press(anjay_t *anjay, const anjay_dm_object_def_t **def); 17 | void push_button_release(anjay_t *anjay, const anjay_dm_object_def_t **def); 18 | 19 | #endif // PUSH_BUTTON_OBJECT_H 20 | -------------------------------------------------------------------------------- /demo/objects/gateway_end_devices/temperature_object.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | #ifndef TEMPERATURE_OBJECT_H 10 | #define TEMPERATURE_OBJECT_H 11 | 12 | #include 13 | 14 | const anjay_dm_object_def_t **temperature_object_create(anjay_iid_t id); 15 | void temperature_object_release(const anjay_dm_object_def_t **def); 16 | void temperature_object_update_value(anjay_t *anjay, 17 | const anjay_dm_object_def_t **def); 18 | 19 | #endif // TEMPERATURE_OBJECT_H 20 | -------------------------------------------------------------------------------- /deps/avs_coap/.gitignore: -------------------------------------------------------------------------------- 1 | # binaries 2 | *.o 3 | *.a 4 | *.so 5 | *.so.* 6 | avs_*_test 7 | /tools/dtls_echo_server 8 | /certs 9 | /ensure-no-warnings-from-headers-if-cpp.cpp 10 | 11 | # NetBeans Project 12 | nbproject 13 | 14 | # VSCode 15 | .vscode/ 16 | 17 | # logs 18 | *.log 19 | 20 | # build configuration autogenerated files 21 | CMakeFiles/ 22 | CMakeTmp/ 23 | Makefile 24 | CMakeCache.txt 25 | CMakeDoxyfile.in 26 | CMakeDoxygenDefaults.cmake 27 | CPackConfig.cmake 28 | CPackSourceConfig.cmake 29 | CTestTestfile.cmake 30 | avs_coap-config.cmake 31 | avs_coap-version.cmake 32 | cmake_install.cmake 33 | compile_commands.json 34 | install_manifest.txt 35 | _CPack_Packages/ 36 | Testing/ 37 | /cmake/avs_coap-config.cmake 38 | /build* 39 | /coverage/ 40 | /examples/build 41 | /include_public/avsystem/coap/avs_coap_config.h 42 | /tools/__pycache__ 43 | 44 | # documentation 45 | /doc/doxygen 46 | /doc/sphinx/conf.py 47 | /doc/sphinx/html 48 | 49 | # dist package 50 | *.tar.gz 51 | *.tgz 52 | *.deb 53 | 54 | # gdb stuff 55 | .gdb_history 56 | -------------------------------------------------------------------------------- /deps/avs_coap/NOTICE: -------------------------------------------------------------------------------- 1 | AVSystem CoAP Library 2 | Copyright 2017-2025 AVSystem 3 | 4 | This product includes software developed at AVSystem (www.avsystem.com). 5 | 6 | This product bundles the AVSystem Commons Library 7 | (https://github.com/AVSystem/avs_commons), licensed under the terms of the 8 | Apache License, version 2.0. See deps/avs_commons/NOTICE file for details. 9 | -------------------------------------------------------------------------------- /deps/avs_coap/README.md: -------------------------------------------------------------------------------- 1 | # AVSystem CoAP Library 2 | -------------------------------------------------------------------------------- /deps/avs_coap/cmake/avs_coap-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem CoAP library 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | set(AVS_COAP_VERSION "@AVS_COAP_VERSION@") 9 | 10 | if(NOT DEFINED avs_commons_DIR) 11 | set(avs_commons_DIR "${CMAKE_CURRENT_LIST_DIR}/../avs_commons") 12 | endif() 13 | find_package(avs_commons REQUIRED COMPONENTS @AVS_COMMONS_REQUIRED_COMPONENTS@) 14 | 15 | @PACKAGE_INIT@ 16 | 17 | check_required_components(avs_coap) 18 | 19 | include(${CMAKE_CURRENT_LIST_DIR}/avs_coap-targets.cmake) 20 | -------------------------------------------------------------------------------- /deps/avs_coap/cmake/fill-placeholders.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem CoAP library 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | string(TIMESTAMP current_year "%Y") 9 | 10 | foreach(file IN LISTS CMAKE_INSTALL_MANIFEST_FILES) 11 | if(file MATCHES ".(h|hpp|c|cpp|cmake|py|sh)$") 12 | file(READ ${file} file_contents) 13 | string(REPLACE "2017-2025" "${current_year}" file_contents_replaced "${file_contents}") 14 | file(WRITE ${file} "${file_contents_replaced}") 15 | endif() 16 | endforeach() 17 | -------------------------------------------------------------------------------- /deps/avs_coap/devconfig: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem CoAP library 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | set -e 11 | 12 | if [[ -d '.git' ]]; then 13 | git submodule update --init --recursive 14 | fi 15 | 16 | EXTRA_FLAGS=() 17 | 18 | rm -f CMakeCache.txt 19 | rm -rf CMakeFiles 20 | cmake -D CMAKE_BUILD_TYPE=Debug \ 21 | -D CMAKE_C_FLAGS="-Wall -Wextra -Wshadow -Winit-self -Wmissing-declarations -Wc++-compat -Wsign-conversion -Wconversion -Wcast-qual -Wvla -Wno-variadic-macros -Wno-long-long -Wjump-misses-init -Werror -Wno-error=deprecated-declarations" \ 22 | -D CMAKE_EXPORT_COMPILE_COMMANDS=ON \ 23 | -D WITH_INTERNAL_LOGS=ON \ 24 | -D WITH_INTERNAL_TRACE=ON \ 25 | -D AVS_LOG_WITH_TRACE=ON \ 26 | -D WITH_VALGRIND=ON \ 27 | -D WITH_TEST=ON \ 28 | -D WITH_POISONING=ON \ 29 | -D WITH_MBEDTLS=ON \ 30 | "${EXTRA_FLAGS[@]}" \ 31 | "$@" "$(dirname "$0")" && 32 | make clean 33 | -------------------------------------------------------------------------------- /deps/avs_coap/doc/sphinx/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /deps/avs_coap/doc/sphinx/source/avsystem_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/deps/avs_coap/doc/sphinx/source/avsystem_header.png -------------------------------------------------------------------------------- /deps/avs_coap/doc/sphinx/source/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem CoAP library 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Welcome to AVSystem CoAP library documentation! 10 | =============================================== 11 | 12 | Contents 13 | -------- 14 | 15 | .. toctree:: 16 | :numbered: 17 | :titlesonly: 18 | 19 | Overview 20 | ErrorHandling 21 | Fuzzing 22 | 23 | Links 24 | ----- 25 | 26 | * `Source repository `_ 27 | * `Doxygen-generated API documentation `_ 28 | 29 | Indices and tables 30 | ================== 31 | 32 | * :ref:`search` 33 | -------------------------------------------------------------------------------- /deps/avs_coap/examples/async-client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem CoAP library 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | cmake_minimum_required(VERSION 3.16) 9 | project(async-client C) 10 | 11 | find_package(avs_coap REQUIRED) 12 | 13 | add_executable(async-client src/main.c) 14 | target_link_libraries(async-client PRIVATE avs_coap) 15 | -------------------------------------------------------------------------------- /deps/avs_coap/src/avs_coap_common_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_COAP_SRC_COMMON_UTILS_H 11 | #define AVS_COAP_SRC_COMMON_UTILS_H 12 | 13 | #include "avs_coap_ctx.h" 14 | 15 | VISIBILITY_PRIVATE_HEADER_BEGIN 16 | 17 | typedef struct { 18 | uint8_t *write_ptr; 19 | size_t bytes_left; 20 | } bytes_appender_t; 21 | 22 | typedef struct { 23 | const uint8_t *read_ptr; 24 | size_t bytes_left; 25 | } bytes_dispenser_t; 26 | 27 | int _avs_coap_bytes_append(bytes_appender_t *appender, 28 | const void *data, 29 | size_t size_bytes); 30 | 31 | int _avs_coap_bytes_extract(bytes_dispenser_t *dispenser, 32 | void *out, 33 | size_t size_bytes); 34 | 35 | avs_error_t _avs_coap_parse_token(avs_coap_token_t *out_token, 36 | uint8_t token_size, 37 | bytes_dispenser_t *dispenser); 38 | 39 | VISIBILITY_PRIVATE_HEADER_END 40 | 41 | #endif // AVS_COAP_SRC_COMMON_UTILS_H 42 | -------------------------------------------------------------------------------- /deps/avs_coap/src/avs_coap_parse_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_COAP_SRC_PARSE_UTILS_H 11 | #define AVS_COAP_SRC_PARSE_UTILS_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | VISIBILITY_PRIVATE_HEADER_BEGIN 20 | 21 | #define _AVS_FIELD_GET(field, mask, shift) (((field) & (mask)) >> (shift)) 22 | #define _AVS_FIELD_SET(field, mask, shift, value) \ 23 | ((field) = (uint8_t) (((field) & ~(mask)) \ 24 | | (uint8_t) (((value) << (shift)) & (mask)))) 25 | 26 | static inline uint16_t extract_u16(const uint8_t *data) { 27 | uint16_t result; 28 | memcpy(&result, data, sizeof(uint16_t)); 29 | return avs_convert_be16(result); 30 | } 31 | 32 | VISIBILITY_PRIVATE_HEADER_END 33 | 34 | #endif // AVS_COAP_SRC_PARSE_UTILS_H 35 | -------------------------------------------------------------------------------- /deps/avs_coap/src/avs_coap_x_log_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifdef LOG 11 | # undef LOG 12 | #endif 13 | 14 | #ifndef MODULE_NAME 15 | # error "You need to define MODULE_NAME before including this header" 16 | #endif 17 | 18 | #ifdef WITH_AVS_COAP_LOGS 19 | // these macros interfere with avs_log() macro implementation 20 | # ifdef TRACE 21 | # undef TRACE 22 | # endif 23 | # ifdef DEBUG 24 | # undef DEBUG 25 | # endif 26 | # ifdef INFO 27 | # undef INFO 28 | # endif 29 | # ifdef WARNING 30 | # undef WARNING 31 | # endif 32 | # ifdef ERROR 33 | # undef ERROR 34 | # endif 35 | 36 | # ifdef WITH_AVS_COAP_TRACE_LOGS 37 | # define AVS_LOG_WITH_TRACE 38 | # endif 39 | # include 40 | # define LOG(...) avs_log(MODULE_NAME, __VA_ARGS__) 41 | void _avs_coap_log_oom__(void); 42 | # define LOG_OOM() _avs_coap_log_oom__() 43 | #else // WITH_AVS_COAP_LOGS 44 | # define LOG(...) ((void) 0) 45 | # define LOG_OOM() ((void) 0) 46 | // used by tcp_ctx 47 | # define avs_log_internal_l__(...) ((void) 0) 48 | #endif // WITH_AVS_COAP_LOG 49 | -------------------------------------------------------------------------------- /deps/avs_coap/src/tcp/avs_coap_tcp_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_COAP_SRC_TCP_UTILS_H 11 | #define AVS_COAP_SRC_TCP_UTILS_H 12 | 13 | #include 14 | 15 | #include 16 | 17 | VISIBILITY_PRIVATE_HEADER_BEGIN 18 | 19 | /** 20 | * Converts @p payload, which may contain non-printable characters, to printable 21 | * string. 22 | * 23 | * @returns Number of bytes escaped. If it's not equal to @p payload_size, this 24 | * function may be called again with @p payload pointer incremented by 25 | * number of bytes escaped to convert further chunks of data. 26 | * 27 | * Note: @p converted message is always ended with NULL character. 28 | */ 29 | size_t _avs_coap_tcp_escape_payload(const char *payload, 30 | size_t payload_size, 31 | char *escaped_buf, 32 | size_t escaped_buf_size); 33 | 34 | VISIBILITY_PRIVATE_HEADER_END 35 | 36 | #endif // AVS_COAP_SRC_TCP_UTILS_H 37 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem CoAP library 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | if(NOT CMAKE_C_COMPILER MATCHES "/afl-.*$") 9 | set(FUZZ_TEST_EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) 10 | endif() 11 | 12 | add_executable(avs_coap_parse_stdin ${FUZZ_TEST_EXCLUDE_FROM_ALL} 13 | coap_parse.c) 14 | target_include_directories(avs_coap_parse_stdin PRIVATE 15 | $) 16 | target_link_libraries(avs_coap_parse_stdin PRIVATE avs_coap) 17 | 18 | add_executable(avs_coap_async_api_udp ${FUZZ_TEST_EXCLUDE_FROM_ALL} 19 | coap_async_api_udp.c) 20 | target_include_directories(avs_coap_async_api_udp PRIVATE 21 | $) 22 | target_link_libraries(avs_coap_async_api_udp PRIVATE avs_coap) 23 | add_executable(avs_coap_async_api_tcp ${FUZZ_TEST_EXCLUDE_FROM_ALL} 24 | coap_async_api_tcp.c) 25 | target_include_directories(avs_coap_async_api_tcp PRIVATE 26 | $) 27 | target_link_libraries(avs_coap_async_api_tcp PRIVATE avs_coap) 28 | 29 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/coap_parse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #define AVS_COAP_POISON_H // disable libc poisoning 11 | #include 12 | 13 | #include 14 | 15 | #include "udp/avs_coap_udp_msg.h" 16 | 17 | int main() { 18 | uint8_t buf[65536]; 19 | size_t read = fread(buf, 1, sizeof(buf), stdin); 20 | 21 | avs_coap_udp_msg_t msg; 22 | return avs_is_err(_avs_coap_udp_msg_parse(&msg, buf, read)); 23 | } 24 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_tcp.hex/recv_get_send_content: -------------------------------------------------------------------------------- 1 | 0008 # in buf size 2 | 0008 # out buf size 3 | 0008 # opts buf size 4 | 05 # request timeout in seconds 5 | 00 # default mtu 6 | 7 | 00 # mock_send: don't fail during sending CSM 8 | 9 | # CSM 10 | 0200 # mock_recv: msg size 11 | 00 # mock_recv: msg length 0, token length 0 12 | E1 # mock_recv: code = CSM 13 | 00 # mock_recv: do not override msg token with last sent 14 | 15 | 03 # handle incoming packet 16 | 0200 # mock_recv: msg size 17 | 00 # mock_recv: msg length 0, token length 0 18 | 01 # mock_recv: code = Get 19 | 00 # mock_recv: do not override msg token with last sent 20 | 21 | 00 # handle_new_request: do nothing in do_stuff 22 | 00 # handle_new_request: don't return early 23 | 00 # handle_new_request: do nothing in do_stuff 24 | 00000000 # handle_new_request: succeed 25 | 26 | 00 # handle_request: do nothing in do_stuff 27 | 00 # handle_request: don't return early 28 | 45 # handle_request: 2.05 Content 29 | 0000 # handle_request: empty options 30 | 0000 # handle_request: zero capacity 31 | 00 # handle_request: don't pass payload_writer 32 | 00 # handle_request: do nothing in do_stuff 33 | 00000000 # handle_request: succeed 34 | 00 # mock_send: don't fail 35 | 36 | 00 # handle_request (cleanup): do nothing in do_stuff 37 | 01 # handle_request (cleanup): return early 38 | 00000000 # handle_request (cleanup): succeed 39 | 40 | 0000 # mock_recv: msg size 41 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_tcp/recv_get_send_content: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/deps/avs_coap/tests/fuzz/input/coap_async_api_tcp/recv_get_send_content -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp.hex/recv_get_send_content: -------------------------------------------------------------------------------- 1 | 0008 # in buf size 2 | 0008 # out buf size 3 | 00 # default tx params 4 | 00 # no response cache 5 | 00 # default mtu 6 | 7 | 03 # handle incoming packet 8 | 0400 # mock_recv: msg size 9 | 40 # mock_recv: CON, empty token 10 | 01 # mock_recv: code = Get 11 | 0000 # mock_recv: msg id 12 | 00 # mock_recv: do not override msd id/token with last sent 13 | 14 | 00 # handle_new_request: do nothing in do_stuff 15 | 00 # handle_new_request: don't return early 16 | 00 # handle_new_request: do nothing in do_stuff 17 | 00000000 # handle_new_request: succeed 18 | 19 | 00 # handle_request: do nothing in do_stuff 20 | 00 # handle_request: don't return early 21 | 45 # handle_request: 2.05 Content 22 | 0000 # handle_request: empty options 23 | 0000 # handle_request: zero capacity 24 | 00 # handle_request: don't pass payload_writer 25 | 00 # handle_request: do nothing in do_stuff 26 | 00000000 # handle_request: suceed 27 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp.hex/send_block_put_recv_changed: -------------------------------------------------------------------------------- 1 | 0008 # in buf size = 2 KB 2 | 2200 # out buf size = 34 B 3 | 00 # default tx params 4 | 00 # no response cache 5 | 00 # default mtu 6 | 7 | 01 # send request 8 | 07 # pass ID, writer, handler 9 | 03 # code: POST 10 | 0000 # options size 11 | 0000 # options capacity 12 | 00 # payload_writer: do nothing in do_stuff 13 | 00 # payload_writer: do not fail 14 | 1100 # payload_writer: payload size = 17 15 | 00 # mock_send: do not fail 16 | 17 | 03 # handle incoming packet 18 | 0700 # mock_recv: msg size = 7 19 | 60 # mock_recv: ACK, empty token 20 | 5f # mock_recv: code = Continue 21 | 0000 # mock_recv: msg id 22 | d10e00 # mock_recv: BLOCK1, seq_num 0, size 16, more 1 23 | 01 # mock_recv: override msd id/token with last sent 24 | 25 | # request for the next block 26 | 00 # payload_writer: do nothing in do_stuff 27 | 00 # payload_writer: do not fail 28 | 0f00 # payload_writer: payload size = 15 29 | 00 # mock_send: do not fail 30 | 31 | 03 # handle incoming packet 32 | 0f00 # mock_recv: msg size = 15 33 | 68 # mock_recv: ACK, 8B token 34 | 44 # mock_recv: code = Changed 35 | 0000 # mock_recv: msg id 36 | 0000000000000000 # mock_recv: token 37 | d10e10 # mock_recv: BLOCK1, seq_num 1, size 16, more 0 38 | 01 # mock_recv: override msd id/token with last sent 39 | 00 # response_handler: do nothing in do_stuff 40 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp.hex/send_get_recv_block_content: -------------------------------------------------------------------------------- 1 | 0008 # in buf size 2 | 0008 # out buf size 3 | 00 # default tx params 4 | 00 # no response cache 5 | 00 # default mtu 6 | 7 | 01 # send request 8 | 07 # pass ID, writer, handler 9 | 01 # code: GET 10 | 0000 # options size 11 | 0000 # options capacity 12 | 00 # payload_writer: do nothing in do_stuff 13 | 00 # payload_writer: do not fail 14 | 0000 # payload_writer: payload size 15 | 00 # mock_send: do not fail 16 | 17 | 03 # handle incoming packet 18 | 1800 # mock_recv: msg size = 24 19 | 60 # mock_recv: ACK, empty token 20 | 45 # mock_recv: code = Content 21 | 0000 # mock_recv: msg id 22 | d10a08 # mock_recv: BLOCK2, seq_num 0, size 16, more 1 23 | ff # payload marker 24 | 31323334353637383960616263646520 # "123456789abcdef " 25 | 01 # mock_recv: override msd id/token with last sent 26 | 00 # response_handler: do nothing in do_stuff 27 | 28 | # request for the next block 29 | 00 # mock_send: do not fail 30 | 31 | 03 # handle incoming packet 32 | 2000 # mock_recv: msg size = 32 33 | 68 # mock_recv: ACK, 8B token 34 | 45 # mock_recv: code = Content 35 | 0000 # mock_recv: msg id 36 | 0000000000000000 # mock_recv: token 37 | d10a10 # mock_recv: BLOCK2, seq_num 1, size 16, more 0 38 | ff # payload marker 39 | 31323334353637383960616263646520 # "123456789abcdef " 40 | 01 # mock_recv: override msd id/token with last sent 41 | 00 # response_handler: do nothing in do_stuff 42 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp.hex/send_get_recv_content: -------------------------------------------------------------------------------- 1 | 0008 # in buf size 2 | 0008 # out buf size 3 | 00 # default tx params 4 | 00 # no response cache 5 | 00 # default mtu 6 | 7 | 01 # send request 8 | 07 # pass ID, writer, handler 9 | 01 # code: GET 10 | 0000 # options size 11 | 0000 # options capacity 12 | 00 # payload_writer: do nothing in do_stuff 13 | 00 # payload_writer: do not fail 14 | 0000 # payload_writer: payload size 15 | 00 # mock_send: do not fail 16 | 17 | 03 # handle incoming packet 18 | 0400 # mock_recv: msg size 19 | 60 # mock_recv: ACK, empty token 20 | 45 # mock_recv: code = Content 21 | 0000 # mock_recv: msg id 22 | 01 # mock_recv: override msd id/token with last sent 23 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp/recv_get_send_content: -------------------------------------------------------------------------------- 1 | @E -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp/send_block_put_recv_changed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/deps/avs_coap/tests/fuzz/input/coap_async_api_udp/send_block_put_recv_changed -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp/send_get_recv_block_content: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/deps/avs_coap/tests/fuzz/input/coap_async_api_udp/send_get_recv_block_content -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_async_api_udp/send_get_recv_content: -------------------------------------------------------------------------------- 1 | `E -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/coap_parse/empty: -------------------------------------------------------------------------------- 1 | @ -------------------------------------------------------------------------------- /deps/avs_coap/tests/fuzz/input/hex-to-fuzz-input.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sed -e 's/#.*$//g' | paste -sd\ | sed -e 's/[^0-9a-fA-F]//g' | xxd -r -p 4 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/mock_clock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_TEST_MOCK_CLOCK_H 11 | #define AVS_TEST_MOCK_CLOCK_H 12 | 13 | #include 14 | 15 | void _avs_mock_clock_start(const avs_time_monotonic_t t); 16 | void _avs_mock_clock_advance(const avs_time_duration_t t); 17 | void _avs_mock_clock_finish(void); 18 | 19 | #endif /* AVS_TEST_MOCK_CLOCK_H */ 20 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/socket.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #ifdef AVS_UNIT_TESTING 13 | 14 | # include "./socket.h" 15 | 16 | # define MODULE_NAME test 17 | # include 18 | 19 | void _avs_mocksock_create(avs_net_socket_t **mocksock, int inner_mtu, int mtu) { 20 | avs_unit_mocksock_create(mocksock); 21 | if (inner_mtu >= 0) { 22 | avs_unit_mocksock_enable_inner_mtu_getopt(*mocksock, inner_mtu); 23 | } 24 | if (mtu >= 0) { 25 | avs_unit_mocksock_enable_mtu_getopt(*mocksock, mtu); 26 | } 27 | } 28 | 29 | #endif // AVS_UNIT_TESTING 30 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/socket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_TEST_COAP_SOCKET_H 11 | #define AVS_TEST_COAP_SOCKET_H 12 | 13 | #include 14 | 15 | /** 16 | * NOTE: inner_mtu / mtu may be set to a negative value, in which case 17 | * they are not automatically handled by mocksock_get_opt() 18 | */ 19 | void _avs_mocksock_create(avs_net_socket_t **mocksock, int inner_mtu, int mtu); 20 | 21 | #endif /* AVS_TEST_COAP_SOCKET_H */ 22 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/tcp/ctx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #if defined(AVS_UNIT_TESTING) && defined(WITH_AVS_COAP_TCP) 13 | 14 | # include "tests/utils.h" 15 | 16 | # define MODULE_NAME test 17 | # include 18 | 19 | # include "./helper_functions.h" 20 | 21 | AVS_UNIT_TEST(coap_tcp_ctx, create_ctx_and_delete) { 22 | test_env_t env __attribute__((cleanup(test_teardown))) = test_setup(); 23 | } 24 | 25 | AVS_UNIT_TEST(coap_tcp_ctx, unexpected_response) { 26 | test_env_t env __attribute__((cleanup(test_teardown))) = test_setup(); 27 | 28 | const test_msg_t *response = COAP_MSG(CONTENT, MAKE_TOKEN("123")); 29 | 30 | expect_recv(&env, response); 31 | avs_coap_borrowed_msg_t request; 32 | ASSERT_OK(receive_nonrequest_message(env.coap_ctx, &request)); 33 | } 34 | 35 | AVS_UNIT_TEST(coap_tcp_ctx, unexpected_response_with_too_big_options) { 36 | test_env_t env __attribute__((cleanup(test_teardown))) = test_setup(); 37 | 38 | // PATH option in response is used only for test purposes. 39 | const test_msg_t *response = 40 | COAP_MSG(CONTENT, MAKE_TOKEN("123"), 41 | PATH("deszcz na jeziorach deszcz na jeziorach")); 42 | 43 | expect_recv(&env, response); 44 | 45 | avs_coap_borrowed_msg_t request; 46 | ASSERT_OK(receive_nonrequest_message(env.coap_ctx, &request)); 47 | ASSERT_OK(receive_nonrequest_message(env.coap_ctx, &request)); 48 | } 49 | 50 | #endif // defined(AVS_UNIT_TESTING) && defined(WITH_AVS_COAP_TCP) 51 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/tcp/setsock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #if defined(AVS_UNIT_TESTING) && defined(WITH_AVS_COAP_TCP) 13 | 14 | # include "tests/utils.h" 15 | 16 | # define MODULE_NAME test 17 | # include 18 | 19 | # include "./helper_functions.h" 20 | 21 | AVS_UNIT_TEST(tcp_setsock, callable_only_once) { 22 | test_env_t env __attribute__((cleanup(test_teardown))) = test_setup(); 23 | // socket already set by test_setup() 24 | ASSERT_FAIL(avs_coap_ctx_set_socket(env.coap_ctx, env.mocksock)); 25 | } 26 | 27 | AVS_UNIT_TEST(tcp_setsock, cleanup_possible_without_socket) { 28 | test_env_t env __attribute__((cleanup(test_teardown))) = 29 | test_setup_without_socket(); 30 | avs_coap_ctx_cleanup(&env.coap_ctx); 31 | } 32 | 33 | #endif // defined(AVS_UNIT_TESTING) && defined(WITH_AVS_COAP_TCP) 34 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/udp/big_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_COAP_SRC_UDP_TEST_BIG_DATA_H 11 | #define AVS_COAP_SRC_UDP_TEST_BIG_DATA_H 12 | 13 | #include "./utils.h" 14 | 15 | #define DATA_4KB DATA_1KB DATA_1KB DATA_1KB DATA_1KB 16 | #define DATA_16KB DATA_4KB DATA_4KB DATA_4KB DATA_4KB 17 | #define DATA_64KB DATA_16KB DATA_16KB DATA_16KB DATA_16KB 18 | #define DATA_256KB DATA_64KB DATA_64KB DATA_64KB DATA_64KB 19 | #define DATA_1MB DATA_256KB DATA_256KB DATA_256KB DATA_256KB 20 | #define DATA_4MB DATA_1MB DATA_1MB DATA_1MB DATA_1MB 21 | #define DATA_16MB DATA_4MB DATA_4MB DATA_4MB DATA_4MB 22 | 23 | #endif // AVS_COAP_SRC_UDP_TEST_BIG_DATA_H 24 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/udp/setsock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #if defined(AVS_UNIT_TESTING) && defined(WITH_AVS_COAP_UDP) 13 | 14 | # include 15 | # include 16 | 17 | # define MODULE_NAME test 18 | # include 19 | 20 | # include "./utils.h" 21 | 22 | AVS_UNIT_TEST(udp_setsock, callable_only_once) { 23 | test_env_t env __attribute__((cleanup(test_teardown))) = 24 | test_setup(&AVS_COAP_DEFAULT_UDP_TX_PARAMS, 1024, 1024, NULL); 25 | // socket already set by test_setup() 26 | ASSERT_FAIL(avs_coap_ctx_set_socket(env.coap_ctx, env.mocksock)); 27 | } 28 | 29 | AVS_UNIT_TEST(udp_setsock, cleanup_possible_without_socket) { 30 | test_env_t env __attribute__((cleanup(test_teardown))) = 31 | test_setup_without_socket(NULL, 1024, 1024, NULL); 32 | avs_coap_ctx_cleanup(&env.coap_ctx); 33 | } 34 | 35 | #endif // defined(AVS_UNIT_TESTING) && defined(WITH_AVS_COAP_UDP) 36 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/udp/tx_params_mock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef AVS_COAP_TEST_TX_PARAMS_MOCK_H 11 | #define AVS_COAP_TEST_TX_PARAMS_MOCK_H 12 | 13 | #include 14 | 15 | extern __typeof__(_avs_coap_udp_initial_retry_state) *AVS_UNIT_MOCK( 16 | _avs_coap_udp_initial_retry_state); 17 | void _avs_unit_mock_constructor_avs_coap_udp_initial_retry_state(void) 18 | __attribute__((constructor)); 19 | #define _avs_coap_udp_initial_retry_state(...) \ 20 | AVS_UNIT_MOCK_WRAPPER(_avs_coap_udp_initial_retry_state)(__VA_ARGS__) 21 | 22 | #endif /* AVS_COAP_TEST_TX_PARAMS_MOCK_H */ 23 | -------------------------------------------------------------------------------- /deps/avs_coap/tests/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem CoAP library 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #ifdef AVS_UNIT_TESTING 13 | 14 | # include 15 | # include 16 | 17 | # include "utils.h" 18 | 19 | # define MODULE_NAME test 20 | # include 21 | 22 | static uint64_t GLOBAL_TOKEN_VALUE; 23 | 24 | void reset_token_generator(void) { 25 | GLOBAL_TOKEN_VALUE = 0; 26 | } 27 | 28 | avs_error_t _avs_coap_ctx_generate_token(avs_coap_ctx_t *ctx, 29 | avs_coap_token_t *out_token); 30 | 31 | avs_error_t _avs_coap_ctx_generate_token(avs_coap_ctx_t *ctx, 32 | avs_coap_token_t *out_token) { 33 | (void) ctx; 34 | *out_token = nth_token(GLOBAL_TOKEN_VALUE++); 35 | return AVS_OK; 36 | } 37 | 38 | avs_coap_token_t nth_token(uint64_t k) { 39 | union { 40 | uint8_t bytes[sizeof(uint64_t)]; 41 | uint64_t value; 42 | } v; 43 | v.value = avs_convert_be64(k); 44 | 45 | avs_coap_token_t token; 46 | token.size = sizeof(v.bytes); 47 | memcpy(token.bytes, v.bytes, sizeof(v.bytes)); 48 | return token; 49 | } 50 | 51 | avs_coap_token_t current_token(void) { 52 | return nth_token(GLOBAL_TOKEN_VALUE); 53 | } 54 | 55 | #endif // AVS_UNIT_TESTING 56 | -------------------------------------------------------------------------------- /deps/avs_coap/tools/conditional_headers_whitelist.json: -------------------------------------------------------------------------------- 1 | { 2 | "": [ 3 | "avs_coap_init\\.h", 4 | "avs_coap_x_log_config\\.h", 5 | "avsystem/coap/[^.]*\\.h", 6 | "avsystem/commons/[^.]*\\.h" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /doc/sphinx/extensions/builders/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /doc/sphinx/extensions/builders/dummy.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | try: 11 | from sphinx.builders.dummy import DummyBuilder 12 | except ImportError: 13 | # dummy builder available in sphinx 1.4+ 14 | from sphinx.builders import Builder 15 | 16 | 17 | class DummyBuilder(Builder): 18 | name = 'dummy' 19 | allow_parallel = True 20 | 21 | def init(self): pass 22 | 23 | def get_outdated_docs(self): return self.env.found_docs 24 | 25 | def get_target_uri(self, docname, typ=None): return '' 26 | 27 | def prepare_writing(self, docnames): pass 28 | 29 | def write_doc(self, docname, doctree): pass 30 | 31 | def finish(self): pass 32 | -------------------------------------------------------------------------------- /doc/sphinx/extensions/builders/snippet_source_list_references.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from builders.dummy import DummyBuilder 11 | from snippet_source import SnippetSourceNode 12 | 13 | 14 | class SnippetSourceListReferencesBuilder(DummyBuilder): 15 | name = 'snippet_source_list_references' 16 | 17 | def __init__(self, *args, **kwargs): 18 | super(SnippetSourceListReferencesBuilder, self).__init__(*args, **kwargs) 19 | 20 | self.referenced_docs = set() 21 | 22 | def write_doc(self, docname, doctree): 23 | list_commercial = False 24 | 25 | for node in doctree.traverse(SnippetSourceNode): 26 | if list_commercial or not node['commercial']: 27 | self.referenced_docs.add(node.source_filepath) 28 | 29 | def finish(self): 30 | print('\n'.join(self.referenced_docs)) 31 | 32 | 33 | def setup(app): 34 | app.add_builder(SnippetSourceListReferencesBuilder) 35 | -------------------------------------------------------------------------------- /doc/sphinx/extensions/small_literal.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from docutils import nodes 11 | from sphinx.application import Sphinx 12 | 13 | def small_literal_role(name, rawtext, text, lineno, inliner, options={}, content=[]): 14 | return [nodes.literal(rawtext, text, classes=['small-literal'])], [] 15 | 16 | def setup(app: Sphinx): 17 | app.add_role('small-literal', small_literal_role) 18 | -------------------------------------------------------------------------------- /doc/sphinx/source/API_description.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | API description 10 | =============== 11 | 12 | Redirecting to Doxygen API docs... 13 | 14 | .. raw:: html 15 | 16 | 19 | 20 | If you are not redirected automatically, click 21 | `here <../../doxygen/html/index.html>`_. 22 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Advanced topics 10 | =============== 11 | 12 | .. toctree:: 13 | :glob: 14 | :titlesonly: 15 | 16 | AdvancedTopics/AT-AccessControl 17 | AdvancedTopics/AT-AttributeStorage 18 | AdvancedTopics/AT-Certificates 19 | AdvancedTopics/AT-CustomObjects 20 | AdvancedTopics/AT-NetworkErrorHandling 21 | AdvancedTopics/AT-OtherFeatures 22 | AdvancedTopics/AT-Persistence 23 | AdvancedTopics/AT-RetransmissionsTimeoutsCaching 24 | AdvancedTopics/AT-CustomEventLoop 25 | AdvancedTopics/AT-EventLoopNotes 26 | AdvancedTopics/AT-IpsoObjects 27 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_SingleInstanceReadOnly.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_SingleInstanceReadOnly` 18 | ===================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO2_SingleInstanceExecutableAndReadOnly.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_SingleInstanceExecutableAndReadOnly.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_SingleInstanceExecutableAndReadOnly` 18 | ================================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO3_MultiInstanceReadOnlyFixed.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_MultiInstanceReadOnlyFixed.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_MultiInstanceReadOnlyFixed` 18 | ========================================= 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO4_FixedInstanceWritable.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_FixedInstanceWritable.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_FixedInstanceWritable` 18 | ==================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO5_MultiInstanceDynamic.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_MultiInstanceDynamic.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_MultiInstanceDynamic` 18 | =================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO6_MultipleResourceInstances.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_MultipleResourceInstances.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_MultipleResourceInstances` 18 | ======================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/AT_CO7_BootstrapAwareness.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=AT_CO_BootstrapAwareness.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`AT_CO_BootstrapAwareness` 18 | ================================= 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | 10 | .. note:: 11 | 12 | This section describes in details the implementation of custom Objects in 13 | Anjay, either defined in `OMA LwM2M Object and Resource Registry 14 | `_ 15 | or designed by user. 16 | 17 | Although most of the Object's code can be generated using 18 | :ref:`anjay-object-stub-generator` if you have Object's definition in XML, 19 | it is recommended to read this section to have a clear understanding on what 20 | various parts of the LwM2M Object code are for. 21 | -------------------------------------------------------------------------------- /doc/sphinx/source/AdvancedTopics/AT-OtherFeatures.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Other library features 10 | ====================== 11 | 12 | .. _coap-pull-download: 13 | 14 | CoAP PULL download 15 | ------------------ 16 | 17 | If the LwM2M Client needs to download a large file from an external CoAP server, 18 | it may use the `anjay_download API <../api/download_8h.html>`_. The built-in 19 | downloader supports CoAP, CoAP/DTLS and HTTP(S) connections and is able to 20 | perform transfers without interrupting regular LwM2M operations. 21 | 22 | For a simple example, see `examples/tutorial/AT-Downloader` subdirectory of main 23 | Anjay project repository. 24 | -------------------------------------------------------------------------------- /doc/sphinx/source/BasicClient.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Basic client 10 | ============ 11 | 12 | In this tutorial we will focus on creating simple LwM2M Client based on Anjay 13 | library, featuring: 14 | 15 | - secure connection to a LwM2M Server, 16 | - Object with writable and readable resources. 17 | 18 | This client can be a good starting point for creating more complex applications. 19 | 20 | .. toctree:: 21 | :glob: 22 | :titlesonly: 23 | 24 | BasicClient/BC-Initialization 25 | BasicClient/BC-MandatoryObjects 26 | BasicClient/BC-Security 27 | BasicClient/BC-ObjectImplementation 28 | BasicClient/BC-Notifications 29 | BasicClient/BC-Send 30 | BasicClient/BC-ThreadSafety 31 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Firmware Update Tutorial 10 | ======================== 11 | 12 | .. toctree:: 13 | :glob: 14 | :titlesonly: 15 | 16 | FirmwareUpdateTutorial/FU-Introduction 17 | FirmwareUpdateTutorial/FU-BasicImplementation 18 | FirmwareUpdateTutorial/FU-ModesAndProtocols 19 | FirmwareUpdateTutorial/FU-SecureDownloads 20 | FirmwareUpdateTutorial/FU-PoorConnectivity 21 | FirmwareUpdateTutorial/FU-DownloadResumption 22 | FirmwareUpdateTutorial/FU-AdvancedFirmwareUpdate 23 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU-AdvancedFirmwareUpdate.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Advanced Firmware Update 10 | ======================== 11 | 12 | **Advanced Firmware Update** object (``/33629``) is an optional object which 13 | extends the definition of **Firmware Update** object (``/5``) and allows for 14 | multiple instances, with each instance representing a separate “component” of 15 | the device's firmware that can be upgraded independently. The significance of 16 | such components is implementation-defined, however, the intention is that they 17 | might refer to components such as: bootloaders, application code, cellular 18 | modem firmwares, security processor firmwares, etc. 19 | 20 | It is expected that firmware components can be upgraded independently in most 21 | cases, however, the object provides a mechanism for checking version 22 | dependencies when a certain order of updates is required, or when multiple 23 | components need to be upgraded in tandem. 24 | 25 | 26 | :download:`Download: Advanced Firmware Update Object Definition XML ` 27 | 28 | .. toctree:: 29 | :glob: 30 | :titlesonly: 31 | 32 | FU-AdvancedFirmwareUpdate/FU-AFU-ResourceDefinitions.rst 33 | FU-AdvancedFirmwareUpdate/FU-AFU-StateDiagram.rst 34 | FU-AdvancedFirmwareUpdate/FU-AFU-Examples.rst 35 | FU-AdvancedFirmwareUpdate/FU-AFU-BasicImplementation.rst 36 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU1.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=FU-Introduction.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`FU-Introduction` 18 | ======================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU2.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=FU-BasicImplementation.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`FU-BasicImplementation` 18 | =============================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU3.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=FU-ModesAndProtocols.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`FU-ModesAndProtocols` 18 | ============================= 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU4.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=FU-SecureDownloads.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`FU-SecureDownloads` 18 | =========================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU5.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=FU-PoorConnectivity.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`FU-PoorConnectivity` 18 | ============================ 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/FirmwareUpdateTutorial/FU6.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=FU-DownloadResumption.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`FU-DownloadResumption` 18 | ============================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/LwM2MGateway.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | LwM2M Gateway 10 | ============= 11 | 12 | .. toctree:: 13 | :glob: 14 | :titlesonly: 15 | 16 | LwM2MGateway/LwM2MGatewayIntro 17 | LwM2MGateway/LwM2MGatewayAPI 18 | LwM2MGateway/LwM2MGatewayNotifications 19 | LwM2MGateway/LwM2MGatewaySend 20 | -------------------------------------------------------------------------------- /doc/sphinx/source/Migrating.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Migrating from older versions 10 | ============================= 11 | 12 | .. note:: 13 | 14 | Each of these documents is intended to be stand-alone and complete guide for 15 | migrating from the specified version to the newest one. 16 | 17 | In other words, if you are migrating from e.g. Anjay 2.4, you **only** need 18 | to follow :doc:`Migrating/MigratingFromAnjay24`. All the relevant 19 | information from :doc:`Migrating/MigratingFromAnjay26` etc. is included 20 | there as well. 21 | 22 | .. toctree:: 23 | :glob: 24 | :titlesonly: 25 | 26 | Migrating/MigratingFromAnjay225 27 | Migrating/MigratingCustomEntropy 28 | Migrating/MigratingFromAnjay24 29 | Migrating/MigratingFromAnjay26 30 | Migrating/MigratingFromAnjay27 31 | Migrating/MigratingFromAnjay28 32 | Migrating/MigratingFromAnjay214 33 | Migrating/MigratingFromAnjay215 34 | Migrating/MigratingFromAnjay30 35 | Migrating/MigratingFromAnjay32 36 | Migrating/MigratingFromAnjay33 37 | Migrating/MigratingFromAnjay34 38 | Migrating/MigratingFromAnjay37 39 | -------------------------------------------------------------------------------- /doc/sphinx/source/Migrating/MigratingFromAnjay34.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Migrating from Anjay 3.4 10 | ======================== 11 | 12 | .. contents:: :local: 13 | 14 | .. highlight:: c 15 | 16 | Introduction 17 | ------------ 18 | 19 | Since Anjay 3.5.0, the code flow of delivering notifications has been 20 | refactored so that user handler callbacks may be called in a different order. 21 | This only affects direct users of ``avs_coap`` APIs (e.g. when communicating 22 | over raw CoAP protocol). 23 | 24 | Changed flow of cancelling observations in case of errors 25 | --------------------------------------------------------- 26 | 27 | CoAP observations are implicitly cancelled if a notification bearing a 4.xx or 28 | 5.xx error code is delivered. If an attempt to deliver a confirmable 29 | notification times out, CoAP observation is not cancelled by default anymore. 30 | It can be adjusted by ``WITH_AVS_COAP_OBSERVE_CANCEL_ON_TIMEOUT``. 31 | 32 | In Anjay 3.4.x and earlier, this cancellation (which involves calling the 33 | ``avs_coap_observe_cancel_handler_t`` callback) was performed *before* calling 34 | the ``avs_coap_delivery_status_handler_t`` callback for the specific 35 | notification. Since Anjay 3.5.0, this order is reversed, so any code that relies 36 | on this logic may break. 37 | 38 | This change is only relevant if you are using ``avs_coap`` APIs directly (e.g. 39 | when communicating over raw CoAP protocol) and in case of notifications intended 40 | to be delivered as confirmable. The LwM2M Observe/Notify implementation in Anjay 41 | has been updated accordingly. 42 | -------------------------------------------------------------------------------- /doc/sphinx/source/Migrating/MigratingFromAnjay37.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Migrating from Anjay 3.7 10 | ======================== 11 | 12 | .. contents:: :local: 13 | 14 | .. highlight:: c 15 | 16 | Introduction 17 | ------------ 18 | 19 | Since Anjay 3.8.0, confirmable notifications are not cancelled anymore in case 20 | of a timeout. 21 | 22 | Changed flow of cancelling observations in case of timeout 23 | ---------------------------------------------------------- 24 | 25 | If an attempt to deliver a confirmable notification times out, CoAP observation 26 | is not cancelled by default anymore. It can be adjusted by 27 | ``WITH_AVS_COAP_OBSERVE_CANCEL_ON_TIMEOUT``. 28 | The LwM2M Observe/Notify implementation in Anjay has been updated accordingly. 29 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Porting guide for non-POSIX platforms 10 | ===================================== 11 | 12 | By default, Anjay makes use of POSIX-specific interfaces for retrieving time 13 | and handling network traffic. If no such interfaces are provided by the 14 | toolchain, the user needs to provide custom implementations. 15 | 16 | The articles below show additional information about the specific functions that 17 | need to be implemented. 18 | 19 | .. toctree:: 20 | :titlesonly: 21 | 22 | PortingGuideForNonPOSIXPlatforms/TimeAPI 23 | PortingGuideForNonPOSIXPlatforms/ThreadingAPI 24 | PortingGuideForNonPOSIXPlatforms/NetworkingAPI 25 | PortingGuideForNonPOSIXPlatforms/CustomTLS 26 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI1.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-Minimal.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-Minimal` 18 | ============================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI2.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-RemoteHostPort.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-RemoteHostPort` 18 | ===================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI3.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-Bind.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-Bind` 18 | =========================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI4.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-ShutdownRemoteHostname.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-ShutdownRemoteHostname` 18 | ============================================= 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI5.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-Stats.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-Stats` 18 | ============================ 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI6.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-IpStickiness.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-IpStickiness` 18 | =================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/PortingGuideForNonPOSIXPlatforms/NetworkingAPI/NetworkingAPI7.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | :orphan: 10 | 11 | .. meta:: 12 | 13 | :http-equiv=Refresh: 1; url=NetworkingAPI-OtherFeatures.html 14 | 15 | .. title:: Redirection 16 | 17 | ↳ :doc:`NetworkingAPI-OtherFeatures` 18 | ==================================== 19 | -------------------------------------------------------------------------------- /doc/sphinx/source/Tools.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Tools 10 | ===== 11 | 12 | .. toctree:: 13 | :glob: 14 | :titlesonly: 15 | 16 | Tools/* 17 | 18 | -------------------------------------------------------------------------------- /doc/sphinx/source/avsystem_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/doc/sphinx/source/avsystem_header.png -------------------------------------------------------------------------------- /doc/sphinx/source/avsystem_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/doc/sphinx/source/avsystem_logo.png -------------------------------------------------------------------------------- /doc/sphinx/source/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017-2025 AVSystem 3 | AVSystem Anjay LwM2M SDK 4 | All rights reserved. 5 | 6 | Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | See the attached LICENSE file for details. 8 | 9 | Welcome to Anjay LwM2M library documentation! 10 | ============================================= 11 | 12 | .. attention:: 13 | 14 | With release of Anjay 3.0, the `library's license terms have changed 15 | `_. Please make sure 16 | that you have reviewed it before updating to the new major release. Previous 17 | versions of Anjay remain with the old, Apache 2.0 license. 18 | 19 | Contents: 20 | 21 | .. toctree:: 22 | :numbered: 23 | :titlesonly: 24 | 25 | Introduction 26 | LwM2M 27 | Compiling_client_applications 28 | BasicClient 29 | AdvancedTopics 30 | FirmwareUpdateTutorial 31 | LwM2MGateway 32 | Tools 33 | API_description 34 | PortingGuideForNonPOSIXPlatforms 35 | Migrating 36 | CommercialFeatures 37 | 38 | Links 39 | ----- 40 | 41 | * `Source repository `_ 42 | 43 | Indices and tables 44 | ================== 45 | 46 | * :ref:`search` 47 | 48 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-CorePersistence/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-core-persistence C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-EST-PKCS11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-est-pkcs11 C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | # check if AVS_COMMONS_WITH_AVS_CRYPTO_PKI_ENGINE is enabled 10 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/avs_commons_check.c 11 | "#include \nint main() {\n#ifndef AVS_COMMONS_WITH_AVS_CRYPTO_PKI_ENGINE\nint error[-1];\n#endif\nreturn 0; }\n") 12 | get_target_property(INCLUDE_DIRS anjay INTERFACE_INCLUDE_DIRECTORIES) 13 | try_compile(WITH_AVS_CRYPTO_PKI_ENGINE 14 | ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp 15 | ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/avs_commons_check.c 16 | CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${INCLUDE_DIRS}") 17 | 18 | if(WITH_AVS_CRYPTO_PKI_ENGINE) 19 | add_executable(${PROJECT_NAME} src/main.c) 20 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 21 | endif() 22 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-EST/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-est C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-NIDD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-nidd C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/nidd_demo_driver.h 12 | src/nidd_demo_driver.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-NIDD/src/nidd_demo_driver.h: -------------------------------------------------------------------------------- 1 | #ifndef DEMO_NIDD_DEMO_DRIVER_H 2 | #define DEMO_NIDD_DEMO_DRIVER_H 3 | 4 | #include 5 | #include 6 | 7 | /** 8 | * Simple NIDD driver that connects to the PTY of a modem device, responsible 9 | * for NIDD connectivity. 10 | * 11 | * @param modem_device Path to the modem pseudo-terminal device, e.g. 12 | * "/dev/pts/1". 13 | * 14 | * @returns pointer to a newly created NIDD driver. 15 | */ 16 | anjay_nidd_driver_t **demo_nidd_driver_create(const char *modem_device); 17 | 18 | void demo_nidd_driver_cleanup(anjay_nidd_driver_t **driver); 19 | 20 | #endif /* DEMO_NIDD_DEMO_DRIVER_H */ 21 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-OSCORE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-oscore C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-PKCS11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-pkcs11 C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | # check if AVS_COMMONS_WITH_AVS_CRYPTO_PKI_ENGINE is enabled 10 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/avs_commons_check.c 11 | "#include \nint main() {\n#ifndef AVS_COMMONS_WITH_AVS_CRYPTO_PKI_ENGINE\nint error[-1];\n#endif\nreturn 0; }\n") 12 | get_target_property(INCLUDE_DIRS anjay INTERFACE_INCLUDE_DIRECTORIES) 13 | try_compile(WITH_AVS_CRYPTO_PKI_ENGINE 14 | ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp 15 | ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/avs_commons_check.c 16 | CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${INCLUDE_DIRS}") 17 | 18 | if(WITH_AVS_CRYPTO_PKI_ENGINE) 19 | add_executable(${PROJECT_NAME} src/main.c) 20 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 21 | endif() 22 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-PSA-PKI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-psa-pki C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-PSA-PSK/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-psa-psk C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-PSA-bootstrap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-psa-bootstrap C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-PSA-management/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-psa-management C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(avs_commons COMPONENTS crypto REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE avs_crypto) 11 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-SMS-PSK/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-sms-psk C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-SMS-UDP/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-sms-udp C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-SMS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-sms C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/commercial-features/CF-SmartCardBootstrap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-smart-card-bootstrap C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} src/main.c) 12 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 13 | -------------------------------------------------------------------------------- /examples/commercial-features/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/custom-network/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | add_subdirectory(minimal) 3 | add_subdirectory(remote-host-port) 4 | add_subdirectory(bind) 5 | add_subdirectory(shutdown-remote-hostname) 6 | add_subdirectory(stats) 7 | 8 | # NOTE: ip-stickiness requires -DWITHOUT_IP_STICKINESS=OFF 9 | # so it's not included here 10 | -------------------------------------------------------------------------------- /examples/custom-network/bind/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-network-bind C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | 8 | add_executable(${PROJECT_NAME} 9 | src/main.c 10 | src/net_impl.c) 11 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 12 | -------------------------------------------------------------------------------- /examples/custom-network/bind/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-network/ip-stickiness/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-network-ip-stickiness C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | 8 | add_executable(${PROJECT_NAME} 9 | src/main.c 10 | src/net_impl.c) 11 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 12 | -------------------------------------------------------------------------------- /examples/custom-network/ip-stickiness/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-network/minimal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(minimal-custom-network C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | 8 | add_executable(${PROJECT_NAME} 9 | src/main.c 10 | src/net_impl.c) 11 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 12 | -------------------------------------------------------------------------------- /examples/custom-network/minimal/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-network/remote-host-port/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-network-remote-host-port C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | 8 | add_executable(${PROJECT_NAME} 9 | src/main.c 10 | src/net_impl.c) 11 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 12 | -------------------------------------------------------------------------------- /examples/custom-network/remote-host-port/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-network/shutdown-remote-hostname/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-network-shutdown-remote-hostname C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | 8 | add_executable(${PROJECT_NAME} 9 | src/main.c 10 | src/net_impl.c) 11 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 12 | -------------------------------------------------------------------------------- /examples/custom-network/shutdown-remote-hostname/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-network/stats/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-network-stats C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | 8 | add_executable(${PROJECT_NAME} 9 | src/main.c 10 | src/net_impl.c) 11 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 12 | -------------------------------------------------------------------------------- /examples/custom-network/stats/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | add_subdirectory(stub) 3 | add_subdirectory(minimal) 4 | add_subdirectory(resumption-simple) 5 | add_subdirectory(resumption-buffer) 6 | add_subdirectory(config-features) 7 | add_subdirectory(certificates-basic) 8 | add_subdirectory(certificates-advanced) 9 | add_subdirectory(certificates-advanced-fake-dane) 10 | add_subdirectory(tcp-support) 11 | -------------------------------------------------------------------------------- /examples/custom-tls/certificates-advanced-fake-dane/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-certificates-advanced-fake-dane C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/certificates-advanced-fake-dane/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-Certificates/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/certificates-advanced-fake-dane/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/certificates-advanced/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-certificates-advanced C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/certificates-advanced/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-Certificates/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/certificates-advanced/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/certificates-basic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-certificates-basic C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/certificates-basic/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/config-features/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-config-features C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/config-features/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/config-features/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/minimal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-minimal C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/minimal/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/minimal/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/resumption-buffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-resumption-buffer C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/resumption-buffer/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/resumption-buffer/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/resumption-simple/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-resumption-simple C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/resumption-simple/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/resumption-simple/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/stub/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-stub C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/net_impl.c 12 | src/tls_impl.c) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 14 | -------------------------------------------------------------------------------- /examples/custom-tls/stub/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/AT-CustomEventLoop/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/stub/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/tcp-support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-tls-tcp-support C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | 6 | find_package(anjay REQUIRED) 7 | find_package(OpenSSL REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/firmware_update.c 12 | src/firmware_update.h 13 | src/net_impl.c 14 | src/time_object.c 15 | src/time_object.h 16 | src/tls_impl.c) 17 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay OpenSSL::SSL) 18 | -------------------------------------------------------------------------------- /examples/custom-tls/tcp-support/src/firmware_update.h: -------------------------------------------------------------------------------- 1 | ../../../tutorial/firmware-update/secure-downloads/src/firmware_update.h -------------------------------------------------------------------------------- /examples/custom-tls/tcp-support/src/main.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/firmware-update/secure-downloads/src/main.c -------------------------------------------------------------------------------- /examples/custom-tls/tcp-support/src/net_impl.c: -------------------------------------------------------------------------------- 1 | ../../../custom-network/ip-stickiness/src/net_impl.c -------------------------------------------------------------------------------- /examples/custom-tls/tcp-support/src/time_object.c: -------------------------------------------------------------------------------- 1 | ../../../tutorial/firmware-update/secure-downloads/src/time_object.c -------------------------------------------------------------------------------- /examples/custom-tls/tcp-support/src/time_object.h: -------------------------------------------------------------------------------- 1 | ../../../tutorial/firmware-update/secure-downloads/src/time_object.h -------------------------------------------------------------------------------- /examples/tutorial/AT-AccessControl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(access-control C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/test_object.c 12 | src/test_object.h) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/tutorial/AT-AccessControl/src/test_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_OBJECT_H 2 | #define TEST_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **create_test_object(void); 7 | void delete_test_object(const anjay_dm_object_def_t **obj); 8 | 9 | #endif /* TEST_OBJECT_H */ 10 | -------------------------------------------------------------------------------- /examples/tutorial/AT-Certificates/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-cert C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomEventLoop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(custom-event-loop C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} src/main.c) 12 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 13 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(bootstrap-awareness) 2 | add_subdirectory(multi-instance-dynamic) 3 | add_subdirectory(multi-instance-resources-dynamic) 4 | add_subdirectory(read-only) 5 | add_subdirectory(read-only-with-executable) 6 | add_subdirectory(read-only-multiple-fixed) 7 | add_subdirectory(writable-multiple-fixed) 8 | add_subdirectory(writable-multiple-fixed-transactional) 9 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/bootstrap-awareness/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(bootstrap_awareness C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/multi-instance-dynamic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(multi-instance-dynamic C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/test_object.c 12 | src/test_object.h) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/multi-instance-dynamic/src/test_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_OBJECT_H 2 | #define TEST_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **create_test_object(void); 7 | void delete_test_object(const anjay_dm_object_def_t **obj); 8 | 9 | #endif /* TEST_OBJECT_H */ 10 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/multi-instance-resources-dynamic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(multi-instance-resources-dynamic C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/test_object.c 12 | src/test_object.h) 13 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 14 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/multi-instance-resources-dynamic/src/test_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_OBJECT_H 2 | #define TEST_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **create_test_object(void); 7 | void delete_test_object(const anjay_dm_object_def_t **obj); 8 | 9 | #endif /* TEST_OBJECT_H */ 10 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/read-only-multiple-fixed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(multi-instance-read-only-fixed C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/read-only-with-executable/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(single-instance-read-only-with-executable C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/read-only/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(single-instance-read-only C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/writable-multiple-fixed-transactional/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(multi-instance-writable-fixed-transactional C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-CustomObjects/writable-multiple-fixed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(multi-instance-writable-fixed C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-Downloader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(downloader C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-IpsoObjects/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(ipso-objects C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/AT-Persistence/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(persistence C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} src/main.c) 10 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 11 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Initialization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-initialization C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} src/main.c) 12 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 13 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Initialization/src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) { 5 | if (argc != 2) { 6 | avs_log(tutorial, ERROR, "usage: %s ENDPOINT_NAME", argv[0]); 7 | return -1; 8 | } 9 | 10 | const anjay_configuration_t CONFIG = { 11 | .endpoint_name = argv[1], 12 | .in_buffer_size = 4000, 13 | .out_buffer_size = 4000, 14 | .msg_cache_size = 4000 15 | }; 16 | 17 | anjay_t *anjay = anjay_new(&CONFIG); 18 | if (!anjay) { 19 | avs_log(tutorial, ERROR, "Could not create Anjay object"); 20 | return -1; 21 | } 22 | 23 | anjay_event_loop_run(anjay, avs_time_duration_from_scalar(1, AVS_TIME_S)); 24 | 25 | anjay_delete(anjay); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /examples/tutorial/BC-MandatoryObjects/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-mandatory-objects C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} src/main.c) 12 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 13 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Notifications/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-notifications C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c 13 | src/time_object.h 14 | src/time_object.c) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Notifications/src/time_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_OBJECT_H 2 | #define TIME_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **time_object_create(void); 7 | void time_object_release(const anjay_dm_object_def_t **def); 8 | void time_object_notify(anjay_t *anjay, const anjay_dm_object_def_t **def); 9 | 10 | #endif // TIME_OBJECT_H 11 | -------------------------------------------------------------------------------- /examples/tutorial/BC-ObjectImplementation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-object-implementation C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c 13 | src/time_object.h 14 | src/time_object.c) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/BC-ObjectImplementation/src/time_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_OBJECT_H 2 | #define TIME_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **time_object_create(void); 7 | void time_object_release(const anjay_dm_object_def_t **def); 8 | 9 | #endif // TIME_OBJECT_H 10 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Security/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-security C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} src/main.c) 12 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 13 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Send/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-send C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_compile_options(-Wall -Wextra) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c 13 | src/time_object.h 14 | src/time_object.c) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/BC-Send/src/time_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_OBJECT_H 2 | #define TIME_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **time_object_create(void); 7 | void time_object_release(const anjay_dm_object_def_t **def); 8 | void time_object_notify(anjay_t *anjay, const anjay_dm_object_def_t **def); 9 | void time_object_send(anjay_t *anjay, const anjay_dm_object_def_t **def); 10 | 11 | #endif // TIME_OBJECT_H 12 | -------------------------------------------------------------------------------- /examples/tutorial/BC-ThreadSafety/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-bc-thread-safety C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS ON) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | find_package(Threads REQUIRED) 11 | 12 | add_executable(${PROJECT_NAME} 13 | src/main.c 14 | src/time_object.h 15 | src/time_object.c) 16 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay ${CMAKE_THREAD_LIBS_INIT}) 17 | -------------------------------------------------------------------------------- /examples/tutorial/BC-ThreadSafety/src/time_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_OBJECT_H 2 | #define TIME_OBJECT_H 3 | 4 | #include 5 | 6 | const anjay_dm_object_def_t **time_object_create(void); 7 | void time_object_release(const anjay_dm_object_def_t **def); 8 | void time_object_notify(anjay_t *anjay, const anjay_dm_object_def_t **def); 9 | 10 | #endif // TIME_OBJECT_H 11 | -------------------------------------------------------------------------------- /examples/tutorial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | add_subdirectory(BC-Initialization) 3 | add_subdirectory(BC-MandatoryObjects) 4 | add_subdirectory(BC-Security) 5 | add_subdirectory(BC-ObjectImplementation) 6 | add_subdirectory(BC-Notifications) 7 | add_subdirectory(BC-Send) 8 | add_subdirectory(BC-ThreadSafety) 9 | add_subdirectory(firmware-update) 10 | add_subdirectory(AT-AccessControl) 11 | add_subdirectory(AT-Certificates) 12 | add_subdirectory(AT-CustomObjects) 13 | add_subdirectory(AT-Downloader) 14 | add_subdirectory(AT-Persistence) 15 | add_subdirectory(AT-CustomEventLoop) 16 | add_subdirectory(AT-IpsoObjects) 17 | add_subdirectory(LwM2M-Gateway) 18 | -------------------------------------------------------------------------------- /examples/tutorial/LwM2M-Gateway/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(anjay-lwm2m-gateway C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | add_compile_options(-Wall -Wextra) 8 | 9 | find_package(anjay REQUIRED) 10 | 11 | add_executable(${PROJECT_NAME} 12 | src/main.c 13 | src/gateway_server.h 14 | src/gateway_server.c 15 | src/temperature_object.h 16 | src/temperature_object.c) 17 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 18 | -------------------------------------------------------------------------------- /examples/tutorial/LwM2M-Gateway/src/gateway_server.h: -------------------------------------------------------------------------------- 1 | #ifndef GATEWAY_SERVER_H 2 | #define GATEWAY_SERVER_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #define SOCKET_PATH "/tmp/lwm2m-gateway.sock" 11 | 12 | #define END_DEVICE_NAME_LEN sizeof("urn:dev:00000") 13 | #define VALUE_MESSAGE_MAX_LEN sizeof("xx.yy") 14 | #define EXECUTE_MSG_RESPONSE_LEN sizeof("OK") 15 | 16 | #define DEFAULT_MAXIMAL_EVALUATION_PERIOD 60 17 | #define EVALUATION_CALC_JOB_PERIOD 1 18 | 19 | typedef struct { 20 | struct pollfd cl_poll_fd; 21 | const anjay_dm_object_def_t **temperature_object; 22 | anjay_iid_t iid; 23 | char end_device_name[END_DEVICE_NAME_LEN]; 24 | int32_t evaluation_period; 25 | avs_sched_handle_t notify_job_handle; 26 | avs_sched_handle_t evaluation_period_job_handle; 27 | } end_device_t; 28 | 29 | typedef struct { 30 | anjay_t *anjay; 31 | int srv_socket; 32 | AVS_LIST(end_device_t) end_devices; 33 | } gateway_srv_t; 34 | 35 | typedef enum { 36 | GATEWAY_REQUEST_TYPE_GET_ID, 37 | GATEWAY_REQUEST_TYPE_GET_TEMPERATURE, 38 | GATEWAY_REQUEST_TYPE_GET_MAX_MEASURED_VALUE, 39 | GATEWAY_REQUEST_TYPE_GET_MIN_MEASURED_VALUE, 40 | GATEWAY_REQUEST_TYPE_RESET_MIN_AND_MAX_MEASURED_VALUES 41 | } gateway_request_type_t; 42 | 43 | int gateway_setup_server(gateway_srv_t *gateway_srv); 44 | void gateway_cleanup_server(gateway_srv_t *gateway_srv); 45 | int gateway_request(gateway_srv_t *gateway_srv, 46 | anjay_iid_t end_device_iid, 47 | gateway_request_type_t request_type, 48 | char *out_buffer, 49 | size_t out_buffer_size); 50 | 51 | #endif // GATEWAY_SERVER_H 52 | -------------------------------------------------------------------------------- /examples/tutorial/LwM2M-Gateway/src/temperature_object.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPERATURE_OBJECT_H 2 | #define TEMPERATURE_OBJECT_H 3 | 4 | #include 5 | 6 | #include "gateway_server.h" 7 | 8 | const anjay_dm_object_def_t ** 9 | temperature_object_create(int id, gateway_srv_t *gateway_srv); 10 | void temperature_object_release(const anjay_dm_object_def_t **def); 11 | void temperature_object_send(anjay_t *anjay, AVS_LIST(end_device_t) end_device); 12 | void temperature_object_update_value(anjay_t *anjay, 13 | const anjay_dm_object_def_t **def); 14 | void temperature_object_evaluation_period_update_value( 15 | anjay_t *anjay, 16 | const anjay_dm_object_def_t **def, 17 | int32_t *evaluation_period); 18 | #endif // TEMPERATURE_OBJECT_H 19 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(basic-implementation) 2 | add_subdirectory(secure-downloads) 3 | add_subdirectory(download-resumption) 4 | add_subdirectory(advanced-firmware-update) 5 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/advanced-firmware-update/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(advanced-firmware-update C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/advanced_firmware_update.c 12 | src/advanced_firmware_update.h 13 | src/time_object.c 14 | src/time_object.h) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/advanced-firmware-update/src/advanced_firmware_update.h: -------------------------------------------------------------------------------- 1 | #ifndef ADVANCED_FIRMWARE_UPDATE_H 2 | #define ADVANCED_FIRMWARE_UPDATE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define AFU_DEFAULT_FIRMWARE_VERSION "1.0.0" 10 | #define AFU_ADD_FILE_DEFAULT_CONTENT "1.1.1" 11 | 12 | #define AFU_DEFAULT_FIRMWARE_INSTANCE_IID 0 13 | #define AFU_NUMBER_OF_FIRMWARE_INSTANCES 3 14 | 15 | /** 16 | * Buffer for the endpoint name that will be used when re-launching the client 17 | * after firmware upgrade. 18 | */ 19 | extern const char *ENDPOINT_NAME; 20 | 21 | /** 22 | * Installs the advanced firmware update module. 23 | * 24 | * @returns 0 on success, negative value otherwise. 25 | */ 26 | int afu_update_install(anjay_t *anjay); 27 | 28 | #endif // ADVANCED_FIRMWARE_UPDATE_H 29 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/advanced-firmware-update/src/time_object.c: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.c -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/advanced-firmware-update/src/time_object.h: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.h -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/basic-implementation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(basic-firmware-update C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/firmware_update.c 12 | src/firmware_update.h 13 | src/time_object.c 14 | src/time_object.h) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/basic-implementation/src/firmware_update.h: -------------------------------------------------------------------------------- 1 | #ifndef FIRMWARE_UPDATE_H 2 | #define FIRMWARE_UPDATE_H 3 | #include 4 | #include 5 | 6 | /** 7 | * Buffer for the endpoint name that will be used when re-launching the client 8 | * after firmware upgrade. 9 | */ 10 | extern const char *ENDPOINT_NAME; 11 | 12 | /** 13 | * Installs the firmware update module. 14 | * 15 | * @returns 0 on success, negative value otherwise. 16 | */ 17 | int fw_update_install(anjay_t *anjay); 18 | 19 | #endif // FIRMWARE_UPDATE_H 20 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/basic-implementation/src/time_object.c: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.c -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/basic-implementation/src/time_object.h: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.h -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/download-resumption/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(download-resumption C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/firmware_update.c 12 | src/firmware_update.h 13 | src/time_object.c 14 | src/time_object.h) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/download-resumption/src/firmware_update.h: -------------------------------------------------------------------------------- 1 | #ifndef FIRMWARE_UPDATE_H 2 | #define FIRMWARE_UPDATE_H 3 | #include 4 | #include 5 | 6 | /** 7 | * Buffer for the endpoint name that will be used when re-launching the client 8 | * after firmware upgrade. 9 | */ 10 | extern const char *ENDPOINT_NAME; 11 | 12 | /** 13 | * Installs the firmware update module. 14 | * 15 | * @returns 0 on success, negative value otherwise. 16 | */ 17 | int fw_update_install(anjay_t *anjay); 18 | 19 | #endif // FIRMWARE_UPDATE_H 20 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/download-resumption/src/time_object.c: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.c -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/download-resumption/src/time_object.h: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.h -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/secure-downloads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(secure-downloads C) 3 | 4 | set(CMAKE_C_STANDARD 99) 5 | set(CMAKE_C_EXTENSIONS OFF) 6 | 7 | find_package(anjay REQUIRED) 8 | 9 | add_executable(${PROJECT_NAME} 10 | src/main.c 11 | src/firmware_update.c 12 | src/firmware_update.h 13 | src/time_object.c 14 | src/time_object.h) 15 | target_link_libraries(${PROJECT_NAME} PRIVATE anjay) 16 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/secure-downloads/src/firmware_update.h: -------------------------------------------------------------------------------- 1 | #ifndef FIRMWARE_UPDATE_H 2 | #define FIRMWARE_UPDATE_H 3 | #include 4 | #include 5 | 6 | /** 7 | * Buffer for the endpoint name that will be used when re-launching the client 8 | * after firmware upgrade. 9 | */ 10 | extern const char *ENDPOINT_NAME; 11 | 12 | /** 13 | * Installs the firmware update module. 14 | * 15 | * @returns 0 on success, negative value otherwise. 16 | */ 17 | int fw_update_install(anjay_t *anjay); 18 | 19 | #endif // FIRMWARE_UPDATE_H 20 | -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/secure-downloads/src/time_object.c: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.c -------------------------------------------------------------------------------- /examples/tutorial/firmware-update/secure-downloads/src/time_object.h: -------------------------------------------------------------------------------- 1 | ../../../BC-Notifications/src/time_object.h -------------------------------------------------------------------------------- /include_public/anjay/anjay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_INCLUDE_ANJAY_ANJAY_H 11 | #define ANJAY_INCLUDE_ANJAY_ANJAY_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #endif /*ANJAY_INCLUDE_ANJAY_ANJAY_H*/ 19 | -------------------------------------------------------------------------------- /include_public/anjay/factory_provisioning.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | #ifndef ANJAY_INCLUDE_ANJAY_FACTORY_PROVISIONING_H 10 | #define ANJAY_INCLUDE_ANJAY_FACTORY_PROVISIONING_H 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /** 22 | * Reads Bootstrap Information from the stream (@p data_stream) and initializes 23 | * Anjay's data model. Expected format of the stream data is SenML CBOR, as used 24 | * for a Write-Composite operation. 25 | 26 | * 27 | * @param anjay Anjay Object to operate on. 28 | * @param data_stream Bootstrap Information data stream. 29 | * @returns 30 | * - @ref AVS_OK for success 31 | * - avs_errno(AVS_EBADMSG) if Anjay failed to apply bootstrap 32 | information 33 | * - avs_errno(AVS_ENOMEM) if Anjay failed to allocate memory 34 | * - avs_errno(AVS_EAGAIN) if connection with Bootstrap Server is in 35 | progress 36 | * - avs_errno(AVS_EPROTO) in case of other internal errors 37 | */ 38 | avs_error_t anjay_factory_provision(anjay_t *anjay, avs_stream_t *data_stream); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* ANJAY_INCLUDE_ANJAY_FACTORY_PROVISIONING_H */ 45 | -------------------------------------------------------------------------------- /include_public/anjay/stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | #ifndef ANJAY_INCLUDE_ANJAY_STATS_H 10 | #define ANJAY_INCLUDE_ANJAY_STATS_H 11 | 12 | #include 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /** 19 | * @returns the total amount of bytes transmitted by the client. 20 | * 21 | * NOTE: When ANJAY_WITH_NET_STATS is disabled this function always returns 0. 22 | */ 23 | uint64_t anjay_get_tx_bytes(anjay_t *anjay); 24 | 25 | /** 26 | * @returns the amount of bytes received by the client. 27 | * 28 | * NOTE: When ANJAY_WITH_NET_STATS is disabled this function always returns 0. 29 | */ 30 | uint64_t anjay_get_rx_bytes(anjay_t *anjay); 31 | 32 | /** 33 | * @returns the number of packets received by the client to which cached 34 | * responses were found. 35 | * 36 | * NOTE: When ANJAY_WITH_NET_STATS is disabled this function always returns 0. 37 | */ 38 | uint64_t anjay_get_num_incoming_retransmissions(anjay_t *anjay); 39 | 40 | /** 41 | * @returns the number of packets sent by the client that were already 42 | * cached as well as requests which the client did not get any 43 | * response to. 44 | * 45 | * NOTE: When ANJAY_WITH_NET_STATS is disabled this function always returns 0. 46 | */ 47 | uint64_t anjay_get_num_outgoing_retransmissions(anjay_t *anjay); 48 | 49 | #ifdef __cplusplus 50 | } /* extern "C" */ 51 | #endif 52 | 53 | #endif /* ANJAY_INCLUDE_ANJAY_STATS_H */ 54 | -------------------------------------------------------------------------------- /ltoconfig: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | ./devconfig \ 11 | --c-flags '-Os -DNDEBUG -flto' \ 12 | --without-dtls \ 13 | -D CMAKE_EXE_LINKER_FLAGS='-flto' \ 14 | -D CMAKE_SHARED_LINKED_FLAGS='-flto' \ 15 | -D CMAKE_AR="$(which gcc-ar)" \ 16 | -D CMAKE_RANLIB="$(which gcc-ranlib)" \ 17 | -D WITH_LIBRARY_SHARED=OFF \ 18 | -D AVS_LOG_WITH_TRACE=OFF \ 19 | "$@" 20 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | aiocoap>=0.4 9 | cbor2>=5.4.2 10 | cryptography>=40.0.2 11 | GitPython>=3.1.18 12 | linuxdoc==20230827 13 | openpyxl>=3.1.2 14 | packaging>=21.3 15 | powercmd>=0.3.6 16 | pyparsing>=3.1.1 17 | pyyaml 18 | Sphinx>=5.3.0 19 | sphinx-rtd-theme>=1.3.0 20 | sphinx-tabs 21 | -------------------------------------------------------------------------------- /src/anjay_modules/anjay_attr_storage_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_INCLUDE_ANJAY_MODULES_AS_H 11 | #define ANJAY_INCLUDE_ANJAY_MODULES_AS_H 12 | 13 | typedef struct anjay_attr_storage_struct anjay_attr_storage_t; 14 | 15 | #endif // ANJAY_INCLUDE_ANJAY_MODULES_AS_H 16 | -------------------------------------------------------------------------------- /src/anjay_modules/anjay_bootstrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_INCLUDE_ANJAY_MODULES_BOOTSTRAP_H 11 | #define ANJAY_INCLUDE_ANJAY_MODULES_BOOTSTRAP_H 12 | 13 | #include 14 | 15 | #include 16 | 17 | VISIBILITY_PRIVATE_HEADER_BEGIN 18 | 19 | #ifdef ANJAY_WITH_BOOTSTRAP 20 | 21 | bool _anjay_bootstrap_in_progress(anjay_unlocked_t *anjay); 22 | 23 | void _anjay_bootstrap_cleanup(anjay_unlocked_t *anjay); 24 | 25 | # if defined(ANJAY_WITH_MODULE_FACTORY_PROVISIONING) 26 | avs_error_t _anjay_bootstrap_delete_everything(anjay_unlocked_t *anjay); 27 | 28 | int _anjay_bootstrap_finish(anjay_unlocked_t *anjay); 29 | # endif /* defined(ANJAY_WITH_MODULE_BOOTSTRAPPER) || \ 30 | defined(ANJAY_WITH_MODULE_FACTORY_PROVISIONING) */ 31 | 32 | # ifdef ANJAY_WITH_MODULE_FACTORY_PROVISIONING 33 | int _anjay_bootstrap_write_composite(anjay_unlocked_t *anjay, 34 | anjay_unlocked_input_ctx_t *in_ctx); 35 | # endif // ANJAY_WITH_MODULE_FACTORY_PROVISIONING 36 | 37 | # ifdef ANJAY_WITH_LWM2M11 38 | int _anjay_schedule_bootstrap_request_unlocked(anjay_unlocked_t *anjay); 39 | # endif // ANJAY_WITH_LWM2M11 40 | 41 | #else 42 | 43 | # define _anjay_bootstrap_in_progress(anjay) ((void) (anjay), false) 44 | 45 | # define _anjay_bootstrap_cleanup(anjay) ((void) 0) 46 | 47 | #endif 48 | 49 | VISIBILITY_PRIVATE_HEADER_END 50 | 51 | #endif /* ANJAY_INCLUDE_ANJAY_MODULES_BOOTSTRAP_H */ 52 | -------------------------------------------------------------------------------- /src/anjay_modules/anjay_sched.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_INCLUDE_ANJAY_MODULES_SCHED_H 11 | #define ANJAY_INCLUDE_ANJAY_MODULES_SCHED_H 12 | 13 | #include 14 | 15 | #include 16 | 17 | VISIBILITY_PRIVATE_HEADER_BEGIN 18 | 19 | static inline anjay_t *_anjay_get_from_sched(avs_sched_t *sched) { 20 | return (anjay_t *) avs_sched_data(sched); 21 | } 22 | 23 | VISIBILITY_PRIVATE_HEADER_END 24 | 25 | #endif /* ANJAY_INCLUDE_ANJAY_MODULES_SCHED_H */ 26 | -------------------------------------------------------------------------------- /src/anjay_modules/anjay_time_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_INCLUDE_ANJAY_MODULES_TIME_H 11 | #define ANJAY_INCLUDE_ANJAY_MODULES_TIME_H 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | VISIBILITY_PRIVATE_HEADER_BEGIN 19 | 20 | #define NUM_NANOSECONDS_IN_A_SECOND (1L * 1000L * 1000L * 1000L) 21 | #define NUM_SECONDS_IN_A_DAY 86400 22 | 23 | VISIBILITY_PRIVATE_HEADER_END 24 | 25 | #endif /* ANJAY_INCLUDE_ANJAY_MODULES_TIME_H */ 26 | -------------------------------------------------------------------------------- /src/anjay_modules/dm/anjay_execute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_INCLUDE_ANJAY_MODULES_DM_EXECUTE_H 11 | #define ANJAY_INCLUDE_ANJAY_MODULES_DM_EXECUTE_H 12 | 13 | #include 14 | 15 | #include 16 | 17 | VISIBILITY_PRIVATE_HEADER_BEGIN 18 | 19 | anjay_unlocked_execute_ctx_t * 20 | _anjay_execute_ctx_create(avs_stream_t *payload_stream); 21 | void _anjay_execute_ctx_destroy(anjay_unlocked_execute_ctx_t **ctx); 22 | 23 | VISIBILITY_PRIVATE_HEADER_END 24 | 25 | #endif /* ANJAY_INCLUDE_ANJAY_MODULES_DM_EXECUTE_H */ 26 | -------------------------------------------------------------------------------- /src/core/anjay_lwm2m_send.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_LWM2M_SEND_H 11 | #define ANJAY_LWM2M_SEND_H 12 | 13 | #include 14 | 15 | VISIBILITY_PRIVATE_HEADER_BEGIN 16 | 17 | typedef struct anjay_send_entry anjay_send_entry_t; 18 | 19 | typedef struct { 20 | AVS_LIST(anjay_send_entry_t) entries; 21 | } anjay_sender_t; 22 | 23 | bool _anjay_send_in_progress(anjay_connection_ref_t ref); 24 | 25 | void _anjay_send_interrupt(anjay_connection_ref_t ref); 26 | 27 | void _anjay_send_cleanup(anjay_sender_t *sender); 28 | 29 | #ifndef ANJAY_WITHOUT_QUEUE_MODE_AUTOCLOSE 30 | bool _anjay_send_has_deferred(anjay_unlocked_t *anjay, anjay_ssid_t ssid); 31 | #endif // ANJAY_WITHOUT_QUEUE_MODE_AUTOCLOSE 32 | 33 | int _anjay_send_sched_retry_deferred(anjay_unlocked_t *anjay, 34 | anjay_ssid_t ssid); 35 | 36 | VISIBILITY_PRIVATE_HEADER_END 37 | 38 | #endif /* ANJAY_LWM2M_SEND_H */ 39 | -------------------------------------------------------------------------------- /src/core/anjay_raw_buffer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | VISIBILITY_SOURCE_BEGIN 21 | 22 | void _anjay_raw_buffer_clear(anjay_raw_buffer_t *buffer) { 23 | avs_free(buffer->data); 24 | buffer->data = NULL; 25 | buffer->size = 0; 26 | buffer->capacity = 0; 27 | } 28 | 29 | int _anjay_raw_buffer_clone(anjay_raw_buffer_t *dst, 30 | const anjay_raw_buffer_t *src) { 31 | return _anjay_raw_buffer_from_data(dst, src->data, src->size); 32 | } 33 | 34 | int _anjay_raw_buffer_alloc(anjay_raw_buffer_t *dst, size_t capacity) { 35 | assert(!dst->data && !dst->size); 36 | if (!capacity) { 37 | return 0; 38 | } 39 | dst->data = avs_malloc(capacity); 40 | if (!dst->data) { 41 | return -1; 42 | } 43 | dst->capacity = capacity; 44 | return 0; 45 | } 46 | 47 | int _anjay_raw_buffer_from_data(anjay_raw_buffer_t *dst, 48 | const void *src, 49 | size_t size) { 50 | int result = _anjay_raw_buffer_alloc(dst, size); 51 | if (!result) { 52 | dst->size = size; 53 | memcpy(dst->data, src, size); 54 | } 55 | return result; 56 | } 57 | -------------------------------------------------------------------------------- /src/core/anjay_servers_inactive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_SERVERS_INACTIVE_H 11 | #define ANJAY_SERVERS_INACTIVE_H 12 | 13 | #include "anjay_servers_private.h" 14 | 15 | #if !defined(ANJAY_SERVERS_INTERNALS) && !defined(ANJAY_OBSERVE_SOURCE) \ 16 | && !defined(ANJAY_TEST) 17 | # error "servers_inactive.h shall only be included from " \ 18 | "servers/ or from the Observe subsystem" 19 | #endif 20 | 21 | VISIBILITY_PRIVATE_HEADER_BEGIN 22 | 23 | anjay_server_info_t *_anjay_servers_find(anjay_unlocked_t *anjay, 24 | anjay_ssid_t ssid); 25 | 26 | bool _anjay_server_is_disable_scheduled(anjay_server_info_t *server); 27 | 28 | bool _anjay_server_active(anjay_server_info_t *server); 29 | 30 | VISIBILITY_PRIVATE_HEADER_END 31 | 32 | #endif // ANJAY_SERVERS_INACTIVE_H 33 | -------------------------------------------------------------------------------- /src/core/anjay_servers_reload.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_SERVERS_RELOAD_H 11 | #define ANJAY_SERVERS_RELOAD_H 12 | 13 | #include 14 | 15 | #if !(defined(ANJAY_SERVERS_INTERNALS) || defined(ANJAY_LWM2M_SEND_SOURCE) \ 16 | || defined(ANJAY_TEST)) 17 | # error "Headers from servers/ are not meant to be included from outside" 18 | #endif 19 | 20 | VISIBILITY_PRIVATE_HEADER_BEGIN 21 | 22 | int _anjay_schedule_delayed_reload_servers(anjay_unlocked_t *anjay); 23 | 24 | int _anjay_schedule_refresh_server(anjay_server_info_t *server, 25 | avs_time_duration_t delay); 26 | 27 | VISIBILITY_PRIVATE_HEADER_END 28 | 29 | #endif // ANJAY_SERVERS_RELOAD_H 30 | -------------------------------------------------------------------------------- /src/core/anjay_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_STATS_H 11 | #define ANJAY_STATS_H 12 | 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | VISIBILITY_PRIVATE_HEADER_BEGIN 22 | 23 | #ifdef ANJAY_WITH_NET_STATS 24 | 25 | /** 26 | * Structure for aggregating statistics of all closed coap contexts and sockets. 27 | */ 28 | typedef struct { 29 | avs_coap_stats_t coap_stats; 30 | struct { 31 | uint64_t bytes_sent; 32 | uint64_t bytes_received; 33 | } socket_stats; 34 | } closed_connections_stats_t; 35 | 36 | #endif // ANJAY_WITH_NET_STATS 37 | 38 | void _anjay_coap_ctx_cleanup(anjay_unlocked_t *anjay, avs_coap_ctx_t **ctx); 39 | 40 | avs_error_t _anjay_socket_cleanup(anjay_unlocked_t *anjay, 41 | avs_net_socket_t **socket); 42 | 43 | VISIBILITY_PRIVATE_HEADER_END 44 | 45 | #endif // ANJAY_STATS_H 46 | -------------------------------------------------------------------------------- /src/core/coap/anjay_content_format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_COAP_CONTENT_FORMAT_H 11 | #define ANJAY_COAP_CONTENT_FORMAT_H 12 | 13 | /* for AVS_COAP_FORMAT_NONE */ 14 | #include 15 | 16 | VISIBILITY_PRIVATE_HEADER_BEGIN 17 | 18 | /** Auxiliary constants for common Content-Format Option values */ 19 | 20 | #ifdef ANJAY_WITH_LEGACY_CONTENT_FORMAT_SUPPORT 21 | # define ANJAY_COAP_FORMAT_LEGACY_PLAINTEXT 1541 22 | # define ANJAY_COAP_FORMAT_LEGACY_TLV 1542 23 | # define ANJAY_COAP_FORMAT_LEGACY_JSON 1543 24 | # define ANJAY_COAP_FORMAT_LEGACY_OPAQUE 1544 25 | #endif // ANJAY_WITH_LEGACY_CONTENT_FORMAT_SUPPORT 26 | 27 | VISIBILITY_PRIVATE_HEADER_END 28 | 29 | #endif // ANJAY_COAP_CONTENT_FORMAT_H 30 | -------------------------------------------------------------------------------- /src/core/dm/anjay_dm_create.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_CREATE_CORE_H 11 | #define ANJAY_CREATE_CORE_H 12 | 13 | #include 14 | 15 | #include "../anjay_dm_core.h" 16 | #include "../anjay_io_core.h" 17 | 18 | VISIBILITY_PRIVATE_HEADER_BEGIN 19 | 20 | int _anjay_dm_create(anjay_unlocked_t *anjay, 21 | const anjay_dm_installed_object_t *obj, 22 | const anjay_request_t *request, 23 | anjay_ssid_t ssid, 24 | anjay_unlocked_input_ctx_t *in_ctx); 25 | 26 | VISIBILITY_PRIVATE_HEADER_END 27 | 28 | #endif // ANJAY_CREATE_CORE_H 29 | -------------------------------------------------------------------------------- /src/core/dm/anjay_dm_execute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_EXECUTE_CORE_H 11 | #define ANJAY_EXECUTE_CORE_H 12 | 13 | #include 14 | 15 | VISIBILITY_PRIVATE_HEADER_BEGIN 16 | 17 | typedef enum { 18 | STATE_READ_ARGUMENT = 0, 19 | STATE_READ_VALUE, 20 | STATE_FINISHED_READING_ARGUMENT, 21 | STATE_EOF, 22 | STATE_ERROR 23 | } anjay_execute_state_t; 24 | 25 | struct anjay_unlocked_execute_ctx_struct { 26 | avs_stream_t *payload_stream; 27 | anjay_execute_state_t state; 28 | int arg; 29 | bool arg_has_value; 30 | }; 31 | 32 | VISIBILITY_PRIVATE_HEADER_END 33 | 34 | #endif // ANJAY_EXECUTE_CORE_H 35 | -------------------------------------------------------------------------------- /src/core/dm/anjay_dm_write_attrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_WRITE_ATTRS_CORE_H 11 | #define ANJAY_WRITE_ATTRS_CORE_H 12 | 13 | #include 14 | 15 | #include "../anjay_dm_core.h" 16 | #include "../anjay_io_core.h" 17 | 18 | VISIBILITY_PRIVATE_HEADER_BEGIN 19 | 20 | bool _anjay_dm_resource_specific_request_attrs_empty( 21 | const anjay_request_attributes_t *attrs); 22 | bool _anjay_dm_request_attrs_empty(const anjay_request_attributes_t *attrs); 23 | 24 | void _anjay_update_r_attrs(anjay_dm_r_attributes_t *attrs_ptr, 25 | const anjay_request_attributes_t *request_attrs); 26 | 27 | bool _anjay_r_attrs_valid(const anjay_dm_r_attributes_t *attrs); 28 | 29 | int _anjay_dm_write_attributes(anjay_unlocked_t *anjay, 30 | const anjay_dm_installed_object_t *obj, 31 | const anjay_request_t *request, 32 | anjay_ssid_t ssid); 33 | 34 | VISIBILITY_PRIVATE_HEADER_END 35 | 36 | #endif // ANJAY_WRITE_ATTRS_CORE_H 37 | -------------------------------------------------------------------------------- /src/core/dm/anjay_query.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_DM_QUERY_H 11 | #define ANJAY_DM_QUERY_H 12 | 13 | #include 14 | 15 | VISIBILITY_PRIVATE_HEADER_BEGIN 16 | 17 | int _anjay_find_server_iid(anjay_unlocked_t *anjay, 18 | anjay_ssid_t ssid, 19 | anjay_iid_t *out_iid); 20 | 21 | int _anjay_ssid_from_server_iid(anjay_unlocked_t *anjay, 22 | anjay_iid_t server_iid, 23 | anjay_ssid_t *out_ssid); 24 | 25 | #ifdef ANJAY_WITH_BOOTSTRAP 26 | bool _anjay_is_bootstrap_security_instance(anjay_unlocked_t *anjay, 27 | anjay_iid_t security_iid); 28 | 29 | anjay_iid_t _anjay_find_bootstrap_security_iid(anjay_unlocked_t *anjay); 30 | #else 31 | # define _anjay_is_bootstrap_security_instance(...) (false) 32 | # define _anjay_find_bootstrap_security_iid(...) ANJAY_ID_INVALID 33 | #endif 34 | 35 | avs_time_duration_t 36 | _anjay_disable_timeout_from_server_iid(anjay_unlocked_t *anjay, 37 | anjay_iid_t server_iid); 38 | 39 | VISIBILITY_PRIVATE_HEADER_END 40 | 41 | #endif // ANJAY_DM_QUERY_H 42 | -------------------------------------------------------------------------------- /src/core/io/anjay_base64_out.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_IO_BASE64_OUT_H 11 | #define ANJAY_IO_BASE64_OUT_H 12 | 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | 19 | VISIBILITY_PRIVATE_HEADER_BEGIN 20 | 21 | anjay_unlocked_ret_bytes_ctx_t *_anjay_base64_ret_bytes_ctx_new( 22 | avs_stream_t *stream, avs_base64_config_t config, size_t length); 23 | int _anjay_base64_ret_bytes_ctx_close(anjay_unlocked_ret_bytes_ctx_t *ctx); 24 | 25 | void _anjay_base64_ret_bytes_ctx_delete(anjay_unlocked_ret_bytes_ctx_t **ctx); 26 | 27 | VISIBILITY_PRIVATE_HEADER_END 28 | 29 | #endif /* ANJAY_IO_BASE64_OUT_H */ 30 | -------------------------------------------------------------------------------- /src/core/io/anjay_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #include "anjay_common.h" 13 | 14 | VISIBILITY_SOURCE_BEGIN 15 | 16 | int _anjay_io_parse_objlnk(char *objlnk, 17 | anjay_oid_t *out_oid, 18 | anjay_iid_t *out_iid) { 19 | char *colon = strchr(objlnk, ':'); 20 | if (!colon) { 21 | return -1; 22 | } 23 | *colon = '\0'; 24 | long long oid; 25 | long long iid; 26 | if (_anjay_safe_strtoll(objlnk, &oid) 27 | || _anjay_safe_strtoll(colon + 1, &iid) || oid < 0 28 | || oid > UINT16_MAX || iid < 0 || iid > UINT16_MAX) { 29 | return -1; 30 | } 31 | *out_oid = (anjay_oid_t) oid; 32 | *out_iid = (anjay_iid_t) iid; 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /src/core/io/anjay_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_IO_COMMON_H 11 | #define ANJAY_IO_COMMON_H 12 | 13 | #include 14 | #include 15 | 16 | #include "../anjay_io_core.h" 17 | 18 | #include 19 | #include 20 | 21 | VISIBILITY_PRIVATE_HEADER_BEGIN 22 | 23 | #define MAX_OBJLNK_STRING_SIZE sizeof("65535:65535") 24 | /** 25 | * Enumeration for supported SenML labels. Their numeric values correspond to 26 | * their CBOR representation wherever possible. 27 | */ 28 | typedef enum { 29 | SENML_LABEL_BASE_TIME = -3, 30 | SENML_LABEL_BASE_NAME = -2, 31 | SENML_LABEL_NAME = 0, 32 | SENML_LABEL_VALUE = 2, 33 | SENML_LABEL_VALUE_STRING = 3, 34 | SENML_LABEL_VALUE_BOOL = 4, 35 | SENML_LABEL_TIME = 6, 36 | SENML_LABEL_VALUE_OPAQUE = 8, 37 | /* NOTE: Objlnk is represented as a string "vlo" */ 38 | SENML_EXT_LABEL_OBJLNK = 0x766C6F /* "vlo */ 39 | } senml_label_t; 40 | 41 | #define SENML_EXT_OBJLNK_REPR "vlo" 42 | 43 | /** 44 | * Converts Object link from string format OID:IID to numeric OID and IID. 45 | * 46 | * @p out_oid and @p out_iid are modified only if this function succeeded. 47 | * 48 | * NOTE: @p objlnk may be modified by this function. 49 | */ 50 | int _anjay_io_parse_objlnk(char *objlnk, 51 | anjay_oid_t *out_oid, 52 | anjay_iid_t *out_iid); 53 | 54 | VISIBILITY_PRIVATE_HEADER_END 55 | 56 | #endif /* ANJAY_IO_COMMON_H */ 57 | -------------------------------------------------------------------------------- /src/core/io/anjay_corelnk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_IO_CORELNK_H 11 | #define ANJAY_IO_CORELNK_H 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | VISIBILITY_PRIVATE_HEADER_BEGIN 19 | 20 | /** 21 | * Function that returns a null-terminated string containing a list of objects, 22 | * their instances and version. It can be used as a payload for Register and 23 | * Update operations or as a /25/x/3 resource value. 24 | * 25 | * @param anjay Anjay object to operate on. 26 | * @param dm Data model on which the query will be performed. 27 | * @param version LwM2M version for which the query will be prepared. 28 | * @param buffer The pointer that will be set to the buffer with the 29 | * prepared string. It is the caller's responsibility to 30 | * free the buffer using avs_free(). 31 | * 32 | * @returns 0 on success, a negative value in case of error. 33 | */ 34 | int _anjay_corelnk_query_dm(anjay_unlocked_t *anjay, 35 | anjay_dm_t *dm, 36 | anjay_lwm2m_version_t version, 37 | char **buffer); 38 | 39 | VISIBILITY_PRIVATE_HEADER_END 40 | 41 | #endif // ANJAY_IO_CORELNK_H 42 | -------------------------------------------------------------------------------- /src/core/io/anjay_tlv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_IO_TLV_H 11 | #define ANJAY_IO_TLV_H 12 | 13 | VISIBILITY_PRIVATE_HEADER_BEGIN 14 | 15 | typedef enum { 16 | TLV_ID_IID = 0, 17 | TLV_ID_RIID = 1, 18 | TLV_ID_RID_ARRAY = 2, 19 | TLV_ID_RID = 3 20 | } tlv_id_type_t; 21 | 22 | VISIBILITY_PRIVATE_HEADER_END 23 | 24 | #endif /* ANJAY_IO_TLV_H */ 25 | -------------------------------------------------------------------------------- /src/core/io/json/anjay_json_decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_IO_JSON_DECODER_H 11 | #define ANJAY_IO_JSON_DECODER_H 12 | 13 | #include "../anjay_json_like_decoder.h" 14 | 15 | VISIBILITY_PRIVATE_HEADER_BEGIN 16 | 17 | anjay_json_like_decoder_t *_anjay_json_decoder_new(avs_stream_t *stream); 18 | 19 | VISIBILITY_PRIVATE_HEADER_END 20 | 21 | #endif // ANJAY_IO_JSON_DECODER_H 22 | -------------------------------------------------------------------------------- /src/core/servers/anjay_security.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_SERVERS_SECURITY_H 11 | #define ANJAY_SERVERS_SECURITY_H 12 | 13 | #include "anjay_connections.h" 14 | 15 | #if !defined(ANJAY_SERVERS_INTERNALS) && !defined(ANJAY_TEST) 16 | # error "Headers from servers/ are not meant to be included from outside" 17 | #endif 18 | 19 | VISIBILITY_PRIVATE_HEADER_BEGIN 20 | 21 | typedef struct { 22 | anjay_ssid_t ssid; 23 | anjay_iid_t security_iid; 24 | avs_url_t *uri; 25 | const anjay_transport_info_t *transport_info; 26 | bool is_encrypted; 27 | } anjay_connection_info_t; 28 | 29 | int _anjay_connection_security_generic_get_uri( 30 | anjay_unlocked_t *anjay, 31 | anjay_iid_t security_iid, 32 | avs_url_t **out_uri, 33 | const anjay_transport_info_t **out_transport_info); 34 | 35 | avs_error_t _anjay_connection_security_generic_get_config( 36 | anjay_unlocked_t *anjay, 37 | anjay_security_config_t *out_config, 38 | anjay_security_config_cache_t *cache, 39 | anjay_connection_info_t *inout_info); 40 | 41 | VISIBILITY_PRIVATE_HEADER_END 42 | 43 | #endif // ANJAY_SERVERS_SECURITY_H 44 | -------------------------------------------------------------------------------- /src/core/servers/anjay_server_connections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_SERVERS_SERVER_CONNECTIONS_H 11 | #define ANJAY_SERVERS_SERVER_CONNECTIONS_H 12 | 13 | #include "../anjay_core.h" 14 | #include "../anjay_utils_private.h" 15 | 16 | #if !defined(ANJAY_SERVERS_INTERNALS) && !defined(ANJAY_TEST) 17 | # error "Headers from servers/ are not meant to be included from outside" 18 | #endif 19 | 20 | #include "anjay_connections.h" 21 | #include "anjay_servers_internal.h" 22 | 23 | VISIBILITY_PRIVATE_HEADER_BEGIN 24 | 25 | static inline anjay_server_connection_t * 26 | _anjay_get_server_connection(anjay_connection_ref_t ref) { 27 | assert(ref.server); 28 | return _anjay_connection_get(&ref.server->connections, ref.conn_type); 29 | } 30 | 31 | void _anjay_active_server_refresh(anjay_server_info_t *server); 32 | 33 | void _anjay_connections_flush_notifications(anjay_connections_t *connections); 34 | 35 | VISIBILITY_PRIVATE_HEADER_END 36 | 37 | #endif // ANJAY_SERVERS_SERVER_CONNECTIONS_H 38 | -------------------------------------------------------------------------------- /src/modules/security/anjay_security_transaction.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef SECURITY_TRANSACTION_H 11 | #define SECURITY_TRANSACTION_H 12 | #include 13 | 14 | #include "anjay_mod_security.h" 15 | 16 | VISIBILITY_PRIVATE_HEADER_BEGIN 17 | 18 | int _anjay_sec_object_validate_and_process_keys(anjay_unlocked_t *anjay, 19 | sec_repr_t *repr); 20 | 21 | int _anjay_sec_transaction_begin_impl(sec_repr_t *repr); 22 | int _anjay_sec_transaction_commit_impl(sec_repr_t *repr); 23 | int _anjay_sec_transaction_validate_impl(anjay_unlocked_t *anjay, 24 | sec_repr_t *repr); 25 | int _anjay_sec_transaction_rollback_impl(sec_repr_t *repr); 26 | 27 | VISIBILITY_PRIVATE_HEADER_END 28 | 29 | #endif /* SECURITY_TRANSACTION_H */ 30 | -------------------------------------------------------------------------------- /src/modules/server/anjay_server_transaction.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef SERVER_TRANSACTION_H 11 | #define SERVER_TRANSACTION_H 12 | #include 13 | 14 | #include "anjay_mod_server.h" 15 | 16 | VISIBILITY_PRIVATE_HEADER_BEGIN 17 | 18 | int _anjay_serv_object_validate(server_repr_t *repr); 19 | 20 | int _anjay_serv_transaction_begin_impl(server_repr_t *repr); 21 | int _anjay_serv_transaction_commit_impl(server_repr_t *repr); 22 | int _anjay_serv_transaction_validate_impl(server_repr_t *repr); 23 | int _anjay_serv_transaction_rollback_impl(server_repr_t *repr); 24 | 25 | VISIBILITY_PRIVATE_HEADER_END 26 | 27 | #endif /* SERVER_TRANSACTION_H */ 28 | -------------------------------------------------------------------------------- /src/modules/server/anjay_server_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef SERVER_UTILS_H 11 | #define SERVER_UTILS_H 12 | #include 13 | 14 | #include 15 | 16 | #include "anjay_mod_server.h" 17 | 18 | VISIBILITY_PRIVATE_HEADER_BEGIN 19 | 20 | server_repr_t *_anjay_serv_get(const anjay_dm_installed_object_t obj_ptr); 21 | 22 | int _anjay_serv_fetch_ssid(anjay_unlocked_input_ctx_t *ctx, 23 | anjay_ssid_t *out_ssid); 24 | int _anjay_serv_fetch_validated_i32(anjay_unlocked_input_ctx_t *ctx, 25 | int32_t min_value, 26 | int32_t max_value, 27 | int32_t *out_value); 28 | int _anjay_serv_fetch_binding(anjay_unlocked_input_ctx_t *ctx, 29 | anjay_binding_mode_t *out_binding); 30 | 31 | AVS_LIST(server_instance_t) 32 | _anjay_serv_clone_instances(const server_repr_t *repr); 33 | void _anjay_serv_destroy_instances(AVS_LIST(server_instance_t) *instances); 34 | void _anjay_serv_reset_instance(server_instance_t *serv); 35 | 36 | VISIBILITY_PRIVATE_HEADER_END 37 | 38 | #endif /* SERVER_UTILS_H */ 39 | -------------------------------------------------------------------------------- /standalone/security/standalone_security_transaction.h: -------------------------------------------------------------------------------- 1 | #ifndef ANJAY_STANDALONE_SECURITY_TRANSACTION_H 2 | #define ANJAY_STANDALONE_SECURITY_TRANSACTION_H 3 | 4 | #include "standalone_mod_security.h" 5 | 6 | int _standalone_sec_object_validate_and_process_keys(anjay_t *anjay, 7 | sec_repr_t *repr); 8 | 9 | int _standalone_sec_transaction_begin_impl(sec_repr_t *repr); 10 | int _standalone_sec_transaction_commit_impl(sec_repr_t *repr); 11 | int _standalone_sec_transaction_validate_impl(anjay_t *anjay, sec_repr_t *repr); 12 | int _standalone_sec_transaction_rollback_impl(sec_repr_t *repr); 13 | 14 | #endif /* ANJAY_STANDALONE_SECURITY_TRANSACTION_H */ 15 | -------------------------------------------------------------------------------- /standalone/server/standalone_server_transaction.h: -------------------------------------------------------------------------------- 1 | #ifndef ANJAY_STANDALONE_SERVER_TRANSACTION_H 2 | #define ANJAY_STANDALONE_SERVER_TRANSACTION_H 3 | 4 | #include "standalone_mod_server.h" 5 | 6 | int _standalone_serv_object_validate(server_repr_t *repr); 7 | 8 | int _standalone_serv_transaction_begin_impl(server_repr_t *repr); 9 | int _standalone_serv_transaction_commit_impl(server_repr_t *repr); 10 | int _standalone_serv_transaction_validate_impl(server_repr_t *repr); 11 | int _standalone_serv_transaction_rollback_impl(server_repr_t *repr); 12 | 13 | #endif /* ANJAY_STANDALONE_SERVER_TRANSACTION_H */ 14 | -------------------------------------------------------------------------------- /standalone/server/standalone_server_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef ANJAY_STANDALONE_SERVER_UTILS_H 2 | #define ANJAY_STANDALONE_SERVER_UTILS_H 3 | 4 | #include 5 | 6 | #include "standalone_mod_server.h" 7 | 8 | server_repr_t * 9 | _standalone_serv_get(const anjay_dm_object_def_t *const *obj_ptr); 10 | 11 | int _standalone_serv_fetch_ssid(anjay_input_ctx_t *ctx, anjay_ssid_t *out_ssid); 12 | int _standalone_serv_fetch_validated_i32(anjay_input_ctx_t *ctx, 13 | int32_t min_value, 14 | int32_t max_value, 15 | int32_t *out_value); 16 | int _standalone_serv_fetch_binding(anjay_input_ctx_t *ctx, 17 | standalone_binding_mode_t *out_binding); 18 | 19 | AVS_LIST(server_instance_t) 20 | _standalone_serv_clone_instances(const server_repr_t *repr); 21 | void _standalone_serv_destroy_instances(AVS_LIST(server_instance_t) *instances); 22 | void _standalone_serv_reset_instance(server_instance_t *serv); 23 | 24 | #endif /* ANJAY_STANDALONE_SERVER_UTILS_H */ 25 | -------------------------------------------------------------------------------- /tests/codegen/input/execute.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | Test object 13 | Test description 14 | 12345 15 | urn:avs:test:12345 16 | Single 17 | Optional 18 | 19 | 20 | Execute 21 | E 22 | Single 23 | Mandatory 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/codegen/input/multiple-object.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | Test object 13 | Test description 14 | 12345 15 | urn:avs:test:12345 16 | Multiple 17 | Optional 18 | 19 | 20 | Integer 21 | R 22 | Single 23 | Mandatory 24 | Integer 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/codegen/input/sanitization.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 1-this?begins.with-a digit and has some special characters 13 | Test description 14 | 12345 15 | urn:avs:test:12345 16 | Single 17 | Optional 18 | 19 | 20 | Execute 21 | E 22 | Single 23 | Mandatory 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/core/bootstrap_mock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef BOOTSTRAP_MOCK_H 11 | #define BOOTSTRAP_MOCK_H 12 | 13 | #include 14 | 15 | AVS_UNIT_MOCK_CREATE(_anjay_notify_perform_without_servers) 16 | #define _anjay_notify_perform_without_servers(...) \ 17 | AVS_UNIT_MOCK_WRAPPER(_anjay_notify_perform_without_servers)(__VA_ARGS__) 18 | 19 | AVS_UNIT_MOCK_CREATE(_anjay_dm_call_instance_remove) 20 | #define _anjay_dm_call_instance_remove(...) \ 21 | AVS_UNIT_MOCK_WRAPPER(_anjay_dm_call_instance_remove)(__VA_ARGS__) 22 | 23 | #endif /* BOOTSTRAP_MOCK_H */ 24 | -------------------------------------------------------------------------------- /tests/core/coap/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include "utils.h" 17 | 18 | static uint64_t GLOBAL_TOKEN_VALUE; 19 | 20 | void reset_token_generator(void) { 21 | GLOBAL_TOKEN_VALUE = 0; 22 | } 23 | 24 | avs_error_t _avs_coap_ctx_generate_token(avs_coap_ctx_t *ctx, 25 | avs_coap_token_t *out_token); 26 | 27 | avs_error_t _avs_coap_ctx_generate_token(avs_coap_ctx_t *ctx, 28 | avs_coap_token_t *out_token) { 29 | (void) ctx; 30 | *out_token = nth_token(GLOBAL_TOKEN_VALUE++); 31 | return AVS_OK; 32 | } 33 | 34 | avs_coap_token_t nth_token(uint64_t k) { 35 | union { 36 | uint8_t bytes[sizeof(uint64_t)]; 37 | uint64_t value; 38 | } v; 39 | v.value = avs_convert_be64(k); 40 | 41 | avs_coap_token_t token; 42 | token.size = sizeof(v.bytes); 43 | memcpy(token.bytes, v.bytes, sizeof(v.bytes)); 44 | return token; 45 | } 46 | 47 | avs_coap_token_t current_token(void) { 48 | return nth_token(GLOBAL_TOKEN_VALUE); 49 | } 50 | -------------------------------------------------------------------------------- /tests/core/io/bigdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_IO_TEST_BIGDATA_H 11 | #define ANJAY_IO_TEST_BIGDATA_H 12 | 13 | // clang-format off 14 | #define DATA10B "0123456789" 15 | #define DATA100B \ 16 | DATA10B DATA10B DATA10B DATA10B DATA10B \ 17 | DATA10B DATA10B DATA10B DATA10B DATA10B 18 | #define DATA1kB \ 19 | DATA100B DATA100B DATA100B DATA100B DATA100B \ 20 | DATA100B DATA100B DATA100B DATA100B DATA100B 21 | #define DATA10kB \ 22 | DATA1kB DATA1kB DATA1kB DATA1kB DATA1kB \ 23 | DATA1kB DATA1kB DATA1kB DATA1kB DATA1kB 24 | #define DATA100kB \ 25 | DATA10kB DATA10kB DATA10kB DATA10kB DATA10kB \ 26 | DATA10kB DATA10kB DATA10kB DATA10kB DATA10kB 27 | #define DATA1MB \ 28 | DATA100kB DATA100kB DATA100kB DATA100kB DATA100kB \ 29 | DATA100kB DATA100kB DATA100kB DATA100kB DATA100kB 30 | #define DATA10MB \ 31 | DATA1MB DATA1MB DATA1MB DATA1MB DATA1MB \ 32 | DATA1MB DATA1MB DATA1MB DATA1MB DATA1MB 33 | #define DATA20MB DATA10MB DATA10MB 34 | // clang-format on 35 | 36 | #endif /* ANJAY_IO_TEST_BIGDATA_H */ 37 | -------------------------------------------------------------------------------- /tests/core/observe/observe_mock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_TEST_OBSERVE_MOCK_H 11 | #define ANJAY_TEST_OBSERVE_MOCK_H 12 | 13 | #include 14 | 15 | AVS_UNIT_MOCK_CREATE(_anjay_dm_find_object_by_oid) 16 | #define _anjay_dm_find_object_by_oid(...) \ 17 | AVS_UNIT_MOCK_WRAPPER(_anjay_dm_find_object_by_oid)(__VA_ARGS__) 18 | 19 | AVS_UNIT_MOCK_CREATE(send_initial_response) 20 | #define send_initial_response(...) \ 21 | AVS_UNIT_MOCK_WRAPPER(send_initial_response)(__VA_ARGS__) 22 | 23 | #endif /* ANJAY_TEST_OBSERVE_MOCK_H */ 24 | -------------------------------------------------------------------------------- /tests/core/socket_mock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #include "socket_mock.h" 13 | 14 | AVS_UNIT_MOCK_DEFINE(avs_net_tcp_socket_create) 15 | AVS_UNIT_MOCK_DEFINE(avs_net_udp_socket_create) 16 | AVS_UNIT_MOCK_DEFINE(avs_net_ssl_socket_create) 17 | AVS_UNIT_MOCK_DEFINE(avs_net_dtls_socket_create) 18 | -------------------------------------------------------------------------------- /tests/core/socket_mock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef SOCKET_MOCK_H 11 | #define SOCKET_MOCK_H 12 | 13 | #include 14 | #include 15 | 16 | extern AVS_UNIT_MOCK_DECLARE(avs_net_tcp_socket_create); 17 | #define avs_net_tcp_socket_create(...) \ 18 | AVS_UNIT_MOCK_WRAPPER(avs_net_tcp_socket_create)(__VA_ARGS__) 19 | 20 | extern AVS_UNIT_MOCK_DECLARE(avs_net_udp_socket_create); 21 | #define avs_net_udp_socket_create(...) \ 22 | AVS_UNIT_MOCK_WRAPPER(avs_net_udp_socket_create)(__VA_ARGS__) 23 | 24 | extern AVS_UNIT_MOCK_DECLARE(avs_net_ssl_socket_create); 25 | #define avs_net_ssl_socket_create(...) \ 26 | AVS_UNIT_MOCK_WRAPPER(avs_net_ssl_socket_create)(__VA_ARGS__) 27 | 28 | extern AVS_UNIT_MOCK_DECLARE(avs_net_dtls_socket_create); 29 | #define avs_net_dtls_socket_create(...) \ 30 | AVS_UNIT_MOCK_WRAPPER(avs_net_dtls_socket_create)(__VA_ARGS__) 31 | 32 | #endif /* SOCKET_MOCK_H */ 33 | -------------------------------------------------------------------------------- /tests/fuzz/test_cases/cbor_decoder/boring: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/Anjay/c7df239f478244885b23b76b115fa5b0fb090336/tests/fuzz/test_cases/cbor_decoder/boring -------------------------------------------------------------------------------- /tests/fuzz/test_cases/cbor_decoder/invalid: -------------------------------------------------------------------------------- 1 | x -n 2 | -------------------------------------------------------------------------------- /tests/fuzz/test_cases/coap_stream/valid_coap_msg: -------------------------------------------------------------------------------- 1 | ` -------------------------------------------------------------------------------- /tests/fuzz/test_cases/coap_stream_request/basic: -------------------------------------------------------------------------------- 1 | _ -------------------------------------------------------------------------------- /tests/fuzz/test_cases/coap_stream_response/basic: -------------------------------------------------------------------------------- 1 | _ -------------------------------------------------------------------------------- /tests/integration/framework/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m/coap/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from . import utils 11 | 12 | from .code import Code 13 | from .content_format import ContentFormat 14 | from .option import Option, ContentFormatOption, AcceptOption 15 | from .packet import Packet 16 | from .server import Server, TlsServer, DtlsServer 17 | from .type import Type 18 | 19 | __all__ = [ 20 | 'utils', 21 | 'Code', 22 | 'ContentFormat', 23 | 'Option', 'ContentFormatOption', 'AcceptOption', 24 | 'Packet', 25 | 'Server', 'TlsServer', 'DtlsServer', 26 | 'Type' 27 | ] 28 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m/coap/transport.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | import enum 11 | 12 | class Transport(enum.Enum): 13 | TCP = 0 14 | UDP = 1 15 | 16 | def __str__(self): 17 | if self == Transport.TCP: 18 | return 'tcp' 19 | else: 20 | return 'udp' 21 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m/coap/type.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | 11 | class Type(object): 12 | @staticmethod 13 | def powercmd_parse(text): 14 | from powercmd.utils import match_instance 15 | 16 | return match_instance(Type, text) 17 | 18 | @staticmethod 19 | def powercmd_complete(text): 20 | from powercmd.utils import get_available_instance_names 21 | from powercmd.match_string import match_string 22 | 23 | possible = get_available_instance_names(Type) 24 | return match_string(text, possible) 25 | 26 | def __init__(self, value): 27 | if value not in range(4): 28 | raise ValueError("invalid CoAP packet type: %d" % value) 29 | 30 | self.value = value 31 | 32 | def __str__(self): 33 | return { 34 | 0: 'CONFIRMABLE', 35 | 1: 'NON_CONFIRMABLE', 36 | 2: 'ACKNOWLEDGEMENT', 37 | 3: 'RESET' 38 | }[self.value] 39 | 40 | def __repr__(self): 41 | return 'coap.Type.%s' % str(self) 42 | 43 | def __eq__(self, other): 44 | return (type(self) is type(other) 45 | and self.value == other.value) 46 | 47 | 48 | Type.CONFIRMABLE = Type(0) 49 | Type.NON_CONFIRMABLE = Type(1) 50 | Type.ACKNOWLEDGEMENT = Type(2) 51 | Type.RESET = Type(3) 52 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m/coap/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | import string 11 | 12 | 13 | def hexlify(s): 14 | return ''.join('\\x%02x' % c for c in s) 15 | 16 | 17 | def hexlify_nonprintable(s): 18 | return ''.join(chr(c) if chr(c) in string.printable else ('\\x%02x' % c) for c in s) 19 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m/server.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from . import coap 11 | from .messages import get_lwm2m_msg 12 | 13 | 14 | class Lwm2mServer: 15 | def __init__(self, coap_server=None): 16 | super().__setattr__('_coap_server', coap_server or coap.Server()) 17 | self.set_timeout(timeout_s=15) 18 | 19 | def send(self, pkt: coap.Packet): 20 | if not isinstance(pkt, coap.Packet): 21 | raise ValueError(('pkt is %r, expected coap.Packet; did you forget additional parentheses? ' + 22 | 'valid syntax: Lwm2mSomething.matching(pkt)()') % (type(pkt),)) 23 | self._coap_server.send(pkt.fill_placeholders()) 24 | 25 | def recv(self, timeout_s: float = -1, deadline=None, filter=None, peek=False): 26 | lwm2m_filter = None 27 | if filter is not None: 28 | lwm2m_filter = lambda pkt: filter(get_lwm2m_msg(pkt)) 29 | pkt = self._coap_server.recv(timeout_s=timeout_s, deadline=deadline, filter=lwm2m_filter, 30 | peek=peek) 31 | return get_lwm2m_msg(pkt) 32 | 33 | def __getattr__(self, name): 34 | return getattr(self._coap_server, name) 35 | 36 | def __setattr__(self, name, value): 37 | return setattr(self._coap_server, name, value) 38 | 39 | def __delattr__(self, name): 40 | return delattr(self._coap_server, name) 41 | -------------------------------------------------------------------------------- /tests/integration/framework/lwm2m_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from . import test_suite 11 | from .test_utils import * 12 | 13 | from . import lwm2m 14 | from .lwm2m import coap 15 | from .lwm2m.server import Lwm2mServer 16 | from .lwm2m.messages import * 17 | -------------------------------------------------------------------------------- /tests/integration/framework/nsh-lwm2m/pymbedtls/src/common.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #include 13 | 14 | #include "common.hpp" 15 | 16 | using namespace std; 17 | 18 | namespace ssl { 19 | namespace detail { 20 | string to_hex(int n) { 21 | if (n < 0) { 22 | return "-" + to_hex(-n); 23 | } else { 24 | stringstream ss; 25 | ss << "0x" << hex << n; 26 | return ss.str(); 27 | } 28 | } 29 | 30 | } // namespace detail 31 | 32 | string mbedtls_error_string(int error_code) { 33 | char buf[1024]; 34 | mbedtls_strerror(error_code, buf, sizeof(buf)); 35 | return string(buf) + " (" + detail::to_hex(error_code) + ")"; 36 | } 37 | 38 | } // namespace ssl 39 | -------------------------------------------------------------------------------- /tests/integration/framework/nsh-lwm2m/pymbedtls/src/context.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #if defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_PSA_CRYPTO_C) 16 | # include 17 | #endif // defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_PSA_CRYPTO_C) 18 | 19 | #include "context.hpp" 20 | 21 | using namespace std; 22 | 23 | namespace ssl { 24 | 25 | Context::Context(std::shared_ptr security, 26 | bool debug, 27 | std::string connection_id) 28 | : security_(security), debug_(debug), connection_id_(connection_id) { 29 | #if defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_PSA_CRYPTO_C) 30 | if (psa_crypto_init() != PSA_SUCCESS) { 31 | throw runtime_error("psa_crypto_init() failed"); 32 | } 33 | #endif // defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_PSA_CRYPTO_C) 34 | 35 | memset(&session_cache_, 0, sizeof(session_cache_)); 36 | mbedtls_ssl_cache_init(&session_cache_); 37 | 38 | #if !defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) 39 | if (connection_id.size() > 0) { 40 | throw runtime_error( 41 | "connection_id is not supported in this version of pymbedtls"); 42 | } 43 | #endif // !MBEDTLS_SSL_DTLS_CONNECTION_ID 44 | } 45 | 46 | Context::~Context() { 47 | mbedtls_ssl_cache_free(&session_cache_); 48 | } 49 | 50 | } // namespace ssl 51 | -------------------------------------------------------------------------------- /tests/integration/framework/nsh-lwm2m/pymbedtls/src/context.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef PYMBEDTLS_CONTEXT_HPP 11 | #define PYMBEDTLS_CONTEXT_HPP 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace ssl { 19 | 20 | class SecurityInfo; 21 | 22 | class Context { 23 | mbedtls_ssl_cache_context session_cache_; 24 | std::shared_ptr security_; 25 | bool debug_; 26 | std::string connection_id_; 27 | 28 | public: 29 | Context(std::shared_ptr security, 30 | bool debug, 31 | std::string connection_id); 32 | ~Context(); 33 | 34 | mbedtls_ssl_cache_context *session_cache() { 35 | return &session_cache_; 36 | } 37 | 38 | std::shared_ptr security() const { 39 | return security_; 40 | } 41 | 42 | std::string connection_id() const { 43 | return connection_id_; 44 | } 45 | 46 | bool debug() const { 47 | return debug_; 48 | } 49 | }; 50 | 51 | } // namespace ssl 52 | 53 | #endif // PYMBEDTLS_CONTEXT_HPP 54 | -------------------------------------------------------------------------------- /tests/integration/framework/nsh-lwm2m/pymbedtls/src/pybind11_interop.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef PYMBEDTLS_PYBIND11_INTEROP 11 | #define PYMBEDTLS_PYBIND11_INTEROP 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace py = pybind11; 19 | 20 | template 21 | typename std::enable_if::value, Result>::type 22 | call_method(py::object py_object, const char *name, Args &&... args) { 23 | auto f = py_object.attr(name); 24 | auto result = f(std::forward(args)...); 25 | return py::cast(result); 26 | } 27 | 28 | template 29 | typename std::enable_if::value>::type 30 | call_method(py::object py_object, const char *name, Args &&... args) { 31 | auto f = py_object.attr(name); 32 | (void) f(std::forward(args)...); 33 | } 34 | 35 | #endif // PYMBEDTLS_PYBIND11_INTEROP 36 | -------------------------------------------------------------------------------- /tests/integration/run_tests.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | 11 | COMMAND="@CMAKE_CTEST_COMMAND@"; 12 | RERUNS=@TEST_RERUNS@; 13 | 14 | CREATE_XLSX_REPORTS="python3 @CMAKE_SOURCE_DIR@/tests/integration/framework/create_xlsx_test_report.py \ 15 | -d @CMAKE_BINARY_DIR@/output/test/integration/log/test/" 16 | 17 | if [ "$1" == "-h" ]; then 18 | COMMAND="@CMAKE_CTEST_COMMAND@ -R hsm"; 19 | fi 20 | 21 | if [ $RERUNS == 0 ]; then 22 | $COMMAND -j@NPROC@ --output-on-failure && $CREATE_XLSX_REPORTS && exit 0; 23 | else 24 | $COMMAND -j@NPROC@ && $CREATE_XLSX_REPORTS && exit 0; 25 | fi 26 | 27 | if [ $RERUNS -gt 0 ]; then 28 | if [ $RERUNS -gt 1 ]; then 29 | for i in $(seq 1 $(($RERUNS-1))); do 30 | $COMMAND --rerun-failed && $CREATE_XLSX_REPORTS && exit 0; 31 | done; 32 | fi 33 | $COMMAND --rerun-failed --output-on-failure && $CREATE_XLSX_REPORTS && exit 0; 34 | fi 35 | 36 | $CREATE_XLSX_REPORTS 37 | 38 | exit 1 39 | -------------------------------------------------------------------------------- /tests/integration/suites/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/integration/suites/default/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/integration/suites/default/bootstrap_factory.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | import socket 11 | 12 | from framework.lwm2m_test import * 13 | 14 | 15 | class BootstrapFactoryTest(test_suite.Lwm2mTest, test_suite.SingleServerAccessor): 16 | def setUp(self): 17 | extra_args = ['--bootstrap-timeout', '5'] 18 | self.setup_demo_with_servers(servers=1, 19 | bootstrap_server=True, 20 | extra_cmdline_args=extra_args) 21 | 22 | def tearDown(self): 23 | self.teardown_demo_with_servers() 24 | 25 | def runTest(self): 26 | self.assertEqual(2, self.get_socket_count()) 27 | 28 | # no message on the bootstrap socket - already bootstrapped 29 | with self.assertRaises(socket.timeout): 30 | print(self.bootstrap_server.recv(timeout_s=2)) 31 | 32 | # no changes 33 | self.assertEqual(2, self.get_socket_count()) 34 | 35 | # still no message 36 | with self.assertRaises(socket.timeout): 37 | print(self.bootstrap_server.recv(timeout_s=4)) 38 | 39 | # Bootstrap Finish did not arrive, so Bootstrap Server timeout is not applicable here - no change 40 | self.assertEqual(2, self.get_socket_count()) 41 | 42 | # Registration Update shall not include changes 43 | self.communicate('send-update') 44 | self.assertDemoUpdatesRegistration() 45 | 46 | self.assertEqual(2, self.get_socket_count()) 47 | -------------------------------------------------------------------------------- /tests/integration/suites/default/critical_opts.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from framework.lwm2m_test import * 11 | 12 | import unittest 13 | 14 | class CriticalOptsTest(test_suite.Lwm2mSingleServerTest): 15 | def runTest(self): 16 | # This should result in 4.02 Bad Option response. 17 | pkt = Lwm2mRead(ResPath.Server[1].ShortServerID, options=[coap.Option.IF_NONE_MATCH]) 18 | self.serv.send(pkt) 19 | self.assertMsgEqual(Lwm2mErrorResponse.matching(pkt)(code=coap.Code.RES_BAD_OPTION), 20 | self.serv.recv()) 21 | 22 | # And this shuld work. 23 | pkt = Lwm2mRead(ResPath.Server[1].ShortServerID) 24 | self.serv.send(pkt) 25 | self.assertMsgEqual(Lwm2mContent.matching(pkt)(), 26 | self.serv.recv()) 27 | -------------------------------------------------------------------------------- /tests/integration/suites/default/modify_servers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | import socket 11 | 12 | from framework.lwm2m_test import * 13 | 14 | 15 | class ModifyServersTest(test_suite.Lwm2mTest): 16 | def setUp(self): 17 | self.setup_demo_with_servers(servers=2, auto_register=False) 18 | 19 | def tearDown(self): 20 | self.coap_ping(self.servers[0]) 21 | self.coap_ping(self.servers[1]) 22 | self.request_demo_shutdown() 23 | self.assertDemoDeregisters(self.servers[0], path='/rd/demo') 24 | self.assertDemoDeregisters(self.servers[1], path='/rd/server3') 25 | self.teardown_demo_with_servers(auto_deregister=False) 26 | 27 | def runTest(self): 28 | self.assertDemoRegisters(server=self.servers[0], location='/rd/demo') 29 | self.assertDemoRegisters(server=self.servers[1], location='/rd/server2') 30 | 31 | # remove second server 32 | self.communicate("trim-servers 1") 33 | self.assertDemoDeregisters(server=self.servers[1], path='/rd/server2') 34 | self.assertDemoUpdatesRegistration(server=self.servers[0], content=ANY) 35 | 36 | # add another server 37 | self.communicate("add-server coap://127.0.0.1:%d" % self.servers[1].get_listen_port()) 38 | self.assertDemoUpdatesRegistration(server=self.servers[0], content=ANY) 39 | self.assertDemoRegisters(server=self.servers[1], location='/rd/server3') 40 | -------------------------------------------------------------------------------- /tests/integration/suites/default/reboot.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from framework.lwm2m_test import * 11 | 12 | 13 | class RebootSendsResponseTest(test_suite.Lwm2mSingleServerTest): 14 | def _get_valgrind_args(self): 15 | # Reboot cannot be performed when demo is run under valgrind 16 | return [] 17 | 18 | def runTest(self): 19 | # should send a response before rebooting 20 | req = Lwm2mExecute(ResPath.Device.Reboot) 21 | self.serv.send(req) 22 | self.assertMsgEqual(Lwm2mChanged.matching(req)(), self.serv.recv()) 23 | 24 | # should register after rebooting 25 | self.serv.reset() 26 | self.assertDemoRegisters(self.serv) 27 | -------------------------------------------------------------------------------- /tests/integration/suites/default/request_too_large.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | from framework.lwm2m_test import * 11 | 12 | 13 | class RequestTooLarge(test_suite.Lwm2mSingleServerTest): 14 | def setUp(self): 15 | super().setUp(extra_cmdline_args=['-I', '1000']) 16 | 17 | def runTest(self): 18 | req = Lwm2mWrite(ResPath.FirmwareUpdate.Package, random_stuff(1200)) 19 | self.serv.send(req) 20 | res = self.serv.recv() 21 | self.assertMsgEqual( 22 | Lwm2mErrorResponse.matching(req)(coap.Code.RES_REQUEST_ENTITY_TOO_LARGE), res) 23 | -------------------------------------------------------------------------------- /tests/integration/suites/sensitive/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/integration/suites/testfest/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/integration/suites/testfest/dm/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | -------------------------------------------------------------------------------- /tests/utils/coap/socket.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #include 11 | 12 | #include "tests/utils/coap/socket.h" 13 | 14 | void _anjay_mocksock_create(avs_net_socket_t **mocksock, 15 | int inner_mtu, 16 | int mtu) { 17 | avs_unit_mocksock_create_datagram(mocksock); 18 | avs_unit_mocksock_enable_recv_timeout_getsetopt( 19 | *mocksock, avs_time_duration_from_scalar(30, AVS_TIME_S)); 20 | if (inner_mtu >= 0) { 21 | avs_unit_mocksock_enable_inner_mtu_getopt(*mocksock, inner_mtu); 22 | } 23 | if (mtu >= 0) { 24 | avs_unit_mocksock_enable_mtu_getopt(*mocksock, mtu); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/utils/coap/socket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_TEST_COAP_SOCKET_H 11 | #define ANJAY_TEST_COAP_SOCKET_H 12 | 13 | #include 14 | 15 | /** 16 | * NOTE: inner_mtu / mtu may be set to a negative value, in which case 17 | * they are not automatically handled by mocksock_get_opt() 18 | */ 19 | void _anjay_mocksock_create(avs_net_socket_t **mocksock, 20 | int inner_mtu, 21 | int mtu); 22 | 23 | #endif /* ANJAY_TEST_COAP_SOCKET_H */ 24 | -------------------------------------------------------------------------------- /tests/utils/mock_clock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_TEST_MOCK_CLOCK_H 11 | #define ANJAY_TEST_MOCK_CLOCK_H 12 | 13 | #include 14 | 15 | void _anjay_mock_clock_start(const avs_time_monotonic_t t); 16 | void _anjay_mock_clock_reset(const avs_time_monotonic_t t); 17 | void _anjay_mock_clock_advance(const avs_time_duration_t t); 18 | void _anjay_mock_clock_finish(void); 19 | 20 | #endif /* ANJAY_TEST_MOCK_CLOCK_H */ 21 | -------------------------------------------------------------------------------- /tests/utils/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 AVSystem 3 | * AVSystem Anjay LwM2M SDK 4 | * All rights reserved. 5 | * 6 | * Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | * See the attached LICENSE file for details. 8 | */ 9 | 10 | #ifndef ANJAY_TEST_UTILS_H 11 | #define ANJAY_TEST_UTILS_H 12 | 13 | #include 14 | #include 15 | 16 | #define SCOPED_PTR(Type, Deleter) __attribute__((__cleanup__(Deleter))) Type * 17 | 18 | static inline void _anjay_mocksock_expect_stats_zero(avs_net_socket_t *socket) { 19 | avs_unit_mocksock_expect_shutdown(socket); 20 | avs_unit_mocksock_expect_get_opt(socket, AVS_NET_SOCKET_OPT_BYTES_SENT, 21 | (avs_net_socket_opt_value_t) { 22 | .bytes_sent = 0 23 | }); 24 | avs_unit_mocksock_expect_get_opt(socket, 25 | AVS_NET_SOCKET_OPT_BYTES_RECEIVED, 26 | (avs_net_socket_opt_value_t) { 27 | .bytes_received = 0 28 | }); 29 | } 30 | 31 | #endif /* ANJAY_TEST_UTILS_H */ 32 | -------------------------------------------------------------------------------- /tools/ci-psa/README.md: -------------------------------------------------------------------------------- 1 | This Dockerfile is developed to build PSA examples and run PSA tests. 2 | It contains the basic libs needed to build Anjay and additionaly custom build 3 | of mbed TLS with PSA enabled. 4 | 5 | To build the image, you can run the following command from the root of the Anjay 6 | repository: 7 | ```bash 8 | docker build --no-cache -f tools/ci-psa/Dockerfile . 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /tools/ci/rockylinux-9/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | # NOTE: After changing this file, please remember to update the Docker image on 9 | # Docker Hub (for more information, check the help message of 10 | # tools/ci/build-docker-images.sh script). 11 | 12 | FROM rockylinux/rockylinux:9 13 | RUN dnf update -y && \ 14 | dnf install -y --allowerasing python3-pip git openssl-devel zlib-devel \ 15 | python3 python3-devel wget openssl valgrind curl cmake \ 16 | gcc gcc-c++ wireshark-cli which 'dnf-command(config-manager)' 17 | RUN dnf config-manager --set-enabled crb && \ 18 | dnf install -y epel-release && \ 19 | dnf install -y mbedtls-devel 20 | COPY requirements.txt requirements.txt 21 | RUN pip3 install -r requirements.txt 22 | -------------------------------------------------------------------------------- /tools/ci/ubuntu-20.04/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | # NOTE: After changing this file, please remember to update the Docker image on 9 | # Docker Hub (for more information, check the help message of 10 | # tools/ci/build-docker-images.sh script). 11 | 12 | FROM ubuntu:20.04 13 | RUN apt-get update && \ 14 | env DEBIAN_FRONTEND=noninteractive \ 15 | apt-get install -y python3-pip git libmbedtls-dev libssl-dev zlib1g-dev \ 16 | python3 libpython3-dev wget valgrind curl cmake build-essential tshark 17 | COPY requirements.txt requirements.txt 18 | RUN pip3 install -r requirements.txt 19 | # Solve issues with EPERM when running dumpcap 20 | RUN setcap '' $(which dumpcap) 21 | -------------------------------------------------------------------------------- /tools/ci/ubuntu-22.04/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2025 AVSystem 2 | # AVSystem Anjay LwM2M SDK 3 | # All rights reserved. 4 | # 5 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 6 | # See the attached LICENSE file for details. 7 | 8 | # NOTE: After changing this file, please remember to update the Docker image on 9 | # Docker Hub (for more information, check the help message of 10 | # tools/ci/build-docker-images.sh script). 11 | 12 | FROM ubuntu:22.04 13 | RUN apt-get update && \ 14 | env DEBIAN_FRONTEND=noninteractive \ 15 | apt-get install -y python3-pip git libmbedtls-dev libssl-dev zlib1g-dev \ 16 | python3 libpython3-dev wget valgrind curl cmake build-essential tshark 17 | COPY requirements.txt requirements.txt 18 | RUN pip3 install -r requirements.txt 19 | # Solve issues with EPERM when running dumpcap 20 | RUN setcap '' $(which dumpcap) 21 | -------------------------------------------------------------------------------- /tools/conditional_headers_whitelist.json: -------------------------------------------------------------------------------- 1 | { 2 | "": [ 3 | "anjay_init\\.h", 4 | "avsystem/commons/[^.]*\\.h", 5 | "avsystem/coap/[^.]*\\.h", 6 | "anjay/[^.]*\\.h", 7 | "anjay_modules/[^.]*\\.h" 8 | ], 9 | "anjay_core\\.c": [ 10 | "anjay_config_log\\.h" 11 | ], 12 | "anjay_event_loop\\.c": [ 13 | "poll\\.h", 14 | "sys/select\\.h" 15 | ], 16 | "anjay_utils_core\\.h": [ 17 | "stdatomic\\.h" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /tools/generate_doxygen_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | set -euo pipefail 10 | 11 | EXAMPLE_CONFIG="$1" # e.g. example_configs/linux_lwm2m11/anjay/anjay_config.h 12 | INCLUDE_PUBLIC_SRC="$2" # e.g. include_public/ 13 | OUTPUT_ROOT="$3" # e.g. output/doc/doxygen/config/ 14 | 15 | # Absolute paths 16 | EXAMPLE_CONFIG="$(realpath "$EXAMPLE_CONFIG")" 17 | INCLUDE_PUBLIC_SRC="$(realpath "$INCLUDE_PUBLIC_SRC")" 18 | mkdir -p "${OUTPUT_ROOT}" 19 | OUTPUT_ROOT="$(realpath "${OUTPUT_ROOT}")" 20 | 21 | # Destination paths 22 | OUTPUT_INCLUDE="${OUTPUT_ROOT}/include_public" 23 | OUTPUT_CONFIG="${OUTPUT_INCLUDE}/anjay/anjay_config.h" 24 | 25 | # Copy full include_public tree 26 | cp -r "${INCLUDE_PUBLIC_SRC}" "${OUTPUT_ROOT}" 27 | 28 | # Copy example config into place 29 | mkdir -p "$(dirname "${OUTPUT_CONFIG}")" 30 | cp "${EXAMPLE_CONFIG}" "${OUTPUT_CONFIG}" 31 | 32 | # Patch: replace /* #undef X */ → #define X 33 | sed -i -E 's@/\* *#undef +([^ ]+) *\*/@#define \1@g' "${OUTPUT_CONFIG}" 34 | 35 | echo "[generate_doxygen_config.sh] Patched config written to: ${OUTPUT_CONFIG}" 36 | -------------------------------------------------------------------------------- /tools/provisioning-tool/configs/cert_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "countryName": "PL", 3 | "stateOrProvinceName": "Malopolska", 4 | "localityName": "Cracow", 5 | "organizationName": "AVSystem", 6 | "organizationUnitName": "Embedded", 7 | "serialNumber": 1, 8 | "validityOffsetInSeconds": 220752000, 9 | "digest": "sha512", 10 | "ellipticCurve": "secp384r1" 11 | } 12 | -------------------------------------------------------------------------------- /tools/provisioning-tool/configs/endpoint_cfg: -------------------------------------------------------------------------------- 1 | { 2 | OID.Security: { 3 | 1: { 4 | RID.Security.ServerURI : 'coaps://eu.iot.avsystem.cloud:5684', 5 | RID.Security.Bootstrap : False, 6 | RID.Security.Mode : 0, # 0: PSK, 2: Cert, 3: NoSec 7 | RID.Security.PKOrIdentity : b'reg-test-psk-identity', 8 | RID.Security.SecretKey : b'3x@mpl3P5K53cr3tK3y', 9 | RID.Security.ShortServerID : 1 10 | }, 11 | }, 12 | 13 | OID.Server: { 14 | 1: { 15 | RID.Server.ShortServerID : 1, 16 | RID.Server.Lifetime : 86400, 17 | RID.Server.NotificationStoring : False, 18 | RID.Server.Binding : 'U' 19 | }, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tools/provisioning-tool/configs/lwm2m_server.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://eu.iot.avsystem.cloud", 3 | "port": 8087, 4 | "domain": "/embedded/" 5 | } 6 | -------------------------------------------------------------------------------- /tools/provisioning-tool/factory_prov/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright 2017-2025 AVSystem 3 | # AVSystem Anjay LwM2M SDK 4 | # All rights reserved. 5 | # 6 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 7 | # See the attached LICENSE file for details. 8 | 9 | import os 10 | import sys 11 | 12 | sys.path = [os.path.join( 13 | os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))), 14 | 'tests', 'integration')] + sys.path 15 | -------------------------------------------------------------------------------- /tools/symlink-check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2017-2025 AVSystem 4 | # AVSystem Anjay LwM2M SDK 5 | # All rights reserved. 6 | # 7 | # Licensed under AVSystem Anjay LwM2M Client SDK - Non-Commercial License. 8 | # See the attached LICENSE file for details. 9 | 10 | set -e 11 | 12 | EXCEPTIONS=( 13 | "^\./\.git/" 14 | "^\./examples/" 15 | "^\./test_ghactions" 16 | "/doc/sphinx/html/" 17 | ) 18 | 19 | cd "$(dirname "$(dirname "$0")")" 20 | 21 | find . -type l | grep -v -f <(for ((I=0; I<"${#EXCEPTIONS[@]}"; ++I)); do 22 | echo "${EXCEPTIONS[I]}" 23 | done) | { 24 | FOUND=0 25 | while read REPLY; do 26 | echo "$REPLY" 27 | FOUND=1 28 | done 29 | 30 | exit "$FOUND" 31 | } 32 | -------------------------------------------------------------------------------- /valgrind_test.supp: -------------------------------------------------------------------------------- 1 | { 2 | getaddrinfo-globalstate 3 | Memcheck:Leak 4 | fun:malloc 5 | fun:* 6 | fun:* 7 | fun:* 8 | fun:* 9 | fun:gaih_inet* 10 | fun:getaddrinfo 11 | } 12 | { 13 | getaddrinfo-invalidfree 14 | Memcheck:Free 15 | fun:free 16 | fun:__libc_freeres 17 | ... 18 | fun:exit 19 | } 20 | { 21 | ssl_handshake-value 22 | Memcheck:Value8 23 | ... 24 | obj:*/libssl.so.* 25 | fun:ssl_handshake 26 | } 27 | { 28 | ssl_handshake-cond 29 | Memcheck:Cond 30 | ... 31 | obj:*/libssl.so.* 32 | fun:ssl_handshake 33 | } 34 | { 35 | libcrypto-value 36 | Memcheck:Value8 37 | obj:*/libcrypto.so.* 38 | } 39 | { 40 | libssl-value 41 | Memcheck:Value8 42 | obj:*/libssl.so.* 43 | } 44 | { 45 | libcrypto-cond 46 | Memcheck:Cond 47 | obj:*/libcrypto.so.* 48 | } 49 | { 50 | libssl-cond 51 | Memcheck:Cond 52 | obj:*/libssl.so.* 53 | } 54 | { 55 | sendto-argument 56 | Memcheck:Param 57 | socketcall.sendto(msg) 58 | ... 59 | fun:BIO_write 60 | ... 61 | fun:ssl_handshake 62 | } 63 | { 64 | recv 65 | Memcheck:Cond 66 | obj:*/vgpreload_memcheck* 67 | obj:*/libssl.so.* 68 | ... 69 | obj:*/libssl.so.* 70 | fun:receive_ssl 71 | } 72 | { 73 | engine-private-key 74 | Memcheck:Leak 75 | fun:malloc 76 | ... 77 | fun:ENGINE_load_private_key 78 | fun:_avs_crypto_openssl_engine_load_private_key 79 | } 80 | { 81 | engine-cert 82 | Memcheck:Leak 83 | fun:malloc 84 | ... 85 | fun:ENGINE_ctrl_cmd 86 | fun:_avs_crypto_openssl_engine_load_certs 87 | } 88 | { 89 | engine-new 90 | Memcheck:Leak 91 | fun:malloc 92 | ... 93 | fun:ENGINE_new 94 | } 95 | --------------------------------------------------------------------------------