1 #ifndef PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_H
2 #define PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_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_data_organization.h
16 * @ingroup Persistence client library
17 * @author Ingo Huerner
18 * @brief Header of the persistence client library data organization.
27 #define PERSIST_CLIENT_LIBRARY_DATA_ORGANIZATION_INTERFACE_VERSION (0x03000000U)
29 #include "../include/persistence_client_library_error_def.h"
30 #include "../include/persistence_client_library_key.h"
32 #include <persComRct.h>
35 #include <dlt/dlt_common.h>
42 /// structure used to manage database context
43 typedef struct _PersistenceDbContext_s
48 } PersistenceDbContext_s;
50 /// persistence information
51 typedef struct _PersistenceInfo_s
53 PersistenceDbContext_s context; /**< database context*/
54 PersistenceConfigurationKey_s configKey; /**< prct configuration key*/
59 /** storages to manage the data */
60 typedef enum PersDefaultType_e_
62 PersDefaultType_Configurable = 0, /**< get the data from configurable defaults */
63 PersDefaultType_Factory, /**< get the data from factory defaults */
65 /** insert new entries here ... */
66 PersDefaultType_LastEntry /**< last entry */
70 /** storages to manage the data */
71 typedef enum PersGetDefault_e_
73 PersGetDefault_Data = 0, /**< get the data from configurable defaults */
74 PersGetDefault_Size, /**< get the data from factory defaults */
76 /** insert new entries here ... */
77 PersGetDefault_LastEntry /**< last entry */
81 /// enumerator used to identify the policy to manage the data
82 typedef enum _PersNotifyRegPolicy_e
84 Notify_register = 0, /**< register to change notifications*/
85 Notify_unregister = 1, /**< unregister for change notifications */
86 Notify_lastEntry, /**<last entry */
87 } PersNotifyRegPolicy_e;
90 /// constant definitions
91 enum _PersistenceConstantDef
93 ResIsNoFile = 0, /// flag to identify that resource a not file
94 ResIsFile = 1, /// flag to identify that resource a file
95 AccessNoLock = 1, /// flag to indicate that access is not locked
97 PCLnotInitialized = 0, /// indication if PCL is not initialized
98 PCLinitialized = 1, /// indication if PCL is initialized
100 FileClosed = 0, /// flag to identify if file will be closed
101 FileOpen = 1, /// flag to identify if file has been opend
103 Shutdown_Partial = 0, /// make partial Shutdown (close but not free everything)
104 Shutdown_Full = 1, /// make complete Shutdown (close and free everything)
105 Shutdown_MaxCount = 3, /// max number of shutdown cancel calls
107 NsmShutdownNormal = 1, /// lifecycle shutdown normal
108 NsmErrorStatus_OK = 1, /// lifecycle return OK indicator
109 NsmErrorStatus_Fail = -1, /// lifecycle return failed indicator
111 ChecksumBufSize = 64, /// max checksum size
113 DbusSubMatchSize = 12, /// max character sub match size
114 DbusMatchRuleSize = 300, /// max character size of the dbus match rule size
116 PrctKeySize = 64, /// persistence resource config table max key size
117 PrctValueSize = 256, /// persistence resource config table max value size
118 PrctDbTableSize = 1024, /// number of persistence resource config tables to store
120 RDRWBufferSize = 1024, /// write buffer size
122 DbKeySize = 64, /// database max key size
123 DbValueSize = 16384, /// database max value size
124 DbTableSize = 1024, /// database table size
126 PasMsg_Block = 0x0001, /// persistence administration service block access
127 PasMsg_Unblock = 0x0002, /// persistence administration service unblock access
128 PasMsg_WriteBack = 0x0010, /// persistence administration service write_back
130 PasErrorStatus_RespPend = 0x0001, /// persistence administration service msg return status
131 PasErrorStatus_OK = 0x0002, /// persistence administration service msg return status
132 PasErrorStatus_FAIL = 0x8000, /// persistence administration service msg return status
134 CustLibMaxLen = 128, /// max length of the custom library name and path
135 DbKeyMaxLen = 128, /// max database key length
136 DbResIDMaxLen = 128, /// max database key length
137 DbPathMaxLen = 128, /// max database path length
138 MaxAppNameLen = 128, /// max application name
139 MaxPersHandle = 256, /// max number of parallel open persistence handles
141 MaxConfKeyLengthResp = 32, /// length of the config key responsible name
142 MaxConfKeyLengthCusName = 32, /// length of the config key custom name
143 MaxRctLengthCustom_ID = 64, /// length of the customer ID
145 defaultMaxKeyValDataSize = 16384 /// default limit the key-value data size to 16kB
149 /// resource configuration table name
150 extern const char* gResTableCfg;
152 /// configurable default database name
153 extern const char* gConfigDefault;
155 /// default database name
156 extern const char* gDefault;
159 /// shared cached database
160 extern const char* gCached;
162 /// write through database name
163 extern const char* gWt;
166 /// directory structure node name definition
167 extern const char* gNode;
168 /// directory structure user name definition
169 extern const char* gUser;
170 /// directory structure seat name definition
171 extern const char* gSeat;
173 /// default data folder name definition
174 extern const char* gDefDataFolder;
176 /// path for the backup location
177 extern const char* gBackupPrefix;
179 /// size of cached prefix string
180 extern const int gCPathPrefixSize;
181 /// size of write through prefix string
182 extern const int gWTPathPrefixSize;
184 /// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name>
185 extern const char* gLocalCachePath;
186 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
187 extern const char* gLocalWtPath;
188 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
189 extern const char* gSharedCachePath;
190 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
191 extern const char* gSharedWtPath;
192 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
193 extern const char* gSharedPublicCachePath;
194 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
195 extern const char* gSharedPublicWtPath;
197 /// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name>
198 extern const char* gLocalCachePathKey;
199 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
200 extern const char* gLocalWtPathKey;
201 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
202 extern const char* gSharedCachePathKey;
203 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
204 extern const char* gSharedWtPathKey;
205 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
206 extern const char* gSharedPublicCachePathKey;
207 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
208 extern const char* gSharedPublicWtPathKey;
210 /// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/>userno>/<seat>/>seatno>/<resource>
211 extern const char* gLocalCacheFilePath;
214 extern char gAppId[MaxAppNameLen];
216 /// max key value data size
217 extern int gMaxKeyValDataSize;
220 extern DltContext gPclDLTContext;
222 /// flag to indicate if client library has been initialized
223 extern unsigned int gPclInitialized;
226 /// change signal string
227 extern const char* gChangeSignal;
228 /// delete signal string
229 extern const char* gDeleteSignal;
230 /// create signal string
231 extern const char* gCreateSignal;
235 * Global notification variables, will be used to pass
236 * the notification information into the mainloop.
238 /// notification key string
239 extern char gNotifykey[DbKeyMaxLen];
240 /// notification lbid
241 extern unsigned int gNotifyLdbid;
242 /// notification user number
243 extern unsigned int gNotifyUserNo;
244 /// notification seat number
245 extern unsigned int gNotifySeatNo;
246 /// notification reason (created, changed, deleted)
247 extern pclNotifyStatus_e gNotifyReason;
248 /// notification policy (register or unregister)
249 extern PersNotifyRegPolicy_e gNotifyPolicy;
252 // dbus timeout (5 seconds)
253 extern int gTimeoutMs;
255 // dbus pending return value
256 extern int gDbusPendingRvalue;
260 * @brief definition of change callback function
262 * @param pclNotification_s callback notification structure
264 extern int(* gChangeNotifyCallback)(pclNotification_s * notifyStruct);
271 #endif /* PERSISTENCY_CLIENT_LIBRARY_DATA_ORGANIZATION_H */