Removed itzam, and switched to commom library; Known issues: delete key test fails...
[profile/ivi/persistence-client-library.git] / src / persistence_client_library_data_organization.c
1 /******************************************************************************
2  * Project         Persistency
3  * (c) copyright   2012
4  * Company         XS Embedded GmbH
5  *****************************************************************************/
6 /******************************************************************************
7  * This Source Code Form is subject to the terms of the
8  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed
9  * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 ******************************************************************************/
11  /**
12  * @file           persistence_client_library_data_organization.c
13  * @ingroup        Persistence client library
14  * @author         Ingo Huerner
15  * @brief          Implementation of persistence database low level access
16  * @see            
17  */
18
19 #include "persistence_client_library_data_organization.h"
20
21 #include <string.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 // rrsource configuration database name
26 const char* gResTableCfg = "/resource-table-cfg.itz";
27
28 /// configurable default database name
29 const char* gConfigDefault = "/configurable-default-data.itz";
30
31 /// default database name
32 const char* gDefault = "/default-data.itz";
33
34 /// write through database name
35 const char* gWt             = "/wt.itz";
36 /// cached database name
37 const char* gCached        = "/cached.itz";
38
39
40 /// directory structure node name defintion
41 const char* gNode = "/node";
42 /// directory structure user name defintion
43 const char* gUser = "/user/";
44 /// directory structure seat name defintion
45 const char* gSeat = "/seat/";
46
47
48 /// cached path location
49 #define CACHEPREFIX         "/Data/mnt-c/"
50 /// write through path location
51 #define WTPREFIX            "/Data/mnt-wt/"
52
53 /// size of cached path string
54 const int gCPathPrefixSize = sizeof(CACHEPREFIX)-1;
55 /// size of write through string
56 const int gWTPathPrefixSize = sizeof(WTPREFIX)-1;
57
58 /// path for the backup location
59 const char* gBackupPrefix = "/Data/mnt-backup/";
60
61 /// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
62 const char* gLocalCachePath        = CACHEPREFIX "%s";
63 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
64 const char* gLocalWtPath           = WTPREFIX "%s";
65 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
66 const char* gSharedCachePath       = CACHEPREFIX "%s/shared_group_%x";
67 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
68 const char* gSharedWtPath          = WTPREFIX "%s/shared_group_%x";
69 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
70 const char* gSharedPublicCachePath = CACHEPREFIX "%s/shared_public";
71 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
72 const char* gSharedPublicWtPath    = WTPREFIX "%s/shared_public";
73
74 /// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
75 const char* gLocalCachePathKey        = CACHEPREFIX "%s%s";
76 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
77 const char* gLocalWtPathKey           = WTPREFIX "%s%s";
78 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
79 const char* gSharedCachePathKey       = CACHEPREFIX "%s/shared_group_%x%s";
80 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
81 const char* gSharedWtPathKey          = WTPREFIX "%s/shared_group_%x%s";
82 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
83 const char* gSharedPublicCachePathKey = CACHEPREFIX "%s/shared_public%s";
84 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
85 const char* gSharedPublicWtPathKey    = WTPREFIX "%s/shared_public%s";
86
87 /// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/<seat>/<resource>
88 const char* gLocalCacheFilePath        = CACHEPREFIX "%s/user/%d/seat/%d/%s";
89
90
91 const char* gChangeSignal = "PersistenceResChange";
92 const char* gDeleteSignal = "PersistenceResDelete";
93 const char* gCreateSignal = "PersistenceResCreate";
94
95
96 char gNotifykey[DbKeyMaxLen] = {0};
97 unsigned int gNotifyLdbid  = 0;
98 unsigned int gNotifyUserNo = 0;
99 unsigned int gNotifySeatNo = 0;
100 pclNotifyStatus_e       gNotifyReason = 0;
101 PersNotifyRegPolicy_e   gNotifyPolicy = 0;
102
103
104 int gTimeoutMs = 5000;
105
106 int gDbusPendingRvalue = 0;
107
108
109 /// application id
110 char gAppId[MaxAppNameLen] = {0};
111
112
113 /// max key value data size [default 16kB]
114 int gMaxKeyValDataSize = defaultMaxKeyValDataSize;
115
116
117 unsigned int gPclInitialized = PCLnotInitialized;
118
119
120 DltContext gPclDLTContext;
121
122 int(* gChangeNotifyCallback)(pclNotification_s * notifyStruct);
123
124