[1/2] celix git commit: CELIX-237: Removed unused function

2015-07-31 Thread pnoltes
Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-237_rsa-ffi 24d13f2ef - f9ed9b33b


CELIX-237: Removed unused function


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/e9954746
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/e9954746
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/e9954746

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: e99547469face64cc3f330d3602efe1869fafc20
Parents: 24d13f2
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Fri Jul 31 12:59:55 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Fri Jul 31 12:59:55 2015 +0200

--
 remote_services/dynamic_function_interface/dyn_type.c | 7 ---
 remote_services/dynamic_function_interface/dyn_type.h | 1 -
 2 files changed, 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/e9954746/remote_services/dynamic_function_interface/dyn_type.c
--
diff --git a/remote_services/dynamic_function_interface/dyn_type.c 
b/remote_services/dynamic_function_interface/dyn_type.c
index 6de9736..87ebb5d 100644
--- a/remote_services/dynamic_function_interface/dyn_type.c
+++ b/remote_services/dynamic_function_interface/dyn_type.c
@@ -478,13 +478,6 @@ int dynType_complex_indexForName(dyn_type *type, const 
char *name) {
 return index;
 }
 
-char dynType_complex_descriptorTypeAt(dyn_type *type, int index) {
-assert(type-type == DYN_TYPE_COMPLEX);
-
-dyn_type *item = type-complex.types[index];
-return item-descriptor;
-}
-
 int dynType_complex_dynTypeAt(dyn_type *type, int index, dyn_type **result) {
 assert(type-type == DYN_TYPE_COMPLEX);
 dyn_type *sub = type-complex.types[index];

http://git-wip-us.apache.org/repos/asf/celix/blob/e9954746/remote_services/dynamic_function_interface/dyn_type.h
--
diff --git a/remote_services/dynamic_function_interface/dyn_type.h 
b/remote_services/dynamic_function_interface/dyn_type.h
index bf6dfc8..7334da3 100644
--- a/remote_services/dynamic_function_interface/dyn_type.h
+++ b/remote_services/dynamic_function_interface/dyn_type.h
@@ -148,7 +148,6 @@ int dynType_descriptorType(dyn_type *type);
 
 //complexType
 int dynType_complex_indexForName(dyn_type *type, const char *name);
-char dynType_complex_descriptorTypeAt(dyn_type *type, int index);
 int dynType_complex_dynTypeAt(dyn_type *type, int index, dyn_type **subType);
 int dynType_complex_setValueAt(dyn_type *type, int index, void *inst, void 
*in);
 int dynType_complex_valLocAt(dyn_type *type, int index, void *inst, void 
**valLoc);



[07/10] celix git commit: CELIX-237: moved rsa_http_ffi source to rsa_dfi

2015-07-31 Thread pnoltes
CELIX-237: moved rsa_http_ffi source to rsa_dfi


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3d7f7641
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3d7f7641
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3d7f7641

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 3d7f7641fbd58c79b54e00d9d7d1395f54db166c
Parents: bf76d21
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Fri Jul 31 16:11:31 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Fri Jul 31 16:11:31 2015 +0200

--
 .../remote_service_admin_dfi/CMakeLists.txt |   26 +-
 .../dynamic_function_interface/CMakeLists.txt   |5 +-
 .../include/remote_service_admin_http_impl.h|   52 +
 .../src/remote_service_admin_activator.c|  122 ++
 .../private/src/remote_service_admin_impl.c | 1085 ++
 .../CMakeLists.txt  |   51 -
 .../include/remote_service_admin_http_impl.h|   52 -
 .../src/remote_service_admin_activator.c|  122 --
 .../private/src/remote_service_admin_impl.c | 1085 --
 9 files changed, 1274 insertions(+), 1326 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/3d7f7641/remote_services/remote_service_admin_dfi/CMakeLists.txt
--
diff --git a/remote_services/remote_service_admin_dfi/CMakeLists.txt 
b/remote_services/remote_service_admin_dfi/CMakeLists.txt
index f74cac1..500e40e 100644
--- a/remote_services/remote_service_admin_dfi/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/CMakeLists.txt
@@ -34,19 +34,19 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
 
include_directories(${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_http/private/include)
 
include_directories(${PROJECT_SOURCE_DIR}/remote_services/endpoint_listener/public/include)
 
-#SET_HEADER(BUNDLE_SYMBOLICNAME apache_celix_remote_service_admin_dfi)
-#SET(BUNDLE_VERSION 0.0.1)
-#SET_HEADERS(Bundle-Name: Apache Celix Remote Service Admin HTTP for 
dynamic function interface)
+SET_HEADER(BUNDLE_SYMBOLICNAME apache_celix_remote_service_admin_dfi)
+SET(BUNDLE_VERSION 0.0.1)
+SET_HEADERS(Bundle-Name: Apache Celix Remote Service Admin HTTP for 
dynamic function interface)
 
-#bundle(remote_service_admin_dfi SOURCES
-#private/src/remote_service_admin_impl
-#private/src/remote_service_admin_activator
-#
${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/export_registration_impl
-#
${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/import_registration_impl
-#${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
-#${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
-#)
-#target_link_libraries(remote_service_admin_dfi celix_framework 
${CURL_LIBRARIES} ${JANSSON_LIBRARIES} ${FFI_LIBRARIES})
+bundle(remote_service_admin_dfi SOURCES
+private/src/remote_service_admin_impl
+private/src/remote_service_admin_activator
+
${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/export_registration_impl
+
${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/import_registration_impl
+${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
+${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
+)
+target_link_libraries(remote_service_admin_dfi celix_framework 
${CURL_LIBRARIES} ${JANSSON_LIBRARIES} ${FFI_LIBRARIES} dfi)
 
-#install_bundle(remote_service_admin_dfi)
+install_bundle(remote_service_admin_dfi)
 endif (RSA_REMOTE_SERVICE_ADMIN_DFI)

http://git-wip-us.apache.org/repos/asf/celix/blob/3d7f7641/remote_services/remote_service_admin_dfi/dynamic_function_interface/CMakeLists.txt
--
diff --git 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/CMakeLists.txt
 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/CMakeLists.txt
index 309176f..ae1d5c3 100644
--- 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/CMakeLists.txt
+++ 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/CMakeLists.txt
@@ -18,7 +18,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
set(MEMSTREAM_SOURCES memstream/open_memstream.c memstream/fmemopen.c)
 endif()
 
-add_library(dfi
+add_library(dfi STATIC
 dyn_common.c
 dyn_type.c
 dyn_function.c
@@ -30,14 +30,13 @@ add_library(dfi
 target_link_libraries(dfi ${FFI_LIBRARIES} ${JANSSON_LIBRARY})
 
 
-#if (FRAMEWORK_TESTS)
+#if (FRAMEWORK_TESTS) TODO
add_executable(dfi_tests

[10/10] celix git commit: CELIX-237: Finished ccputest setup for testing the rsa dfi bundle. Cpputest uses the launcher to launch an embedded celix

2015-07-31 Thread pnoltes
CELIX-237: Finished ccputest setup for testing the rsa dfi bundle. Cpputest 
uses the launcher to launch an embedded celix


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/481e5c86
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/481e5c86
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/481e5c86

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 481e5c86114ecdd2bef5b2f5f6afdb32a6a6a537
Parents: 1e618fb
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Fri Jul 31 22:56:02 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Fri Jul 31 22:56:02 2015 +0200

--
 launcher/private/src/launcher.c |  9 +++--
 launcher/public/include/launcher.h  |  1 +
 .../remote_service_admin_dfi/CMakeLists.txt |  4 ++-
 .../remote_service_admin_dfi/tst/CMakeLists.txt | 18 ++
 .../remote_service_admin_dfi/tst/rsa_tests.cpp  | 36 
 .../remote_service_admin_dfi/tst/run_tests.cpp  | 21 +---
 6 files changed, 74 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/launcher/private/src/launcher.c
--
diff --git a/launcher/private/src/launcher.c b/launcher/private/src/launcher.c
index 9292ffb..4f0f3de 100644
--- a/launcher/private/src/launcher.c
+++ b/launcher/private/src/launcher.c
@@ -183,15 +183,18 @@ void celixLauncher_waitForShutdown(void) {
 properties_destroy(config);
 }
 
+void celixLauncher_stop(void) {
+bundle_pt fwBundle = NULL;
+framework_getFrameworkBundle(framework, fwBundle);
+bundle_stop(fwBundle);
+}
 
 struct framework *celixLauncher_getFramework(void) {
 return framework;
 }
 
 static void launcher_shutdown(int signal) {
-bundle_pt fwBundle = NULL;
-framework_getFrameworkBundle(framework, fwBundle);
-bundle_stop(fwBundle);
+celixLauncher_stop();
 // if (framework_waitForStop(framework) != CELIX_SUCCESS) {
 // celix_log(Error waiting for stop.);
 // }

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/launcher/public/include/launcher.h
--
diff --git a/launcher/public/include/launcher.h 
b/launcher/public/include/launcher.h
index f95e160..6ee8357 100644
--- a/launcher/public/include/launcher.h
+++ b/launcher/public/include/launcher.h
@@ -32,6 +32,7 @@
 
 int celixLauncher_launch(const char *configFile);
 int celixLauncher_launchWithStream(FILE *config);
+void celixLauncher_stop(void);
 void celixLauncher_waitForShutdown(void);
 struct framework *celixLauncher_getFramework(void);
 

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/remote_services/remote_service_admin_dfi/CMakeLists.txt
--
diff --git a/remote_services/remote_service_admin_dfi/CMakeLists.txt 
b/remote_services/remote_service_admin_dfi/CMakeLists.txt
index 500e40e..3937605 100644
--- a/remote_services/remote_service_admin_dfi/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/CMakeLists.txt
@@ -46,7 +46,9 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
 ${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
 ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
 )
-target_link_libraries(remote_service_admin_dfi celix_framework 
${CURL_LIBRARIES} ${JANSSON_LIBRARIES} ${FFI_LIBRARIES} dfi)
+target_link_libraries(remote_service_admin_dfi celix_framework celix_utils 
${CURL_LIBRARIES} ${JANSSON_LIBRARIES} ${FFI_LIBRARIES} dfi)
 
 install_bundle(remote_service_admin_dfi)
+
+add_subdirectory(tst)
 endif (RSA_REMOTE_SERVICE_ADMIN_DFI)

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
--
diff --git a/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt 
b/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
index fb1834a..d71186e 100644
--- a/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
@@ -3,20 +3,26 @@
 #
 
 include_directories(
-   ${PROJECT_SOURCE_DIR}/launcher/public
+   ${PROJECT_SOURCE_DIR}/launcher/public/include
 ${CPPUTEST_INCLUDE_DIR}
+${PROJECT_SOURCE_DIR}/framework/public/include
+${PROJECT_SOURCE_DIR}/utils/public/include
 )
 
-
 #if (FRAMEWORK_TESTS) TODO
+SET(CMAKE_SKIP_BUILD_RPATH  FALSE) #TODO needed?
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed?
+SET(CMAKE_INSTALL_RPATH 
${PROJECT_BINARY_DIR}/framework:${PROJECT_BINARY_DIR}/utils)
+
add_executable(rsa_dfi_tests
-   

[01/10] celix git commit: CELIX-237: Added extra test

2015-07-31 Thread pnoltes
Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-237_rsa-ffi f9ed9b33b - 481e5c861


CELIX-237: Added extra test


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a2b09e22
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a2b09e22
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a2b09e22

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: a2b09e223114b509a01209d418cd479bb09e4b7c
Parents: f9ed9b3
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Fri Jul 31 15:57:42 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Fri Jul 31 15:57:42 2015 +0200

--
 .../dynamic_function_interface/dyn_type.c|  4 ++--
 .../dynamic_function_interface/dyn_type.h|  2 ++
 .../tst/dyn_type_tests.cpp   | 15 +++
 3 files changed, 19 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/a2b09e22/remote_services/dynamic_function_interface/dyn_type.c
--
diff --git a/remote_services/dynamic_function_interface/dyn_type.c 
b/remote_services/dynamic_function_interface/dyn_type.c
index af98fe9..2946607 100644
--- a/remote_services/dynamic_function_interface/dyn_type.c
+++ b/remote_services/dynamic_function_interface/dyn_type.c
@@ -595,7 +595,7 @@ void dynType_free(dyn_type *type, void *loc) {
 void dynType_deepFree(dyn_type *type, void *loc, bool alsoDeleteSelf) {
 if (loc != NULL) {
 dyn_type *subType = NULL;
-const char *text = NULL;
+char *text = NULL;
 switch (type-type) {
 case DYN_TYPE_COMPLEX :
 dynType_freeComplexType(type, loc);
@@ -608,7 +608,7 @@ void dynType_deepFree(dyn_type *type, void *loc, bool 
alsoDeleteSelf) {
 dynType_deepFree(subType, *(void **)loc, true);
 break;
 case DYN_TYPE_TEXT :
-text = *(const char **)loc;
+text = *(char **)loc;
 free(text);
 break;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/a2b09e22/remote_services/dynamic_function_interface/dyn_type.h
--
diff --git a/remote_services/dynamic_function_interface/dyn_type.h 
b/remote_services/dynamic_function_interface/dyn_type.h
index c4f33a2..9fdbff2 100644
--- a/remote_services/dynamic_function_interface/dyn_type.h
+++ b/remote_services/dynamic_function_interface/dyn_type.h
@@ -128,8 +128,10 @@ int 
dynType_sequence_increaseLengthAndReturnLastLoc(dyn_type *type, void *seqLoc
 dyn_type * dynType_sequence_itemType(dyn_type *type);
 uint32_t dynType_sequence_length(void *seqLoc);
 
+//typed pointer
 int dynType_typedPointer_getTypedType(dyn_type *type, dyn_type **typedType);
 
+//text
 int dynType_text_allocAndInit(dyn_type *type, void *textLoc, const char 
*value);
 
 //simple

http://git-wip-us.apache.org/repos/asf/celix/blob/a2b09e22/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
--
diff --git a/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp 
b/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
index daee4cf..96f64fa 100644
--- a/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
+++ b/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
@@ -173,3 +173,18 @@ TEST(DynTypeTests, AssignTest2) {
 
 dynType_destroy(type);
 }
+
+TEST(DynTypeTests, AssignTest3) {
+int simple = 1;
+dyn_type *type = NULL;
+int rc = dynType_parseWithStr(N, NULL, NULL, type);
+CHECK_EQUAL(0, rc);
+
+int newValue = 42;
+void *loc = simple;
+void *input = newValue;
+dynType_simple_setValue(type, loc, input);
+CHECK_EQUAL(42, simple);
+dynType_destroy(type);
+}
+



[02/10] celix git commit: CELIX-237: Moved dynamic function interface under remote_service_admin_dfi

2015-07-31 Thread pnoltes
http://git-wip-us.apache.org/repos/asf/celix/blob/bf76d213/remote_services/remote_service_admin_dfi/dynamic_function_interface/memstream/open_memstream.h
--
diff --git 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/memstream/open_memstream.h
 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/memstream/open_memstream.h
new file mode 100644
index 000..e87bb0a
--- /dev/null
+++ 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/memstream/open_memstream.h
@@ -0,0 +1,15 @@
+#ifndef OPEN_MEMSTREAM_H_
+#define OPEN_MEMSTREAM_H_
+
+#ifdef __cplusplus
+extern C
+{
+#endif
+
+FILE *open_memstream(char **cp, size_t *lenp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef FMEMOPEN_H_

http://git-wip-us.apache.org/repos/asf/celix/blob/bf76d213/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avdl
--
diff --git 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avdl
 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avdl
new file mode 100644
index 000..0490dcd
--- /dev/null
+++ 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avdl
@@ -0,0 +1,11 @@
+protocol Complex {
+
+  record StatResult {
+double sum;
+double min;
+double max;
+arraydouble input;
+  }
+
+  StatResult stats(arraydouble input);
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/bf76d213/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avpr
--
diff --git 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avpr
 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avpr
new file mode 100644
index 000..0577397
--- /dev/null
+++ 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/complex.avpr
@@ -0,0 +1,36 @@
+{
+  protocol : Complex,
+  namespace : null,
+  types : [ {
+type : record,
+name : StatResult,
+fields : [ {
+  name : sum,
+  type : double
+}, {
+  name : min,
+  type : double
+}, {
+  name : max,
+  type : double
+}, {
+  name : input,
+  type : {
+type : array,
+items : double
+  }
+} ]
+  } ],
+  messages : {
+stats : {
+  request : [ {
+name : input,
+type : {
+  type : array,
+  items : double
+}
+  } ],
+  response : StatResult
+}
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/bf76d213/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid1.avpr
--
diff --git 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid1.avpr
 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid1.avpr
new file mode 100644
index 000..c968c61
--- /dev/null
+++ 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid1.avpr
@@ -0,0 +1,29 @@
+{
+  protocol : Complex,
+  namespace : null,
+  types : [ {
+type : record,
+name : StatResult,
+fields : [ {
+  name : sum,
+  type : double
+}, {
+  name : min,
+  type : double
+}, {
+  name : max,
+  type : double
+}, {
+  name : input,
+  type : {
+type : array,
+items : double
+  }
+} ]
+  } ],
+  messages : {
+stats : {
+  response : StatResult
+}
+  }
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/bf76d213/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid2.avpr
--
diff --git 
a/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid2.avpr
 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid2.avpr
new file mode 100644
index 000..fc48ca9
--- /dev/null
+++ 
b/remote_services/remote_service_admin_dfi/dynamic_function_interface/schemas/invalid2.avpr
@@ -0,0 +1,31 @@
+{
+  protocol : Simple,
+  types : [ ],
+  messages : {
+sum : {
+  request : [ {
+name : a
+  }, {
+name : b,
+type : double
+  } ],
+  response : double
+},
+sub : {
+  request : [ {
+name : a,
+type : double
+  }, {
+name : b,
+type : double
+  } ],
+  response : double
+},
+sqrt : {
+  request : [ {
+name : a
+  } ],
+  response : double
+}
+  }
+}


[3/5] celix git commit: CELIX-237: Some mem leak fixed based on valgrind results

2015-07-31 Thread pnoltes
CELIX-237: Some mem leak fixed based on valgrind results


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/195c83d0
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/195c83d0
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/195c83d0

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 195c83d0747c7e13cd0ed4321f27fd2768fc3ee2
Parents: 794f797
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Thu Jul 30 13:49:20 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Thu Jul 30 13:49:20 2015 +0200

--
 remote_services/CMakeLists.txt  | 12 +-
 .../dynamic_function_interface/dyn_common.c | 22 +++--
 .../dynamic_function_interface/dyn_common.h | 11 -
 .../dynamic_function_interface/dyn_interface.c  | 25 +++-
 .../dynamic_function_interface/dyn_interface.h  | 10 ++--
 .../tst/dyn_interface_tests.cpp |  5 
 6 files changed, 47 insertions(+), 38 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/195c83d0/remote_services/CMakeLists.txt
--
diff --git a/remote_services/CMakeLists.txt b/remote_services/CMakeLists.txt
index b7dc13c..957f468 100644
--- a/remote_services/CMakeLists.txt
+++ b/remote_services/CMakeLists.txt
@@ -33,14 +33,14 @@ if (REMOTE_SERVICE_ADMIN)
 
 add_subdirectory(topology_manager)
 
-#add_subdirectory(remote_service_admin)
-#add_subdirectory(remote_service_admin_http)
-add_subdirectory(remote_service_admin_http_ffi)
-#add_subdirectory(remote_service_admin_shm)   
+add_subdirectory(remote_service_admin)
+add_subdirectory(remote_service_admin_http)
+#add_subdirectory(remote_service_admin_http_ffi)
+add_subdirectory(remote_service_admin_shm)
 
-#add_subdirectory(discovery_configured)
+add_subdirectory(discovery_configured)
 add_subdirectory(discovery_etcd)
-#add_subdirectory(discovery_shm)
+add_subdirectory(discovery_shm)
 
 add_subdirectory(dynamic_function_interface)
 

http://git-wip-us.apache.org/repos/asf/celix/blob/195c83d0/remote_services/dynamic_function_interface/dyn_common.c
--
diff --git a/remote_services/dynamic_function_interface/dyn_common.c 
b/remote_services/dynamic_function_interface/dyn_common.c
index 057ddcf..0cca69b 100644
--- a/remote_services/dynamic_function_interface/dyn_common.c
+++ b/remote_services/dynamic_function_interface/dyn_common.c
@@ -51,14 +51,15 @@ int dynCommon_parseNameAlsoAccept(FILE *stream, const char 
*acceptedChars, char
 if (strLen == 0) {
 status = ERROR;
 LOG_ERROR(Parsed empty name);
-free(buf);
 }
 }
 
 if (status == OK) {
LOG_DEBUG(Parsed name '%s', buf);
*result = buf;
-} 
+} else if (buf != NULL) {
+free(buf);
+}
 
 return status;
 }
@@ -116,3 +117,20 @@ static bool dynCommon_charIn(int c, const char 
*acceptedChars) {
 
 return status;
 }
+
+void dynCommon_clearNamValHead(struct namvals_head *head) {
+struct namval_entry *tmp = NULL;
+struct namval_entry *entry = TAILQ_FIRST(head);
+while (entry != NULL) {
+tmp = entry;
+
+if (entry-name != NULL) {
+free(entry-name);
+}
+if (entry-value != NULL) {
+free(entry-value);
+}
+entry = TAILQ_NEXT(entry, entries);
+free(tmp);
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/195c83d0/remote_services/dynamic_function_interface/dyn_common.h
--
diff --git a/remote_services/dynamic_function_interface/dyn_common.h 
b/remote_services/dynamic_function_interface/dyn_common.h
index 308b75a..a31cbc4 100644
--- a/remote_services/dynamic_function_interface/dyn_common.h
+++ b/remote_services/dynamic_function_interface/dyn_common.h
@@ -14,20 +14,19 @@
 //logging
 DFI_SETUP_LOG_HEADER(dynCommon);
 
-/*
-typedef struct _dyn_annotation_list_type annotation_list_type;
-TAILQ_HEAD(_dyn_annotation_list_type, _dyn_annotation_type);
+TAILQ_HEAD(namvals_head, namval_entry);
 
-typedef struct _dyn_annotation_type dyn_annotation_type;
-struct _dyn_annotation_type {
+struct namval_entry {
 char *name;
 char *value;
+TAILQ_ENTRY(namval_entry) entries;
 };
-*/
 
 int dynCommon_parseName(FILE *stream, char **result);
 int dynCommon_parseNameAlsoAccept(FILE *stream, const char *acceptedChars, 
char **result);
 int dynCommon_parseNameValue(FILE *stream, char **name, char **value);
 int dynCommon_eatChar(FILE *stream, int c);
 
+void dynCommon_clearNamValHead(struct namvals_head *head);
+
 

[5/5] celix git commit: CELIX-237: Updated serialized. Added parse tests and conresponding implementation and added write functionality

2015-07-31 Thread pnoltes
CELIX-237: Updated serialized. Added parse tests and conresponding 
implementation and added write functionality


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/24d13f2e
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/24d13f2e
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/24d13f2e

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 24d13f2ef08de444739e441471e87b349eb6972e
Parents: 9f2ea10
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Fri Jul 31 12:17:30 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Fri Jul 31 12:17:30 2015 +0200

--
 .../dynamic_function_interface/dyn_type.c   | 234 ---
 .../dynamic_function_interface/dyn_type.h   |  30 +-
 .../json_serializer.c   | 407 +++
 .../json_serializer.h   |   8 +-
 .../tst/json_serializer_tests.cpp   | 265 ++--
 5 files changed, 765 insertions(+), 179 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/24d13f2e/remote_services/dynamic_function_interface/dyn_type.c
--
diff --git a/remote_services/dynamic_function_interface/dyn_type.c 
b/remote_services/dynamic_function_interface/dyn_type.c
index f90f432..6de9736 100644
--- a/remote_services/dynamic_function_interface/dyn_type.c
+++ b/remote_services/dynamic_function_interface/dyn_type.c
@@ -47,43 +47,45 @@ static void dynType_printTypes(dyn_type *type, FILE 
*stream);
 static void dynType_printComplexType(dyn_type *type, FILE *stream);
 static void dynType_printSimpleType(dyn_type *type, FILE *stream);
 
+static int dynType_parseText(FILE *stream, dyn_type *type);
+
 struct generic_sequence {
 uint32_t cap;
 uint32_t len;
 void *buf;
 };
 
-static const int DT_OK = 0;
-static const int DT_ERROR = 1;
-static const int DT_MEM_ERROR = 2;
-static const int DT_PARSE_ERROR = 3;
+static const int OK = 0;
+static const int ERROR = 1;
+static const int MEM_ERROR = 2;
+static const int PARSE_ERROR = 3;
 
 int dynType_parse(FILE *descriptorStream, const char *name, struct 
reference_types_head *refTypes, dyn_type **type) {
 return dynType_parseWithStream(descriptorStream, name, NULL, refTypes, 
type);
 }
 
 int dynType_parseWithStr(const char *descriptor, const char *name, struct 
reference_types_head *refTypes, dyn_type **type) {
-int status = DT_OK;
+int status = OK;
 FILE *stream = fmemopen((char *)descriptor, strlen(descriptor), r);
 if (stream != NULL) {
 status = dynType_parseWithStream(stream, name, NULL, refTypes, type);
-if (status == DT_OK) {
+if (status == OK) {
 int c = fgetc(stream);
 if (c != '\0'  c != EOF) {
-status = DT_PARSE_ERROR;
+status = PARSE_ERROR;
 LOG_ERROR(Expected EOF got %c, c);
 }
 } 
 fclose(stream);
 } else {
-status = DT_ERROR;
+status = ERROR;
 LOG_ERROR(Error creating mem stream for descriptor string. %s, 
strerror(errno)); 
 }
 return status;
 }
 
 static int dynType_parseWithStream(FILE *stream, const char *name, dyn_type 
*parent, struct reference_types_head *refTypes, dyn_type **result) {
-int status = DT_OK;
+int status = OK;
 dyn_type *type = calloc(1, sizeof(*type));
 if (type != NULL) {
 type-parent = parent;
@@ -93,33 +95,33 @@ static int dynType_parseWithStream(FILE *stream, const char 
*name, dyn_type *par
 if (name != NULL) {
 type-name = strdup(name);
 if (type-name == NULL) {
-status = DT_MEM_ERROR;
+status = MEM_ERROR;
 LOG_ERROR(Error strdup'ing name '%s'\n, name);   

 } 
 }
-if (status == DT_OK) {
+if (status == OK) {
 status = dynType_parseAny(stream, type);
 }
-if (status == DT_OK) {
+if (status == OK) {
 *result = type;
 } else {
 dynType_destroy(type);
 }
 } else {
-status = DT_MEM_ERROR;
+status = MEM_ERROR;
 LOG_ERROR(Error allocating memory for type);
 }
 return status;
 }
 
 static int dynType_parseAny(FILE *stream, dyn_type *type) {
-int status = DT_OK;
+int status = OK;
 
 int c = fgetc(stream);
 switch(c) {
 case 'T' :
 status = dynType_parseNestedType(stream, type);
-if (status == DT_OK) {
+if (status == OK) {
 status = dynType_parseAny(stream, type);
 } 
 break;
@@ -138,6 +140,9 @@ static int dynType_parseAny(FILE *stream, dyn_type *type) {
 case '*' :
 

[4/5] celix git commit: CELIX-237: refactoring of dynType_print added FILE * as argument

2015-07-31 Thread pnoltes
CELIX-237: refactoring of dynType_print added FILE * as argument


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/9f2ea106
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/9f2ea106
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/9f2ea106

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 9f2ea106a553715e7e7fd1505ee135738b14adb4
Parents: 195c83d
Author: Pepijn Noltes pepijnnol...@gmail.com
Authored: Thu Jul 30 15:42:04 2015 +0200
Committer: Pepijn Noltes pepijnnol...@gmail.com
Committed: Thu Jul 30 15:42:04 2015 +0200

--
 .../dynamic_function_interface/dyn_type.c   | 123 ++-
 .../dynamic_function_interface/dyn_type.h   |   6 +-
 .../tst/dyn_type_tests.cpp  |   8 +-
 3 files changed, 72 insertions(+), 65 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/celix/blob/9f2ea106/remote_services/dynamic_function_interface/dyn_type.c
--
diff --git a/remote_services/dynamic_function_interface/dyn_type.c 
b/remote_services/dynamic_function_interface/dyn_type.c
index 720f929..f90f432 100644
--- a/remote_services/dynamic_function_interface/dyn_type.c
+++ b/remote_services/dynamic_function_interface/dyn_type.c
@@ -36,16 +36,16 @@ static int dynType_parseTypedPointer(FILE *stream, dyn_type 
*type);
 static void dynType_prepCif(ffi_type *type);
 static unsigned short dynType_getOffset(dyn_type *type, int index);
 
-static void dynType_printAny(char *name, dyn_type *type, int depth);
-static void dynType_printComplex(char *name, dyn_type *type, int depth);
-static void dynType_printSequence(char *name, dyn_type *type, int depth);
-static void dynType_printSimple(char *name, dyn_type *type, int depth);
-static void dynType_printTypedPointer(char *name, dyn_type *type, int depth);
-static void printDepth(int depth);
+static void dynType_printAny(char *name, dyn_type *type, int depth, FILE 
*stream);
+static void dynType_printComplex(char *name, dyn_type *type, int depth, FILE 
*stream);
+static void dynType_printSequence(char *name, dyn_type *type, int depth, FILE 
*stream);
+static void dynType_printSimple(char *name, dyn_type *type, int depth, FILE 
*stream);
+static void dynType_printTypedPointer(char *name, dyn_type *type, int depth, 
FILE *stream);
+static void dynType_printDepth(int depth, FILE *stream);
 
-static void dynType_printTypes(dyn_type *type);
-static void dynType_printComplexType(dyn_type *type);
-static void dynType_printSimpleType(dyn_type *type);
+static void dynType_printTypes(dyn_type *type, FILE *stream);
+static void dynType_printComplexType(dyn_type *type, FILE *stream);
+static void dynType_printSimpleType(dyn_type *type, FILE *stream);
 
 struct generic_sequence {
 uint32_t cap;
@@ -442,7 +442,7 @@ int dynType_alloc(dyn_type *type, void **bufLoc) {
 *bufLoc = inst;
 } else {
 status = DT_MEM_ERROR;
-//TODO log
+LOG_ERROR(Error allocating memory for type '%c', type-descriptor);
 }
 return status;
 }
@@ -515,6 +515,11 @@ int dynType_sequence_alloc(dyn_type *type, void *inst, int 
cap, void **out) {
 return status;
 }
 
+void dynType_free(dyn_type *type, void *loc) {
+//TODO
+LOG_INFO(TODO);
+}
+
 int dynType_sequence_append(dyn_type *type, void *inst, void *in) {
 assert(type-type == DYN_TYPE_SEQUENCE);
 int status = DT_OK;
@@ -653,99 +658,99 @@ int dynType_type(dyn_type *type) {
 return type-type;
 }
 
-void dynType_print(dyn_type *type) {
+void dynType_print(dyn_type *type, FILE *stream) {
 if (type != NULL) {
-dynType_printTypes(type);
+dynType_printTypes(type, stream);
 
-printf(main type:\n);
-dynType_printAny(root, type, 0);
+fprintf(stream, main type:\n);
+dynType_printAny(root, type, 0, stream);
 } else {
-printf(invalid type\n);
+fprintf(stream, invalid type\n);
 }
 }
 
-static void printDepth(int depth) {
+static void dynType_printDepth(int depth, FILE *stream) {
 int i;
 for (i = 0; i  depth; i +=1 ) {
-printf(\t);
+fprintf(stream, \t);
 }
 }
 
-static void dynType_printAny(char *name, dyn_type *type, int depth) {
+static void dynType_printAny(char *name, dyn_type *type, int depth, FILE 
*stream) {
 dyn_type *toPrint = type;
 if (toPrint-type == DYN_TYPE_REF) {
 toPrint = toPrint-ref.ref;
 }
 switch(toPrint-type) {
 case DYN_TYPE_COMPLEX :
-dynType_printComplex(name, toPrint, depth);
+dynType_printComplex(name, toPrint, depth, stream);
 break;
 case DYN_TYPE_SIMPLE :
-dynType_printSimple(name, toPrint, depth);
+dynType_printSimple(name, toPrint, depth, stream);