1 #ifndef OSS_PERSISTENCE_RESOURCE_CONFIG_TABLE_H
2 #define OSS_PERSISTENCE_RESOURCE_CONFIG_TABLE_H
4 /**********************************************************************************************************************
6 * Copyright (C) 2012 Continental Automotive Systems, Inc.
8 * Author: Ionut.Ieremie@continental-corporation.com
10 * Interface: protected - Access to resource configuration table
12 * For additional details see
13 * https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface
15 * This Source Code Form is subject to the terms of the Mozilla Public
16 * License, v. 2.0. If a copy of the MPL was not distributed with this
17 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
20 * 2013.04.02 uidl9757 5.0.0.0 CSP_WZ#3321: Update of PersistenceConfigurationKey_s.permission
21 * 2013.03.21 uidl9757 4.0.0.0 CSP_WZ#2798: Update of PersistenceConfigurationKey_s
22 * 2013.01.23 uidl9757 3.0.0.0 CSP_WZ#2060: CoC_SSW:Persistence: common interface to be used by both PCL and PAS
24 **********************************************************************************************************************/
27 * \brief For details see https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface
31 /** \defgroup PERS_COM_RCT Resource Config Table API
39 #endif /* #ifdef __cplusplus */
41 /** \defgroup PERS_RCT_IF_VERSION Interface version
44 #define PERS_COM_RESOURCE_CONFIG_TABLE_INTERFACE_VERSION (0x05000000U)
45 /** \} */ /* end of PERS_RCT_IF_VERSION */
49 /** \defgroup PERS_RCT_CONFIG Configuration parameters
50 * see the defines below for their meaning
54 #define PERS_RCT_MAX_LENGTH_RESOURCE_ID 64 /**< Max. length of the resource identifier */
55 #define PERS_RCT_MAX_LENGTH_RESPONSIBLE 64 /**< Max. length of the responsible application */
56 #define PERS_RCT_MAX_LENGTH_CUSTOM_NAME 64 /**< Max. length of the customer plugin */
57 #define PERS_RCT_MAX_LENGTH_CUSTOM_ID 64 /**< Max. length of the custom ID */
59 /** \} */ /* End of PERS_RCT_CONFIG */
63 /** \defgroup PERS_RCT_ENUM Enumerators managed in the RCT
67 typedef enum PersistencePolicy_e_
69 PersistencePolicy_wc = 0, /**< the data is managed write cached */
70 PersistencePolicy_wt, /**< the data is managed write through */
71 PersistencePolicy_na, /**< the data is not applicable */
73 /** insert new entries here ... */
74 PersistencePolicy_LastEntry /**< last entry */
76 } PersistencePolicy_e;
79 /** storages to manage the data */
80 typedef enum PersistenceStorage_e_
82 PersistenceStorage_local = 0, /**< the data is managed local */
83 PersistenceStorage_shared, /**< the data is managed shared */
84 PersistenceStorage_custom, /**< the data is managed over custom client implementation */
86 /** insert new entries here ... */
87 PersistenceStorage_LastEntry /**< last entry */
89 } PersistenceStorage_e;
91 /** specifies the type of the resource */
92 typedef enum PersistenceResourceType_e_
94 PersistenceResourceType_key = 0, /**< key type resource */
95 PersistenceResourceType_file, /**< file type resourced */
97 /** insert new entries here ... */
98 PersistenceResourceType_LastEntry /**< last entry */
100 } PersistenceResourceType_e;
102 /** specifies the permission on resource's data */
103 typedef enum PersistencePermission_e_
105 PersistencePermission_ReadWrite = 0, /**< random access to data is allowed */
106 PersistencePermission_ReadOnly, /**< only read access to data is allowed */
107 PersistencePermission_WriteOnly, /**< only write access to data is allowed */
109 /** insert new entries here ... */
110 PersistencePermission_LastEntry /**< last entry */
111 } PersistencePermission_e;
113 /** \} */ /* End of PERS_RCT_ENUM */
117 /** \defgroup PERS_RCT_STRUCT Structures managed in the RCT
120 /** resource configuration */
121 typedef struct PersistenceConfigurationKey_s_
123 PersistencePolicy_e policy; /**< policy */
124 PersistenceStorage_e storage; /**< definition of storage to use */
125 PersistenceResourceType_e type; /**< type of the resource */
126 PersistencePermission_e permission; /**< access right */
127 unsigned int max_size; /**< max size expected for the key */
128 char reponsible[PERS_RCT_MAX_LENGTH_RESPONSIBLE]; /**< name of responsible application */
129 char custom_name[PERS_RCT_MAX_LENGTH_CUSTOM_NAME]; /**< name of the customer plugin */
130 char customID[PERS_RCT_MAX_LENGTH_CUSTOM_ID]; /**< internal ID for the custom type resource */
131 } PersistenceConfigurationKey_s;
132 /** \} */ /* End of PERS_RCT_STRUCT */
136 /** \defgroup PERS_RCT_FUNCTIONS Functions
142 * \brief Obtain a handler to RCT indicated by rctPathname
143 * \note : RCT is created if it does not exist and (bForceCreationIfNotPresent != 0)
145 * \param rctPathname [in] absolute path to RCT (length limited to \ref PERS_ORG_MAX_LENGTH_PATH_FILENAME)
146 * \param bForceCreationIfNotPresent [in] if !=0x0, the RCT is created if it does not exist
148 * \return >= 0 for valid handler, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
150 signed int persComRctOpen(char const * rctPathname, unsigned char bForceCreationIfNotPresent) ;
153 * \brief Close handler to RCT
155 * \param handlerRCT [in] handler obtained with persComRctOpen
157 * \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
159 signed int persComRctClose(signed int handlerRCT) ;
162 * \brief write a resourceID-value pair into RCT
164 * \param handlerRCT [in] handler obtained with persComRctOpen
165 * \param resourceID [in] resource's identifier (length limited to \ref PERS_RCT_MAX_LENGTH_RESOURCE_ID)
166 * \param psConfig [in] configuration for resourceID
168 * \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
170 signed int persComRctWrite(signed int handlerRCT, char const * resourceID, PersistenceConfigurationKey_s const * psConfig) ;
174 * \brief read a resourceID's configuration from RCT
176 * \param handlerRCT [in] handler obtained with persComRctOpen
177 * \param resourceID [in] resource's identifier (length limited to \ref PERS_RCT_MAX_LENGTH_RESOURCE_ID)
178 * \param psConfig_out [out]where to return the configuration for resourceID
180 * \return read size [byte], or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
182 signed int persComRctRead(signed int handlerRCT, char const * resourceID, PersistenceConfigurationKey_s const * psConfig_out) ;
186 * \brief delete a resourceID's configuration from RCT
188 * \param handlerRCT [in] handler obtained with persComRctOpen
189 * \param resourceID [in] resource's identifier (length limited to \ref PERS_RCT_MAX_LENGTH_RESOURCE_ID)
191 * \return 0 for success, or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
193 signed int persComRctDelete(signed int handlerRCT, char const * resourceID) ;
197 * \brief Find the buffer's size needed to accomodate the listing of resourceIDs in RCT
199 * \param handlerRCT [in] handler obtained with persComRctOpen
201 * \return needed size [byte], or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
203 signed int persComRctGetSizeResourcesList(signed int handlerRCT) ;
207 * \brief Get the list of the resourceIDs in RCT
208 * \note : resourceIDs in the list are separated by '\0'
210 * \param handlerRCT [in] handler obtained with persComRctOpen
211 * \param listBuffer_out [out]buffer where to return the list of resourceIDs
212 * \param listBufferSize [in] size of listBuffer_out
214 * \return list size [byte], or negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES)
216 signed int persComRctGetResourcesList(signed int handlerRCT, char* listBuffer_out, signed int listBufferSize) ;
219 /** \} */ /* End of PERS_RCT_FUNCTIONS */
223 #endif /* extern "C" { */
225 /** \} */ /* End of PERS_COM_RCT */
226 #endif /* OSS_PERSISTENCE_DATA_ORGANIZATION_H */