diff options
Diffstat (limited to 'src/persistence_client_library_data_organization.h')
-rw-r--r-- | src/persistence_client_library_data_organization.h | 262 |
1 files changed, 262 insertions, 0 deletions
diff --git a/src/persistence_client_library_data_organization.h b/src/persistence_client_library_data_organization.h new file mode 100644 index 0000000..21075b4 --- /dev/null +++ b/src/persistence_client_library_data_organization.h @@ -0,0 +1,262 @@ +#ifndef PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_H +#define PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_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_data_organization.h + * @ingroup Persistence client library + * @author Ingo Huerner + * @brief Header of the persistence client library data organization. + * @see + */ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define PERSIST_CLIENT_LIBRARY_DATA_ORGANIZATION_INTERFACE_VERSION (0x03000000U) + +#include "../include/persistence_client_library_error_def.h" +#include "../include/persistence_client_library_key.h" + +#include <persComRct.h> + +#include <dlt/dlt.h> +#include <dlt/dlt_common.h> + +#include <string.h> +#include <stdio.h> + + + +/// structure used to manage database context +typedef struct _PersistenceDbContext_s +{ + unsigned int ldbid; + unsigned int user_no; + unsigned int seat_no; +} PersistenceDbContext_s; + +/// persistence information +typedef struct _PersistenceInfo_s +{ + PersistenceDbContext_s context; /**< database context*/ + PersistenceConfigurationKey_s configKey; /**< prct configuration key*/ + +} PersistenceInfo_s; + + +/** storages to manage the data */ +typedef enum PersDefaultType_e_ +{ + PersDefaultType_Configurable = 0, /**< get the data from configurable defaults */ + PersDefaultType_Factory, /**< get the data from factory defaults */ + + /** insert new entries here ... */ + PersDefaultType_LastEntry /**< last entry */ + +} PersDefaultType_e; + +/** storages to manage the data */ +typedef enum PersGetDefault_e_ +{ + PersGetDefault_Data = 0, /**< get the data from configurable defaults */ + PersGetDefault_Size, /**< get the data from factory defaults */ + + /** insert new entries here ... */ + PersGetDefault_LastEntry /**< last entry */ + +} PersGetDefault_e; + +/// enumerator used to identify the policy to manage the data +typedef enum _PersNotifyRegPolicy_e +{ + Notify_register = 0, /**< register to change notifications*/ + Notify_unregister = 1, /**< unregister for change notifications */ + Notify_lastEntry, /**<last entry */ +} PersNotifyRegPolicy_e; + + +/// constant definitions +enum _PersistenceConstantDef +{ + ResIsNoFile = 0, /// flag to identify that resource a not file + ResIsFile = 1, /// flag to identify that resource a file + AccessNoLock = 1, /// flag to indicate that access is not locked + + PCLnotInitialized = 0, /// indication if PCL is not initialized + PCLinitialized = 1, /// indication if PCL is initialized + + FileClosed = 0, /// flag to identify if file will be closed + FileOpen = 1, /// flag to identify if file has been opend + + NsmShutdownNormal = 1, /// lifecycle shutdown normal + NsmErrorStatus_OK = 1, /// lifecycle return OK idicator + NsmErrorStatus_Fail = -1, /// lifecycle return failed indicator + + ChecksumBufSize = 64, /// max checksum size + + DbusSubMatchSize = 12, /// max character sub match size + DbusMatchRuleSize = 300, /// max character size of the dbus match rule size + + PrctKeySize = 64, /// persistence resource config table max key size + PrctValueSize = 256, /// persistence resource config table max value size + PrctDbTableSize = 1024, /// number of persistence resource config tables to store + + RDRWBufferSize = 1024, /// write buffer size + + DbKeySize = 64, /// database max key size + DbValueSize = 16384, /// database max value size + DbTableSize = 1024, /// database table size + + PasMsg_Block = 0x0001, /// persistence administration service block access + PasMsg_Unblock = 0x0002, /// persistence administration service unblock access + PasMsg_WriteBack = 0x0010, /// persistence administration service write_back + + PasErrorStatus_RespPend = 0x0001, /// persistence administration service msg return status + PasErrorStatus_OK = 0x0002, /// persistence administration service msg return status + PasErrorStatus_FAIL = 0x8000, /// persistence administration service msg return status + + CustLibMaxLen = 128, /// max length of the custom library name and path + DbKeyMaxLen = 128, /// max database key length + DbResIDMaxLen = 128, /// max database key length + DbPathMaxLen = 128, /// max database path length + MaxAppNameLen = 128, /// max application name + MaxPersHandle = 256, /// max number of parallel open persistence handles + + MaxConfKeyLengthResp = 32, /// length of the config key responsible name + MaxConfKeyLengthCusName = 32, /// length of the config key custom name + MaxRctLengthCustom_ID = 64, /// length of the customer ID + + defaultMaxKeyValDataSize = 16384 /// default limit the key-value data size to 16kB +}; + + +/// resource configuration table name +extern const char* gResTableCfg; + +/// configurable default database name +extern const char* gConfigDefault; + +/// default database name +extern const char* gDefault; + + +/// shared cached database +extern const char* gCached; + +/// write through database name +extern const char* gWt; + + +/// directory structure node name defintion +extern const char* gNode; +/// directory structure user name defintion +extern const char* gUser; +/// directory structure seat name defintion +extern const char* gSeat; + +extern const char* gBackupPrefix; + +extern const int gCPathPrefixSize; +extern const int gWTPathPrefixSize; + +/// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name> +extern const char* gLocalCachePath; +/// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name> +extern const char* gLocalWtPath; +/// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name> +extern const char* gSharedCachePath; +/// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name> +extern const char* gSharedWtPath; +/// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name> +extern const char* gSharedPublicCachePath; +/// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name> +extern const char* gSharedPublicWtPath; + +/// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name> +extern const char* gLocalCachePathKey; +/// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name> +extern const char* gLocalWtPathKey; +/// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name> +extern const char* gSharedCachePathKey; +/// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name> +extern const char* gSharedWtPathKey; +/// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name> +extern const char* gSharedPublicCachePathKey; +/// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name> +extern const char* gSharedPublicWtPathKey; + +/// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/>userno>/<seat>/>seatno>/<resource> +extern const char* gLocalCacheFilePath; + +/// application id +extern char gAppId[MaxAppNameLen]; + +/// max key value data size +extern int gMaxKeyValDataSize; + +/// the DLT context +extern DltContext gPclDLTContext; + +/// flag to indicate if client library has been initialized +extern unsigned int gPclInitialized; + + +/// change signal string +extern const char* gChangeSignal; +/// delete signal string +extern const char* gDeleteSignal; +/// create signal string +extern const char* gCreateSignal; + + +/** + * Global notification variables, will be used to pass + * the notification information into the mainloop. + */ +/// notification key string +extern char gNotifykey[DbKeyMaxLen]; +/// notification lbid +extern unsigned int gNotifyLdbid; +/// notification user number +extern unsigned int gNotifyUserNo; +/// notification seat number +extern unsigned int gNotifySeatNo; +/// notification reason (created, changed, deleted) +extern pclNotifyStatus_e gNotifyReason; +/// notification policy (register or unregister) +extern PersNotifyRegPolicy_e gNotifyPolicy; + + +// dbus timeout (5 seconds) +extern int gTimeoutMs; + +// dbus pending return value +extern int gDbusPendingRvalue; + + +/** + * @brief definition of change callback function + * + * @param pclNotification_s callback notification structure + */ +extern int(* gChangeNotifyCallback)(pclNotification_s * notifyStruct); + + +#ifdef __cplusplus +} +#endif + +#endif /* PERSISTENCY_CLIENT_LIBRARY_DATA_ORGANIZATION_H */ + |