CELIX-417: Refactor for CMake usage in RSA, PSA and Docker. mostly trying to identify the api and common libraries
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/2a670f26 Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/2a670f26 Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/2a670f26 Branch: refs/heads/develop Commit: 2a670f26579d89e5404979d7fffb4ed27040441c Parents: a1c3088 Author: Pepijn Noltes <[email protected]> Authored: Tue Nov 21 21:07:44 2017 +0100 Committer: Pepijn Noltes <[email protected]> Committed: Tue Nov 21 21:07:44 2017 +0100 ---------------------------------------------------------------------- cmake/cmake_celix/BundlePackaging.cmake | 2 +- cmake/cmake_celix/DockerPackaging.cmake | 17 +- deployment_admin/CMakeLists.txt | 2 +- examples/dm_example_cxx/CMakeLists.txt | 16 +- examples/dm_example_cxx/phase1/CMakeLists.txt | 4 +- examples/hello_world/CMakeLists.txt | 8 +- examples/services_example_c/bar/CMakeLists.txt | 4 +- log_writer/CMakeLists.txt | 6 +- log_writer/README.md | 10 +- log_writer/log_writer_stdout/CMakeLists.txt | 10 +- log_writer/log_writer_syslog/CMakeLists.txt | 4 - pubsub/CMakeLists.txt | 2 +- pubsub/deploy/CMakeLists.txt | 2 +- .../examples/mp_pubsub/publisher/CMakeLists.txt | 2 +- .../mp_pubsub/subscriber/CMakeLists.txt | 2 +- pubsub/examples/pubsub/publisher/CMakeLists.txt | 2 +- .../examples/pubsub/publisher2/CMakeLists.txt | 2 +- .../examples/pubsub/subscriber/CMakeLists.txt | 2 +- pubsub/pubsub_admin_udp_mc/CMakeLists.txt | 28 +- .../private/include/large_udp.h | 45 - .../private/include/pubsub_admin_impl.h | 93 - .../private/include/topic_publication.h | 57 - .../private/include/topic_subscription.h | 60 - .../pubsub_admin_udp_mc/private/src/large_udp.c | 372 - .../private/src/psa_activator.c | 141 - .../private/src/pubsub_admin_impl.c | 1039 --- .../private/src/topic_publication.c | 444 - .../private/src/topic_subscription.c | 635 -- pubsub/pubsub_admin_udp_mc/src/large_udp.c | 372 + pubsub/pubsub_admin_udp_mc/src/large_udp.h | 45 + pubsub/pubsub_admin_udp_mc/src/psa_activator.c | 141 + .../pubsub_admin_udp_mc/src/pubsub_admin_impl.c | 1039 +++ .../pubsub_admin_udp_mc/src/pubsub_admin_impl.h | 93 + .../pubsub_admin_udp_mc/src/topic_publication.c | 444 + .../pubsub_admin_udp_mc/src/topic_publication.h | 57 + .../src/topic_subscription.c | 635 ++ .../src/topic_subscription.h | 60 + pubsub/pubsub_admin_zmq/CMakeLists.txt | 5 +- pubsub/pubsub_discovery/CMakeLists.txt | 27 +- .../private/include/etcd_common.h | 28 - .../private/include/etcd_watcher.h | 38 - .../private/include/etcd_writer.h | 39 - .../private/include/pubsub_discovery_impl.h | 72 - .../pubsub_discovery/private/src/etcd_common.c | 82 - .../pubsub_discovery/private/src/etcd_watcher.c | 290 - .../pubsub_discovery/private/src/etcd_writer.c | 189 - .../private/src/psd_activator.c | 171 - .../private/src/pubsub_discovery_impl.c | 457 - .../public/include/pubsub_discovery.h | 26 - pubsub/pubsub_discovery/src/etcd_common.c | 82 + pubsub/pubsub_discovery/src/etcd_common.h | 28 + pubsub/pubsub_discovery/src/etcd_watcher.c | 290 + pubsub/pubsub_discovery/src/etcd_watcher.h | 38 + pubsub/pubsub_discovery/src/etcd_writer.c | 189 + pubsub/pubsub_discovery/src/etcd_writer.h | 39 + pubsub/pubsub_discovery/src/psd_activator.c | 171 + pubsub/pubsub_discovery/src/pubsub_discovery.h | 26 + .../src/pubsub_discovery_impl.c | 457 + .../src/pubsub_discovery_impl.h | 72 + pubsub/pubsub_serializer_json/CMakeLists.txt | 20 +- .../private/include/pubsub_serializer_impl.h | 55 - .../private/src/ps_activator.c | 107 - .../private/src/pubsub_serializer_impl.c | 295 - .../pubsub_serializer_json/src/ps_activator.c | 107 + .../src/pubsub_serializer_impl.c | 295 + .../src/pubsub_serializer_impl.h | 55 + pubsub/pubsub_topology_manager/CMakeLists.txt | 12 +- pubsub/test/CMakeLists.txt | 6 +- remote_services/CMakeLists.txt | 6 +- .../discovery/private/include/discovery.h | 67 - .../include/endpoint_descriptor_common.h | 61 - .../include/endpoint_descriptor_reader.h | 42 - .../include/endpoint_descriptor_writer.h | 39 - .../private/include/endpoint_discovery_poller.h | 56 - .../private/include/endpoint_discovery_server.h | 81 - remote_services/discovery/private/src/desc.xml | 41 - .../discovery/private/src/discovery.c | 233 - .../discovery/private/src/discovery_activator.c | 186 - .../private/src/endpoint_descriptor_reader.c | 387 - .../private/src/endpoint_descriptor_writer.c | 233 - .../private/src/endpoint_discovery_poller.c | 403 - .../private/src/endpoint_discovery_server.c | 450 - remote_services/discovery_common/CMakeLists.txt | 33 + .../discovery_common/include/civetweb.h | 657 ++ .../discovery_common/include/discovery.h | 67 + .../include/endpoint_descriptor_common.h | 61 + .../include/endpoint_descriptor_reader.h | 42 + .../include/endpoint_descriptor_writer.h | 39 + .../include/endpoint_discovery_poller.h | 56 + .../include/endpoint_discovery_server.h | 81 + remote_services/discovery_common/src/civetweb.c | 7907 ++++++++++++++++++ remote_services/discovery_common/src/desc.xml | 41 + .../discovery_common/src/discovery.c | 234 + .../discovery_common/src/discovery_activator.c | 186 + .../src/endpoint_descriptor_reader.c | 387 + .../src/endpoint_descriptor_writer.c | 233 + .../src/endpoint_discovery_poller.c | 403 + .../src/endpoint_discovery_server.c | 450 + remote_services/discovery_common/src/md5.inl | 461 + .../discovery_configured/CMakeLists.txt | 36 +- .../private/include/discovery_impl.h | 62 - .../discovery_configured/private/src/desc.xml | 41 - .../private/src/discovery_impl.c | 123 - .../discovery_configured/src/desc.xml | 41 + .../discovery_configured/src/discovery_impl.c | 123 + .../discovery_configured/src/discovery_impl.h | 62 + remote_services/discovery_etcd/CMakeLists.txt | 33 +- remote_services/discovery_shm/CMakeLists.txt | 35 +- .../private/include/discovery_impl.h | 66 - .../private/include/discovery_shm.h | 56 - .../private/include/discovery_shmWatcher.h | 40 - .../discovery_shm/private/src/discovery_impl.c | 163 - .../discovery_shm/private/src/discovery_shm.c | 284 - .../private/src/discovery_shmWatcher.c | 246 - .../discovery_shm/src/discovery_impl.c | 163 + .../discovery_shm/src/discovery_impl.h | 66 + .../discovery_shm/src/discovery_shm.c | 284 + .../discovery_shm/src/discovery_shm.h | 56 + .../discovery_shm/src/discovery_shmWatcher.c | 246 + .../discovery_shm/src/discovery_shmWatcher.h | 40 + remote_services/examples/CMakeLists.txt | 5 +- .../examples/calculator_api/CMakeLists.txt | 22 + .../calculator_api/include/calculator_service.h | 56 + ...apache.celix.calc.api.Calculator2.descriptor | 11 + .../examples/calculator_service/CMakeLists.txt | 22 +- .../private/include/calculator_impl.h | 43 - .../private/src/calculator_activator.c | 110 - .../private/src/calculator_impl.c | 79 - .../public/include/calculator_service.h | 56 - ...apache.celix.calc.api.Calculator2.descriptor | 11 - .../src/calculator_activator.c | 110 + .../calculator_service/src/calculator_impl.c | 79 + .../calculator_service/src/calculator_impl.h | 43 + .../examples/calculator_shell/CMakeLists.txt | 28 +- .../private/include/add_command.h | 32 - ...apache.celix.calc.api.Calculator2.descriptor | 11 - .../private/include/sqrt_command.h | 32 - .../private/include/sub_command.h | 32 - .../calculator_shell/private/src/add_command.c | 101 - .../private/src/calculator_shell_activator.c | 125 - .../calculator_shell/private/src/sqrt_command.c | 96 - .../calculator_shell/private/src/sub_command.c | 99 - .../examples/calculator_shell/src/add_command.c | 101 + .../examples/calculator_shell/src/add_command.h | 32 + .../src/calculator_shell_activator.c | 125 + ...apache.celix.calc.api.Calculator2.descriptor | 11 + .../calculator_shell/src/sqrt_command.c | 96 + .../calculator_shell/src/sqrt_command.h | 32 + .../examples/calculator_shell/src/sub_command.c | 99 + .../examples/calculator_shell/src/sub_command.h | 32 + .../remote_service_admin/CMakeLists.txt | 46 - remote_services/remote_service_admin/README.md | 11 - .../private/include/export_registration_impl.h | 61 - .../private/include/import_registration_impl.h | 81 - .../private/include/remote_service_admin_impl.h | 49 - .../private/src/endpoint_description.c | 89 - .../private/src/export_registration_impl.c | 257 - .../private/src/import_registration_impl.c | 274 - .../private/src/remote_proxy_factory_impl.c | 252 - .../public/include/endpoint_description.h | 50 - .../public/include/endpoint_listener.h | 49 - .../public/include/export_registration.h | 22 - .../public/include/import_registration.h | 22 - .../public/include/remote_constants.h | 38 - .../public/include/remote_endpoint.h | 44 - .../public/include/remote_endpoint_impl.h | 38 - .../public/include/remote_proxy.h | 76 - .../public/include/remote_service_admin.h | 73 - .../remote_service_admin_api/CMakeLists.txt | 45 + .../remote_service_admin_api/README.md | 11 + .../include/endpoint_description.h | 50 + .../include/endpoint_listener.h | 49 + .../include/export_registration.h | 22 + .../include/import_registration.h | 22 + .../include/remote_constants.h | 38 + .../include/remote_endpoint.h | 44 + .../include/remote_endpoint_impl.h | 38 + .../include/remote_proxy.h | 76 + .../include/remote_service_admin.h | 73 + .../remote_service_admin_common/CMakeLists.txt | 24 + .../src/endpoint_description.c | 89 + .../src/export_registration_impl.c | 257 + .../src/export_registration_impl.h | 61 + .../src/import_registration_impl.c | 274 + .../src/import_registration_impl.h | 81 + .../src/remote_proxy_factory_impl.c | 252 + .../src/remote_service_admin_impl.h | 49 + .../remote_service_admin_dfi/rsa/CMakeLists.txt | 31 +- .../rsa/private/include/dfi_utils.h | 30 - .../private/include/export_registration_dfi.h | 38 - .../private/include/import_registration_dfi.h | 44 - .../private/include/remote_service_admin_dfi.h | 57 - .../rsa/private/src/dfi_utils.c | 98 - .../rsa/private/src/export_registration_dfi.c | 251 - .../rsa/private/src/import_registration_dfi.c | 402 - .../src/remote_service_admin_activator.c | 124 - .../rsa/private/src/remote_service_admin_dfi.c | 775 -- .../rsa/src/dfi_utils.c | 98 + .../rsa/src/dfi_utils.h | 30 + .../rsa/src/export_registration_dfi.c | 251 + .../rsa/src/export_registration_dfi.h | 38 + .../rsa/src/import_registration_dfi.c | 402 + .../rsa/src/import_registration_dfi.h | 44 + .../rsa/src/remote_service_admin_activator.c | 124 + .../rsa/src/remote_service_admin_dfi.c | 775 ++ .../rsa/src/remote_service_admin_dfi.h | 57 + .../rsa_tst/CMakeLists.txt | 4 +- .../rsa_tst/bundle/CMakeLists.txt | 14 +- remote_services/topology_manager/CMakeLists.txt | 26 +- .../topology_manager/include/tm_scope.h | 46 + .../topology_manager/private/include/scope.h | 150 - .../private/include/topology_manager.h | 65 - .../topology_manager/private/src/activator.c | 289 - .../topology_manager/private/src/scope.c | 326 - .../private/src/topology_manager.c | 985 --- .../topology_manager/public/include/tm_scope.h | 46 - .../topology_manager/src/activator.c | 289 + remote_services/topology_manager/src/scope.c | 326 + remote_services/topology_manager/src/scope.h | 150 + .../topology_manager/src/topology_manager.c | 985 +++ .../topology_manager/src/topology_manager.h | 65 + .../topology_manager/tms_tst/CMakeLists.txt | 4 +- .../tms_tst/bundle/CMakeLists.txt | 2 +- .../tms_tst/disc_mock/CMakeLists.txt | 11 +- .../utils/private/include/civetweb.h | 657 -- remote_services/utils/private/src/civetweb.c | 7907 ------------------ remote_services/utils/private/src/md5.inl | 461 - shell/CMakeLists.txt | 2 +- shell/README.md | 3 +- 229 files changed, 23404 insertions(+), 23450 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/cmake/cmake_celix/BundlePackaging.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake index 2071fca..c5d75d6 100644 --- a/cmake/cmake_celix/BundlePackaging.cmake +++ b/cmake/cmake_celix/BundlePackaging.cmake @@ -371,7 +371,7 @@ function(bundle_import_libs) list(APPEND LIBS "$<TARGET_SONAME_FILE_NAME:${LIB}>") endif() - target_link_libraries(${BUNDLE} ${LIB}) + target_link_libraries(${BUNDLE} PRIVATE ${LIB}) endforeach() http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/cmake/cmake_celix/DockerPackaging.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/DockerPackaging.cmake b/cmake/cmake_celix/DockerPackaging.cmake index 7cce6dd..b85da11 100644 --- a/cmake/cmake_celix/DockerPackaging.cmake +++ b/cmake/cmake_celix/DockerPackaging.cmake @@ -116,22 +116,16 @@ function(add_celix_docker) DEPENDS ${TIMESTAMP_FILE} ) - #Setting CELIX_LIB_DIRS, CELIX_BIN_DIR and CELIX_LAUNCHER - if (EXISTS ${CELIX_FRAMEWORK_LIBRARY}) - #CELIX_FRAMEWORK_LIBRARY set by FindCelix.cmake -> Celix Based Project - #CELIX_LAUNCHER is set by FindCelix.cmake - else() - set(CELIX_LAUNCHER "$<TARGET_FILE:celix>") - endif() + set(CELIX_LAUNCHER "$<TARGET_FILE:Celix::launcher>") #setup dependencies based on timestamp if (DOCKER_CREATE_FS) add_custom_command(OUTPUT "${TIMESTAMP_FILE}" COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE} - COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC> - COMMAND cd $<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC> && /bin/bash ${CELIX_CMAKE_DIRECTORY}/cmake_celix/create_target_filesystem.sh -e ${CELIX_LAUNCHER} -l $<TARGET_FILE:${DOCKER_DEPSLIB}> > /dev/null + COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC> + COMMAND cd $<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC> && /bin/bash ${CELIX_CMAKE_DIRECTORY}/cmake_celix/create_target_filesystem.sh -e ${CELIX_LAUNCHER} -l $<TARGET_FILE:${DOCKER_DEPSLIB}> > /dev/null DEPENDS "$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_DEPS>" ${DOCKERFILE} ${DOCKER_DEPSLIB} - WORKING_DIRECTORY "${DOCKER_LOC}" + WORKING_DIRECTORY "${DOCKER_LOC}" COMMENT "Creating docker dir for ${DOCKER_TARGET}" VERBATIM ) else () @@ -248,7 +242,8 @@ function(celix_docker_bundles) COMMENT "Copying bundle '${BUNDLE}' to '${OUT}'" DEPENDS ${BUNDLE} ) - add_dependencies(${DOCKER_TARGET} ${BUNDLE}_bundle) #ensure the the deploy depends on the _bundle target, custom_command depends on add_library + get_target_property(BUILD_BUNDLE_TARGET ${BUNDLE} BUNDLE_BUILD_BUNDLE_TARGET) + add_dependencies(${DOCKER_TARGET} ${BUILD_BUNDLE_TARGET}) #ensure the the deploy depends on the _bundle target, custom_command depends on add_library endif() list(APPEND DEPS "${OUT}") endforeach() http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/deployment_admin/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/deployment_admin/CMakeLists.txt b/deployment_admin/CMakeLists.txt index 4a06be5..3eb38ec 100644 --- a/deployment_admin/CMakeLists.txt +++ b/deployment_admin/CMakeLists.txt @@ -57,7 +57,7 @@ if (DEPLOYMENT_ADMIN) add_library(Celix::deployment_admin ALIAS deployment_admin) add_deploy(deployment-admin - BUNDLES Celix::deployment_admin Celix::shell Celix::shell_tui log_service log_writer + BUNDLES Celix::deployment_admin Celix::shell Celix::shell_tui Celix::log_service Celix::log_writer_stdout PROPERTIES "deployment_admin_url=http://localhost:8080" "deployment_admin_identification=celix" http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/examples/dm_example_cxx/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/dm_example_cxx/CMakeLists.txt b/examples/dm_example_cxx/CMakeLists.txt index 1a47113..012f706 100644 --- a/examples/dm_example_cxx/CMakeLists.txt +++ b/examples/dm_example_cxx/CMakeLists.txt @@ -36,9 +36,9 @@ if (BUILD_DEPENDENCY_MANAGER_CXX) BUNDLES Celix::shell Celix::shell_tui - dm_shell - log_service - log_writer + Celix::dm_shell + Celix::log_service + Celix::log_writer_stdout phase1_cxx phase2a_cxx @@ -55,11 +55,11 @@ if (BUILD_DEPENDENCY_MANAGER_CXX) BUNDLES_DIR /usr/share/bundles WORKDIR /workspace BUNDLES - celix_shell - shell_tui - dm_shell - log_service - log_writer + Celix::shell + Celix::shell_tui + Celix::dm_shell + Celix::log_service + Celix::log_writer_stdout phase1_cxx phase2a_cxx http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/examples/dm_example_cxx/phase1/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/dm_example_cxx/phase1/CMakeLists.txt b/examples/dm_example_cxx/phase1/CMakeLists.txt index 728278b..62b1658 100644 --- a/examples/dm_example_cxx/phase1/CMakeLists.txt +++ b/examples/dm_example_cxx/phase1/CMakeLists.txt @@ -35,8 +35,8 @@ IF(APPLE) else() if(ENABLE_ADDRESS_SANITIZER) #With asan there can be undefined symbols - target_link_libraries(phase1_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api) + target_link_libraries(phase1_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api) else() - target_link_libraries(phase1_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api) + target_link_libraries(phase1_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api) endif() endif() http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/examples/hello_world/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt index 7cb590f..ca72eec 100644 --- a/examples/hello_world/CMakeLists.txt +++ b/examples/hello_world/CMakeLists.txt @@ -32,7 +32,7 @@ add_library(hello_test2lib SHARED ) set_library_version(hello_test2lib "3.3.3") -add_bundle(hello +add_bundle(hello_bundle VERSION "1.2" SOURCES private/src/activator.c @@ -45,19 +45,19 @@ add_bundle(hello_export EXPORT_LIBRARIES hello_test2lib ) -bundle_private_libs(hello +bundle_private_libs(hello_bundle hello_testlib ) add_deploy(helloworld_byref GROUP hello - BUNDLES hello_export hello ${CELIX_SHELL_BUNDLE} ${CELIX_SHELL_TUI_BUNDLE} + BUNDLES hello_export hello_bundle ${CELIX_SHELL_BUNDLE} ${CELIX_SHELL_TUI_BUNDLE} ) add_deploy(helloworld_withcopy GROUP hello COPY #Ensures that bundles are copied in the deploy location - BUNDLES hello_export hello ${SHELL_BUNDLE} ${SHELL_TUI_BUNDLE} + BUNDLES hello_export hello_bundle ${SHELL_BUNDLE} ${SHELL_TUI_BUNDLE} ) endif() http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/examples/services_example_c/bar/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/services_example_c/bar/CMakeLists.txt b/examples/services_example_c/bar/CMakeLists.txt index 2332931..0633c06 100644 --- a/examples/services_example_c/bar/CMakeLists.txt +++ b/examples/services_example_c/bar/CMakeLists.txt @@ -32,8 +32,8 @@ IF(APPLE) else() if(ENABLE_ADDRESS_SANITIZER) #With asan there can be undefined symbols - target_link_libraries(bar -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive Celix::framework ) + target_link_libraries(bar PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive Celix::framework ) else() - target_link_libraries(bar -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive Celix::framework ) + target_link_libraries(bar PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive Celix::framework ) endif() endif() http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/log_writer/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/log_writer/CMakeLists.txt b/log_writer/CMakeLists.txt index a742af2..340af15 100644 --- a/log_writer/CMakeLists.txt +++ b/log_writer/CMakeLists.txt @@ -19,5 +19,9 @@ celix_subproject(LOG_WRITER "Option to enable building the Log Writer bundles" O if (LOG_WRITER) add_subdirectory(log_writer) add_subdirectory(log_writer_stdout) - add_subdirectory(log_writer_syslog) + add_subdirectory(log_writer_syslog) + + #Setup target aliases to match external usage + add_library(Celix::log_writer_stdout ALIAS log_writer_stdout) + add_library(Celix::log_writer_syslog ALIAS log_writer_syslog) endif (LOG_WRITER) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/log_writer/README.md ---------------------------------------------------------------------- diff --git a/log_writer/README.md b/log_writer/README.md index 6de181d..29aebcc 100644 --- a/log_writer/README.md +++ b/log_writer/README.md @@ -1,7 +1,13 @@ -## Log Writer +# Log Writer The Celix Log Writers are components that read/listen to the Log Service and print the Log entries to the console or syslog, respectively. -###### CMake options +## CMake options BUILD_LOG_WRITER=ON BUILD_LOG_WRITER_SYSLOG=ON + +## Using info + +If the Celix Log Writers is installed The `FindCelix.cmake` will set: + - The `Celix::log_writer_stdout` bundle target + - The `Celix::log_writer_syslog` bundle target http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/log_writer/log_writer_stdout/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/log_writer/log_writer_stdout/CMakeLists.txt b/log_writer/log_writer_stdout/CMakeLists.txt index 11734cc..6070b2e 100644 --- a/log_writer/log_writer_stdout/CMakeLists.txt +++ b/log_writer/log_writer_stdout/CMakeLists.txt @@ -15,18 +15,14 @@ # specific language governing permissions and limitations # under the License. -add_bundle(log_writer +add_bundle(log_writer_stdout SYMBOLIC_NAME "apache_celix_log_writer" VERSION "1.1.0" NAME "Apache Celix Log Writer" SOURCES - #${PROJECT_SOURCE_DIR}/log_writer/log_writer/private/src/log_writer_activator - #${PROJECT_SOURCE_DIR}/log_writer/log_writer/private/src/log_writer - #${PROJECT_SOURCE_DIR}/log_writer/log_writer/private/include/log_writer.h - src/log_writer_stdout ) -install_bundle(log_writer) +install_bundle(log_writer_stdout) -target_link_libraries(log_writer PRIVATE Celix::log_service_api log_writer_common) \ No newline at end of file +target_link_libraries(log_writer_stdout PRIVATE Celix::log_service_api log_writer_common) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/log_writer/log_writer_syslog/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/log_writer/log_writer_syslog/CMakeLists.txt b/log_writer/log_writer_syslog/CMakeLists.txt index caad713..b98b914 100644 --- a/log_writer/log_writer_syslog/CMakeLists.txt +++ b/log_writer/log_writer_syslog/CMakeLists.txt @@ -23,10 +23,6 @@ if (LOG_WRITER_SYSLOG) SYMBOLIC_NAME "apache_celix_log_writer_syslog" NAME "Apache Celix Log Writer Syslog" SOURCES - - #${PROJECT_SOURCE_DIR}/log_writer/log_writer/private/src/log_writer_activator - #${PROJECT_SOURCE_DIR}/log_writer/log_writer/private/src/log_writer - #${PROJECT_SOURCE_DIR}/log_writer/log_writer/private/include/log_writer.h private/src/log_writer_syslog ) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/CMakeLists.txt b/pubsub/CMakeLists.txt index a866ba4..9d18175 100644 --- a/pubsub/CMakeLists.txt +++ b/pubsub/CMakeLists.txt @@ -43,7 +43,7 @@ if (PUBSUB) endif() #api target - add_libary(pubsub_api INTERFACE) + add_library(pubsub_api INTERFACE) target_include_directories(pubsub_api INTERFACE api) #install api http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/deploy/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/deploy/CMakeLists.txt b/pubsub/deploy/CMakeLists.txt index 6f9234d..e76f91b 100644 --- a/pubsub/deploy/CMakeLists.txt +++ b/pubsub/deploy/CMakeLists.txt @@ -165,7 +165,7 @@ if (BUILD_PUBSUB_PSA_ZMQ) add_deploy("pubsub_mp_subscriber_zmq" GROUP "pubsub" BUNDLES - Celix::hell + Celix::shell Celix::shell_tui org.apache.celix.pubsub_serializer.PubSubSerializerJson org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt b/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt index 76a01f1..1ef8645 100644 --- a/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt +++ b/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt @@ -47,4 +47,4 @@ bundle_files(org.apache.celix.pubsub_publisher.MpPublisher DESTINATION "META-INF/keys/subscriber" ) -target_link_libraries(org.apache.celix.pubsub_publisher.MpPublisher celix_framework celix_utils) +target_link_libraries(org.apache.celix.pubsub_publisher.MpPublisher PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt b/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt index a480a73..e281ab1 100644 --- a/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt +++ b/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt @@ -47,4 +47,4 @@ bundle_files(org.apache.celix.pubsub_subscriber.MpSubscriber DESTINATION "META-INF/keys/publisher" ) -target_link_libraries(org.apache.celix.pubsub_subscriber.MpSubscriber celix_framework celix_utils) +target_link_libraries(org.apache.celix.pubsub_subscriber.MpSubscriber PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/examples/pubsub/publisher/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher/CMakeLists.txt b/pubsub/examples/pubsub/publisher/CMakeLists.txt index e35c137..fcf50c7 100644 --- a/pubsub/examples/pubsub/publisher/CMakeLists.txt +++ b/pubsub/examples/pubsub/publisher/CMakeLists.txt @@ -51,4 +51,4 @@ bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher DESTINATION "META-INF/keys/subscriber" ) -target_link_libraries(org.apache.celix.pubsub_publisher.PoiPublisher celix_framework celix_utils) +target_link_libraries(org.apache.celix.pubsub_publisher.PoiPublisher PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/examples/pubsub/publisher2/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher2/CMakeLists.txt b/pubsub/examples/pubsub/publisher2/CMakeLists.txt index b83f7dd..82ffb75 100644 --- a/pubsub/examples/pubsub/publisher2/CMakeLists.txt +++ b/pubsub/examples/pubsub/publisher2/CMakeLists.txt @@ -51,4 +51,4 @@ bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher2 DESTINATION "META-INF/keys/subscriber" ) -target_link_libraries(org.apache.celix.pubsub_publisher.PoiPublisher2 celix_framework celix_utils) +target_link_libraries(org.apache.celix.pubsub_publisher.PoiPublisher2 PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/examples/pubsub/subscriber/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/subscriber/CMakeLists.txt b/pubsub/examples/pubsub/subscriber/CMakeLists.txt index 7fd9fae..28569b0 100644 --- a/pubsub/examples/pubsub/subscriber/CMakeLists.txt +++ b/pubsub/examples/pubsub/subscriber/CMakeLists.txt @@ -52,4 +52,4 @@ bundle_files(org.apache.celix.pubsub_subscriber.PoiSubscriber DESTINATION "META-INF/keys/publisher" ) -target_link_libraries(org.apache.celix.pubsub_subscriber.PoiSubscriber celix_framework celix_utils) +target_link_libraries(org.apache.celix.pubsub_subscriber.PoiSubscriber PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/CMakeLists.txt b/pubsub/pubsub_admin_udp_mc/CMakeLists.txt index 3ab0c54..a57693f 100644 --- a/pubsub/pubsub_admin_udp_mc/CMakeLists.txt +++ b/pubsub/pubsub_admin_udp_mc/CMakeLists.txt @@ -17,32 +17,28 @@ find_package(Jansson REQUIRED) -include_directories("${PROJECT_SOURCE_DIR}/utils/public/include") -include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include") -include_directories("${PROJECT_SOURCE_DIR}/dfi/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") -include_directories("private/include") -include_directories("public/include") -include_directories("${JANSSON_INCLUDE_DIR}") - add_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_udp_multicast" VERSION "1.0.0" SOURCES - private/src/psa_activator.c - private/src/pubsub_admin_impl.c - private/src/topic_subscription.c - private/src/topic_publication.c - private/src/large_udp.c - ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c + src/psa_activator.c + src/pubsub_admin_impl.c + src/topic_subscription.c + src/topic_publication.c + src/large_udp.c ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_endpoint.c ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_admin_match.c ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c ) + +target_include_directories(org.apache.celix.pubsub_admin.PubSubAdminUdpMc PRIVATE + src + ${JANSSON_INCLUDE_DIR} +) + set_target_properties(org.apache.celix.pubsub_admin.PubSubAdminUdpMc PROPERTIES INSTALL_RPATH "$ORIGIN") -target_link_libraries(org.apache.celix.pubsub_admin.PubSubAdminUdpMc celix_framework celix_utils celix_dfi) +target_link_libraries(org.apache.celix.pubsub_admin.PubSubAdminUdpMc PRIVATE Celix::framework Celix::dfi Celix::log_helper) install_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc) http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/private/include/large_udp.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/private/include/large_udp.h b/pubsub/pubsub_admin_udp_mc/private/include/large_udp.h deleted file mode 100644 index a21e654..0000000 --- a/pubsub/pubsub_admin_udp_mc/private/include/large_udp.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * large_udp.h - * - * \date Mar 1, 2016 - * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef _LARGE_UDP_H_ -#define _LARGE_UDP_H_ -#include <stdbool.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -typedef struct largeUdp *largeUdp_pt; - -largeUdp_pt largeUdp_create(unsigned int maxNrUdpReceptions); -void largeUdp_destroy(largeUdp_pt handle); - -int largeUdp_sendto(largeUdp_pt handle, int fd, void *buf, size_t count, int flags, struct sockaddr_in *dest_addr, size_t addrlen); -int largeUdp_sendmsg(largeUdp_pt handle, int fd, struct iovec *largeMsg_iovec, int len, int flags, struct sockaddr_in *dest_addr, size_t addrlen); -bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, unsigned int *size); -int largeUdp_read(largeUdp_pt handle, unsigned int index, void ** buffer, unsigned int size); - -#endif /* _LARGE_UDP_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/private/include/pubsub_admin_impl.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/private/include/pubsub_admin_impl.h b/pubsub/pubsub_admin_udp_mc/private/include/pubsub_admin_impl.h deleted file mode 100644 index de4b813..0000000 --- a/pubsub/pubsub_admin_udp_mc/private/include/pubsub_admin_impl.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * pubsub_admin_impl.h - * - * \date Dec 5, 2013 - * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef PUBSUB_ADMIN_UDP_MC_IMPL_H_ -#define PUBSUB_ADMIN_UDP_MC_IMPL_H_ - -#include "pubsub_admin.h" -#include "log_helper.h" - -#define PUBSUB_ADMIN_TYPE "udp_mc" - -struct pubsub_admin { - - bundle_context_pt bundle_context; - log_helper_pt loghelper; - - /* List of the available serializers */ - celix_thread_mutex_t serializerListLock; // List<serializers> - array_list_pt serializerList; - - celix_thread_mutex_t localPublicationsLock; - hash_map_pt localPublications;//<topic(string),service_factory_pt> - - celix_thread_mutex_t externalPublicationsLock; - hash_map_pt externalPublications;//<topic(string),List<pubsub_ep>> - - celix_thread_mutex_t subscriptionsLock; - hash_map_pt subscriptions; //<topic(string),topic_subscription> - - celix_thread_mutex_t pendingSubscriptionsLock; - celix_thread_mutexattr_t pendingSubscriptionsAttr; - hash_map_pt pendingSubscriptions; //<topic(string),List<pubsub_ep>> - - /* Those are used to keep track of valid subscriptions/publications that still have no valid serializer */ - celix_thread_mutex_t noSerializerPendingsLock; - celix_thread_mutexattr_t noSerializerPendingsAttr; - array_list_pt noSerializerSubscriptions; // List<pubsub_ep> - array_list_pt noSerializerPublications; // List<pubsub_ep> - - celix_thread_mutex_t usedSerializersLock; - hash_map_pt topicSubscriptionsPerSerializer; // <serializer,List<topicSubscription>> - hash_map_pt topicPublicationsPerSerializer; // <serializer,List<topicPublications>> - - char* ifIpAddress; // The local interface which is used for multicast communication - char* mcIpAddress; // The multicast IP address - - int sendSocket; - void* zmq_context; // to be removed - -}; - -celix_status_t pubsubAdmin_create(bundle_context_pt context, pubsub_admin_pt *admin); -celix_status_t pubsubAdmin_destroy(pubsub_admin_pt admin); - -celix_status_t pubsubAdmin_addSubscription(pubsub_admin_pt admin,pubsub_endpoint_pt subEP); -celix_status_t pubsubAdmin_removeSubscription(pubsub_admin_pt admin,pubsub_endpoint_pt subEP); - -celix_status_t pubsubAdmin_addPublication(pubsub_admin_pt admin,pubsub_endpoint_pt pubEP); -celix_status_t pubsubAdmin_removePublication(pubsub_admin_pt admin,pubsub_endpoint_pt pubEP); - -celix_status_t pubsubAdmin_closeAllPublications(pubsub_admin_pt admin,char* scope, char* topic); -celix_status_t pubsubAdmin_closeAllSubscriptions(pubsub_admin_pt admin,char* scope, char* topic); - -celix_status_t pubsubAdmin_serializerAdded(void * handle, service_reference_pt reference, void * service); -celix_status_t pubsubAdmin_serializerRemoved(void * handle, service_reference_pt reference, void * service); - -celix_status_t pubsubAdmin_matchEndpoint(pubsub_admin_pt admin, pubsub_endpoint_pt endpoint, double* score); - - -#endif /* PUBSUB_ADMIN_UDP_MC_IMPL_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/private/include/topic_publication.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/private/include/topic_publication.h b/pubsub/pubsub_admin_udp_mc/private/include/topic_publication.h deleted file mode 100644 index 4363d71..0000000 --- a/pubsub/pubsub_admin_udp_mc/private/include/topic_publication.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * topic_publication.h - * - * \date Sep 24, 2015 - * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef TOPIC_PUBLICATION_H_ -#define TOPIC_PUBLICATION_H_ - -#include "publisher.h" -#include "pubsub_endpoint.h" -#include "pubsub_common.h" - -#include "pubsub_serializer.h" - -#define UDP_BASE_PORT 49152 -#define UDP_MAX_PORT 65000 - -typedef struct pubsub_udp_msg { - struct pubsub_msg_header header; - unsigned int payloadSize; - char payload[]; -} pubsub_udp_msg_t; - -typedef struct topic_publication *topic_publication_pt; -celix_status_t pubsub_topicPublicationCreate(int sendSocket, pubsub_endpoint_pt pubEP, pubsub_serializer_service_t *best_serializer, char* bindIP, topic_publication_pt *out); -celix_status_t pubsub_topicPublicationDestroy(topic_publication_pt pub); - -celix_status_t pubsub_topicPublicationAddPublisherEP(topic_publication_pt pub,pubsub_endpoint_pt ep); -celix_status_t pubsub_topicPublicationRemovePublisherEP(topic_publication_pt pub,pubsub_endpoint_pt ep); - -celix_status_t pubsub_topicPublicationStart(bundle_context_pt bundle_context,topic_publication_pt pub,service_factory_pt* svcFactory); -celix_status_t pubsub_topicPublicationStop(topic_publication_pt pub); - -array_list_pt pubsub_topicPublicationGetPublisherList(topic_publication_pt pub); - -#endif /* TOPIC_PUBLICATION_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/private/include/topic_subscription.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/private/include/topic_subscription.h b/pubsub/pubsub_admin_udp_mc/private/include/topic_subscription.h deleted file mode 100644 index 475416a..0000000 --- a/pubsub/pubsub_admin_udp_mc/private/include/topic_subscription.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * topic_subscription.h - * - * \date Sep 22, 2015 - * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef TOPIC_SUBSCRIPTION_H_ -#define TOPIC_SUBSCRIPTION_H_ - -#include "celix_threads.h" -#include "array_list.h" -#include "celixbool.h" -#include "service_tracker.h" - -#include "pubsub_endpoint.h" -#include "pubsub_common.h" -#include "pubsub_serializer.h" - -typedef struct topic_subscription* topic_subscription_pt; - -celix_status_t pubsub_topicSubscriptionCreate(bundle_context_pt bundle_context, char* ifIp,char* scope, char* topic ,pubsub_serializer_service_t *best_serializer, topic_subscription_pt* out); -celix_status_t pubsub_topicSubscriptionDestroy(topic_subscription_pt ts); -celix_status_t pubsub_topicSubscriptionStart(topic_subscription_pt ts); -celix_status_t pubsub_topicSubscriptionStop(topic_subscription_pt ts); - -celix_status_t pubsub_topicSubscriptionAddConnectPublisherToPendingList(topic_subscription_pt ts, char* pubURL); -celix_status_t pubsub_topicSubscriptionAddDisconnectPublisherToPendingList(topic_subscription_pt ts, char* pubURL); - -celix_status_t pubsub_topicSubscriptionConnectPublisher(topic_subscription_pt ts, char* pubURL); -celix_status_t pubsub_topicSubscriptionDisconnectPublisher(topic_subscription_pt ts, char* pubURL); - -celix_status_t pubsub_topicSubscriptionAddSubscriber(topic_subscription_pt ts, pubsub_endpoint_pt subEP); -celix_status_t pubsub_topicSubscriptionRemoveSubscriber(topic_subscription_pt ts, pubsub_endpoint_pt subEP); - -array_list_pt pubsub_topicSubscriptionGetSubscribersList(topic_subscription_pt sub); -celix_status_t pubsub_topicIncreaseNrSubscribers(topic_subscription_pt subscription); -celix_status_t pubsub_topicDecreaseNrSubscribers(topic_subscription_pt subscription); -unsigned int pubsub_topicGetNrSubscribers(topic_subscription_pt subscription); - -#endif /*TOPIC_SUBSCRIPTION_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/private/src/large_udp.c ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/private/src/large_udp.c b/pubsub/pubsub_admin_udp_mc/private/src/large_udp.c deleted file mode 100644 index 7455925..0000000 --- a/pubsub/pubsub_admin_udp_mc/private/src/large_udp.c +++ /dev/null @@ -1,372 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * large_udp.c - * - * \date Mar 1, 2016 - * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#include "large_udp.h" - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> -#include <array_list.h> -#include <pthread.h> - -#define MAX_UDP_MSG_SIZE 65535 /* 2^16 -1 */ -#define IP_HEADER_SIZE 20 -#define UDP_HEADER_SIZE 8 -//#define MTU_SIZE 1500 -#define MTU_SIZE 8000 -#define MAX_MSG_VECTOR_LEN 64 - -//#define NO_IP_FRAGMENTATION - -struct largeUdp { - unsigned int maxNrLists; - array_list_pt udpPartLists; - pthread_mutex_t dbLock; -}; - -typedef struct udpPartList { - unsigned int msg_ident; - unsigned int msg_size; - unsigned int nrPartsRemaining; - char *data; -} *udpPartList_pt; - - -typedef struct msg_part_header { - unsigned int msg_ident; - unsigned int total_msg_size; - unsigned int part_msg_size; - unsigned int offset; -} msg_part_header_t; - -#ifdef NO_IP_FRAGMENTATION -#define MAX_PART_SIZE (MTU_SIZE - (IP_HEADER_SIZE + UDP_HEADER_SIZE + sizeof(struct msg_part_header) )) -#else -#define MAX_PART_SIZE (MAX_UDP_MSG_SIZE - (IP_HEADER_SIZE + UDP_HEADER_SIZE + sizeof(struct msg_part_header) )) -#endif - -typedef struct msg_part { - msg_part_header_t header; - char data[MAX_PART_SIZE]; -} msg_part_t; - -// -// Create a handle -// -largeUdp_pt largeUdp_create(unsigned int maxNrUdpReceptions) -{ - printf("## Creating large UDP\n"); - largeUdp_pt handle = calloc(sizeof(*handle), 1); - if(handle != NULL) { - handle->maxNrLists = maxNrUdpReceptions; - if(arrayList_create(&handle->udpPartLists) != CELIX_SUCCESS) { - free(handle); - handle = NULL; - } - pthread_mutex_init(&handle->dbLock, 0); - } - - return handle; -} - -// -// Destroys the handle -// -void largeUdp_destroy(largeUdp_pt handle) -{ - printf("### Destroying large UDP\n"); - if(handle != NULL) { - pthread_mutex_lock(&handle->dbLock); - int nrUdpLists = arrayList_size(handle->udpPartLists); - int i; - for(i=0; i < nrUdpLists; i++) { - udpPartList_pt udpPartList = arrayList_remove(handle->udpPartLists, i); - if(udpPartList) { - if(udpPartList->data) { - free(udpPartList->data); - udpPartList->data = NULL; - } - free(udpPartList); - } - } - arrayList_destroy(handle->udpPartLists); - handle->udpPartLists = NULL; - pthread_mutex_unlock(&handle->dbLock); - pthread_mutex_destroy(&handle->dbLock); - free(handle); - } -} - -// -// Write large data to UDP. This function splits the data in chunks and sends these chunks with a header over UDP. -// -int largeUdp_sendmsg(largeUdp_pt handle, int fd, struct iovec *largeMsg_iovec, int len, int flags, struct sockaddr_in *dest_addr, size_t addrlen) -{ - int n; - int result = 0; - msg_part_header_t header; - - int written = 0; - header.msg_ident = (unsigned int)random(); - header.total_msg_size = 0; - for(n = 0; n < len ;n++) { - header.total_msg_size += largeMsg_iovec[n].iov_len; - } - int nr_buffers = (header.total_msg_size / MAX_PART_SIZE) + 1; - - struct iovec msg_iovec[MAX_MSG_VECTOR_LEN]; - struct msghdr msg; - msg.msg_name = dest_addr; - msg.msg_namelen = addrlen; - msg.msg_flags = 0; - msg.msg_iov = msg_iovec; - msg.msg_iovlen = 2; // header and payload; - msg.msg_control = NULL; - msg.msg_controllen = 0; - - msg.msg_iov[0].iov_base = &header; - msg.msg_iov[0].iov_len = sizeof(header); - - for(n = 0; n < nr_buffers; n++) { - - header.part_msg_size = (((header.total_msg_size - n * MAX_PART_SIZE) > MAX_PART_SIZE) ? MAX_PART_SIZE : (header.total_msg_size - n * MAX_PART_SIZE)); - header.offset = n * MAX_PART_SIZE; - int remainingOffset = header.offset; - int recvPart = 0; - // find the start of the part - while(remainingOffset > largeMsg_iovec[recvPart].iov_len) { - remainingOffset -= largeMsg_iovec[recvPart].iov_len; - recvPart++; - } - int remainingData = header.part_msg_size; - int sendPart = 1; - msg.msg_iovlen = 1; - - // fill in the output iovec from the input iovec in such a way that all UDP frames are filled maximal. - while(remainingData > 0) { - int partLen = ( (largeMsg_iovec[recvPart].iov_len - remainingOffset) <= remainingData ? (largeMsg_iovec[recvPart].iov_len -remainingOffset) : remainingData); - msg.msg_iov[sendPart].iov_base = largeMsg_iovec[recvPart].iov_base + remainingOffset; - msg.msg_iov[sendPart].iov_len = partLen; - remainingData -= partLen; - remainingOffset = 0; - sendPart++; - recvPart++; - msg.msg_iovlen++; - } - int tmp, tmptot; - for(tmp = 0, tmptot=0; tmp < msg.msg_iovlen; tmp++) { - tmptot += msg.msg_iov[tmp].iov_len; - } - - int w = sendmsg(fd, &msg, 0); - if(w == -1) { - perror("send()"); - result = -1; - break; - } - written += w; - } - - return (result == 0 ? written : result); -} - -// -// Write large data to UDP. This function splits the data in chunks and sends these chunks with a header over UDP. -// -int largeUdp_sendto(largeUdp_pt handle, int fd, void *buf, size_t count, int flags, struct sockaddr_in *dest_addr, size_t addrlen) -{ - int n; - int nr_buffers = (count / MAX_PART_SIZE) + 1; - int result = 0; - msg_part_header_t header; - - int written = 0; - header.msg_ident = (unsigned int)random(); - header.total_msg_size = count; - char *databuf = buf; - - struct iovec msg_iovec[2]; - struct msghdr msg; - msg.msg_name = dest_addr; - msg.msg_namelen = addrlen; - msg.msg_flags = 0; - msg.msg_iov = msg_iovec; - msg.msg_iovlen = 2; // header and payload; - msg.msg_control = NULL; - msg.msg_controllen = 0; - - msg.msg_iov[0].iov_base = &header; - msg.msg_iov[0].iov_len = sizeof(header); - - for(n = 0; n < nr_buffers; n++) { - - header.part_msg_size = (((header.total_msg_size - n * MAX_PART_SIZE) > MAX_PART_SIZE) ? MAX_PART_SIZE : (header.total_msg_size - n * MAX_PART_SIZE)); - header.offset = n * MAX_PART_SIZE; - msg.msg_iov[1].iov_base = &databuf[header.offset]; - msg.msg_iov[1].iov_len = header.part_msg_size; - int w = sendmsg(fd, &msg, 0); - if(w == -1) { - perror("send()"); - result = -1; - break; - } - written += w; - //usleep(1000); // TODO: If not slept a UDP buffer overflow occurs and parts are missing at the reception side (at least via localhost) - } - - return (result == 0 ? written : result); -} - -// -// Reads data from the filedescriptor which has date (determined by epoll()) and stores it in the internal structure -// If the message is completely reassembled true is returned and the index and size have valid values -// -bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, unsigned int *size) { - msg_part_header_t header; - int result = false; - // Only read the header, we don't know yet where to store the payload - if(recv(fd, &header, sizeof(header), MSG_PEEK) < 0) { - perror("read()"); - return false; - } - - struct iovec msg_vec[2]; - struct msghdr msg; - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_flags = 0; - msg.msg_iov = msg_vec; - msg.msg_iovlen = 2; // header and payload; - msg.msg_control = NULL; - msg.msg_controllen = 0; - - msg.msg_iov[0].iov_base = &header; - msg.msg_iov[0].iov_len = sizeof(header); - - pthread_mutex_lock(&handle->dbLock); - - int nrUdpLists = arrayList_size(handle->udpPartLists); - int i; - bool found = false; - for(i = 0; i < nrUdpLists; i++) { - udpPartList_pt udpPartList = arrayList_get(handle->udpPartLists, i); - if(udpPartList->msg_ident == header.msg_ident) { - found = true; - - //sanity check - if(udpPartList->msg_size != header.total_msg_size) { - // Corruption occurred. Remove the existing administration and build up a new one. - arrayList_remove(handle->udpPartLists, i); - free(udpPartList->data); - free(udpPartList); - found = false; - break; - } - - msg.msg_iov[1].iov_base = &udpPartList->data[header.offset]; - msg.msg_iov[1].iov_len = header.part_msg_size; - if(recvmsg(fd, &msg, 0)<0){ - found=true; - result=false; - break; - } - - udpPartList->nrPartsRemaining--; - if(udpPartList->nrPartsRemaining == 0) { - *index = i; - *size = udpPartList->msg_size; - result = true; - break; - } else { - result = false; // not complete - break; - } - } - } - - if(found == false) { - udpPartList_pt udpPartList = NULL; - if(nrUdpLists == handle->maxNrLists) { - // remove list at index 0 - udpPartList = arrayList_remove(handle->udpPartLists, 0); - fprintf(stderr, "ERROR: Removing entry for id %d: %d parts not received\n",udpPartList->msg_ident, udpPartList->nrPartsRemaining ); - free(udpPartList->data); - free(udpPartList); - nrUdpLists--; - } - udpPartList = calloc(sizeof(*udpPartList), 1); - udpPartList->msg_ident = header.msg_ident; - udpPartList->msg_size = header.total_msg_size; - udpPartList->nrPartsRemaining = header.total_msg_size / MAX_PART_SIZE; - udpPartList->data = calloc(sizeof(char), header.total_msg_size); - - msg.msg_iov[1].iov_base = &udpPartList->data[header.offset]; - msg.msg_iov[1].iov_len = header.part_msg_size; - if(recvmsg(fd, &msg, 0)<0){ - free(udpPartList->data); - free(udpPartList); - result=false; - } - else{ - arrayList_add(handle->udpPartLists, udpPartList); - - if(udpPartList->nrPartsRemaining == 0) { - *index = nrUdpLists; - *size = udpPartList->msg_size; - result = true; - } else { - result = false; - } - } - - } - - pthread_mutex_unlock(&handle->dbLock); - - return result; -} - -// -// Read out the message which is indicated available by the largeUdp_dataAvailable function -// -int largeUdp_read(largeUdp_pt handle, unsigned int index, void ** buffer, unsigned int size) -{ - int result = 0; - pthread_mutex_lock(&handle->dbLock); - - udpPartList_pt udpPartList = arrayList_remove(handle->udpPartLists, index); - if(udpPartList) { - *buffer = udpPartList->data; - free(udpPartList); - } else { - result = -1; - } - pthread_mutex_unlock(&handle->dbLock); - - return result; -} http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/pubsub/pubsub_admin_udp_mc/private/src/psa_activator.c ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/private/src/psa_activator.c b/pubsub/pubsub_admin_udp_mc/private/src/psa_activator.c deleted file mode 100644 index cd4ee07..0000000 --- a/pubsub/pubsub_admin_udp_mc/private/src/psa_activator.c +++ /dev/null @@ -1,141 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * psa_activator.c - * - * \date Sep 30, 2011 - * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#include <stdlib.h> - -#include "bundle_activator.h" -#include "service_registration.h" -#include "service_tracker.h" - -#include "pubsub_admin_impl.h" - -struct activator { - pubsub_admin_pt admin; - pubsub_admin_service_pt adminService; - service_registration_pt registration; - service_tracker_pt serializerTracker; -}; - -celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) { - celix_status_t status = CELIX_SUCCESS; - struct activator *activator; - - activator = calloc(1, sizeof(*activator)); - if (!activator) { - status = CELIX_ENOMEM; - } - else{ - *userData = activator; - - status = pubsubAdmin_create(context, &(activator->admin)); - - if(status == CELIX_SUCCESS){ - service_tracker_customizer_pt customizer = NULL; - status = serviceTrackerCustomizer_create(activator->admin, - NULL, - pubsubAdmin_serializerAdded, - NULL, - pubsubAdmin_serializerRemoved, - &customizer); - if(status == CELIX_SUCCESS){ - status = serviceTracker_create(context, PUBSUB_SERIALIZER_SERVICE, customizer, &(activator->serializerTracker)); - if(status != CELIX_SUCCESS){ - serviceTrackerCustomizer_destroy(customizer); - pubsubAdmin_destroy(activator->admin); - } - } - else{ - pubsubAdmin_destroy(activator->admin); - } - } - } - - return status; -} - -celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) { - celix_status_t status = CELIX_SUCCESS; - struct activator *activator = userData; - pubsub_admin_service_pt pubsubAdminSvc = calloc(1, sizeof(*pubsubAdminSvc)); - - if (!pubsubAdminSvc) { - status = CELIX_ENOMEM; - } - else{ - pubsubAdminSvc->admin = activator->admin; - - pubsubAdminSvc->addPublication = pubsubAdmin_addPublication; - pubsubAdminSvc->removePublication = pubsubAdmin_removePublication; - - pubsubAdminSvc->addSubscription = pubsubAdmin_addSubscription; - pubsubAdminSvc->removeSubscription = pubsubAdmin_removeSubscription; - - pubsubAdminSvc->closeAllPublications = pubsubAdmin_closeAllPublications; - pubsubAdminSvc->closeAllSubscriptions = pubsubAdmin_closeAllSubscriptions; - - pubsubAdminSvc->matchEndpoint = pubsubAdmin_matchEndpoint; - - activator->adminService = pubsubAdminSvc; - - status = bundleContext_registerService(context, PUBSUB_ADMIN_SERVICE, pubsubAdminSvc, NULL, &activator->registration); - - status += serviceTracker_open(activator->serializerTracker); - - } - - - return status; -} - -celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) { - celix_status_t status = CELIX_SUCCESS; - struct activator *activator = userData; - - status += serviceTracker_close(activator->serializerTracker); - status += serviceRegistration_unregister(activator->registration); - - activator->registration = NULL; - - free(activator->adminService); - activator->adminService = NULL; - - return status; -} - -celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) { - celix_status_t status = CELIX_SUCCESS; - struct activator *activator = userData; - - serviceTracker_destroy(activator->serializerTracker); - pubsubAdmin_destroy(activator->admin); - activator->admin = NULL; - - free(activator); - - return status; -} - -
