anjay
advanced_fw_update.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-2024 AVSystem <avsystem@avsystem.com>
3  * AVSystem Anjay LwM2M SDK
4  * All rights reserved.
5  *
6  * Licensed under the AVSystem-5-clause License.
7  * See the attached LICENSE file for details.
8  */
9 
10 #ifndef ANJAY_INCLUDE_ANJAY_ADVANCED_FW_UPDATE_H
11 #define ANJAY_INCLUDE_ANJAY_ADVANCED_FW_UPDATE_H
12 
13 #include <anjay/core.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #define ANJAY_ADVANCED_FW_UPDATE_OID 33629
20 
28 typedef enum {
34 
42 typedef enum {
58 
71 #define ANJAY_ADVANCED_FW_UPDATE_ERR_NOT_ENOUGH_SPACE \
72  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_NOT_ENOUGH_SPACE)
73 #define ANJAY_ADVANCED_FW_UPDATE_ERR_OUT_OF_MEMORY \
74  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_OUT_OF_MEMORY)
75 #define ANJAY_ADVANCED_FW_UPDATE_ERR_INTEGRITY_FAILURE \
76  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_INTEGRITY_FAILURE)
77 #define ANJAY_ADVANCED_FW_UPDATE_ERR_UNSUPPORTED_PACKAGE_TYPE \
78  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE)
79 #define ANJAY_ADVANCED_FW_UPDATE_ERR_DEFERRED \
80  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_DEFERRED)
81 #define ANJAY_ADVANCED_FW_UPDATE_ERR_CONFLICTING_STATE \
82  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_CONFLICTING_STATE)
83 #define ANJAY_ADVANCED_FW_UPDATE_ERR_DEPENDENCY_ERROR \
84  (-(int) ANJAY_ADVANCED_FW_UPDATE_RESULT_DEPENDENCY_ERROR)
91 typedef enum {
96 
101 typedef struct {
108 #ifdef ANJAY_WITH_SEND
115 #endif // ANJAY_WITH_SEND
117 
122 typedef struct {
128 
134 
139 
144 
149  avs_time_real_t persisted_update_deadline;
151 
181  void *user_ptr);
207  void *user_ptr,
208  const void *data,
209  size_t length);
210 
242  void *user_ptr);
243 
265 typedef void anjay_advanced_fw_update_reset_t(anjay_iid_t iid, void *user_ptr);
266 
294  void *user_ptr);
295 
323  void *user_ptr);
324 
344 typedef const char *
346 
397  anjay_iid_t iid,
398  void *user_ptr,
399  const anjay_iid_t *requested_supplemental_iids,
400  size_t requested_supplemental_iids_count);
401 
475  anjay_iid_t iid,
476  void *user_ptr,
477  anjay_security_config_t *out_security_info,
478  const char *download_uri);
479 
499 typedef avs_coap_udp_tx_params_t anjay_advanced_fw_update_get_coap_tx_params_t(
500  anjay_iid_t iid, void *user_ptr, const char *download_uri);
501 
526  anjay_iid_t iid, void *user_ptr, const char *download_uri);
527 
572 typedef struct {
582 
586 
596 
600 
604 
608 
613 
631  anjay_t *anjay, const anjay_advanced_fw_update_global_config_t *config);
632 
670  anjay_t *anjay,
671  anjay_iid_t iid,
672  const char *component_name,
673  const anjay_advanced_fw_update_handlers_t *handlers,
674  void *user_arg,
675  const anjay_advanced_fw_update_initial_state_t *initial_state);
676 
715  anjay_t *anjay,
716  anjay_iid_t iid,
719 
732  anjay_t *anjay,
733  anjay_iid_t iid,
735 
748  anjay_t *anjay_locked,
749  anjay_iid_t iid,
751 
773  anjay_t *anjay,
774  anjay_iid_t iid,
775  const anjay_iid_t *target_iids,
776  size_t target_iids_count);
777 
804  anjay_t *anjay,
805  anjay_iid_t iid,
806  const anjay_iid_t **out_target_iids,
807  size_t *out_target_iids_count);
808 
835  anjay_t *anjay,
836  anjay_iid_t iid,
837  const anjay_iid_t *target_iids,
838  size_t target_iids_count);
839 
870  anjay_t *anjay,
871  anjay_iid_t iid,
872  const anjay_iid_t **out_target_iids,
873  size_t *out_target_iids_count);
874 
887  anjay_iid_t iid);
888 
901 
912 avs_time_real_t
914  anjay_iid_t iid);
915 
916 #ifdef ANJAY_WITH_DOWNLOADER
937 
954 #endif // ANJAY_WITH_DOWNLOADER
955 
956 #ifdef __cplusplus
957 }
958 #endif
959 
960 #endif /* ANJAY_INCLUDE_ANJAY_ADVANCED_FW_UPDATE_H */
void anjay_advanced_fw_update_pull_suspend(anjay_t *anjay)
int anjay_advanced_fw_update_install(anjay_t *anjay, const anjay_advanced_fw_update_global_config_t *config)
int anjay_advanced_fw_update_stream_open_t(anjay_iid_t iid, void *user_ptr)
Definition: advanced_fw_update.h:180
int anjay_advanced_fw_update_get_state(anjay_t *anjay, anjay_iid_t iid, anjay_advanced_fw_update_state_t *out_state)
const char * anjay_advanced_fw_update_get_pkg_version_t(anjay_iid_t iid, void *user_ptr)
Definition: advanced_fw_update.h:322
const char * anjay_advanced_fw_update_get_pkg_name_t(anjay_iid_t iid, void *user_ptr)
Definition: advanced_fw_update.h:293
int anjay_advanced_fw_update_set_linked_instances(anjay_t *anjay, anjay_iid_t iid, const anjay_iid_t *target_iids, size_t target_iids_count)
int anjay_advanced_fw_update_stream_write_t(anjay_iid_t iid, void *user_ptr, const void *data, size_t length)
Definition: advanced_fw_update.h:206
int anjay_advanced_fw_update_stream_finish_t(anjay_iid_t iid, void *user_ptr)
Definition: advanced_fw_update.h:241
void anjay_advanced_fw_update_reset_t(anjay_iid_t iid, void *user_ptr)
Definition: advanced_fw_update.h:265
avs_time_real_t anjay_advanced_fw_update_get_last_state_change_time(anjay_t *anjay, anjay_iid_t iid)
int anjay_advanced_fw_update_instance_add(anjay_t *anjay, anjay_iid_t iid, const char *component_name, const anjay_advanced_fw_update_handlers_t *handlers, void *user_arg, const anjay_advanced_fw_update_initial_state_t *initial_state)
anjay_advanced_fw_update_severity_t
Definition: advanced_fw_update.h:91
@ ANJAY_ADVANCED_FW_UPDATE_SEVERITY_CRITICAL
Definition: advanced_fw_update.h:92
@ ANJAY_ADVANCED_FW_UPDATE_SEVERITY_OPTIONAL
Definition: advanced_fw_update.h:94
@ ANJAY_ADVANCED_FW_UPDATE_SEVERITY_MANDATORY
Definition: advanced_fw_update.h:93
avs_time_real_t anjay_advanced_fw_update_get_deadline(anjay_t *anjay, anjay_iid_t iid)
int anjay_advanced_fw_update_get_conflicting_instances(anjay_t *anjay, anjay_iid_t iid, const anjay_iid_t **out_target_iids, size_t *out_target_iids_count)
avs_time_duration_t anjay_advanced_fw_update_get_tcp_request_timeout_t(anjay_iid_t iid, void *user_ptr, const char *download_uri)
Definition: advanced_fw_update.h:525
int anjay_advanced_fw_update_perform_upgrade_t(anjay_iid_t iid, void *user_ptr, const anjay_iid_t *requested_supplemental_iids, size_t requested_supplemental_iids_count)
Definition: advanced_fw_update.h:396
int anjay_advanced_fw_update_pull_reconnect(anjay_t *anjay)
const char * anjay_advanced_fw_update_get_current_version_t(anjay_iid_t iid, void *user_ptr)
Definition: advanced_fw_update.h:345
anjay_advanced_fw_update_severity_t anjay_advanced_fw_update_get_severity(anjay_t *anjay, anjay_iid_t iid)
int anjay_advanced_fw_update_set_state_and_result(anjay_t *anjay, anjay_iid_t iid, anjay_advanced_fw_update_state_t state, anjay_advanced_fw_update_result_t result)
int anjay_advanced_fw_update_set_conflicting_instances(anjay_t *anjay, anjay_iid_t iid, const anjay_iid_t *target_iids, size_t target_iids_count)
int anjay_advanced_fw_update_get_linked_instances(anjay_t *anjay, anjay_iid_t iid, const anjay_iid_t **out_target_iids, size_t *out_target_iids_count)
avs_coap_udp_tx_params_t anjay_advanced_fw_update_get_coap_tx_params_t(anjay_iid_t iid, void *user_ptr, const char *download_uri)
Definition: advanced_fw_update.h:499
int anjay_advanced_fw_update_get_security_config_t(anjay_iid_t iid, void *user_ptr, anjay_security_config_t *out_security_info, const char *download_uri)
Definition: advanced_fw_update.h:474
anjay_advanced_fw_update_result_t
Definition: advanced_fw_update.h:42
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_NOT_ENOUGH_SPACE
Definition: advanced_fw_update.h:45
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_SUCCESS
Definition: advanced_fw_update.h:44
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_INTEGRITY_FAILURE
Definition: advanced_fw_update.h:48
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_OUT_OF_MEMORY
Definition: advanced_fw_update.h:46
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE
Definition: advanced_fw_update.h:49
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_UPDATE_CANCELLED
Definition: advanced_fw_update.h:53
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_CONNECTION_LOST
Definition: advanced_fw_update.h:47
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_INITIAL
Definition: advanced_fw_update.h:43
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_CONFLICTING_STATE
Definition: advanced_fw_update.h:55
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_INVALID_URI
Definition: advanced_fw_update.h:50
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_UNSUPPORTED_PROTOCOL
Definition: advanced_fw_update.h:52
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_FAILED
Definition: advanced_fw_update.h:51
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_DEFERRED
Definition: advanced_fw_update.h:54
@ ANJAY_ADVANCED_FW_UPDATE_RESULT_DEPENDENCY_ERROR
Definition: advanced_fw_update.h:56
int anjay_advanced_fw_update_get_result(anjay_t *anjay_locked, anjay_iid_t iid, anjay_advanced_fw_update_result_t *out_result)
anjay_advanced_fw_update_state_t
Definition: advanced_fw_update.h:28
@ ANJAY_ADVANCED_FW_UPDATE_STATE_IDLE
Definition: advanced_fw_update.h:29
@ ANJAY_ADVANCED_FW_UPDATE_STATE_DOWNLOADED
Definition: advanced_fw_update.h:31
@ ANJAY_ADVANCED_FW_UPDATE_STATE_UPDATING
Definition: advanced_fw_update.h:32
@ ANJAY_ADVANCED_FW_UPDATE_STATE_DOWNLOADING
Definition: advanced_fw_update.h:30
uint16_t anjay_iid_t
Definition: core.h:1014
struct anjay_struct anjay_t
Definition: core.h:45
Definition: advanced_fw_update.h:101
bool use_lwm2m_send
Definition: advanced_fw_update.h:114
bool prefer_same_socket_downloads
Definition: advanced_fw_update.h:107
Definition: advanced_fw_update.h:572
anjay_advanced_fw_update_reset_t * reset
Definition: advanced_fw_update.h:585
anjay_advanced_fw_update_stream_finish_t * stream_finish
Definition: advanced_fw_update.h:581
anjay_advanced_fw_update_get_tcp_request_timeout_t * get_tcp_request_timeout
Definition: advanced_fw_update.h:611
anjay_advanced_fw_update_stream_open_t * stream_open
Definition: advanced_fw_update.h:575
anjay_advanced_fw_update_get_pkg_name_t * get_pkg_name
Definition: advanced_fw_update.h:589
anjay_advanced_fw_update_perform_upgrade_t * perform_upgrade
Definition: advanced_fw_update.h:599
anjay_advanced_fw_update_stream_write_t * stream_write
Definition: advanced_fw_update.h:578
anjay_advanced_fw_update_get_security_config_t * get_security_config
Definition: advanced_fw_update.h:603
anjay_advanced_fw_update_get_pkg_version_t * get_pkg_version
Definition: advanced_fw_update.h:592
anjay_advanced_fw_update_get_coap_tx_params_t * get_coap_tx_params
Definition: advanced_fw_update.h:607
anjay_advanced_fw_update_get_current_version_t * get_current_version
Definition: advanced_fw_update.h:595
Definition: advanced_fw_update.h:122
anjay_advanced_fw_update_severity_t persisted_severity
Definition: advanced_fw_update.h:138
avs_time_real_t persisted_last_state_change_time
Definition: advanced_fw_update.h:143
anjay_advanced_fw_update_state_t state
Definition: advanced_fw_update.h:127
avs_time_real_t persisted_update_deadline
Definition: advanced_fw_update.h:149
anjay_advanced_fw_update_result_t result
Definition: advanced_fw_update.h:133
Definition: core.h:1735