anjay
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_FW_UPDATE_H
11 #define ANJAY_INCLUDE_ANJAY_FW_UPDATE_H
12 
13 #include <anjay/anjay_config.h>
14 #include <anjay/dm.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
26 typedef enum {
38 
50 #define ANJAY_FW_UPDATE_ERR_NOT_ENOUGH_SPACE \
51  (-(int) ANJAY_FW_UPDATE_RESULT_NOT_ENOUGH_SPACE)
52 #define ANJAY_FW_UPDATE_ERR_OUT_OF_MEMORY \
53  (-(int) ANJAY_FW_UPDATE_RESULT_OUT_OF_MEMORY)
54 #define ANJAY_FW_UPDATE_ERR_INTEGRITY_FAILURE \
55  (-(int) ANJAY_FW_UPDATE_RESULT_INTEGRITY_FAILURE)
56 #define ANJAY_FW_UPDATE_ERR_UNSUPPORTED_PACKAGE_TYPE \
57  (-(int) ANJAY_FW_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE)
58 
65 typedef enum {
80 
89 
96 
103 
111 
119 
123 typedef struct {
130 
147  const char *persisted_uri;
148 
161 
173  const struct anjay_etag *resume_etag;
174 
181 
182 #ifdef ANJAY_WITH_SEND
189 #endif // ANJAY_WITH_SEND
190 
192 
231 typedef int
233  const char *package_uri,
234  const struct anjay_etag *package_etag);
235 
256 typedef int
257 anjay_fw_update_stream_write_t(void *user_ptr, const void *data, size_t length);
258 
286 typedef int anjay_fw_update_stream_finish_t(void *user_ptr);
287 
300 typedef void anjay_fw_update_reset_t(void *user_ptr);
301 
325 typedef const char *anjay_fw_update_get_name_t(void *user_ptr);
326 
350 typedef const char *anjay_fw_update_get_version_t(void *user_ptr);
351 
388 typedef int anjay_fw_update_perform_upgrade_t(void *user_ptr);
389 
459  void *user_ptr,
460  anjay_security_config_t *out_security_info,
461  const char *download_uri);
462 
479 typedef avs_coap_udp_tx_params_t
480 anjay_fw_update_get_coap_tx_params_t(void *user_ptr, const char *download_uri);
481 
502 typedef avs_time_duration_t
504  const char *download_uri);
505 
550 typedef struct {
560 
564 
571 
575 
579 
583 
588 
617  anjay_t *anjay,
618  const anjay_fw_update_handlers_t *handlers,
619  void *user_arg,
620  const anjay_fw_update_initial_state_t *initial_state);
621 
656 
657 #ifdef ANJAY_WITH_DOWNLOADER
676 
694 #endif // ANJAY_WITH_DOWNLOADER
695 
696 #ifdef __cplusplus
697 }
698 #endif
699 
700 #endif /* ANJAY_INCLUDE_ANJAY_FW_UPDATE_H */
struct anjay_struct anjay_t
Definition: core.h:45
int anjay_fw_update_stream_open_t(void *user_ptr, const char *package_uri, const struct anjay_etag *package_etag)
Definition: fw_update.h:232
int anjay_fw_update_install(anjay_t *anjay, const anjay_fw_update_handlers_t *handlers, void *user_arg, const anjay_fw_update_initial_state_t *initial_state)
int anjay_fw_update_stream_finish_t(void *user_ptr)
Definition: fw_update.h:286
void anjay_fw_update_reset_t(void *user_ptr)
Definition: fw_update.h:300
const char * anjay_fw_update_get_name_t(void *user_ptr)
Definition: fw_update.h:325
const char * anjay_fw_update_get_version_t(void *user_ptr)
Definition: fw_update.h:350
avs_coap_udp_tx_params_t anjay_fw_update_get_coap_tx_params_t(void *user_ptr, const char *download_uri)
Definition: fw_update.h:480
anjay_fw_update_initial_result_t
Definition: fw_update.h:65
@ ANJAY_FW_UPDATE_INITIAL_SUCCESS
Definition: fw_update.h:102
@ ANJAY_FW_UPDATE_INITIAL_DOWNLOADED
Definition: fw_update.h:79
@ ANJAY_FW_UPDATE_INITIAL_NEUTRAL
Definition: fw_update.h:95
@ ANJAY_FW_UPDATE_INITIAL_FAILED
Definition: fw_update.h:117
@ ANJAY_FW_UPDATE_INITIAL_UPDATING
Definition: fw_update.h:73
@ ANJAY_FW_UPDATE_INITIAL_INTEGRITY_FAILURE
Definition: fw_update.h:110
@ ANJAY_FW_UPDATE_INITIAL_DOWNLOADING
Definition: fw_update.h:88
int anjay_fw_update_get_security_config_t(void *user_ptr, anjay_security_config_t *out_security_info, const char *download_uri)
Definition: fw_update.h:458
void anjay_fw_update_pull_suspend(anjay_t *anjay)
anjay_fw_update_result_t
Definition: fw_update.h:26
@ ANJAY_FW_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE
Definition: fw_update.h:33
@ ANJAY_FW_UPDATE_RESULT_NOT_ENOUGH_SPACE
Definition: fw_update.h:29
@ ANJAY_FW_UPDATE_RESULT_SUCCESS
Definition: fw_update.h:28
@ ANJAY_FW_UPDATE_RESULT_INITIAL
Definition: fw_update.h:27
@ ANJAY_FW_UPDATE_RESULT_INVALID_URI
Definition: fw_update.h:34
@ ANJAY_FW_UPDATE_RESULT_UNSUPPORTED_PROTOCOL
Definition: fw_update.h:36
@ ANJAY_FW_UPDATE_RESULT_INTEGRITY_FAILURE
Definition: fw_update.h:32
@ ANJAY_FW_UPDATE_RESULT_FAILED
Definition: fw_update.h:35
@ ANJAY_FW_UPDATE_RESULT_CONNECTION_LOST
Definition: fw_update.h:31
@ ANJAY_FW_UPDATE_RESULT_OUT_OF_MEMORY
Definition: fw_update.h:30
int anjay_fw_update_perform_upgrade_t(void *user_ptr)
Definition: fw_update.h:388
avs_time_duration_t anjay_fw_update_get_tcp_request_timeout_t(void *user_ptr, const char *download_uri)
Definition: fw_update.h:503
int anjay_fw_update_set_result(anjay_t *anjay, anjay_fw_update_result_t result)
int anjay_fw_update_stream_write_t(void *user_ptr, const void *data, size_t length)
Definition: fw_update.h:257
int anjay_fw_update_pull_reconnect(anjay_t *anjay)
Definition: download.h:26
Definition: fw_update.h:550
anjay_fw_update_stream_finish_t * stream_finish
Definition: fw_update.h:559
anjay_fw_update_get_name_t * get_name
Definition: fw_update.h:567
anjay_fw_update_reset_t * reset
Definition: fw_update.h:563
anjay_fw_update_get_version_t * get_version
Definition: fw_update.h:570
anjay_fw_update_get_coap_tx_params_t * get_coap_tx_params
Definition: fw_update.h:582
anjay_fw_update_get_security_config_t * get_security_config
Definition: fw_update.h:578
anjay_fw_update_stream_open_t * stream_open
Definition: fw_update.h:553
anjay_fw_update_stream_write_t * stream_write
Definition: fw_update.h:556
anjay_fw_update_perform_upgrade_t * perform_upgrade
Definition: fw_update.h:574
anjay_fw_update_get_tcp_request_timeout_t * get_tcp_request_timeout
Definition: fw_update.h:586
Definition: fw_update.h:123
const char * persisted_uri
Definition: fw_update.h:147
anjay_fw_update_initial_result_t result
Definition: fw_update.h:129
bool use_lwm2m_send
Definition: fw_update.h:188
bool prefer_same_socket_downloads
Definition: fw_update.h:180
const struct anjay_etag * resume_etag
Definition: fw_update.h:173
size_t resume_offset
Definition: fw_update.h:160
Definition: core.h:1735