3c1ecde479482fa036af3d6deec83156da28f675
[profile/ivi/persistence-client-library.git] / include_protected / persistence_client_library_data_organization.h
1 #ifndef PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_H
2 #define PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_H
3
4 /******************************************************************************
5  * Project         Persistency
6  * (c) copyright   2012
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 ******************************************************************************/
14  /**
15  * @file           persistence_client_library_data_organization.h
16  * @ingroup        Persistence client library
17  * @author         Ingo Huerner
18  * @brief          Header of the persistence client library data organization.
19  * @see            
20  */
21
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #define  PERSIST_CLIENT_LIBRARY_DATA_ORGANIZATION_INTERFACE_VERSION   (0x02000000U)
28
29 #include "../include/persistence_client_library_error_def.h"
30 #include "../include/persistence_client_library_key.h"
31
32 #include <dlt/dlt.h>
33 #include <dlt/dlt_common.h>
34
35 #include <string.h>
36 #include <stdio.h>
37
38
39 /// enumerator used to identify the policy to manage the data
40 typedef enum _PersNotifyRegPolicy_e
41 {
42    Notify_register   = 0,  /**< register to change notifications*/
43    Notify_unregister = 1,  /**< unregister for change notifications */
44    Notify_lastEntry,       /**<last entry */
45 } PersNotifyRegPolicy_e;
46
47
48 /// constant definitions
49 enum _PersistenceConstantDef
50 {
51    ResIsNoFile          = 0,        /// flag to identify that resource a not file
52    ResIsFile            = 1,        /// flag to identify that resource a file
53    AccessNoLock         = 1,        /// flag to indicate that access is not locked
54
55    PCLnotInitialized    = 0,        /// 
56    PCLinitialized       = 1,        ///
57
58    FileClosed           = 0,
59    FileOpen             = 1,
60
61    NsmShutdownNormal       = 1,        /// lifecycle shutdown normal
62    NsmErrorStatus_OK       = 1,
63    NsmErrorStatus_Fail     = -1,
64
65    ChecksumBufSize         = 64,       /// max checksum size
66
67    DbusSubMatchSize        = 12,       /// max character sub match size
68    DbusMatchRuleSize       = 300,      /// max character size of the dbus match rule size
69
70    PrctKeySize             = 64,       /// persistence resource config table max key size
71    PrctValueSize           = 256,      /// persistence resource config table max value size
72    PrctDbTableSize         = 1024,     /// number of persistence resource config tables to store
73
74    RDRWBufferSize          = 1024,     /// write buffer size
75
76    DbKeySize               = 64,       /// database max key size
77    DbValueSize             = 16384,    /// database max value size
78    DbTableSize             = 1024,     /// database table size
79
80    PasMsg_Block            = 0x0001,   /// persistence administration service block access
81    PasMsg_Unblock          = 0x0002,   /// persistence administration service unblock access
82    PasMsg_WriteBack        = 0x0010,   /// persistence administration service write_back
83
84    PasErrorStatus_RespPend = 0x0001,   /// persistence administration service msg return status
85    PasErrorStatus_OK       = 0x0002,   /// persistence administration service msg return status
86    PasErrorStatus_FAIL     = 0x8000,   /// persistence administration service msg return status
87
88    CustLibMaxLen = 128,             /// max length of the custom library name and path
89    DbKeyMaxLen   = 128,             /// max database key length
90    DbResIDMaxLen = 128,             /// max database key length
91    DbPathMaxLen  = 128,             /// max database path length
92    MaxAppNameLen = 128,             /// max application name
93    MaxPersHandle = 256,             /// max number of parallel open persistence handles
94
95    MaxConfKeyLengthResp    = 32,    /// length of the config key responsible name
96    MaxConfKeyLengthCusName = 32,    /// length of the config key custom name
97    MaxRctLengthCustom_ID   = 64,    /// length of the customer ID
98
99    defaultMaxKeyValDataSize = 16384 /// default limit the key-value data size to 16kB
100 };
101
102
103
104 /// resource configuration table name
105 extern const char* gResTableCfg;
106
107 /// configurable default database name
108 extern const char* gConfigDefault;
109
110 /// default database name
111 extern const char* gDefault;
112
113
114 /// shared cached database
115 extern const char* gCached;
116
117 /// write through database name
118 extern const char* gWt;
119
120
121 /// directory structure node name defintion
122 extern const char* gNode;
123 /// directory structure user name defintion
124 extern const char* gUser;
125 /// directory structure seat name defintion
126 extern const char* gSeat;
127
128
129 /// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name>
130 extern const char* gLocalCachePath;
131 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
132 extern const char* gLocalWtPath;
133 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
134 extern const char* gSharedCachePath;
135 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
136 extern const char* gSharedWtPath;
137 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
138 extern const char* gSharedPublicCachePath;
139 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
140 extern const char* gSharedPublicWtPath;
141
142 /// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name>
143 extern const char* gLocalCachePathKey;
144 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
145 extern const char* gLocalWtPathKey;
146 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
147 extern const char* gSharedCachePathKey;
148 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
149 extern const char* gSharedWtPathKey;
150 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
151 extern const char* gSharedPublicCachePathKey;
152 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
153 extern const char* gSharedPublicWtPathKey;
154
155 /// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/>userno>/<seat>/>seatno>/<resource>
156 extern const char* gLocalCacheFilePath;
157
158 /// application id
159 extern char gAppId[MaxAppNameLen];
160
161 /// max key value data size
162 extern int gMaxKeyValDataSize;
163
164 /// the DLT context
165 extern DltContext gDLTContext;
166
167 /// flag to indicate if client library has been initialized
168 extern unsigned int gPclInitialized;
169
170
171 /// change signal string
172 extern const char* gChangeSignal;
173 /// delete signal string
174 extern const char* gDeleteSignal;
175 /// create signal string
176 extern const char* gCreateSignal;
177
178 /// notification key
179 extern char gSendNotifykey[DbKeyMaxLen];
180 extern unsigned int gSendNotifyLdbid;
181 extern unsigned int gSendNotifyUserNo;
182 extern unsigned int gSendNotifySeatNo;
183 extern pclNotifyStatus_e gSendNotifyReason;
184
185 extern char gRegNotifykey[DbKeyMaxLen];
186 extern unsigned int gRegNotifyLdbid;
187 extern unsigned int gRegNotifyUserNo;
188 extern unsigned int gRegNotifySeatNo;
189 extern PersNotifyRegPolicy_e gRegNotifyPolicy;
190
191 // dbus timeout
192 extern int gTimeoutMs;
193
194 // dbus pending return value
195 extern int gDbusPendingRvalue;
196
197
198 /**
199  * @brief definition of change callback function
200  *
201  * @param pclNotification_s callback notification structure
202  */
203 extern int(* gChangeNotifyCallback)(pclNotification_s * notifyStruct);
204
205
206 #ifdef __cplusplus
207 }
208 #endif
209
210 #endif /* PERSISTENCY_CLIENT_LIBRARY_DATA_ORGANIZATION_H */
211