summaryrefslogtreecommitdiff
path: root/src/persistence_client_library_handle.h
blob: 6d56c46ef332520d5cb64443a1ace0bb49f6069d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef PERSISTENCE_CLIENT_LIBRARY_HANDLE_H
#define PERSISTENCE_CLIENT_LIBRARY_HANDLE_H

/******************************************************************************
 * Project         Persistency
 * (c) copyright   2012
 * Company         XS Embedded GmbH
 *****************************************************************************/
/******************************************************************************
 * This Source Code Form is subject to the terms of the
 * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed
 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
******************************************************************************/
 /**
 * @file           persistence_client_library_handle.h
 * @ingroup        Persistence client library
 * @author         Ingo Huerner
 * @brief          Header of the persistence client library handle.
 *                 Library provides an API to access persistent data
 * @see            
 */

#include "../include_protected/persistence_client_library_data_organization.h"
#include "../include_protected/persistence_client_library_rc_table.h"


/// key handle structure definition
typedef struct _PersistenceKeyHandle_s
{
   PersistenceInfo_s info;          /// persistence info
   char dbPath[DbPathMaxLen];       /// path to the database
   char dbKey[DbKeyMaxLen];         /// database key
   char resourceID[DbResIDMaxLen];  /// resourceID
}
PersistenceKeyHandle_s;


/// file handle structure definition
typedef struct _PersistenceFileHandle_s
{
   PersistencePermission_e permission;    /// access permission read/write
   int backupCreated;                     /// flag to indicate if a backup has already been created
   char backupPath[DbPathMaxLen];         /// path to the backup file
   char csumPath[DbPathMaxLen];           /// path to the checksum file
}
PersistenceFileHandle_s;


/// persistence key handle array
extern PersistenceKeyHandle_s gKeyHandleArray[MaxPersHandle];


/// persistence file handle array
extern PersistenceFileHandle_s gFileHandleArray[MaxPersHandle];


/// open file descriptor handle array
extern int gOpenFdArray[MaxPersHandle];


/**
 * @brief get persistence handle
 *
 * @return a new handle or 0 if an error occured
 */
int get_persistence_handle_idx();


/**
 * @brief close persistence handle
 *
 * @param the handle to close
 */
void set_persistence_handle_close_idx(int handle);




#endif /* PERSISTENCY_CLIENT_LIBRARY_HANDLE_H */