1 /* 2 * Copyright (c) 2022 Laird Connectivity 3 * Copyright (c) 2022 Nordic Semiconductor ASA 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #ifndef H_MCUMGR_FS_MGMT_CALLBACKS_ 9 #define H_MCUMGR_FS_MGMT_CALLBACKS_ 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 /** 16 * @brief MCUmgr fs_mgmt callback API 17 * @defgroup mcumgr_callback_api_fs_mgmt MCUmgr fs_mgmt callback API 18 * @ingroup mcumgr_callback_api 19 * @{ 20 */ 21 22 /** The type of operation that is being requested for a given file access callback. */ 23 enum fs_mgmt_file_access_types { 24 /** Access to read file (file upload). */ 25 FS_MGMT_FILE_ACCESS_READ, 26 27 /** Access to write file (file download). */ 28 FS_MGMT_FILE_ACCESS_WRITE, 29 30 /** Access to get status of file. */ 31 FS_MGMT_FILE_ACCESS_STATUS, 32 33 /** Access to calculate hash or checksum of file. */ 34 FS_MGMT_FILE_ACCESS_HASH_CHECKSUM, 35 }; 36 37 /** 38 * Structure provided in the #MGMT_EVT_OP_FS_MGMT_FILE_ACCESS notification callback: This callback 39 * function is used to notify the application about a pending file read/write request and to 40 * authorise or deny it. Access will be allowed so long as all notification handlers return 41 * #MGMT_ERR_EOK, if one returns an error then access will be denied. 42 */ 43 struct fs_mgmt_file_access { 44 /** Specifies the type of the operation that is being requested. */ 45 enum fs_mgmt_file_access_types access; 46 47 /** 48 * Path and filename of file be accesses, note that this can be changed by handlers to 49 * redirect file access if needed (as long as it does not exceed the maximum path string 50 * size). 51 */ 52 char *filename; 53 }; 54 55 /** 56 * @} 57 */ 58 59 #ifdef __cplusplus 60 } 61 #endif 62 63 #endif 64