le_secStore_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_secStore_common.h
12  *
13  * Type definitions for le_secStore.
14  *
15  */
16 #ifndef LE_SECSTORE_COMMON_H_INCLUDE_GUARD
17 #define LE_SECSTORE_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 #define IFGEN_LE_SECSTORE_PROTOCOL_ID "36b54984790858c948712c081053c8a3"
23 #define IFGEN_LE_SECSTORE_MSG_SIZE 8463
24 /** @addtogroup le_secStore
25  * @{ **/
26 
27 
28 //--------------------------------------------------------------------------------------------------
29 /**
30  * Maximum number of characters and byte storage size permitted for a secure storage item name.
31  */
32 //--------------------------------------------------------------------------------------------------
33 #define LE_SECSTORE_MAX_NAME_SIZE 255
34 
35 //--------------------------------------------------------------------------------------------------
36 /**
37  */
38 //--------------------------------------------------------------------------------------------------
39 #define LE_SECSTORE_MAX_NAME_BYTES 256
40 
41 //--------------------------------------------------------------------------------------------------
42 /**
43  * Maximum number of bytes for each item in secure storage.
44  */
45 //--------------------------------------------------------------------------------------------------
46 #define LE_SECSTORE_MAX_ITEM_SIZE 8192
47 
48 //--------------------------------------------------------------------------------------------------
49 /**
50  * Version of the SecStore data storage
51  */
52 //--------------------------------------------------------------------------------------------------
53 typedef enum
54 {
56  ///< Data is stored in modem SFS
58  ///< Data is encrypted with TrustZone and stored in ConfigTree
60  ///< Data is encrypted with IoTKeystore and stored in ConfigTree
61 }
63 
64 
65 
66 //--------------------------------------------------------------------------------------------------
67 /**
68  * Get if this client bound locally.
69  */
70 //--------------------------------------------------------------------------------------------------
71 LE_SHARED bool ifgen_le_secStore_HasLocalBinding
72 (
73  void
74 );
75 
76 
77 //--------------------------------------------------------------------------------------------------
78 /**
79  * Init data that is common across all threads
80  */
81 //--------------------------------------------------------------------------------------------------
82 LE_SHARED void ifgen_le_secStore_InitCommonData
83 (
84  void
85 );
86 
87 
88 //--------------------------------------------------------------------------------------------------
89 /**
90  * Perform common initialization and open a session
91  */
92 //--------------------------------------------------------------------------------------------------
93 LE_SHARED le_result_t ifgen_le_secStore_OpenSession
94 (
95  le_msg_SessionRef_t _ifgen_sessionRef,
96  bool isBlocking
97 );
98 
99 //--------------------------------------------------------------------------------------------------
100 /**
101  * Writes an item to secure storage. If the item already exists, it'll be overwritten with
102  * the new value. If the item doesn't already exist, it'll be created.
103  * If the item name is not valid or the buffer is NULL, this function will kill the calling client.
104  *
105  * @return
106  * LE_OK if successful.
107  * LE_NO_MEMORY if there isn't enough memory to store the item.
108  * LE_UNAVAILABLE if the secure storage is currently unavailable.
109  * LE_FAULT if there was some other error.
110  */
111 //--------------------------------------------------------------------------------------------------
112 LE_SHARED le_result_t ifgen_le_secStore_Write
113 (
114  le_msg_SessionRef_t _ifgen_sessionRef,
115  const char* LE_NONNULL name,
116  ///< [IN] Name of the secure storage item.
117  const uint8_t* bufPtr,
118  ///< [IN] Buffer containing the data to store.
119  size_t bufSize
120  ///< [IN]
121 );
122 
123 //--------------------------------------------------------------------------------------------------
124 /**
125  * Reads an item from secure storage.
126  * If the item name is not valid or the buffer is NULL, this function will kill the calling client.
127  *
128  * @return
129  * LE_OK if successful.
130  * LE_OVERFLOW if the buffer is too small to hold the entire item. No data will be written to
131  * the buffer in this case.
132  * LE_NOT_FOUND if the item doesn't exist.
133  * LE_UNAVAILABLE if the secure storage is currently unavailable.
134  * LE_FAULT if there was some other error.
135  */
136 //--------------------------------------------------------------------------------------------------
137 LE_SHARED le_result_t ifgen_le_secStore_Read
138 (
139  le_msg_SessionRef_t _ifgen_sessionRef,
140  const char* LE_NONNULL name,
141  ///< [IN] Name of the secure storage item.
142  uint8_t* bufPtr,
143  ///< [OUT] Buffer to store the data in.
144  size_t* bufSizePtr
145  ///< [INOUT]
146 );
147 
148 //--------------------------------------------------------------------------------------------------
149 /**
150  * Deletes an item from secure storage.
151  * If the item name is not valid, this function will kill the calling client.
152  *
153  * @return
154  * LE_OK if successful.
155  * LE_NOT_FOUND if the item doesn't exist.
156  * LE_UNAVAILABLE if the secure storage is currently unavailable.
157  * LE_FAULT if there was some other error.
158  */
159 //--------------------------------------------------------------------------------------------------
160 LE_SHARED le_result_t ifgen_le_secStore_Delete
161 (
162  le_msg_SessionRef_t _ifgen_sessionRef,
163  const char* LE_NONNULL name
164  ///< [IN] Name of the secure storage item.
165 );
166 
167 //--------------------------------------------------------------------------------------------------
168 /**
169  * Gets the size of the buffer required to read an item from the secure storage.
170  * It can be actual size of the data, or some slightly greater number.
171  *
172  * @return
173  * LE_OK if successful.
174  * LE_NOT_FOUND if the path doesn't exist.
175  * LE_UNAVAILABLE if the secure storage is currently unavailable.
176  * LE_FAULT if there was some other error.
177  */
178 //--------------------------------------------------------------------------------------------------
179 LE_SHARED le_result_t ifgen_le_secStore_GetMinimumBufferSize
180 (
181  le_msg_SessionRef_t _ifgen_sessionRef,
182  const char* LE_NONNULL path,
183  ///< [IN] Path of the secure storage item.
184  uint32_t* sizePtr
185  ///< [OUT] Number that is equal to or greater than
186  ///< the size of the item, in bytes.
187 );
188 
189 //--------------------------------------------------------------------------------------------------
190 /**
191  * Start the "batch write" that aggregates multiple write/delete operation into a single batch
192  * with the purpose of improving the performance.
193  *
194  * The performance is optimized by postponing the data serialization (triggered by write/delete
195  * API calls by this particular client) until the function EndBatchWrite is called.
196  *
197  * @return
198  * LE_OK if successful.
199  * LE_FAULT if there was error.
200  */
201 //--------------------------------------------------------------------------------------------------
202 LE_SHARED le_result_t ifgen_le_secStore_StartBatchWrite
203 (
204  le_msg_SessionRef_t _ifgen_sessionRef
205 );
206 
207 //--------------------------------------------------------------------------------------------------
208 /**
209  * Ends the "batch write" operation and serializes the data to the persistent storage.
210  *
211  * @note - Failure to finish the (previously started) batch write may result in data loss.
212  * - This is not a transactional mechanism, i.e. the possibility to roll back the changes
213  * is not provided.
214  *
215  * @return
216  * LE_OK if successful.
217  * LE_FAULT if there was error.
218  */
219 //--------------------------------------------------------------------------------------------------
220 LE_SHARED le_result_t ifgen_le_secStore_EndBatchWrite
221 (
222  le_msg_SessionRef_t _ifgen_sessionRef
223 );
224 /** @} **/
225 #endif // LE_SECSTORE_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
Data is stored in modem SFS.
Definition: le_secStore_common.h:55
le_secStore_Version_t
Definition: le_secStore_common.h:53
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860
Data is encrypted with IoTKeystore and stored in ConfigTree.
Definition: le_secStore_common.h:59
Data is encrypted with TrustZone and stored in ConfigTree.
Definition: le_secStore_common.h:57