├── .dockerignore ├── .editorconfig ├── .gitignore ├── .markdownlint.json ├── .travis.yml ├── CHANGELOG.md ├── CMakeLists.txt ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── LICENSE ├── Makefile ├── README.md ├── VERSION ├── api ├── .gitignore ├── CMakeLists.txt ├── Makefile ├── doc │ ├── Doxyfile │ ├── doxygen-err-filter.sh │ └── template │ │ ├── creator.css │ │ ├── doxygen.css │ │ ├── footer.html │ │ ├── header.html │ │ ├── imgteclogo.png │ │ ├── layout.xml │ │ ├── mainpage.dox │ │ └── tabs.css ├── examples │ ├── CMakeLists.txt │ ├── client-defineset-example.c │ ├── client-definition-iterator-example.c │ ├── client-delete-array-range-example.c │ ├── client-delete-example.c │ ├── client-get-array-example.c │ ├── client-get-contains-path-example.c │ ├── client-get-example.c │ ├── client-set-array-example.c │ ├── client-set-create-example.c │ ├── client-set-example.c │ ├── client-subscribe-to-change-example.c │ ├── client-subscribe-to-execute-example.c │ ├── server-defineset-example.c │ ├── server-delete-object-instance-example.c │ ├── server-event-example.c │ ├── server-execute-arguments-example.c │ ├── server-execute-example.c │ ├── server-list-clients-example.c │ ├── server-observe-example.c │ ├── server-read-example.c │ ├── server-write-create-example.c │ ├── server-write-create-unspecified-instance-example.c │ ├── server-write-example.c │ └── tutorials │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── client-tutorial1.c │ │ ├── client-tutorial2.c │ │ ├── server-tutorial.c │ │ ├── static-client-tutorial1.c │ │ ├── static-client-tutorial2.c │ │ └── static-client-tutorial3.c ├── include │ └── awa │ │ ├── client.h │ │ ├── common.h │ │ ├── error.h │ │ ├── server.h │ │ ├── static.h │ │ └── types.h ├── python │ ├── api.py │ ├── client_low.py │ ├── common.py │ ├── config.py │ ├── ipc.py │ ├── ipc_core.py │ ├── ipc_lwm2m_client.py │ ├── ipc_lwm2m_server.py │ ├── overlord.py │ └── tests │ │ ├── test_ipc_lwm2m_client.py │ │ ├── test_ipc_lwm2m_server.py │ │ └── xml_test_case.py ├── src │ ├── CMakeLists.txt │ ├── arrays.c │ ├── arrays.h │ ├── boolean_array.c │ ├── changeset.c │ ├── changeset.h │ ├── client_define_operation.c │ ├── client_delete_operation.c │ ├── client_iterator.c │ ├── client_iterator.h │ ├── client_notification.c │ ├── client_session.c │ ├── client_session.h │ ├── client_subscribe.c │ ├── client_subscribe.h │ ├── client_subscribe_response.c │ ├── client_subscribe_response.h │ ├── define_common.c │ ├── define_common.h │ ├── define_operation.c │ ├── define_operation.h │ ├── error.c │ ├── error.h │ ├── execute_operation.c │ ├── float_array.c │ ├── get_operation.c │ ├── get_operation.h │ ├── get_response.c │ ├── get_response.h │ ├── integer_array.c │ ├── ipc.c │ ├── ipc.h │ ├── ipc_defs.h │ ├── iterator.c │ ├── iterator.h │ ├── list.c │ ├── list.h │ ├── list_clients_operation.c │ ├── log.c │ ├── log.h │ ├── lwm2m_error.c │ ├── lwm2m_error.h │ ├── map.c │ ├── map.h │ ├── memalloc.h │ ├── objectlink_array.c │ ├── objects_tree.c │ ├── objects_tree.h │ ├── observe_operation.c │ ├── observe_operation.h │ ├── opaque_array.c │ ├── operation_common.c │ ├── operation_common.h │ ├── path.c │ ├── path.h │ ├── path_iterator.c │ ├── path_iterator.h │ ├── path_result.c │ ├── path_result.h │ ├── queue.c │ ├── queue.h │ ├── read_operation.c │ ├── registered_entity_iterator.c │ ├── registered_entity_iterator.h │ ├── response_common.c │ ├── response_common.h │ ├── server_define_operation.c │ ├── server_delete_operation.c │ ├── server_events.c │ ├── server_events.h │ ├── server_notification.c │ ├── server_notification.h │ ├── server_operation.c │ ├── server_operation.h │ ├── server_response.c │ ├── server_response.h │ ├── server_session.c │ ├── server_session.h │ ├── session_common.c │ ├── session_common.h │ ├── set_operation.c │ ├── set_operation.h │ ├── set_write_common.c │ ├── set_write_common.h │ ├── string_array.c │ ├── string_iterator.c │ ├── string_iterator.h │ ├── subscribe_observe_common.c │ ├── subscribe_observe_common.h │ ├── time_array.c │ ├── unsupported.c │ ├── utils.c │ ├── utils.h │ ├── value.c │ ├── value.h │ ├── write_attributes_operation.c │ ├── write_mode.c │ ├── write_mode.h │ └── write_operation.c └── tests │ ├── CMakeLists.txt │ ├── client │ ├── test_client.cc │ ├── test_client_define_defaults.cc │ ├── test_client_define_operation.cc │ ├── test_client_delete_operation.cc │ ├── test_client_iterator.cc │ ├── test_client_objdefs_from_file.cc │ ├── test_client_session.cc │ ├── test_get_operation.cc │ ├── test_set_operation.cc │ └── test_subscribe_operation.cc │ ├── common │ ├── test_array_types.cc │ ├── test_bootstrap.cc │ ├── test_client_server_interaction.cc │ ├── test_daemon.cc │ ├── test_define_common.cc │ ├── test_define_operation.cc │ ├── test_error.cc │ ├── test_ipc.cc │ ├── test_iterator.cc │ ├── test_list.cc │ ├── test_log.cc │ ├── test_lwm2m_error.cc │ ├── test_map.cc │ ├── test_objects_tree.cc │ ├── test_operation_common.cc │ ├── test_path.cc │ ├── test_path_iterator.cc │ ├── test_path_result.cc │ ├── test_queue.cc │ ├── test_response_common.cc │ ├── test_session_common.cc │ ├── test_string_iterator.cc │ ├── test_subscribe_observe_common.cc │ ├── test_utils.cc │ ├── test_value.cc │ └── test_xmltree.cc │ ├── debug.bsc │ ├── gtest.bsc │ ├── object-defs-gtest.xml │ ├── server │ ├── test_changeset.cc │ ├── test_execute_operation.cc │ ├── test_list_clients_operation.cc │ ├── test_observe_operation.cc │ ├── test_read_operation.cc │ ├── test_server.cc │ ├── test_server_define_defaults.cc │ ├── test_server_define_operation.cc │ ├── test_server_delete_operation.cc │ ├── test_server_events.cc │ ├── test_server_notification.cc │ ├── test_server_objdefs_from_file.cc │ ├── test_server_response.cc │ ├── test_server_session.cc │ ├── test_set_write_common.cc │ ├── test_write_attributes_operation.cc │ └── test_write_operation.cc │ ├── static-client │ ├── test_static_api.cc │ ├── test_static_api_create_delete.cc │ ├── test_static_api_get_resource_instance_pointer.cc │ ├── test_static_api_handlers.cc │ └── test_static_api_with_pointer.cc │ └── support │ ├── daemon.cc │ ├── daemon.h │ ├── definition.h │ ├── file_resource.h │ ├── log.cc │ ├── log.h │ ├── main │ ├── Makefile │ ├── main.cc │ ├── main.ggo │ ├── main_cmdline.c │ └── main_cmdline.h │ ├── process.cc │ ├── process.h │ ├── static_api_support.cc │ ├── static_api_support.h │ ├── support.cc │ ├── support.h │ └── xml_support.h ├── ci ├── Dockerfile ├── Dockerfile.ci ├── ci-docker.sh ├── ci.sh ├── cppcheck.suppress ├── jenkins-valgrind.sh ├── jenkins.sh ├── lcov_cobertura.py ├── openwrt-toolchain.cmake ├── requirements.txt ├── update-docs.sh ├── valgrind-docker.sh ├── valgrind.sh └── valgrind.suppress ├── config ├── contiki-flow-NAT64.bsc ├── contiki-sim.bsc ├── contiki.bsc ├── docker.bsc ├── flowcloud.bsc ├── leshan.bsc ├── localhost-secure.bsc ├── localhost.bsc └── objects │ ├── connectivity-monitoring.xml │ ├── connectivity-statistics.xml │ ├── device.xml │ ├── firmware-update.xml │ └── location.xml ├── core ├── CMakeLists.txt ├── src │ ├── CMakeLists.txt │ ├── bootstrap │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── lwm2m_bootstrap.c │ │ ├── lwm2m_bootstrap.h │ │ ├── lwm2m_bootstrap_cert.h │ │ ├── lwm2m_bootstrap_core.c │ │ ├── lwm2m_bootstrap_psk.h │ │ └── lwm2m_core.h │ ├── client │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── Makefile.client │ │ ├── lwm2m_acl_object.c │ │ ├── lwm2m_acl_object.h │ │ ├── lwm2m_bootstrap.c │ │ ├── lwm2m_bootstrap.h │ │ ├── lwm2m_client_cert.h │ │ ├── lwm2m_client_core.c │ │ ├── lwm2m_client_psk.h │ │ ├── lwm2m_core.h │ │ ├── lwm2m_object_tree.c │ │ ├── lwm2m_object_tree.h │ │ ├── lwm2m_registration.c │ │ ├── lwm2m_registration.h │ │ ├── lwm2m_security_object.c │ │ ├── lwm2m_security_object.h │ │ ├── lwm2m_server_object.c │ │ ├── lwm2m_server_object.h │ │ └── lwm2m_static.c │ ├── common │ │ ├── CMakeLists.txt │ │ ├── Makefile.common │ │ ├── coap_abstraction.h │ │ ├── coap_abstraction_erbium.c │ │ ├── coap_abstraction_libcoap.c │ │ ├── dtls_abstraction.h │ │ ├── dtls_abstraction_cyassl.c │ │ ├── dtls_abstraction_dummy.c │ │ ├── dtls_abstraction_gnutls.c │ │ ├── dtls_abstraction_mbedTLS.c │ │ ├── dtls_abstraction_tinydtls.c │ │ ├── lwm2m_attributes.c │ │ ├── lwm2m_attributes.h │ │ ├── lwm2m_bootstrap_config.c │ │ ├── lwm2m_bootstrap_config.h │ │ ├── lwm2m_context.h │ │ ├── lwm2m_debug.c │ │ ├── lwm2m_debug.h │ │ ├── lwm2m_definition.c │ │ ├── lwm2m_definition.h │ │ ├── lwm2m_endpoints.c │ │ ├── lwm2m_endpoints.h │ │ ├── lwm2m_json.c │ │ ├── lwm2m_json.h │ │ ├── lwm2m_limits.h │ │ ├── lwm2m_list.c │ │ ├── lwm2m_list.h │ │ ├── lwm2m_object_defs.h │ │ ├── lwm2m_object_store.c │ │ ├── lwm2m_object_store.h │ │ ├── lwm2m_objects.h │ │ ├── lwm2m_observers.c │ │ ├── lwm2m_observers.h │ │ ├── lwm2m_opaque.c │ │ ├── lwm2m_opaque.h │ │ ├── lwm2m_plaintext.c │ │ ├── lwm2m_plaintext.h │ │ ├── lwm2m_prettyprint.c │ │ ├── lwm2m_prettyprint.h │ │ ├── lwm2m_request_origin.h │ │ ├── lwm2m_result.c │ │ ├── lwm2m_result.h │ │ ├── lwm2m_serdes.c │ │ ├── lwm2m_serdes.h │ │ ├── lwm2m_tlv.c │ │ ├── lwm2m_tlv.h │ │ ├── lwm2m_tree_builder.c │ │ ├── lwm2m_tree_builder.h │ │ ├── lwm2m_tree_node.c │ │ ├── lwm2m_tree_node.h │ │ ├── lwm2m_types.c │ │ ├── lwm2m_types.h │ │ ├── lwm2m_util.c │ │ ├── lwm2m_util.h │ │ ├── lwm2m_util_contiki.c │ │ ├── lwm2m_util_linux.c │ │ ├── lwm2m_util_posix.c │ │ ├── lwm2m_util_riot.c │ │ ├── network_abstraction.h │ │ ├── network_abstraction_contiki.c │ │ ├── network_abstraction_posix.c │ │ └── network_abstraction_posix.h │ ├── erbium │ │ ├── CMakeLists.txt │ │ ├── Makefile.erbium │ │ ├── er-coap-block1.c │ │ ├── er-coap-block1.h │ │ ├── er-coap-conf.h │ │ ├── er-coap-constants.h │ │ ├── er-coap-engine.c │ │ ├── er-coap-engine.h │ │ ├── er-coap-separate.c │ │ ├── er-coap-separate.h │ │ ├── er-coap-transactions.c │ │ ├── er-coap-transactions.h │ │ ├── er-coap.c │ │ ├── er-coap.h │ │ └── er-resource.h │ └── server │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── lwm2m_core.h │ │ ├── lwm2m_object_defs.c │ │ ├── lwm2m_registration.c │ │ ├── lwm2m_registration.h │ │ ├── lwm2m_server_cert.h │ │ ├── lwm2m_server_core.c │ │ └── lwm2m_server_psk.h └── tests │ ├── CMakeLists.txt │ ├── lwm2m_device_object.c │ ├── lwm2m_device_object.h │ ├── main.cc │ ├── test_definition_registry.cc │ ├── test_json.cc │ ├── test_lwm2m_core.cc │ ├── test_lwm2m_tree.cc │ ├── test_lwm2m_tree_builder.cc │ ├── test_lwm2m_types.cc │ ├── test_object_store_interface.cc │ ├── test_object_tree.cc │ ├── test_plaintext.cc │ ├── test_prettyprint.cc │ ├── test_template.cc │ ├── test_tlv.cc │ ├── unit_support.cc │ └── unit_support.h ├── daemon ├── CMakeLists.txt ├── src │ ├── CMakeLists.txt │ ├── bootstrap │ │ ├── CMakeLists.txt │ │ ├── awa_bootstrapd.ggo │ │ ├── awa_bootstrapd_cmdline.c │ │ ├── awa_bootstrapd_cmdline.h │ │ └── lwm2m_bootstrap_server.c │ ├── client │ │ ├── CMakeLists.txt │ │ ├── awa_clientd.ggo │ │ ├── awa_clientd_cmdline.c │ │ ├── awa_clientd_cmdline.h │ │ ├── lwm2m_client.c │ │ ├── lwm2m_client_xml_handlers.c │ │ └── lwm2m_client_xml_handlers.h │ ├── common │ │ ├── ipc_session.c │ │ ├── ipc_session.h │ │ ├── lwm2m_events.c │ │ ├── lwm2m_events.h │ │ ├── lwm2m_ipc.c │ │ ├── lwm2m_ipc.h │ │ ├── lwm2m_xml_interface.c │ │ ├── lwm2m_xml_interface.h │ │ ├── lwm2m_xml_serdes.c │ │ ├── lwm2m_xml_serdes.h │ │ ├── objdefs.c │ │ ├── objdefs.h │ │ ├── xml.c │ │ └── xml.h │ └── server │ │ ├── CMakeLists.txt │ │ ├── awa_serverd.ggo │ │ ├── awa_serverd_cmdline.c │ │ ├── awa_serverd_cmdline.h │ │ ├── lwm2m_server.c │ │ ├── lwm2m_server_xml_events.c │ │ ├── lwm2m_server_xml_events.h │ │ ├── lwm2m_server_xml_handlers.c │ │ ├── lwm2m_server_xml_handlers.h │ │ ├── lwm2m_server_xml_registered_entity_tree.c │ │ └── lwm2m_server_xml_registered_entity_tree.h └── tests │ ├── CMakeLists.txt │ ├── main.cc │ └── test_xml.cc ├── doc ├── 3rdparty.md ├── Awa_Static_API.md ├── coding_style.md ├── developer_guide.md ├── docker.md ├── example_api_list.md ├── example_app_api.md ├── example_app_static_api.md ├── images │ ├── Awa LightweightM2M document map.png │ ├── Awa_LWM2M_application_overview_constrained_device.png │ ├── Awa_LWM2M_bootstrap_server-interfaces.png │ ├── Awa_LWM2M_server_interfaces.png │ ├── Awa_application_overview-gateway_indicated.png │ ├── Awa_application_overview.png │ ├── Awa_client_API_structure.png │ ├── Awa_client_tutorial.png │ ├── Awa_client_tutorial_application_positioning.png │ ├── Awa_client_tutorial_application_positioning_static_api.png │ ├── Awa_client_tutorial_object_description.png │ ├── Awa_client_tutorial_static_api.png │ ├── Awa_static_API_constrained_device.png │ ├── FlowM2M_application_overview_constrained_device.png │ ├── LWM2M_object_referencing.png │ ├── awa_client_interfaces.png │ ├── client-tutorial.png │ ├── img.png │ ├── pointer_mode_sparse_resource_distribution.png │ ├── pointer_mode_uniform_resource_distribution.png │ └── server-tutorial.png ├── ipc.md ├── lwm2m_overview.md ├── object_definition_files.md ├── rebasing_info.md ├── starters_guide.md ├── testing.md └── userguide.md ├── lib ├── CMakeLists.txt ├── b64 │ ├── CMakeLists.txt │ ├── Makefile.b64 │ ├── b64.c │ └── b64.h ├── gtest │ └── CMakeLists.txt ├── hmac │ ├── CMakeLists.txt │ ├── Makefile.hmac │ ├── hmac.c │ └── hmac.h ├── jsmn │ ├── CMakeLists.txt │ ├── CMakeLists.txt.in │ └── apply_patches ├── libcoap │ ├── CMakeLists.txt │ ├── apply_patches │ └── patches │ │ ├── 001-libcoap.cmake.patch │ │ └── 002-libcoap.coap_io.patch ├── tinydtls │ ├── CMakeLists.txt │ ├── apply_patches │ └── patches │ │ ├── 001-tinydtls.cmake.patch │ │ ├── 002-tinydtls.h.patch │ │ ├── 003-dtls_config.h.patch │ │ ├── 004-psk-length.patch │ │ └── 005-dtls-max-buf.patch └── xml │ ├── CMakeLists.txt │ ├── Makefile │ ├── Makefile.xml │ ├── xmlparser.c │ ├── xmlparser.h │ ├── xmltree.c │ └── xmltree.h ├── systemd ├── etc │ └── awa │ │ └── awa_serverd.bsc └── lib │ └── systemd │ └── system │ ├── awa_bootstrapd.service │ ├── awa_clientd.service │ └── awa_serverd.service └── tools ├── .gitignore ├── CMakeLists.txt ├── Makefile ├── awa-client-define-base.ggo ├── awa-client-define.c ├── awa-client-define_cmdline.c ├── awa-client-define_cmdline.h ├── awa-client-delete.c ├── awa-client-delete.ggo ├── awa-client-delete_cmdline.c ├── awa-client-delete_cmdline.h ├── awa-client-explore.c ├── awa-client-explore.ggo ├── awa-client-explore_cmdline.c ├── awa-client-explore_cmdline.h ├── awa-client-get.c ├── awa-client-get.ggo ├── awa-client-get_cmdline.c ├── awa-client-get_cmdline.h ├── awa-client-set.c ├── awa-client-set.ggo ├── awa-client-set_cmdline.c ├── awa-client-set_cmdline.h ├── awa-client-subscribe.c ├── awa-client-subscribe.ggo ├── awa-client-subscribe_cmdline.c ├── awa-client-subscribe_cmdline.h ├── awa-server-define-base.ggo ├── awa-server-define.c ├── awa-server-define_cmdline.c ├── awa-server-define_cmdline.h ├── awa-server-delete.c ├── awa-server-delete.ggo ├── awa-server-delete_cmdline.c ├── awa-server-delete_cmdline.h ├── awa-server-execute.c ├── awa-server-execute.ggo ├── awa-server-execute_cmdline.c ├── awa-server-execute_cmdline.h ├── awa-server-explore.c ├── awa-server-explore.ggo ├── awa-server-explore_cmdline.c ├── awa-server-explore_cmdline.h ├── awa-server-list-clients.c ├── awa-server-list-clients.ggo ├── awa-server-list-clients_cmdline.c ├── awa-server-list-clients_cmdline.h ├── awa-server-observe.c ├── awa-server-observe.ggo ├── awa-server-observe_cmdline.c ├── awa-server-observe_cmdline.h ├── awa-server-read.c ├── awa-server-read.ggo ├── awa-server-read_cmdline.c ├── awa-server-read_cmdline.h ├── awa-server-write-attributes.c ├── awa-server-write-attributes.ggo ├── awa-server-write-attributes_cmdline.c ├── awa-server-write-attributes_cmdline.h ├── awa-server-write.c ├── awa-server-write.ggo ├── awa-server-write_cmdline.c ├── awa-server-write_cmdline.h ├── changeset_common.c ├── changeset_common.h ├── define-common.ggo ├── define_common.c ├── define_common.h ├── tests ├── gtest │ ├── CMakeLists.txt │ └── test_tools_common.cc ├── object-defs-tools-test.xml ├── python │ ├── test_awa_client.py │ ├── test_awa_client_define.py │ ├── test_awa_client_delete.py │ ├── test_awa_client_explore.py │ ├── test_awa_client_get.py │ ├── test_awa_client_server_interaction.py │ ├── test_awa_client_set.py │ ├── test_awa_client_subscribe.py │ ├── test_awa_server.py │ ├── test_awa_server_define.py │ ├── test_awa_server_delete.py │ ├── test_awa_server_execute.py │ ├── test_awa_server_list_clients.py │ ├── test_awa_server_list_clients_multiple.py │ ├── test_awa_server_observe.py │ ├── test_awa_server_read.py │ ├── test_awa_server_write.py │ ├── test_awa_server_write_attributes.py │ └── tools_common.py ├── run_tests.sh └── test.bsc ├── tools_common.c └── tools_common.h /.dockerignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | 10 | [*.{c,h}] 11 | indent_size = 4 12 | 13 | [{Makefile,Dockerfile*}] 14 | indent_style = tab 15 | indent_size = 4 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cppcheck-result.xml 2 | *_out.xml 3 | staging/ 4 | *~ 5 | *.o 6 | *.pyc 7 | *.a 8 | *.swp 9 | *.so 10 | *.orig 11 | *.rej 12 | awa_clientd 13 | awa_serverd 14 | awa_bootstrapd 15 | test_*_runner 16 | valgrind/ 17 | 18 | # CMake builds 19 | build/ 20 | build.openwrt/ 21 | .build_x86 22 | *.cmake 23 | 24 | # Eclipse 25 | .project 26 | .cproject 27 | .settings 28 | 29 | # PyDev 30 | .pydevproject 31 | .python-version 32 | 33 | # VSCode 34 | .vscode/* 35 | 36 | # log files 37 | daemon.log 38 | awa_clientd.log 39 | awa_serverd.log 40 | awa_bootstrapd.log 41 | 42 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "commands-show-output": false, 4 | "ol-prefix": false, 5 | "no-bare-urls": false, 6 | "fenced-code-language": false, 7 | "first-line-h1": false, 8 | "no-hard-tabs": false, 9 | "line-length": false 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: cpp 3 | compiler: gcc 4 | 5 | addons: 6 | apt: 7 | sources: 8 | - george-edison55-precise-backports 9 | - ubuntu-toolchain-r-test 10 | packages: 11 | - cmake 12 | - cmake-data 13 | - gcc-5 14 | - g++-5 15 | - python-virtualenv 16 | 17 | install: 18 | - if [ "$CXX" = "g++" ]; then export CXX="g++-5" CC="gcc-5"; fi 19 | - virtualenv --system-site-packages venv 20 | - source venv/bin/activate 21 | - pip install -r ci/requirements.txt 22 | 23 | # Travis-CI does not support IPv6 addresses: 24 | script: make tests TEST_FILTER=*.*:-*.*_handles_IPv6_address* 25 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Chris Dewbery 2 | Sean Kelly 3 | David Antliff 4 | Roland Bewick 5 | Hayden Brown 6 | Tony Walsworth 7 | Rory Latchem 8 | Delme Thomas 9 | Surender Sanke 10 | Janibasha Shaik 11 | François Berder 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 5 | following conditions are met: 6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 7 | following disclaimer. 8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 9 | following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 11 | products derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 14 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 16 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 18 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 19 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.2.5 2 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | Awa-html 2 | html 3 | *.o 4 | *.a 5 | latex 6 | *.pdf 7 | -------------------------------------------------------------------------------- /api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (API_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "API_INCLUDE_DIR") 2 | 3 | add_subdirectory (src) 4 | if (BUILD_EXAMPLES) 5 | add_subdirectory (examples) 6 | endif () 7 | 8 | if (BUILD_TESTS) 9 | add_subdirectory (tests) 10 | endif () 11 | 12 | install (DIRECTORY include/awa 13 | DESTINATION include 14 | ) 15 | 16 | -------------------------------------------------------------------------------- /api/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | 3 | .PHONY: doc docs doc-html doc-pdf 4 | doc docs: doc-html 5 | 6 | export VERSION:=$(shell cat ../VERSION) 7 | 8 | doc-html: 9 | cd doc && doxygen 2>&1 >/dev/null | ./doxygen-err-filter.sh | ( ! grep . ) 10 | 11 | doc-pdf: 12 | $(MAKE) -C doc/latex 13 | mv doc/latex/refman.pdf doc/Awa.pdf 14 | rm -rf doc/latex 15 | 16 | .PHONY: clean 17 | clean: 18 | rm -rf doc/latex 19 | rm -rf doc/html 20 | rm -f doc/Awa.pdf 21 | -------------------------------------------------------------------------------- /api/doc/doxygen-err-filter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Filter doxygen output for acceptable warnings 3 | 4 | stdin=$(cat) 5 | echo "$stdin" | grep -v "has become obsolete." \ 6 | | grep -v "To avoid this warning please remove this line from your configuration file" 7 | -------------------------------------------------------------------------------- /api/doc/template/creator.css: -------------------------------------------------------------------------------- 1 | #imglogo { 2 | padding-left:0px; 3 | background: url(imgteclogo.png) no-repeat left center #770172; 4 | height:80px; 5 | } 6 | 7 | #version { 8 | color: white; 9 | background: #770172; 10 | display: block; 11 | width: 100%; 12 | height: 18px; 13 | text-align: right; 14 | } 15 | .copyright_footer { 16 | margin-left: 10px; 17 | color: #666666; 18 | } 19 | -------------------------------------------------------------------------------- /api/doc/template/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /api/doc/template/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $title 6 | 7 | 8 | 9 | $search 10 | 11 | 12 | 13 | 14 | 15 | 17 |
$projectname ($projectnumber)  
18 | -------------------------------------------------------------------------------- /api/doc/template/imgteclogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/api/doc/template/imgteclogo.png -------------------------------------------------------------------------------- /api/doc/template/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** @mainpage Awa LWM2M C API 2 | @section overview Overview 3 | 4 | @e Awa @e LWM2M is an implementation of the OMA Lightweight M2M protocol that provides a secure and standards-compliant device management solution to simplify the development of M2M applications by providing an intuitive API that enables customization without the need for an intimate knowledge of M2M protocols. 5 | 6 | This documentation covers the C APIs provided for an application to interact with the client or server. 7 | 8 | The @e Awa @e LWM2M source code and further information can be found at https://github.com/FlowM2M/AwaLWM2M 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /api/doc/template/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-color: #511557; 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | } 7 | 8 | .tabs2 { 9 | font-size: 10px; 10 | } 11 | .tabs3 { 12 | font-size: 9px; 13 | } 14 | 15 | .tablist { 16 | margin: 0; 17 | padding: 0; 18 | display: table; 19 | } 20 | 21 | .tablist li { 22 | float: left; 23 | display: table-cell; 24 | line-height: 36px; 25 | list-style: none; 26 | } 27 | 28 | .tablist a { 29 | display: block; 30 | padding: 0 20px; 31 | font-weight: bold; 32 | background-repeat:no-repeat; 33 | background-position:right; 34 | color: #FFFFFF; 35 | text-shadow: none 36 | text-decoration: none; 37 | outline: none; 38 | } 39 | 40 | .tabs3 .tablist a { 41 | padding: 0 10px; 42 | } 43 | 44 | .tablist a:hover { 45 | background-color: #DFDFDF; 46 | color: #770172; 47 | text-decoration: none; 48 | text-shadow: none; 49 | } 50 | 51 | .tablist li.current a { 52 | background-color: #FFFFFF; 53 | color: #770172; 54 | text-shadow: none; 55 | } 56 | -------------------------------------------------------------------------------- /api/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (Examples 2 | client-get-example 3 | client-get-contains-path-example 4 | client-get-array-example 5 | client-set-example 6 | client-set-create-example 7 | client-set-array-example 8 | client-defineset-example 9 | client-delete-example 10 | #client-delete-array-range-example # TODO enable when delete array range is supported. 11 | client-subscribe-to-change-example 12 | client-subscribe-to-execute-example 13 | client-definition-iterator-example 14 | 15 | server-list-clients-example 16 | server-read-example 17 | server-write-example 18 | server-write-create-example 19 | server-write-create-unspecified-instance-example 20 | server-delete-object-instance-example 21 | server-observe-example 22 | server-defineset-example 23 | server-execute-example 24 | server-execute-arguments-example 25 | server-event-example 26 | 27 | # TODO: set-array example uses single values and not an array. Add an example for that too and 28 | # rename this set-array to set-array-individual-instances-example 29 | 30 | # TODO: get-response-iterator-example 31 | # TODO: subscribe iterate through changeset example 32 | ) 33 | 34 | foreach (example ${Examples}) 35 | add_executable (${example} ${example}.c) 36 | target_include_directories (${example} PRIVATE ${API_INCLUDE_DIR}) 37 | target_link_libraries (${example} Awa_static) 38 | target_link_libraries (${example} libxml_static) 39 | 40 | if (ENABLE_GCOV) 41 | target_link_libraries (${example} gcov) 42 | endif () 43 | endforeach (example ${Examples}) 44 | 45 | add_subdirectory (tutorials) 46 | -------------------------------------------------------------------------------- /api/examples/tutorials/.gitignore: -------------------------------------------------------------------------------- 1 | client-tutorial1 2 | client-tutorial2 3 | server-tutorial 4 | static-client-tutorial1 5 | static-client-tutorial2 6 | 7 | -------------------------------------------------------------------------------- /api/examples/tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (Tutorials 2 | client-tutorial1 3 | client-tutorial2 4 | server-tutorial 5 | static-client-tutorial1 6 | static-client-tutorial2 7 | static-client-tutorial3 8 | ) 9 | 10 | foreach (tutorial ${Tutorials}) 11 | 12 | add_executable (${tutorial} ${tutorial}.c) 13 | target_include_directories (${tutorial} PRIVATE ${API_INCLUDE_DIR}) 14 | target_link_libraries (${tutorial} Awa_static) 15 | target_link_libraries (${tutorial} awa_static) 16 | target_link_libraries (${tutorial} libxml_static) 17 | 18 | if (ENABLE_GCOV) 19 | target_link_libraries (${tutorial} gcov) 20 | endif () 21 | endforeach (tutorial ${Tutorials}) 22 | -------------------------------------------------------------------------------- /api/examples/tutorials/Makefile: -------------------------------------------------------------------------------- 1 | # This makefile assumes that Awa has been built with the default INSTALL_PREFIX and DESTDIR=install. 2 | AWA_INSTALL_PATH:=../../../build/install 3 | 4 | all: 5 | $(CC) client-tutorial1.c -o client-tutorial1 -I$(AWA_INSTALL_PATH)/include -L$(AWA_INSTALL_PATH)/lib -lawa 6 | $(CC) client-tutorial2.c -o client-tutorial2 -I$(AWA_INSTALL_PATH)/include -L$(AWA_INSTALL_PATH)/lib -lawa 7 | $(CC) server-tutorial.c -o server-tutorial -I$(AWA_INSTALL_PATH)/include -L$(AWA_INSTALL_PATH)/lib -lawa 8 | $(CC) static-client-tutorial1.c -o static-client-tutorial1 -I$(AWA_INSTALL_PATH)/include -L$(AWA_INSTALL_PATH)/lib -lawa_static 9 | $(CC) static-client-tutorial2.c -o static-client-tutorial2 -I$(AWA_INSTALL_PATH)/include -L$(AWA_INSTALL_PATH)/lib -lawa_static 10 | -------------------------------------------------------------------------------- /api/examples/tutorials/static-client-tutorial1.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #include 24 | #include 25 | #include "awa/static.h" 26 | 27 | int main(void) 28 | { 29 | AwaStaticClient * awaClient = AwaStaticClient_New(); 30 | 31 | AwaStaticClient_SetLogLevel(AwaLogLevel_Error); 32 | AwaStaticClient_SetEndPointName(awaClient, "AwaStaticClient1"); 33 | AwaStaticClient_SetCoAPListenAddressPort(awaClient, "0.0.0.0", 0); 34 | AwaStaticClient_SetBootstrapServerURI(awaClient, "coap://[127.0.0.1]:15685"); 35 | 36 | AwaStaticClient_Init(awaClient); 37 | 38 | while (1) 39 | { 40 | AwaStaticClient_Process(awaClient); 41 | } 42 | 43 | AwaStaticClient_Free(&awaClient); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /api/src/changeset.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef CHANGESET_H 25 | #define CHANGESET_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "awa/common.h" 32 | #include "operation_common.h" 33 | #include "xmltree.h" 34 | 35 | AwaChangeSet * ChangeSet_NewWithClientID(Session * session, SessionType sessionType, TreeNode objectsTree, const char * clientID); 36 | 37 | AwaChangeSet * ChangeSet_New(Session * session, SessionType sessionType, TreeNode objectsTree); 38 | 39 | AwaError ChangeSet_Free(AwaChangeSet ** changeSet); 40 | 41 | AwaError ChangeSet_GetExecuteArguments(const AwaChangeSet * changeSet, const char * path, AwaExecuteArguments * arguments); 42 | 43 | TreeNode ChangeSet_GetObjectsTree(const AwaChangeSet * changeSet); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // CHANGESET_H 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /api/src/client_iterator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef CLIENT_ITERATOR_H 25 | #define CLIENT_ITERATOR_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef struct _ClientIterator ClientIterator; 32 | 33 | ClientIterator * ClientIterator_New(void); 34 | 35 | void ClientIterator_Free(ClientIterator ** iterator); 36 | 37 | void ClientIterator_Add(ClientIterator * iterator, const char * clientID); 38 | 39 | bool ClientIterator_Next(ClientIterator * iterator); 40 | 41 | const char * ClientIterator_GetClientID(const ClientIterator * iterator); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif // CLIENT_ITERATOR_H 48 | 49 | -------------------------------------------------------------------------------- /api/src/client_notification.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #include 25 | #include 26 | #include "awa/client.h" 27 | #include "awa/common.h" 28 | #include "log.h" 29 | #include "ipc.h" 30 | #include "client_session.h" 31 | #include "client_subscribe.h" 32 | 33 | AwaError ClientNotification_Process(AwaClientSession * session, IPCMessage * notification) 34 | { 35 | AwaError result = AwaError_Success; 36 | if (notification) 37 | { 38 | TreeNode contentNode = IPCMessage_GetContentNode(notification); 39 | if (contentNode != NULL) 40 | { 41 | result = ClientSubscribe_CallSubscribers(session, contentNode); 42 | } 43 | else 44 | { 45 | result = LogErrorWithEnum(AwaError_IPCError, "Content node not found"); 46 | } 47 | } 48 | return result; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /api/src/client_subscribe_response.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef CLIENT_SUBSCRIBE_RESPONSE_H 25 | #define CLIENT_SUBSCRIBE_RESPONSE_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "lwm2m_tree_node.h" 32 | #include "awa/client.h" 33 | #include "client_session.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | AwaClientSubscribeResponse * SubscribeResponse_New(AwaClientSubscribeOperation * operation, TreeNode objectsNode); 40 | AwaError SubscribeResponse_Free(AwaClientSubscribeResponse ** response); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif // CLIENT_SUBSCRIBE_RESPONSE_H 47 | -------------------------------------------------------------------------------- /api/src/define_common.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef DEFINE_COMMON_H 25 | #define DEFINE_COMMON_H 26 | 27 | #include 28 | 29 | #include "awa/client.h" 30 | #include "lwm2m_definition.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | 37 | struct _AwaObjectDefinitionIterator 38 | { 39 | AwaObjectID ObjectID; 40 | DefinitionRegistry * Definitions; 41 | }; 42 | 43 | struct _AwaResourceDefinitionIterator 44 | { 45 | AwaResourceID ResourceID; 46 | const AwaObjectDefinition * Definition; 47 | }; 48 | 49 | 50 | Lwm2mTreeNode * ResourceDefinition_GetDefaultValueNode(const AwaResourceDefinition * definition); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif // DEFINE_COMMON_H 57 | 58 | -------------------------------------------------------------------------------- /api/src/get_operation.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef GET_OPERATION_H 25 | #define GET_OPERATION_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "lwm2m_tree_node.h" 32 | #include "awa/client.h" 33 | #include "client_session.h" 34 | #include "operation_common.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | const AwaClientSession * ClientGetOperation_GetSession(const AwaClientGetOperation * operation); 41 | 42 | OperationCommon * ClientGetOperation_GetOperationCommon(const AwaClientGetOperation * operation); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif // GET_OPERATION_H 49 | 50 | -------------------------------------------------------------------------------- /api/src/get_response.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef GET_RESPONSE_H 25 | #define GET_RESPONSE_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "awa/client.h" 32 | #include "lwm2m_tree_node.h" 33 | #include "client_session.h" 34 | #include "memalloc.h" 35 | #include "log.h" 36 | #include "xml.h" 37 | #include "path.h" 38 | #include "ipc.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // GET_RESPONSE_H 50 | 51 | -------------------------------------------------------------------------------- /api/src/lwm2m_error.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef SERVER_ERROR_H 25 | #define SERVER_ERROR_H 26 | 27 | #include "awa/common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | const char * LWM2MError_ToString(AwaLWM2MError error); 34 | AwaLWM2MError LWM2MError_FromString(const char * errorString); 35 | AwaLWM2MError LWM2MError_FromCoapResponseCode(int responseCode); 36 | size_t LWM2MError_GetNumberOfServerErrorStrings(void); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // SERVER_ERROR_H 43 | 44 | -------------------------------------------------------------------------------- /api/src/memalloc.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef MEMALLOC_H 25 | #define MEMALLOC_H 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #define Awa_MemAlloc malloc 34 | #define Awa_MemCalloc calloc 35 | #define Awa_MemRealloc realloc 36 | #define Awa_MemSafeFree free 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // MEMALLOC_H 43 | 44 | -------------------------------------------------------------------------------- /api/src/path_iterator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef PATH_ITERATOR_H 25 | #define PATH_ITERATOR_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef struct _PathIterator PathIterator; 32 | 33 | PathIterator * PathIterator_New(void); 34 | 35 | void PathIterator_Free(PathIterator ** iterator); 36 | 37 | void PathIterator_Add(PathIterator * iterator, const char * path); 38 | 39 | bool PathIterator_Next(PathIterator * iterator); 40 | 41 | const char * PathIterator_Get(const PathIterator * iterator); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif // PATH_ITERATOR_H 48 | 49 | -------------------------------------------------------------------------------- /api/src/path_result.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef PATH_RESULT_H 25 | #define PATH_RESULT_H 26 | 27 | #include "awa/error.h" 28 | #include "xmltree.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct _PathResult PathResult; 35 | 36 | PathResult * PathResult_New(TreeNode resultNode); 37 | void PathResult_Free(PathResult ** result); 38 | AwaError PathResult_GetError(const PathResult * result); 39 | AwaLWM2MError PathResult_GetLWM2MError(const PathResult * result); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif // PATH_RESULT_H 46 | 47 | -------------------------------------------------------------------------------- /api/src/queue.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef QUEUE_H 25 | #define QUEUE_H 26 | 27 | #include 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct _QueueType QueueType; 35 | 36 | QueueType * Queue_New(void); 37 | bool Queue_Push(QueueType * queue, void * item); 38 | bool Queue_Pop(QueueType * queue, void ** item); 39 | void Queue_Free(QueueType ** queue); 40 | void Queue_Flush(QueueType * queue); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif // QUEUE_H 47 | 48 | -------------------------------------------------------------------------------- /api/src/registered_entity_iterator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef REGISTERED_ENTITY_ITERATOR_H 25 | #define REGISTERED_ENTITY_ITERATOR_H 26 | 27 | #include "response_common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef struct _RegisteredEntityIterator RegisteredEntityIterator; 34 | 35 | RegisteredEntityIterator * RegisteredEntityIterator_New(const ResponseCommon * response); 36 | 37 | void RegisteredEntityIterator_Free(RegisteredEntityIterator ** iterator); 38 | 39 | void RegisteredEntityIterator_Add(RegisteredEntityIterator * iterator, const char * path); 40 | 41 | bool RegisteredEntityIterator_Next(RegisteredEntityIterator * iterator); 42 | 43 | const char * RegisteredEntityIterator_GetPath(const RegisteredEntityIterator * iterator); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // PATH_ITERATOR_H 50 | 51 | -------------------------------------------------------------------------------- /api/src/server_notification.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef SERVER_NOTIFICATION_H 25 | #define SERVER_NOTIFICATION_H 26 | 27 | #include "awa/common.h" 28 | #include "server_session.h" 29 | #include "ipc.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | AwaError ServerNotification_Process(AwaServerSession * session, IPCMessage * notification); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif // SERVER_NOTIFICATION_H 42 | 43 | -------------------------------------------------------------------------------- /api/src/string_iterator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef STRING_ITERATOR_H 25 | #define STRING_ITERATOR_H 26 | 27 | #include "awa/common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef struct _StringIterator StringIterator; 34 | 35 | StringIterator * StringIterator_New(void); 36 | 37 | void StringIterator_Free(StringIterator ** iterator); 38 | 39 | void StringIterator_Add(StringIterator * iterator, const char * path); 40 | 41 | bool StringIterator_Next(StringIterator * iterator); 42 | 43 | const char * StringIterator_Get(const StringIterator * iterator); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // STRING_ITERATOR_H 50 | 51 | -------------------------------------------------------------------------------- /api/src/subscribe_observe_common.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef SUBSCRIBE_OBSERVE_OPERATION_H 25 | #define SUBSCRIBE_OBSERVE_OPERATION_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "changeset.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | // Common to Subscribe / Observe 38 | 39 | typedef void (*CallObserversCallback)(MapType * observers, const char * path, const AwaChangeSet * changeSet); 40 | 41 | AwaError SubscribeObserveCommon_CallObservers(MapType * observers, AwaChangeSet * changeSet, CallObserversCallback callback); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif // SUBSCRIBE_OBSERVE_OPERATION_H 48 | 49 | -------------------------------------------------------------------------------- /api/src/utils.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef UTILS_H 25 | #define UTILS_H 26 | 27 | #include "awa/error.h" 28 | #include "awa/common.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | #ifndef __GNUC__ 35 | # define __attribute__(X) 36 | #endif // __GNUC__ 37 | 38 | size_t msprintf(char ** string, const char * format, ...) __attribute__ ((format (printf, 2, 3))); 39 | 40 | const char * Utils_ResourceTypeToString(AwaResourceType resourceType); 41 | 42 | size_t Utils_GetNumberOfResourceTypeStrings(void); 43 | 44 | const char * Utils_ResourceOperationToString(AwaResourceOperations resourceOp); 45 | 46 | size_t Utils_GetNumberOfResourceOperationStrings(void); 47 | 48 | AwaResourceType Utils_GetPrimativeResourceType(AwaResourceType resourceType); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif // UTILS_H 55 | 56 | -------------------------------------------------------------------------------- /api/src/value.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef VALUE_H 25 | #define VALUE_H 26 | 27 | #include 28 | 29 | #include "awa/common.h" 30 | #include "xmltree.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct _Value Value; 37 | 38 | Value * Value_New(TreeNode valueNode, AwaResourceType type); 39 | 40 | void Value_Free(Value ** value); 41 | 42 | AwaResourceType Value_GetType(const Value * value); 43 | 44 | void * Value_GetData(const Value * value); 45 | 46 | size_t Value_GetLength(const Value * value); 47 | 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif // VALUE_H 54 | 55 | -------------------------------------------------------------------------------- /api/src/write_mode.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef WRITE_MODE_H 25 | #define WRITE_MODE_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "awa/server.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | bool IsWriteModeValid(AwaWriteMode writeMode); 38 | 39 | const char * WriteMode_ToString(AwaWriteMode error); 40 | 41 | AwaWriteMode WriteMode_FromString(const char * errorString); 42 | 43 | size_t WriteMode_GetNumberOfWriteModeStrings(void); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // WRITE_MODE_H 50 | 51 | -------------------------------------------------------------------------------- /api/tests/debug.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://127.0.0.1:5683 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=15 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true 14 | -------------------------------------------------------------------------------- /api/tests/gtest.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://127.0.0.1:6001 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=15 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true -------------------------------------------------------------------------------- /api/tests/support/log.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #include "log.h" 24 | 25 | #include 26 | 27 | namespace Awa { 28 | 29 | namespace global { 30 | 31 | const std::string testLogFilename = "daemon.log"; 32 | 33 | LogStream testLog(testLogFilename, std::ios::out | std::ios::app); 34 | 35 | } // namespace global 36 | 37 | } // namespace Awa 38 | -------------------------------------------------------------------------------- /api/tests/support/log.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #include 24 | #include 25 | 26 | namespace Awa { 27 | 28 | namespace global { 29 | 30 | extern const std::string testLogFilename; 31 | 32 | typedef std::ofstream LogStream; 33 | 34 | extern LogStream testLog; 35 | 36 | } // namespace global 37 | } // namespace Awa 38 | -------------------------------------------------------------------------------- /api/tests/support/main/Makefile: -------------------------------------------------------------------------------- 1 | FILES:=main_cmdline 2 | 3 | all: $(FILES:=.c) 4 | 5 | .PHONY: gen_cmdline 6 | gen_cmdline: $(FILES) 7 | 8 | %_cmdline.c %_cmdline.h: %.ggo 9 | gengetopt --input=$^ --include-getopt --file $*_cmdline 10 | 11 | .PHONY: clean 12 | clean: 13 | rm -f $(FILES:=.c) $(FILES:=.h) 14 | 15 | 16 | -------------------------------------------------------------------------------- /api/tests/support/main/main.ggo: -------------------------------------------------------------------------------- 1 | version "0.1" 2 | package "test_runner" 3 | purpose "Perform unit tests" 4 | 5 | # Options 6 | option "clientIpcPort" c "External LWM2M Client IPC Port" int optional typestr="PORT" 7 | option "serverIpcPort" s "External LWM2M Server IPC Port" int optional typestr="PORT" 8 | 9 | option "clientLocalCoapPort" - "External LWM2M Client local CoAP Port" int optional typestr="PORT" 10 | option "serverCoapPort" - "External LWM2M Server CoAP Port" int optional typestr="PORT" 11 | option "bootstrapServerCoapPort" - "External LWM2M Bootstrap Server CoAP Port" int optional typestr="PORT" 12 | 13 | option "logLevel" - "Awa API Log Level" int optional typestr="LEVEL" 14 | 15 | option "coapClientPath" - "Path to libcoap coap-client tool" string optional default="lib/libcoap/examples/coap-client" 16 | option "clientDaemonPath" - "Path to LWM2M client daemon" string optional default="daemon/src/client/awa_clientd" 17 | option "serverDaemonPath" - "Path to LWM2M server daemon" string optional default="daemon/src/server/awa_serverd" 18 | option "bootstrapDaemonPath" - "Path to LWM2M bootstrap daemon" string optional default="daemon/src/bootstrap/awa_bootstrapd" 19 | option "bootstrapConfig" - "Path to bootstrap config file" string optional default="../api/tests/gtest.bsc" 20 | option "objectDefinitions" - "Path to object definitions file" string optional default="../api/tests/object-defs-gtest.xml" 21 | 22 | option "defaultTimeout" - "Set default timeout in milliseconds for IPC operations" int optional typestr="TIMEOUT" 23 | -------------------------------------------------------------------------------- /ci/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | MAINTAINER David Antliff 3 | 4 | ENV DEBIAN_FRONTEND noninteractive 5 | 6 | # install package dependencies 7 | RUN apt-get update -yq && apt-get install -yq \ 8 | apt-utils \ 9 | git \ 10 | curl \ 11 | make \ 12 | build-essential \ 13 | libssl-dev \ 14 | zlib1g-dev \ 15 | libbz2-dev \ 16 | libreadline-dev \ 17 | libxml2-dev \ 18 | libxslt-dev \ 19 | doxygen \ 20 | graphviz \ 21 | gnutls-dev \ 22 | gawk \ 23 | cmake 24 | # apt-get clean is automatic for Ubuntu images 25 | 26 | # some handy utilities for development purposes 27 | RUN apt-get install -yq \ 28 | dnsutils \ 29 | iputils-ping 30 | 31 | # install pyenv 32 | RUN useradd -m build 33 | WORKDIR /home/build 34 | ENV HOME /home/build 35 | USER build 36 | 37 | RUN git clone https://github.com/yyuu/pyenv.git .pyenv 38 | ENV PYENV_ROOT $HOME/.pyenv 39 | ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH 40 | 41 | # install python 2.7.11 within pyenv, pip 42 | RUN pyenv install 2.7.11 && pyenv global 2.7.11 && pyenv rehash 43 | 44 | # copy in Awa sources 45 | USER root 46 | COPY . $HOME/AwaLWM2M 47 | RUN chown build:build -R $HOME/AwaLWM2M 48 | 49 | # allow CMAKE_OPTIONS to be specified during image build-time 50 | ARG CMAKE_OPTIONS 51 | ENV CMAKE_OPTIONS ${CMAKE_OPTIONS} 52 | 53 | # build AwaLWM2M and tests 54 | USER build 55 | WORKDIR $HOME/AwaLWM2M 56 | RUN pip install -r ci/requirements.txt 57 | RUN make 58 | 59 | # build docs 60 | RUN make docs 61 | 62 | # run tests 63 | RUN make tests 64 | 65 | # install 66 | USER root 67 | RUN make install 68 | -------------------------------------------------------------------------------- /ci/Dockerfile.ci: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | MAINTAINER David Antliff 3 | 4 | ENV DEBIAN_FRONTEND noninteractive 5 | 6 | # install package dependencies 7 | RUN apt-get update -yq && apt-get install -yq \ 8 | apt-utils \ 9 | git \ 10 | curl \ 11 | make \ 12 | build-essential \ 13 | libssl-dev \ 14 | zlib1g-dev \ 15 | libbz2-dev \ 16 | libreadline-dev \ 17 | libxml2-dev \ 18 | libxslt-dev \ 19 | doxygen \ 20 | graphviz \ 21 | cmake \ 22 | valgrind \ 23 | lcov \ 24 | cppcheck 25 | # apt-get clean is automatic for Ubuntu images 26 | 27 | # install pyenv 28 | RUN useradd -m build 29 | WORKDIR /home/build 30 | ENV HOME /home/build 31 | 32 | USER build 33 | RUN git clone https://github.com/yyuu/pyenv.git .pyenv 34 | ENV PYENV_ROOT $HOME/.pyenv 35 | ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH 36 | 37 | # install python 2.7.11 within pyenv, pip 38 | RUN pyenv install 2.7.11 && pyenv global 2.7.11 && pyenv rehash 39 | 40 | # copy in Awa sources 41 | USER root 42 | COPY ci/requirements.txt $HOME/requirements.txt 43 | #COPY . $HOME/AwaLWM2M 44 | #RUN chown build:build -R $HOME/AwaLWM2M 45 | 46 | # install test dependencies 47 | USER build 48 | #WORKDIR $HOME/AwaLWM2M 49 | RUN pip install -r $HOME/requirements.txt 50 | 51 | WORKDIR $HOME 52 | # 53 | -------------------------------------------------------------------------------- /ci/ci-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Script to build AwaLWM2M and execute CI within a docker container 3 | # 4 | # Define DOCKER_BUILD_EXTRA_OPTIONS if you wish to add/override image build options. 5 | # Define DOCKER_RUN_EXTRA_OPTIONS if you wish to add/override container run options. 6 | # 7 | 8 | # only enable Docker pseudoterminal if a TTY is present: 9 | if [ -t 1 ]; then 10 | TERMINAL_OPT=-t 11 | else 12 | TERMINAL_OPT= 13 | fi 14 | 15 | # create/update the build environment image: 16 | docker build \ 17 | -t flowm2m/awalwm2m.ci \ 18 | -f ci/Dockerfile.ci \ 19 | $DOCKER_BUILD_EXTRA_OPTIONS \ 20 | . 21 | 22 | # use the image to run the CI process: 23 | docker run \ 24 | -v $(pwd):/home/build/AwaLWM2M \ 25 | -w /home/build/AwaLWM2M \ 26 | -i $TERMINAL_OPT \ 27 | $DOCKER_RUN_EXTRA_OPTIONS \ 28 | flowm2m/awalwm2m.ci \ 29 | ci/ci.sh $@ 30 | -------------------------------------------------------------------------------- /ci/cppcheck.suppress: -------------------------------------------------------------------------------- 1 | // Suppress all warnings about unmatched suppressions! 2 | unmatchedSuppression:* 3 | 4 | // Suppress all warnings from gengetopt-generated files: 5 | *:*/*cmdline.c 6 | 7 | // Unsupported functions are probably best ignored: 8 | unusedFunction:api/src/unsupported.c 9 | 10 | // Unused function warnings are occasionally useful, but more often than not annoying. 11 | // Suppress all unused function warnings for now. 12 | unusedFunction:* 13 | 14 | // False positives 15 | 16 | // "Member variable 'CallbackHandler1::count' is not initialized in the constructor." 17 | uninitMemberVar:api/tests/client/test_subscribe_operation.cc 18 | uninitMemberVar:api/tests/server/test_observe_operation.cc 19 | uninitMemberVar:api/tests/server/test_server_events.cc 20 | 21 | // Erbium suppressions 22 | unreadVariable:core/src/erbium/er-coap.c 23 | -------------------------------------------------------------------------------- /ci/jenkins-valgrind.sh: -------------------------------------------------------------------------------- 1 | valgrind.sh -------------------------------------------------------------------------------- /ci/jenkins.sh: -------------------------------------------------------------------------------- 1 | ci.sh -------------------------------------------------------------------------------- /ci/openwrt-toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | 3 | set(CMAKE_C_COMPILER mipsel-openwrt-linux-uclibc-gcc) 4 | set(CMAKE_CXX_COMPILER mipsel-openwrt-linux-uclibc-g++) 5 | 6 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 7 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 10 | -------------------------------------------------------------------------------- /ci/requirements.txt: -------------------------------------------------------------------------------- 1 | mercurial==4.1.3 2 | nose==1.3.7 3 | lxml==3.6.0 4 | future==0.16.0 5 | -------------------------------------------------------------------------------- /ci/update-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | # Script to build docs and update FlowM2M/AwaLWM2M-docs repository 3 | # 4 | # Define DOCKER_RUN_EXTRA_OPTIONS if you wish to add/override container run options. 5 | # 6 | # Assumes FlowM2M/AwaLWM2M-docs is checked out in ../docs 7 | # SSH credentials for pushing to FlowM2M/AwaLWM2M-docs are to be provided externally (e.g. from Jenkins) 8 | # 9 | 10 | DOCKER_RUN_EXTRA_OPTIONS=$DOCKER_RUN_EXTRA_OPTIONS 11 | 12 | set -o errexit 13 | set -o nounset 14 | 15 | SRC_DOCS=$PWD/api/doc/html 16 | DST_DOCS=../docs 17 | 18 | # only enable Docker pseudoterminal if a TTY is present: 19 | if [ -t 1 ]; then 20 | TERMINAL_OPT=-t 21 | else 22 | TERMINAL_OPT= 23 | fi 24 | 25 | # make docs 26 | docker run \ 27 | -v $(pwd):/home/build/AwaLWM2M \ 28 | -w /home/build/AwaLWM2M \ 29 | -i $TERMINAL_OPT \ 30 | $DOCKER_RUN_EXTRA_OPTIONS \ 31 | flowm2m/awalwm2m.ci \ 32 | make docs 33 | 34 | GIT_REV=$(git rev-parse HEAD) 35 | 36 | ( 37 | cd $DST_DOCS 38 | git checkout -b gh-pages-update 39 | git rm -rf --ignore-unmatch * 40 | cp -a $SRC_DOCS/* . 41 | git add . --all 42 | git status 43 | git commit -m "Update documentation from FlowM2M/AwaLWM2M.git :: $GIT_REV." 44 | git push origin gh-pages-update:gh-pages 45 | git checkout origin/gh-pages 46 | git branch -D gh-pages-update 47 | ) 48 | -------------------------------------------------------------------------------- /ci/valgrind-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Script to build AwaLWM2M and execute Valgrind within a docker container 3 | 4 | # only enable Docker pseudoterminal if a TTY is present: 5 | if [ -t 1 ]; then 6 | TERMINAL_OPT=-t 7 | else 8 | TERMINAL_OPT= 9 | fi 10 | 11 | # create/update the build environment image: 12 | docker build -t flowm2m/awalwm2m.ci -f ci/Dockerfile.ci . 13 | 14 | # use the image to run the Valgrind process: 15 | docker run \ 16 | -v $(pwd):/home/build/AwaLWM2M \ 17 | -e CMAKE_OPTIONS="-DWITH_LIBCOAP=ON" \ 18 | -w /home/build/AwaLWM2M \ 19 | -i $TERMINAL_OPT \ 20 | flowm2m/awalwm2m.ci \ 21 | ci/valgrind.sh 22 | -------------------------------------------------------------------------------- /ci/valgrind.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | #/************************************************************************************************************************ 4 | # Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 8 | # following conditions are met: 9 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 10 | # following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 12 | # following disclaimer in the documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 14 | # products derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 17 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 22 | # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | #************************************************************************************************************************/ 24 | 25 | set -o errexit 26 | 27 | BUILD_DIR=build 28 | 29 | #export ac_cv_func_malloc_0_nonnull=yes 30 | 31 | # clean out existing build artefacts 32 | make clean 33 | rm -rf $BUILD_DIR 34 | rm -rf tools/tools_tests.xml 35 | 36 | # Build for x86 and run valgrind check on all tests 37 | make BUILD_DIR=$BUILD_DIR CMAKE_OPTIONS="$CMAKE_OPTIONS" valgrind_comprehensive 38 | 39 | # legacy CI support 40 | ln -sfn $BUILD_DIR .build_x86 41 | -------------------------------------------------------------------------------- /ci/valgrind.suppress: -------------------------------------------------------------------------------- 1 | # Suppress C++ leak with g++ 5.2+ 2 | { 3 | 4 | Memcheck:Leak 5 | match-leak-kinds: reachable 6 | fun:malloc 7 | obj:/usr/lib/x86_64-linux-gnu/libstdc++.so.6.* 8 | fun:call_init.part.0 9 | fun:call_init 10 | fun:_dl_init 11 | obj:/lib/x86_64-linux-gnu/ld-*.so 12 | } 13 | -------------------------------------------------------------------------------- /config/contiki-flow-NAT64.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://[2001:1418:200::8daa:f85]:5683/ 2 | SecurityMode=3 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=2 6 | HoldOffTime=30 7 | ShortServerID=2 8 | Binding=U 9 | LifeTime=60 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true -------------------------------------------------------------------------------- /config/contiki-sim.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://[FE80::1]:5683 2 | SecurityMode=3 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=60 10 | -------------------------------------------------------------------------------- /config/contiki.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://[2001:1418:0100::1]:5683 2 | SecurityMode=3 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=60 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true -------------------------------------------------------------------------------- /config/docker.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://awa_serverd:5683 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=30 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true 14 | -------------------------------------------------------------------------------- /config/flowcloud.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://ws-uat.flowworld.com:5683 2 | SecurityMode=3 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=2 6 | HoldOffTime=30 7 | ShortServerID=2 8 | Binding=U 9 | LifeTime=30 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true -------------------------------------------------------------------------------- /config/leshan.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://leshan.eclipse.org:5683 2 | SecurityMode=3 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=15 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true -------------------------------------------------------------------------------- /config/localhost-secure.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coaps://127.0.0.1:5684 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=30 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true 14 | -------------------------------------------------------------------------------- /config/localhost.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://127.0.0.1:5683 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=30 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true 14 | -------------------------------------------------------------------------------- /core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (WITH_JSON) 2 | add_definitions (-DWITH_JSON) 3 | endif () 4 | 5 | add_definitions (-DPOSIX) 6 | 7 | add_subdirectory (src) 8 | 9 | if (BUILD_TESTS) 10 | add_subdirectory (tests) 11 | endif () 12 | -------------------------------------------------------------------------------- /core/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (CORE_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "CORE_SRC_DIR") 2 | 3 | set (CMAKE_C_FLAGS_DEBUG "-Wall -Werror -Wno-pointer-sign -g -DVERSION='\"${VERSION}\"' -D_GNU_SOURCE") 4 | set (CMAKE_C_FLAGS_RELEASE "-Os -Wall -Werror -Wno-pointer-sign -DVERSION='\"${VERSION}\"' -D_GNU_SOURCE") 5 | #SET(CMAKE_C_ARCHIVE_CREATE " rcs ") 6 | 7 | add_subdirectory (common) 8 | add_subdirectory (bootstrap) 9 | add_subdirectory (client) 10 | add_subdirectory (server) 11 | add_subdirectory (erbium) 12 | -------------------------------------------------------------------------------- /core/src/bootstrap/Makefile: -------------------------------------------------------------------------------- 1 | FILES:=awa_bootstrapd_cmdline 2 | 3 | # prevent autodeletion of intermediate files: 4 | #.SECONDARY: 5 | 6 | all: $(FILES:=.c) 7 | 8 | .PHONY: gen_cmdline 9 | gen_cmdline: $(FILES) 10 | 11 | %_cmdline.c %_cmdline.h: %.ggo 12 | gengetopt --input=$^ --include-getopt --unamed-opts=PATHS --file $*_cmdline 13 | 14 | .PHONY: clean 15 | clean: 16 | rm -f $(FILES:=.c) $(FILES:=.h) 17 | -------------------------------------------------------------------------------- /core/src/bootstrap/lwm2m_bootstrap.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_BOOTSTRAP_H 25 | #define LWM2M_BOOTSTRAP_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "lwm2m_core.h" 36 | 37 | // Initialise the boot strap mechanism, create the /bs endpoint 38 | bool Lwm2mBootstrap_BootStrapInit(Lwm2mContextType * context, const char ** config, int configCount); 39 | 40 | void Lwm2mBootstrap_Destroy(void); 41 | 42 | void Lwm2mBootstrap_BootStrapUpdate(Lwm2mContextType * context); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif // LWM2M_BOOTSTRAP_H 49 | 50 | -------------------------------------------------------------------------------- /core/src/bootstrap/lwm2m_bootstrap_psk.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_BOOTSTRAP_PSK_H_ 25 | #define LWM2M_BOOTSTRAP_PSK_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | const char * pskIdentity = "oFIrQFrW8EWcZ5u7eGfrkw"; 33 | 34 | const uint8_t pskKey[] = { 35 | 0x7C, 0xCD, 0xE1, 0x4A, 0x5C, 0xF3, 0xB7, 0x1C, 0x0C, 0x08, 0xC8, 0xB7, 0xF9, 0xE5 36 | }; 37 | 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* LWM2M_BOOTSTRAP_PSK_H_ */ 44 | -------------------------------------------------------------------------------- /core/src/client/Makefile: -------------------------------------------------------------------------------- 1 | FILES:=awa_clientd_cmdline 2 | 3 | # prevent autodeletion of intermediate files: 4 | #.SECONDARY: 5 | 6 | all: $(FILES:=.c) 7 | 8 | .PHONY: gen_cmdline 9 | gen_cmdline: $(FILES) 10 | 11 | %_cmdline.c %_cmdline.h: %.ggo 12 | gengetopt --input=$^ --include-getopt --unamed-opts=PATHS --file $*_cmdline 13 | 14 | .PHONY: clean 15 | clean: 16 | rm -f $(FILES:=.c) $(FILES:=.h) 17 | -------------------------------------------------------------------------------- /core/src/client/Makefile.client: -------------------------------------------------------------------------------- 1 | client_src = \ 2 | lwm2m_registration.c \ 3 | lwm2m_bootstrap.c \ 4 | lwm2m_security_object.c \ 5 | lwm2m_client_core.c \ 6 | lwm2m_acl_object.c \ 7 | lwm2m_server_object.c \ 8 | lwm2m_object_tree.c \ 9 | lwm2m_static.c 10 | -------------------------------------------------------------------------------- /core/src/client/lwm2m_acl_object.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_ACL_H 25 | #define LWM2M_ACL_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | #include "lwm2m_core.h" 33 | 34 | 35 | typedef enum 36 | { 37 | ACLRight_Read = 0x01, 38 | ACLRight_Write = 0x02, 39 | ACLRight_Execute = 0x04, 40 | ACLRight_Delete = 0x08, 41 | ACLRight_Create = 0x10, 42 | } ACLRight; 43 | 44 | typedef struct 45 | { 46 | unsigned short ServerID; 47 | ACLRight Rights; 48 | } ACL; 49 | 50 | 51 | void Lwm2m_RegisterACLObject(Lwm2mContextType * context); 52 | 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif // LWM2M_ACL_H 59 | -------------------------------------------------------------------------------- /core/src/client/lwm2m_client_cert.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_CLIENT_CERT_H_ 25 | #define LWM2M_CLIENT_CERT_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include 32 | 33 | const unsigned char clientCert[] = { 0x00 34 | }; 35 | 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* LWM2M_CLIENT_CERT_H_ */ 42 | -------------------------------------------------------------------------------- /core/src/client/lwm2m_client_psk.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_CLIENT_PSK_H_ 25 | #define LWM2M_CLIENT_PSK_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | const char * pskIdentity = ""; 33 | 34 | const uint8_t pskKey[] = {0x00}; 35 | 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* LWM2M_CLIENT_PSK_H_ */ 42 | -------------------------------------------------------------------------------- /core/src/common/Makefile.common: -------------------------------------------------------------------------------- 1 | common_src = \ 2 | lwm2m_list.c \ 3 | lwm2m_debug.c \ 4 | lwm2m_util.c \ 5 | lwm2m_object_store.c \ 6 | lwm2m_definition.c \ 7 | lwm2m_attributes.c \ 8 | lwm2m_tree_node.c \ 9 | lwm2m_endpoints.c \ 10 | lwm2m_result.c \ 11 | lwm2m_types.c \ 12 | lwm2m_bootstrap_config.c \ 13 | lwm2m_serdes.c \ 14 | lwm2m_tlv.c \ 15 | lwm2m_opaque.c \ 16 | lwm2m_plaintext.c \ 17 | lwm2m_prettyprint.c \ 18 | lwm2m_tree_builder.c \ 19 | lwm2m_observers.c \ 20 | coap_abstraction_erbium.c 21 | 22 | 23 | ifeq ($(RIOT),) 24 | common_src += network_abstraction_contiki.c \ 25 | lwm2m_util_contiki.c 26 | else 27 | common_src += network_abstraction_posix.c \ 28 | lwm2m_util_posix.c \ 29 | lwm2m_util_riot.c 30 | endif 31 | 32 | 33 | 34 | ifeq ($(TINYDTLS),) 35 | common_src += dtls_abstraction_dummy.c 36 | else 37 | common_src += dtls_abstraction_tinydtls.c 38 | endif 39 | 40 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_context.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_CONTEXT_H 25 | #define LWM2M_CONTEXT_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct _Lwm2mContextType Lwm2mContextType; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif // LWM2M_CONTEXT_H 42 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_json.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_JSON_H 25 | #define LWM2M_JSON_H 26 | 27 | #include "lwm2m_serdes.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | extern const SerialiserDeserialiser jsonSerDes; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif // LWM2M_JSON_H 40 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_limits.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_LIMITS_H 25 | #define LWM2M_LIMITS_H 26 | 27 | #include "lwm2m_types.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | static const ObjectIDType LWM2M_LIMITS_MAX_OBJECT_ID = UINT16_MAX; 34 | static const ObjectInstanceIDType LWM2M_LIMITS_MAX_OBJECT_INSTANCE_ID = UINT16_MAX; 35 | static const ResourceIDType LWM2M_LIMITS_MAX_RESOURCE_ID = UINT16_MAX; 36 | static const ResourceInstanceIDType LWM2M_LIMITS_MAX_RESOURCE_INSTANCE_ID = UINT16_MAX; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // LWM2M_LIMITS_H 43 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_object_defs.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #ifndef LWM2M_OBJECT_DEFS_H_ 24 | #define LWM2M_OBJECT_DEFS_H_ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | void Lwm2m_RegisterObjectTypes(Lwm2mContextType * context); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif // LWM2M_OBJECT_DEFS_H_ 37 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_opaque.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_OPAQUE_H 25 | #define LWM2M_OPAQUE_H 26 | 27 | #include "lwm2m_serdes.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | extern const SerialiserDeserialiser opaqueSerDes; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif // LWM2M_OPAQUE_H 40 | 41 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_plaintext.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #ifndef LWM2M_PLAIN_TEXT_H 24 | #define LWM2M_PLAIN_TEXT_H 25 | 26 | #include "lwm2m_serdes.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | extern const SerialiserDeserialiser plainTextSerDes; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif // LWM2M_PLAIN_TEXT_H 39 | 40 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_prettyprint.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_PRETTYPRINT_H 25 | #define LWM2M_PRETTYPRINT_H 26 | 27 | #include "lwm2m_serdes.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | extern const SerialiserDeserialiser ppSerDes; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif // LWM2M_PRETTYPRINT_H 40 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_request_origin.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_REQUEST_ORIGIN_H 25 | #define LWM2M_REQUEST_ORIGIN_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef enum 32 | { 33 | Lwm2mRequestOrigin_Client, 34 | Lwm2mRequestOrigin_Server, 35 | Lwm2mRequestOrigin_BootstrapServer 36 | } Lwm2mRequestOrigin; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // LWM2M_REQUEST_ORIGIN_H 43 | -------------------------------------------------------------------------------- /core/src/common/lwm2m_tlv.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_TLV_H 25 | #define LWM2M_TLV_H 26 | 27 | #include "lwm2m_serdes.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | extern const SerialiserDeserialiser tlvSerDes; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif // LWM2M_TLV_H 40 | -------------------------------------------------------------------------------- /core/src/erbium/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (awa_erbium_SOURCES 2 | er-coap.c 3 | er-coap-engine.c 4 | er-coap-transactions.c 5 | # er-coap-observe.c 6 | er-coap-separate.c 7 | # er-coap-res-well-known-core.c 8 | er-coap-block1.c 9 | # er-coap-observe-client.c 10 | ) 11 | 12 | # fetch the INCLUDE_DIRECTORIES properties of non-linked dependencies: 13 | # (it is not possible to link with an OBJECT library, so these are not automatic) 14 | #get_property (LIB_XML_INCLUDE_DIR TARGET libxml_static PROPERTY INCLUDE_DIRECTORIES) 15 | get_property (LIB_B64_INCLUDE_DIR TARGET libb64_static PROPERTY INCLUDE_DIRECTORIES) 16 | get_property (LIB_HMAC_INCLUDE_DIR TARGET libhmac_static PROPERTY INCLUDE_DIRECTORIES) 17 | 18 | # currently the API and core are a little tangled so we need to define the include 19 | # path here. the API tests depend on core, which depends on the API. 20 | set (API_INCLUDE_DIR ../../../api/include CACHE INTERNAL "API_INCLUDE_DIR") 21 | 22 | set (awa_erbium_INCLUDE_DIRS 23 | ${API_INCLUDE_DIR} 24 | ${LIB_B64_INCLUDE_DIR} 25 | ${LIB_HMAC_INCLUDE_DIR} 26 | ${CORE_SRC_DIR} 27 | ${CORE_SRC_DIR}/common 28 | ${CORE_SRC_DIR}/client 29 | ${CORE_SRC_DIR}/erbium 30 | #${CORE_SRC_DIR}/../../api/src 31 | #${CORE_SRC_DIR}/../../api/include 32 | ) 33 | 34 | if (ENABLE_GCOV) 35 | set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 --coverage") 36 | set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage") 37 | endif () 38 | 39 | # From Contiki Makefiles 40 | add_definitions (-DREST_MAX_CHUNK_SIZE=512) 41 | add_definitions (-DPOSIX) 42 | remove_definitions (-DWITH_JSON) 43 | #add_definitions (-DUIP_CONF_BUFFER_SIZE=4096) 44 | 45 | # static library liberbiumstatic.a 46 | add_library (awa_erbiumstatic STATIC ${awa_erbium_SOURCES}) 47 | set_target_properties (awa_erbiumstatic PROPERTIES OUTPUT_NAME "erbiumstatic") 48 | set_target_properties (awa_erbiumstatic PROPERTIES POSITION_INDEPENDENT_CODE ON) 49 | target_include_directories(awa_erbiumstatic PUBLIC ${awa_erbium_INCLUDE_DIRS}) 50 | target_link_libraries (awa_erbiumstatic ${awa_erbium_LIBS}) 51 | 52 | # TODO - needed? c.f. libawa_static) 53 | #if (ENABLE_GCOV) 54 | # target_link_libraries (awa_erbiumstatic gcov) 55 | #endif () 56 | 57 | # liberbiumstatic.so 58 | add_library (awa_erbiumstatic_shared SHARED ${awa_erbium_SOURCES}) 59 | set_target_properties (awa_erbiumstatic_shared PROPERTIES OUTPUT_NAME "erbiumstatic") 60 | set_target_properties (awa_erbiumstatic_shared PROPERTIES POSITION_INDEPENDENT_CODE ON) 61 | target_include_directories (awa_erbiumstatic_shared PUBLIC ${awa_erbium_INCLUDE_DIRS}) 62 | target_link_libraries (awa_erbiumstatic_shared ${awa_erbium_LIBS}) 63 | 64 | install (TARGETS awa_erbiumstatic_shared 65 | LIBRARY DESTINATION lib 66 | ) 67 | -------------------------------------------------------------------------------- /core/src/erbium/Makefile.erbium: -------------------------------------------------------------------------------- 1 | erbium_src = er-coap.c \ 2 | er-coap-engine.c \ 3 | er-coap-transactions.c \ 4 | er-coap-separate.c \ 5 | er-coap-block1.c 6 | 7 | # Following not used 8 | # er-coap-observe.c 9 | # er-coap-res-well-known-core.c 10 | # er-coap-observe-client.c 11 | 12 | 13 | CFLAGS += -DREST_MAX_CHUNK_SIZE=512 -DPOSIX -DUIP_CONF_BUFFER_SIZE=4096 -UWITH_JSON -Ucoap_rest_implementation 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /core/src/erbium/er-coap-block1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Lars Schmertmann . 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the Contiki operating system. 30 | */ 31 | 32 | /** 33 | * \file 34 | * CoAP module for block 1 handling 35 | * \author 36 | * Lars Schmertmann 37 | */ 38 | 39 | #ifndef COAP_BLOCK1_H_ 40 | #define COAP_BLOCK1_H_ 41 | 42 | #include 43 | #include 44 | 45 | int coap_block1_handler(void *request, void *response, uint8_t *target, size_t *len, size_t max_len); 46 | 47 | #endif /* COAP_BLOCK1_H_ */ 48 | -------------------------------------------------------------------------------- /core/src/erbium/er-resource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * er-resource.h 3 | * 4 | * Created on: 27/03/2016 5 | * Author: sean 6 | */ 7 | 8 | #ifndef CORE_SRC_ERBIUM_ER_RESOURCE_H_ 9 | #define CORE_SRC_ERBIUM_ER_RESOURCE_H_ 10 | 11 | typedef enum { 12 | NO_FLAGS = 0, 13 | 14 | /* methods to handle */ 15 | METHOD_GET = (1 << 0), 16 | METHOD_POST = (1 << 1), 17 | METHOD_PUT = (1 << 2), 18 | METHOD_DELETE = (1 << 3), 19 | 20 | /* special flags */ 21 | HAS_SUB_RESOURCES = (1 << 4), 22 | IS_SEPARATE = (1 << 5), 23 | IS_OBSERVABLE = (1 << 6), 24 | IS_PERIODIC = (1 << 7) 25 | } rest_resource_flags_t; 26 | 27 | struct resource_s; 28 | 29 | /* signatures of handler functions */ 30 | typedef void (*restful_handler)(void *request, void *response, 31 | uint8_t *buffer, uint16_t preferred_size, 32 | int32_t *offset); 33 | typedef void (*restful_final_handler)(struct resource_s *resource, 34 | void *request, void *response); 35 | typedef void (*restful_periodic_handler)(void); 36 | typedef void (*restful_response_handler)(void *data, void *response); 37 | typedef void (*restful_trigger_handler)(void); 38 | 39 | /* data structure representing a resource in REST */ 40 | struct resource_s { 41 | struct resource_s *next; /* for LIST, points to next resource defined */ 42 | const char *url; /*handled URL */ 43 | rest_resource_flags_t flags; /* handled RESTful methods */ 44 | const char *attributes; /* link-format attributes */ 45 | restful_handler get_handler; /* handler function */ 46 | restful_handler post_handler; /* handler function */ 47 | restful_handler put_handler; /* handler function */ 48 | restful_handler delete_handler; /* handler function */ 49 | union { 50 | struct periodic_resource_s *periodic; /* special data depending on flags */ 51 | restful_trigger_handler trigger; 52 | restful_trigger_handler resume; 53 | }restful_resource_handler; 54 | }; 55 | typedef struct resource_s resource_t; 56 | 57 | #endif /* CORE_SRC_ERBIUM_ER_RESOURCE_H_ */ 58 | -------------------------------------------------------------------------------- /core/src/server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (awa_server_SOURCES 2 | lwm2m_server_core.c 3 | lwm2m_object_defs.c 4 | lwm2m_registration.c 5 | ${CORE_SRC_DIR}/common/lwm2m_serdes.c 6 | ${CORE_SRC_DIR}/common/lwm2m_tlv.c 7 | ${CORE_SRC_DIR}/common/lwm2m_plaintext.c 8 | ${CORE_SRC_DIR}/common/lwm2m_prettyprint.c 9 | ${CORE_SRC_DIR}/common/lwm2m_opaque.c 10 | ${CORE_SRC_DIR}/common/lwm2m_tree_builder.c 11 | ) 12 | 13 | # fetch the INCLUDE_DIRECTORIES properties of non-linked dependencies: 14 | # (it is not possible to link with an OBJECT library, so these are not automatic) 15 | get_property (LIB_XML_INCLUDE_DIR TARGET libxml_static PROPERTY INCLUDE_DIRECTORIES) 16 | get_property (LIB_B64_INCLUDE_DIR TARGET libb64_static PROPERTY INCLUDE_DIRECTORIES) 17 | 18 | set (awa_server_INCLUDE_DIRS 19 | ${LIB_XML_INCLUDE_DIR} 20 | ${LIB_B64_INCLUDE_DIR} 21 | 22 | ${CORE_SRC_DIR} 23 | ${CORE_SRC_DIR}/common 24 | ${CORE_SRC_DIR}/server 25 | 26 | ######################## TODO REMOVE ######################## 27 | # TODO: extract components common to both Core and API 28 | # FIXME: API_INCLUDE_DIR is not in the cmake cache at the time this is read 29 | #${API_INCLUDE_DIR} 30 | #${API_SRC_DIR} 31 | ${CORE_SRC_DIR}/../../api/src 32 | ${CORE_SRC_DIR}/../../api/include 33 | ############################################################# 34 | ) 35 | 36 | if (WITH_JSON) 37 | list (APPEND awa_server_SOURCES 38 | ${CORE_SRC_DIR}/common/lwm2m_json.c 39 | ) 40 | # LIBJSMN_INCLUDE_DIR is a global, as it's set by an imported target 41 | list (APPEND awa_server_INCLUDE_DIRS 42 | ${LIBJSMN_INCLUDE_DIR}) 43 | endif () 44 | 45 | add_definitions (-DLWM2M_SERVER) 46 | 47 | if (ENABLE_GCOV) 48 | set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 --coverage") 49 | set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage") 50 | endif () 51 | 52 | # Virtual library to avoid building .o files twice: 53 | add_library (awa_server_object OBJECT ${awa_server_SOURCES}) 54 | target_include_directories (awa_server_object PRIVATE ${awa_server_INCLUDE_DIRS}) 55 | set_property (TARGET awa_server_object PROPERTY POSITION_INDEPENDENT_CODE ON) 56 | 57 | # static library liblwm2mserver.a 58 | add_library (awa_server_static STATIC $) 59 | set_target_properties (awa_server_static PROPERTIES OUTPUT_NAME "lwm2mserver") 60 | 61 | # shared library liblwm2mserver.so 62 | add_library (awa_server_shared SHARED $) 63 | set_target_properties (awa_server_shared PROPERTIES OUTPUT_NAME "lwm2mserver") 64 | -------------------------------------------------------------------------------- /core/src/server/Makefile: -------------------------------------------------------------------------------- 1 | FILES:=awa_serverd_cmdline 2 | 3 | # prevent autodeletion of intermediate files: 4 | #.SECONDARY: 5 | 6 | all: $(FILES:=.c) 7 | 8 | .PHONY: gen_cmdline 9 | gen_cmdline: $(FILES) 10 | 11 | %_cmdline.c %_cmdline.h: %.ggo 12 | gengetopt --input=$^ --include-getopt --unamed-opts=PATHS --file $*_cmdline 13 | 14 | .PHONY: clean 15 | clean: 16 | rm -f $(FILES:=.c) $(FILES:=.h) 17 | -------------------------------------------------------------------------------- /core/src/server/lwm2m_server_psk.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_SERVER_PSK_H_ 25 | #define LWM2M_SERVER_PSK_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | const char * pskIdentity = "oFIrQFrW8EWcZ5u7eGfrkw"; 32 | 33 | const uint8_t pskKey[] = { 34 | 0x7C, 0xCD, 0xE1, 0x4A, 0x5C, 0xF3, 0xB7, 0x1C, 0x0C, 0x08, 0xC8, 0xB7, 0xF9, 0xE5 35 | }; 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* LWM2M_SERVER_PSK_H_ */ 43 | -------------------------------------------------------------------------------- /core/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (test_core_runner_SOURCES 2 | main.cc 3 | 4 | test_lwm2m_core.cc 5 | test_object_store_interface.cc 6 | test_template.cc 7 | test_tlv.cc 8 | test_definition_registry.cc 9 | test_plaintext.cc 10 | test_prettyprint.cc 11 | test_lwm2m_types.cc 12 | 13 | test_lwm2m_tree.cc 14 | test_lwm2m_tree_builder.cc 15 | unit_support.cc 16 | test_object_tree.cc 17 | 18 | lwm2m_device_object.c 19 | ) 20 | 21 | set (test_core_runner_INCLUDE_DIRS 22 | ${GTEST_INCLUDE_DIR} 23 | ${CORE_SRC_DIR} 24 | ${CORE_SRC_DIR}/common 25 | ${CORE_SRC_DIR}/client 26 | ) 27 | 28 | set (test_core_runner_LIBRARIES 29 | gtest 30 | pthread 31 | awa_static 32 | awa_common_static 33 | ) 34 | 35 | if (WITH_JSON) 36 | list (APPEND test_core_runner_SOURCES 37 | test_json.cc 38 | ) 39 | endif () 40 | 41 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -g -std=c++11") 42 | if (ENABLE_GCOV) 43 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage") 44 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") 45 | set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") 46 | endif () 47 | 48 | add_definitions (-DLWM2M_CLIENT -D__STDC_FORMAT_MACROS) 49 | 50 | add_executable (test_core_runner ${test_core_runner_SOURCES}) 51 | target_include_directories (test_core_runner PRIVATE ${test_core_runner_INCLUDE_DIRS}) 52 | target_link_libraries (test_core_runner ${test_core_runner_LIBRARIES}) 53 | 54 | if (ENABLE_GCOV) 55 | target_link_libraries (test_core_runner gcov) 56 | endif () 57 | 58 | # Testing 59 | add_custom_command ( 60 | OUTPUT test_core_runner_out.xml 61 | COMMAND test_core_runner --gtest_output=xml:test_core_runner_out.xml 62 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 63 | VERBATIM 64 | ) 65 | 66 | if (RUN_TESTS) 67 | # always run test_core_runner 68 | add_custom_target ( 69 | test_core_runner_TARGET ALL 70 | DEPENDS test_core_runner_out.xml 71 | ) 72 | endif () 73 | -------------------------------------------------------------------------------- /core/tests/lwm2m_device_object.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_DEVICE_H 25 | #define LWM2M_DEVICE_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | #include "lwm2m_core.h" 33 | 34 | 35 | void Lwm2m_RegisterDeviceObject(Lwm2mContextType * context); 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // LWM2M_DEVICE_H 43 | -------------------------------------------------------------------------------- /core/tests/main.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | GTEST_API_ int main(int argc, char **argv) { 28 | testing::InitGoogleTest(&argc, argv); 29 | return RUN_ALL_TESTS(); 30 | } 31 | -------------------------------------------------------------------------------- /core/tests/test_template.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class TemplateTestSuite : public testing::Test 29 | { 30 | void SetUp() { } 31 | void TearDown() { } 32 | }; 33 | 34 | TEST_F(TemplateTestSuite, test_template1) 35 | { 36 | ASSERT_EQ(0, 0); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /core/tests/unit_support.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | /******************************************************** 24 | *** Unit Test Common Test Support Functions 25 | *******************************************************/ 26 | 27 | #include "unit_support.h" 28 | -------------------------------------------------------------------------------- /core/tests/unit_support.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #ifndef UNIT_SUPPORT_H 24 | #define UNIT_SUPPORT_H 25 | 26 | /******************************************************** 27 | *** Unit Test Common Test Support Functions 28 | *******************************************************/ 29 | 30 | #endif // UNIT_SUPPORT_H 31 | -------------------------------------------------------------------------------- /daemon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (WITH_JSON) 2 | add_definitions (-DWITH_JSON) 3 | endif () 4 | 5 | add_definitions (-DPOSIX) 6 | 7 | add_subdirectory (src) 8 | 9 | if (BUILD_TESTS) 10 | add_subdirectory (tests) 11 | endif () 12 | -------------------------------------------------------------------------------- /daemon/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (DAEMON_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "DAEMON_SRC_DIR") 2 | 3 | set (CMAKE_C_FLAGS_DEBUG "-Wall -Werror -Wno-pointer-sign -g -DVERSION='\"${VERSION}\"' -D_GNU_SOURCE") 4 | set (CMAKE_C_FLAGS_RELEASE "-Os -Wall -Werror -Wno-pointer-sign -DVERSION='\"${VERSION}\"' -D_GNU_SOURCE") 5 | #SET(CMAKE_C_ARCHIVE_CREATE " rcs ") 6 | 7 | add_subdirectory (bootstrap) 8 | add_subdirectory (client) 9 | add_subdirectory (server) 10 | -------------------------------------------------------------------------------- /daemon/src/bootstrap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (awa_bootstrapd_SOURCES 2 | awa_bootstrapd_cmdline.c 3 | lwm2m_bootstrap_server.c 4 | ) 5 | 6 | set (awa_bootstrapd_INCLUDE_DIRS 7 | ${CORE_SRC_DIR} 8 | ${CORE_SRC_DIR}/common 9 | ${CORE_SRC_DIR}/bootstrap 10 | 11 | ${DAEMON_SRC_DIR}/common 12 | 13 | ) 14 | 15 | if (WITH_JSON) 16 | list (APPEND awa_bootstrapd_SOURCES 17 | ${CORE_SRC_DIR}/common/lwm2m_json.c 18 | ) 19 | # LIBJSMN_INCLUDE_DIR is a global, as it's set by an imported target 20 | list (APPEND awa_bootstrapd_INCLUDE_DIRS 21 | ${LIBJSMN_INCLUDE_DIR} 22 | ) 23 | endif () 24 | 25 | add_definitions (-DLWM2M_BOOTSTRAP) 26 | 27 | if (ENABLE_GCOV) 28 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage") 29 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") 30 | endif () 31 | 32 | # disable -Wall warnings for _cmdline.c files 33 | set_source_files_properties (awa_bootstrapd_cmdline.c PROPERTIES COMPILE_FLAGS -Wno-all) 34 | 35 | add_executable (awa_bootstrapd ${awa_bootstrapd_SOURCES}) 36 | target_include_directories (awa_bootstrapd PRIVATE ${awa_bootstrapd_INCLUDE_DIRS}) 37 | target_link_libraries (awa_bootstrapd awa_bootstrap_server_static awa_common_static libb64_static libxml_static) 38 | 39 | if (ENABLE_GCOV) 40 | target_link_libraries (awa_bootstrapd gcov) 41 | endif () 42 | 43 | install (TARGETS awa_bootstrapd 44 | RUNTIME DESTINATION bin 45 | ) 46 | 47 | -------------------------------------------------------------------------------- /daemon/src/bootstrap/awa_bootstrapd.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | package "awa_bootstrapd" 3 | purpose "Awa LWM2M Bootstrap Server" 4 | versiontext "Copyright (c) 2016 Imagination Technologies Limited and/or its affiliated group companies." 5 | args "--no-version" 6 | 7 | option "ip" a "Accept client bootstrap requests on IP address ADDR" string optional default="0.0.0.0" typestr="ADDR" 8 | option "interface" e "Accept client bootstrap requests on network interface IF" string optional typestr="IF" 9 | option "addressFamily" f "Address family for network interface. AF=4 for IPv4, AF=6 for IPv6" 10 | int optional default="4" typestr="AF" values="4","6" 11 | option "port" p "Use port number PORT for CoAP communications" int optional default="15685" typestr="PORT" 12 | option "config" c "Load server list configuration from FILE" string optional typestr="FILE" multiple(1-4) 13 | option "secure" s "CoAP communications are secured with DTLS" flag off 14 | option "daemonize" d "Detach process from terminal and run in the background" flag off 15 | option "verbose" v "Generate verbose output" flag off 16 | option "logFile" l "Log output to FILE" string optional typestr="FILE" 17 | option "version" V "Print version and exit" flag off 18 | 19 | text "\n" 20 | text "Example:\n" 21 | text " awa_bootstrapd --port 15685 --config bootstrap.config\n" 22 | text "\n" 23 | -------------------------------------------------------------------------------- /daemon/src/common/lwm2m_events.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #include "lwm2m_events.h" 24 | 25 | EventContext * EventContext_New(const RequestInfoType * request) 26 | { 27 | EventContext * eventContext = malloc(sizeof(*eventContext)); 28 | if (eventContext != NULL) 29 | { 30 | memset(eventContext, 0, sizeof(*eventContext)); 31 | eventContext->SessionID = request->SessionID; 32 | } 33 | return eventContext; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /daemon/src/common/lwm2m_events.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_EVENTS_H 25 | #define LWM2M_EVENTS_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #include "lwm2m_xml_interface.h" 35 | #include "lwm2m_context.h" 36 | #include "ipc_session.h" 37 | 38 | typedef struct 39 | { 40 | IPCSessionID SessionID; 41 | 42 | } EventContext; 43 | 44 | EventContext * EventContext_New(const RequestInfoType * request); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif // LWM2M_EVENTS_H 51 | -------------------------------------------------------------------------------- /daemon/src/common/objdefs.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #ifndef OBJDEFS_H 24 | #define OBJDEFS_H 25 | 26 | #include "lwm2m_context.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | int LoadObjectDefinitionsFromFiles(Lwm2mContextType * context, const char ** filenames, size_t numFilenames); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif // OBJDEFS_H 39 | -------------------------------------------------------------------------------- /daemon/src/server/awa_serverd.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | package "awa_serverd" 3 | purpose "Awa LWM2M Server" 4 | versiontext "Copyright (c) 2016 Imagination Technologies Limited and/or its affiliated group companies." 5 | args "--no-version" 6 | 7 | option "ip" a "Accept client registration requests on IP address ADDR" string optional default="0.0.0.0" typestr="ADDR" 8 | option "interface" e "Accept client registration requests on network interface IF" string optional typestr="IF" 9 | option "addressFamily" f "Address family for network interface. AF=4 for IPv4, AF=6 for IPv6" 10 | int optional default="4" typestr="AF" values="4","6" 11 | option "port" p "Use port number PORT for CoAP communications" int optional default="5683" typestr="PORT" 12 | option "ipcPort" i "Use port number PORT for IPC communications" int optional default="54321" typestr="PORT" 13 | option "contentType" m "Use Content Type ID (TLV=1542, JSON=50)" int optional default="1542" typestr="ID" values="50","1542" 14 | option "secure" s "CoAP communications are secured with DTLS" flag off 15 | option "objDefs" o "Load object and resource definitions from FILE" string optional typestr="FILE" multiple(1-16) 16 | option "daemonize" d "Detach process from terminal and run in the background" flag off 17 | option "verbose" v "Generate verbose output" flag off 18 | option "logFile" l "Log output to FILE" string optional typestr="FILE" 19 | option "version" V "Print version and exit" flag off 20 | 21 | text "\n" 22 | text "Example:\n" 23 | text " awa_serverd --interface eth0 --addressFamily 4 --port 5683\n" 24 | text "\n" 25 | -------------------------------------------------------------------------------- /daemon/src/server/lwm2m_server_xml_events.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_SERVER_XML_EVENTS_H 25 | #define LWM2M_SERVER_XML_EVENTS_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #include "lwm2m_registration.h" 35 | #include "lwm2m_context.h" 36 | 37 | void xmlif_HandleRegistrationEvent(RegistrationEventType eventType, void * context, void * parameter); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif // LWM2M_SERVER_XML_EVENTS_H 44 | -------------------------------------------------------------------------------- /daemon/src/server/lwm2m_server_xml_handlers.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef LWM2M_SERVER_XML_HANDLERS_H 25 | #define LWM2M_SERVER_XML_HANDLERS_H 26 | 27 | #include 28 | 29 | #include "lwm2m_object_store.h" 30 | #include "lwm2m_util.h" 31 | #include "lwm2m_definition.h" 32 | #include "lwm2m_xml_interface.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | void xmlif_RegisterHandlers(void); 39 | TreeNode xmlif_ConstructObjectDefinitionNode(const DefinitionRegistry * definitions, const ObjectDefinition * objFormat, int objectID); 40 | 41 | DefinitionCount xmlif_ParseObjDefDeviceServerXml(Lwm2mContextType * context, TreeNode content); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif // LWM2M_SERVER_XML_HANDLERS_H 48 | -------------------------------------------------------------------------------- /daemon/src/server/lwm2m_server_xml_registered_entity_tree.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #ifndef LWM2M_SERVER_XML_REGISTERED_ENTITY_TREE_H 24 | #define LWM2M_SERVER_XML_REGISTERED_ENTITY_TREE_H 25 | 26 | #include "lwm2m_registration.h" 27 | 28 | TreeNode BuildRegisteredEntityTree(const Lwm2mClientType * client); 29 | 30 | #endif // LWM2M_SERVER_XML_REGISTERED_ENTITY_TREE_H 31 | -------------------------------------------------------------------------------- /daemon/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (test_daemon_runner_SOURCES 2 | main.cc 3 | 4 | test_xml.cc 5 | 6 | ${DAEMON_SRC_DIR}/client/lwm2m_client_xml_handlers.c 7 | ${DAEMON_SRC_DIR}/common/lwm2m_xml_interface.c 8 | ${DAEMON_SRC_DIR}/common/lwm2m_xml_serdes.c 9 | ${DAEMON_SRC_DIR}/common/lwm2m_ipc.c 10 | ${DAEMON_SRC_DIR}/common/ipc_session.c 11 | ${DAEMON_SRC_DIR}/common/xml.c 12 | ${DAEMON_SRC_DIR}/common/objdefs.c 13 | 14 | ######################## TODO REMOVE ######################## 15 | # TODO: extract components common to both Core and API 16 | # FIXME: API_SRC_DIR is not in the cmake cache at the time this is read 17 | #${API_SRC_DIR}/path.c 18 | #${API_SRC_DIR}/objects_tree.c 19 | #${API_SRC_DIR}/log.c 20 | #${API_SRC_DIR}/error.c 21 | #${API_SRC_DIR}/utils.c 22 | ${CORE_SRC_DIR}/../../api/src/path.c 23 | ${CORE_SRC_DIR}/../../api/src/objects_tree.c 24 | ${CORE_SRC_DIR}/../../api/src/log.c 25 | ${CORE_SRC_DIR}/../../api/src/error.c 26 | ${CORE_SRC_DIR}/../../api/src/lwm2m_error.c 27 | ${CORE_SRC_DIR}/../../api/src/utils.c 28 | ############################################################# 29 | ) 30 | 31 | set (test_daemon_runner_INCLUDE_DIRS 32 | ${GTEST_INCLUDE_DIR} 33 | ${CORE_SRC_DIR} 34 | ${CORE_SRC_DIR}/common 35 | ${CORE_SRC_DIR}/client 36 | ${DAEMON_SRC_DIR} 37 | ${DAEMON_SRC_DIR}/common 38 | ) 39 | 40 | set (test_daemon_runner_LIBRARIES 41 | gtest 42 | pthread 43 | awa_static 44 | awa_common_static 45 | libxml_static 46 | libb64_static 47 | ) 48 | 49 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -g -std=c++11") 50 | if (ENABLE_GCOV) 51 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage") 52 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") 53 | set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") 54 | endif () 55 | 56 | add_definitions (-DLWM2M_CLIENT -D__STDC_FORMAT_MACROS) 57 | 58 | add_executable (test_daemon_runner ${test_daemon_runner_SOURCES}) 59 | target_include_directories (test_daemon_runner PRIVATE ${test_daemon_runner_INCLUDE_DIRS}) 60 | target_link_libraries (test_daemon_runner ${test_daemon_runner_LIBRARIES}) 61 | 62 | if (ENABLE_GCOV) 63 | target_link_libraries (test_daemon_runner gcov) 64 | endif () 65 | 66 | # Testing 67 | add_custom_command ( 68 | OUTPUT test_daemon_runner_out.xml 69 | COMMAND test_daemon_runner --gtest_output=xml:test_daemon_runner_out.xml 70 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 71 | VERBATIM 72 | ) 73 | 74 | if (RUN_TESTS) 75 | # always run test_daemon_runner 76 | add_custom_target ( 77 | test_daemon_runner_TARGET ALL 78 | DEPENDS test_daemon_runner_out.xml 79 | ) 80 | endif () 81 | -------------------------------------------------------------------------------- /daemon/tests/main.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | GTEST_API_ int main(int argc, char **argv) { 28 | testing::InitGoogleTest(&argc, argv); 29 | return RUN_ALL_TESTS(); 30 | } 31 | -------------------------------------------------------------------------------- /doc/3rdparty.md: -------------------------------------------------------------------------------- 1 | 2 | ![](images/img.png) 3 | 4 | ---- 5 | 6 | # Awa LightweightM2M 7 | 8 | ## Connecting the Awa LightweightM2M client to third-party servers 9 | 10 | ### Wakaama (bootstrap) / Leshan (server) 11 | 12 | The *awa_clientd* daemon can connect to both the Wakaama and Leshan servers. These are third-party LWM2M servers provided by the Eclipse Foundation. The following instructions outline how to use the Wakaama bootstrap server and a Leshan server. 13 | 14 | Compile and run the Wakaama bootstrap server. You may need to edit *bootstrap_server.ini* to decrease the *lifetime* setting, though the remaining settings are pre-configured for Leshan: 15 | 16 | ```` 17 | $ git clone https://github.com/eclipse/wakaama.git 18 | $ mkdir bootstrap 19 | $ cd bootstrap 20 | $ bootstrap> cmake ../wakaama/tests/bootstrap_server 21 | $ bootstrap> make 22 | $ bootstrap> cp ../wakaama/tests/bootstrap_server/bootstrap_server.ini . 23 | 24 | $ bootstrap> vi bootstrap_server.ini 25 | 26 | # Information for the Leshan sandbox server hosted by 27 | # the Eclipse Foundation 28 | [Server] 29 | id=2 30 | uri=coap://leshan.eclipse.org:5683 31 | bootstrap=no 32 | lifetime=300 << change this to 20 33 | security=NoSec 34 | 35 | $ bootstrap> ./bootstrap_server -p 15678 36 | ```` 37 | 38 | Run the Imagination LWM2M client with the above bootstrap server address specified: 39 | 40 | ```` 41 | $ build/daemon/src/client/awa_clientd --bootstrap coap://0.0.0.0:15678 --verbose --endPointName imaginationtest 42 | ```` 43 | 44 | Open http://leshan.eclipse.org/ in your web browser. 45 | 46 | ### Wakaama (server) 47 | 48 | Assuming you have already built the bootstrap server, modify the configuration and start the bootstrap server: 49 | 50 | ```` 51 | $ bootstrap> vi bootstrap_server.ini 52 | 53 | # Information for the Leshan sandbox server hosted by 54 | # the Eclipse Foundation 55 | [Server] 56 | id=2 57 | uri=coap://0.0.0.0:5683 << change this to local host 58 | bootstrap=no 59 | lifetime=10 60 | security=NoSec 61 | 62 | $ bootstrap> ./bootstrap_server -p 15678 63 | ```` 64 | 65 | Compile and run the wakaama server: 66 | 67 | ```` 68 | $ mkdir server 69 | $ cd server 70 | $ server> cmake ../wakaama/tests/server 71 | $ server> make 72 | $ server> ./lwm2mserver 73 | ```` 74 | 75 | Run the Awa LightweightM2M client: 76 | 77 | ```` 78 | $ build/daemon/src/client/awa_clientd --bootstrap coap://0.0.0.0:15678 --verbose --endPointName imaginationtest 79 | ```` 80 | 81 | The Wakaama client will show the registration attempt. 82 | 83 | ---- 84 | -------------------------------------------------------------------------------- /doc/images/Awa LightweightM2M document map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa LightweightM2M document map.png -------------------------------------------------------------------------------- /doc/images/Awa_LWM2M_application_overview_constrained_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_LWM2M_application_overview_constrained_device.png -------------------------------------------------------------------------------- /doc/images/Awa_LWM2M_bootstrap_server-interfaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_LWM2M_bootstrap_server-interfaces.png -------------------------------------------------------------------------------- /doc/images/Awa_LWM2M_server_interfaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_LWM2M_server_interfaces.png -------------------------------------------------------------------------------- /doc/images/Awa_application_overview-gateway_indicated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_application_overview-gateway_indicated.png -------------------------------------------------------------------------------- /doc/images/Awa_application_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_application_overview.png -------------------------------------------------------------------------------- /doc/images/Awa_client_API_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_client_API_structure.png -------------------------------------------------------------------------------- /doc/images/Awa_client_tutorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_client_tutorial.png -------------------------------------------------------------------------------- /doc/images/Awa_client_tutorial_application_positioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_client_tutorial_application_positioning.png -------------------------------------------------------------------------------- /doc/images/Awa_client_tutorial_application_positioning_static_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_client_tutorial_application_positioning_static_api.png -------------------------------------------------------------------------------- /doc/images/Awa_client_tutorial_object_description.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_client_tutorial_object_description.png -------------------------------------------------------------------------------- /doc/images/Awa_client_tutorial_static_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_client_tutorial_static_api.png -------------------------------------------------------------------------------- /doc/images/Awa_static_API_constrained_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/Awa_static_API_constrained_device.png -------------------------------------------------------------------------------- /doc/images/FlowM2M_application_overview_constrained_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/FlowM2M_application_overview_constrained_device.png -------------------------------------------------------------------------------- /doc/images/LWM2M_object_referencing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/LWM2M_object_referencing.png -------------------------------------------------------------------------------- /doc/images/awa_client_interfaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/awa_client_interfaces.png -------------------------------------------------------------------------------- /doc/images/client-tutorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/client-tutorial.png -------------------------------------------------------------------------------- /doc/images/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/img.png -------------------------------------------------------------------------------- /doc/images/pointer_mode_sparse_resource_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/pointer_mode_sparse_resource_distribution.png -------------------------------------------------------------------------------- /doc/images/pointer_mode_uniform_resource_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/pointer_mode_uniform_resource_distribution.png -------------------------------------------------------------------------------- /doc/images/server-tutorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectivityFoundry/AwaLWM2M/2f3d3f8533bdde80796b51b32a325c229fab271e/doc/images/server-tutorial.png -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory (b64) 2 | add_subdirectory (hmac) 3 | if (WITH_LIBCOAP) 4 | add_subdirectory (libcoap) 5 | endif () 6 | add_subdirectory (xml) 7 | 8 | if (WITH_JSON) 9 | add_subdirectory (jsmn) 10 | endif () 11 | 12 | if (WITH_TINYDTLS) 13 | add_subdirectory (tinydtls) 14 | endif () 15 | 16 | if (BUILD_TESTS) 17 | # gtest is CMake-enabled 18 | # defines libraries 'gtest' and 'gtest-main' 19 | add_subdirectory (gtest) 20 | # set (GTEST_INCLUDE_DIR ${gtest_SOURCE_DIR}/include CACHE INTERNAL "GTEST_INCLUDE_DIR") 21 | endif () 22 | -------------------------------------------------------------------------------- /lib/b64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library (libb64_static b64.c) 2 | set_property (TARGET libb64_static PROPERTY POSITION_INDEPENDENT_CODE ON) 3 | set_target_properties (libb64_static PROPERTIES OUTPUT_NAME "b64") 4 | target_include_directories (libb64_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 5 | -------------------------------------------------------------------------------- /lib/b64/Makefile.b64: -------------------------------------------------------------------------------- 1 | b64_src = \ 2 | b64.c 3 | -------------------------------------------------------------------------------- /lib/gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(googletest NONE) 4 | 5 | if (DEFINED CMAKE_TOOLCHAIN_FILE) 6 | set(CMAKE_EXTRA_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 7 | endif() 8 | 9 | Include (ExternalProject) 10 | ExternalProject_Add(googletest 11 | GIT_REPOSITORY https://github.com/google/googletest 12 | GIT_TAG ff07a5de0e81580547f1685e101194ed1a4fcd56 13 | CMAKE_ARGS ${CMAKE_EXTRA_ARGS} 14 | SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src" 15 | BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build" 16 | UPDATE_COMMAND "" 17 | INSTALL_COMMAND "" 18 | ) 19 | 20 | set (GTEST_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gtest-src/googletest/include CACHE INTERNAL "GTEST_INCLUDE_DIR") 21 | 22 | add_library(gtest STATIC IMPORTED GLOBAL) 23 | set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/gtest-build/googlemock/gtest/libgtest.a") 24 | #set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}) 25 | 26 | -------------------------------------------------------------------------------- /lib/hmac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library (libhmac_static hmac.c) 2 | set_property (TARGET libhmac_static PROPERTY POSITION_INDEPENDENT_CODE ON) 3 | set_target_properties (libhmac_static PROPERTIES OUTPUT_NAME "hmac") 4 | target_include_directories (libhmac_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 5 | -------------------------------------------------------------------------------- /lib/hmac/Makefile.hmac: -------------------------------------------------------------------------------- 1 | hmac_src = \ 2 | hmac.c 3 | -------------------------------------------------------------------------------- /lib/hmac/hmac.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | #ifndef HMAC_256_H 24 | #define HMAC_256_H 25 | 26 | #define SHA256_HASH_LENGTH 32 27 | 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * @brief Compute a Hmac using SHA256 of the data provided and write the result into a buffer 36 | * @param[out] hash - buffer to store resulting hash 37 | * @param[in] data - pointer to data to hash 38 | * @param[in] dataLen - length of data in buffer 39 | * @param[in] key - pointer to key 40 | * @param[in] keyLen - length of key 41 | */ 42 | void HmacSha256_ComputeHash(uint8_t hash[SHA256_HASH_LENGTH], const uint8_t * data, int dataLen, const uint8_t * key, int keyLen); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /lib/jsmn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(libjsmn NONE) 4 | 5 | if (DEFINED CMAKE_TOOLCHAIN_FILE) 6 | set(CMAKE_EXTRA_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 7 | endif() 8 | 9 | Include (ExternalProject) 10 | ExternalProject_Add(libjsmn 11 | HG_REPOSITORY https://bitbucket.org/azimoff/jsmn 12 | HG_TAG 4b14865 13 | CMAKE_ARGS ${CMAKE_EXTRA_ARGS} 14 | SOURCE_DIR "${CMAKE_BINARY_DIR}/libjsmn-src" 15 | BINARY_DIR "${CMAKE_BINARY_DIR}/libjsmn-build" 16 | UPDATE_COMMAND "" 17 | INSTALL_COMMAND "" 18 | PATCH_COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_BINARY_DIR}/libjsmn-src/CMakeLists.txt 19 | ) 20 | 21 | # target properties are not allowed for imported targets, so for now use a global variable 22 | # for this until we find a way of setting the property on the libjsmn_static target 23 | set (LIBJSMN_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libjsmn-src ${CMAKE_BINARY_DIR}/libjsmn-build CACHE INTERNAL "") 24 | 25 | add_library(libjsmn_static STATIC IMPORTED GLOBAL) 26 | set_target_properties(libjsmn_static PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/libjsmn-build/libjsmn.a") 27 | 28 | -------------------------------------------------------------------------------- /lib/jsmn/CMakeLists.txt.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | add_library (libjsmn_static jsmn.c) 4 | set_property (TARGET libjsmn_static PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | add_compile_options (-Wall -O2) 6 | target_compile_definitions (libjsmn_static PRIVATE -DJSMN_FIRST_CHILD_NEXT_SIBLING) 7 | set_target_properties (libjsmn_static PROPERTIES OUTPUT_NAME "jsmn") 8 | target_include_directories (libjsmn_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 9 | -------------------------------------------------------------------------------- /lib/jsmn/apply_patches: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for x in $1/*.patch; do patch < $x; done 4 | -------------------------------------------------------------------------------- /lib/libcoap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(libcoap NONE) 4 | 5 | if (DEFINED CMAKE_TOOLCHAIN_FILE) 6 | set(CMAKE_EXTRA_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 7 | endif() 8 | 9 | Include (ExternalProject) 10 | ExternalProject_Add(libcoap 11 | GIT_REPOSITORY https://github.com/obgm/libcoap 12 | GIT_TAG d48ab449fd05801e574e4966023589ed7dac500b 13 | CMAKE_ARGS ${CMAKE_EXTRA_ARGS} 14 | SOURCE_DIR "${CMAKE_BINARY_DIR}/libcoap-src" 15 | BINARY_DIR "${CMAKE_BINARY_DIR}/libcoap-build" 16 | UPDATE_COMMAND "" 17 | INSTALL_COMMAND "" 18 | PATCH_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/apply_patches ${CMAKE_CURRENT_SOURCE_DIR}/patches 19 | ) 20 | 21 | # for now use a global variable for this until we find a way of setting the property on the libcoap_static target 22 | set (LIBCOAP_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libcoap-src ${CMAKE_BINARY_DIR}/libcoap-build CACHE INTERNAL "") 23 | 24 | add_library(libcoap_static STATIC IMPORTED GLOBAL) 25 | set_target_properties(libcoap_static PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/libcoap-build/libcoap.a") 26 | #set_target_properties(libcoap_static PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${LIBCOAP_INCLUDE_DIR}) 27 | 28 | 29 | -------------------------------------------------------------------------------- /lib/libcoap/apply_patches: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for x in $1/*.patch; do patch < $x; done 4 | -------------------------------------------------------------------------------- /lib/libcoap/patches/002-libcoap.coap_io.patch: -------------------------------------------------------------------------------- 1 | diff --git a/coap_io.c b/coap_io.c 2 | index 073730d..0539fb8 100644 3 | --- a/coap_io.c 4 | +++ b/coap_io.c 5 | @@ -36,6 +36,7 @@ 6 | #include "debug.h" 7 | #include "mem.h" 8 | #include "coap_io.h" 9 | +#include "pdu.h" 10 | 11 | #ifndef CUSTOM_COAP_NETWORK_ENDPOINT 12 | 13 | @@ -175,6 +176,7 @@ coap_free_endpoint(coap_endpoint_t *ep) { 14 | 15 | #ifndef CUSTOM_COAP_NETWORK_SEND 16 | 17 | +#ifndef HAVE_PKT6INFO 18 | /* define struct in6_pktinfo and struct in_pktinfo if not available 19 | FIXME: check with configure 20 | */ 21 | @@ -182,13 +184,15 @@ struct in6_pktinfo { 22 | struct in6_addr ipi6_addr; /* src/dst IPv6 address */ 23 | unsigned int ipi6_ifindex; /* send/recv interface index */ 24 | }; 25 | +#endif 26 | 27 | +#ifndef HAVE_PKTINFO 28 | struct in_pktinfo { 29 | int ipi_ifindex; 30 | struct in_addr ipi_spec_dst; 31 | struct in_addr ipi_addr; 32 | }; 33 | - 34 | +#endif 35 | #ifdef __GNUC__ 36 | #define UNUSED_PARAM __attribute__ ((unused)) 37 | #else /* not a GCC */ 38 | @@ -414,8 +418,9 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) { 39 | memcpy(&(*packet)->dst.addr.sin.sin_addr, 40 | &u.p->ipi_addr, sizeof(struct in_addr)); 41 | 42 | - (*packet)->src.size = mhdr.msg_namelen; 43 | - memcpy(&(*packet)->src.addr.st, mhdr.msg_name, (*packet)->src.size); 44 | + (*packet)->src.size = mhdr.msg_namelen; 45 | + // This causes a valgrind overlap error and doesn't seem to be useful either (see line 353) 46 | + //memcpy(&(*packet)->src.addr.st, mhdr.msg_name, (*packet)->src.size); 47 | 48 | break; 49 | } 50 | -------------------------------------------------------------------------------- /lib/tinydtls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(tinydtls NONE) 4 | 5 | if (DEFINED CMAKE_TOOLCHAIN_FILE) 6 | set(CMAKE_EXTRA_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 7 | endif() 8 | 9 | Include (ExternalProject) 10 | ExternalProject_Add(tinydtls 11 | GIT_REPOSITORY https://git.eclipse.org/r/tinydtls/org.eclipse.tinydtls 12 | GIT_TAG 0016138fe3998552eee3987a1c09da43a23c9fb5 13 | CMAKE_ARGS ${CMAKE_EXTRA_ARGS} 14 | SOURCE_DIR "${CMAKE_BINARY_DIR}/tinydtls-src" 15 | BINARY_DIR "${CMAKE_BINARY_DIR}/tinydtls-build" 16 | UPDATE_COMMAND "" 17 | INSTALL_COMMAND "" 18 | PATCH_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/apply_patches ${CMAKE_CURRENT_SOURCE_DIR}/patches 19 | ) 20 | 21 | # for now use a global variable for this until we find a way of setting the property on the tinydtls_static target 22 | set (TINYDTLS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/tinydtls-src ${CMAKE_BINARY_DIR}/tinydtls-build CACHE INTERNAL "") 23 | 24 | add_library(tinydtls_static STATIC IMPORTED GLOBAL) 25 | set_target_properties(tinydtls_static PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/tinydtls-build/libtinydtls.a") 26 | #set_target_properties(tinydtls_static PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${TINYDTLS_INCLUDE_DIR}) 27 | 28 | 29 | -------------------------------------------------------------------------------- /lib/tinydtls/apply_patches: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for x in $1/*.patch; do patch < $x; done 4 | -------------------------------------------------------------------------------- /lib/tinydtls/patches/002-tinydtls.h.patch: -------------------------------------------------------------------------------- 1 | diff --git a/tinydtls.h b/tinydtls.h 2 | new file mode 100644 3 | index 0000000..4e18909 4 | --- /dev/null 5 | +++ b/tinydtls.h 6 | @@ -0,0 +1,27 @@ 7 | +/******************************************************************************* 8 | + * 9 | + * Copyright (c) 2011, 2012, 2013, 2014, 2015 Olaf Bergmann (TZI) and others. 10 | + * All rights reserved. This program and the accompanying materials 11 | + * are made available under the terms of the Eclipse Public License v1.0 12 | + * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 13 | + * 14 | + * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 15 | + * and the Eclipse Distribution License is available at 16 | + * http://www.eclipse.org/org/documents/edl-v10.php. 17 | + * 18 | + * Contributors: 19 | + * Olaf Bergmann - initial API and implementation 20 | + * Hauke Mehrtens - memory optimization, ECC integration 21 | + * 22 | + *******************************************************************************/ 23 | + 24 | +/** 25 | + * @file tinydtls.h 26 | + * @brief public tinydtls API 27 | + */ 28 | + 29 | +#ifndef _DTLS_TINYDTLS_H_ 30 | +#define _DTLS_TINYDTLS_H_ 31 | + 32 | + 33 | +#endif /* _DTLS_TINYDTLS_H_ */ 34 | 35 | -------------------------------------------------------------------------------- /lib/tinydtls/patches/004-psk-length.patch: -------------------------------------------------------------------------------- 1 | diff --git a/crypto.h b/crypto.h 2 | index f434618..fde1221 100644 3 | --- a/crypto.h 4 | +++ b/crypto.h 5 | @@ -36,13 +36,16 @@ 6 | #define DTLS_MAC_LENGTH DTLS_HMAC_DIGEST_SIZE 7 | #define DTLS_IV_LENGTH 4 /* length of nonce_explicit */ 8 | 9 | +/* This is the maximal supported length of the pre-shared key. */ 10 | +#define DTLS_PSK_MAX_KEY_LEN 32 11 | + 12 | /** 13 | * Maximum size of the generated keyblock. Note that MAX_KEYBLOCK_LENGTH must 14 | * be large enough to hold the pre_master_secret, i.e. twice the length of the 15 | * pre-shared key + 1. 16 | */ 17 | #define MAX_KEYBLOCK_LENGTH \ 18 | - (2 * DTLS_MAC_KEY_LENGTH + 2 * DTLS_KEY_LENGTH + 2 * DTLS_IV_LENGTH) 19 | + (2 * DTLS_MAC_KEY_LENGTH + 2 * DTLS_PSK_MAX_KEY_LEN + 2 * DTLS_IV_LENGTH) 20 | 21 | /** Length of DTLS master_secret */ 22 | #define DTLS_MASTER_SECRET_LENGTH 48 23 | @@ -77,8 +80,6 @@ typedef struct { 24 | * server identity hint */ 25 | #define DTLS_PSK_MAX_CLIENT_IDENTITY_LEN 32 26 | 27 | -/* This is the maximal supported length of the pre-shared key. */ 28 | -#define DTLS_PSK_MAX_KEY_LEN DTLS_KEY_LENGTH 29 | 30 | typedef struct { 31 | uint16_t id_length; 32 | -------------------------------------------------------------------------------- /lib/tinydtls/patches/005-dtls-max-buf.patch: -------------------------------------------------------------------------------- 1 | diff --git a/global.h b/global.h 2 | index c2ce904..dfe14ac 100644 3 | --- a/global.h 4 | +++ b/global.h 5 | @@ -50,7 +50,7 @@ typedef unsigned char uint48[6]; 6 | #ifdef DTLS_ECC 7 | #define DTLS_MAX_BUF 200 8 | #else /* DTLS_ECC */ 9 | -#define DTLS_MAX_BUF 100 10 | +#define DTLS_MAX_BUF 200 11 | #endif /* DTLS_ECC */ 12 | #else /* WITH_CONTIKI */ 13 | #define DTLS_MAX_BUF 1400 14 | -------------------------------------------------------------------------------- /lib/xml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library (libxml_static xmltree.c xmlparser.c) 2 | set_property (TARGET libxml_static PROPERTY POSITION_INDEPENDENT_CODE ON) 3 | set_target_properties (libxml_static PROPERTIES OUTPUT_NAME "xml") 4 | target_include_directories (libxml_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 5 | -------------------------------------------------------------------------------- /lib/xml/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | AR=ar 3 | _STAGING_DIR:=../../staging 4 | 5 | all: compile install 6 | 7 | install: compile 8 | mkdir -p $(_STAGING_DIR)/usr/lib 9 | cp libxml.so $(_STAGING_DIR)/usr/lib 10 | 11 | compile: 12 | $(CC) -fPIC -o xmltree.o -c xmltree.c $(CFLAGS) 13 | $(CC) -fPIC -o xmlparser.o -c xmlparser.c $(CFLAGS) 14 | $(AR) rcs libxml.a xmlparser.o xmltree.o 15 | $(LD) -shared -o libxml.so xmlparser.o xmltree.o 16 | 17 | clean: 18 | rm -f *.o *.a *.so 19 | -------------------------------------------------------------------------------- /lib/xml/Makefile.xml: -------------------------------------------------------------------------------- 1 | xml_src = \ 2 | xmltree.c \ 3 | xmlparser.c 4 | -------------------------------------------------------------------------------- /systemd/etc/awa/awa_serverd.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://127.0.0.1:5683 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=30 10 | DefaultMinimumPeriod=1 11 | DefaultMaximumPeriod=-1 12 | DisableTimeout=86400 13 | NotificationStoringWhenDisabledOrOffline=true 14 | -------------------------------------------------------------------------------- /systemd/lib/systemd/system/awa_bootstrapd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Awa Bootstrap Server Daemon 3 | After=network.target 4 | 5 | [Service] 6 | User=nobody 7 | Group=nogroup 8 | Type=simple 9 | ExecStart=/usr/bin/awa_bootstrapd \ 10 | --logFile /var/log/awa/awa_bootstrapd.log \ 11 | --config /etc/awa/awa_serverd.bsc \ 12 | --port 15685 13 | StandardOutput=journal 14 | StandardError=journal 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | 19 | -------------------------------------------------------------------------------- /systemd/lib/systemd/system/awa_clientd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Awa Client Daemon 3 | After=network.target 4 | 5 | [Service] 6 | User=nobody 7 | Group=nogroup 8 | Type=simple 9 | ExecStart=/usr/bin/awa_clientd \ 10 | --logFile /var/log/awa/awa_clientd.log \ 11 | --bootstrap coap://127.0.0.1:15685 12 | StandardOutput=journal 13 | StandardError=journal 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | 18 | -------------------------------------------------------------------------------- /systemd/lib/systemd/system/awa_serverd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Awa Server Daemon 3 | After=network.target 4 | 5 | [Service] 6 | User=nobody 7 | Group=nogroup 8 | Type=simple 9 | ExecStart=/usr/bin/awa_serverd \ 10 | --logFile /var/log/awa/awa_serverd.log \ 11 | --port 5683 12 | StandardOutput=journal 13 | StandardError=journal 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | 18 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | tools_tests.xml 2 | awa-client-define.ggo 3 | awa-server-define.ggo 4 | 5 | -------------------------------------------------------------------------------- /tools/awa-client-define-base.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-client-define" 4 | purpose "LWM2M Client Object Definition Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Client IPC port" int optional default="12345" typestr="PORT" 11 | 12 | # define-common.cmdline will be appended here: 13 | -------------------------------------------------------------------------------- /tools/awa-client-delete.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-client-delete" 4 | purpose "LWM2M Client Resource Delete Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcPort" p "Connect to Client IPC port" int optional default="12345" typestr="PORT" 10 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 11 | 12 | text "\n" 13 | text "Specify one or more object, object instance and resource paths\n" 14 | text "to delete in the format \"/O/I/R/i\", separated by spaces.\n" 15 | text "For example:\n" 16 | text "\n" 17 | text " /3/0/0\n" 18 | text " /3/0/7/1\n" 19 | text " /4/0/3 /4/0/6\n" 20 | -------------------------------------------------------------------------------- /tools/awa-client-explore.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-client-explore" 4 | purpose "LWM2M Client Objects/Resource Explore Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "export" e "Export definitions in XML format" flag off 11 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 12 | option "ipcPort" p "Connect to Client IPC port" int optional default="12345" typestr="PORT" 13 | 14 | text "\n" 15 | text "Specify one or more object, object instance and resource paths\n" 16 | text "in the format \"/O/I/R\", separated by spaces. For example:\n" 17 | text "\n" 18 | text " /3 /4 /4/0/7 /5/0/0 /5\n" 19 | -------------------------------------------------------------------------------- /tools/awa-client-get.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-client-get" 4 | purpose "LWM2M Client Resource Get Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 11 | option "ipcPort" p "Connect to Client IPC port" int optional default="12345" typestr="PORT" 12 | 13 | text "\n" 14 | text "Specify one or more object, object instance and resource paths\n" 15 | text "in the format \"/O/I/R/i\", separated by spaces. For example:\n" 16 | text "\n" 17 | text " /3/0/7/1 /3/0/0 /4/1 /5\n" 18 | -------------------------------------------------------------------------------- /tools/awa-client-set.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-client-set" 4 | purpose "LWM2M Client Resource Set Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Client IPC port" int optional default="12345" typestr="PORT" 11 | 12 | option "create" c "Create a new Object Instance or Optional Resource" 13 | string optional multiple(0-) 14 | 15 | text "\n" 16 | text "Specify one or more object, object instance and resource paths\n" 17 | text "and values in the format \"/O/I/R/i=VALUE\", separated by spaces.\n" 18 | text "For example:\n" 19 | text "\n" 20 | text " /3/0/0=Imagination\n" 21 | text " /3/0/7/1=4200\n" 22 | text " /4/0/3=3 /4/0/6=7\n" 23 | #text "\n" 24 | #text "Multiple resource instances can be set together with the format:\n" 25 | #text " /3/0/6=0:3800,1:4800,4:1700\n" 26 | #text " (enclose values containing , and : characters in single or double quotes)\n" 27 | -------------------------------------------------------------------------------- /tools/awa-client-subscribe.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-client-subscribe" 4 | purpose "LWM2M Client Resource Subscribe Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 11 | option "ipcPort" p "Connect to IPC port" int optional default="12345" typestr="PORT" 12 | 13 | option "waitTime" t "Time to wait for notification" 14 | int optional default="0" typestr="SECONDS" 15 | option "waitCount" c "Number of notifications to wait for" 16 | int optional default="0" typestr="NUMBER" 17 | 18 | text "\n" 19 | text "Specify one or more object, object instance and resource paths\n" 20 | text "to subscribe to in the format \"/O/I/R/i\", separated by spaces.\n" 21 | text "For example:\n" 22 | text "\n" 23 | text " /3/0/0\n" 24 | text " /3/0/7/1\n" 25 | text " /4/0/3 /4/0/6\n" 26 | -------------------------------------------------------------------------------- /tools/awa-server-define-base.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-define" 4 | purpose "LWM2M Server Object Definition Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 11 | 12 | # define-common.cmdline will be appended here: 13 | -------------------------------------------------------------------------------- /tools/awa-server-delete.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-delete" 4 | purpose "LWM2M Server Resource Delete Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 11 | option "clientID" c "Client ID" string required typestr="ID" 12 | 13 | text "\n" 14 | text "Specify one or more object instance paths\n" 15 | text "to delete in the format \"/O/I\", separated by spaces.\n" 16 | text "For example:\n" 17 | text "\n" 18 | text " /3/0\n" 19 | text " /4/0\n" 20 | -------------------------------------------------------------------------------- /tools/awa-server-execute.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-execute" 4 | purpose "LWM2M Server Resource Execute Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 11 | option "clientID" c "Client ID" string required typestr="ID" 12 | option "stdin" s "Accept argument data from stdin" flag off 13 | 14 | text "\n" 15 | text "Specify one or more object, object instance and resource paths\n" 16 | text "to execute in the format \"/O/I/R\", separated by spaces.\n" 17 | text "For example:\n" 18 | text "\n" 19 | text " /3/0/4\n" 20 | text " /3/0/4 /3/0/5\n" 21 | -------------------------------------------------------------------------------- /tools/awa-server-explore.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-explore" 4 | purpose "LWM2M Server Objects/Resource Explore Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "export" e "Export definitions in XML format" flag off 11 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 12 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 13 | 14 | text "\n" 15 | text "Specify one or more object, object instance and resource paths\n" 16 | text "in the format \"/O/I/R\", separated by spaces. For example:\n" 17 | text "\n" 18 | text " /3 /4 /4/0/7 /5/0/0 /5\n" 19 | -------------------------------------------------------------------------------- /tools/awa-server-list-clients.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-list-clients" 4 | purpose "LWM2M Server List Clients Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "ipcAddress" a "Connect to Client IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 11 | option "ipcPort" p "Connect to Client IPC port" int optional default="54321" typestr="PORT" 12 | 13 | option "objects" o "Show registered objects" flag off 14 | -------------------------------------------------------------------------------- /tools/awa-server-observe.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-observe" 4 | purpose "LWM2M Server Observe Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 11 | option "ipcPort" p "Connect to IPC port" int optional default="54321" typestr="PORT" 12 | option "clientID" c "Client ID" string required typestr="ID" 13 | 14 | option "waitTime" t "Time to wait for notification" int optional default="0" typestr="SECONDS" 15 | option "waitCount" n "Number of notifications to wait for" int optional default="0" typestr="NUMBER" 16 | 17 | text "\n" 18 | text "Specify one or more object, object instance and resource paths\n" 19 | text "to observe in the format \"/O/I/R/i\", separated by spaces.\n" 20 | text "For example:\n" 21 | text "\n" 22 | text " /3/0/0\n" 23 | text " /3/0/7/1\n" 24 | text " /4/0/3 /4/0/6\n" 25 | -------------------------------------------------------------------------------- /tools/awa-server-read.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-read" 4 | purpose "LWM2M Server Resource Read Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "quiet" q "Decrease program verbosity" flag off 10 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 11 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 12 | option "clientID" c "Client ID" string required typestr="ID" 13 | 14 | text "\n" 15 | text "Specify one or more object, object instance and resource paths\n" 16 | text "in the format \"/O/I/R/i\", separated by spaces. For example:\n" 17 | text "\n" 18 | text " /3/0/7/1 /3/0/0 /4/1 /5\n" 19 | -------------------------------------------------------------------------------- /tools/awa-server-write-attributes.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-write-attributes" 4 | purpose "LWM2M Server Resource Write Attributes Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 11 | option "clientID" c "Client ID" string required typestr="ID" 12 | 13 | text "\n" 14 | text "Specify one or more object, object instance and resource paths\n" 15 | text "with query parameters in the format \"/O/I/R?LINK=VALUE\\&LINK2=VALUE2\", separated by spaces.\n" 16 | text "For example:\n" 17 | text "\n" 18 | text " /3/0/13?gt=5\n" 19 | text " /3/0/13?pmin=2\\&pmax=10\n" 20 | #text "\n" 21 | -------------------------------------------------------------------------------- /tools/awa-server-write.ggo: -------------------------------------------------------------------------------- 1 | # gengetopt configuration file 2 | version "1.0" 3 | package "awa-server-write" 4 | purpose "LWM2M Server Resource Write Operation" 5 | 6 | # Options 7 | option "verbose" v "Increase program verbosity" flag off 8 | option "debug" d "Increase program verbosity" flag off 9 | option "ipcAddress" a "Connect to Server IPC Address" string optional default="127.0.0.1" typestr="ADDRESS" 10 | option "ipcPort" p "Connect to Server IPC port" int optional default="54321" typestr="PORT" 11 | option "clientID" c "Client ID" string required typestr="ID" 12 | option "create" o "Create a new Object Instance or Optional Resource" 13 | string optional multiple(0-) 14 | option "replace" r "Replace existing resource (rather than update which is the default)" flag off 15 | 16 | text "\n" 17 | text "Specify one or more object, object instance and resource paths\n" 18 | text "and values in the format \"/O/I/R/i=VALUE\", separated by spaces.\n" 19 | text "For example:\n" 20 | text "\n" 21 | text " awa-server-write -o /3/0/0 /3/0/0=Imagination (create and set)\n" 22 | text " awa-server-write /3/0/0=Imagination\n" 23 | text " awa-server-write /3/0/7/1=4200\n" 24 | text " awa-server-write /4/0/3=3 /4/0/6=7\n" 25 | #text "\n" 26 | #text "Multiple resource instances can be set together with the format:\n" 27 | #text " awa-server-write /3/0/6=0:3800,1:4800,4:1700\n" 28 | #text " (enclose values containing , and : characters in single or double quotes)\n" 29 | -------------------------------------------------------------------------------- /tools/changeset_common.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************************ 2 | Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 6 | following conditions are met: 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8 | following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 20 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | ************************************************************************************************************************/ 22 | 23 | 24 | #ifndef CHANGESET_COMMON_H 25 | #define CHANGESET_COMMON_H 26 | 27 | #include "awa/common.h" 28 | #include "tools_common.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | void PrintChanged(AwaChangeType changeType, const char * path); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif // CHANGESET_COMMON_H 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /tools/define-common.ggo: -------------------------------------------------------------------------------- 1 | # This file is appended to awa-client/server-define-base.cmdline 2 | 3 | defmode "XML Definition" 4 | defmode "Cmdline Definition" 5 | 6 | # Mode: XML Definition 7 | modeoption "xmlFile" x "Load XML Definition file" mode="XML Definition" string optional typestr="FILENAME" required 8 | 9 | # Mode: Cmdline Definition 10 | modeoption "objectID" o "Object ID" mode="Cmdline Definition" int required typestr="ID" 11 | modeoption "objectName" j "Object name" mode="Cmdline Definition" string optional typestr="NAME" 12 | modeoption "objectMandatory" m "Object is required or optional" mode="Cmdline Definition" flag off 13 | modeoption "objectInstances" y "Object supports single or multiple instances" 14 | mode="Cmdline Definition" enum optional typestr="TYPE" values="single","multiple" default="single" 15 | 16 | modeoption "resourceID" r "Resource ID" mode="Cmdline Definition" int optional typestr="ID" multiple(1-) 17 | modeoption "resourceName" n "Resource Name" mode="Cmdline Definition" string optional typestr="NAME" multiple(1-) 18 | modeoption "resourceType" t "Resource Type" mode="Cmdline Definition" enum optional typestr="TYPE" multiple(1-) values="opaque","integer","float","boolean","string","time","objlink","none" 19 | modeoption "resourceInstances" u "Resource supports single or multiple instances" 20 | mode="Cmdline Definition" enum optional typestr="VALUE" multiple(1-) values="single","multiple" 21 | modeoption "resourceRequired" q "Resource is required or optional" 22 | mode="Cmdline Definition" enum optional typestr="VALUE" multiple(1-) values="optional","mandatory" 23 | modeoption "resourceOperations" k "Resource Operation" mode="Cmdline Definition" enum optional typestr="VALUE" multiple(1-) values="r","w","e","rw" 24 | -------------------------------------------------------------------------------- /tools/tests/gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -g -std=c++11") 2 | if (ENABLE_GCOV) 3 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage") 4 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") 5 | endif () 6 | 7 | add_executable (test_tools_runner 8 | ../../tools_common.c 9 | test_tools_common.cc 10 | ${API_TEST_DIR}/support/main/main.cc 11 | ${API_TEST_DIR}/support/main/main_cmdline.c 12 | ${API_TEST_DIR}/support/support.cc 13 | ${API_TEST_DIR}/support/process.cc 14 | ${API_TEST_DIR}/support/daemon.cc 15 | ${API_TEST_DIR}/support/log.cc 16 | ) 17 | 18 | set_source_files_properties(${API_TEST_DIR}/support/main/main_cmdline.c PROPERTIES COMPILE_FLAGS -Wno-all) 19 | 20 | target_include_directories (test_tools_runner PRIVATE ../..) 21 | target_include_directories (test_tools_runner PRIVATE ${GTEST_INCLUDE_DIR}) 22 | target_include_directories (test_tools_runner PRIVATE ${API_INCLUDE_DIR}) 23 | target_include_directories (test_tools_runner PRIVATE ${API_TEST_DIR}) 24 | target_include_directories (test_tools_runner PRIVATE ${CORE_SRC_DIR}) 25 | 26 | target_link_libraries(test_tools_runner gtest) 27 | target_link_libraries(test_tools_runner pthread) 28 | target_link_libraries(test_tools_runner Awa_static) 29 | if (ENABLE_GCOV) 30 | target_link_libraries(test_tools_runner gcov) 31 | endif () 32 | 33 | # Testing 34 | add_custom_command ( 35 | OUTPUT test_tools_runner_out.xml 36 | COMMAND test_tools_runner --gtest_output=xml:test_tools_runner_out.xml || true 37 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 38 | VERBATIM 39 | ) 40 | 41 | if (RUN_TESTS) 42 | # always run test_tools_runner 43 | add_custom_target ( 44 | test_tools_runner_TARGET ALL 45 | DEPENDS test_tools_runner_out.xml 46 | ) 47 | endif () 48 | -------------------------------------------------------------------------------- /tools/tests/test.bsc: -------------------------------------------------------------------------------- 1 | ServerURI=coap://127.0.0.1:9871 2 | SecurityMode=0 3 | PublicKey=[PublicKey] 4 | SecretKey=[SecretKey] 5 | ServerID=1 6 | HoldOffTime=30 7 | ShortServerID=1 8 | Binding=U 9 | LifeTime=30 10 | --------------------------------------------------------------------------------