summaryrefslogtreecommitdiff
path: root/include/persistence_client_custom.h
blob: 56f59046b664750119896a75fc78ba331f6e6600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#ifndef PERSISTENCE_CLIENT_LIBRARY_CUSTOM_H
#define PERSISTENCE_CLIENT_LIBRARY_CUSTOM_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_custom.h
 * @ingroup        Persistence client library
 * @author         Ingo Huerner (XSe) / Guy Sagnes (Continental)
 * @brief          Header of the persistence client library custom plugin.
 *                 Library provides an plugin API to extend persistence client library
 * @par change history
 *  Date       Author    Version  Description 
 *  2013.06.26 ihuerner  1.5.0.0  added description of parameters
 *  2013.01.06 ihuerner  1.4.0.0  plugin_handle_open and plugin_set_data changed from char* to const char*
 *  2012.11.22 gsagnes   1.3.0.0  add the handle_get_size, correct the type to int
 *  2012.10.16 gsagnes   1.2.0.0  add get_size, create_backup, restore_backup
 *  2012.10.04 gsagnes   1.1.0.0  add deinitialisation functionality (call during shutdown)
 *  2012.07.14 ihuerner  1.0.0.0  Initial version of the interface
 */

 
/** \ingroup GEN_PERS_CLIENTLIB_INTERFACE API document
 *  \{
 */

/** Module version
The lower significant byte is equal 0 for released version only
*/
#define     PERSIST_CUSTOMER_INTERFACE_VERSION            (0x01050000U)

/**
 * <b>Plugin interface:</b>
 * All plugins in a specual location will be loaded, and according
 * to the plugin name  functions will created.
 * Example:
 * function name: plugin_open
 * Loaded plugin name: hwi
 * Generated function: hwi_plugin_open
 */
 
/**
 * @brief create backup
 *
 * @param backup_id Name of the backup / identifier
 *
 * @return positive value (0 or greater): backup success (size of backup, bytes); negative value: error
 */
int plugin_create_backup(const char* backup_id);

 /**
 * @brief deinitialize plugin (during shutdown)
 *
 * @return positive value (0 or greater): init success; negative value: error
 */
int plugin_deinit();

/**
 * @brief delete data
 *
 * @param path the path to the data to delete
 *
 * @return positive value (0 or greater): delete success; negative value: error
 */
int plugin_delete_data(const char* path);

/**
 * @brief get backup name
 *
 * @param backup_id Name of the backup / identifier
 * @param size size of the buffer to return the identifier
 *
 * @return positive value (0 or greater): success, length of identifier; negative value: error
 */
int plugin_get_backup(char* backup_id, int size);

/**
 * @brief gets the size of persistent data in bytes
 *
 * @param path the path to the data
 *
 * @return positive value (0 or greater): the size; negative value: error code
 */
int plugin_get_size(const char* path);

/**
 * @brief get data
 *
 * @param path the path to the resource to get
 * @param buffer the buffer to store data
 * @param size the number of bytes to get data
 *
 * @return positive value (0 or greater): size data read in bytes; negative value: error
 */
int plugin_get_data(const char* path, char* buffer, int size);
 
/**
 * @brief close the given handle
 *
 * @param handle the handle to close
 *
 * @return positive value (0 or greater): successfully closed; negative value: error
 */
int plugin_handle_close(int handle);

/**
 * @brief get data
 *
 * @param handle the handle returned from open
 * @param buffer the buffer to store data
 * @param size the number of bytes to get data
 *
 * @return positive value (0 or greater): size data read in bytes; negative value: error
 */
int plugin_handle_get_data(int handle, char* buffer, int size);

/**
 * @brief open a resource
 *
 * @param path the path to the resource to open
 * @param flag open flags
 * @param mode the open mode
 *
 * @return positive value (0 or greater): handle; negative value: error
 */
int plugin_handle_open(const char* path, int flag, int mode);

/**
 * @brief set data
 *
 * @param handle the handle given by open
 * @param buffer the data to write
 * @param size the number of bytes to write
 *
 * @return positive size data set; negative value: error
 */
int plugin_handle_set_data(int handle, char* buffer, int size);

/**
 * @brief initialize plugin
 *
 * @return positive value: init success; negative value: error
 */
int plugin_init();

/**
 * @brief restore backup
 *
 * @param backup_id Name of the backup / identifier
 *
 * @return positive value (0 or greater): backup success (size of backup, bytes); negative value: error
 */
int plugin_restore_backup(const char* backup_id);

/**
 * @brief set data
 *
 * @param path the path to the resource to set
 * @param buffer the data to write
 * @param size the number of bytes to write
 *
 * @return positive size data set; negative value: error
 */
int plugin_set_data(const char* path, char* buffer, int size);

/**
 * @brief typdef of callback function prototype
 *
 * @param int pass a statusId to the function
 * @param void* pass an argument to the function
 */
typedef int (*plugin_callback_t) (int, void*);

/**
 * @brief registercallback for status notifications
 *
 * @param pFunct the callback
 *
 * @return positive value: register success; negative value error
 */
int plugin_get_status_notification_clbk(plugin_callback_t pFunct);

/**
 * @brief get size
 *
 * @param handle the handle given by open
 *
 * @return positive value: the size; negative value: error code
 */
int plugin_handle_get_size(int handle);

#endif /* PERSISTENCE_CLIENT_LIBRARY_CUSTOM_H */
/** \} */ /* End of INTERFACE */