anjay
sw_mgmt.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_SW_MGMT_H
11 #define ANJAY_INCLUDE_ANJAY_SW_MGMT_H
12 
13 #include <anjay/anjay_config.h>
14 #include <anjay/dm.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
24 typedef enum {
39 
50 #define ANJAY_SW_MGMT_ERR_NOT_ENOUGH_SPACE \
51  (-(int) ANJAY_SW_MGMT_UPDATE_RESULT_NOT_ENOUGH_SPACE)
52 #define ANJAY_SW_MGMT_ERR_OUT_OF_MEMORY \
53  (-(int) ANJAY_SW_MGMT_UPDATE_RESULT_OUT_OF_MEMORY)
54 #define ANJAY_SW_MGMT_ERR_INTEGRITY_FAILURE \
55  (-(int) ANJAY_SW_MGMT_UPDATE_RESULT_INTEGRITY_FAILURE)
56 #define ANJAY_SW_MGMT_ERR_UNSUPPORTED_PACKAGE_TYPE \
57  (-(int) ANJAY_SW_MGMT_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE)
67 typedef enum {
83 
91 
99 
108 
115 
123 
131 typedef struct {
137 
144 
148  void *inst_ctx;
150 
180 typedef int
181 anjay_sw_mgmt_stream_open_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
182 
213 typedef int anjay_sw_mgmt_stream_write_t(void *obj_ctx,
214  anjay_iid_t iid,
215  void *inst_ctx,
216  const void *data,
217  size_t length);
218 
255 typedef int
256 anjay_sw_mgmt_stream_finish_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
257 
284 typedef int
285 anjay_sw_mgmt_check_integrity_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
286 
310 typedef void
311 anjay_sw_mgmt_reset_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
312 
346 typedef const char *
347 anjay_sw_mgmt_get_name_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
348 
382 typedef const char *
383 anjay_sw_mgmt_get_version_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
384 
431 typedef int
432 anjay_sw_mgmt_pkg_install_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
433 
466 typedef int
467 anjay_sw_mgmt_pkg_uninstall_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
468 
499 typedef int anjay_sw_mgmt_prepare_for_update_t(void *obj_ctx,
500  anjay_iid_t iid,
501  void *inst_ctx);
502 
537 typedef int
538 anjay_sw_mgmt_activate_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
539 
574 typedef int
575 anjay_sw_mgmt_deactivate_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
576 
577 #ifdef ANJAY_WITH_DOWNLOADER
578 
659 typedef int
661  anjay_iid_t iid,
662  void *inst_ctx,
663  const char *download_uri,
664  anjay_security_config_t *out_security_info);
665 
689 typedef avs_coap_udp_tx_params_t
691  anjay_iid_t iid,
692  void *inst_ctx,
693  const char *download_uri);
694 
722 typedef avs_time_duration_t
724  anjay_iid_t iid,
725  void *inst_ctx,
726  const char *download_uri);
727 
750 
771 
772 #endif // ANJAY_WITH_DOWNLOADER
773 
804 typedef int anjay_sw_mgmt_add_handler_t(void *obj_ctx,
805  anjay_iid_t iid,
806  void **out_inst_ctx);
807 
836 typedef int
837 anjay_sw_mgmt_remove_handler_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx);
838 
843 typedef struct {
847 
851 
854 
858 
862 
866 
870 
874 
877 
881 
884 
887 
888 #ifdef ANJAY_WITH_DOWNLOADER
892 
896 
897 # ifdef ANJAY_WITH_COAP_DOWNLOAD
901 # endif // ANJAY_WITH_COAP_DOWNLOAD
902 #endif // ANJAY_WITH_DOWNLOADER
903 
907 
912 
920 typedef struct {
928 
933  void *obj_ctx;
934 
935 #if defined(ANJAY_WITH_DOWNLOADER)
942 #endif // defined(ANJAY_WITH_DOWNLOADER)
944 
970  const anjay_sw_mgmt_settings_t *settings);
971 
994  anjay_iid_t iid,
995  bool *out_state);
996 
1003 typedef enum {
1025 
1061  anjay_t *anjay,
1062  anjay_iid_t iid,
1063  anjay_sw_mgmt_finish_pkg_install_result_t pkg_install_result);
1064 
1083  anjay_t *anjay,
1084  const anjay_sw_mgmt_instance_initializer_t *instance_initializer);
1085 
1117 
1118 #ifdef __cplusplus
1119 }
1120 #endif
1121 
1122 #endif /* ANJAY_INCLUDE_ANJAY_SW_MGMT_H */
uint16_t anjay_iid_t
Definition: core.h:1014
struct anjay_struct anjay_t
Definition: core.h:45
Definition: core.h:1735
Definition: sw_mgmt.h:843
anjay_sw_mgmt_stream_finish_t * stream_finish
Definition: sw_mgmt.h:853
anjay_sw_mgmt_get_name_t * get_name
Definition: sw_mgmt.h:865
anjay_sw_mgmt_pkg_uninstall_t * pkg_uninstall
Definition: sw_mgmt.h:876
anjay_sw_mgmt_remove_handler_t * remove_handler
Definition: sw_mgmt.h:910
anjay_sw_mgmt_get_version_t * get_version
Definition: sw_mgmt.h:869
anjay_sw_mgmt_activate_t * activate
Definition: sw_mgmt.h:883
anjay_sw_mgmt_pkg_install_t * pkg_install
Definition: sw_mgmt.h:873
anjay_sw_mgmt_stream_open_t * stream_open
Definition: sw_mgmt.h:846
anjay_sw_mgmt_get_tcp_request_timeout_t * get_tcp_request_timeout
Definition: sw_mgmt.h:895
anjay_sw_mgmt_get_coap_tx_params_t * get_coap_tx_params
Definition: sw_mgmt.h:900
anjay_sw_mgmt_get_security_config_t * get_security_config
Definition: sw_mgmt.h:891
anjay_sw_mgmt_stream_write_t * stream_write
Definition: sw_mgmt.h:850
anjay_sw_mgmt_deactivate_t * deactivate
Definition: sw_mgmt.h:886
anjay_sw_mgmt_prepare_for_update_t * prepare_for_update
Definition: sw_mgmt.h:880
anjay_sw_mgmt_reset_t * reset
Definition: sw_mgmt.h:861
anjay_sw_mgmt_add_handler_t * add_handler
Definition: sw_mgmt.h:906
anjay_sw_mgmt_check_integrity_t * check_integrity
Definition: sw_mgmt.h:857
Definition: sw_mgmt.h:131
anjay_iid_t iid
Definition: sw_mgmt.h:143
void * inst_ctx
Definition: sw_mgmt.h:148
anjay_sw_mgmt_initial_state_t initial_state
Definition: sw_mgmt.h:136
Definition: sw_mgmt.h:920
const anjay_sw_mgmt_handlers_t * handlers
Definition: sw_mgmt.h:927
bool prefer_same_socket_downloads
Definition: sw_mgmt.h:941
void * obj_ctx
Definition: sw_mgmt.h:933
const char * anjay_sw_mgmt_get_version_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:383
int anjay_sw_mgmt_install(anjay_t *anjay, const anjay_sw_mgmt_settings_t *settings)
anjay_sw_mgmt_initial_state_t
Definition: sw_mgmt.h:67
@ ANJAY_SW_MGMT_INITIAL_STATE_INSTALLED_DEACTIVATED
Definition: sw_mgmt.h:114
@ ANJAY_SW_MGMT_INITIAL_STATE_INSTALLING
Definition: sw_mgmt.h:107
@ ANJAY_SW_MGMT_INITIAL_STATE_IDLE
Definition: sw_mgmt.h:82
@ ANJAY_SW_MGMT_INITIAL_STATE_INSTALLED_ACTIVATED
Definition: sw_mgmt.h:121
@ ANJAY_SW_MGMT_INITIAL_STATE_DELIVERED
Definition: sw_mgmt.h:98
@ ANJAY_SW_MGMT_INITIAL_STATE_DOWNLOADED
Definition: sw_mgmt.h:90
int anjay_sw_mgmt_deactivate_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:575
int anjay_sw_mgmt_remove_handler_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:837
int anjay_sw_mgmt_check_integrity_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:285
anjay_sw_mgmt_update_result_t
Definition: sw_mgmt.h:24
@ ANJAY_SW_MGMT_UPDATE_RESULT_UPDATE_ERROR
Definition: sw_mgmt.h:35
@ ANJAY_SW_MGMT_UPDATE_RESULT_INSTALLATION_FAILURE
Definition: sw_mgmt.h:36
@ ANJAY_SW_MGMT_UPDATE_RESULT_DOWNLOADED_VERIFIED
Definition: sw_mgmt.h:28
@ ANJAY_SW_MGMT_UPDATE_RESULT_INSTALLED
Definition: sw_mgmt.h:27
@ ANJAY_SW_MGMT_UPDATE_RESULT_CONNECTION_LOST
Definition: sw_mgmt.h:31
@ ANJAY_SW_MGMT_UPDATE_RESULT_NOT_ENOUGH_SPACE
Definition: sw_mgmt.h:29
@ ANJAY_SW_MGMT_UPDATE_RESULT_INVALID_URI
Definition: sw_mgmt.h:34
@ ANJAY_SW_MGMT_UPDATE_RESULT_UNINSTALLATION_FAILURE
Definition: sw_mgmt.h:37
@ ANJAY_SW_MGMT_UPDATE_RESULT_DOWNLOADING
Definition: sw_mgmt.h:26
@ ANJAY_SW_MGMT_UPDATE_RESULT_OUT_OF_MEMORY
Definition: sw_mgmt.h:30
@ ANJAY_SW_MGMT_UPDATE_RESULT_INTEGRITY_FAILURE
Definition: sw_mgmt.h:32
@ ANJAY_SW_MGMT_UPDATE_RESULT_INITIAL
Definition: sw_mgmt.h:25
@ ANJAY_SW_MGMT_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE
Definition: sw_mgmt.h:33
int anjay_sw_mgmt_add_handler_t(void *obj_ctx, anjay_iid_t iid, void **out_inst_ctx)
Definition: sw_mgmt.h:804
int anjay_sw_mgmt_prepare_for_update_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:499
int anjay_sw_mgmt_stream_write_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx, const void *data, size_t length)
Definition: sw_mgmt.h:213
avs_coap_udp_tx_params_t anjay_sw_mgmt_get_coap_tx_params_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx, const char *download_uri)
Definition: sw_mgmt.h:690
int anjay_sw_mgmt_pkg_install_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:432
int anjay_sw_mgmt_pull_reconnect(anjay_t *anjay)
int anjay_sw_mgmt_activate_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:538
int anjay_sw_mgmt_add_instance(anjay_t *anjay, const anjay_sw_mgmt_instance_initializer_t *instance_initializer)
int anjay_sw_mgmt_remove_instance(anjay_t *anjay, anjay_iid_t iid)
int anjay_sw_mgmt_get_activation_state(anjay_t *anjay, anjay_iid_t iid, bool *out_state)
anjay_sw_mgmt_finish_pkg_install_result_t
Definition: sw_mgmt.h:1003
@ ANJAY_SW_MGMT_FINISH_PKG_INSTALL_SUCCESS_INACTIVE
Definition: sw_mgmt.h:1008
@ ANJAY_SW_MGMT_FINISH_PKG_INSTALL_SUCCESS_ACTIVE
Definition: sw_mgmt.h:1018
@ ANJAY_SW_MGMT_FINISH_PKG_INSTALL_FAILURE
Definition: sw_mgmt.h:1023
int anjay_sw_mgmt_stream_finish_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:256
avs_time_duration_t anjay_sw_mgmt_get_tcp_request_timeout_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx, const char *download_uri)
Definition: sw_mgmt.h:723
int anjay_sw_mgmt_stream_open_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:181
int anjay_sw_mgmt_pkg_uninstall_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:467
const char * anjay_sw_mgmt_get_name_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:347
void anjay_sw_mgmt_reset_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx)
Definition: sw_mgmt.h:311
int anjay_sw_mgmt_get_security_config_t(void *obj_ctx, anjay_iid_t iid, void *inst_ctx, const char *download_uri, anjay_security_config_t *out_security_info)
Definition: sw_mgmt.h:660
void anjay_sw_mgmt_pull_suspend(anjay_t *anjay)
int anjay_sw_mgmt_finish_pkg_install(anjay_t *anjay, anjay_iid_t iid, anjay_sw_mgmt_finish_pkg_install_result_t pkg_install_result)