Line data Source code
1 0 : /*
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 File System Management Callbacks API
17 : * @defgroup mcumgr_callback_api_fs_mgmt File System Management Callbacks
18 : * @ingroup mcumgr_fs_mgmt
19 : * @ingroup mcumgr_callback_api
20 : * @{
21 : */
22 :
23 : /** The type of operation that is being requested for a given file access callback. */
24 1 : enum fs_mgmt_file_access_types {
25 : /** Access to read file (file download). */
26 : FS_MGMT_FILE_ACCESS_READ,
27 :
28 : /** Access to write file (file upload). */
29 : FS_MGMT_FILE_ACCESS_WRITE,
30 :
31 : /** Access to get status of file. */
32 : FS_MGMT_FILE_ACCESS_STATUS,
33 :
34 : /** Access to calculate hash or checksum of file. */
35 : FS_MGMT_FILE_ACCESS_HASH_CHECKSUM,
36 : };
37 :
38 : /**
39 : * Structure provided in the #MGMT_EVT_OP_FS_MGMT_FILE_ACCESS notification callback: This callback
40 : * function is used to notify the application about a pending file read/write request and to
41 : * authorise or deny it. Access will be allowed so long as all notification handlers return
42 : * #MGMT_ERR_EOK, if one returns an error then access will be denied.
43 : */
44 1 : struct fs_mgmt_file_access {
45 : /** Specifies the type of the operation that is being requested. */
46 1 : enum fs_mgmt_file_access_types access;
47 :
48 : /**
49 : * Path and filename of file be accesses, note that this can be changed by handlers to
50 : * redirect file access if needed (as long as it does not exceed the maximum path string
51 : * size).
52 : */
53 1 : char *filename;
54 : };
55 :
56 : /**
57 : * @}
58 : */
59 :
60 : #ifdef __cplusplus
61 : }
62 : #endif
63 :
64 : #endif
|