summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2012-12-17 22:02:48 +0100
committerIngo Huerner <ingo.huerner@xse.de>2012-12-17 22:02:48 +0100
commitb7250822718b2e91e00d06bc96da728814699db4 (patch)
tree32d7bf5fdfc721cf5a42344833e5575a1512760a
parent4f35c79a589a75842c22766b8527848564ea7443 (diff)
downloadpersistence-client-library-b7250822718b2e91e00d06bc96da728814699db4.tar.gz
Renamed and moved files, fixed problem with handle test
-rw-r--r--include_protected/persistence_client_library_data_organization.h (renamed from include_protected/persistence_client_library_common_data.h)90
-rw-r--r--include_protected/persistence_client_library_db_access.h5
-rw-r--r--include_protected/persistence_client_library_rc_table.h114
-rw-r--r--src/Makefile.am6
-rw-r--r--src/persistence_client_library_custom_loader.c2
-rw-r--r--src/persistence_client_library_data_organization.c (renamed from src/persistence_client_library_common_data.c)4
-rw-r--r--src/persistence_client_library_db_access.c3
-rw-r--r--src/persistence_client_library_db_access_ll.c2
-rw-r--r--src/persistence_client_library_db_access_ll.h (renamed from include_protected/persistence_client_library_db_access_ll.h)0
-rw-r--r--src/persistence_client_library_file.c2
-rw-r--r--src/persistence_client_library_handle.h3
-rw-r--r--src/persistence_client_library_key.c1
-rw-r--r--src/persistence_client_library_lc_interface.c2
-rw-r--r--src/persistence_client_library_pas_interface.c2
-rw-r--r--src/persistence_client_library_prct_access.h4
-rw-r--r--test/Makefile.am1
-rw-r--r--test/persistence_client_library_test.c7
17 files changed, 145 insertions, 103 deletions
diff --git a/include_protected/persistence_client_library_common_data.h b/include_protected/persistence_client_library_data_organization.h
index 03fea61..d026d3e 100644
--- a/include_protected/persistence_client_library_common_data.h
+++ b/include_protected/persistence_client_library_data_organization.h
@@ -1,5 +1,5 @@
-#ifndef PERSISTENCE_CLIENT_LIBRARY_H
-#define PERSISTENCE_CLIENT_LIBRARY_H
+#ifndef PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_H
+#define PERSISTENCE_CLIENT_LIBRARY_DATA_ORGANIZATION_H
/******************************************************************************
* Project Persistency
@@ -12,11 +12,10 @@
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
******************************************************************************/
/**
- * @file persistence_client_library.h
+ * @file persistence_client_library_data_organization.h
* @ingroup Persistence client library
* @author Ingo Huerner
- * @brief Header of the persistence client library.
- * Library provides an API to access persistent data
+ * @brief Header of the persistence client library data organization.
* @see
*/
@@ -25,7 +24,7 @@
extern "C" {
#endif
-#define PERSIST_CLIENT_LIBRARY_COMMON_DATA_INTERFACE_VERSION (0x01000000U)
+#define PERSIST_CLIENT_LIBRARY_DATA_ORGANIZATION_INTERFACE_VERSION (0x01000000U)
#include "../include/persistence_client_library_error_def.h"
@@ -75,83 +74,6 @@ enum _PersistenceConstantDef
};
-/// enumerator used to identify the policy to manage the data
-typedef enum _PersistencePolicy_e
-{
- PersistencePolicy_wc = 0, /**< the data is managed write cached */
- PersistencePolicy_wt = 1, /**< the data is managed write through */
- PersistencePolicy_na = 2, /**< the data is not applicable */
-
- /** insert new entries here ... */
- PersistencePolicy_LastEntry /**< last entry */
-
-} PersistencePolicy_e;
-
-
-/// enumerator used to identify the persistence storage to manage the data
-typedef enum _PersistenceStorage_e
-{
- PersistenceStorage_local = 0, /**< the data is managed local */
- PersistenceStorage_shared = 1, /**< the data is managed shared */
- PersistenceStorage_custom = 2, /**< the data is managed over custom client implementation */
-
- /** insert new entries here ... */
- PersistenceStoragePolicy_LastEntry /**< last entry */
-
-} PersistenceStorage_e;
-
-
-/// structure used to manage database context
-typedef struct _PersistenceDbContext_s
-{
- unsigned char ldbid;
- unsigned char user_no;
- unsigned char seat_no;
-} PersistenceDbContext_s;
-
-
-/// structure used to manage the persistence configuration for a key
-typedef struct _PersistenceConfigurationKey_s
-{
- PersistencePolicy_e policy; /**< policy */
- PersistenceStorage_e storage; /**< definition of storage to use */
- unsigned int permission; /**< access right, corresponds to UNIX */
- unsigned int max_size; /**< max size expected for the key */
- char reponsible[MaxConfKeyLengthResp]; /**< name of responsible application */
- char custom_name[MaxConfKeyLengthCusName]; /**< name of the customer plugin */
-} PersistenceConfigurationKey_s;
-
-
-/// structure definition of an persistence resource configuration table entry
-typedef struct _PersistenceRctEntry_s
-{
- char key[PrctKeySize]; /**< the key */
- PersistenceConfigurationKey_s data; /**< data for the key */
-}
-PersistenceRctEntry_s;
-
-
-/// persistence information
-typedef struct _PersistenceInfo_s
-{
- PersistenceDbContext_s context; /**< database context*/
- PersistenceConfigurationKey_s configKey; /**< prct configuration key*/
-
-} PersistenceInfo_s;
-
-
-
-/// persistence resource config table type definition
-typedef enum _PersistenceRCT_e
-{
- PersistenceRCT_local = 0,
- PersistenceRCT_shared_public = 1,
- PersistenceRCT_shared_group = 2,
-
- PersistenceRCT_LastEntry // last Entry
-
-} PersistenceRCT_e;
-
/// resource configuration table name
extern const char* gResTableCfg;
@@ -207,5 +129,5 @@ extern int gMaxKeyValDataSize;
}
#endif
-#endif /* PERSISTENCY_CLIENT_LIBRARY_H */
+#endif /* PERSISTENCY_CLIENT_LIBRARY_DATA_ORGANIZATION_H */
diff --git a/include_protected/persistence_client_library_db_access.h b/include_protected/persistence_client_library_db_access.h
index f5dceaf..7e7c0aa 100644
--- a/include_protected/persistence_client_library_db_access.h
+++ b/include_protected/persistence_client_library_db_access.h
@@ -27,7 +27,8 @@ extern "C" {
#define PERSIST_DATA_ACCESS_INTERFACE_VERSION (0x03000000U)
-#include "persistence_client_library_common_data.h"
+#include "persistence_client_library_data_organization.h"
+#include "persistence_client_library_rc_table.h"
@@ -162,7 +163,7 @@ int pers_db_cursor_get_key(unsigned int handlerDB, char * bufKeyName_out, int bu
*
* @return read size (if >= 0), error other way
*/
-int pers_db_cursor_get_key_data(unsigned int handlerDB, char * bufData_out, int bufSize) ;
+int pers_db_cursor_get_data(unsigned int handlerDB, char * bufData_out, int bufSize) ;
/**
* @brief get the data size of the key pointed by the cursor associated with the database
diff --git a/include_protected/persistence_client_library_rc_table.h b/include_protected/persistence_client_library_rc_table.h
new file mode 100644
index 0000000..1ec8731
--- /dev/null
+++ b/include_protected/persistence_client_library_rc_table.h
@@ -0,0 +1,114 @@
+#ifndef PERSISTENCE_CLIENT_LIBRARY_RC_TABLE_H
+#define PERSISTENCE_CLIENT_LIBRARY_RC_TABLE_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_rc_table.h
+ * @ingroup Persistence client library
+ * @author Ingo Huerner
+ * @brief Header of the persistence client library resource config table.
+ * @see
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PERSIST_DATA_RC_TABLE_INTERFACE_VERSION (0x01000000U)
+
+#include "persistence_client_library_data_organization.h"
+
+
+/// enumerator used to identify the policy to manage the data
+typedef enum _PersistencePolicy_e
+{
+ PersistencePolicy_wc = 0, /**< the data is managed write cached */
+ PersistencePolicy_wt = 1, /**< the data is managed write through */
+ PersistencePolicy_na = 2, /**< the data is not applicable */
+
+ /** insert new entries here ... */
+ PersistencePolicy_LastEntry /**< last entry */
+
+} PersistencePolicy_e;
+
+
+/// enumerator used to identify the persistence storage to manage the data
+typedef enum _PersistenceStorage_e
+{
+ PersistenceStorage_local = 0, /**< the data is managed local */
+ PersistenceStorage_shared = 1, /**< the data is managed shared */
+ PersistenceStorage_custom = 2, /**< the data is managed over custom client implementation */
+
+ /** insert new entries here ... */
+ PersistenceStoragePolicy_LastEntry /**< last entry */
+
+} PersistenceStorage_e;
+
+
+/// structure used to manage database context
+typedef struct _PersistenceDbContext_s
+{
+ unsigned char ldbid;
+ unsigned char user_no;
+ unsigned char seat_no;
+} PersistenceDbContext_s;
+
+
+/// structure used to manage the persistence configuration for a key
+typedef struct _PersistenceConfigurationKey_s
+{
+ PersistencePolicy_e policy; /**< policy */
+ PersistenceStorage_e storage; /**< definition of storage to use */
+ unsigned int permission; /**< access right, corresponds to UNIX */
+ unsigned int max_size; /**< max size expected for the key */
+ char reponsible[MaxConfKeyLengthResp]; /**< name of responsible application */
+ char custom_name[MaxConfKeyLengthCusName]; /**< name of the customer plugin */
+} PersistenceConfigurationKey_s;
+
+
+/// structure definition of an persistence resource configuration table entry
+typedef struct _PersistenceRctEntry_s
+{
+ char key[PrctKeySize]; /**< the key */
+ PersistenceConfigurationKey_s data; /**< data for the key */
+}
+PersistenceRctEntry_s;
+
+
+/// persistence information
+typedef struct _PersistenceInfo_s
+{
+ PersistenceDbContext_s context; /**< database context*/
+ PersistenceConfigurationKey_s configKey; /**< prct configuration key*/
+
+} PersistenceInfo_s;
+
+
+
+/// persistence resource config table type definition
+typedef enum _PersistenceRCT_e
+{
+ PersistenceRCT_local = 0,
+ PersistenceRCT_shared_public = 1,
+ PersistenceRCT_shared_group = 2,
+
+ PersistenceRCT_LastEntry // last Entry
+
+} PersistenceRCT_e;
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PERSISTENCY_CLIENT_LIBRARY_RC_TABLE_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index f5b16a4..0c2cd5e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,8 +5,8 @@ if DEBUG
AM_CFLAGS = $(DEPS_CFLAGS) -g -I../include \
-Idbus-1.0
else
-AM_CFLAGS = $(DEPS_CFLAGS) -I../include \
- -Idbus-1.0
+AM_CFLAGS = $(DEPS_CFLAGS) -I../include -Idbus-1.0
+#AM_CFLAGS = -fprofile-arcs -ftest-coverage $(DEPS_CFLAGS) -I../include -Idbus-1.0
endif
@@ -20,7 +20,7 @@ lib_LTLIBRARIES = libpersistence_client_library_common_data.la libpersistence_cl
libpersistence_client_library_common_data_la_SOURCES = \
- persistence_client_library_common_data.c
+ persistence_client_library_data_organization.c
diff --git a/src/persistence_client_library_custom_loader.c b/src/persistence_client_library_custom_loader.c
index 0b4dc6e..c525a7f 100644
--- a/src/persistence_client_library_custom_loader.c
+++ b/src/persistence_client_library_custom_loader.c
@@ -17,7 +17,7 @@
*/
#include "persistence_client_library_custom_loader.h"
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
#include <stdio.h>
#include <errno.h>
diff --git a/src/persistence_client_library_common_data.c b/src/persistence_client_library_data_organization.c
index ba029b8..b53d15f 100644
--- a/src/persistence_client_library_common_data.c
+++ b/src/persistence_client_library_data_organization.c
@@ -9,14 +9,14 @@
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
******************************************************************************/
/**
- * @file persistence_client_library_data_access_ll.c
+ * @file persistence_client_library_data_organization.c
* @ingroup Persistence client library
* @author Ingo Huerner
* @brief Implementation of persistence database low level access
* @see
*/
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
#include <string.h>
#include <stdio.h>
diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c
index 4d60c91..71fc930 100644
--- a/src/persistence_client_library_db_access.c
+++ b/src/persistence_client_library_db_access.c
@@ -18,6 +18,7 @@
*/
#include "../include_protected/persistence_client_library_db_access.h"
+#include "../include_protected/persistence_client_library_rc_table.h"
#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library_itzam_errors.h"
@@ -579,7 +580,7 @@ int pers_db_cursor_get_key(unsigned int handlerDB, char * bufKeyName_out, int bu
-int pers_db_cursor_get_key_data(unsigned int handlerDB, char * bufData_out, int bufSize)
+int pers_db_cursor_get_data(unsigned int handlerDB, char * bufData_out, int bufSize)
{
int rval = -1;
KeyValuePair_s search;
diff --git a/src/persistence_client_library_db_access_ll.c b/src/persistence_client_library_db_access_ll.c
index 4452902..234191f 100644
--- a/src/persistence_client_library_db_access_ll.c
+++ b/src/persistence_client_library_db_access_ll.c
@@ -16,7 +16,7 @@
* @see
*/
-#include "../include_protected/persistence_client_library_db_access_ll.h"
+#include "persistence_client_library_db_access_ll.h"
#include <string.h>
#include <stdio.h>
diff --git a/include_protected/persistence_client_library_db_access_ll.h b/src/persistence_client_library_db_access_ll.h
index 5609db7..5609db7 100644
--- a/include_protected/persistence_client_library_db_access_ll.h
+++ b/src/persistence_client_library_db_access_ll.h
diff --git a/src/persistence_client_library_file.c b/src/persistence_client_library_file.c
index 52f4bcb..cbf970d 100644
--- a/src/persistence_client_library_file.c
+++ b/src/persistence_client_library_file.c
@@ -18,7 +18,7 @@
*/
#include "persistence_client_library_file.h"
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
#include "../include_protected/persistence_client_library_db_access.h"
#include "persistence_client_library_pas_interface.h"
diff --git a/src/persistence_client_library_handle.h b/src/persistence_client_library_handle.h
index 4cdb8e4..502db7d 100644
--- a/src/persistence_client_library_handle.h
+++ b/src/persistence_client_library_handle.h
@@ -20,7 +20,8 @@
* @see
*/
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
+#include "../include_protected/persistence_client_library_rc_table.h"
/// handle structure definition
typedef struct _PersistenceHandle_s
diff --git a/src/persistence_client_library_key.c b/src/persistence_client_library_key.c
index c31caf3..3cc19cd 100644
--- a/src/persistence_client_library_key.c
+++ b/src/persistence_client_library_key.c
@@ -20,6 +20,7 @@
#include "persistence_client_library_key.h"
#include "../include_protected/persistence_client_library_db_access.h"
+#include "../include_protected/persistence_client_library_rc_table.h"
#include "../include_protected/crc32.h"
#include "persistence_client_library_handle.h"
diff --git a/src/persistence_client_library_lc_interface.c b/src/persistence_client_library_lc_interface.c
index 714c867..ae4c734 100644
--- a/src/persistence_client_library_lc_interface.c
+++ b/src/persistence_client_library_lc_interface.c
@@ -19,7 +19,7 @@
#include "persistence_client_library_lc_interface.h"
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
#include "../include_protected/persistence_client_library_db_access.h"
#include "persistence_client_library_handle.h"
diff --git a/src/persistence_client_library_pas_interface.c b/src/persistence_client_library_pas_interface.c
index 9175317..36f0dcc 100644
--- a/src/persistence_client_library_pas_interface.c
+++ b/src/persistence_client_library_pas_interface.c
@@ -20,7 +20,7 @@
#include "persistence_client_library_pas_interface.h"
#include "persistence_client_library_dbus_service.h"
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
#include <errno.h>
#include <unistd.h>
diff --git a/src/persistence_client_library_prct_access.h b/src/persistence_client_library_prct_access.h
index 02bab52..31dbca6 100644
--- a/src/persistence_client_library_prct_access.h
+++ b/src/persistence_client_library_prct_access.h
@@ -20,7 +20,9 @@
* @see
*/
-#include "../include_protected/persistence_client_library_common_data.h"
+#include "../include_protected/persistence_client_library_data_organization.h"
+#include "../include_protected/persistence_client_library_rc_table.h"
+
#include <itzam.h>
/**
diff --git a/test/Makefile.am b/test/Makefile.am
index 61f22f8..6d12435 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,6 +4,7 @@ if DEBUG
AM_CFLAGS =$(DEPS_CFLAGS) $(CHECK_CFLAGS) -g
else
AM_CFLAGS = $(DEPS_CFLAGS) $(CHECK_CFLAGS)
+#AM_CFLAGS = -fprofile-arcs -ftest-coverage $(DEPS_CFLAGS) $(CHECK_CFLAGS)
endif
diff --git a/test/persistence_client_library_test.c b/test/persistence_client_library_test.c
index 60adcfe..f87c1b0 100644
--- a/test/persistence_client_library_test.c
+++ b/test/persistence_client_library_test.c
@@ -103,8 +103,7 @@ START_TEST (test_GetDataHandle)
snprintf(sysTimeBuffer, 128, "TimeAndData: \"%s %d.%d.%d - %d:%.2d:%.2d Uhr\"", dayOfWeek[locTime->tm_wday], locTime->tm_mday, locTime->tm_mon, (locTime->tm_year+1900),
locTime->tm_hour, locTime->tm_min, locTime->tm_sec);
// open handle ---------------------------------------------------
- handle = key_handle_open(0xFF, "posHandle/last_position", 1, 0);
- printf("Handle: %d\n", handle);
+ handle = key_handle_open(0xFF, "posHandle/last_position", 0, 0);
fail_unless(handle >= 0, "Failed to open handle ==> /posHandle/last_position");
ret = key_handle_read_data(handle, buffer, READ_SIZE);
@@ -467,7 +466,7 @@ START_TEST(test_Cursor)
rval = pers_db_cursor_get_key(handle, bufferKeySrc, 128);
fail_unless(rval != -1, "Cursor failed to get key!!");
// get data
- rval = pers_db_cursor_get_key_data(handle, bufferDataSrc, 128);
+ rval = pers_db_cursor_get_data(handle, bufferDataSrc, 128);
fail_unless(rval != -1, "Cursor failed to get data!!");
// get size
size = pers_db_cursor_get_data_size(handle);
@@ -478,7 +477,7 @@ START_TEST(test_Cursor)
rval = pers_db_cursor_get_key(handle1, bufferKeyDst, 128);
fail_unless(rval != -1, "Cursor failed to get key!!");
// get data
- rval = pers_db_cursor_get_key_data(handle1, bufferDataDst, 128);
+ rval = pers_db_cursor_get_data(handle1, bufferDataDst, 128);
fail_unless(rval != -1, "Cursor failed to get data!!");
// get size
size = pers_db_cursor_get_data_size(handle1);