1 #ifndef PERSISTENCE_CLIENT_LIBRARY_HANDLE_H
2 #define PERSISTENCE_CLIENT_LIBRARY_HANDLE_H
4 /******************************************************************************
7 * Company XS Embedded GmbH
8 *****************************************************************************/
9 /******************************************************************************
10 * This Source Code Form is subject to the terms of the
11 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
12 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 ******************************************************************************/
15 * @file persistence_client_library_handle.h
16 * @ingroup Persistence client library
17 * @author Ingo Huerner
18 * @brief Header of the persistence client library handle.
19 * Library provides an API to access persistent data
23 #include "../include_protected/persistence_client_library_data_organization.h"
24 #include "../include_protected/persistence_client_library_rc_table.h"
27 /// key handle structure definition
28 typedef struct _PersistenceKeyHandle_s
30 PersistenceInfo_s info; /// persistence info
31 char dbPath[DbPathMaxLen]; /// path to the database
32 char dbKey[DbKeyMaxLen]; /// database key
33 char resourceID[DbResIDMaxLen]; /// resourceID
35 PersistenceKeyHandle_s;
38 /// file handle structure definition
39 typedef struct _PersistenceFileHandle_s
41 PersistencePermission_e permission; /// access permission read/write
42 int backupCreated; /// flag to indicate if a backup has already been created
43 char backupPath[DbPathMaxLen]; /// path to the backup file
44 char csumPath[DbPathMaxLen]; /// path to the checksum file
46 PersistenceFileHandle_s;
49 /// persistence key handle array
50 extern PersistenceKeyHandle_s gKeyHandleArray[MaxPersHandle];
53 /// persistence file handle array
54 extern PersistenceFileHandle_s gFileHandleArray[MaxPersHandle];
57 /// open file descriptor handle array
58 extern int gOpenFdArray[MaxPersHandle];
62 * @brief get persistence handle
64 * @return a new handle or 0 if an error occured
66 int get_persistence_handle_idx(char* dbPath, char* key, PersistenceInfo_s* info);
70 * @brief close persistence handle
72 * @param the handle to close
76 int set_persistence_handle_close_idx(int handle, char* dbPath, char* key, PersistenceInfo_s* info);
81 #endif /* PERSISTENCY_CLIENT_LIBRARY_HANDLE_H */