From 3ae152944bfbf0e7a394770c56361d26ba053f99 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Thu, 4 May 2023 16:46:53 +0800 Subject: [PATCH 1/8] Remove deprecated header for rsa_spi --- .../include/endpoint_discovery_poller.h | 3 ++- .../src/endpoint_descriptor_writer.c | 1 + .../src/endpoint_discovery_poller.c | 4 ++-- .../remote_service_admin_dfi/gtest/src/rsa_tests.cc | 13 ++++++------- .../src/import_registration_dfi.h | 1 + .../rsa_spi/include/endpoint_description.h | 3 +-- .../rsa_spi/include/endpoint_listener.h | 4 +--- .../rsa_spi/include/export_registration.h | 2 +- .../rsa_spi/include/import_registration.h | 2 -- .../rsa_spi/include/remote_endpoint.h | 1 + .../remote_services/rsa_spi/include/remote_proxy.h | 3 ++- .../rsa_spi/include/remote_service_admin.h | 9 +++++---- .../rsa_spi/include/rsa_request_handler_service.h | 4 ++-- .../rsa_spi/include/rsa_request_sender_service.h | 6 +++--- .../rsa_spi/include/rsa_rpc_factory.h | 6 +++--- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bundles/remote_services/discovery_common/include/endpoint_discovery_poller.h b/bundles/remote_services/discovery_common/include/endpoint_discovery_poller.h index 9cf03291c..a52e745a4 100644 --- a/bundles/remote_services/discovery_common/include/endpoint_discovery_poller.h +++ b/bundles/remote_services/discovery_common/include/endpoint_discovery_poller.h @@ -32,6 +32,7 @@ #include "celix_log_helper.h" #include "celix_threads.h" #include "hash_map.h" +#include "celix_array_list.h" typedef struct endpoint_discovery_poller endpoint_discovery_poller_t; @@ -55,6 +56,6 @@ celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_t *poll celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_t *poller, char *url); celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_t *poller, char *url); -celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, array_list_pt urls); +celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, celix_array_list_t *urls); #endif /* ENDPOINT_DISCOVERY_POLLER_H_ */ diff --git a/bundles/remote_services/discovery_common/src/endpoint_descriptor_writer.c b/bundles/remote_services/discovery_common/src/endpoint_descriptor_writer.c index d2e2421fa..be2e03eb3 100644 --- a/bundles/remote_services/discovery_common/src/endpoint_descriptor_writer.c +++ b/bundles/remote_services/discovery_common/src/endpoint_descriptor_writer.c @@ -34,6 +34,7 @@ #include "endpoint_description.h" #include "endpoint_descriptor_common.h" #include "endpoint_descriptor_writer.h" +#include "hash_map.h" struct endpoint_descriptor_writer { xmlBufferPtr buffer; diff --git a/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c b/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c index 355e5438c..2d3b4e8fc 100644 --- a/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c +++ b/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c @@ -161,7 +161,7 @@ celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_t *poll } -celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, array_list_pt urls) { +celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, celix_array_list_t *urls) { celixThreadMutex_lock(&(poller)->pollerLock); hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries); @@ -169,7 +169,7 @@ celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_ while(hashMapIterator_hasNext(iterator)) { hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator); char* toAdd = strdup((char*) hashMapEntry_getKey(entry)); - arrayList_add(urls, toAdd); + celix_arrayList_add(urls, toAdd); } hashMapIterator_destroy(iterator); diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc index 9780993b3..d125fd6b2 100644 --- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc @@ -24,11 +24,11 @@ #include "celix_bundle_context.h" #include "celix_constants.h" #include "calculator_service.h" +#include "celix_array_list.h" extern "C" { #include "remote_service_admin.h" -#include "calculator_service.h" #define TST_CONFIGURATION_TYPE "org.amdatu.remote.admin.http" @@ -93,7 +93,7 @@ extern "C" { ASSERT_EQ(1, celix_arrayList_size(svcRegistration)); - rc = rsa->exportRegistration_close(rsa->admin,(export_registration_t *)(arrayList_get(svcRegistration,0))); + rc = rsa->exportRegistration_close(rsa->admin,(export_registration_t *)(celix_arrayList_get(svcRegistration,0))); ASSERT_EQ(CELIX_SUCCESS, rc); celix_arrayList_destroy(svcRegistration); } @@ -157,11 +157,10 @@ extern "C" { } static void testBundles(void) { - array_list_pt bundles = NULL; + celix_array_list_t *bundles = NULL; - int rc = bundleContext_getBundles(context, &bundles); - ASSERT_EQ(0, rc); - ASSERT_EQ(3, arrayList_size(bundles)); //framework, rsa_dfi & calc + bundles = celix_bundleContext_listBundles(context); + ASSERT_EQ(3, celix_arrayList_size(bundles)); //framework, rsa_dfi & calc /* int size = arrayList_size(bundles); @@ -177,7 +176,7 @@ extern "C" { printf("got bundle with symbolic name '%s'", name); }*/ - arrayList_destroy(bundles); + celix_arrayList_destroy(bundles); } } diff --git a/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.h b/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.h index 13353204f..f4e332399 100644 --- a/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.h +++ b/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.h @@ -21,6 +21,7 @@ #define CELIX_IMPORT_REGISTRATION_DFI_H #include "import_registration.h" +#include "endpoint_description.h" #include "dfi_utils.h" #include diff --git a/bundles/remote_services/rsa_spi/include/endpoint_description.h b/bundles/remote_services/rsa_spi/include/endpoint_description.h index a3fa11615..a5dac1c15 100644 --- a/bundles/remote_services/rsa_spi/include/endpoint_description.h +++ b/bundles/remote_services/rsa_spi/include/endpoint_description.h @@ -27,8 +27,7 @@ #ifndef ENDPOINT_DESCRIPTION_H_ #define ENDPOINT_DESCRIPTION_H_ -#include "properties.h" -#include "array_list.h" +#include "celix_properties.h" #include struct endpoint_description { diff --git a/bundles/remote_services/rsa_spi/include/endpoint_listener.h b/bundles/remote_services/rsa_spi/include/endpoint_listener.h index 68bad113e..57c889fb2 100644 --- a/bundles/remote_services/rsa_spi/include/endpoint_listener.h +++ b/bundles/remote_services/rsa_spi/include/endpoint_listener.h @@ -27,10 +27,8 @@ #ifndef ENDPOINT_LISTENER_H_ #define ENDPOINT_LISTENER_H_ -#include "array_list.h" -#include "properties.h" - #include "endpoint_description.h" +#include "celix_errno.h" static const char * const OSGI_ENDPOINT_LISTENER_SERVICE = "endpoint_listener"; diff --git a/bundles/remote_services/rsa_spi/include/export_registration.h b/bundles/remote_services/rsa_spi/include/export_registration.h index f6ac78e04..9adb4aa46 100644 --- a/bundles/remote_services/rsa_spi/include/export_registration.h +++ b/bundles/remote_services/rsa_spi/include/export_registration.h @@ -22,7 +22,7 @@ #include "celix_errno.h" #include "endpoint_description.h" -#include "service_reference.h" +#include "celix_types.h" /** * This headers contains a opaque declaration of the export_registration type and declaration of some generic diff --git a/bundles/remote_services/rsa_spi/include/import_registration.h b/bundles/remote_services/rsa_spi/include/import_registration.h index 0447729de..af78e5312 100644 --- a/bundles/remote_services/rsa_spi/include/import_registration.h +++ b/bundles/remote_services/rsa_spi/include/import_registration.h @@ -21,8 +21,6 @@ #define CELIX_IMPORT_REGISTRATION_H #include "celix_errno.h" -#include "endpoint_description.h" -#include "service_reference.h" /** * This headers contains a opaque declaration of the import_registration type and declaration of some generic diff --git a/bundles/remote_services/rsa_spi/include/remote_endpoint.h b/bundles/remote_services/rsa_spi/include/remote_endpoint.h index 45a1d7e9f..6b44fec10 100644 --- a/bundles/remote_services/rsa_spi/include/remote_endpoint.h +++ b/bundles/remote_services/rsa_spi/include/remote_endpoint.h @@ -26,6 +26,7 @@ #ifndef REMOTE_ENDPOINT_H_ #define REMOTE_ENDPOINT_H_ +#include "celix_errno.h" #define OSGI_RSA_REMOTE_ENDPOINT "remote_endpoint" diff --git a/bundles/remote_services/rsa_spi/include/remote_proxy.h b/bundles/remote_services/rsa_spi/include/remote_proxy.h index 2643d01bd..67bef22d1 100644 --- a/bundles/remote_services/rsa_spi/include/remote_proxy.h +++ b/bundles/remote_services/rsa_spi/include/remote_proxy.h @@ -29,6 +29,7 @@ #include "endpoint_listener.h" #include "remote_service_admin.h" +#include "celix_long_hash_map.h" #define OSGI_RSA_REMOTE_PROXY_FACTORY "remote_proxy_factory" #define OSGI_RSA_REMOTE_PROXY_TIMEOUT "remote_proxy_timeout" @@ -48,7 +49,7 @@ struct remote_proxy_factory { celix_properties_t *properties; service_registration_t *registration; - hash_map_pt proxy_instances; + celix_long_hash_map_t *proxy_instances; void *handle; diff --git a/bundles/remote_services/rsa_spi/include/remote_service_admin.h b/bundles/remote_services/rsa_spi/include/remote_service_admin.h index 346b11939..ad9553c28 100644 --- a/bundles/remote_services/rsa_spi/include/remote_service_admin.h +++ b/bundles/remote_services/rsa_spi/include/remote_service_admin.h @@ -28,9 +28,10 @@ #define REMOTE_SERVICE_ADMIN_H_ #include "endpoint_listener.h" -#include "service_reference.h" +#include "celix_types.h" #include "export_registration.h" #include "import_registration.h" +#include "celix_array_list.h" #define OSGI_RSA_REMOTE_SERVICE_ADMIN "remote_service_admin" @@ -41,10 +42,10 @@ typedef struct remote_service_admin remote_service_admin_t; struct remote_service_admin_service { remote_service_admin_t *admin; - celix_status_t (*exportService)(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations); + celix_status_t (*exportService)(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, celix_array_list_t **registrations); celix_status_t (*removeExportedService)(remote_service_admin_t *admin, export_registration_t *registration); - celix_status_t (*getExportedServices)(remote_service_admin_t *admin, array_list_pt *services); - celix_status_t (*getImportedEndpoints)(remote_service_admin_t *admin, array_list_pt *services); + celix_status_t (*getExportedServices)(remote_service_admin_t *admin, celix_array_list_t **services); + celix_status_t (*getImportedEndpoints)(remote_service_admin_t *admin, celix_array_list_t **services); celix_status_t (*importService)(remote_service_admin_t *admin, endpoint_description_t *endpoint, import_registration_t **registration); celix_status_t (*exportReference_getExportedEndpoint)(export_reference_t *reference, endpoint_description_t **endpoint); diff --git a/bundles/remote_services/rsa_spi/include/rsa_request_handler_service.h b/bundles/remote_services/rsa_spi/include/rsa_request_handler_service.h index c94c19265..c509ddb7c 100644 --- a/bundles/remote_services/rsa_spi/include/rsa_request_handler_service.h +++ b/bundles/remote_services/rsa_spi/include/rsa_request_handler_service.h @@ -23,8 +23,8 @@ #ifdef __cplusplus extern "C" { #endif -#include -#include +#include "celix_properties.h" +#include "celix_errno.h" #include #define RSA_REQUEST_HANDLER_SERVICE_NAME "rsa_request_handler_service" diff --git a/bundles/remote_services/rsa_spi/include/rsa_request_sender_service.h b/bundles/remote_services/rsa_spi/include/rsa_request_sender_service.h index ba0cc62a0..9d15205d6 100644 --- a/bundles/remote_services/rsa_spi/include/rsa_request_sender_service.h +++ b/bundles/remote_services/rsa_spi/include/rsa_request_sender_service.h @@ -23,9 +23,9 @@ #ifdef __cplusplus extern "C" { #endif -#include -#include -#include +#include "endpoint_description.h" +#include "celix_properties.h" +#include "celix_errno.h" #include #define RSA_REQUEST_SENDER_SERVICE_NAME "rsa_request_sender_service" diff --git a/bundles/remote_services/rsa_spi/include/rsa_rpc_factory.h b/bundles/remote_services/rsa_spi/include/rsa_rpc_factory.h index 8c9027237..a19a68023 100644 --- a/bundles/remote_services/rsa_spi/include/rsa_rpc_factory.h +++ b/bundles/remote_services/rsa_spi/include/rsa_rpc_factory.h @@ -23,9 +23,9 @@ #ifdef __cplusplus extern "C" { #endif -#include -#include -#include +#include "endpoint_description.h" +#include "celix_properties.h" +#include "celix_errno.h" #include /** From 7637e40038cea96ae814dd5964dac6bdb98404f4 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Thu, 4 May 2023 19:41:20 +0800 Subject: [PATCH 2/8] Remove deprecated header for rsa_spi --- .../rsa_shm/CMakeLists.txt | 1 + .../rsa_shm/gtest/CMakeLists.txt | 1 + .../RsaShmExportRegistrationUnitTestSuite.cc | 1 + .../rsa_shm/src/rsa_shm_impl.c | 9 +- .../rsa_shm/src/rsa_shm_impl.h | 5 +- .../src/remote_proxy_factory_impl.c | 251 ------------------ .../src/rsa_json_rpc_proxy_impl.c | 21 +- .../remote_services/rsa_spi/CMakeLists.txt | 3 - 8 files changed, 24 insertions(+), 268 deletions(-) delete mode 100644 bundles/remote_services/rsa_common/src/remote_proxy_factory_impl.c diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/CMakeLists.txt b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/CMakeLists.txt index 836140218..b7189afcd 100644 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/CMakeLists.txt +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/CMakeLists.txt @@ -57,6 +57,7 @@ add_library(Celix::rsa_shm ALIAS rsa_shm) if (ENABLE_TESTING) add_library(rsa_shm_cut STATIC ${RSA_SHM_SRC}) celix_deprecated_utils_headers(rsa_shm_cut) + celix_deprecated_framework_headers(rsa_shm_cut) target_include_directories(rsa_shm_cut PUBLIC src) target_link_libraries(rsa_shm_cut PUBLIC ${RSA_SHM_DEPS}) add_subdirectory(gtest) diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt index 181626c73..bae1234a7 100644 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt @@ -81,6 +81,7 @@ if (LINKER_WRAP_SUPPORTED) add_celix_bundle_dependencies(unit_test_rsa_shm Celix::rsa_json_rpc) celix_deprecated_utils_headers(unit_test_rsa_shm) + celix_deprecated_framework_headers(unit_test_rsa_shm) add_test(NAME run_unit_test_rsa_shm COMMAND unit_test_rsa_shm) setup_target_for_coverage(unit_test_rsa_shm SCAN_DIR ..) diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmExportRegistrationUnitTestSuite.cc b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmExportRegistrationUnitTestSuite.cc index a82b0ba0f..7c71ce7dc 100644 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmExportRegistrationUnitTestSuite.cc +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmExportRegistrationUnitTestSuite.cc @@ -30,6 +30,7 @@ #include "celix_framework.h" #include "celix_bundle_context.h" #include "celix_framework_factory.h" +#include "bundle_context.h" #include "celix_properties.h" #include "celix_constants.h" #include "celix_errno.h" diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.c b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.c index 3f576066f..84eccad37 100755 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.c +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.c @@ -26,7 +26,10 @@ #include "rsa_request_sender_service.h" #include "endpoint_description.h" #include "remote_constants.h" -#include "celix_api.h" +#include "bundle_context.h" +#include "celix_threads.h" +#include "celix_constants.h" +#include "celix_properties.h" #include "celix_long_hash_map.h" #include "celix_array_list.h" #include "celix_utils.h" @@ -625,13 +628,13 @@ static celix_status_t rsaShm_createEndpointDescription(rsa_shm_t *admin, } //LCOV_EXCL_START -celix_status_t rsaShm_getExportedServices(rsa_shm_t *admin, array_list_pt *services) { +celix_status_t rsaShm_getExportedServices(rsa_shm_t *admin, celix_array_list_t **services) { celix_status_t status = CELIX_SUCCESS; //It is stub and will not be called at present. return status; } -celix_status_t rsaShm_getImportedEndpoints(rsa_shm_t *admin, array_list_pt *services) { +celix_status_t rsaShm_getImportedEndpoints(rsa_shm_t *admin, celix_array_list_t **services) { celix_status_t status = CELIX_SUCCESS; //It is stub and will not be called at present. return status; diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.h b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.h index db0872aa6..0404a4e32 100644 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.h +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_impl.h @@ -28,6 +28,7 @@ extern "C" { #include "endpoint_description.h" #include "celix_types.h" #include "celix_properties.h" +#include "celix_array_list.h" #include "celix_errno.h" @@ -46,9 +47,9 @@ celix_status_t rsaShm_exportService(rsa_shm_t *admin, char *serviceId, celix_status_t rsaShm_removeExportedService(rsa_shm_t *admin, export_registration_t *registration); -celix_status_t rsaShm_getExportedServices(rsa_shm_t *admin, array_list_pt *services); +celix_status_t rsaShm_getExportedServices(rsa_shm_t *admin, celix_array_list_t **services); -celix_status_t rsaShm_getImportedEndpoints(rsa_shm_t *admin, array_list_pt *services); +celix_status_t rsaShm_getImportedEndpoints(rsa_shm_t *admin, celix_array_list_t **services); celix_status_t rsaShm_importService(rsa_shm_t *admin, endpoint_description_t *endpointDescription, import_registration_t **registration); diff --git a/bundles/remote_services/rsa_common/src/remote_proxy_factory_impl.c b/bundles/remote_services/rsa_common/src/remote_proxy_factory_impl.c deleted file mode 100644 index 3e455951c..000000000 --- a/bundles/remote_services/rsa_common/src/remote_proxy_factory_impl.c +++ /dev/null @@ -1,251 +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. - */ -/** - * remote_proxy_factory_impl.c - * - * \date 22 Dec 2014 - * \author Apache Celix Project Team - * \copyright Apache License, Version 2.0 - */ - -#include -#include - -#include "remote_proxy.h" - -typedef struct proxy_instance { - service_registration_t *registration_ptr; - void *service; - celix_properties_t *properties; -} *proxy_instance_pt; - -static celix_status_t remoteProxyFactory_registerProxyService(remote_proxy_factory_t *remote_proxy_factory_ptr, endpoint_description_t *endpointDescription, remote_service_admin_t *rsa, sendToHandle sendToCallback); -static celix_status_t remoteProxyFactory_unregisterProxyService(remote_proxy_factory_t *remote_proxy_factory_ptr, endpoint_description_t *endpointDescription); - -celix_status_t remoteProxyFactory_create(celix_bundle_context_t *context, char *service, void *handle, - createProxyService create, destroyProxyService destroy, - remote_proxy_factory_t **remote_proxy_factory_ptr) { - celix_status_t status = CELIX_SUCCESS; - - *remote_proxy_factory_ptr = calloc(1, sizeof(**remote_proxy_factory_ptr)); - if (!*remote_proxy_factory_ptr) { - status = CELIX_ENOMEM; - } - - if (status == CELIX_SUCCESS) { - (*remote_proxy_factory_ptr)->context_ptr = context; - (*remote_proxy_factory_ptr)->service = strdup(service); - - (*remote_proxy_factory_ptr)->remote_proxy_factory_service_ptr = NULL; - (*remote_proxy_factory_ptr)->properties = NULL; - (*remote_proxy_factory_ptr)->registration = NULL; - - (*remote_proxy_factory_ptr)->proxy_instances = hashMap_create(NULL, NULL, NULL, NULL); - - (*remote_proxy_factory_ptr)->handle = handle; - - (*remote_proxy_factory_ptr)->create_proxy_service_ptr = create; - (*remote_proxy_factory_ptr)->destroy_proxy_service_ptr = destroy; - } - - return status; -} - -celix_status_t remoteProxyFactory_destroy(remote_proxy_factory_t **remote_proxy_factory_ptr) { - celix_status_t status = CELIX_SUCCESS; - - if (!*remote_proxy_factory_ptr) { - status = CELIX_ILLEGAL_ARGUMENT; - } - - if (status == CELIX_SUCCESS) { - if ((*remote_proxy_factory_ptr)->proxy_instances) { - hashMap_destroy((*remote_proxy_factory_ptr)->proxy_instances, false, false); - (*remote_proxy_factory_ptr)->proxy_instances = NULL; - } - if ((*remote_proxy_factory_ptr)->service) { - free((*remote_proxy_factory_ptr)->service); - (*remote_proxy_factory_ptr)->service = NULL; - } - free(*remote_proxy_factory_ptr); - *remote_proxy_factory_ptr = NULL; - } - - return status; -} - -celix_status_t remoteProxyFactory_register(remote_proxy_factory_t *remote_proxy_factory_ptr) { - celix_status_t status = CELIX_SUCCESS; - - remote_proxy_factory_ptr->remote_proxy_factory_service_ptr = calloc(1, sizeof(*remote_proxy_factory_ptr->remote_proxy_factory_service_ptr)); - if (!remote_proxy_factory_ptr->remote_proxy_factory_service_ptr) { - status = CELIX_ENOMEM; - } - - if (status == CELIX_SUCCESS) { - remote_proxy_factory_ptr->remote_proxy_factory_service_ptr->factory = remote_proxy_factory_ptr; - remote_proxy_factory_ptr->remote_proxy_factory_service_ptr->registerProxyService = remoteProxyFactory_registerProxyService; - remote_proxy_factory_ptr->remote_proxy_factory_service_ptr->unregisterProxyService = remoteProxyFactory_unregisterProxyService; - - remote_proxy_factory_ptr->properties = celix_properties_create(); - if (!remote_proxy_factory_ptr->properties) { - status = CELIX_BUNDLE_EXCEPTION; - } else { - celix_properties_set(remote_proxy_factory_ptr->properties, "proxy.interface", remote_proxy_factory_ptr->service); - } - } - - if (status == CELIX_SUCCESS) { - status = bundleContext_registerService(remote_proxy_factory_ptr->context_ptr, OSGI_RSA_REMOTE_PROXY_FACTORY, - remote_proxy_factory_ptr->remote_proxy_factory_service_ptr, remote_proxy_factory_ptr->properties, &remote_proxy_factory_ptr->registration); - } - - return status; -} - -celix_status_t remoteProxyFactory_unregister(remote_proxy_factory_t *remote_proxy_factory_ptr) { - celix_status_t status = CELIX_SUCCESS; - - if (!remote_proxy_factory_ptr) { - status = CELIX_ILLEGAL_ARGUMENT; - } - - // #TODO Remove proxy registrations - if (status == CELIX_SUCCESS) { - - hash_map_iterator_pt iter = hashMapIterator_create(remote_proxy_factory_ptr->proxy_instances); - while(hashMapIterator_hasNext(iter)){ - proxy_instance_pt proxy_instance_ptr = (proxy_instance_pt)hashMapIterator_nextValue(iter); - - if (proxy_instance_ptr->service) { - remote_proxy_factory_ptr->destroy_proxy_service_ptr(remote_proxy_factory_ptr->handle, proxy_instance_ptr->service); - } - free(proxy_instance_ptr); - } - hashMapIterator_destroy(iter); - - if (remote_proxy_factory_ptr->registration) { - status = serviceRegistration_unregister(remote_proxy_factory_ptr->registration); - remote_proxy_factory_ptr->properties = NULL; - } - if (remote_proxy_factory_ptr->properties) { - celix_properties_destroy(remote_proxy_factory_ptr->properties); - } - if (remote_proxy_factory_ptr->remote_proxy_factory_service_ptr) { - free(remote_proxy_factory_ptr->remote_proxy_factory_service_ptr); - } - } - - return status; -} - - -static celix_status_t remoteProxyFactory_registerProxyService(remote_proxy_factory_t *remote_proxy_factory_ptr, endpoint_description_t *endpointDescription, remote_service_admin_t *rsa, sendToHandle sendToCallback) { - celix_status_t status = CELIX_SUCCESS; - proxy_instance_pt proxy_instance_ptr = NULL; - - if (!remote_proxy_factory_ptr || !remote_proxy_factory_ptr->create_proxy_service_ptr) { - status = CELIX_ILLEGAL_ARGUMENT; - } - - if (status == CELIX_SUCCESS) { - proxy_instance_ptr = calloc(1, sizeof(*proxy_instance_ptr)); - if (!proxy_instance_ptr) { - status = CELIX_ENOMEM; - } - } - - if (status == CELIX_SUCCESS) { - proxy_instance_ptr->properties = celix_properties_create(); - if (!proxy_instance_ptr->properties) { - status = CELIX_ENOMEM; - } - } - - if (status == CELIX_SUCCESS) { - status = remote_proxy_factory_ptr->create_proxy_service_ptr(remote_proxy_factory_ptr->handle, endpointDescription, rsa, sendToCallback, proxy_instance_ptr->properties, &proxy_instance_ptr->service); - } - - if (status == CELIX_SUCCESS) { - celix_properties_set(proxy_instance_ptr->properties, "proxy.interface", remote_proxy_factory_ptr->service); - - hash_map_iterator_pt iter = hashMapIterator_create(endpointDescription->properties); - while (hashMapIterator_hasNext(iter)) { - hash_map_entry_pt entry = hashMapIterator_nextEntry(iter); - char *key = hashMapEntry_getKey(entry); - char *value = hashMapEntry_getValue(entry); - - celix_properties_set(proxy_instance_ptr->properties, key, value); - } - hashMapIterator_destroy(iter); - } - - if (status == CELIX_SUCCESS) { - status = bundleContext_registerService(remote_proxy_factory_ptr->context_ptr, remote_proxy_factory_ptr->service, proxy_instance_ptr->service, proxy_instance_ptr->properties, &proxy_instance_ptr->registration_ptr); - } - - if (status == CELIX_SUCCESS) { - hashMap_put(remote_proxy_factory_ptr->proxy_instances, endpointDescription, proxy_instance_ptr); - } - - if(status!=CELIX_SUCCESS){ - if(proxy_instance_ptr != NULL){ - if(proxy_instance_ptr->properties != NULL){ - celix_properties_destroy(proxy_instance_ptr->properties); - } - free(proxy_instance_ptr); - } - } - - return status; -} - -static celix_status_t remoteProxyFactory_unregisterProxyService(remote_proxy_factory_t *remote_proxy_factory_ptr, endpoint_description_t *endpointDescription) { - celix_status_t status = CELIX_SUCCESS; - proxy_instance_pt proxy_instance_ptr = NULL; - - if (!remote_proxy_factory_ptr || !endpointDescription || !remote_proxy_factory_ptr->proxy_instances || !remote_proxy_factory_ptr->handle) { - status = CELIX_ILLEGAL_ARGUMENT; - } - - if (status == CELIX_SUCCESS) { - proxy_instance_ptr = hashMap_remove(remote_proxy_factory_ptr->proxy_instances, endpointDescription); - if (proxy_instance_ptr == NULL) { - status = CELIX_BUNDLE_EXCEPTION; - } - } - - if (status == CELIX_SUCCESS) { - if (proxy_instance_ptr->registration_ptr) { - status = serviceRegistration_unregister(proxy_instance_ptr->registration_ptr); - proxy_instance_ptr->properties = NULL; - } - if (proxy_instance_ptr->service) { - status = remote_proxy_factory_ptr->destroy_proxy_service_ptr(remote_proxy_factory_ptr->handle, proxy_instance_ptr->service); - } - if (proxy_instance_ptr->properties) { - celix_properties_destroy(proxy_instance_ptr->properties); - } - free(proxy_instance_ptr); - } - - return status; -} - - diff --git a/bundles/remote_services/rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c b/bundles/remote_services/rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c index f5d3b9fcb..0662711bb 100644 --- a/bundles/remote_services/rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c +++ b/bundles/remote_services/rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c @@ -25,6 +25,8 @@ #include "dfi_utils.h" #include "celix_version.h" #include "celix_constants.h" +#include "celix_long_hash_map.h" +#include "celix_build_assert.h" #include #include #include @@ -37,7 +39,7 @@ struct rsa_json_rpc_proxy_factory { celix_service_factory_t factory; long factorySvcId; endpoint_description_t *endpointDesc; - hash_map_t *proxies;//Key:requestingBundle, Value: rsa_json_rpc_proxy_t *. Work on the celix_event thread , so locks are not required + celix_long_hash_map_t *proxies;//Key:requestingBundle, Value: rsa_json_rpc_proxy_t *. Work on the celix_event thread , so locks are not required remote_interceptors_handler_t *interceptorsHandler; rsa_request_sender_tracker_t *reqSenderTracker; long reqSenderSvcId; @@ -90,7 +92,8 @@ celix_status_t rsaJsonRpcProxy_factoryCreate(celix_bundle_context_t* ctx, celix_ proxyFactory->reqSenderSvcId = requestSenderSvcId; proxyFactory->serialProtoId = serialProtoId; - proxyFactory->proxies = hashMap_create(NULL, NULL, NULL, NULL); + CELIX_BUILD_ASSERT(sizeof(long) >= sizeof(void*));//The celix_long_hash_map uses the long as key, but the key is a pointer, so long should be at least as big as void*. + proxyFactory->proxies = celix_longHashMap_create(); assert(proxyFactory->proxies != NULL); proxyFactory->endpointDesc = endpointDescription_clone(endpointDesc); @@ -114,7 +117,7 @@ celix_status_t rsaJsonRpcProxy_factoryCreate(celix_bundle_context_t* ctx, celix_ proxy_svc_fac_err: // props has been freed by framework endpointDescription_destroy(proxyFactory->endpointDesc); - hashMap_destroy(proxyFactory->proxies, false, false); + celix_longHashMap_destroy(proxyFactory->proxies); free(proxyFactory); return status; } @@ -133,8 +136,8 @@ static void rsaJsonRpcProxy_unregisterFacSvcDone(void *data) { assert(data); rsa_json_rpc_proxy_factory_t *proxyFactory = (rsa_json_rpc_proxy_factory_t *)data; endpointDescription_destroy(proxyFactory->endpointDesc); - assert(hashMap_isEmpty(proxyFactory->proxies)); - hashMap_destroy(proxyFactory->proxies, false, false); + assert(celix_longHashMap_size(proxyFactory->proxies) == 0); + celix_longHashMap_destroy(proxyFactory->proxies); free(proxyFactory); return; } @@ -147,7 +150,7 @@ static void* rsaJsonRpcProxy_getService(void *handle, const celix_bundle_t *requ celix_status_t status = CELIX_SUCCESS; rsa_json_rpc_proxy_factory_t *proxyFactory = (rsa_json_rpc_proxy_factory_t *)handle; - rsa_json_rpc_proxy_t *proxy = hashMap_get(proxyFactory->proxies, requestingBundle); + rsa_json_rpc_proxy_t *proxy = celix_longHashMap_get(proxyFactory->proxies, (long)requestingBundle); if (proxy == NULL) { status = rsaJsonRpcProxy_create(proxyFactory, requestingBundle, &proxy); if (status != CELIX_SUCCESS) { @@ -155,7 +158,7 @@ static void* rsaJsonRpcProxy_getService(void *handle, const celix_bundle_t *requ proxyFactory->endpointDesc->serviceName, status); goto service_proxy_err; } - hashMap_put(proxyFactory->proxies, (void*)requestingBundle, proxy); + celix_longHashMap_put(proxyFactory->proxies, (long)requestingBundle, proxy); } proxy->useCnt += 1; @@ -171,11 +174,11 @@ static void rsaJsonRpcProxy_ungetService(void *handle, const celix_bundle_t *req assert(requestingBundle != NULL); assert(svcProperties != NULL); rsa_json_rpc_proxy_factory_t *proxyFactory = (rsa_json_rpc_proxy_factory_t *)handle; - rsa_json_rpc_proxy_t *proxy = hashMap_get(proxyFactory->proxies, requestingBundle); + rsa_json_rpc_proxy_t *proxy = celix_longHashMap_get(proxyFactory->proxies, (long)requestingBundle); if (proxy != NULL) { proxy->useCnt -= 1; if (proxy->useCnt == 0) { - (void)hashMap_remove(proxyFactory->proxies, requestingBundle); + (void)celix_longHashMap_remove(proxyFactory->proxies, (long)requestingBundle); rsaJsonRpcProxy_destroy(proxy); } } diff --git a/bundles/remote_services/rsa_spi/CMakeLists.txt b/bundles/remote_services/rsa_spi/CMakeLists.txt index 8836c6c4d..6b60f7b4f 100644 --- a/bundles/remote_services/rsa_spi/CMakeLists.txt +++ b/bundles/remote_services/rsa_spi/CMakeLists.txt @@ -17,12 +17,9 @@ add_library(c_rsa_spi INTERFACE) -get_target_property(FRAMEWORK_SOURCE_DIR Celix::framework "SOURCE_DIR") target_include_directories(c_rsa_spi INTERFACE $ - $##TODO remove when deprecated header service_reference.h is removed ) -set_property(TARGET celix-deprecated APPEND PROPERTY "FRAMEWORK_TARGETS" c_rsa_spi) target_link_libraries(c_rsa_spi INTERFACE Celix::framework) install(TARGETS c_rsa_spi EXPORT celix COMPONENT rsa From 000bdfcd3656cd7293136c56713ff89f928d222b Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Thu, 4 May 2023 21:44:42 +0800 Subject: [PATCH 3/8] Remove deprecated headers for conan_test_package --- .../src/pubsub_udpmc_common.c | 7 ++-- .../src/pubsub_udpmc_common.h | 4 +- .../src/pubsub_udpmc_topic_receiver.c | 9 ++--- .../src/pubsub_udpmc_topic_sender.c | 17 ++++---- .../src/pubsub_avrobin_serializer_impl.c | 39 +++++++++---------- .../src/pubsub_avrobin_serializer_impl.h | 4 +- .../src/pubsub_serializer_impl.c | 38 +++++++++--------- .../src/pubsub_serializer_impl.h | 4 +- .../pubsub_spi/include/pubsub_serializer.h | 10 ++--- examples/conan_test_package/hello_bundle.c | 2 +- .../my_log_writer_activator.c | 2 +- .../conan_test_package/my_psa_activator.c | 2 +- .../conan_test_package/my_rsa_activator.c | 8 ++-- .../conan_test_package/test_cxx_shell.cpp | 14 ++++--- examples/conan_test_package/test_framework.c | 15 ++++--- .../test_http_admin_activator.c | 2 +- examples/conan_test_package/test_shell.c | 15 ++++--- 17 files changed, 96 insertions(+), 96 deletions(-) diff --git a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.c b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.c index c6718d075..2280a1e8e 100644 --- a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.c +++ b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.c @@ -19,13 +19,12 @@ #include "pubsub_udpmc_common.h" -bool psa_udpmc_checkVersion(version_pt msgVersion, pubsub_udp_msg_header_t *hdr) { +bool psa_udpmc_checkVersion(celix_version_t *msgVersion, pubsub_udp_msg_header_t *hdr) { bool check = false; if (msgVersion != NULL) { - int major = 0, minor = 0; - version_getMajor(msgVersion,&major); - version_getMinor(msgVersion,&minor); + int major = celix_version_getMajor(msgVersion); + int minor = celix_version_getMinor(msgVersion); if (hdr->major == ((unsigned char) major)) { /* Different major means incompatible */ check = (hdr->minor >= ((unsigned char) minor)); /* Compatible only if the provider has a minor equals or greater (means compatible update) */ diff --git a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.h b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.h index 0852ca49e..e56b9e224 100644 --- a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.h +++ b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_common.h @@ -22,7 +22,7 @@ #include -#include "version.h" +#include "celix_version.h" typedef struct pubsub_udp_msg_header { unsigned int type; @@ -31,7 +31,7 @@ typedef struct pubsub_udp_msg_header { } pubsub_udp_msg_header_t; -bool psa_udpmc_checkVersion(version_pt msgVersion, pubsub_udp_msg_header_t *hdr); +bool psa_udpmc_checkVersion(celix_version_t *msgVersion, pubsub_udp_msg_header_t *hdr); #endif //CELIX_PUBSUB_UDPMC_COMMON_H diff --git a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c index 5f8201953..541f4c7a6 100644 --- a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c +++ b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c @@ -96,7 +96,7 @@ typedef struct psa_udpmc_requested_connection_entry { } psa_udpmc_requested_connection_entry_t; typedef struct psa_udpmc_subscriber_entry { - hash_map_t *msgTypes; //map from serializer svc + celix_long_hash_map_t *msgTypes; //map from serializer svc hash_map_t *subscriberServices; //key = servide id, value = pubsub_subscriber_t* bool initialized; //true if the init function is called through the receive thread } psa_udpmc_subscriber_entry_t; @@ -474,7 +474,7 @@ static void psa_udpmc_processMsg(pubsub_udpmc_topic_receiver_t *receiver, pubsub pubsub_msg_serializer_t *msgSer = NULL; if (entry->msgTypes != NULL) { - msgSer = hashMap_get(entry->msgTypes, (void *) (uintptr_t) msg->header.type); + msgSer = celix_longHashMap_get(entry->msgTypes, msg->header.type); } if (msgSer == NULL) { L_WARN("[PSA_UDPMC] Serializer not available for message %d.\n", msg->header.type); @@ -513,9 +513,8 @@ static void psa_udpmc_processMsg(pubsub_udpmc_topic_receiver_t *receiver, pubsub } } else { - int major = 0, minor = 0; - version_getMajor(msgSer->msgVersion, &major); - version_getMinor(msgSer->msgVersion, &minor); + int major = celix_version_getMajor(msgSer->msgVersion); + int minor = celix_version_getMinor(msgSer->msgVersion); L_WARN("[PSA_UDPMC] Version mismatch for primary message '%s' (have %d.%d, received %u.%u). NOT sending any part of the whole message.\n", msgSer->msgName,major,minor,msg->header.major,msg->header.minor); } diff --git a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_sender.c b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_sender.c index cbcfa9951..be4b977f9 100644 --- a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_sender.c +++ b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_sender.c @@ -31,6 +31,7 @@ #include "pubsub_psa_udpmc_constants.h" #include "large_udp.h" #include "pubsub_udpmc_common.h" +#include "hash_map.h" #define FIRST_SEND_DELAY_IN_SECONDS 2 @@ -67,7 +68,7 @@ typedef struct psa_udpmc_bounded_service_entry { pubsub_udpmc_topic_sender_t *parent; pubsub_publisher_t service; long bndId; - hash_map_t *msgTypes; + celix_long_hash_map_t *msgTypes; hash_map_t *msgTypeIds; int getCount; largeUdp_t *largeUdpHandle; @@ -240,9 +241,8 @@ static void* psa_udpmc_getPublisherService(void *handle, const celix_bundle_t *r int rc = sender->serializer->createSerializerMap(sender->serializer->handle, (celix_bundle_t*)requestingBundle, &entry->msgTypes); if (rc == 0) { - hash_map_iterator_t iter = hashMapIterator_construct(entry->msgTypes); - while (hashMapIterator_hasNext(&iter)) { - pubsub_msg_serializer_t *msgSer = hashMapIterator_nextValue(&iter); + CELIX_LONG_HASH_MAP_ITERATE(entry->msgTypes, iter) { + pubsub_msg_serializer_t *msgSer = iter.value.ptrValue; hashMap_put(entry->msgTypeIds, strndup(msgSer->msgName, 1024), (void *)(uintptr_t) msgSer->msgId); } @@ -292,7 +292,7 @@ static int psa_udpmc_topicPublicationSend(void* handle, unsigned int msgTypeId, pubsub_msg_serializer_t* msgSer = NULL; if (entry->msgTypes != NULL) { - msgSer = hashMap_get(entry->msgTypes, (void*)(intptr_t)(msgTypeId)); + msgSer = celix_longHashMap_get(entry->msgTypes, msgTypeId); } if (msgSer != NULL) { @@ -303,11 +303,8 @@ static int psa_udpmc_topicPublicationSend(void* handle, unsigned int msgTypeId, msg_hdr->type = msgTypeId; if (msgSer->msgVersion != NULL) { - int major = 0, minor = 0; - version_getMajor(msgSer->msgVersion, &major); - version_getMinor(msgSer->msgVersion, &minor); - msg_hdr->major = (unsigned char) major; - msg_hdr->minor = (unsigned char) minor; + msg_hdr->major = (unsigned char) celix_version_getMajor(msgSer->msgVersion); + msg_hdr->minor = (unsigned char) celix_version_getMinor(msgSer->msgVersion); } pubsub_udp_msg_t *msg = calloc(1, sizeof(*msg)); diff --git a/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.c b/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.c index ac1a79867..81589eea9 100644 --- a/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.c +++ b/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.c @@ -61,12 +61,12 @@ typedef struct pubsub_avrobin_msg_serializer_impl { dyn_message_type *msgType; unsigned int msgId; const char *msgName; - version_pt msgVersion; + celix_version_t *msgVersion; } pubsub_avrobin_msg_serializer_impl_t; static char *pubsubAvrobinSerializer_getMsgDescriptionDir(const celix_bundle_t *bundle); -static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, const celix_bundle_t *bundle, hash_map_pt msgTypesMap); -static void pubsubAvrobinSerializer_fillMsgSerializerMap(hash_map_pt msgTypesMap, const celix_bundle_t *bundle); +static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, const celix_bundle_t *bundle, celix_long_hash_map_t *msgTypesMap); +static void pubsubAvrobinSerializer_fillMsgSerializerMap(celix_long_hash_map_t *msgTypesMap, const celix_bundle_t *bundle); static int pubsubMsgAvrobinSerializer_convertDescriptor(FILE* file_ptr, pubsub_msg_serializer_t* serializer); static int pubsubMsgAvrobinSerializer_convertAvpr(FILE* file_ptr, pubsub_msg_serializer_t* serializer, const char* fqn); @@ -114,11 +114,11 @@ celix_status_t pubsubAvrobinSerializer_destroy(pubsub_avrobin_serializer_t *seri return status; } -celix_status_t pubsubAvrobinSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, hash_map_pt *serializerMap) { +celix_status_t pubsubAvrobinSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, celix_long_hash_map_t **serializerMap) { celix_status_t status = CELIX_SUCCESS; pubsub_avrobin_serializer_t *serializer = handle; - hash_map_pt map = hashMap_create(NULL, NULL, NULL, NULL); + celix_long_hash_map_t *map = celix_longHashMap_create(); if (map != NULL) { pubsubAvrobinSerializer_fillMsgSerializerMap(map, bundle); @@ -134,23 +134,22 @@ celix_status_t pubsubAvrobinSerializer_createSerializerMap(void *handle, const c return status; } -celix_status_t pubsubAvrobinSerializer_destroySerializerMap(void *handle, hash_map_pt serializerMap) { +celix_status_t pubsubAvrobinSerializer_destroySerializerMap(void *handle, celix_long_hash_map_t *serializerMap) { celix_status_t status = CELIX_SUCCESS; if (serializerMap == NULL) { return CELIX_ILLEGAL_ARGUMENT; } - hash_map_iterator_t iter = hashMapIterator_construct(serializerMap); - while (hashMapIterator_hasNext(&iter)) { - pubsub_msg_serializer_t* msgSerializer = hashMapIterator_nextValue(&iter); + CELIX_LONG_HASH_MAP_ITERATE(serializerMap, iter){ + pubsub_msg_serializer_t* msgSerializer = iter.value.ptrValue; pubsub_avrobin_msg_serializer_impl_t *impl = msgSerializer->handle; dynMessage_destroy(impl->msgType); free(msgSerializer); //also contains the service struct. free(impl); } - hashMap_destroy(serializerMap, false, false); + celix_longHashMap_destroy(serializerMap); return status; } @@ -260,7 +259,7 @@ static char *pubsubAvrobinSerializer_getMsgDescriptionDir(const celix_bundle_t * return root; } -static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, const celix_bundle_t *bundle, hash_map_pt msgTypesMap) { +static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, const celix_bundle_t *bundle, celix_long_hash_map_t *msgTypesMap) { char fqn[MAX_PATH_LEN]; char path[MAX_PATH_LEN]; const char* entry_name = NULL; @@ -304,7 +303,7 @@ static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, } // serializer has been constructed, try to put in the map - if (hashMap_containsKey(msgTypesMap, (void *) (uintptr_t) msgSerializer->msgId)) { + if (celix_longHashMap_hasKey(msgTypesMap, msgSerializer->msgId)) { printf("Cannot add msg %s. clash in msg id %d!!\n", msgSerializer->msgName, msgSerializer->msgId); dynMessage_destroy(impl->msgType); free(msgSerializer); @@ -316,7 +315,7 @@ static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, free(impl); } else { - hashMap_put(msgTypesMap, (void *) (uintptr_t) msgSerializer->msgId, msgSerializer); + celix_longHashMap_put(msgTypesMap, msgSerializer->msgId, msgSerializer); } } @@ -325,7 +324,7 @@ static void pubsubAvrobinSerializer_addMsgSerializerFromBundle(const char *root, } } -static void pubsubAvrobinSerializer_fillMsgSerializerMap(hash_map_pt msgTypesMap, const celix_bundle_t *bundle) { +static void pubsubAvrobinSerializer_fillMsgSerializerMap(celix_long_hash_map_t *msgTypesMap, const celix_bundle_t *bundle) { char *root = NULL; char *metaInfPath = NULL; @@ -430,7 +429,7 @@ static int pubsubMsgAvrobinSerializer_convertDescriptor(FILE* file_ptr, pubsub_m char* msgName = NULL; rc += dynMessage_getName(msgType, &msgName); - version_pt msgVersion = NULL; + celix_version_t *msgVersion = NULL; rc += dynMessage_getVersion(msgType, &msgVersion); if (rc != 0 || msgName == NULL || msgVersion == NULL) { @@ -490,13 +489,13 @@ static int pubsubMsgAvrobinSerializer_convertAvpr(FILE* file_ptr, pubsub_msg_ser const char* msgName = dynType_getName(type); - version_pt msgVersion = NULL; - celix_status_t s = version_createVersionFromString(dynType_getMetaInfo(type, "version"), &msgVersion); + celix_version_t *msgVersion = NULL; + msgVersion = celix_version_createVersionFromString(dynType_getMetaInfo(type, "version")); - if (s != CELIX_SUCCESS || !msgName) { + if (msgVersion == NULL || !msgName) { printf("DMU: cannot retrieve name and/or version from msg\n"); - if (s == CELIX_SUCCESS) { - version_destroy(msgVersion); + if (msgVersion != NULL) { + celix_version_destroy(msgVersion); } return -1; } diff --git a/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.h b/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.h index ab1494f29..d09cc8f03 100644 --- a/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.h +++ b/bundles/pubsub/pubsub_serializer_avrobin/src/pubsub_avrobin_serializer_impl.h @@ -34,7 +34,7 @@ typedef struct pubsub_avrobin_serializer pubsub_avrobin_serializer_t; celix_status_t pubsubAvrobinSerializer_create(celix_bundle_context_t *context, pubsub_avrobin_serializer_t **serializer); celix_status_t pubsubAvrobinSerializer_destroy(pubsub_avrobin_serializer_t *serializer); -celix_status_t pubsubAvrobinSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, hash_map_pt *serializerMap); -celix_status_t pubsubAvrobinSerializer_destroySerializerMap(void *handle, hash_map_pt serializerMap); +celix_status_t pubsubAvrobinSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, celix_long_hash_map_t **serializerMap); +celix_status_t pubsubAvrobinSerializer_destroySerializerMap(void *handle, celix_long_hash_map_t *serializerMap); #endif /* PUBSUB_SERIALIZER_AVROBIN_H_ */ diff --git a/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.c b/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.c index 459563352..38cabc4fa 100644 --- a/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.c +++ b/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.c @@ -74,12 +74,12 @@ typedef struct pubsub_json_msg_serializer_impl { unsigned int msgId; const char* msgName; - version_pt msgVersion; + celix_version_t *msgVersion; } pubsub_json_msg_serializer_impl_t; static char* pubsubSerializer_getMsgDescriptionDir(const celix_bundle_t *bundle); -static void pubsubSerializer_addMsgSerializerFromBundle(pubsub_json_serializer_t* serializer, const char *root, const celix_bundle_t *bundle, hash_map_pt msgSerializers); -static void pubsubSerializer_fillMsgSerializerMap(pubsub_json_serializer_t* serializer, hash_map_pt msgSerializers, const celix_bundle_t *bundle); +static void pubsubSerializer_addMsgSerializerFromBundle(pubsub_json_serializer_t* serializer, const char *root, const celix_bundle_t *bundle, celix_long_hash_map_t *msgSerializers); +static void pubsubSerializer_fillMsgSerializerMap(pubsub_json_serializer_t* serializer, celix_long_hash_map_t *msgSerializers, const celix_bundle_t *bundle); static int pubsubMsgSerializer_convertDescriptor(pubsub_json_serializer_t* serializer, FILE* file_ptr, pubsub_msg_serializer_t* msgSerializer); static int pubsubMsgSerializer_convertAvpr(pubsub_json_serializer_t *serializer, FILE* file_ptr, pubsub_msg_serializer_t* msgSerializer, const char* fqn); @@ -125,32 +125,31 @@ celix_status_t pubsubSerializer_destroy(pubsub_json_serializer_t* serializer) { return status; } -celix_status_t pubsubSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, hash_map_pt* serializerMap) { +celix_status_t pubsubSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, celix_long_hash_map_t **serializerMap) { pubsub_json_serializer_t *serializer = handle; - hash_map_pt map = hashMap_create(NULL, NULL, NULL, NULL); + celix_long_hash_map_t *map = celix_longHashMap_create(); pubsubSerializer_fillMsgSerializerMap(serializer, map, bundle); *serializerMap = map; return CELIX_SUCCESS; } -celix_status_t pubsubSerializer_destroySerializerMap(void* handle __attribute__((unused)), hash_map_pt serializerMap) { +celix_status_t pubsubSerializer_destroySerializerMap(void* handle __attribute__((unused)), celix_long_hash_map_t *serializerMap) { celix_status_t status = CELIX_SUCCESS; //pubsub_json_serializer_t *serializer = handle; if (serializerMap == NULL) { return CELIX_ILLEGAL_ARGUMENT; } - hash_map_iterator_t iter = hashMapIterator_construct(serializerMap); - while (hashMapIterator_hasNext(&iter)) { - pubsub_msg_serializer_t* msgSerializer = hashMapIterator_nextValue(&iter); + CELIX_LONG_HASH_MAP_ITERATE(serializerMap, iter){ + pubsub_msg_serializer_t* msgSerializer = iter.value.ptrValue; pubsub_json_msg_serializer_impl_t *impl = msgSerializer->handle; dynMessage_destroy(impl->msgType); free(msgSerializer); //also contains the service struct. free(impl); } - hashMap_destroy(serializerMap, false, false); + celix_longHashMap_destroy(serializerMap); return status; } @@ -227,7 +226,7 @@ void pubsubMsgSerializer_freeDeserializeMsg(void* handle, void *msg) { } -static void pubsubSerializer_fillMsgSerializerMap(pubsub_json_serializer_t* serializer, hash_map_pt msgSerializers, const celix_bundle_t *bundle) { +static void pubsubSerializer_fillMsgSerializerMap(pubsub_json_serializer_t* serializer, celix_long_hash_map_t *msgSerializers, const celix_bundle_t *bundle) { char* root = NULL; char* metaInfPath = NULL; @@ -270,7 +269,7 @@ static char* pubsubSerializer_getMsgDescriptionDir(const celix_bundle_t *bundle) return root; } -static void pubsubSerializer_addMsgSerializerFromBundle(pubsub_json_serializer_t* serializer, const char *root, const celix_bundle_t *bundle, hash_map_pt msgSerializers) { +static void pubsubSerializer_addMsgSerializerFromBundle(pubsub_json_serializer_t* serializer, const char *root, const celix_bundle_t *bundle, celix_long_hash_map_t *msgSerializers) { char fqn[MAX_PATH_LEN]; char pathOrError[MAX_PATH_LEN]; const char* entry_name = NULL; @@ -319,7 +318,7 @@ static void pubsubSerializer_addMsgSerializerFromBundle(pubsub_json_serializer_t } // serializer has been constructed, try to put in the map - if (hashMap_containsKey(msgSerializers, (void *) (uintptr_t) msgSerializer->msgId)) { + if (celix_longHashMap_hasKey(msgSerializers, msgSerializer->msgId)) { L_WARN("Cannot add msg %s. Clash is msg id %d!\n", msgSerializer->msgName, msgSerializer->msgId); dynMessage_destroy(impl->msgType); free(msgSerializer); @@ -331,7 +330,7 @@ static void pubsubSerializer_addMsgSerializerFromBundle(pubsub_json_serializer_t free(impl); } else { - hashMap_put(msgSerializers, (void *) (uintptr_t) msgSerializer->msgId, msgSerializer); + celix_longHashMap_put(msgSerializers, msgSerializer->msgId, msgSerializer); } } @@ -425,7 +424,7 @@ static int pubsubMsgSerializer_convertDescriptor(pubsub_json_serializer_t* seria char *msgName = NULL; rc += dynMessage_getName(msgType, &msgName); - version_pt msgVersion = NULL; + celix_version_t *msgVersion = NULL; rc += dynMessage_getVersion(msgType, &msgVersion); if (rc != 0 || msgName == NULL || msgVersion == NULL) { @@ -487,13 +486,12 @@ static int pubsubMsgSerializer_convertAvpr(pubsub_json_serializer_t *serializer, const char *msgName = dynType_getName(type); - version_pt msgVersion = NULL; - celix_status_t s = version_createVersionFromString(dynType_getMetaInfo(type, "version"), &msgVersion); + celix_version_t *msgVersion = celix_version_createVersionFromString(dynType_getMetaInfo(type, "version")); - if (s != CELIX_SUCCESS || !msgName) { + if (msgVersion == NULL || !msgName) { L_WARN("[json serializer] Cannot retrieve name and/or version from msg\n"); - if (s == CELIX_SUCCESS) { - version_destroy(msgVersion); + if (msgVersion != NULL) { + celix_version_destroy(msgVersion); } return -1; } diff --git a/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.h b/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.h index 1e9936d99..f9cd39a51 100644 --- a/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.h +++ b/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.h @@ -34,8 +34,8 @@ typedef struct pubsub_json_serializer pubsub_json_serializer_t; celix_status_t pubsubSerializer_create(celix_bundle_context_t *context, pubsub_json_serializer_t **serializer); celix_status_t pubsubSerializer_destroy(pubsub_json_serializer_t* serializer); -celix_status_t pubsubSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, hash_map_pt* serializerMap); -celix_status_t pubsubSerializer_destroySerializerMap(void *handle, hash_map_pt serializerMap); +celix_status_t pubsubSerializer_createSerializerMap(void *handle, const celix_bundle_t *bundle, celix_long_hash_map_t **serializerMap); +celix_status_t pubsubSerializer_destroySerializerMap(void *handle, celix_long_hash_map_t *serializerMap); void pubsubSerializer_onInstalled(void *handle, const celix_bundle_t *bundle); diff --git a/bundles/pubsub/pubsub_spi/include/pubsub_serializer.h b/bundles/pubsub/pubsub_spi/include/pubsub_serializer.h index 6e251b276..4a826e3bf 100644 --- a/bundles/pubsub/pubsub_spi/include/pubsub_serializer.h +++ b/bundles/pubsub/pubsub_spi/include/pubsub_serializer.h @@ -24,8 +24,8 @@ extern "C" { #endif -#include "hash_map.h" -#include "version.h" +#include "celix_long_hash_map.h" +#include "celix_version.h" #include "celix_bundle.h" #include "sys/uio.h" @@ -48,7 +48,7 @@ typedef struct pubsub_msg_serializer { unsigned int msgId; const char* msgName; - version_pt msgVersion; + celix_version_t *msgVersion; celix_status_t (*serialize)(void* handle, const void* input, struct iovec** output, size_t* outputIovLen); void (*freeSerializeMsg)(void* handle, const struct iovec* input, size_t inputIovLen); @@ -60,8 +60,8 @@ typedef struct pubsub_msg_serializer { typedef struct pubsub_serializer_service { void* handle; - celix_status_t (*createSerializerMap)(void* handle, const celix_bundle_t *bundle, hash_map_pt* serializerMap); - celix_status_t (*destroySerializerMap)(void* handle, hash_map_pt serializerMap); + celix_status_t (*createSerializerMap)(void* handle, const celix_bundle_t *bundle, celix_long_hash_map_t **serializerMap); + celix_status_t (*destroySerializerMap)(void* handle, celix_long_hash_map_t *serializerMap); } pubsub_serializer_service_t; diff --git a/examples/conan_test_package/hello_bundle.c b/examples/conan_test_package/hello_bundle.c index 6e2afe674..55c641877 100644 --- a/examples/conan_test_package/hello_bundle.c +++ b/examples/conan_test_package/hello_bundle.c @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -#include +#include #include #include diff --git a/examples/conan_test_package/my_log_writer_activator.c b/examples/conan_test_package/my_log_writer_activator.c index 4d11f35e5..d55d72b80 100644 --- a/examples/conan_test_package/my_log_writer_activator.c +++ b/examples/conan_test_package/my_log_writer_activator.c @@ -19,7 +19,7 @@ #define _GNU_SOURCE #include -#include +#include #include typedef struct my_log_writer_activator { diff --git a/examples/conan_test_package/my_psa_activator.c b/examples/conan_test_package/my_psa_activator.c index 32a3b536c..ca3df27fc 100644 --- a/examples/conan_test_package/my_psa_activator.c +++ b/examples/conan_test_package/my_psa_activator.c @@ -17,7 +17,7 @@ under the License. */ -#include +#include #include #include #include diff --git a/examples/conan_test_package/my_rsa_activator.c b/examples/conan_test_package/my_rsa_activator.c index 24e6188d2..59eaa5cbe 100644 --- a/examples/conan_test_package/my_rsa_activator.c +++ b/examples/conan_test_package/my_rsa_activator.c @@ -17,7 +17,7 @@ under the License. */ -#include +#include #include #include #include @@ -34,21 +34,21 @@ typedef struct my_remote_service_admin_activator { long svcIdRsa; } my_remote_service_admin_activator_t; -static celix_status_t remoteServiceAdmin_exportService(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations) { +static celix_status_t remoteServiceAdmin_exportService(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, celix_array_list_t **registrations) { (void)properties; (void)registrations; celix_logHelper_info(admin->loghelper, "%s called: serviceId=%s\n", __FUNCTION__, serviceId); return CELIX_SUCCESS; } -static celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_t *admin, array_list_pt *services) { +static celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_t *admin, celix_array_list_t **services) { celix_status_t status = CELIX_SUCCESS; (void)services; celix_logHelper_info(admin->loghelper, "%s called\n", __FUNCTION__); return status; } -static celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_t *admin, array_list_pt *services) { +static celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_t *admin, celix_array_list_t **services) { celix_status_t status = CELIX_SUCCESS; (void)services; celix_logHelper_info(admin->loghelper, "%s called\n", __FUNCTION__); diff --git a/examples/conan_test_package/test_cxx_shell.cpp b/examples/conan_test_package/test_cxx_shell.cpp index e5f269088..dbd5e8cb4 100644 --- a/examples/conan_test_package/test_cxx_shell.cpp +++ b/examples/conan_test_package/test_cxx_shell.cpp @@ -20,7 +20,9 @@ #include #include #include -#include +#include +#include +#include #include #include #include @@ -39,13 +41,13 @@ int main() { celix_bundle_context_t *ctx = NULL; celix_properties_t *properties = NULL; - properties = properties_create(); - properties_set(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", "true"); - properties_set(properties, "org.osgi.framework.storage.clean", "onFirstInit"); - properties_set(properties, "org.osgi.framework.storage", ".cacheBundleContextTestFramework"); + properties = celix_properties_create(); + celix_properties_set(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", "true"); + celix_properties_set(properties, "org.osgi.framework.storage.clean", "onFirstInit"); + celix_properties_set(properties, "org.osgi.framework.storage", ".cacheBundleContextTestFramework"); fw = celix_frameworkFactory_createFramework(properties); - ctx = framework_getContext(fw); + ctx = celix_framework_getFrameworkContext(fw); long bndId = celix_bundleContext_installBundle(ctx, CXX_SHELL_BUNDLE_LOCATION, true); assert(bndId >= 0); diff --git a/examples/conan_test_package/test_framework.c b/examples/conan_test_package/test_framework.c index 416a046a7..dff83c8f4 100644 --- a/examples/conan_test_package/test_framework.c +++ b/examples/conan_test_package/test_framework.c @@ -16,7 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -#include +#include +#include +#include +#include #include #include @@ -25,13 +28,13 @@ int main() { celix_bundle_context_t *ctx = NULL; celix_properties_t *properties = NULL; - properties = properties_create(); - properties_set(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", "true"); - properties_set(properties, "org.osgi.framework.storage.clean", "onFirstInit"); - properties_set(properties, "org.osgi.framework.storage", ".cacheBundleContextTestFramework"); + properties = celix_properties_create(); + celix_properties_set(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", "true"); + celix_properties_set(properties, "org.osgi.framework.storage.clean", "onFirstInit"); + celix_properties_set(properties, "org.osgi.framework.storage", ".cacheBundleContextTestFramework"); fw = celix_frameworkFactory_createFramework(properties); - ctx = framework_getContext(fw); + ctx = celix_framework_getFrameworkContext(fw); long bndId = celix_bundleContext_installBundle(ctx, HELLO_TEST_BUNDLE_LOCATION, true); assert(bndId >= 0); celix_framework_waitForStop(fw); diff --git a/examples/conan_test_package/test_http_admin_activator.c b/examples/conan_test_package/test_http_admin_activator.c index 73a74d846..1978e8a4a 100644 --- a/examples/conan_test_package/test_http_admin_activator.c +++ b/examples/conan_test_package/test_http_admin_activator.c @@ -18,7 +18,7 @@ */ #include -#include "celix_api.h" +#include #include "http_admin/api.h" #include "civetweb.h" diff --git a/examples/conan_test_package/test_shell.c b/examples/conan_test_package/test_shell.c index e4c3421fc..58684edb6 100644 --- a/examples/conan_test_package/test_shell.c +++ b/examples/conan_test_package/test_shell.c @@ -18,7 +18,10 @@ */ #include #include -#include +#include +#include +#include +#include #include static void use(void *handle, void *svc) { @@ -39,13 +42,13 @@ int main() { celix_bundle_context_t *ctx = NULL; celix_properties_t *properties = NULL; - properties = properties_create(); - properties_set(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", "true"); - properties_set(properties, "org.osgi.framework.storage.clean", "onFirstInit"); - properties_set(properties, "org.osgi.framework.storage", ".cacheBundleContextTestFramework"); + properties = celix_properties_create(); + celix_properties_set(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", "true"); + celix_properties_set(properties, "org.osgi.framework.storage.clean", "onFirstInit"); + celix_properties_set(properties, "org.osgi.framework.storage", ".cacheBundleContextTestFramework"); fw = celix_frameworkFactory_createFramework(properties); - ctx = framework_getContext(fw); + ctx = celix_framework_getFrameworkContext(fw); long bndId = celix_bundleContext_installBundle(ctx, SHELL_BUNDLE_LOCATION, true); assert(bndId >= 0); From 1998e1077fa2953a9176720b8c0efc4269ed65db Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Thu, 4 May 2023 21:48:57 +0800 Subject: [PATCH 4/8] Add conan_test_package for rsa_discovery_zeroconf --- examples/conan_test_package/CMakeLists.txt | 12 ++++++++++++ examples/conan_test_package/conanfile.py | 3 +++ 2 files changed, 15 insertions(+) diff --git a/examples/conan_test_package/CMakeLists.txt b/examples/conan_test_package/CMakeLists.txt index 921d93fc1..051dbbb41 100644 --- a/examples/conan_test_package/CMakeLists.txt +++ b/examples/conan_test_package/CMakeLists.txt @@ -237,6 +237,18 @@ if (TEST_RSA_DISCOVERY_ETCD) ) endif () +option(TEST_RSA_DISCOVERY_ZEROCONF "Test the Discovery (ZEROCONF) bundle" OFF) +if (TEST_RSA_DISCOVERY_ZEROCONF) + add_celix_container(use_rsa_discovery_zeroconf + BUNDLES + Celix::rsa_discovery_zeroconf + Celix::rsa_topology_manager + my_rsa + hello + PROPERTIES + ) +endif () + option(TEST_SHELL "Test shell" OFF) if (TEST_SHELL) add_executable(use_shell test_shell.c) diff --git a/examples/conan_test_package/conanfile.py b/examples/conan_test_package/conanfile.py index ab397433e..327a61a74 100644 --- a/examples/conan_test_package/conanfile.py +++ b/examples/conan_test_package/conanfile.py @@ -40,6 +40,7 @@ def build(self): cmake.definitions["TEST_RSA_RPC_JSON"] = self.options["celix"].build_rsa_json_rpc cmake.definitions["TEST_RSA_DISCOVERY_CONFIGURED"] = self.options["celix"].build_rsa_discovery_configured cmake.definitions["TEST_RSA_DISCOVERY_ETCD"] = self.options["celix"].build_rsa_discovery_etcd + cmake.definitions["TEST_RSA_DISCOVERY_ZEROCONF"] = self.options["celix"].build_rsa_discovery_zeroconf cmake.definitions["TEST_SHELL"] = self.options["celix"].build_shell if self.options["celix"].build_shell: cmake.definitions["TEST_CXX_SHELL"] = self.options["celix"].celix_cxx17 or self.options["celix"].celix_cxx14 @@ -93,6 +94,8 @@ def test(self): self.run("./use_rsa_configured", cwd=os.path.join("deploy", "use_rsa_configured"), run_environment=True) if self.options["celix"].build_rsa_discovery_etcd: self.run("./use_rsa_etcd", cwd=os.path.join("deploy", "use_rsa_etcd"), run_environment=True) + if self.options["celix"].build_rsa_discovery_zeroconf: + self.run("./use_rsa_discovery_zeroconf", cwd=os.path.join("deploy", "use_rsa_discovery_zeroconf"), run_environment=True) if self.options["celix"].build_shell: self.run("./use_shell", run_environment=True) if self.options["celix"].celix_cxx17 or self.options["celix"].celix_cxx14: From 60f8d7225ea957f7530516dc75ac61aa80bbd1b1 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Thu, 4 May 2023 23:18:52 +0800 Subject: [PATCH 5/8] Resolve test failure --- .../remote_service_admin_dfi/gtest/src/rsa_tests.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc index d125fd6b2..6119da27c 100644 --- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc @@ -160,7 +160,7 @@ extern "C" { celix_array_list_t *bundles = NULL; bundles = celix_bundleContext_listBundles(context); - ASSERT_EQ(3, celix_arrayList_size(bundles)); //framework, rsa_dfi & calc + ASSERT_EQ(2, celix_arrayList_size(bundles)); //rsa_dfi & calc /* int size = arrayList_size(bundles); From fd38f580d19eb380056b65e0346dbb62dd4fae06 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Fri, 5 May 2023 09:56:28 +0800 Subject: [PATCH 6/8] Remove deprecated headers for pubsub_spi --- .../pubsub_spi/include/pubsub_message_serialization_marker.h | 5 ----- .../include/pubsub_message_serialization_service.h | 4 ++-- .../pubsub/pubsub_utils/src/pubsub_serialization_provider.c | 1 + bundles/pubsub/pubsub_utils/src/pubsub_serializer_handler.c | 1 + 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_marker.h b/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_marker.h index 919b8f47b..9e8c45650 100644 --- a/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_marker.h +++ b/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_marker.h @@ -24,11 +24,6 @@ extern "C" { #endif -#include "hash_map.h" -#include "version.h" -#include "celix_bundle.h" -#include "sys/uio.h" - #define PUBSUB_MESSAGE_SERIALIZATION_MARKER_NAME "pubsub_message_serialization_marker" #define PUBSUB_MESSAGE_SERIALIZATION_MARKER_VERSION "1.0.0" #define PUBSUB_MESSAGE_SERIALIZATION_MARKER_RANGE "[1,2)" diff --git a/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_service.h b/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_service.h index c47d9eb52..7abe35cbe 100644 --- a/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_service.h +++ b/bundles/pubsub/pubsub_spi/include/pubsub_message_serialization_service.h @@ -24,10 +24,10 @@ extern "C" { #endif -#include "hash_map.h" -#include "version.h" #include "celix_bundle.h" +#include "celix_errno.h" #include "sys/uio.h" +#include #define PUBSUB_MESSAGE_SERIALIZATION_SERVICE_NAME "pubsub_message_serialization_service" #define PUBSUB_MESSAGE_SERIALIZATION_SERVICE_VERSION "1.0.0" diff --git a/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c b/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c index 3b33df3e3..8ea0fd053 100644 --- a/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c +++ b/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c @@ -36,6 +36,7 @@ #include "pubsub_message_serialization_service.h" #include "celix_shell_command.h" #include "celix_threads.h" +#include "version.h" #define MAX_PATH_LEN 1024 diff --git a/bundles/pubsub/pubsub_utils/src/pubsub_serializer_handler.c b/bundles/pubsub/pubsub_utils/src/pubsub_serializer_handler.c index 8ce7acd67..1737b1dc4 100644 --- a/bundles/pubsub/pubsub_utils/src/pubsub_serializer_handler.c +++ b/bundles/pubsub/pubsub_utils/src/pubsub_serializer_handler.c @@ -30,6 +30,7 @@ #include "celix_constants.h" #include "celix_threads.h" #include "celix_utils.h" +#include "hash_map.h" #define L_DEBUG(...) \ celix_logHelper_debug(handler->logHelper, __VA_ARGS__) From e46bcb8ffab6ac821f514416ce26b755281c6060 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Fri, 5 May 2023 16:29:17 +0800 Subject: [PATCH 7/8] Resolve compilation errors --- examples/conan_test_package/hello_bundle.c | 1 + examples/conan_test_package/test_http_admin_activator.c | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/conan_test_package/hello_bundle.c b/examples/conan_test_package/hello_bundle.c index 55c641877..095650258 100644 --- a/examples/conan_test_package/hello_bundle.c +++ b/examples/conan_test_package/hello_bundle.c @@ -17,6 +17,7 @@ * under the License. */ #include +#include #include #include diff --git a/examples/conan_test_package/test_http_admin_activator.c b/examples/conan_test_package/test_http_admin_activator.c index 1978e8a4a..a32548a32 100644 --- a/examples/conan_test_package/test_http_admin_activator.c +++ b/examples/conan_test_package/test_http_admin_activator.c @@ -19,6 +19,7 @@ #include #include +#include #include "http_admin/api.h" #include "civetweb.h" From cdc77e072d498f732f42c2a9d06a8327b672e6f5 Mon Sep 17 00:00:00 2001 From: xuzhenbao Date: Fri, 5 May 2023 20:47:55 +0800 Subject: [PATCH 8/8] Revert "Add conan_test_package for rsa_discovery_zeroconf" This reverts commit 1998e1077fa2953a9176720b8c0efc4269ed65db. --- examples/conan_test_package/CMakeLists.txt | 12 ------------ examples/conan_test_package/conanfile.py | 3 --- 2 files changed, 15 deletions(-) diff --git a/examples/conan_test_package/CMakeLists.txt b/examples/conan_test_package/CMakeLists.txt index 051dbbb41..921d93fc1 100644 --- a/examples/conan_test_package/CMakeLists.txt +++ b/examples/conan_test_package/CMakeLists.txt @@ -237,18 +237,6 @@ if (TEST_RSA_DISCOVERY_ETCD) ) endif () -option(TEST_RSA_DISCOVERY_ZEROCONF "Test the Discovery (ZEROCONF) bundle" OFF) -if (TEST_RSA_DISCOVERY_ZEROCONF) - add_celix_container(use_rsa_discovery_zeroconf - BUNDLES - Celix::rsa_discovery_zeroconf - Celix::rsa_topology_manager - my_rsa - hello - PROPERTIES - ) -endif () - option(TEST_SHELL "Test shell" OFF) if (TEST_SHELL) add_executable(use_shell test_shell.c) diff --git a/examples/conan_test_package/conanfile.py b/examples/conan_test_package/conanfile.py index 327a61a74..ab397433e 100644 --- a/examples/conan_test_package/conanfile.py +++ b/examples/conan_test_package/conanfile.py @@ -40,7 +40,6 @@ def build(self): cmake.definitions["TEST_RSA_RPC_JSON"] = self.options["celix"].build_rsa_json_rpc cmake.definitions["TEST_RSA_DISCOVERY_CONFIGURED"] = self.options["celix"].build_rsa_discovery_configured cmake.definitions["TEST_RSA_DISCOVERY_ETCD"] = self.options["celix"].build_rsa_discovery_etcd - cmake.definitions["TEST_RSA_DISCOVERY_ZEROCONF"] = self.options["celix"].build_rsa_discovery_zeroconf cmake.definitions["TEST_SHELL"] = self.options["celix"].build_shell if self.options["celix"].build_shell: cmake.definitions["TEST_CXX_SHELL"] = self.options["celix"].celix_cxx17 or self.options["celix"].celix_cxx14 @@ -94,8 +93,6 @@ def test(self): self.run("./use_rsa_configured", cwd=os.path.join("deploy", "use_rsa_configured"), run_environment=True) if self.options["celix"].build_rsa_discovery_etcd: self.run("./use_rsa_etcd", cwd=os.path.join("deploy", "use_rsa_etcd"), run_environment=True) - if self.options["celix"].build_rsa_discovery_zeroconf: - self.run("./use_rsa_discovery_zeroconf", cwd=os.path.join("deploy", "use_rsa_discovery_zeroconf"), run_environment=True) if self.options["celix"].build_shell: self.run("./use_shell", run_environment=True) if self.options["celix"].celix_cxx17 or self.options["celix"].celix_cxx14: