From commits-return-4587-archive-asf-public=cust-asf.ponee.io@celix.apache.org Tue Jan 30 20:29:55 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 9F97718077D for ; Tue, 30 Jan 2018 20:29:52 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8F7C3160C55; Tue, 30 Jan 2018 19:29:52 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7CFD4160C6D for ; Tue, 30 Jan 2018 20:29:48 +0100 (CET) Received: (qmail 62940 invoked by uid 500); 30 Jan 2018 19:29:47 -0000 Mailing-List: contact commits-help@celix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@celix.apache.org Delivered-To: mailing list commits@celix.apache.org Received: (qmail 61751 invoked by uid 99); 30 Jan 2018 19:29:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jan 2018 19:29:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 87870F353D; Tue, 30 Jan 2018 19:29:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pnoltes@apache.org To: commits@celix.apache.org Date: Tue, 30 Jan 2018 19:30:25 -0000 Message-Id: In-Reply-To: <738f396660a54807b3c4b2699574eae1@git.apache.org> References: <738f396660a54807b3c4b2699574eae1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [41/54] [abbrv] celix git commit: CELIX-417: Refactors cmake usage of pubsub and rsa. Started with installing exported targets CELIX-417: Refactors cmake usage of pubsub and rsa. Started with installing exported targets Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/81804e00 Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/81804e00 Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/81804e00 Branch: refs/heads/develop Commit: 81804e001001de1cd7ffd86d671ef53b8e74a429 Parents: ac0d0d7 Author: Pepijn Noltes Authored: Wed Jan 24 19:30:21 2018 +0100 Committer: Pepijn Noltes Committed: Wed Jan 24 19:30:21 2018 +0100 ---------------------------------------------------------------------- CMakeLists.txt | 4 + framework/CMakeLists.txt | 18 +- log_service/CMakeLists.txt | 15 +- pubsub/CMakeLists.txt | 38 +- pubsub/api/pubsub/publisher.h | 88 -- pubsub/api/pubsub/subscriber.h | 75 -- pubsub/deploy/CMakeLists.txt | 229 ---- pubsub/examples/CMakeLists.txt | 213 ++++ .../examples/mp_pubsub/publisher/CMakeLists.txt | 11 +- .../private/include/mp_publisher_private.h | 2 +- .../publisher/private/src/mp_pub_activator.c | 48 +- .../publisher/private/src/mp_publisher.c | 1 - .../mp_pubsub/subscriber/CMakeLists.txt | 17 +- .../private/include/mp_subscriber_private.h | 3 +- .../subscriber/private/src/mp_sub_activator.c | 40 +- pubsub/examples/pubsub/publisher/CMakeLists.txt | 21 +- .../private/include/pubsub_publisher_private.h | 2 +- .../publisher/private/src/ps_pub_activator.c | 54 +- .../publisher/private/src/pubsub_publisher.c | 1 - .../examples/pubsub/publisher2/CMakeLists.txt | 23 +- .../examples/pubsub/subscriber/CMakeLists.txt | 27 +- .../private/include/pubsub_subscriber_private.h | 3 +- .../subscriber/private/src/ps_sub_activator.c | 38 +- pubsub/mock/CMakeLists.txt | 20 +- pubsub/pubsub_admin_udp_mc/CMakeLists.txt | 15 +- .../pubsub_admin_udp_mc/src/pubsub_admin_impl.c | 2 +- .../pubsub_admin_udp_mc/src/topic_publication.c | 2 +- .../pubsub_admin_udp_mc/src/topic_publication.h | 2 +- .../src/topic_subscription.c | 4 +- pubsub/pubsub_admin_zmq/CMakeLists.txt | 48 +- .../private/include/pubsub_admin_impl.h | 109 -- .../private/include/topic_publication.h | 49 - .../private/include/topic_subscription.h | 60 - .../private/include/zmq_crypto.h | 41 - .../private/src/psa_activator.c | 142 --- .../private/src/pubsub_admin_impl.c | 1040 ------------------ .../private/src/topic_publication.c | 630 ----------- .../private/src/topic_subscription.c | 732 ------------ .../pubsub_admin_zmq/private/src/zmq_crypto.c | 281 ----- pubsub/pubsub_admin_zmq/src/psa_activator.c | 142 +++ pubsub/pubsub_admin_zmq/src/pubsub_admin_impl.c | 1040 ++++++++++++++++++ pubsub/pubsub_admin_zmq/src/pubsub_admin_impl.h | 109 ++ pubsub/pubsub_admin_zmq/src/topic_publication.c | 630 +++++++++++ pubsub/pubsub_admin_zmq/src/topic_publication.h | 49 + .../pubsub_admin_zmq/src/topic_subscription.c | 732 ++++++++++++ .../pubsub_admin_zmq/src/topic_subscription.h | 60 + pubsub/pubsub_admin_zmq/src/zmq_crypto.c | 281 +++++ pubsub/pubsub_admin_zmq/src/zmq_crypto.h | 41 + pubsub/pubsub_api/CMakeLists.txt | 32 + pubsub/pubsub_api/include/pubsub/publisher.h | 88 ++ pubsub/pubsub_api/include/pubsub/subscriber.h | 75 ++ .../include/publisher_endpoint_announce.h | 36 - .../pubsub_common/public/include/pubsub_admin.h | 72 -- .../public/include/pubsub_admin_match.h | 40 - .../public/include/pubsub_common.h | 52 - .../public/include/pubsub_endpoint.h | 58 - .../public/include/pubsub_serializer.h | 66 -- .../public/include/pubsub_topic_info.descriptor | 10 - .../pubsub_common/public/include/pubsub_utils.h | 39 - .../public/src/pubsub_admin_match.c | 320 ------ .../pubsub_common/public/src/pubsub_endpoint.c | 254 ----- pubsub/pubsub_common/public/src/pubsub_utils.c | 170 --- pubsub/pubsub_discovery/CMakeLists.txt | 15 +- pubsub/pubsub_serializer_json/CMakeLists.txt | 13 +- pubsub/pubsub_spi/CMakeLists.txt | 35 + .../include/publisher_endpoint_announce.h | 36 + pubsub/pubsub_spi/include/pubsub_admin.h | 72 ++ pubsub/pubsub_spi/include/pubsub_admin_match.h | 40 + pubsub/pubsub_spi/include/pubsub_common.h | 52 + pubsub/pubsub_spi/include/pubsub_endpoint.h | 58 + pubsub/pubsub_spi/include/pubsub_serializer.h | 66 ++ .../include/pubsub_topic_info.descriptor | 10 + pubsub/pubsub_spi/include/pubsub_utils.h | 39 + pubsub/pubsub_spi/src/pubsub_admin_match.c | 320 ++++++ pubsub/pubsub_spi/src/pubsub_endpoint.c | 254 +++++ pubsub/pubsub_spi/src/pubsub_utils.c | 170 +++ pubsub/pubsub_topology_manager/CMakeLists.txt | 19 +- .../private/include/pubsub_topology_manager.h | 83 -- .../private/src/pstm_activator.c | 246 ----- .../private/src/pubsub_topology_manager.c | 723 ------------ .../src/pstm_activator.c | 244 ++++ .../src/pubsub_topology_manager.c | 721 ++++++++++++ .../src/pubsub_topology_manager.h | 82 ++ pubsub/test/CMakeLists.txt | 10 +- remote_services/CMakeLists.txt | 11 +- remote_services/discovery_common/CMakeLists.txt | 2 +- .../examples/calculator_service/CMakeLists.txt | 2 +- .../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 | 27 - .../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_services_api/CMakeLists.txt | 28 + remote_services/remote_services_api/README.md | 11 + .../include/remote_constants.h | 31 + remote_services/rsa_common/CMakeLists.txt | 29 + .../rsa_common/src/endpoint_description.c | 89 ++ .../rsa_common/src/export_registration_impl.c | 257 +++++ .../rsa_common/src/export_registration_impl.h | 61 + .../rsa_common/src/import_registration_impl.c | 274 +++++ .../rsa_common/src/import_registration_impl.h | 81 ++ .../rsa_common/src/remote_proxy_factory_impl.c | 252 +++++ .../rsa_common/src/remote_service_admin_impl.h | 49 + remote_services/rsa_spi/CMakeLists.txt | 29 + remote_services/rsa_spi/README.md | 11 + .../rsa_spi/include/endpoint_description.h | 50 + .../rsa_spi/include/endpoint_listener.h | 49 + .../rsa_spi/include/export_registration.h | 22 + .../rsa_spi/include/import_registration.h | 22 + .../rsa_spi/include/remote_constants.h | 38 + .../rsa_spi/include/remote_endpoint.h | 44 + .../rsa_spi/include/remote_endpoint_impl.h | 38 + remote_services/rsa_spi/include/remote_proxy.h | 76 ++ .../rsa_spi/include/remote_service_admin.h | 73 ++ remote_services/topology_manager/CMakeLists.txt | 2 +- .../tms_tst/bundle/CMakeLists.txt | 2 +- utils/CMakeLists.txt | 13 +- 131 files changed, 7540 insertions(+), 7516 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index d05ec8a..aa26d8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,5 +95,9 @@ add_subdirectory(pubsub) add_subdirectory(dependency_manager) add_subdirectory(dependency_manager_cxx) + +#export targets +install(EXPORT celix NAMESPACE Celix:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/celix) + #Example as last, because some example will check if underlining options are enabled add_subdirectory(examples) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/framework/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index a92910c..1716a7d 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -36,7 +36,10 @@ set(SOURCES ) add_library(framework SHARED ${SOURCES}) set_target_properties(framework PROPERTIES OUTPUT_NAME "celix_framework") -target_include_directories(framework PUBLIC include) +target_include_directories(framework PUBLIC + $ + $ +) target_include_directories(framework PRIVATE src ${ZLIB_INCLUDE_DIR} @@ -45,7 +48,6 @@ target_include_directories(framework PRIVATE ) target_compile_definitions(framework PRIVATE -DUSE_FILE32API) -include_directories("${PROJECT_SOURCE_DIR}/utils/public/include") set_target_properties(framework PROPERTIES "SOVERSION" 2) if(NOT APPLE) @@ -54,16 +56,16 @@ endif() target_link_libraries(framework PUBLIC Celix::utils) target_link_libraries(framework PRIVATE ${UUID} ${ZLIB_LIBRARY} ${CURL_LIBRARIES}) -install(TARGETS framework DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework) +install(TARGETS framework EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework) +install(DIRECTORY include/ DESTINATION include/celix COMPONENT framework) +install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/" DESTINATION share/celix/cmake/modules COMPONENT framework + PATTERN "CMakeCelix-local.cmake" EXCLUDE +) + #Alias setup to match external usage add_library(Celix::framework ALIAS framework) -install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/" DESTINATION share/celix/cmake/modules - COMPONENT framework - PATTERN "CMakeCelix-local.cmake" EXCLUDE -) - if (ENABLE_TESTING) find_package(CppUTest REQUIRED) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/log_service/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/log_service/CMakeLists.txt b/log_service/CMakeLists.txt index b9af374..70afb0e 100644 --- a/log_service/CMakeLists.txt +++ b/log_service/CMakeLists.txt @@ -19,12 +19,21 @@ celix_subproject(LOG_SERVICE "Option to enable building the Log Service bundles" if (LOG_SERVICE) add_library(log_service_api INTERFACE) - target_include_directories(log_service_api INTERFACE include) + target_include_directories(log_service_api INTERFACE + $ + $ + ) + install(TARGETS log_service_api EXPORT celix) + install(DIRECTORY include/ DESTINATION include/celix/log_service) add_library(log_helper STATIC src/log_helper.c) - target_include_directories(log_helper PUBLIC loghelper_include) + target_include_directories(log_helper PUBLIC + $ + $ + ) target_link_libraries(log_helper PUBLIC Celix::framework log_service_api) - #TODO install log helper + install(TARGETS log_helper EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT log_service) + install(DIRECTORY loghelper_include/ DESTINATION include/celix/log_helper COMPONENT log_service) add_bundle(log_service SYMBOLIC_NAME "apache_celix_log_service" http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/CMakeLists.txt b/pubsub/CMakeLists.txt index 9d18175..79f8168 100644 --- a/pubsub/CMakeLists.txt +++ b/pubsub/CMakeLists.txt @@ -23,52 +23,24 @@ if (PUBSUB) message(WARNING "Celix will now contain a dependency with a LGPL License (ZeroMQ). For more information about this, consult the pubsub/README.md file.") option(BUILD_ZMQ_SECURITY "Build with security for ZeroMQ." OFF) endif (BUILD_PUBSUB_PSA_ZMQ) - + + add_subdirectory(pubsub_api) + add_subdirectory(pubsub_spi) add_subdirectory(pubsub_topology_manager) add_subdirectory(pubsub_discovery) add_subdirectory(pubsub_serializer_json) add_subdirectory(pubsub_admin_zmq) add_subdirectory(pubsub_admin_udp_mc) - add_subdirectory(examples) - add_subdirectory(deploy) add_subdirectory(keygen) add_subdirectory(mock) + add_subdirectory(examples) if (ENABLE_TESTING) - option(BUILD_PUBSUB_TESTS "Enable Tests for PUBSUB" OFF) + option(BUILD_PUBSUB_TESTS "Enable Tests for PUBSUB" OFF) endif() if (ENABLE_TESTING AND BUILD_PUBSUB_TESTS) add_subdirectory(test) endif() - #api target - add_library(pubsub_api INTERFACE) - target_include_directories(pubsub_api INTERFACE api) - - #install api - install(FILES api/pubsub/publisher.h api/pubsub/subscriber.h DESTINATION include/celix/pubsub COMPONENT framework) - - #install public common files - install(FILES - pubsub_common/public/include/pubsub_serializer.h - pubsub_common/public/include/pubsub_utils.h - pubsub_common/public/include/pubsub_common.h - pubsub_common/public/include/pubsub_endpoint.h - pubsub_common/public/include/pubsub_admin_match.h - pubsub_common/public/include/publisher_endpoint_announce.h - pubsub_common/public/include/pubsub_admin.h - DESTINATION include/celix/pubsub - COMPONENT framework - ) - install(FILES - pubsub_common/public/src/pubsub_admin_match.c - pubsub_common/public/src/pubsub_utils.c - pubsub_common/public/src/pubsub_endpoint.c - DESTINATION share/celix/pubsub - COMPONENT framework - ) - - #Setup target aliases to match external usage - add_library(Celix::pubsub_api ALIAS pubsub_api) endif(PUBSUB) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/api/pubsub/publisher.h ---------------------------------------------------------------------- diff --git a/pubsub/api/pubsub/publisher.h b/pubsub/api/pubsub/publisher.h deleted file mode 100644 index 3eec149..0000000 --- a/pubsub/api/pubsub/publisher.h +++ /dev/null @@ -1,88 +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. - */ -/* - * publisher.h - * - * \date Jan 7, 2016 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef __PUBSUB_PUBLISHER_H_ -#define __PUBSUB_PUBLISHER_H_ - -#include - -#define PUBSUB_PUBLISHER_SERVICE_NAME "pubsub.publisher" -#define PUBSUB_PUBLISHER_SERVICE_VERSION "2.0.0" - -//properties -#define PUBSUB_PUBLISHER_TOPIC "pubsub.topic" -#define PUBSUB_PUBLISHER_SCOPE "pubsub.scope" -#define PUBSUB_PUBLISHER_STRATEGY "pubsub.strategy" -#define PUBSUB_PUBLISHER_CONFIG "pubsub.config" - -#define PUBSUB_PUBLISHER_SCOPE_DEFAULT "default" -//flags -#define PUBSUB_PUBLISHER_FIRST_MSG 01 -#define PUBSUB_PUBLISHER_PART_MSG 02 -#define PUBSUB_PUBLISHER_LAST_MSG 04 - -struct pubsub_release_callback_struct { - void *handle; - void (*release)(char *buf, void *handle); -}; -typedef struct pubsub_release_callback_struct pubsub_release_callback_t; -typedef struct pubsub_release_callback_struct* pubsub_release_callback_pt; - - -struct pubsub_publisher { - void *handle; - - /** - * Every msg is identifiable by msg type string. Because masg type string are performance wise not preferable (string compares), - * a "local" (int / platform dependent) unique id will be generated runtime - * with use of a distributed key/value store or communication between participation parties. - * this is called the local message type id. This local message type id can be requested with the localMsgIdForMsgType method. - * When return is successful the msgTypeId is always greater than 0. (Note this can be used to specify/detect uninitialized msg type ids in the consumer code). - * - * Returns 0 on success. - */ - int (*localMsgTypeIdForMsgType)(void *handle, const char *msgType, unsigned int *msgTypeId); - - /** - * send is a async function, but the msg can be safely deleted after send returns. - * Returns 0 on success. - */ - int (*send)(void *handle, unsigned int msgTypeId, const void *msg); - - - /** - * sendMultipart is a async function, but the msg can be safely deleted after send returns. - * The first (primary) message of a multipart message must have the flag PUBLISHER_PRIMARY_MSG - * The last message of a multipart message must have the flag PUBLISHER_LAST_MSG - * Returns 0 on success. - */ - int (*sendMultipart)(void *handle, unsigned int msgTypeId, const void *msg, int flags); - -}; -typedef struct pubsub_publisher pubsub_publisher_t; -typedef struct pubsub_publisher* pubsub_publisher_pt; - -#endif // __PUBSUB_PUBLISHER_H_ http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/api/pubsub/subscriber.h ---------------------------------------------------------------------- diff --git a/pubsub/api/pubsub/subscriber.h b/pubsub/api/pubsub/subscriber.h deleted file mode 100644 index 5d87b8a..0000000 --- a/pubsub/api/pubsub/subscriber.h +++ /dev/null @@ -1,75 +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. - */ -/* - * subscriber.h - * - * \date Jan 7, 2016 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef __PUBSUB_SUBSCRIBER_H_ -#define __PUBSUB_SUBSCRIBER_H_ - -#include - -#define PUBSUB_SUBSCRIBER_SERVICE_NAME "pubsub.subscriber" -#define PUBSUB_SUBSCRIBER_SERVICE_VERSION "2.0.0" - -//properties -#define PUBSUB_SUBSCRIBER_TOPIC "pubsub.topic" -#define PUBSUB_SUBSCRIBER_SCOPE "pubsub.scope" -#define PUBSUB_SUBSCRIBER_STRATEGY "pubsub.strategy" -#define PUBSUB_SUBSCRIBER_CONFIG "pubsub.config" - -#define PUBSUB_SUBSCRIBER_SCOPE_DEFAULT "default" - -struct pubsub_multipart_callbacks_struct { - void *handle; - int (*localMsgTypeIdForMsgType)(void *handle, const char *msgType, unsigned int *msgId); - int (*getMultipart)(void *handle, unsigned int msgTypeId, bool retain, void **part); -}; -typedef struct pubsub_multipart_callbacks_struct pubsub_multipart_callbacks_t; -typedef struct pubsub_multipart_callbacks_struct* pubsub_multipart_callbacks_pt; - -struct pubsub_subscriber_struct { - void *handle; - - /** - * When a new message for a topic is available the receive will be called. - * - * msgType contains fully qualified name of the type and msgTypeId is a local id which presents the type for performance reasons. - * Release can be used to instruct the pubsubadmin to release (free) the message when receive function returns. Set it to false to take - * over ownership of the msg (e.g. take the responsibility to free it). - * - * The callbacks argument is only valid inside the receive function, use the getMultipart callback, with retain=true, to keep multipart messages in memory. - * results of the localMsgTypeIdForMsgType callback are valid during the complete lifecycle of the component, not just a single receive call. - * - * Return 0 implies a successful handling. If return is not 0, the msg will always be released by the pubsubadmin. - * - * this method can be NULL. - */ - int (*receive)(void *handle, const char *msgType, unsigned int msgTypeId, void *msg, pubsub_multipart_callbacks_t *callbacks, bool *release); - -}; -typedef struct pubsub_subscriber_struct pubsub_subscriber_t; -typedef struct pubsub_subscriber_struct* pubsub_subscriber_pt; - - -#endif // __PUBSUB_SUBSCRIBER_H_ http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/deploy/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/deploy/CMakeLists.txt b/pubsub/deploy/CMakeLists.txt deleted file mode 100644 index e76f91b..0000000 --- a/pubsub/deploy/CMakeLists.txt +++ /dev/null @@ -1,229 +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. - -find_program(ETCD_CMD NAMES etcd) -find_program(XTERM_CMD NAMES xterm) - -# UDP Multicast -add_deploy(pubsub_publisher_udp_mc - GROUP pubsub - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_publisher.PoiPublisher - org.apache.celix.pubsub_publisher.PoiPublisher2 -) - -add_deploy("pubsub_subscriber_udp_mc" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_subscriber.PoiSubscriber -) - -add_deploy("pubsub_subscriber2_udp_mc" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_subscriber.PoiSubscriber -) - -if (ETCD_CMD AND XTERM_CMD) - #Runtime starting a publish and subscriber for udp mc - add_runtime(pubsub_rt_upd_mc - NAME udp_mc - GROUP pubsub - DEPLOYMENTS - pubsub_publisher_udp_mc - pubsub_subscriber_udp_mc - pubsub_subscriber2_udp_mc - COMMANDS - etcd - USE_TERM - ) -endif () - -if (BUILD_PUBSUB_PSA_ZMQ) - - # Dynamic ZMQ / UDP admin - add_deploy("pubsub_publisher" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_publisher.PoiPublisher - org.apache.celix.pubsub_publisher.PoiPublisher2 - PROPERTIES - poi1.psa=zmq - poi2.psa=udp - ) - - add_deploy("pubsub_subscriber" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_subscriber.PoiSubscriber - PROPERTIES - poi1.psa=zmq - poi2.psa=udp - ) - - # ZMQ - add_deploy("pubsub_zmq" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_publisher.PoiPublisher - org.apache.celix.pubsub_subscriber.PoiSubscriber - ) - - add_deploy("pubsub_publisher_zmq" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_publisher.PoiPublisher - org.apache.celix.pubsub_publisher.PoiPublisher2 - PROPERTIES - pubsub.scope=my_small_scope - ) - - add_deploy("pubsub_subscriber_zmq" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_subscriber.PoiSubscriber - ) - - add_deploy("pubsub_subscriber2_zmq" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_subscriber.PoiSubscriber - - ) - - # ZMQ Multipart - add_deploy("pubsub_mp_subscriber_zmq" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_subscriber.MpSubscriber - ) - - add_deploy("pubsub_mp_publisher_zmq" - GROUP "pubsub" - BUNDLES - Celix::shell - Celix::shell_tui - org.apache.celix.pubsub_serializer.PubSubSerializerJson - org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminZmq - org.apache.celix.pubsub_publisher.MpPublisher - ) - - if (ETCD_CMD AND XTERM_CMD) - #Runtime starting two bundles using both zmq and upd mc pubsub - add_runtime(pubsub_rt_zmq_udpmc_combi - NAME combi - GROUP pubsub - DEPLOYMENTS - pubsub_publisher_zmq - pubsub_subscriber_zmq - pubsub_subscriber_zmq - COMMANDS - etcd - USE_TERM - ) - - #Runtime starting a publish and 2 subscribers for zmq - add_runtime(pubsub_rt_zmq - NAME zmq - GROUP pubsub - DEPLOYMENTS - pubsub_publisher - pubsub_subscriber_zmq - pubsub_subscriber2_zmq - COMMANDS - etcd - USE_TERM - ) - - #Runtime starting a multipart (multiple message in one send) publish and subscriber for zmq - add_runtime(pubsub_rt_multipart_zmq - NAME zmq_multipart - GROUP pubsub - DEPLOYMENTS - pubsub_mp_subscriber_zmq - pubsub_mp_publisher_zmq - COMMANDS - etcd - USE_TERM - ) - endif () - -endif() http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/CMakeLists.txt b/pubsub/examples/CMakeLists.txt index 22ca5ca..b79b101 100644 --- a/pubsub/examples/CMakeLists.txt +++ b/pubsub/examples/CMakeLists.txt @@ -17,3 +17,216 @@ add_subdirectory(pubsub) add_subdirectory(mp_pubsub) + +find_program(ETCD_CMD NAMES etcd) +find_program(XTERM_CMD NAMES xterm) + +# UDP Multicast +add_deploy(pubsub_publisher_udp_mc + GROUP pubsub + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_udp_multicast + celix_pubsub_poi_publisher + celix_pubsub_poi_publisher2 + ) + +add_deploy("pubsub_subscriber_udp_mc" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_udp_multicast + celix_pubsub_poi_subscriber + ) + +add_deploy("pubsub_subscriber2_udp_mc" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_udp_multicast + celix_pubsub_poi_subscriber + ) + +if (ETCD_CMD AND XTERM_CMD) + #Runtime starting a publish and subscriber for udp mc + add_runtime(pubsub_rt_upd_mc + NAME udp_mc + GROUP pubsub + DEPLOYMENTS + pubsub_publisher_udp_mc + pubsub_subscriber_udp_mc + pubsub_subscriber2_udp_mc + COMMANDS + etcd + USE_TERM + ) +endif () + +if (BUILD_PUBSUB_PSA_ZMQ) + + # Dynamic ZMQ / UDP admin + add_deploy("pubsub_publisher" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_zmq + Celix::pubsub_admin_udp_multicast + celix_pubsub_poi_publisher + celix_pubsub_poi_publisher2 + PROPERTIES + poi1.psa=zmq + poi2.psa=udp + ) + + add_deploy("pubsub_subscriber" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_zmq + Celix::pubsub_admin_udp_multicast + celix_pubsub_poi_subscriber + PROPERTIES + poi1.psa=zmq + poi2.psa=udp + ) + + # ZMQ + add_deploy("pubsub_zmq" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + org.apache.celix.pubsub_admin.PubSubAdminZmq + celix_pubsub_poi_publisher + celix_pubsub_poi_subscriber + ) + + add_deploy("pubsub_publisher_zmq" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_zmq + celix_pubsub_poi_publisher + celix_pubsub_poi_publisher2 + PROPERTIES + pubsub.scope=my_small_scope + ) + + add_deploy("pubsub_subscriber_zmq" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + org.apache.celix.pubsub_admin.PubSubAdminZmq + celix_pubsub_poi_subscriber + ) + + add_deploy("pubsub_subscriber2_zmq" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_zmq + celix_pubsub_poi_subscriber + + ) + + # ZMQ Multipart + add_deploy("pubsub_mp_subscriber_zmq" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_zmq + org.apache.celix.pubsub_subscriber.MpSubscriber + ) + + add_deploy("pubsub_mp_publisher_zmq" + GROUP "pubsub" + BUNDLES + Celix::shell + Celix::shell_tui + Celix::pubsub_serializer_json + Celix::pubsub_discovery_etcd + Celix::pubsub_topology_manager + Celix::pubsub_admin_zmq + org.apache.celix.pubsub_publisher.MpPublisher + ) + + if (ETCD_CMD AND XTERM_CMD) + #Runtime starting two bundles using both zmq and upd mc pubsub + add_runtime(pubsub_rt_zmq_udpmc_combi + NAME combi + GROUP pubsub + DEPLOYMENTS + pubsub_publisher_zmq + pubsub_subscriber_zmq + pubsub_subscriber_zmq + COMMANDS + etcd + USE_TERM + ) + + #Runtime starting a publish and 2 subscribers for zmq + add_runtime(pubsub_rt_zmq + NAME zmq + GROUP pubsub + DEPLOYMENTS + pubsub_publisher + pubsub_subscriber_zmq + pubsub_subscriber2_zmq + COMMANDS + etcd + USE_TERM + ) + + #Runtime starting a multipart (multiple message in one send) publish and subscriber for zmq + add_runtime(pubsub_rt_multipart_zmq + NAME zmq_multipart + GROUP pubsub + DEPLOYMENTS + pubsub_mp_subscriber_zmq + pubsub_mp_publisher_zmq + COMMANDS + etcd + USE_TERM + ) + endif () + +endif() http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/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 1ef8645..e837d7f 100644 --- a/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt +++ b/pubsub/examples/mp_pubsub/publisher/CMakeLists.txt @@ -15,20 +15,15 @@ # specific language governing permissions and limitations # under the License. -include_directories("private/include") -include_directories("${PROJECT_SOURCE_DIR}/framework/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/examples/mp_pubsub/common/include") - add_bundle(org.apache.celix.pubsub_publisher.MpPublisher SYMBOLIC_NAME "apache_celix_pubsub_mp_publisher" VERSION "1.0.0" SOURCES private/src/mp_pub_activator.c private/src/mp_publisher.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c ) +target_link_libraries(org.apache.celix.pubsub_publisher.MpPublisher PRIVATE Celix::framework Celix::pubsub_api) +target_include_directories(org.apache.celix.pubsub_publisher.MpPublisher PRIVATE private/include) bundle_files(org.apache.celix.pubsub_publisher.MpPublisher ${PROJECT_SOURCE_DIR}/pubsub/examples/mp_pubsub/msg_descriptors/msg_ew.descriptor @@ -46,5 +41,3 @@ bundle_files(org.apache.celix.pubsub_publisher.MpPublisher ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/subscriber/public DESTINATION "META-INF/keys/subscriber" ) - -target_link_libraries(org.apache.celix.pubsub_publisher.MpPublisher PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/mp_pubsub/publisher/private/include/mp_publisher_private.h ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/publisher/private/include/mp_publisher_private.h b/pubsub/examples/mp_pubsub/publisher/private/include/mp_publisher_private.h index a9c070f..9c227fd 100644 --- a/pubsub/examples/mp_pubsub/publisher/private/include/mp_publisher_private.h +++ b/pubsub/examples/mp_pubsub/publisher/private/include/mp_publisher_private.h @@ -29,7 +29,7 @@ #include -#include "publisher.h" +#include "pubsub/publisher.h" struct pubsub_sender { array_list_pt trackers; http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/mp_pubsub/publisher/private/src/mp_pub_activator.c ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/publisher/private/src/mp_pub_activator.c b/pubsub/examples/mp_pubsub/publisher/private/src/mp_pub_activator.c index 5c8b145..464d1ab 100644 --- a/pubsub/examples/mp_pubsub/publisher/private/src/mp_pub_activator.c +++ b/pubsub/examples/mp_pubsub/publisher/private/src/mp_pub_activator.c @@ -32,11 +32,13 @@ #include "service_tracker.h" #include "constants.h" -#include "pubsub_common.h" -#include "pubsub_utils.h" #include "mp_publisher_private.h" -#define PUB_TOPIC "multipart" +static const char * PUB_TOPICS[] = { + "multipart", + NULL +}; + struct publisherActivator { pubsub_sender_pt client; @@ -78,40 +80,28 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) int i; - array_list_pt topic_list = pubsub_getTopicsFromString(PUB_TOPIC); - - if(topic_list !=NULL){ - + if(PUB_TOPICS != NULL) { char filter[128]; + for(i=0; PUB_TOPICS[i] != NULL; i++){ + const char* topic = PUB_TOPICS[i]; - for(i=0; iclient,NULL,publisher_publishSvcAdded,NULL,publisher_publishSvcRemoved,&customizer); - serviceTracker_createWithFilter(context, filter, customizer, &tracker); + serviceTrackerCustomizer_create(act->client,NULL,publisher_publishSvcAdded,NULL,publisher_publishSvcRemoved,&customizer); + serviceTracker_createWithFilter(context, filter, customizer, &tracker); - arrayList_add(act->trackerList,tracker); - } - else{ - printf("Topic %s too long. Skipping publication.\n",topic); - } - free(topic); + arrayList_add(act->trackerList,tracker); } - arrayList_destroy(topic_list); - } publisher_start(act->client); http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/mp_pubsub/publisher/private/src/mp_publisher.c ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/publisher/private/src/mp_publisher.c b/pubsub/examples/mp_pubsub/publisher/private/src/mp_publisher.c index fa53487..f47be29 100644 --- a/pubsub/examples/mp_pubsub/publisher/private/src/mp_publisher.c +++ b/pubsub/examples/mp_pubsub/publisher/private/src/mp_publisher.c @@ -32,7 +32,6 @@ #include "service_tracker.h" #include "celix_threads.h" -#include "pubsub_common.h" #include "ew.h" #include "ide.h" #include "kinematics.h" http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/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 e281ab1..858efb5 100644 --- a/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt +++ b/pubsub/examples/mp_pubsub/subscriber/CMakeLists.txt @@ -15,20 +15,15 @@ # specific language governing permissions and limitations # under the License. -include_directories("private/include") -include_directories("${PROJECT_SOURCE_DIR}/framework/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/examples/mp_pubsub/common/include") - -add_bundle( org.apache.celix.pubsub_subscriber.MpSubscriber +add_bundle(org.apache.celix.pubsub_subscriber.MpSubscriber SYMBOLIC_NAME "apache_celix_pubsub_mp_subscriber" VERSION "1.0.0" SOURCES private/src/mp_sub_activator.c private/src/mp_subscriber.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c ) +target_link_libraries(org.apache.celix.pubsub_subscriber.MpSubscriber PRIVATE Celix::framework Celix::pubsub_api) +target_include_directories(org.apache.celix.pubsub_subscriber.MpSubscriber PRIVATE private/include) bundle_files( org.apache.celix.pubsub_subscriber.MpSubscriber ${PROJECT_SOURCE_DIR}/pubsub/examples/mp_pubsub/msg_descriptors/msg_ew.descriptor @@ -43,8 +38,6 @@ bundle_files(org.apache.celix.pubsub_subscriber.MpSubscriber ) bundle_files(org.apache.celix.pubsub_subscriber.MpSubscriber - ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/publisher/public + ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/publisher/public DESTINATION "META-INF/keys/publisher" -) - -target_link_libraries(org.apache.celix.pubsub_subscriber.MpSubscriber PRIVATE Celix::framework) +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/mp_pubsub/subscriber/private/include/mp_subscriber_private.h ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/subscriber/private/include/mp_subscriber_private.h b/pubsub/examples/mp_pubsub/subscriber/private/include/mp_subscriber_private.h index 1cc7270..2d582b3 100644 --- a/pubsub/examples/mp_pubsub/subscriber/private/include/mp_subscriber_private.h +++ b/pubsub/examples/mp_pubsub/subscriber/private/include/mp_subscriber_private.h @@ -32,8 +32,7 @@ #include "celixbool.h" -#include "pubsub_common.h" -#include "subscriber.h" +#include "pubsub/subscriber.h" struct pubsub_receiver { char * name; http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/mp_pubsub/subscriber/private/src/mp_sub_activator.c ---------------------------------------------------------------------- diff --git a/pubsub/examples/mp_pubsub/subscriber/private/src/mp_sub_activator.c b/pubsub/examples/mp_pubsub/subscriber/private/src/mp_sub_activator.c index ecd4245..df9cb0f 100644 --- a/pubsub/examples/mp_pubsub/subscriber/private/src/mp_sub_activator.c +++ b/pubsub/examples/mp_pubsub/subscriber/private/src/mp_sub_activator.c @@ -26,17 +26,20 @@ #include +#include "pubsub/subscriber.h" #include "bundle_activator.h" -#include "pubsub_common.h" -#include "pubsub_utils.h" #include "mp_subscriber_private.h" -#define SUB_TOPIC "multipart" +#define SUB_NAME "multipart" +static const char * SUB_TOPICS[] = { + "multipart", + NULL +}; struct subscriberActivator { array_list_pt registrationList; //List - pubsub_subscriber_pt subsvc; + pubsub_subscriber_t* subsvc; }; celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) { @@ -51,33 +54,24 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) pubsub_subscriber_pt subsvc = calloc(1,sizeof(*subsvc)); - pubsub_receiver_pt sub = subscriber_create(SUB_TOPIC); + pubsub_receiver_pt sub = subscriber_create(SUB_NAME); subsvc->handle = sub; subsvc->receive = pubsub_subscriber_recv; act->subsvc = subsvc; - array_list_pt topic_list = pubsub_getTopicsFromString(SUB_TOPIC); - - if(topic_list !=NULL){ + if (SUB_TOPICS !=NULL) { int i; - for(i=0; iregistrationList,reg); - } - else{ - printf("Topic %s too long. Skipping subscription.\n",topic); - } - free(topic); + for(i=0; SUB_TOPICS[i] != NULL; i++){ + const char* topic = SUB_TOPICS[i]; + + properties_pt props = properties_create(); + properties_set(props, PUBSUB_SUBSCRIBER_TOPIC,topic); + service_registration_pt reg = NULL; + bundleContext_registerService(context, PUBSUB_SUBSCRIBER_SERVICE_NAME, subsvc, props, ®); + arrayList_add(act->registrationList,reg); } - arrayList_destroy(topic_list); - } subscriber_start((pubsub_receiver_pt)act->subsvc->handle); http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/publisher/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher/CMakeLists.txt b/pubsub/examples/pubsub/publisher/CMakeLists.txt index fcf50c7..43eabd8 100644 --- a/pubsub/examples/pubsub/publisher/CMakeLists.txt +++ b/pubsub/examples/pubsub/publisher/CMakeLists.txt @@ -15,40 +15,35 @@ # specific language governing permissions and limitations # under the License. -include_directories("private/include") -include_directories("${PROJECT_SOURCE_DIR}/framework/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") - -add_bundle(org.apache.celix.pubsub_publisher.PoiPublisher +add_bundle(celix_pubsub_poi_publisher SYMBOLIC_NAME "apache_celix_pubsub_poi_publisher" VERSION "1.0.0" SOURCES private/src/ps_pub_activator.c private/src/pubsub_publisher.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher +target_link_libraries(celix_pubsub_poi_publisher PRIVATE Celix::framework Celix::pubsub_api) +target_include_directories(celix_pubsub_poi_publisher PRIVATE private/include) + +bundle_files(celix_pubsub_poi_publisher ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/msg_poi1.descriptor ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/msg_poi2.descriptor DESTINATION "META-INF/descriptors" ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher +bundle_files(celix_pubsub_poi_publisher ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/poi1.properties ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/poi2.properties DESTINATION "META-INF/topics/pub" ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher +bundle_files(celix_pubsub_poi_publisher ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/publisher DESTINATION "META-INF/keys" ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher +bundle_files(celix_pubsub_poi_publisher ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/subscriber/public DESTINATION "META-INF/keys/subscriber" ) - -target_link_libraries(org.apache.celix.pubsub_publisher.PoiPublisher PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/publisher/private/include/pubsub_publisher_private.h ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher/private/include/pubsub_publisher_private.h b/pubsub/examples/pubsub/publisher/private/include/pubsub_publisher_private.h index 834dada..56ec678 100644 --- a/pubsub/examples/pubsub/publisher/private/include/pubsub_publisher_private.h +++ b/pubsub/examples/pubsub/publisher/private/include/pubsub_publisher_private.h @@ -29,7 +29,7 @@ #include #include -#include "publisher.h" +#include "pubsub/publisher.h" struct pubsub_sender { array_list_pt trackers; http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c b/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c index e6c7a3b..a1f2dc8 100644 --- a/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c +++ b/pubsub/examples/pubsub/publisher/private/src/ps_pub_activator.c @@ -32,12 +32,15 @@ #include "service_tracker.h" #include "constants.h" -#include "pubsub_common.h" -#include "pubsub_utils.h" -#include "publisher.h" +#include "pubsub/publisher.h" #include "pubsub_publisher_private.h" -#define PUB_TOPIC "poi1;poi2" +static const char * PUB_TOPICS[] = { + "poi1", + "poi2", + NULL +}; + struct publisherActivator { pubsub_sender_pt client; @@ -73,22 +76,19 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) struct publisherActivator * act = (struct publisherActivator *) userData; int i; - array_list_pt topic_list = pubsub_getTopicsFromString(PUB_TOPIC); - - if(topic_list !=NULL){ + if(PUB_TOPICS !=NULL){ char filter[128]; - for(i=0; iclient,NULL,publisher_publishSvcAdded,NULL,publisher_publishSvcRemoved,&customizer); - serviceTracker_createWithFilter(context, filter, customizer, &tracker); - - arrayList_add(act->trackerList,tracker); - } - else{ - printf("Topic %s too long. Skipping publication.\n",topic); - } - free(topic); - } - arrayList_destroy(topic_list); + service_tracker_customizer_pt customizer = NULL; + serviceTrackerCustomizer_create(act->client,NULL,publisher_publishSvcAdded,NULL,publisher_publishSvcRemoved,&customizer); + serviceTracker_createWithFilter(context, filter, customizer, &tracker); + + arrayList_add(act->trackerList,tracker); + } } publisher_start(act->client); http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/publisher/private/src/pubsub_publisher.c ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher/private/src/pubsub_publisher.c b/pubsub/examples/pubsub/publisher/private/src/pubsub_publisher.c index 7e7602e..9a7aedc 100644 --- a/pubsub/examples/pubsub/publisher/private/src/pubsub_publisher.c +++ b/pubsub/examples/pubsub/publisher/private/src/pubsub_publisher.c @@ -32,7 +32,6 @@ #include "service_tracker.h" #include "celix_threads.h" -#include "pubsub_common.h" #include "poi.h" #include "pubsub_publisher_private.h" http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/publisher2/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/publisher2/CMakeLists.txt b/pubsub/examples/pubsub/publisher2/CMakeLists.txt index 82ffb75..ba007c2 100644 --- a/pubsub/examples/pubsub/publisher2/CMakeLists.txt +++ b/pubsub/examples/pubsub/publisher2/CMakeLists.txt @@ -15,40 +15,37 @@ # specific language governing permissions and limitations # under the License. -include_directories("../publisher/private/include") -include_directories("${PROJECT_SOURCE_DIR}/framework/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") - -add_bundle(org.apache.celix.pubsub_publisher.PoiPublisher2 +add_bundle(celix_pubsub_poi_publisher2 SYMBOLIC_NAME "apache_celix_pubsub_poi_publisher2" VERSION "1.0.0" SOURCES ../publisher/private/src/ps_pub_activator.c ../publisher/private/src/pubsub_publisher.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c ) +target_link_libraries(celix_pubsub_poi_publisher2 PRIVATE Celix::framework Celix::pubsub_api) +target_include_directories(celix_pubsub_poi_publisher2 PRIVATE ../publisher/private/include) + -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher2 +bundle_files(celix_pubsub_poi_publisher2 ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/msg_poi1.descriptor ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/msg_poi2.descriptor DESTINATION "META-INF/descriptors" ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher2 +bundle_files(celix_pubsub_poi_publisher2 ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/poi1.properties ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/poi2.properties DESTINATION "META-INF/topics/pub" ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher2 +bundle_files(celix_pubsub_poi_publisher2 ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/publisher DESTINATION "META-INF/keys" ) -bundle_files(org.apache.celix.pubsub_publisher.PoiPublisher2 - ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/subscriber/public +bundle_files(celix_pubsub_poi_publisher2 + ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/subscriber/public DESTINATION "META-INF/keys/subscriber" ) -target_link_libraries(org.apache.celix.pubsub_publisher.PoiPublisher2 PRIVATE Celix::framework) +target_link_libraries(celix_pubsub_poi_publisher2 PRIVATE Celix::framework) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/subscriber/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/subscriber/CMakeLists.txt b/pubsub/examples/pubsub/subscriber/CMakeLists.txt index 28569b0..1ffd39a 100644 --- a/pubsub/examples/pubsub/subscriber/CMakeLists.txt +++ b/pubsub/examples/pubsub/subscriber/CMakeLists.txt @@ -15,41 +15,36 @@ # specific language governing permissions and limitations # under the License. -include_directories("private/include") -include_directories("${PROJECT_SOURCE_DIR}/framework/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/common/include") - -add_bundle(org.apache.celix.pubsub_subscriber.PoiSubscriber +add_bundle(celix_pubsub_poi_subscriber SYMBOLIC_NAME "apache_celix_pubsub_poi_subscriber" VERSION "1.0.0" SOURCES private/src/ps_sub_activator.c - private/src/pubsub_subscriber.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c + private/src/pubsub_subscriber.c ) -bundle_files(org.apache.celix.pubsub_subscriber.PoiSubscriber +target_link_libraries(celix_pubsub_poi_subscriber PRIVATE Celix::framework Celix::pubsub_api) +target_include_directories(celix_pubsub_poi_subscriber PRIVATE private/include) + + +bundle_files(celix_pubsub_poi_subscriber ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/msg_poi1.descriptor ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/msg_poi2.descriptor DESTINATION "META-INF/descriptors" ) -bundle_files(org.apache.celix.pubsub_subscriber.PoiSubscriber +bundle_files(celix_pubsub_poi_subscriber ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/poi1.properties ${PROJECT_SOURCE_DIR}/pubsub/examples/pubsub/msg_descriptors/poi2.properties DESTINATION "META-INF/topics/sub" ) -bundle_files(org.apache.celix.pubsub_subscriber.PoiSubscriber +bundle_files(celix_pubsub_poi_subscriber ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/subscriber DESTINATION "META-INF/keys" ) -bundle_files(org.apache.celix.pubsub_subscriber.PoiSubscriber +bundle_files(celix_pubsub_poi_subscriber ${PROJECT_SOURCE_DIR}/pubsub/examples/keys/publisher/public DESTINATION "META-INF/keys/publisher" -) - -target_link_libraries(org.apache.celix.pubsub_subscriber.PoiSubscriber PRIVATE Celix::framework) +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/subscriber/private/include/pubsub_subscriber_private.h ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/subscriber/private/include/pubsub_subscriber_private.h b/pubsub/examples/pubsub/subscriber/private/include/pubsub_subscriber_private.h index c6072df..00ca9b4 100644 --- a/pubsub/examples/pubsub/subscriber/private/include/pubsub_subscriber_private.h +++ b/pubsub/examples/pubsub/subscriber/private/include/pubsub_subscriber_private.h @@ -32,8 +32,7 @@ #include "celixbool.h" -#include "pubsub_common.h" -#include "subscriber.h" +#include "pubsub/subscriber.h" struct pubsub_receiver { char * name; http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c ---------------------------------------------------------------------- diff --git a/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c b/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c index efd34c9..4738abd 100644 --- a/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c +++ b/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c @@ -25,14 +25,18 @@ */ #include +#include #include "bundle_activator.h" -#include "pubsub_common.h" -#include "pubsub_utils.h" #include "pubsub_subscriber_private.h" -#define SUB_TOPIC "poi1;poi2" +#define SUB_NAME "poi1;poi2" +static const char * SUB_TOPICS[] = { + "poi1", + "poi2", + NULL +}; struct subscriberActivator { array_list_pt registrationList; //List @@ -51,39 +55,29 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) pubsub_subscriber_pt subsvc = calloc(1,sizeof(*subsvc)); - pubsub_receiver_pt sub = subscriber_create(SUB_TOPIC); + pubsub_receiver_pt sub = subscriber_create(SUB_NAME); subsvc->handle = sub; subsvc->receive = pubsub_subscriber_recv; act->subsvc = subsvc; - array_list_pt topic_list = pubsub_getTopicsFromString(SUB_TOPIC); - - if(topic_list !=NULL){ + if (SUB_TOPICS !=NULL){ int i; - for(i=0; iregistrationList,reg); - } - else{ - printf("Topic %s too long. Skipping subscription.\n",topic); - } - free(topic); + service_registration_pt reg = NULL; + bundleContext_registerService(context, PUBSUB_SUBSCRIBER_SERVICE_NAME, subsvc, props, ®); + arrayList_add(act->registrationList,reg); } - arrayList_destroy(topic_list); - } subscriber_start((pubsub_receiver_pt)act->subsvc->handle); http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/mock/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/mock/CMakeLists.txt b/pubsub/mock/CMakeLists.txt index 6313987..ccc3d20 100644 --- a/pubsub/mock/CMakeLists.txt +++ b/pubsub/mock/CMakeLists.txt @@ -18,28 +18,22 @@ #only install if CppuTest is available find_package(CppUTest QUIET) if (CPPUTEST_FOUND) - include_directories( - ../api - api + + add_library(celix_pubsub_mock STATIC + src/publisher_mock.cc ) - include_directories(SYSTEM + target_include_directories(celix_pubsub_mock PUBLIC api) + target_link_libraries(celix_pubsub_mock PRIVATE Celix::pubsub_spi ${CPPUTEST_LIBRARY}) + target_include_directories(celix_pubsub_mock PRIVATE SYSTEM ${CPPUTEST_INCLUDE_DIR} ) - add_library(celix_pubsubmock STATIC - src/publisher_mock.cc - ../test/test/msg.h) - target_link_libraries(celix_pubsubmock ${CPPUTEST_LIBRARY}) - - install(TARGETS celix_pubsubmock DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework) - install(FILES api/pubsub/publisher_mock.h DESTINATION include/celix/pubsub COMPONENT framework) - if (ENABLE_TESTING) add_executable(pubsubmock_test tst/pubsubmock_test.cc tst/run_tests.cc ) - target_link_libraries(pubsubmock_test celix_pubsubmock ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY}) + target_link_libraries(pubsubmock_test celix_pubsub_mock ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::framework) add_test(NAME pubsubmock_test COMMAND pubsubmock_test) endif() endif() http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/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 a57693f..87858e3 100644 --- a/pubsub/pubsub_admin_udp_mc/CMakeLists.txt +++ b/pubsub/pubsub_admin_udp_mc/CMakeLists.txt @@ -17,7 +17,7 @@ find_package(Jansson REQUIRED) -add_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc +add_bundle(celix_pubsub_admin_udp_multicast BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_udp_multicast" VERSION "1.0.0" SOURCES @@ -26,20 +26,19 @@ add_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc 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 +target_include_directories(celix_pubsub_admin_udp_multicast 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 PRIVATE Celix::framework Celix::dfi Celix::log_helper) +set_target_properties(celix_pubsub_admin_udp_multicast PROPERTIES INSTALL_RPATH "$ORIGIN") +target_link_libraries(celix_pubsub_admin_udp_multicast PRIVATE Celix::pubsub_spi Celix::framework Celix::dfi Celix::log_helper) -install_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc) +install_bundle(celix_pubsub_admin_udp_multicast) + +add_library(Celix::pubsub_admin_udp_multicast ALIAS celix_pubsub_admin_udp_multicast) http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_udp_mc/src/pubsub_admin_impl.c ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/src/pubsub_admin_impl.c b/pubsub/pubsub_admin_udp_mc/src/pubsub_admin_impl.c index 1fbdb08..674f817 100644 --- a/pubsub/pubsub_admin_udp_mc/src/pubsub_admin_impl.c +++ b/pubsub/pubsub_admin_udp_mc/src/pubsub_admin_impl.c @@ -59,7 +59,7 @@ #include "topic_subscription.h" #include "topic_publication.h" #include "pubsub_endpoint.h" -#include "subscriber.h" +#include "pubsub/subscriber.h" #include "pubsub_admin_match.h" static const char *DEFAULT_MC_IP = "224.100.1.1"; http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_udp_mc/src/topic_publication.c ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/src/topic_publication.c b/pubsub/pubsub_admin_udp_mc/src/topic_publication.c index 44106df..15af108 100644 --- a/pubsub/pubsub_admin_udp_mc/src/topic_publication.c +++ b/pubsub/pubsub_admin_udp_mc/src/topic_publication.c @@ -36,7 +36,7 @@ #include "topic_publication.h" #include "pubsub_common.h" -#include "publisher.h" +#include "pubsub/publisher.h" #include "large_udp.h" #include "pubsub_serializer.h" http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_udp_mc/src/topic_publication.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/src/topic_publication.h b/pubsub/pubsub_admin_udp_mc/src/topic_publication.h index 4363d71..8f47deb 100644 --- a/pubsub/pubsub_admin_udp_mc/src/topic_publication.h +++ b/pubsub/pubsub_admin_udp_mc/src/topic_publication.h @@ -27,7 +27,7 @@ #ifndef TOPIC_PUBLICATION_H_ #define TOPIC_PUBLICATION_H_ -#include "publisher.h" +#include "pubsub/publisher.h" #include "pubsub_endpoint.h" #include "pubsub_common.h" http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_udp_mc/src/topic_subscription.c ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/src/topic_subscription.c b/pubsub/pubsub_admin_udp_mc/src/topic_subscription.c index d8e6f45..6d0768b 100644 --- a/pubsub/pubsub_admin_udp_mc/src/topic_subscription.c +++ b/pubsub/pubsub_admin_udp_mc/src/topic_subscription.c @@ -42,8 +42,8 @@ #include "topic_subscription.h" #include "topic_publication.h" -#include "subscriber.h" -#include "publisher.h" +#include "pubsub/subscriber.h" +#include "pubsub/publisher.h" #include "large_udp.h" #include "pubsub_serializer.h" http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_zmq/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_zmq/CMakeLists.txt b/pubsub/pubsub_admin_zmq/CMakeLists.txt index d71aedb..9d57756 100644 --- a/pubsub/pubsub_admin_zmq/CMakeLists.txt +++ b/pubsub/pubsub_admin_zmq/CMakeLists.txt @@ -21,17 +21,6 @@ if (BUILD_PUBSUB_PSA_ZMQ) find_package(CZMQ REQUIRED) find_package(Jansson REQUIRED) - include_directories("${ZMQ_INCLUDE_DIR}") - include_directories("${CZMQ_INCLUDE_DIR}") - include_directories("${JANSSON_INCLUDE_DIR}") - 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") - if (BUILD_ZMQ_SECURITY) add_definitions(-DBUILD_WITH_ZMQ_SECURITY=1) @@ -41,24 +30,31 @@ if (BUILD_PUBSUB_PSA_ZMQ) set (ZMQ_CRYPTO_C "private/src/zmq_crypto.c") endif() - add_bundle(org.apache.celix.pubsub_admin.PubSubAdminZmq - BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_zmq" - 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 - ${ZMQ_CRYPTO_C} - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_endpoint.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_admin_match.c + add_bundle(celix_pubsub_admin_zmq + BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_zmq" + VERSION "1.0.0" + SOURCES + src/psa_activator.c + src/pubsub_admin_impl.c + src/topic_subscription.c + src/topic_publication.c + ${ZMQ_CRYPTO_C} ) - set_target_properties(org.apache.celix.pubsub_admin.PubSubAdminZmq PROPERTIES INSTALL_RPATH "$ORIGIN") - target_link_libraries(org.apache.celix.pubsub_admin.PubSubAdminZmq PRIVATE + set_target_properties(celix_pubsub_admin_zmq PROPERTIES INSTALL_RPATH "$ORIGIN") + target_link_libraries(celix_pubsub_admin_zmq PRIVATE + Celix::pubsub_spi Celix::framework Celix::dfi Celix::log_helper - ${ZMQ_LIBRARIES} ${CZMQ_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY}) + ${ZMQ_LIBRARIES} ${CZMQ_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} + ) + target_include_directories(celix_pubsub_admin_zmq PRIVATE + ${ZMQ_INCLUDE_DIR} + ${CZMQ_INCLUDE_DIR} + ${JANSSON_INCLUDE_DIR} + src + ) + install_bundle(org.apache.celix.pubsub_admin.PubSubAdminZmq) + add_library(Celix::pubsub_admin_zmq ALIAS celix_pubsub_admin_zmq) endif() http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_zmq/private/include/pubsub_admin_impl.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_zmq/private/include/pubsub_admin_impl.h b/pubsub/pubsub_admin_zmq/private/include/pubsub_admin_impl.h deleted file mode 100644 index 03e8556..0000000 --- a/pubsub/pubsub_admin_zmq/private/include/pubsub_admin_impl.h +++ /dev/null @@ -1,109 +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 Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef PUBSUB_ADMIN_ZMQ_IMPL_H_ -#define PUBSUB_ADMIN_ZMQ_IMPL_H_ - -#include -/* The following undefs prevent the collision between: - * - sys/syslog.h (which is included within czmq) - * - celix/dfi/dfi_log_util.h - */ -#undef LOG_DEBUG -#undef LOG_WARNING -#undef LOG_INFO -#undef LOG_WARNING - -#include "pubsub_admin.h" -#include "pubsub_admin_match.h" -#include "log_helper.h" - -#define PSA_ZMQ_BASE_PORT "PSA_ZMQ_BASE_PORT" -#define PSA_ZMQ_MAX_PORT "PSA_ZMQ_MAX_PORT" - -#define PSA_ZMQ_DEFAULT_BASE_PORT 5501 -#define PSA_ZMQ_DEFAULT_MAX_PORT 6000 - -#define PUBSUB_ADMIN_TYPE "zmq" - -struct pubsub_admin { - - bundle_context_pt bundle_context; - log_helper_pt loghelper; - - /* List of the available serializers */ - celix_thread_mutex_t serializerListLock; // List - array_list_pt serializerList; - - celix_thread_mutex_t localPublicationsLock; - hash_map_pt localPublications;// - - celix_thread_mutex_t externalPublicationsLock; - hash_map_pt externalPublications;//> - - celix_thread_mutex_t subscriptionsLock; - hash_map_pt subscriptions; // - - celix_thread_mutex_t pendingSubscriptionsLock; - celix_thread_mutexattr_t pendingSubscriptionsAttr; - hash_map_pt pendingSubscriptions; //> - - /* 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 - array_list_pt noSerializerPublications; // List - - celix_thread_mutex_t usedSerializersLock; - hash_map_pt topicSubscriptionsPerSerializer; // > - hash_map_pt topicPublicationsPerSerializer; // > - - char* ipAddress; - - zactor_t* zmq_auth; - - unsigned int basePort; - unsigned int maxPort; -}; - -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_ZMQ_IMPL_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/81804e00/pubsub/pubsub_admin_zmq/private/include/topic_publication.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_zmq/private/include/topic_publication.h b/pubsub/pubsub_admin_zmq/private/include/topic_publication.h deleted file mode 100644 index 3457263..0000000 --- a/pubsub/pubsub_admin_zmq/private/include/topic_publication.h +++ /dev/null @@ -1,49 +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 Apache Celix Project Team - * \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" - -typedef struct topic_publication *topic_publication_pt; - -celix_status_t pubsub_topicPublicationCreate(bundle_context_pt bundle_context,pubsub_endpoint_pt pubEP, pubsub_serializer_service_t *best_serializer, char* bindIP, unsigned int basePort, unsigned int maxPort, 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/81804e00/pubsub/pubsub_admin_zmq/private/include/topic_subscription.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_zmq/private/include/topic_subscription.h b/pubsub/pubsub_admin_zmq/private/include/topic_subscription.h deleted file mode 100644 index 7267103..0000000 --- a/pubsub/pubsub_admin_zmq/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 Apache Celix Project Team - * \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* 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/81804e00/pubsub/pubsub_admin_zmq/private/include/zmq_crypto.h ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_zmq/private/include/zmq_crypto.h b/pubsub/pubsub_admin_zmq/private/include/zmq_crypto.h deleted file mode 100644 index f1a990f..0000000 --- a/pubsub/pubsub_admin_zmq/private/include/zmq_crypto.h +++ /dev/null @@ -1,41 +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. - */ -/* - * zmq_crypto.h - * - * \date Dec 2, 2016 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#ifndef ZMQ_CRYPTO_H_ -#define ZMQ_CRYPTO_H_ - -#include - -#define PROPERTY_KEYS_FILE_PATH "keys.file.path" -#define PROPERTY_KEYS_FILE_NAME "keys.file.name" -#define DEFAULT_KEYS_FILE_PATH "/etc/" -#define DEFAULT_KEYS_FILE_NAME "pubsub.keys" - -zcert_t* get_zcert_from_encoded_file(char* keysFilePath, char* keysFileName, char* file_path); -int generate_sha256_hash(char* text, unsigned char* digest); -int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext); - -#endif