diff options
author | Guy Sagnes <guy.sagnes@continental-corporation.com> | 2014-02-25 10:32:29 +0100 |
---|---|---|
committer | Ralf Anton Beier <ralf.anton.beier@continental-corporation.com> | 2014-02-25 11:33:41 +0100 |
commit | 880e7ffe185e5b410ee6183c4ce355a8a204ab28 (patch) | |
tree | 9c18d6aecfaf69a6753b4c2f251583cfe9f3722e /inc/protected | |
parent | 94b07e2221c3333a5a54f689eca4249667892f74 (diff) | |
download | persistence-common-object-880e7ffe185e5b410ee6183c4ce355a8a204ab28.tar.gz |
Added version 1.0.1
12.12.2013 * add missing licenses information / update after review feedback 20131212 - J.Kowalski
03.12.2013 * Persistence Common Object - OIP BL 0.9.130
08.08.2013 * Add instrumentation for debug purposes (low level db access)
18.06.2013 * persistence-common version 1.0.1
- Add makefile to allow creation of auto-generated code
- Default error handler causes the termination of the calling process
- de-central build of the common part
02.05.2013 * initial version of the common persistence libraries
Change-Id: I6ac6b7f1fe453537835ac32f664c04d537d732db
Signed-off-by: Guy Sagnes <guy.sagnes@continental-corporation.com>
Diffstat (limited to 'inc/protected')
-rw-r--r-- | inc/protected/persComDataOrg.h | 265 | ||||
-rw-r--r-- | inc/protected/persComDbAccess.h | 154 | ||||
-rw-r--r-- | inc/protected/persComErrors.h | 69 | ||||
-rw-r--r-- | inc/protected/persComIpc.h | 309 | ||||
-rw-r--r-- | inc/protected/persComRct.h | 226 | ||||
-rw-r--r-- | inc/protected/persComTypes.h | 213 |
6 files changed, 1236 insertions, 0 deletions
diff --git a/inc/protected/persComDataOrg.h b/inc/protected/persComDataOrg.h new file mode 100644 index 0000000..0c9a4bb --- /dev/null +++ b/inc/protected/persComDataOrg.h @@ -0,0 +1,265 @@ +#ifndef OSS_PERSISTENCE_COMMON_DATA_ORGANIZATION_H +#define OSS_PERSISTENCE_COMMON_DATA_ORGANIZATION_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Ionut.Ieremie@continental-corporation.com +* +* Interface: protected - specifies the organization of Genivi's persistence data +* +* The file defines contains the defines according to +* https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface +* +* 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/. +* +* Date Author Reason +* 2013.03.21 uidl9757 3.1.0.0 CSP_WZ#2798: Updates according to changes in data organization +* 2013.01.23 uidl9757 3.0.0.0 CSP_WZ#2060: CoC_SSW:Persistence: common interface to be used by both PCL and PAS +* +**********************************************************************************************************************/ + +/** \defgroup PERS_COM_DATA_ORG Data organization API + * \{ + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /** #ifdef __cplusplus */ + +/** \defgroup PERS_DATA_ORG_IF_VERSION Interface version + * \{ + */ +#define PERS_COM_DATA_ORG_INTERFACE_VERSION (0x03010000U) +/** \} */ + +/** \defgroup PERS_ORG_DEFINES Max path length + * \{ + */ +/** max path length when accessing a file (absolute path + filename) */ +#define PERS_ORG_MAX_LENGTH_PATH_FILENAME 255 +/** \} */ + +/** \defgroup PERS_ORG_DATABASE_NAMES Databases' names + * \{ + */ + +/** resource configuration table name */ +#define PERS_ORG_RCT_NAME "resource-table-cfg.itz" +#define PERS_ORG_RCT_NAME_ "/"PERS_ORG_RCT_NAME +extern const char* gResTableCfg; /**< PERS_ORG_RCT_NAME_ */ + +/** local factory-default database */ +#define PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME "default-data.itz" +#define PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME_ "/"PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME +extern const char* gLocalFactoryDefault; /**< PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME_ */ + +/** local configurable-default database */ +#define PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME "configurable-default-data.itz" +#define PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME_ "/"PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME +extern const char* gLocalConfigurableDefault; /**< PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME_ */ + + +/** shared cached default database */ +#define PERS_ORG_SHARED_CACHE_DEFAULT_DB_NAME "cached-default.itz" +#define PERS_ORG_SHARED_CACHE_DEFAULT_DB_NAME_ "/"PERS_ORG_SHARED_CACHE_DEFAULT_DB_NAME +extern const char* gSharedCachedDefault; /**< PERS_ORG_SHARED_CACHE_DEFAULT_DB_NAME_ */ + + +/** shared cached database */ +#define PERS_ORG_SHARED_CACHE_DB_NAME "cached.itz" +#define PERS_ORG_SHARED_CACHE_DB_NAME_ "/"PERS_ORG_SHARED_CACHE_DB_NAME +extern const char* gSharedCached; /**< PERS_ORG_SHARED_CACHE_DB_NAME_ */ + + +/** shared write through default database */ +#define PERS_ORG_SHARED_WT_DEFAULT_DB_NAME "wt-default.itz" +#define PERS_ORG_SHARED_WT_DEFAULT_DB_NAME_ "/"PERS_ORG_SHARED_WT_DEFAULT_DB_NAME +extern const char* gSharedWtDefault; /**< PERS_ORG_SHARED_WT_DEFAULT_DB_NAME_ */ + + +/** shared write through database */ +#define PERS_ORG_SHARED_WT_DB_NAME "wt.itz" +#define PERS_ORG_SHARED_WT_DB_NAME_ "/"PERS_ORG_SHARED_WT_DB_NAME +extern const char* gSharedWt; /**< PERS_ORG_SHARED_WT_DB_NAME_ */ + + +/** local cached default database */ +#define PERS_ORG_LOCAL_CACHE_DEFAULT_DB_NAME "cached-default.itz" +#define PERS_ORG_LOCAL_CACHE_DEFAULT_DB_NAME_ "/" PERS_ORG_LOCAL_CACHE_DEFAULT_DB_NAME +extern const char* gLocalCachedDefault; /**< PERS_ORG_LOCAL_CACHE_DEFAULT_DB_NAME_ */ + + +/** local cached database */ +#define PERS_ORG_LOCAL_CACHE_DB_NAME "cached.itz" +#define PERS_ORG_LOCAL_CACHE_DB_NAME_ "/"PERS_ORG_LOCAL_CACHE_DB_NAME +extern const char* gLocalCached; /**< PERS_ORG_LOCAL_CACHE_DB_NAME_ */ + + +/** local write through default database */ +#define PERS_ORG_LOCAL_WT_DEFAULT_DB_NAME "wt-default.itz" +#define PERS_ORG_LOCAL_WT_DEFAULT_DB_NAME_ "/"PERS_ORG_LOCAL_WT_DEFAULT_DB_NAME +extern const char* gLocalWtDefault; /**< PERS_ORG_LOCAL_WT_DEFAULT_DB_NAME_ */ + +/** local write through default database */ +#define PERS_ORG_LOCAL_WT_DB_NAME "wt.itz" +#define PERS_ORG_LOCAL_WT_DB_NAME_ "/" PERS_ORG_LOCAL_WT_DB_NAME +extern const char* gLocalWt; /**< PERS_ORG_LOCAL_WT_DB_NAME_ */ + +/** \} */ + + +/** \defgroup PERS_ORG_FOLDER_NAMES Folders' names + * \{ + */ + +/** directory structure node name definition */ +#define PERS_ORG_NODE_FOLDER_NAME "node" +#define PERS_ORG_NODE_FOLDER_NAME_ "/" PERS_ORG_NODE_FOLDER_NAME +extern const char* gNode; /**< PERS_ORG_NODE_FOLDER_NAME_ */ + + +/** directory structure user name definition */ +#define PERS_ORG_USER_FOLDER_NAME "user" +#define PERS_ORG_USER_FOLDER_NAME_ "/"PERS_ORG_USER_FOLDER_NAME "/" +extern const char* gUser; /**< PERS_ORG_USER_FOLDER_NAME_ */ + + +/** directory structure seat name definition */ +#define PERS_ORG_SEAT_FOLDER_NAME "seat" +#define PERS_ORG_SEAT_FOLDER_NAME_ "/"PERS_ORG_SEAT_FOLDER_NAME "/" +extern const char* gSeat; /**< PERS_ORG_SEAT_FOLDER_NAME_ */ + +/** directory structure shared name definition */ +#define PERS_ORG_SHARED_FOLDER_NAME "shared" +#define PERS_ORG_SHARED_FOLDER_NAME_ "/"PERS_ORG_SHARED_FOLDER_NAME +extern const char* gSharedPathName; /**< PERS_ORG_SHARED_FOLDER_NAME */ + +/** directory structure group name definition */ +#define PERS_ORG_GROUP_FOLDER_NAME "group" +#define PERS_ORG_GROUP_FOLDER_NAME_ "/"PERS_ORG_GROUP_FOLDER_NAME + +/** directory structure public name definition */ +#define PERS_ORG_PUBLIC_FOLDER_NAME "public" +#define PERS_ORG_PUBLIC_FOLDER_NAME_ "/"PERS_ORG_PUBLIC_FOLDER_NAME + +/** directory structure defaultData name definition */ +#define PERS_ORG_DEFAULT_DATA_FOLDER_NAME "defaultData" +#define PERS_ORG_DEFAULT_DATA_FOLDER_NAME_ "/"PERS_ORG_DEFAULT_DATA_FOLDER_NAME + +/** directory structure configurableDefaultData name definition */ +#define PERS_ORG_CONFIG_DEFAULT_DATA_FOLDER_NAME "configurableDefaultData" +#define PERS_ORG_CONFIG_DEFAULT_DATA_FOLDER_NAME_ "/"PERS_ORG_CONFIG_DEFAULT_DATA_FOLDER_NAME + + +/** directory structure cached name definition */ +#define PERS_ORG_CACHE_FOLDER_NAME "mnt-c" +#define PERS_ORG_CACHE_FOLDER_NAME_ "/"PERS_ORG_CACHE_FOLDER_NAME +/** directory structure write-through name definition */ +#define PERS_ORG_WT_FOLDER_NAME "mnt-wt" +#define PERS_ORG_WT_FOLDER_NAME_ "/"PERS_ORG_WT_FOLDER_NAME + + +/** path prefix for all data: /Data */ +#define PERS_ORG_ROOT_PATH "/Data" +extern const char* gRootPath; /**< PERS_ORG_ROOT_PATH */ + +/** \} */ + + +/** \defgroup PERS_ORG_PATHS Paths + * \{ + */ + +/** cache root path application: /Data/mnt-c */ +#define PERS_ORG_LOCAL_APP_CACHE_PATH PERS_ORG_ROOT_PATH PERS_ORG_CACHE_FOLDER_NAME_ +#define PERS_ORG_LOCAL_APP_CACHE_PATH_ PERS_ORG_LOCAL_APP_CACHE_PATH"/" +/** wt root path application: /Data/mnt-wt */ +#define PERS_ORG_LOCAL_APP_WT_PATH PERS_ORG_ROOT_PATH PERS_ORG_WT_FOLDER_NAME_ +#define PERS_ORG_LOCAL_APP_WT_PATH_ PERS_ORG_LOCAL_APP_WT_PATH"/" + +/** cache root path shared: /Data/mnt-c/shared */ +#define PERS_ORG_SHARED_CACHE_PATH PERS_ORG_ROOT_PATH PERS_ORG_CACHE_FOLDER_NAME_ PERS_ORG_SHARED_FOLDER_NAME_ +#define PERS_ORG_SHARED_CACHE_PATH_ PERS_ORG_SHARED_CACHE_PATH"/" +/** wt root path shared: /Data/mnt-wt/shared */ +#define PERS_ORG_SHARED_WT_PATH PERS_ORG_ROOT_PATH PERS_ORG_WT_FOLDER_NAME_ PERS_ORG_SHARED_FOLDER_NAME_ +#define PERS_ORG_SHARED_WT_PATH_ PERS_ORG_SHARED_WT_PATH"/" + +/** cache root path shared group: /Data/mnt-c/shared/group */ +#define PERS_ORG_SHARED_GROUP_CACHE_PATH PERS_ORG_SHARED_CACHE_PATH PERS_ORG_GROUP_FOLDER_NAME_ +#define PERS_ORG_SHARED_GROUP_CACHE_PATH_ PERS_ORG_SHARED_GROUP_CACHE_PATH"/" +/** wt root path application: /Data/mnt-wt/shared/group */ +#define PERS_ORG_SHARED_GROUP_WT_PATH PERS_ORG_SHARED_WT_PATH PERS_ORG_GROUP_FOLDER_NAME_ +#define PERS_ORG_SHARED_GROUP_WT_PATH_ PERS_ORG_SHARED_GROUP_WT_PATH"/" + +/** cache root path shared public: /Data/mnt-c/shared/public */ +#define PERS_ORG_SHARED_PUBLIC_CACHE_PATH PERS_ORG_SHARED_CACHE_PATH PERS_ORG_PUBLIC_FOLDER_NAME_ +#define PERS_ORG_SHARED_PUBLIC_CACHE_PATH_ PERS_ORG_SHARED_PUBLIC_CACHE_PATH"/" +/** wt root path application: /Data/mnt-wt/shared/public */ +#define PERS_ORG_SHARED_PUBLIC_WT_PATH PERS_ORG_SHARED_WT_PATH PERS_ORG_PUBLIC_FOLDER_NAME_ +#define PERS_ORG_SHARED_PUBLIC_WT_PATH_ PERS_ORG_SHARED_PUBLIC_WT_PATH"/" + +/** path prefix for local cached database: /Data/mnt-c/\<appId\>/\<database_name\> */ +#define PERS_ORG_LOCAL_CACHE_PATH_FORMAT PERS_ORG_LOCAL_APP_CACHE_PATH"/%s%s" +extern const char* gLocalCachePath; /**< PERS_ORG_LOCAL_CACHE_PATH_FORMAT */ + +/** path prefix for local write through database /Data/mnt-wt/\<appId\>/\<database_name\> */ +#define PERS_ORG_LOCAL_WT_PATH_FORMAT PERS_ORG_LOCAL_APP_WT_PATH "/%s%s" +extern const char* gLocalWtPath; /**< PERS_ORG_LOCAL_WT_PATH_FORMAT */ + +/** path prefix for shared cached database: /Data/mnt-c/shared/group/ */ +extern const char* gSharedCachePathRoot; /**< PERS_ORG_SHARED_GROUP_CACHE_PATH_ */ + +/** path format for shared cached database: /Data/mnt-c/shared/group/\<group_no\>/\<database_name\> */ +#define PERS_ORG_SHARED_CACHE_PATH_FORMAT PERS_ORG_SHARED_GROUP_CACHE_PATH_"%x%s" +extern const char* gSharedCachePath; /**< PERS_ORG_SHARED_CACHE_PATH_FORMAT */ + +/** path prefix for shared cached database: /Data/mnt-c/shared/group/\<group_no\>/\<database_name\> */ +#define PERS_ORG_SHARED_CACHE_PATH_STRING_FORMAT PERS_ORG_SHARED_GROUP_CACHE_PATH_"%s%s" +extern const char* gSharedCachePathString; /**< PERS_ORG_SHARED_CACHE_PATH_STRING_FORMAT */ + +/** path prefix for shared write through database: /Data/mnt-wt/shared/group/ */ +extern const char* gSharedWtPathRoot; /**< PERS_ORG_SHARED_GROUP_WT_PATH_ */ + +/** path prefix for shared write through database: /Data/mnt_wt/Shared/Group/\<group_no\>/\<database_name\> */ +#define PERS_ORG_SHARED_WT_PATH_FORMAT PERS_ORG_SHARED_GROUP_WT_PATH_"%x%s" +extern const char* gSharedWtPath ; /**< PERS_ORG_SHARED_WT_PATH_FORMAT */ + +/** path prefix for shared write through database: /Data/mnt-wt/shared/group/\<group_no\>/\<database_name\> */ +#define PERS_ORG_SHARED_WT_PATH_STRING_FORMAT PERS_ORG_SHARED_GROUP_WT_PATH_"%s%s" +extern const char* gSharedWtPathString; /**< PERS_ORG_SHARED_WT_PATH_STRING_FORMAT */ + +/** path prefix for shared public cached database: /Data/mnt-c/shared/public/\<database_name\> */ +#define PERS_ORG_SHARED_PUBLIC_CACHE_PATH_FORMAT PERS_ORG_SHARED_PUBLIC_CACHE_PATH"%s" +extern const char* gSharedPublicCachePath; /**< PERS_ORG_SHARED_PUBLIC_CACHE_PATH_FORMAT */ + +/** path prefix for shared public write through database: /Data/mnt-wt/shared/public/\<database_name\> */ +#define PERS_ORG_SHARED_PUBLIC_WT_PATH_FORMAT PERS_ORG_SHARED_PUBLIC_WT_PATH"%s" +extern const char* gSharedPublicWtPath; /**< PERS_ORG_SHARED_PUBLIC_WT_PATH_FORMAT */ + +/** \} */ + + + +/** \defgroup PERS_ORG_LINKS_NAMES Links' names + * \{ + */ + +/** symlinks to shared group folder have the format "shared_group_XX", e.g. "shared_group_0A" */ +#define PERS_ORG_SHARED_GROUP_SYMLINK_PREFIX "shared_group_" + +/** symlinks to shared public folder */ +#define PERS_ORG_SHARED_PUBLIC_SYMLINK_NAME "shared_public" + +/** \} */ + +#ifdef __cplusplus +} +#endif /** extern "C" { */ + +/** \} */ /** End of PERS_COM_DATA_ORG */ +#endif /** OSS_PERSISTENCE_COMMON_DATA_ORGANIZATION_H */ diff --git a/inc/protected/persComDbAccess.h b/inc/protected/persComDbAccess.h new file mode 100644 index 0000000..0a169fd --- /dev/null +++ b/inc/protected/persComDbAccess.h @@ -0,0 +1,154 @@ +#ifndef OSS_PERSISTENCE_COMMON_DB_ACCESS_H +#define OSS_PERSISTENCE_COMMON_DB_ACCESS_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Ionut.Ieremie@continental-corporation.com +* +* Interface: protected - Access to local and shared DBs +* +* For additional details see +* https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface +* +* 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/. +* +* Date Author Reason +* 2013.01.23 uidl9757 4.0.0.0 CSP_WZ#2798: Change PERS_DB_MAX_SIZE_KEY_DATA to 16KB +* 2013.01.23 uidl9757 3.0.0.0 CSP_WZ#2060: CoC_SSW:Persistence: common interface to be used by both PCL and PAS +* +**********************************************************************************************************************/ + +/** \defgroup PERS_COM_DB_ACCESS Database access API + * \{ + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* #ifdef __cplusplus */ + +/** \defgroup PERS_DB_ACCESS_IF_VERSION Interface version + * \{ + */ +#define PERS_COM_DB_ACCESS_INTERFACE_VERSION (0x04000000U) +/** \} */ + + + +/** \defgroup PERS_DB_ACCESS_CONFIG Database configurations + * \{ + */ +/* maximum data size for a key type resourceID */ +#define PERS_DB_MAX_LENGTH_KEY_NAME 128 /**< Max. length of the key identifier */ +#define PERS_DB_MAX_SIZE_KEY_DATA 16384 /**< Max. size of the key entry (slot definition) */ +/** \} */ + + +/** \defgroup PERS_DB_ACCESS_FUNCTIONS Functions + * \{ + */ + + +/** + * \brief Obtain a handler to DB indicated by dbPathname + * \note : DB is created if it does not exist and (bForceCreationIfNotPresent != 0) + * + * \param dbPathname [in] absolute path to database (length limited to \ref PERS_ORG_MAX_LENGTH_PATH_FILENAME) + * \param bForceCreationIfNotPresent [in] if !=0x0, the database is created if it does not exist + * + * \return >= 0 for valid handler, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbOpen(char const * dbPathname, unsigned char bForceCreationIfNotPresent) ; + +/** + * \brief Close handler to DB + * + * \param handlerDB [in] handler obtained with persComDbOpen + * + * \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbClose(signed int handlerDB) ; + +/** + * \brief write a key-value pair into local/shared database + * + * \param handlerDB [in] handler obtained with persComDbOpen + * \param key [in] key's name (length limited to \ref PERS_DB_MAX_LENGTH_KEY_NAME) + * \param data [in] buffer with key's data + * \param dataSize [in] size of key's data (max allowed \ref PERS_DB_MAX_SIZE_KEY_DATA) + * + * \return 0 for success, negative value otherwise (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbWriteKey(signed int handlerDB, char const * key, char const * data, signed int dataSize) ; + + +/** + * \brief read a key's value from local/shared database + * + * \param handlerDB [in] handler obtained with persComDbOpen + * \param key [in] key's name (length limited to \ref PERS_DB_MAX_LENGTH_KEY_NAME) + * \param dataBuffer_out [out]buffer where to return the read data + * \param dataBufferSize [in] size of dataBuffer_out + * + * \return read size, or negative value in case of error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbReadKey(signed int handlerDB, char const * key, char* dataBuffer_out, signed int dataBufferSize) ; + +/** + * \brief read a key's value from local/shared database + * + * \param handlerDB [in] handler obtained with persComDbOpen + * \param key [in] key's name (length limited to \ref PERS_DB_MAX_LENGTH_KEY_NAME) + * + * \return key's size, or negative value in case of error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbGetKeySize(signed int handlerDB, char const * key) ; + +/** + * \brief delete key from local/shared database + * + * \param handlerDB [in] handler obtained with persComDbOpen + * \param key [in] key's name (length limited to \ref PERS_DB_MAX_LENGTH_KEY_NAME) + * + * \return 0 for success, negative value otherwise (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbDeleteKey(signed int handlerDB, char const * key) ; + + +/** + * \brief Find the buffer's size needed to accomodate the list of keys' names in local/shared database + * + * \param handlerDB [in] handler obtained with persComDbOpen + * + * \return needed size, or negative value in case of error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbGetSizeKeysList(signed int handlerDB) ; + + +/** + * \brief Obtain the list of the keys' names in local/shared database + * \note : keys in the list are separated by '\0' + * + * \param handlerDB [in] handler obtained with persComDbOpen + * \param listBuffer_out [out]buffer where to return the list of keys + * \param listBufferSize [in] size of listingBuffer_out + * \return >=0 for size of the list, or negative value in case of error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComDbGetKeysList(signed int handlerDB, char* listBuffer_out, signed int listBufferSize) ; + +/** \} */ /* End of PERS_DB_ACCESS_FUNCTIONS */ + + +#ifdef __cplusplus +} +#endif /* extern "C" { */ +/** \} */ /* End of PERS_COM_DB_ACCESS */ +#endif /* OSS_PERSISTENCE_COMMON_DB_ACCESS_H */ + + + + diff --git a/inc/protected/persComErrors.h b/inc/protected/persComErrors.h new file mode 100644 index 0000000..ca447bb --- /dev/null +++ b/inc/protected/persComErrors.h @@ -0,0 +1,69 @@ +#ifndef OSS_PERSISTENCE_COMMON_ERROR_CODES_ACCESS_H +#define OSS_PERSISTENCE_COMMON_ERROR_CODES_ACCESS_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Ionut.Ieremie@continental-corporation.com +* +* Interface: protected - Error codes that can be returned by PersCommon's functions +* +* 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/. +* +* Date Author Reason +* 2013.10.24 uidu0250 3.0.1.0 CSP_WZ#6327: CoC_SSW:Persistence: add IPC specific error code +* 2013.01.23 uidl9757 3.0.0.0 CSP_WZ#2060: CoC_SSW:Persistence: common interface to be used by both PCL and PAS +* +**********************************************************************************************************************/ + +/** \defgroup PERS_COM_ERRORS Error Codes API + * \{ + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* #ifdef __cplusplus */ + +/** \defgroup PERS_COM_ERROR_CODES_IF_VERSION Interface version + * \{ + */ +#define PERS_COM_ERROR_CODES_INTERFACE_VERSION (0x03000000U) +/** \} */ + + + +/** \defgroup PERS_COM_ERROR_CODES_DEFINES Error codes PERS_COM_ERR_ + * \{ + */ +/* Error code return by the SW Package, related to SW_PackageID. */ +#define PERS_COM_PACKAGEID 0x014 //!< Software package identifier, use for return value base +#define PERS_COM_BASERETURN_CODE (PERS_COM_PACKAGEID << 16) //!< Basis of the return value containing SW PackageID + +#define PERS_COM_SUCCESS 0x00000000 //!< the function call succeded + +#define PERS_COM_ERROR_CODE (-(PERS_COM_BASERETURN_CODE)) //!< basis of the error (negative values) +#define PERS_COM_ERR_INVALID_PARAM (PERS_COM_ERROR_CODE - 1) //!< An invalid param was passed +#define PERS_COM_ERR_BUFFER_TOO_SMALL (PERS_COM_ERROR_CODE - 2) //!< The data found is too large to fit in the provided buffer +#define PERS_COM_ERR_NOT_FOUND (PERS_COM_ERROR_CODE - 3) //!< Tried to access an unexistent key, database, file +#define PERS_COM_ERR_SIZE_TOO_LARGE (PERS_COM_ERROR_CODE - 4) //!< Tried to write a too large data +#define PERS_COM_ERR_OPERATION_NOT_SUPPORTED (PERS_COM_ERROR_CODE - 5) //!< Operation is not (yet) supported +#define PERS_COM_ERR_MALLOC (PERS_COM_ERROR_CODE - 6) //!< Dynamic memory allocation failed +#define PERS_COM_ERR_ACCESS_DENIED (PERS_COM_ERROR_CODE - 7) //!< Insufficient rights to perform opperation +#define PERS_COM_ERR_OUT_OF_MEMORY (PERS_COM_ERROR_CODE - 8) //!< Not enough resources for an opperation + +/* IPC specific error codes */ +#define PERS_COM_IPC_ERR_PCL_NOT_AVAILABLE (PERS_COM_ERROR_CODE - 255) //!< PCL client not available (application was killed) +/* end of IPC specific error codes */ + +#define PERS_COM_FAILURE (PERS_COM_ERROR_CODE - 0xFFFF) //!< Generic error code - for situations not covered by the defined error codes +/** \} */ + +#ifdef __cplusplus +} +#endif /* extern "C" { */ +/** \} */ /* End of PERS_COM_ERRORS */ +#endif /* OSS_PERSISTENCE_COMMON_ERROR_CODES_ACCESS_H */ diff --git a/inc/protected/persComIpc.h b/inc/protected/persComIpc.h new file mode 100644 index 0000000..d04bdb6 --- /dev/null +++ b/inc/protected/persComIpc.h @@ -0,0 +1,309 @@ +#ifndef OSS_PERSISTENCE_COMMON_IPC_H +#define OSS_PERSISTENCE_COMMON_IPC_H + +/********************************************************************************************************************** +* +* Copyright (C) 2013 Continental Automotive Systems, Inc. +* +* Author: petrica.manoila@continental-corporation.com +* +* Interface: protected - IPC protocol for communication between PAS and PCL +* +* The file defines contains the defines according to +* https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface +* +* 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/. +* +* Date Author Reason +* 2013.02.26 uidu0250 1.0.0.0 CR CSP_WZ#2739 +* +**********************************************************************************************************************/ + +/** \defgroup PERS_COM_IPC IPC protocol API + * \{ + * Persistence Common library IPC component provides centralized access to the communication between + * PAS (Persistence Administration Service) and PCL (Persistence Client Library) trough C functions. + * This IPC protocol is based on the Genivi administration / DBUS interface specification. + * The interface is independent of the IPC stack, that can be specified as a symbol in the build process, + * and by default will use the GLib DBus binding. + * + * \image html PersCommonIPC.png "PersCommonIPC" + */ +#ifdef __cplusplus +extern "C" +{ +#endif /* #ifdef __cplusplus */ + +/** \defgroup PERS_COM_IPC_IF_VERSION Interface version + * \{ + */ +#define PERS_COM_IPC_INTERFACE_VERSION (0x01000000U) +/** \} */ + +/** \defgroup PERS_COM_IPC_DEFINES_MODE Persistence mode flags + * Persistence mode flags + * \{ + */ +#define PERSISTENCE_MODE_LOCK (0x0001U) /**< Request to lock access to device */ +#define PERSISTENCE_MODE_SYNC (0x0002U) /**< Request to synchronize the cache */ +#define PERSISTENCE_MODE_UNLOCK (0x0004U) /**< Request to unlock access to device */ +/** \} */ /* End of PERS_COM_IPC_DEFINES */ + +/** \defgroup PERS_COM_IPC_DEFINES_STATUS Persistence status flags + * Persistence status flags + * \{ + */ +#define PERSISTENCE_STATUS_LOCKED (0x0001U) /**< Access to device locked status flag */ +#define PERSISTENCE_STATUS_ERROR (0x8000U) /**< Error present status flag */ +/** \} */ /* End of PERS_COM_IPC_DEFINES_STATUS */ + + +/** \defgroup PERS_COM_IPC_DEFINES_ERROR Persistence status error codes + * Persistence status error codes + * \{ + */ +#define PERSISTENCE_STATUS_ERROR_LOCK_FAILED (0x01U) /**< Lock request failed */ +#define PERSISTENCE_STATUS_ERROR_SYNC_FAILED (0x02U) /**< Sync request failed */ +/** \} */ /* End of PERS_COM_IPC_DEFINES_ERROR */ + + + + +/*------------------------------------------------------------------------------------ + * Interface to be used by PAS (Persistence Administration Service) + *------------------------------------------------------------------------------------ + */ + +/** \defgroup PERS_COM_IPC_PAS API for Persistence Administrator + * \{ + * Definition of the callbacks, structures and functions used by the Persistence Administration Service + */ + +/** \defgroup PERS_COM_IPC_PAS_CALLBACKS Callbacks + * \{ + * The callbacks specified here should be implemented by the Persistence Administration Service and + * supplied to the \ref persIpcInitPAS call trough the \ref PersAdminPASInitInfo_s + * initialization structure. + */ + +/* Register callback signature (to be implemented by PAS) */ +/** + * \brief PCL client registration callback + * \note Should be implemented by PAS (Persistence Administration Service) and used to populate the + * \ref PersAdminPASInitInfo_s structure passed to \ref persIpcInitPAS. + * Called when a client registers to PAS. + * The values of the input parameters (flags, timeout) are the values that the PCL client specified when + * calling \ref persIpcRegisterToPAS. + * + * \param clientID [in] unique identifier assigned to the registered client + * \param flags [in] flags specifying the notifications to register for (bitfield using any of the flags : ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK) + * \param timeout [in] maximum time needed to process any supported request (in milliseconds) + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +typedef int (*persIpcRegisterToPAS_f)( int clientID, + unsigned int flags, + unsigned int timeout); + +/* Un-register callback signature (to be implemented by PAS) */ +/** + * \brief PCL client un-registration callback + * \note Should be implemented by PAS (Persistence Administration Service) and used to populate the + * \ref PersAdminPASInitInfo_s structure passed to \ref persIpcInitPAS. + * Called when a client un-registers from PAS. + * The values of the input parameter flags is the value that the PCL client specified when + * calling \ref persIpcUnRegisterFromPAS. + * + * \param clientID [in] unique identifier assigned to the registered client + * \param flags [in] flags specifying the notifications to un-register from (bitfield using any of the flags : ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK) + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +typedef int (*persIpcUnRegisterFromPAS_f)( int clientID, + unsigned int flags); + +/* PersAdminRequestCompleted callback signature (to be implemented by PAS) */ +/** + * \brief PCL request confirmation callback + * \note Should be implemented by PAS (Persistence Administration Service) and used to populate the + * \ref PersAdminPASInitInfo_s structure passed to \ref persIpcInitPAS. + * Called when a client confirms a request sent by PAS. + * The values of the input parameters (requestID, status) are the values that the PCL client specified when + * calling \ref persIpcSendConfirmationToPAS. + * + * \param clientID [in] unique identifier assigned to the registered client + * \param requestID [in] unique identifier of the request sent by PAS. Should have the same value + * as the parameter requestID specified by PAS when calling + \ref persIpcSendRequestToPCL + * \param status [in] the status of the request processed by PCL + * - In case of success: bitfield using any of the flags, depending on the request : ::PERSISTENCE_STATUS_LOCKED. + * - In case of error: the sum of ::PERSISTENCE_STATUS_ERROR and an error code \ref PERS_COM_IPC_DEFINES_ERROR is returned. + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +typedef int (*persIpcSendConfirmationToPAS_f)( int clientID, + int requestID, + unsigned int status); +/** \} */ /* End of PERS_COM_IPC_PAS_CALLBACKS */ + +/** \defgroup PERS_COM_IPC_PAS_STRUCTURES Structures + * \{ + */ +/* PAS init struct */ +typedef struct PersIpcPASInitInfo_s_ +{ + persIpcRegisterToPAS_f pRegCB; /* callback for RegisterPersAdminNotification */ + persIpcUnRegisterFromPAS_f pUnRegCB; /* callback for UnRegisterPersAdminNotification */ + persIpcSendConfirmationToPAS_f pReqCompleteCB; /* callback for PersistenceAdminRequestCompleted*/ +}PersAdminPASInitInfo_s; +/** \} */ /* End of PERS_COM_IPC_PAS_STRUCTURES */ + + +/** \defgroup PERS_COM_IPC_PAS_FUNCTIONS Functions + * \{ + */ + +/** + * \brief Initialize PAS IPC component + * \note An additional thread is created for communication purposes. + * Initialize members of the supplied PersAdminPASInitInfo_s structure before calling this function. + * + * \param pInitInfo [in] pointer to a \ref PersAdminPASInitInfo_s structure containing + * the supported callbacks + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +int persIpcInitPAS( PersAdminPASInitInfo_s * pInitInfo); + + +/** + * \brief Sends a request to the PCL client specified by clientID. + * \note Each requestID should be unique. + * + * \param clientID [in] the client ID returned by the supplied pRegCB callback + * \param requestID [in] a unique identifier generated for every request + * \param request [in] the request to be sent (bitfield using a valid + * combination of any of the following flags : + * ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK) + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +int persIpcSendRequestToPCL( int clientID, + int requestID, + unsigned int request); + +/** \} */ /* End of PERS_COM_IPC_PAS_FUNCTIONS */ + +/** \} */ /* End of PERS_COM_IPC_PAS */ + + +/*------------------------------------------------------------------------------------ + * Interface to be used by PCL (Persistence Client Library) + *------------------------------------------------------------------------------------ + */ + +/** \defgroup PERS_COM_IPC_PCL API for Persistence Client Library + * \{ + * Definition of the callbacks, structures and functions used by the Persistence Client Library + */ + +/** \defgroup PERS_COM_IPC_PCL_CALLBACKS Callbacks + * \{ + * The callbacks specified here should be implemented by the Persistence Client Library and + * supplied to the \ref persIpcRegisterToPAS call trough the \ref PersAdminPCLInitInfo_s + * initialization structure. + */ + +/* PersAdminRequest callback signature (to be implemented by PCL) */ +/** + * \brief PAS request callback + * \note Should be implemented by PCL (Persistence Client Library) and used to populate the + * \ref PersAdminPCLInitInfo_s structure passed to \ref persIpcRegisterToPAS. + * Called when PAS performs a request by calling \ref persIpcSendRequestToPCL. + * The values of the input parameters (requestID, request) are the values that PAS specified when + * calling \ref persIpcSendRequestToPCL. + * + * \param requestID [in] a unique identifier generated for every request + * \param request [in] the request received (bitfield using a valid combination of + * any of the following flags : + ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK) + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +typedef int (*persIpcSendRequestToPCL_f)( int requestID, + unsigned int request); +/** \} */ /* End of PERS_COM_IPC_PCL_CALLBACKS */ + + +/** \defgroup PERS_COM_IPC_PCL_STRUCTURES Structures + * \{ + */ +/* PCL init struct */ +typedef struct PersAdminPCLInitInfo_s_ +{ + persIpcSendRequestToPCL_f pReqCB; /* callback for PersistenceAdminRequest */ +}PersAdminPCLInitInfo_s; +/** \} */ /* End of PERS_COM_IPC_PCL_STRUCTURES */ + + +/** \defgroup PERS_COM_IPC_PCL_FUNCTIONS Functions + * \{ + */ + +/** + * \brief Register PCL client application to PAS + * \note Registers the PCL (Persistence Client Library) client application to PAS (Persistence Administration Service) + * in order to receive persistence mode change notifications (i.e. the memory access blocked/un-blocked). + * The initialization is performed based on the supplied pInitInfo parameter. + * Call \ref persIpcUnRegisterFromPAS to unregister from PAS when closing the application. + * Initialize members of the supplied PersAdminPCLInitInfo_s structure before calling this function. + * + * \param pInitInfo [in] pointer to a \ref PersAdminPCLInitInfo_s structure containing + * the supported callbacks + * \param flags [in] bitfield using a valid combination of any of the following flags : ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK + * \param timeout [in] maximum time needed to process any supported request (in milliseconds) + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +int persIpcRegisterToPAS(PersAdminPCLInitInfo_s * pInitInfo, + unsigned int flags, + unsigned int timeout); + +/** + * \brief Un-Register PCL client application from PAS + * \note Un-registers the PCL (Persistence Client Library) client application from PAS (Persistence Administration Service) for + * the notifications specified trough flags. + * The PCL client application will no longer receive from PAS the notifications specified in flags. + * + * \param flags [in] bitfield using a valid combination of any of the following flags : ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +int persIpcUnRegisterFromPAS( unsigned int flags ); + +/** + * \brief Send 'request processed' confirmation to PAS. + * \note Sends confirmation to PAS that the request specified by requestID has been processed. + * The status parameter should reflect this request and could also return an error. + * + * \param requestID [in] the ID of the processed request + * \param status [in] the status of the request processed by PCL + * - In case of success: bitfield using any of the following flags, depending on the request : ::PERSISTENCE_STATUS_LOCKED. + * - In case of error: the sum of ::PERSISTENCE_STATUS_ERROR and an error code \ref PERS_COM_IPC_DEFINES_ERROR is returned. + * + * \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) + */ +int persIpcSendConfirmationToPAS( int requestID, + unsigned int status); + +/** \} */ /* End of PERS_COM_IPC_PCL_FUNCTIONS */ + +/** \} */ /* End of PERS_COM_IPC_PCL */ + +#ifdef __cplusplus +} +#endif /* extern "C" { */ +/** \} */ /* End of PERS_COM_IPC */ +#endif /* OSS_PERSISTENCE_COMMON_IPC_H */ diff --git a/inc/protected/persComRct.h b/inc/protected/persComRct.h new file mode 100644 index 0000000..79e8fa4 --- /dev/null +++ b/inc/protected/persComRct.h @@ -0,0 +1,226 @@ +#ifndef OSS_PERSISTENCE_RESOURCE_CONFIG_TABLE_H +#define OSS_PERSISTENCE_RESOURCE_CONFIG_TABLE_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Ionut.Ieremie@continental-corporation.com +* +* Interface: protected - Access to resource configuration table +* +* For additional details see +* https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface +* +* 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/. +* +* Date Author Reason +* 2013.04.02 uidl9757 5.0.0.0 CSP_WZ#3321: Update of PersistenceConfigurationKey_s.permission +* 2013.03.21 uidl9757 4.0.0.0 CSP_WZ#2798: Update of PersistenceConfigurationKey_s +* 2013.01.23 uidl9757 3.0.0.0 CSP_WZ#2060: CoC_SSW:Persistence: common interface to be used by both PCL and PAS +* +**********************************************************************************************************************/ + +/** + * \brief For details see https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface + */ + + +/** \defgroup PERS_COM_RCT Resource Config Table API + * \{ + */ + + +#ifdef __cplusplus +extern "C" +{ +#endif /* #ifdef __cplusplus */ + +/** \defgroup PERS_RCT_IF_VERSION Interface version + * \{ + */ +#define PERS_COM_RESOURCE_CONFIG_TABLE_INTERFACE_VERSION (0x05000000U) +/** \} */ /* end of PERS_RCT_IF_VERSION */ + + + +/** \defgroup PERS_RCT_CONFIG Configuration parameters + * see the defines below for their meaning + * \{ + */ + +#define PERS_RCT_MAX_LENGTH_RESOURCE_ID 64 /**< Max. length of the resource identifier */ +#define PERS_RCT_MAX_LENGTH_RESPONSIBLE 64 /**< Max. length of the responsible application */ +#define PERS_RCT_MAX_LENGTH_CUSTOM_NAME 64 /**< Max. length of the customer plugin */ +#define PERS_RCT_MAX_LENGTH_CUSTOM_ID 64 /**< Max. length of the custom ID */ + +/** \} */ /* End of PERS_RCT_CONFIG */ + + + +/** \defgroup PERS_RCT_ENUM Enumerators managed in the RCT + * \{ + */ +/** data policies */ +typedef enum PersistencePolicy_e_ +{ + PersistencePolicy_wc = 0, /**< the data is managed write cached */ + PersistencePolicy_wt, /**< the data is managed write through */ + PersistencePolicy_na, /**< the data is not applicable */ + + /** insert new entries here ... */ + PersistencePolicy_LastEntry /**< last entry */ + +} PersistencePolicy_e; + + +/** storages to manage the data */ +typedef enum PersistenceStorage_e_ +{ + PersistenceStorage_local = 0, /**< the data is managed local */ + PersistenceStorage_shared, /**< the data is managed shared */ + PersistenceStorage_custom, /**< the data is managed over custom client implementation */ + + /** insert new entries here ... */ + PersistenceStorage_LastEntry /**< last entry */ + +} PersistenceStorage_e; + +/** specifies the type of the resource */ +typedef enum PersistenceResourceType_e_ +{ + PersistenceResourceType_key = 0, /**< key type resource */ + PersistenceResourceType_file, /**< file type resourced */ + + /** insert new entries here ... */ + PersistenceResourceType_LastEntry /**< last entry */ + +} PersistenceResourceType_e; + +/** specifies the permission on resource's data */ +typedef enum PersistencePermission_e_ +{ + PersistencePermission_ReadWrite = 0, /**< random access to data is allowed */ + PersistencePermission_ReadOnly, /**< only read access to data is allowed */ + PersistencePermission_WriteOnly, /**< only write access to data is allowed */ + + /** insert new entries here ... */ + PersistencePermission_LastEntry /**< last entry */ +} PersistencePermission_e; + +/** \} */ /* End of PERS_RCT_ENUM */ + + + +/** \defgroup PERS_RCT_STRUCT Structures managed in the RCT + * \{ + */ +/** resource configuration */ +typedef struct PersistenceConfigurationKey_s_ +{ + PersistencePolicy_e policy; /**< policy */ + PersistenceStorage_e storage; /**< definition of storage to use */ + PersistenceResourceType_e type; /**< type of the resource */ + PersistencePermission_e permission; /**< access right */ + unsigned int max_size; /**< max size expected for the key */ + char reponsible[PERS_RCT_MAX_LENGTH_RESPONSIBLE]; /**< name of responsible application */ + char custom_name[PERS_RCT_MAX_LENGTH_CUSTOM_NAME]; /**< name of the customer plugin */ + char customID[PERS_RCT_MAX_LENGTH_CUSTOM_ID]; /**< internal ID for the custom type resource */ +} PersistenceConfigurationKey_s; +/** \} */ /* End of PERS_RCT_STRUCT */ + + + +/** \defgroup PERS_RCT_FUNCTIONS Functions + * \{ + */ + + +/** + * \brief Obtain a handler to RCT indicated by rctPathname + * \note : RCT is created if it does not exist and (bForceCreationIfNotPresent != 0) + * + * \param rctPathname [in] absolute path to RCT (length limited to \ref PERS_ORG_MAX_LENGTH_PATH_FILENAME) + * \param bForceCreationIfNotPresent [in] if !=0x0, the RCT is created if it does not exist + * + * \return >= 0 for valid handler, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctOpen(char const * rctPathname, unsigned char bForceCreationIfNotPresent) ; + +/** + * \brief Close handler to RCT + * + * \param handlerRCT [in] handler obtained with persComRctOpen + * + * \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctClose(signed int handlerRCT) ; + +/** + * \brief write a resourceID-value pair into RCT + * + * \param handlerRCT [in] handler obtained with persComRctOpen + * \param resourceID [in] resource's identifier (length limited to \ref PERS_RCT_MAX_LENGTH_RESOURCE_ID) + * \param psConfig [in] configuration for resourceID + * + * \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctWrite(signed int handlerRCT, char const * resourceID, PersistenceConfigurationKey_s const * psConfig) ; + + +/** + * \brief read a resourceID's configuration from RCT + * + * \param handlerRCT [in] handler obtained with persComRctOpen + * \param resourceID [in] resource's identifier (length limited to \ref PERS_RCT_MAX_LENGTH_RESOURCE_ID) + * \param psConfig_out [out]where to return the configuration for resourceID + * + * \return read size [byte], or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctRead(signed int handlerRCT, char const * resourceID, PersistenceConfigurationKey_s const * psConfig_out) ; + + +/** + * \brief delete a resourceID's configuration from RCT + * + * \param handlerRCT [in] handler obtained with persComRctOpen + * \param resourceID [in] resource's identifier (length limited to \ref PERS_RCT_MAX_LENGTH_RESOURCE_ID) + * + * \return 0 for success, or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctDelete(signed int handlerRCT, char const * resourceID) ; + + +/** + * \brief Find the buffer's size needed to accomodate the listing of resourceIDs in RCT + * + * \param handlerRCT [in] handler obtained with persComRctOpen + * + * \return needed size [byte], or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctGetSizeResourcesList(signed int handlerRCT) ; + + +/** + * \brief Get the list of the resourceIDs in RCT + * \note : resourceIDs in the list are separated by '\0' + * + * \param handlerRCT [in] handler obtained with persComRctOpen + * \param listBuffer_out [out]buffer where to return the list of resourceIDs + * \param listBufferSize [in] size of listBuffer_out + * + * \return list size [byte], or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) + */ +signed int persComRctGetResourcesList(signed int handlerRCT, char* listBuffer_out, signed int listBufferSize) ; + + +/** \} */ /* End of PERS_RCT_FUNCTIONS */ + +#ifdef __cplusplus +} +#endif /* extern "C" { */ + +/** \} */ /* End of PERS_COM_RCT */ +#endif /* OSS_PERSISTENCE_DATA_ORGANIZATION_H */ diff --git a/inc/protected/persComTypes.h b/inc/protected/persComTypes.h new file mode 100644 index 0000000..4fc0ff7 --- /dev/null +++ b/inc/protected/persComTypes.h @@ -0,0 +1,213 @@ +#ifndef PERS_COM_TYPES_H +#define PERS_COM_TYPES_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Ionut.Ieremie@continental-corporation.com +* +* Interface: protected - Type and constant definitions. +* +* For additional details see +* https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface +* +* 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/. +* +* Date Author Reason +* 2013.02.05 uidl9757 1.0.0.0 CSP_WZ#TODO: CoC_SSW:Persistence: interface that defines type and constants +* +**********************************************************************************************************************/ + +#include <stdbool.h> + +#ifndef char_t +typedef char char_t ; +#endif + +#ifndef NIL +/** + * \brief Definition of the NIL value to be used. + */ +#define NIL (0) +#endif /* #ifndef NIL */ + +#ifndef NULL +/** + * \brief Definition of NULL to be the same as NIL. + * \note + * It is not allowed to use NULL furthermore, use NIL instead. NULL + * is defined for legacy code only. + */ +#define NULL NIL +#endif /* #ifndef NULL */ + + + + +/** + * \brief Definition to make boolean type common for C and C++ + */ +typedef unsigned char bool_t; + +/** + * \brief Definition of false for boolean type in C. + */ +#ifndef false +#define false ((bool_t)0) +#endif + +/** + * \brief Definition of true for boolean type in C. + */ +#ifndef true +#define true ((bool_t)1) +#endif + + +#include <linux/types.h> /* from within kernel source-tree ! */ + +typedef __s8 INT8; +typedef __s16 INT16; +typedef __s32 INT32; +typedef __s64 INT64; + +typedef __u8 uint8_t; +typedef __u16 uint16_t; +typedef __u32 uint32_t; +typedef __u64 uint64_t; + +/** + * \brief 8 bit signed + */ +typedef INT8 sint8_t; + +/** + * \brief 16 bit signed + */ +typedef INT16 sint16_t; + +/** + * \brief 32 bit signed + */ +typedef INT32 sint32_t; + +/** + * \brief 64 bit signed + */ +typedef INT64 sint64_t; + + +/** + * \brief Storage for unsigned characters (8 bit). + */ +typedef unsigned char uc8_t; +/** + * \brief Pointer to storage for unsigned characters (8 bit). + */ +typedef uc8_t * puc8_t; + +/** + * \brief Storage for signed characters (8 bit). + */ +typedef signed char sc8_t; +/** + * \brief Pointer to storage for signed characters (8 bit). + */ +typedef sc8_t * psc8_t; + +/** + * \brief Definition of a single string element. + */ +typedef char str_t; +/** + * \brief Pointer to string (to differentiate between characters and strings). + */ +typedef str_t * pstr_t; +/** + * \brief Pointer to constant string. + */ +typedef const str_t * pconststr_t; +/** + * \brief Constant pointer to string. + */ +typedef str_t *const constpstr_t; +/** + * \brief Constant pointer to constant string. + */ +typedef const str_t *const constpconststr_t; + +/** + * \brief Storage for wide characters (16 bit) to support Unicode. + */ +typedef unsigned short uc16_t; +/** + * \brief Pointer to storage for wide characters (16 bit) to support Unicode. + */ +typedef uc16_t * puc16_t; + +/** + * \brief Pointer to wide string (to differentiate between wide characters + * and wide strings). + */ +typedef puc16_t pwstr_t; +/** + * \brief Pointer to constant wide string. + */ +typedef const uc16_t * pconstwstr_t; +/** + * \brief Constant pointer to wide string. + */ +typedef uc16_t *const constpwstr_t; +/** + * \brief Constant pointer to constant wide string. + */ +typedef const uc16_t *const constpconstwstr_t; + +/** + * \brief Pointer to UNSIGNED-8-Bit + */ +typedef uint8_t* puint8_t; +/** + * \brief Pointer to SIGNED-8-Bit + */ +typedef sint8_t* psint8_t; + +/** + * \brief Pointer to UNSIGNED-16-Bit + */ +typedef uint16_t* puint16_t; +/** + * \brief Pointer to SIGNED-16-Bit + */ +typedef sint16_t* psint16_t; + +/** + * \brief Pointer to UNSIGNED-32-Bit + */ +typedef uint32_t* puint32_t; +/** + * \brief Pointer to SIGNED-32-Bit + */ +typedef sint32_t* psint32_t; + +/** + * \brief Pointer to UNSIGNED-64-Bit + */ +typedef uint64_t* puint64_t; +/** + * \brief Pointer to SIGNED-64-Bit + */ +typedef sint64_t* psint64_t; + + +typedef unsigned int uint_t; + + +typedef signed int sint_t; + + +#endif /* #ifndef PERS_COM_TYPES_H */ + |