You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by rl...@apache.org on 2019/09/04 16:41:02 UTC
[celix] branch develop updated: Refactored _pt to _t *
This is an automated email from the ASF dual-hosted git repository.
rlenferink pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to refs/heads/develop by this push:
new a3f5dff Refactored _pt to _t *
a3f5dff is described below
commit a3f5dff25beb7659e5b7b0994b2920140f295be4
Author: Roy Lenferink <le...@gmail.com>
AuthorDate: Sun Sep 1 19:47:24 2019 +0200
Refactored _pt to _t *
---
bundles/deployment_admin/src/deployment_admin.c | 2 +-
bundles/deployment_admin/src/log.c | 6 +-
bundles/deployment_admin/src/log.h | 6 +-
.../device_access/device_access/src/activator.c | 2 +-
.../device_access/src/device_manager.c | 4 +-
.../device_access/src/device_manager.h | 2 +-
.../device_access/src/driver_matcher.c | 2 +-
.../event_admin/private/include/event_admin_impl.h | 60 +-
.../private/src/event_admin_activator.c | 164 +++---
.../event_admin/private/src/event_admin_impl.c | 243 ++++----
bundles/event_admin/event_handler/CMakeLists.txt | 10 +-
.../private/src/event_handler_activator.c | 43 +-
.../event_handler/private/src/event_handler_impl.c | 2 +-
.../private/include/event_publisher_impl.h | 2 +-
bundles/http_admin/http_admin/src/activator.c | 32 +-
bundles/http_admin/http_admin/src/http_admin.c | 32 +-
bundles/http_admin/http_admin/src/http_admin.h | 32 +-
bundles/http_admin/http_admin/src/service_tree.c | 32 +-
bundles/http_admin/http_admin/src/service_tree.h | 32 +-
.../http_admin/http_admin/src/websocket_admin.c | 34 +-
.../http_admin/http_admin/src/websocket_admin.h | 34 +-
.../http_admin_api/include/http_admin/api.h | 32 +-
.../include/http_admin/http_admin_info_service.h | 38 +-
.../include/http_admin/http_admin_service.h | 32 +-
.../include/http_admin/websocket_admin_service.h | 32 +-
bundles/logging/log_service/include/log_entry.h | 48 +-
bundles/logging/log_service/include/log_listener.h | 2 +-
.../log_service/include/log_reader_service.h | 13 +-
bundles/logging/log_service/include/log_service.h | 10 +-
.../log_service/loghelper_include/log_helper.h | 14 +-
bundles/logging/log_service/src/log.c | 543 +++++++++---------
bundles/logging/log_service/src/log.h | 18 +-
bundles/logging/log_service/src/log_entry.c | 52 +-
bundles/logging/log_service/src/log_factory.c | 16 +-
bundles/logging/log_service/src/log_factory.h | 9 +-
bundles/logging/log_service/src/log_helper.c | 20 +-
.../log_service/src/log_reader_service_impl.c | 16 +-
.../log_service/src/log_reader_service_impl.h | 12 +-
.../log_service/src/log_service_activator.c | 32 +-
bundles/logging/log_service/src/log_service_impl.c | 54 +-
bundles/logging/log_service/src/log_service_impl.h | 8 +-
.../subscriber/private/src/ps_sub_activator.c | 8 +-
.../pubsub_admin_tcp/src/pubsub_tcp_handler.c | 61 +-
.../pubsub_admin_tcp/src/pubsub_tcp_handler.h | 37 +-
.../pubsub_admin_tcp/src/pubsub_tcp_msg_header.h | 1 -
.../src/pubsub_tcp_topic_receiver.c | 6 +-
.../pubsub_admin_tcp/src/pubsub_tcp_topic_sender.c | 6 +-
bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.c | 24 +-
bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.h | 14 +-
.../src/pubsub_udpmc_topic_receiver.c | 2 +-
.../src/pubsub_udpmc_topic_sender.c | 2 +-
.../pubsub_discovery/src/pubsub_discovery_impl.c | 2 +-
.../pubsub_discovery/src/pubsub_discovery_impl.h | 4 +-
.../src/pubsub_serializer_impl.c | 8 +-
.../src/pubsub_serializer_impl.h | 2 +-
.../pubsub_topology_manager/src/pstm_activator.c | 4 +-
.../src/pubsub_topology_manager.c | 2 +-
.../src/pubsub_topology_manager.h | 6 +-
.../discovery_common/include/discovery.h | 78 +--
.../discovery_common/include/discovery_type.h | 3 +-
.../include/endpoint_descriptor_reader.h | 8 +-
.../include/endpoint_descriptor_writer.h | 8 +-
.../include/endpoint_discovery_poller.h | 15 +-
.../include/endpoint_discovery_server.h | 27 +-
.../discovery_common/src/discovery.c | 58 +-
.../discovery_common/src/discovery_activator.c | 24 +-
.../src/endpoint_descriptor_reader.c | 10 +-
.../src/endpoint_descriptor_writer.c | 41 +-
.../src/endpoint_discovery_poller.c | 32 +-
.../src/endpoint_discovery_server.c | 622 ++++++++++-----------
.../discovery_configured/src/discovery_impl.c | 8 +-
.../discovery_configured/src/discovery_impl.h | 10 +-
.../discovery_etcd/src/discovery_impl.c | 170 +++---
.../discovery_etcd/src/etcd_watcher.c | 43 +-
.../discovery_etcd/src/etcd_watcher.h | 5 +-
.../discovery_shm/src/discovery_impl.c | 10 +-
.../discovery_shm/src/discovery_shm.c | 24 +-
.../discovery_shm/src/discovery_shm.h | 18 +-
.../discovery_shm/src/discovery_shmWatcher.c | 20 +-
.../discovery_shm/src/discovery_shmWatcher.h | 5 +-
.../calculator_api/include/calculator_service.h | 12 +-
.../examples/calculator_service/CMakeLists.txt | 6 +-
.../calculator_service/src/calculator_activator.c | 129 ++---
.../calculator_service/src/calculator_impl.c | 93 +--
.../calculator_service/src/calculator_impl.h | 42 +-
.../examples/calculator_shell/src/add_command.c | 118 ++--
.../examples/calculator_shell/src/add_command.h | 34 +-
.../src/calculator_shell_activator.c | 161 +++---
.../examples/calculator_shell/src/sqrt_command.c | 112 ++--
.../examples/calculator_shell/src/sqrt_command.h | 34 +-
.../examples/calculator_shell/src/sub_command.c | 118 ++--
.../examples/calculator_shell/src/sub_command.h | 34 +-
.../remote_service_admin_dfi/src/dfi_utils.c | 8 +-
.../remote_service_admin_dfi/src/dfi_utils.h | 4 +-
.../src/export_registration_dfi.c | 72 +--
.../src/export_registration_dfi.h | 12 +-
.../src/import_registration_dfi.c | 50 +-
.../src/import_registration_dfi.h | 20 +-
.../src/remote_service_admin_activator.c | 16 +-
.../src/remote_service_admin_dfi.c | 64 +--
.../src/remote_service_admin_dfi.h | 30 +-
.../test/src/rsa_client_server_tests.cpp | 12 +-
.../test/src/rsa_tests.cpp | 18 +-
.../test/src/tst_activator.c | 18 +-
.../test/src/tst_service.h | 2 +-
.../include/remote_service_admin_shm_impl.h | 42 +-
.../private/src/remote_service_admin_activator.c | 16 +-
.../private/src/remote_service_admin_impl.c | 74 +--
.../private/test/rsa_client_server_tests.cpp | 28 +-
.../rsa_common/src/endpoint_description.c | 6 +-
.../rsa_common/src/export_registration_impl.c | 40 +-
.../rsa_common/src/export_registration_impl.h | 30 +-
.../rsa_common/src/import_registration_impl.c | 36 +-
.../rsa_common/src/import_registration_impl.h | 47 +-
.../rsa_common/src/remote_proxy_factory_impl.c | 20 +-
.../rsa_common/src/remote_service_admin_impl.h | 20 +-
.../rsa_spi/include/endpoint_description.h | 5 +-
.../rsa_spi/include/endpoint_listener.h | 39 +-
.../rsa_spi/include/export_registration.h | 14 +-
.../rsa_spi/include/import_registration.h | 14 +-
.../rsa_spi/include/remote_endpoint.h | 9 +-
.../remote_services/rsa_spi/include/remote_proxy.h | 30 +-
.../rsa_spi/include/remote_service_admin.h | 41 +-
.../topology_manager/src/activator.c | 38 +-
.../remote_services/topology_manager/src/scope.c | 2 +-
.../remote_services/topology_manager/src/scope.h | 2 +-
.../topology_manager/src/topology_manager.c | 84 +--
.../topology_manager/src/topology_manager.h | 6 +-
.../tms_tst/bundle/tst_activator.c | 20 +-
.../topology_manager/tms_tst/bundle/tst_service.h | 2 +-
.../tms_tst/disc_mock/disc_mock_activator.c | 18 +-
.../tms_tst/disc_mock/disc_mock_service.c | 39 +-
.../tms_tst/disc_mock/disc_mock_service.h | 28 +-
.../topology_manager/tms_tst/tms_tests.cpp | 36 +-
bundles/shell/remote_shell/src/activator.c | 2 +-
.../shell/remote_shell/src/connection_listener.c | 326 +++++------
bundles/shell/remote_shell/src/remote_shell.h | 2 +-
bundles/shell/remote_shell/src/shell_mediator.h | 3 +-
bundles/shell/shell/include/command.h | 38 +-
bundles/shell/shell/src/log_command.c | 11 +-
bundles/shell/shell/src/shell_private.h | 2 +-
.../log_service_example/src/activator.c | 2 +-
libs/framework/include/bundle_listener.h | 2 +-
libs/framework/include/framework_listener.h | 3 +-
libs/framework/include/service_registration.h | 2 +-
145 files changed, 2788 insertions(+), 2815 deletions(-)
diff --git a/bundles/deployment_admin/src/deployment_admin.c b/bundles/deployment_admin/src/deployment_admin.c
index 9717ee8..d1f66ca 100644
--- a/bundles/deployment_admin/src/deployment_admin.c
+++ b/bundles/deployment_admin/src/deployment_admin.c
@@ -137,7 +137,7 @@ celix_status_t deploymentAdmin_create(bundle_context_pt context, deployment_admi
(*admin)->auditlogUrl = strdup(auditlogUrl);
// log_store_pt store = NULL;
-// log_pt log = NULL;
+// log_t *log = NULL;
// log_sync_pt sync = NULL;
// logStore_create(subpool, &store);
// log_create(subpool, store, &log);
diff --git a/bundles/deployment_admin/src/log.c b/bundles/deployment_admin/src/log.c
index 98e757d..551dd86 100644
--- a/bundles/deployment_admin/src/log.c
+++ b/bundles/deployment_admin/src/log.c
@@ -36,7 +36,7 @@ struct log {
log_store_pt logStore;
};
-celix_status_t log_create(log_store_pt store, log_pt *log) {
+celix_status_t log_create(log_store_pt store, log_t **log) {
celix_status_t status = CELIX_SUCCESS;
*log = calloc(1, sizeof(**log));
@@ -49,12 +49,12 @@ celix_status_t log_create(log_store_pt store, log_pt *log) {
return status;
}
-celix_status_t log_destroy(log_pt *log) {
+celix_status_t log_destroy(log_t **log) {
free(*log);
return CELIX_SUCCESS;
}
-celix_status_t log_log(log_pt log, unsigned int type, properties_pt properties) {
+celix_status_t log_log(log_t *log, unsigned int type, properties_pt properties) {
celix_status_t status;
log_event_pt event = NULL;
diff --git a/bundles/deployment_admin/src/log.h b/bundles/deployment_admin/src/log.h
index fa77911..bf8c770 100644
--- a/bundles/deployment_admin/src/log.h
+++ b/bundles/deployment_admin/src/log.h
@@ -33,10 +33,10 @@
#include "bundle_event.h"
#include "framework_event.h"
-typedef struct log *log_pt;
+typedef struct log log_t;
-celix_status_t log_create(log_store_pt store, log_pt *log);
-celix_status_t log_log(log_pt log, unsigned int type, properties_pt properties);
+celix_status_t log_create(log_store_pt store, log_t **log);
+celix_status_t log_log(log_t *log, unsigned int type, properties_pt properties);
celix_status_t log_bundleChanged(void * listener, bundle_event_pt event);
celix_status_t log_frameworkEvent(void * listener, framework_event_pt event);
diff --git a/bundles/device_access/device_access/src/activator.c b/bundles/device_access/device_access/src/activator.c
index 007e725..6954296 100644
--- a/bundles/device_access/device_access/src/activator.c
+++ b/bundles/device_access/device_access/src/activator.c
@@ -36,7 +36,7 @@
#include "log_helper.h"
struct device_manager_bundle_instance {
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
bundle_context_pt context;
device_manager_pt deviceManager;
service_tracker_pt driverLocatorTracker;
diff --git a/bundles/device_access/device_access/src/device_manager.c b/bundles/device_access/device_access/src/device_manager.c
index 6e7cfd9..e326013 100644
--- a/bundles/device_access/device_access/src/device_manager.c
+++ b/bundles/device_access/device_access/src/device_manager.c
@@ -49,14 +49,14 @@ struct device_manager {
hash_map_pt drivers;
array_list_pt locators;
driver_selector_service_pt selector;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
};
static celix_status_t deviceManager_attachAlgorithm(device_manager_pt manager, service_reference_pt ref, void *service);
static celix_status_t deviceManager_getIdleDevices(device_manager_pt manager, array_list_pt *idleDevices);
static celix_status_t deviceManager_isDriverBundle(device_manager_pt manager, bundle_pt bundle, bool *isDriver);
-celix_status_t deviceManager_create(bundle_context_pt context, log_helper_pt logHelper, device_manager_pt *manager) {
+celix_status_t deviceManager_create(bundle_context_pt context, log_helper_t *logHelper, device_manager_pt *manager) {
celix_status_t status = CELIX_SUCCESS;
*manager = calloc(1, sizeof(**manager));
diff --git a/bundles/device_access/device_access/src/device_manager.h b/bundles/device_access/device_access/src/device_manager.h
index 00a4f2c..8877cd0 100644
--- a/bundles/device_access/device_access/src/device_manager.h
+++ b/bundles/device_access/device_access/src/device_manager.h
@@ -32,7 +32,7 @@
typedef struct device_manager *device_manager_pt;
-celix_status_t deviceManager_create(bundle_context_pt context, log_helper_pt logHelper, device_manager_pt *manager);
+celix_status_t deviceManager_create(bundle_context_pt context, log_helper_t *logHelper, device_manager_pt *manager);
celix_status_t deviceManager_destroy(device_manager_pt manager);
celix_status_t deviceManager_matchAttachDriver(device_manager_pt manager, driver_loader_pt loader,
diff --git a/bundles/device_access/device_access/src/driver_matcher.c b/bundles/device_access/device_access/src/driver_matcher.c
index c7597d3..c294605 100644
--- a/bundles/device_access/device_access/src/driver_matcher.c
+++ b/bundles/device_access/device_access/src/driver_matcher.c
@@ -36,7 +36,7 @@
struct driver_matcher {
hash_map_pt attributes;
array_list_pt matches;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
bundle_context_pt context;
};
diff --git a/bundles/event_admin/event_admin/private/include/event_admin_impl.h b/bundles/event_admin/event_admin/private/include/event_admin_impl.h
index 56d3eae..11b9c0b 100644
--- a/bundles/event_admin/event_admin/private/include/event_admin_impl.h
+++ b/bundles/event_admin/event_admin/private/include/event_admin_impl.h
@@ -1,31 +1,32 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* event_admin_impl.h
*
- * \Created on: Jul 16, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \date Jul 16, 2013
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef EVENT_ADMIN_IMPL_H_
#define EVENT_ADMIN_IMPL_H_
+
#include <string.h>
#include "celix_errno.h"
#include "bundle_context.h"
@@ -43,19 +44,18 @@
#include "log_helper.h"
struct event_admin {
- hash_map_pt channels;
- array_list_pt event_handlers;
- bundle_context_pt context;
- log_helper_pt *loghelper;
+ hash_map_pt channels;
+ array_list_pt event_handlers;
+ bundle_context_pt context;
+ log_helper_t **loghelper;
};
-typedef struct channel *channel_t;
-struct channel {
- char *topic;
- hash_map_pt eventHandlers;///array list containing all listeners subscribed to the channel
- // hash_map_pt channels;
- // apr_thread_mutex_t *channelLock;
-};
+typedef struct channel {
+ char *topic;
+ hash_map_pt eventHandlers;///array list containing all listeners subscribed to the channel
+ // hash_map_pt channels;
+ // apr_thread_mutex_t *channelLock;
+} channel_t;
/**
* @desc Create event an event admin and put it in the event_admin parameter.
* @param apr_pool_t *pool. Pointer to the apr pool
@@ -108,10 +108,10 @@ celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, const
* @desc apr_pool_t *pool. a memory pool pointer.
* @desc event_handler_service_pt event_handler_service. The handler
* @desc char *topic the topic
- * @desc channel_t *channel. the top level channel.
+ * @desc channel_t **channel. the top level channel.
*/
celix_status_t eventAdmin_createEventChannelsByEventHandler(event_handler_service_pt event_handler_service,
- const char *topic, channel_t *channel);
+ const char *topic, channel_t **channel);
/**
* @desc mutex functions for the channels
* @param event_admin_pt event_admin. the event admin instance.
diff --git a/bundles/event_admin/event_admin/private/src/event_admin_activator.c b/bundles/event_admin/event_admin/private/src/event_admin_activator.c
index a5f8cb2..b444c23 100644
--- a/bundles/event_admin/event_admin/private/src/event_admin_activator.c
+++ b/bundles/event_admin/event_admin/private/src/event_admin_activator.c
@@ -19,9 +19,9 @@
/*
* activator.c
*
- * Created on: Jul 9, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \date Jul 9, 2013
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -32,105 +32,105 @@
struct activator {
- event_admin_service_pt event_admin_service;
- event_admin_pt event_admin;
- service_registration_pt registration;
- service_tracker_pt tracker;
- bundle_context_pt context;
- log_helper_pt loghelper;
+ event_admin_service_pt event_admin_service;
+ event_admin_pt event_admin;
+ service_registration_pt registration;
+ service_tracker_pt tracker;
+ bundle_context_pt context;
+ log_helper_t *loghelper;
};
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
-
- struct activator *activator;
- activator = calloc(1, sizeof(*activator));
-
- if(!activator) {
- status = CELIX_BUNDLE_EXCEPTION;
- }else {
- activator->registration = NULL;
- logHelper_create(context, &activator->loghelper);
-
- *userData = activator;
- event_admin_pt event_admin = NULL;
- event_admin_service_pt event_admin_service = NULL;
- status = eventAdmin_create(context, &event_admin);
- if(status == CELIX_SUCCESS){
- activator->event_admin = event_admin;
- event_admin_service = calloc(1, sizeof(event_admin_service));
- if(!event_admin_service){
- status = CELIX_ENOMEM;
- } else {
- event_admin->context = context;
- event_admin->loghelper = &activator->loghelper;
- event_admin_service->eventAdmin = event_admin;
- event_admin_service->postEvent = eventAdmin_postEvent;
- event_admin_service->sendEvent = eventAdmin_sendEvent;
- event_admin_service->createEvent = eventAdmin_createEvent;
- event_admin_service->containsProperty = eventAdmin_containsProperty;
- event_admin_service->event_equals = eventAdmin_event_equals;
- event_admin_service->getProperty = eventAdmin_getProperty;
- event_admin_service->getPropertyNames = eventAdmin_getPropertyNames;
- event_admin_service->getTopic = eventAdmin_getTopic;
- event_admin_service->hashCode = eventAdmin_hashCode;
- event_admin_service->matches = eventAdmin_matches;
- event_admin_service->toString = eventAdmin_toString;
-
- }
- }
- activator->event_admin_service = event_admin_service;
- }
-
-
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct activator *activator;
+ activator = calloc(1, sizeof(*activator));
+
+ if(!activator) {
+ status = CELIX_BUNDLE_EXCEPTION;
+ }else {
+ activator->registration = NULL;
+ logHelper_create(context, &activator->loghelper);
+
+ *userData = activator;
+ event_admin_pt event_admin = NULL;
+ event_admin_service_pt event_admin_service = NULL;
+ status = eventAdmin_create(context, &event_admin);
+ if(status == CELIX_SUCCESS){
+ activator->event_admin = event_admin;
+ event_admin_service = calloc(1, sizeof(event_admin_service));
+ if(!event_admin_service){
+ status = CELIX_ENOMEM;
+ } else {
+ event_admin->context = context;
+ event_admin->loghelper = &activator->loghelper;
+ event_admin_service->eventAdmin = event_admin;
+ event_admin_service->postEvent = eventAdmin_postEvent;
+ event_admin_service->sendEvent = eventAdmin_sendEvent;
+ event_admin_service->createEvent = eventAdmin_createEvent;
+ event_admin_service->containsProperty = eventAdmin_containsProperty;
+ event_admin_service->event_equals = eventAdmin_event_equals;
+ event_admin_service->getProperty = eventAdmin_getProperty;
+ event_admin_service->getPropertyNames = eventAdmin_getPropertyNames;
+ event_admin_service->getTopic = eventAdmin_getTopic;
+ event_admin_service->hashCode = eventAdmin_hashCode;
+ event_admin_service->matches = eventAdmin_matches;
+ event_admin_service->toString = eventAdmin_toString;
+
+ }
+ }
+ activator->event_admin_service = event_admin_service;
+ }
+
+
+ return status;
}
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
- event_admin_service_pt event_admin_service = NULL;
-
- if(status == CELIX_SUCCESS) {
- struct activator * data = (struct activator *) userData;
- service_tracker_customizer_pt cust = NULL;
- service_tracker_pt tracker = NULL;
- data->context = context;
-
- serviceTrackerCustomizer_create(data->event_admin_service->eventAdmin, eventAdmin_addingService, eventAdmin_addedService, eventAdmin_modifiedService, eventAdmin_removedService, &cust);
- serviceTracker_create(context, (char *) EVENT_HANDLER_SERVICE, cust, &tracker);
-
- data->tracker = tracker;
-
- serviceTracker_open(tracker);
- properties_pt properties = NULL;
- properties = properties_create();
- event_admin_service = activator->event_admin_service;
- bundleContext_registerService(context, (char *) EVENT_ADMIN_NAME, event_admin_service, properties, &activator->registration);
- logHelper_start(activator->loghelper);
- }
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator = userData;
+ event_admin_service_pt event_admin_service = NULL;
+
+ if(status == CELIX_SUCCESS) {
+ struct activator * data = (struct activator *) userData;
+ service_tracker_customizer_pt cust = NULL;
+ service_tracker_pt tracker = NULL;
+ data->context = context;
+
+ serviceTrackerCustomizer_create(data->event_admin_service->eventAdmin, eventAdmin_addingService, eventAdmin_addedService, eventAdmin_modifiedService, eventAdmin_removedService, &cust);
+ serviceTracker_create(context, (char *) EVENT_HANDLER_SERVICE, cust, &tracker);
+
+ data->tracker = tracker;
+
+ serviceTracker_open(tracker);
+ properties_pt properties = NULL;
+ properties = properties_create();
+ event_admin_service = activator->event_admin_service;
+ bundleContext_registerService(context, (char *) EVENT_ADMIN_NAME, event_admin_service, properties, &activator->registration);
+ logHelper_start(activator->loghelper);
+ }
+ return status;
}
celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator * data = userData;
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator * data = userData;
serviceRegistration_unregister(data->registration);
- serviceTracker_close(data->tracker);
- status = logHelper_stop(data->loghelper);
+ serviceTracker_close(data->tracker);
+ status = logHelper_stop(data->loghelper);
logHelper_destroy(&data->loghelper);
- return status;
+ return status;
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status = CELIX_SUCCESS;
//stop struct activator *activator = userData;
// free(activator);
- return status;
+ return status;
}
diff --git a/bundles/event_admin/event_admin/private/src/event_admin_impl.c b/bundles/event_admin/event_admin/private/src/event_admin_impl.c
index 790bd46..381792c 100644
--- a/bundles/event_admin/event_admin/private/src/event_admin_impl.c
+++ b/bundles/event_admin/event_admin/private/src/event_admin_impl.c
@@ -1,28 +1,29 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* event_admin_impl.c
*
- * Created on: Jul 24, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \date Jul 24, 2013
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
+
#include <stdlib.h>
#include "event_admin.h"
@@ -34,127 +35,127 @@
celix_status_t eventAdmin_create(bundle_context_pt context, event_admin_pt *event_admin){
- celix_status_t status = CELIX_SUCCESS;
- *event_admin = calloc(1,sizeof(**event_admin));
- if (!*event_admin) {
+ celix_status_t status = CELIX_SUCCESS;
+ *event_admin = calloc(1,sizeof(**event_admin));
+ if (!*event_admin) {
status = CELIX_ENOMEM;
} else {
(*event_admin)->channels = hashMap_create(utils_stringHash, utils_stringHash, utils_stringEquals, utils_stringEquals);
(*event_admin)->context =context;
status = arrayList_create(&(*event_admin)->event_handlers);
}
- return status;
+ return status;
}
celix_status_t eventAdmin_destroy(event_admin_pt *event_admin)
{
- celix_status_t status = CELIX_SUCCESS;
- //free(*event_admin);
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ //free(*event_admin);
+ return status;
}
celix_status_t eventAdmin_getEventHandlersByChannel(bundle_context_pt context, const char * serviceName, array_list_pt *eventHandlers) {
- celix_status_t status = CELIX_SUCCESS;
- //celix_status_t status = bundleContext_getServiceReferences(context, serviceName, NULL, eventHandlers);
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ //celix_status_t status = bundleContext_getServiceReferences(context, serviceName, NULL, eventHandlers);
+ return status;
}
celix_status_t eventAdmin_postEvent(event_admin_pt event_admin, event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status = CELIX_SUCCESS;
- const char *topic;
+ const char *topic;
eventAdmin_getTopic(&event, &topic);
- array_list_pt event_handlers;
- arrayList_create(&event_handlers);
- eventAdmin_lockHandlersList(event_admin, topic);
- eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
+ array_list_pt event_handlers;
+ arrayList_create(&event_handlers);
+ eventAdmin_lockHandlersList(event_admin, topic);
+ eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
// TODO make this async!
- array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
- while (arrayListIterator_hasNext(handlers_iterator)) {
- event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (POST EVENT) for %s", topic);
- event_handler_service->handle_event(&event_handler_service->event_handler, event);
- }
- eventAdmin_releaseHandersList(event_admin, topic);
- return status;
+ array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
+ while (arrayListIterator_hasNext(handlers_iterator)) {
+ event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (POST EVENT) for %s", topic);
+ event_handler_service->handle_event(&event_handler_service->event_handler, event);
+ }
+ eventAdmin_releaseHandersList(event_admin, topic);
+ return status;
}
celix_status_t eventAdmin_sendEvent(event_admin_pt event_admin, event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
-
- const char *topic;
- eventAdmin_getTopic(&event, &topic);
-
- array_list_pt event_handlers;
- arrayList_create(&event_handlers);
- eventAdmin_lockHandlersList(event_admin, topic);
- eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
- array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
- while (arrayListIterator_hasNext(handlers_iterator)) {
- event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (SEND EVENT) for %s", topic);
- event_handler_service->handle_event(&event_handler_service->event_handler, event);
- }
- eventAdmin_releaseHandersList(event_admin, topic);
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+
+ const char *topic;
+ eventAdmin_getTopic(&event, &topic);
+
+ array_list_pt event_handlers;
+ arrayList_create(&event_handlers);
+ eventAdmin_lockHandlersList(event_admin, topic);
+ eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
+ array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
+ while (arrayListIterator_hasNext(handlers_iterator)) {
+ event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (SEND EVENT) for %s", topic);
+ event_handler_service->handle_event(&event_handler_service->event_handler, event);
+ }
+ eventAdmin_releaseHandersList(event_admin, topic);
+ return status;
}
celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, const char *topic,
- array_list_pt event_handlers) {
- celix_status_t status = CELIX_SUCCESS;
- hash_map_pt channels = event_admin->channels;
- channel_t channel = hashMap_get(channels, topic);
- if (channel != NULL) {
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "found channel: %s", topic);
- if (channel->eventHandlers != NULL && !hashMap_isEmpty(channel->eventHandlers)) {
- // iterate through the handlers and add them to the array list for result.
- hash_map_iterator_pt hashmap_iterator = hashMapIterator_create(channel->eventHandlers);
- while (hashMapIterator_hasNext(hashmap_iterator)) {
- arrayList_add(event_handlers, (event_handler_service_pt) hashMapIterator_nextValue(hashmap_iterator));
- }
- }
- } else {
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_WARNING, "no such channel: %s", topic);
- }
- return status;
+ array_list_pt event_handlers) {
+ celix_status_t status = CELIX_SUCCESS;
+ hash_map_pt channels = event_admin->channels;
+ channel_t *channel = hashMap_get(channels, topic);
+ if (channel != NULL) {
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "found channel: %s", topic);
+ if (channel->eventHandlers != NULL && !hashMap_isEmpty(channel->eventHandlers)) {
+ // iterate through the handlers and add them to the array list for result.
+ hash_map_iterator_pt hashmap_iterator = hashMapIterator_create(channel->eventHandlers);
+ while (hashMapIterator_hasNext(hashmap_iterator)) {
+ arrayList_add(event_handlers, (event_handler_service_pt) hashMapIterator_nextValue(hashmap_iterator));
+ }
+ }
+ } else {
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_WARNING, "no such channel: %s", topic);
+ }
+ return status;
}
celix_status_t eventAdmin_createEventChannels(event_admin_pt *event_admin, const char *topic,
- event_handler_service_pt event_handler_service) {
- celix_status_t status = CELIX_SUCCESS;
- channel_t channel = hashMap_get((*event_admin)->channels, topic);
- if (channel == NULL) {
- //create channel
- logHelper_log(*(*event_admin)->loghelper, OSGI_LOGSERVICE_ERROR, "Creating channel: %s", topic);
+ event_handler_service_pt event_handler_service) {
+ celix_status_t status = CELIX_SUCCESS;
+ channel_t *channel = hashMap_get((*event_admin)->channels, topic);
+ if (channel == NULL) {
+ //create channel
+ logHelper_log(*(*event_admin)->loghelper, OSGI_LOGSERVICE_ERROR, "Creating channel: %s", topic);
- channel = calloc(1, sizeof(*channel));
- if (!channel) {
+ channel = calloc(1, sizeof(*channel));
+ if (!channel) {
status = CELIX_ENOMEM;
} else {
char *channel_name = strdup(topic);
- channel->topic = channel_name;
- channel->eventHandlers = hashMap_create(NULL,NULL,NULL,NULL);
- //channel->channelLock = NULL;
+ channel->topic = channel_name;
+ channel->eventHandlers = hashMap_create(NULL,NULL,NULL,NULL);
+ //channel->channelLock = NULL;
// apr_thread_mutex_create(&channel->channelLock, APR_THREAD_MUTEX_NESTED, subPool);
- hashMap_put((*event_admin)->channels, channel_name, channel);
- }
+ hashMap_put((*event_admin)->channels, channel_name, channel);
+ }
}
if (channel) {
hashMap_put(channel->eventHandlers, &event_handler_service, event_handler_service);
}
- return status;
+ return status;
}
celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, const char *topic) {
- celix_status_t status = CELIX_SUCCESS;
- /*channel_t channel = hashMap_get(event_admin->channels, topic);
- if (channel != NULL) {
+ celix_status_t status = CELIX_SUCCESS;
+ /*channel_t *channel = hashMap_get(event_admin->channels, topic);
+ if (channel != NULL) {
// TODO verify this will never deadlock...
// apr_status_t status;
do {
@@ -162,51 +163,51 @@ celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, const cha
} while (status != 0 && !APR_STATUS_IS_EBUSY(status));
logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "LOCK: %s!", topic);
}*/
- return status;
+ return status;
}
celix_status_t eventAdmin_releaseHandersList(event_admin_pt event_admin, const char *topic) {
- celix_status_t status = CELIX_SUCCESS;
- channel_t channel = hashMap_get(event_admin->channels, topic);
- if (channel != NULL) {
+ celix_status_t status = CELIX_SUCCESS;
+ channel_t *channel = hashMap_get(event_admin->channels, topic);
+ if (channel != NULL) {
// TODO check the result value...
// apr_thread_mutex_unlock(channel->channelLock);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "UNLOCK: %s!", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "UNLOCK: %s!", topic);
}
- return status;
+ return status;
}
celix_status_t eventAdmin_addingService(void * handle, service_reference_pt ref, void **service) {
- celix_status_t status = CELIX_SUCCESS;
- event_admin_pt event_admin = handle;
- status = bundleContext_getService(event_admin->context, ref, service);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "test");
- printf("eventadmin adding service \n");
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ event_admin_pt event_admin = handle;
+ status = bundleContext_getService(event_admin->context, ref, service);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "test");
+ printf("eventadmin adding service \n");
+ return status;
}
celix_status_t eventAdmin_addedService(void * handle, service_reference_pt ref, void * service) {
- celix_status_t status = CELIX_SUCCESS;
- event_admin_pt event_admin = handle;
- event_handler_service_pt event_handler_service = NULL;
- event_handler_service = (event_handler_service_pt) service;
- const char *topic = NULL;
- serviceReference_getProperty(ref, (char*)EVENT_TOPIC, &topic);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Original TOPIC: %s", topic);
- printf("original topic: %s\n", topic);
- eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ event_admin_pt event_admin = handle;
+ event_handler_service_pt event_handler_service = NULL;
+ event_handler_service = (event_handler_service_pt) service;
+ const char *topic = NULL;
+ serviceReference_getProperty(ref, (char*)EVENT_TOPIC, &topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Original TOPIC: %s", topic);
+ printf("original topic: %s\n", topic);
+ eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
+ return status;
}
celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service) {
- event_admin_pt event_admin = (event_admin_pt) handle;
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Modified");
- return CELIX_SUCCESS;
+ event_admin_pt event_admin = (event_admin_pt) handle;
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Modified");
+ return CELIX_SUCCESS;
}
celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) {
- event_admin_pt event_admin = (event_admin_pt) handle;
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Removed %p", service);
- printf("Event admin Removed %p", service);
- return CELIX_SUCCESS;
+ event_admin_pt event_admin = (event_admin_pt) handle;
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Removed %p", service);
+ printf("Event admin Removed %p", service);
+ return CELIX_SUCCESS;
}
diff --git a/bundles/event_admin/event_handler/CMakeLists.txt b/bundles/event_admin/event_handler/CMakeLists.txt
index ed08d94..3acb4bd 100644
--- a/bundles/event_admin/event_handler/CMakeLists.txt
+++ b/bundles/event_admin/event_handler/CMakeLists.txt
@@ -24,11 +24,11 @@ include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
add_celix_bundle(event_handler
VERSION 0.0.0
- GROUP "Celix/EventAdmin"
- SOURCES
- private/src/event_handler_activator.c
- private/src/event_handler_impl.c
- ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
+ GROUP "Celix/EventAdmin"
+ SOURCES
+ private/src/event_handler_activator.c
+ private/src/event_handler_impl.c
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
)
install_celix_bundle(event_handler)
diff --git a/bundles/event_admin/event_handler/private/src/event_handler_activator.c b/bundles/event_admin/event_handler/private/src/event_handler_activator.c
index d39cfd9..9232e6a 100644
--- a/bundles/event_admin/event_handler/private/src/event_handler_activator.c
+++ b/bundles/event_admin/event_handler/private/src/event_handler_activator.c
@@ -19,26 +19,25 @@
/*
* event_handler_activator.c
*
- * Created on: Jul 9, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \date Jul 9, 2013
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
-#include <stdlib.h>
-
+#include <stdlib.h>
#include "event_handler_impl.h"
static const char * const EVENT_HANDLER_NAME = "demo";
struct activator {
- event_handler_service_pt event_handler_service;
- service_registration_pt registration;
- service_tracker_pt eventAdminTracker;
+ event_handler_service_pt event_handler_service;
+ service_registration_pt registration;
+ service_tracker_pt eventAdminTracker;
};
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator;
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator;
activator = calloc(1, sizeof(*activator));
activator->registration = NULL;
@@ -55,8 +54,8 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
} else {
event_handler_service->event_handler = event_handler;
event_handler_service->handle_event = eventHandlerHandleEvent;
- }
- }
+ }
+ }
activator->event_handler_service = event_handler_service;
@@ -64,15 +63,15 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
}
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator = userData;
- properties_pt properties = NULL;
- properties = properties_create();
+ properties_pt properties = NULL;
+ properties = properties_create();
properties_set(properties, (char *) EVENT_HANDLER_SERVICE, (const char *) EVENT_HANDLER_NAME);
properties_set(properties, (char *) EVENT_TOPIC, (const char *) "log/error/eventpublishers/event");
- event_handler_service_pt event_handler_service = activator->event_handler_service;
+ event_handler_service_pt event_handler_service = activator->event_handler_service;
bundleContext_registerService(context, (const char *) EVENT_HANDLER_SERVICE, event_handler_service, properties,
&activator->registration);
@@ -84,21 +83,21 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
activator->eventAdminTracker = tracker;
serviceTracker_open(tracker);
}*/
- return status;
+ return status;
}
celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status = CELIX_SUCCESS;
struct activator *data = userData;
serviceRegistration_unregister(data->registration);
//serviceTracker_close(data->tracker);
//status = logHelper_stop(data->loghelper);
//logHelper_destroy(&data->loghelper);
- return status;
+ return status;
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ return status;
}
diff --git a/bundles/event_admin/event_handler/private/src/event_handler_impl.c b/bundles/event_admin/event_handler/private/src/event_handler_impl.c
index 52ff1b7..29df89d 100644
--- a/bundles/event_admin/event_handler/private/src/event_handler_impl.c
+++ b/bundles/event_admin/event_handler/private/src/event_handler_impl.c
@@ -31,7 +31,7 @@
struct event_handler {
event_admin_service_pt event_admin_service;
bundle_context_pt context;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
};
diff --git a/bundles/event_admin/event_publisher/private/include/event_publisher_impl.h b/bundles/event_admin/event_publisher/private/include/event_publisher_impl.h
index f38438e..44f39c9 100644
--- a/bundles/event_admin/event_publisher/private/include/event_publisher_impl.h
+++ b/bundles/event_admin/event_publisher/private/include/event_publisher_impl.h
@@ -48,7 +48,7 @@ struct event_publisher {
bool eventAdminAdded;
celix_thread_t sender;
bundle_context_pt context;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
};
/**
* @desc create the event publisher
diff --git a/bundles/http_admin/http_admin/src/activator.c b/bundles/http_admin/http_admin/src/activator.c
index ecdbbe0..c6eb7a4 100644
--- a/bundles/http_admin/http_admin/src/activator.c
+++ b/bundles/http_admin/http_admin/src/activator.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* activator.c
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
diff --git a/bundles/http_admin/http_admin/src/http_admin.c b/bundles/http_admin/http_admin/src/http_admin.c
index 84a7b1a..5f0fad4 100755
--- a/bundles/http_admin/http_admin/src/http_admin.c
+++ b/bundles/http_admin/http_admin/src/http_admin.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* http_admin.c
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
diff --git a/bundles/http_admin/http_admin/src/http_admin.h b/bundles/http_admin/http_admin/src/http_admin.h
index 3d282a0..362fd03 100644
--- a/bundles/http_admin/http_admin/src/http_admin.h
+++ b/bundles/http_admin/http_admin/src/http_admin.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* http_admin.h
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef CELIX_HTTP_ADMIN_H
diff --git a/bundles/http_admin/http_admin/src/service_tree.c b/bundles/http_admin/http_admin/src/service_tree.c
index 122b50b..8225cfb 100644
--- a/bundles/http_admin/http_admin/src/service_tree.c
+++ b/bundles/http_admin/http_admin/src/service_tree.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* service_tree.c
*
* \date Jun 19, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
diff --git a/bundles/http_admin/http_admin/src/service_tree.h b/bundles/http_admin/http_admin/src/service_tree.h
index 4f4ff9d..038828b 100644
--- a/bundles/http_admin/http_admin/src/service_tree.h
+++ b/bundles/http_admin/http_admin/src/service_tree.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* service_tree.h
*
* \date Jun 19, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef SERVICE_TREE_H
diff --git a/bundles/http_admin/http_admin/src/websocket_admin.c b/bundles/http_admin/http_admin/src/websocket_admin.c
index 3c3cc26..aee8b50 100644
--- a/bundles/http_admin/http_admin/src/websocket_admin.c
+++ b/bundles/http_admin/http_admin/src/websocket_admin.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* websocket_admin.c
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -49,7 +49,7 @@ struct websocket_admin_manager {
};
-websocket_admin_manager_t *websocketAdmin_create(bundle_context_pt context, struct mg_context *svr_ctx) {
+websocket_admin_manager_t *websocketAdmin_create(celix_bundle_context_t *context, struct mg_context *svr_ctx) {
celix_status_t status;
websocket_admin_manager_t *admin = (websocket_admin_manager_t *) calloc(1, sizeof(websocket_admin_manager_t));
diff --git a/bundles/http_admin/http_admin/src/websocket_admin.h b/bundles/http_admin/http_admin/src/websocket_admin.h
index ee36ef0..5265d62 100644
--- a/bundles/http_admin/http_admin/src/websocket_admin.h
+++ b/bundles/http_admin/http_admin/src/websocket_admin.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* websocket_admin.h
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef CELIX_WEBSOCKET_ADMIN_H
@@ -33,7 +33,7 @@
typedef struct websocket_admin_manager websocket_admin_manager_t;
-websocket_admin_manager_t *websocketAdmin_create(bundle_context_pt context, struct mg_context *svr_ctx);
+websocket_admin_manager_t *websocketAdmin_create(celix_bundle_context_t *context, struct mg_context *svr_ctx);
void websocketAdmin_destroy(websocket_admin_manager_t *admin);
diff --git a/bundles/http_admin/http_admin_api/include/http_admin/api.h b/bundles/http_admin/http_admin_api/include/http_admin/api.h
index f0ec1b9..c0c41b0 100644
--- a/bundles/http_admin/http_admin_api/include/http_admin/api.h
+++ b/bundles/http_admin/http_admin_api/include/http_admin/api.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* api.h
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef HTTP_ADMIN_API_H
diff --git a/bundles/http_admin/http_admin_api/include/http_admin/http_admin_info_service.h b/bundles/http_admin/http_admin_api/include/http_admin/http_admin_info_service.h
index d2fd22f..7831074 100644
--- a/bundles/http_admin/http_admin_api/include/http_admin/http_admin_info_service.h
+++ b/bundles/http_admin/http_admin_api/include/http_admin/http_admin_info_service.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* http_admin_info_service.h
*
* \date Jun 28, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef HTTP_ADMIN_INFO_SERVICE_H
@@ -29,18 +29,18 @@
#include <stdlib.h>
-#define HTTP_ADMIN_INFO_SERVICE_NAME "http_admin_info_service"
+#define HTTP_ADMIN_INFO_SERVICE_NAME "http_admin_info_service"
/**
* Listening port of the HTTP Admin
*/
-#define HTTP_ADMIN_INFO_PORT "http_admin_port"
+#define HTTP_ADMIN_INFO_PORT "http_admin_port"
/**
* available resources found by the HTTP Admin. Entries are comma separated.
* Only present if there are available resources.
*/
-#define HTTP_ADMIN_INFO_RESOURCE_URLS "http_admin_resource_urls"
+#define HTTP_ADMIN_INFO_RESOURCE_URLS "http_admin_resource_urls"
/*
* Marker interface
diff --git a/bundles/http_admin/http_admin_api/include/http_admin/http_admin_service.h b/bundles/http_admin/http_admin_api/include/http_admin/http_admin_service.h
index 4a27bd3..19b0cef 100644
--- a/bundles/http_admin/http_admin_api/include/http_admin/http_admin_service.h
+++ b/bundles/http_admin/http_admin_api/include/http_admin/http_admin_service.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* http_admin_service.h
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef CELIX_HTTP_ADMIN_SERVICE_H
diff --git a/bundles/http_admin/http_admin_api/include/http_admin/websocket_admin_service.h b/bundles/http_admin/http_admin_api/include/http_admin/websocket_admin_service.h
index a49b09a..24ec309 100644
--- a/bundles/http_admin/http_admin_api/include/http_admin/websocket_admin_service.h
+++ b/bundles/http_admin/http_admin_api/include/http_admin/websocket_admin_service.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* websocket_admin_service.h
*
* \date May 24, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef CELIX_WEBSOCKET_ADMIN_SERVICE_H
diff --git a/bundles/logging/log_service/include/log_entry.h b/bundles/logging/log_service/include/log_entry.h
index ea12500..d6646b0 100644
--- a/bundles/logging/log_service/include/log_entry.h
+++ b/bundles/logging/log_service/include/log_entry.h
@@ -1,20 +1,20 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
#ifndef LOG_ENTRY_H_
@@ -32,18 +32,18 @@ struct log_entry {
char* bundleSymbolicName;
};
-typedef struct log_entry * log_entry_pt;
typedef struct log_entry log_entry_t;
+typedef struct log_entry *log_entry_pt CELIX_DEPRECATED_ATTR;
celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , service_reference_pt reference,
- log_level_t level, char *message, int errorCode,
- log_entry_pt *entry);
-celix_status_t logEntry_destroy(log_entry_pt *entry);
-celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, const char** bundleSymbolicName);
-celix_status_t logEntry_getBundleId(log_entry_pt entry, long *bundleId);
-celix_status_t logEntry_getErrorCode(log_entry_pt entry, int *errorCode);
-celix_status_t logEntry_getLevel(log_entry_pt entry, log_level_t *level);
-celix_status_t logEntry_getMessage(log_entry_pt entry, const char** message);
-celix_status_t logEntry_getTime(log_entry_pt entry, time_t *time);
+ log_level_t level, char *message, int errorCode,
+ log_entry_t **entry);
+celix_status_t logEntry_destroy(log_entry_t **entry);
+celix_status_t logEntry_getBundleSymbolicName(log_entry_t *entry, const char** bundleSymbolicName);
+celix_status_t logEntry_getBundleId(log_entry_t *entry, long *bundleId);
+celix_status_t logEntry_getErrorCode(log_entry_t *entry, int *errorCode);
+celix_status_t logEntry_getLevel(log_entry_t *entry, log_level_t *level);
+celix_status_t logEntry_getMessage(log_entry_t *entry, const char** message);
+celix_status_t logEntry_getTime(log_entry_t *entry, time_t *time);
#endif /* LOG_ENTRY_H_ */
diff --git a/bundles/logging/log_service/include/log_listener.h b/bundles/logging/log_service/include/log_listener.h
index 2f02300..ad46966 100644
--- a/bundles/logging/log_service/include/log_listener.h
+++ b/bundles/logging/log_service/include/log_listener.h
@@ -29,7 +29,7 @@ struct log_listener {
};
typedef struct log_listener log_listener_t;
-typedef struct log_listener *log_listener_pt;
+typedef struct log_listener *log_listener_pt CELIX_DEPRECATED_ATTR;
#endif /* LOG_LISTENER_H_ */
diff --git a/bundles/logging/log_service/include/log_reader_service.h b/bundles/logging/log_service/include/log_reader_service.h
index 37624ae..66a00cb 100644
--- a/bundles/logging/log_service/include/log_reader_service.h
+++ b/bundles/logging/log_service/include/log_reader_service.h
@@ -28,17 +28,16 @@
static const char * const OSGI_LOGSERVICE_READER_SERVICE_NAME = "log_reader_service";
typedef struct log_reader_data log_reader_data_t;
-typedef log_reader_data_t* log_reader_data_pt;
struct log_reader_service {
- log_reader_data_pt reader;
- celix_status_t (*getLog)(log_reader_data_pt reader, linked_list_pt *list);
- celix_status_t (*addLogListener)(log_reader_data_pt reader, log_listener_t *listener);
- celix_status_t (*removeLogListener)(log_reader_data_pt reader, log_listener_t *listener);
- celix_status_t (*removeAllLogListener)(log_reader_data_pt reader);
+ log_reader_data_t *reader;
+ celix_status_t (*getLog)(log_reader_data_t *reader, linked_list_pt *list);
+ celix_status_t (*addLogListener)(log_reader_data_t *reader, log_listener_t *listener);
+ celix_status_t (*removeLogListener)(log_reader_data_t *reader, log_listener_t *listener);
+ celix_status_t (*removeAllLogListener)(log_reader_data_t *reader);
};
-typedef struct log_reader_service * log_reader_service_pt;
typedef struct log_reader_service log_reader_service_t;
+typedef struct log_reader_service *log_reader_service_pt CELIX_DEPRECATED_ATTR;
#endif /* LOG_READER_SERVICE_H_ */
diff --git a/bundles/logging/log_service/include/log_service.h b/bundles/logging/log_service/include/log_service.h
index 51073e9..dadd6ce 100644
--- a/bundles/logging/log_service/include/log_service.h
+++ b/bundles/logging/log_service/include/log_service.h
@@ -26,7 +26,7 @@
static const char * const OSGI_LOGSERVICE_NAME = "log_service";
-typedef struct log_service_data *log_service_data_pt;
+typedef struct log_service_data log_service_data_t;
enum log_level
{
@@ -39,13 +39,13 @@ enum log_level
typedef enum log_level log_level_t;
struct log_service {
- log_service_data_pt logger;
- celix_status_t (*log)(log_service_data_pt logger, log_level_t level, char * message);
- celix_status_t (*logSr)(log_service_data_pt logger, service_reference_pt reference, log_level_t level, char * message);
+ log_service_data_t *logger;
+ celix_status_t (*log)(log_service_data_t *logger, log_level_t level, char *message);
+ celix_status_t (*logSr)(log_service_data_t *logger, service_reference_pt reference, log_level_t level, char *message);
};
typedef struct log_service log_service_t;
-typedef log_service_t* log_service_pt;
+typedef struct log_service *log_service_pt CELIX_DEPRECATED_ATTR;
diff --git a/bundles/logging/log_service/loghelper_include/log_helper.h b/bundles/logging/log_service/loghelper_include/log_helper.h
index 41b876a..8567b43 100644
--- a/bundles/logging/log_service/loghelper_include/log_helper.h
+++ b/bundles/logging/log_service/loghelper_include/log_helper.h
@@ -23,17 +23,19 @@
#include "bundle_context.h"
#include "log_service.h"
+
#ifdef __cplusplus
extern "C" {
#endif
+
typedef struct log_helper log_helper_t;
-typedef struct log_helper* log_helper_pt;
-celix_status_t logHelper_create(celix_bundle_context_t *context, log_helper_pt* log_helper);
-celix_status_t logHelper_start(log_helper_pt loghelper);
-celix_status_t logHelper_stop(log_helper_pt loghelper);
-celix_status_t logHelper_destroy(log_helper_pt* loghelper);
-celix_status_t logHelper_log(log_helper_pt loghelper, log_level_t level, const char* message, ... );
+celix_status_t logHelper_create(celix_bundle_context_t *context, log_helper_t **log_helper);
+celix_status_t logHelper_start(log_helper_t *loghelper);
+celix_status_t logHelper_stop(log_helper_t *loghelper);
+celix_status_t logHelper_destroy(log_helper_t **loghelper);
+celix_status_t logHelper_log(log_helper_t *loghelper, log_level_t level, const char* message, ... );
+
#ifdef __cplusplus
}
#endif
diff --git a/bundles/logging/log_service/src/log.c b/bundles/logging/log_service/src/log.c
index 5b29318..4d5a34a 100644
--- a/bundles/logging/log_service/src/log.c
+++ b/bundles/logging/log_service/src/log.c
@@ -1,27 +1,28 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* log.c
*
* \date Jun 26, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -30,345 +31,345 @@
#include "array_list.h"
struct log {
- linked_list_pt entries;
- celix_thread_mutex_t lock;
+ linked_list_pt entries;
+ celix_thread_mutex_t lock;
- array_list_pt listeners;
- array_list_pt listenerEntries;
+ array_list_pt listeners;
+ array_list_pt listenerEntries;
- celix_thread_t listenerThread;
- bool running;
+ celix_thread_t listenerThread;
+ bool running;
- celix_thread_cond_t entriesToDeliver;
- celix_thread_mutex_t deliverLock;
- celix_thread_mutex_t listenerLock;
+ celix_thread_cond_t entriesToDeliver;
+ celix_thread_mutex_t deliverLock;
+ celix_thread_mutex_t listenerLock;
- int max_size;
- bool store_debug;
+ int max_size;
+ bool store_debug;
};
-static celix_status_t log_startListenerThread(log_pt logger);
-static celix_status_t log_stopListenerThread(log_pt logger);
+static celix_status_t log_startListenerThread(log_t *logger);
+static celix_status_t log_stopListenerThread(log_t *logger);
static void *log_listenerThread(void *data);
-celix_status_t log_create(int max_size, bool store_debug, log_pt *logger) {
- celix_status_t status = CELIX_ENOMEM;
+celix_status_t log_create(int max_size, bool store_debug, log_t **logger) {
+ celix_status_t status = CELIX_ENOMEM;
- *logger = calloc(1, sizeof(**logger));
+ *logger = calloc(1, sizeof(**logger));
- if (*logger != NULL) {
- linkedList_create(&(*logger)->entries);
+ if (*logger != NULL) {
+ linkedList_create(&(*logger)->entries);
- status = celixThreadMutex_create(&(*logger)->lock, NULL);
+ status = celixThreadMutex_create(&(*logger)->lock, NULL);
- (*logger)->listeners = NULL;
- (*logger)->listenerEntries = NULL;
- (*logger)->listenerThread = celix_thread_default;
- (*logger)->running = false;
+ (*logger)->listeners = NULL;
+ (*logger)->listenerEntries = NULL;
+ (*logger)->listenerThread = celix_thread_default;
+ (*logger)->running = false;
- (*logger)->max_size = max_size;
- (*logger)->store_debug = store_debug;
+ (*logger)->max_size = max_size;
+ (*logger)->store_debug = store_debug;
- arrayList_create(&(*logger)->listeners);
- arrayList_create(&(*logger)->listenerEntries);
+ arrayList_create(&(*logger)->listeners);
+ arrayList_create(&(*logger)->listenerEntries);
- if (celixThreadCondition_init(&(*logger)->entriesToDeliver, NULL) != CELIX_SUCCESS) {
- status = CELIX_INVALID_SYNTAX;
- }
- else if (celixThreadMutex_create(&(*logger)->deliverLock, NULL) != CELIX_SUCCESS) {
- status = CELIX_INVALID_SYNTAX;
- }
- else if (celixThreadMutex_create(&(*logger)->listenerLock, NULL) != CELIX_SUCCESS) {
- status = CELIX_INVALID_SYNTAX;
- }
- else {
- status = CELIX_SUCCESS;
- }
- }
+ if (celixThreadCondition_init(&(*logger)->entriesToDeliver, NULL) != CELIX_SUCCESS) {
+ status = CELIX_INVALID_SYNTAX;
+ }
+ else if (celixThreadMutex_create(&(*logger)->deliverLock, NULL) != CELIX_SUCCESS) {
+ status = CELIX_INVALID_SYNTAX;
+ }
+ else if (celixThreadMutex_create(&(*logger)->listenerLock, NULL) != CELIX_SUCCESS) {
+ status = CELIX_INVALID_SYNTAX;
+ }
+ else {
+ status = CELIX_SUCCESS;
+ }
+ }
- return status;
+ return status;
}
-celix_status_t log_destroy(log_pt logger) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t log_destroy(log_t *logger) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ celixThreadMutex_destroy(&logger->listenerLock);
+ celixThreadMutex_destroy(&logger->deliverLock);
+ celixThreadCondition_destroy(&logger->entriesToDeliver);
+
+ arrayList_destroy(logger->listeners);
+ linked_list_iterator_pt iter = linkedListIterator_create(logger->entries, 0);
+ while (linkedListIterator_hasNext(iter)) {
+ log_entry_t *entry = linkedListIterator_next(iter);
+ if (arrayList_contains(logger->listenerEntries, entry)) {
+ arrayList_removeElement(logger->listenerEntries, entry);
+ }
+ logEntry_destroy(&entry);
+ }
+ linkedListIterator_destroy(iter);
- celixThreadMutex_destroy(&logger->listenerLock);
- celixThreadMutex_destroy(&logger->deliverLock);
- celixThreadCondition_destroy(&logger->entriesToDeliver);
+ array_list_iterator_pt entryIter = arrayListIterator_create(logger->listenerEntries);
- arrayList_destroy(logger->listeners);
- linked_list_iterator_pt iter = linkedListIterator_create(logger->entries, 0);
- while (linkedListIterator_hasNext(iter)) {
- log_entry_pt entry = linkedListIterator_next(iter);
- if (arrayList_contains(logger->listenerEntries, entry)) {
- arrayList_removeElement(logger->listenerEntries, entry);
- }
- logEntry_destroy(&entry);
- }
- linkedListIterator_destroy(iter);
+ while (arrayListIterator_hasNext(entryIter)) {
+ log_entry_t *entry = arrayListIterator_next(entryIter);
+ logEntry_destroy(&entry);
+ }
+ arrayListIterator_destroy(entryIter);
- array_list_iterator_pt entryIter = arrayListIterator_create(logger->listenerEntries);
+ arrayList_destroy(logger->listenerEntries);
+ linkedList_destroy(logger->entries);
- while (arrayListIterator_hasNext(entryIter)) {
- log_entry_pt entry = arrayListIterator_next(entryIter);
- logEntry_destroy(&entry);
- }
- arrayListIterator_destroy(entryIter);
+ celixThreadMutex_destroy(&logger->lock);
- arrayList_destroy(logger->listenerEntries);
- linkedList_destroy(logger->entries);
+ free(logger);
- celixThreadMutex_destroy(&logger->lock);
+ return status;
+}
- free(logger);
+celix_status_t log_addEntry(log_t *log, log_entry_t *entry) {
+ celixThreadMutex_lock(&log->lock);
- return status;
-}
+ if (log->max_size != 0) {
+ if (log->store_debug || entry->level != OSGI_LOGSERVICE_DEBUG) {
+ linkedList_addElement(log->entries, entry);
+ }
+ }
-celix_status_t log_addEntry(log_pt log, log_entry_pt entry) {
- celixThreadMutex_lock(&log->lock);
-
- if (log->max_size != 0) {
- if (log->store_debug || entry->level != OSGI_LOGSERVICE_DEBUG) {
- linkedList_addElement(log->entries, entry);
- }
- }
-
- celixThreadMutex_lock(&log->deliverLock);
- arrayList_add(log->listenerEntries, entry);
- celixThreadMutex_unlock(&log->deliverLock);
-
- celixThreadCondition_signal(&log->entriesToDeliver);
-
- if (log->max_size != 0) {
- if (log->max_size != -1) {
- if (linkedList_size(log->entries) > log->max_size) {
- log_entry_pt rentry = linkedList_removeFirst(log->entries);
- if (rentry) {
- celixThreadMutex_lock(&log->deliverLock);
- arrayList_removeElement(log->listenerEntries, rentry);
- logEntry_destroy(&rentry);
- celixThreadMutex_unlock(&log->deliverLock);
- }
- }
- }
- }
-
- celixThreadMutex_unlock(&log->lock);
-
- return CELIX_SUCCESS;
+ celixThreadMutex_lock(&log->deliverLock);
+ arrayList_add(log->listenerEntries, entry);
+ celixThreadMutex_unlock(&log->deliverLock);
+
+ celixThreadCondition_signal(&log->entriesToDeliver);
+
+ if (log->max_size != 0) {
+ if (log->max_size != -1) {
+ if (linkedList_size(log->entries) > log->max_size) {
+ log_entry_t *rentry = linkedList_removeFirst(log->entries);
+ if (rentry) {
+ celixThreadMutex_lock(&log->deliverLock);
+ arrayList_removeElement(log->listenerEntries, rentry);
+ logEntry_destroy(&rentry);
+ celixThreadMutex_unlock(&log->deliverLock);
+ }
+ }
+ }
+ }
+
+ celixThreadMutex_unlock(&log->lock);
+
+ return CELIX_SUCCESS;
}
-celix_status_t log_getEntries(log_pt log, linked_list_pt *list) {
- linked_list_pt entries = NULL;
- if (linkedList_create(&entries) == CELIX_SUCCESS) {
- linked_list_iterator_pt iter = NULL;
+celix_status_t log_getEntries(log_t *log, linked_list_pt *list) {
+ linked_list_pt entries = NULL;
+ if (linkedList_create(&entries) == CELIX_SUCCESS) {
+ linked_list_iterator_pt iter = NULL;
- celixThreadMutex_lock(&log->lock);
+ celixThreadMutex_lock(&log->lock);
- iter = linkedListIterator_create(log->entries, 0);
- while (linkedListIterator_hasNext(iter)) {
- linkedList_addElement(entries, linkedListIterator_next(iter));
- }
- linkedListIterator_destroy(iter);
+ iter = linkedListIterator_create(log->entries, 0);
+ while (linkedListIterator_hasNext(iter)) {
+ linkedList_addElement(entries, linkedListIterator_next(iter));
+ }
+ linkedListIterator_destroy(iter);
- *list = entries;
+ *list = entries;
- celixThreadMutex_unlock(&log->lock);
+ celixThreadMutex_unlock(&log->lock);
- return CELIX_SUCCESS;
- } else {
- return CELIX_ENOMEM;
- }
+ return CELIX_SUCCESS;
+ } else {
+ return CELIX_ENOMEM;
+ }
}
-celix_status_t log_bundleChanged(void *listener, bundle_event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
- log_pt logger = ((bundle_listener_pt) listener)->handle;
- log_entry_pt entry = NULL;
-
- int messagesLength = 10;
- char *messages[] = {
- "BUNDLE_EVENT_INSTALLED",
- "BUNDLE_EVENT_STARTED",
- "BUNDLE_EVENT_STOPPED",
- "BUNDLE_EVENT_UPDATED",
- "BUNDLE_EVENT_UNINSTALLED",
- "BUNDLE_EVENT_RESOLVED",
- "BUNDLE_EVENT_UNRESOLVED",
- "BUNDLE_EVENT_STARTING",
- "BUNDLE_EVENT_STOPPING",
- "BUNDLE_EVENT_LAZY_ACTIVATION"
- };
-
- char *message = NULL;
- int i = 0;
- for (i = 0; i < messagesLength; i++) {
- if (event->type >> i == 1) {
- message = messages[i];
- }
- }
-
- if (message != NULL) {
- status = logEntry_create(event->bundleId, event->bundleSymbolicName, NULL, OSGI_LOGSERVICE_INFO, message, 0, &entry);
- if (status == CELIX_SUCCESS) {
- status = log_addEntry(logger, entry);
- }
- }
-
- return status;
+celix_status_t log_bundleChanged(void *listener, celix_bundle_event_t *event) {
+ celix_status_t status = CELIX_SUCCESS;
+ log_t *logger = ((bundle_listener_t *) listener)->handle;
+ log_entry_t *entry = NULL;
+
+ int messagesLength = 10;
+ char *messages[] = {
+ "BUNDLE_EVENT_INSTALLED",
+ "BUNDLE_EVENT_STARTED",
+ "BUNDLE_EVENT_STOPPED",
+ "BUNDLE_EVENT_UPDATED",
+ "BUNDLE_EVENT_UNINSTALLED",
+ "BUNDLE_EVENT_RESOLVED",
+ "BUNDLE_EVENT_UNRESOLVED",
+ "BUNDLE_EVENT_STARTING",
+ "BUNDLE_EVENT_STOPPING",
+ "BUNDLE_EVENT_LAZY_ACTIVATION"
+ };
+
+ char *message = NULL;
+ int i = 0;
+ for (i = 0; i < messagesLength; i++) {
+ if (event->type >> i == 1) {
+ message = messages[i];
+ }
+ }
+
+ if (message != NULL) {
+ status = logEntry_create(event->bundleId, event->bundleSymbolicName, NULL, OSGI_LOGSERVICE_INFO, message, 0, &entry);
+ if (status == CELIX_SUCCESS) {
+ status = log_addEntry(logger, entry);
+ }
+ }
+
+ return status;
}
celix_status_t log_frameworkEvent(void *listener, framework_event_pt event) {
- celix_status_t status;
- log_pt logger = ((framework_listener_pt) listener)->handle;
- log_entry_pt entry = NULL;
+ celix_status_t status;
+ log_t *logger = ((framework_listener_pt) listener)->handle;
+ log_entry_t *entry = NULL;
- status = logEntry_create(event->bundleId, event->bundleSymbolicName, NULL, (event->type == OSGI_FRAMEWORK_EVENT_ERROR) ? OSGI_LOGSERVICE_ERROR : OSGI_LOGSERVICE_INFO, event->error, event->errorCode, &entry);
- if (status == CELIX_SUCCESS) {
- status = log_addEntry(logger, entry);
- }
+ status = logEntry_create(event->bundleId, event->bundleSymbolicName, NULL, (event->type == OSGI_FRAMEWORK_EVENT_ERROR) ? OSGI_LOGSERVICE_ERROR : OSGI_LOGSERVICE_INFO, event->error, event->errorCode, &entry);
+ if (status == CELIX_SUCCESS) {
+ status = log_addEntry(logger, entry);
+ }
- return status;
+ return status;
}
-celix_status_t log_addLogListener(log_pt logger, log_listener_pt listener) {
- celix_status_t status;
+celix_status_t log_addLogListener(log_t *logger, log_listener_t *listener) {
+ celix_status_t status;
- status = celixThreadMutex_lock(&logger->listenerLock);
+ status = celixThreadMutex_lock(&logger->listenerLock);
- if (status == CELIX_SUCCESS) {
- arrayList_add(logger->listeners, listener);
- log_startListenerThread(logger);
+ if (status == CELIX_SUCCESS) {
+ arrayList_add(logger->listeners, listener);
+ log_startListenerThread(logger);
- status = celixThreadMutex_unlock(&logger->listenerLock);
- }
+ status = celixThreadMutex_unlock(&logger->listenerLock);
+ }
- return status;
+ return status;
}
-celix_status_t log_removeLogListener(log_pt logger, log_listener_pt listener) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t log_removeLogListener(log_t *logger, log_listener_t *listener) {
+ celix_status_t status = CELIX_SUCCESS;
status += celixThreadMutex_lock(&logger->deliverLock);
status += celixThreadMutex_lock(&logger->listenerLock);
- if (status == CELIX_SUCCESS) {
- bool last = false;
+ if (status == CELIX_SUCCESS) {
+ bool last = false;
- arrayList_removeElement(logger->listeners, listener);
- if (arrayList_size(logger->listeners) == 0) {
- status = log_stopListenerThread(logger);
- last = true;
- }
+ arrayList_removeElement(logger->listeners, listener);
+ if (arrayList_size(logger->listeners) == 0) {
+ status = log_stopListenerThread(logger);
+ last = true;
+ }
status += celixThreadMutex_unlock(&logger->listenerLock);
status += celixThreadMutex_unlock(&logger->deliverLock);
- if (last) {
- status += celixThread_join(logger->listenerThread, NULL);
- }
- }
+ if (last) {
+ status += celixThread_join(logger->listenerThread, NULL);
+ }
+ }
- if (status != CELIX_SUCCESS) {
- status = CELIX_SERVICE_EXCEPTION;
- }
+ if (status != CELIX_SUCCESS) {
+ status = CELIX_SERVICE_EXCEPTION;
+ }
- return status;
+ return status;
}
-celix_status_t log_removeAllLogListener(log_pt logger) {
- celix_status_t status;
+celix_status_t log_removeAllLogListener(log_t *logger) {
+ celix_status_t status;
- status = celixThreadMutex_lock(&logger->listenerLock);
+ status = celixThreadMutex_lock(&logger->listenerLock);
if (status == CELIX_SUCCESS) {
- arrayList_clear(logger->listeners);
+ arrayList_clear(logger->listeners);
- status = celixThreadMutex_unlock(&logger->listenerLock);
+ status = celixThreadMutex_unlock(&logger->listenerLock);
}
- return status;
+ return status;
}
-static celix_status_t log_startListenerThread(log_pt logger) {
- celix_status_t status;
+static celix_status_t log_startListenerThread(log_t *logger) {
+ celix_status_t status;
- logger->running = true;
+ logger->running = true;
logger->running = true;
status = celixThread_create(&logger->listenerThread, NULL, log_listenerThread, logger);
- return status;
+ return status;
}
-static celix_status_t log_stopListenerThread(log_pt logger) {
- celix_status_t status;
+static celix_status_t log_stopListenerThread(log_t *logger) {
+ celix_status_t status;
- logger->running = false;
+ logger->running = false;
- status = celixThreadCondition_signal(&logger->entriesToDeliver);
+ status = celixThreadCondition_signal(&logger->entriesToDeliver);
- return status;
+ return status;
}
static void * log_listenerThread(void *data) {
- celix_status_t status = CELIX_SUCCESS;
-
- log_pt logger = data;
-
- while (logger->running) {
-
- status = celixThreadMutex_lock(&logger->deliverLock);
-
- if ( status != CELIX_SUCCESS) {
- logger->running = false;
- }
- else {
- if (!arrayList_isEmpty(logger->listenerEntries)) {
- log_entry_pt entry = (log_entry_pt) arrayList_remove(logger->listenerEntries, 0);
-
- if (entry) {
- status = celixThreadMutex_lock(&logger->listenerLock);
- if (status != CELIX_SUCCESS) {
- logger->running = false;
- break;
- } else {
- array_list_iterator_pt it = arrayListIterator_create(logger->listeners);
- while (arrayListIterator_hasNext(it)) {
- log_listener_pt listener = arrayListIterator_next(it);
- listener->logged(listener, entry);
- }
- arrayListIterator_destroy(it);
-
- // destroy not-stored entries
- if (!(logger->store_debug || entry->level != OSGI_LOGSERVICE_DEBUG)) {
- logEntry_destroy(&entry);
- }
-
- status = celixThreadMutex_unlock(&logger->listenerLock);
- if (status != CELIX_SUCCESS) {
- logger->running = false;
- break;
- }
- }
- }
- }
-
- if (arrayList_isEmpty(logger->listenerEntries) && logger->running) {
- celixThreadCondition_wait(&logger->entriesToDeliver, &logger->deliverLock);
- }
-
- status = celixThreadMutex_unlock(&logger->deliverLock);
-
- if (status != CELIX_SUCCESS) {
- logger->running = false;
- break;
- }
- }
-
- }
+ celix_status_t status = CELIX_SUCCESS;
+
+ log_t *logger = data;
+
+ while (logger->running) {
+
+ status = celixThreadMutex_lock(&logger->deliverLock);
+
+ if ( status != CELIX_SUCCESS) {
+ logger->running = false;
+ }
+ else {
+ if (!arrayList_isEmpty(logger->listenerEntries)) {
+ log_entry_t *entry = (log_entry_t *) arrayList_remove(logger->listenerEntries, 0);
+
+ if (entry) {
+ status = celixThreadMutex_lock(&logger->listenerLock);
+ if (status != CELIX_SUCCESS) {
+ logger->running = false;
+ break;
+ } else {
+ array_list_iterator_pt it = arrayListIterator_create(logger->listeners);
+ while (arrayListIterator_hasNext(it)) {
+ log_listener_t *listener = arrayListIterator_next(it);
+ listener->logged(listener, entry);
+ }
+ arrayListIterator_destroy(it);
+
+ // destroy not-stored entries
+ if (!(logger->store_debug || entry->level != OSGI_LOGSERVICE_DEBUG)) {
+ logEntry_destroy(&entry);
+ }
+
+ status = celixThreadMutex_unlock(&logger->listenerLock);
+ if (status != CELIX_SUCCESS) {
+ logger->running = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (arrayList_isEmpty(logger->listenerEntries) && logger->running) {
+ celixThreadCondition_wait(&logger->entriesToDeliver, &logger->deliverLock);
+ }
+
+ status = celixThreadMutex_unlock(&logger->deliverLock);
+
+ if (status != CELIX_SUCCESS) {
+ logger->running = false;
+ break;
+ }
+ }
+
+ }
celixThread_exit(NULL);
return NULL;
diff --git a/bundles/logging/log_service/src/log.h b/bundles/logging/log_service/src/log.h
index e0d7b87..dd82d5c 100644
--- a/bundles/logging/log_service/src/log.h
+++ b/bundles/logging/log_service/src/log.h
@@ -31,18 +31,18 @@
#include "log_entry.h"
#include "log_listener.h"
-typedef struct log * log_pt;
+typedef struct log log_t;
-celix_status_t log_create(int max_size, bool store_debug, log_pt *logger);
-celix_status_t log_destroy(log_pt logger);
-celix_status_t log_addEntry(log_pt log, log_entry_pt entry);
-celix_status_t log_getEntries(log_pt log, linked_list_pt *list);
+celix_status_t log_create(int max_size, bool store_debug, log_t **logger);
+celix_status_t log_destroy(log_t *logger);
+celix_status_t log_addEntry(log_t *log, log_entry_t *entry);
+celix_status_t log_getEntries(log_t *log, linked_list_pt *list);
-celix_status_t log_bundleChanged(void *listener, bundle_event_pt event);
+celix_status_t log_bundleChanged(void *listener, celix_bundle_event_t *event);
celix_status_t log_frameworkEvent(void *listener, framework_event_pt event);
-celix_status_t log_addLogListener(log_pt logger, log_listener_pt listener);
-celix_status_t log_removeLogListener(log_pt logger, log_listener_pt listener);
-celix_status_t log_removeAllLogListener(log_pt logger);
+celix_status_t log_addLogListener(log_t *logger, log_listener_t *listener);
+celix_status_t log_removeLogListener(log_t *logger, log_listener_t *listener);
+celix_status_t log_removeAllLogListener(log_t *logger);
#endif /* LOG_H_ */
diff --git a/bundles/logging/log_service/src/log_entry.c b/bundles/logging/log_service/src/log_entry.c
index 3a8603a..1eee5c1 100644
--- a/bundles/logging/log_service/src/log_entry.c
+++ b/bundles/logging/log_service/src/log_entry.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* log_entry.c
*
* \date Jun 26, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stddef.h>
@@ -33,8 +33,8 @@
#include "log_entry.h"
celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , service_reference_pt reference,
- log_level_t level, char *message, int errorCode,
- log_entry_pt *entry) {
+ log_level_t level, char *message, int errorCode,
+ log_entry_t **entry) {
celix_status_t status = CELIX_SUCCESS;
*entry = malloc(sizeof(**entry));
@@ -53,9 +53,9 @@ celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , s
return status;
}
-celix_status_t logEntry_destroy(log_entry_pt *entry) {
+celix_status_t logEntry_destroy(log_entry_t **entry) {
if (*entry) {
- free((*entry)->bundleSymbolicName);
+ free((*entry)->bundleSymbolicName);
free((*entry)->message);
free(*entry);
*entry = NULL;
@@ -63,32 +63,32 @@ celix_status_t logEntry_destroy(log_entry_pt *entry) {
return CELIX_SUCCESS;
}
-celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, const char** bundleSymbolicName) {
+celix_status_t logEntry_getBundleSymbolicName(log_entry_t *entry, const char** bundleSymbolicName) {
*bundleSymbolicName = entry->bundleSymbolicName;
return CELIX_SUCCESS;
}
-celix_status_t logEntry_getBundleId(log_entry_pt entry, long *bundleId) {
+celix_status_t logEntry_getBundleId(log_entry_t *entry, long *bundleId) {
*bundleId = entry->bundleId;
return CELIX_SUCCESS;
}
-celix_status_t logEntry_getErrorCode(log_entry_pt entry, int *errorCode) {
+celix_status_t logEntry_getErrorCode(log_entry_t *entry, int *errorCode) {
*errorCode = entry->errorCode;
return CELIX_SUCCESS;
}
-celix_status_t logEntry_getLevel(log_entry_pt entry, log_level_t *level) {
+celix_status_t logEntry_getLevel(log_entry_t *entry, log_level_t *level) {
*level = entry->level;
return CELIX_SUCCESS;
}
-celix_status_t logEntry_getMessage(log_entry_pt entry, const char **message) {
+celix_status_t logEntry_getMessage(log_entry_t *entry, const char **message) {
*message = entry->message;
return CELIX_SUCCESS;
}
-celix_status_t logEntry_getTime(log_entry_pt entry, time_t *time) {
+celix_status_t logEntry_getTime(log_entry_t *entry, time_t *time) {
*time = entry->time;
return CELIX_SUCCESS;
}
diff --git a/bundles/logging/log_service/src/log_factory.c b/bundles/logging/log_service/src/log_factory.c
index 1c0a17a..389618d 100644
--- a/bundles/logging/log_service/src/log_factory.c
+++ b/bundles/logging/log_service/src/log_factory.c
@@ -33,17 +33,17 @@
#include "log_service_impl.h"
struct log_service_factory {
- log_pt log;
+ log_t *log;
};
-celix_status_t logFactory_create(log_pt log, service_factory_pt *factory) {
+celix_status_t logFactory_create(log_t *log, service_factory_pt *factory) {
celix_status_t status = CELIX_SUCCESS;
*factory = calloc(1, sizeof(**factory));
if (*factory == NULL) {
status = CELIX_ENOMEM;
} else {
- log_service_factory_pt factoryData = calloc(1, sizeof(*factoryData));
+ log_service_factory_t *factoryData = calloc(1, sizeof(*factoryData));
if (factoryData == NULL) {
status = CELIX_ENOMEM;
} else {
@@ -72,9 +72,9 @@ celix_status_t logFactory_destroy(service_factory_pt *factory) {
celix_status_t logFactory_getService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service) {
- log_service_factory_pt log_factory = factory;
- log_service_pt log_service = NULL;
- log_service_data_pt log_service_data = NULL;
+ log_service_factory_t *log_factory = factory;
+ log_service_t *log_service = NULL;
+ log_service_data_t *log_service_data = NULL;
logService_create(log_factory->log, bundle, &log_service_data);
@@ -88,8 +88,8 @@ celix_status_t logFactory_getService(void *factory, bundle_pt bundle, service_re
return CELIX_SUCCESS;
}
-celix_status_t logFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service) {
- log_service_pt log_service = *service;
+celix_status_t logFactory_ungetService(void *factory, celix_bundle_t *bundle, service_registration_pt registration, void **service) {
+ log_service_t *log_service = *service;
logService_destroy(&log_service->logger);
diff --git a/bundles/logging/log_service/src/log_factory.h b/bundles/logging/log_service/src/log_factory.h
index 8ebe5f8..f022fe3 100644
--- a/bundles/logging/log_service/src/log_factory.h
+++ b/bundles/logging/log_service/src/log_factory.h
@@ -29,12 +29,13 @@
#include "log.h"
-typedef struct log_service_factory * log_service_factory_pt;
+typedef struct log_service_factory log_service_factory_t;
+typedef struct log_service_factory *log_service_factory_pt;
-celix_status_t logFactory_create(log_pt log, service_factory_pt *factory);
+celix_status_t logFactory_create(log_t *log, service_factory_pt *factory);
celix_status_t logFactory_destroy(service_factory_pt *factory);
-celix_status_t logFactory_getService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service);
-celix_status_t logFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service);
+celix_status_t logFactory_getService(void *factory, celix_bundle_t *bundle, service_registration_pt registration, void **service);
+celix_status_t logFactory_ungetService(void *factory, celix_bundle_t *bundle, service_registration_pt registration, void **service);
#endif /* LOG_FACTORY_H_ */
diff --git a/bundles/logging/log_service/src/log_helper.c b/bundles/logging/log_service/src/log_helper.c
index a0cb548..3ae0cfb 100644
--- a/bundles/logging/log_service/src/log_helper.c
+++ b/bundles/logging/log_service/src/log_helper.c
@@ -76,8 +76,8 @@ static char* logHelper_backtrace(void) {
#endif
struct log_helper {
- bundle_context_pt bundleContext;
- service_tracker_pt logServiceTracker;
+ celix_bundle_context_t *bundleContext;
+ celix_service_tracker_t *logServiceTracker;
celix_thread_mutex_t logListLock;
array_list_pt logServices;
bool stdOutFallback;
@@ -88,7 +88,7 @@ celix_status_t logHelper_logServiceAdded(void *handle, service_reference_pt refe
celix_status_t logHelper_logServiceRemoved(void *handle, service_reference_pt reference, void *service);
-celix_status_t logHelper_create(bundle_context_pt context, log_helper_pt* loghelper)
+celix_status_t logHelper_create(bundle_context_pt context, log_helper_t **loghelper)
{
celix_status_t status = CELIX_SUCCESS;
@@ -114,7 +114,7 @@ celix_status_t logHelper_create(bundle_context_pt context, log_helper_pt* loghel
return status;
}
-celix_status_t logHelper_start(log_helper_pt loghelper)
+celix_status_t logHelper_start(log_helper_t *loghelper)
{
celix_status_t status;
service_tracker_customizer_pt logTrackerCustomizer = NULL;
@@ -137,7 +137,7 @@ celix_status_t logHelper_start(log_helper_pt loghelper)
celix_status_t logHelper_logServiceAdded(void *handle, service_reference_pt reference, void *service)
{
- log_helper_pt loghelper = handle;
+ log_helper_t *loghelper = handle;
pthread_mutex_lock(&loghelper->logListLock);
arrayList_add(loghelper->logServices, service);
@@ -148,7 +148,7 @@ celix_status_t logHelper_logServiceAdded(void *handle, service_reference_pt refe
celix_status_t logHelper_logServiceRemoved(void *handle, service_reference_pt reference, void *service)
{
- log_helper_pt loghelper = handle;
+ log_helper_t *loghelper = handle;
pthread_mutex_lock(&loghelper->logListLock);
arrayList_removeElement(loghelper->logServices, service);
@@ -158,7 +158,7 @@ celix_status_t logHelper_logServiceRemoved(void *handle, service_reference_pt re
}
-celix_status_t logHelper_stop(log_helper_pt loghelper) {
+celix_status_t logHelper_stop(log_helper_t *loghelper) {
celix_status_t status;
status = serviceTracker_close(loghelper->logServiceTracker);
@@ -166,7 +166,7 @@ celix_status_t logHelper_stop(log_helper_pt loghelper) {
return status;
}
-celix_status_t logHelper_destroy(log_helper_pt* loghelper) {
+celix_status_t logHelper_destroy(log_helper_t **loghelper) {
celix_status_t status = CELIX_SUCCESS;
if((*loghelper)->logServiceTracker){
@@ -187,7 +187,7 @@ celix_status_t logHelper_destroy(log_helper_pt* loghelper) {
-celix_status_t logHelper_log(log_helper_pt loghelper, log_level_t level, const char* message, ... )
+celix_status_t logHelper_log(log_helper_t *loghelper, log_level_t level, const char* message, ... )
{
celix_status_t status = CELIX_SUCCESS;
va_list listPointer;
@@ -206,7 +206,7 @@ celix_status_t logHelper_log(log_helper_pt loghelper, log_level_t level, const c
int i = 0;
for (; i < arrayList_size(loghelper->logServices); i++) {
- log_service_pt logService = arrayList_get(loghelper->logServices, i);
+ log_service_t *logService = arrayList_get(loghelper->logServices, i);
if (logService != NULL) {
(logService->log)(logService->logger, level, msg); //TODO add backtrace to msg if the level is ERROR
if (level == OSGI_LOGSERVICE_ERROR) {
diff --git a/bundles/logging/log_service/src/log_reader_service_impl.c b/bundles/logging/log_service/src/log_reader_service_impl.c
index 2a46ea7..a82735f 100644
--- a/bundles/logging/log_service/src/log_reader_service_impl.c
+++ b/bundles/logging/log_service/src/log_reader_service_impl.c
@@ -31,13 +31,13 @@
#include "celixbool.h"
struct log_reader_data {
- log_pt log;
+ log_t *log;
};
-celix_status_t logReaderService_create(log_pt log, log_reader_data_pt *reader) {
+celix_status_t logReaderService_create(log_t *log, log_reader_data_t **reader) {
celix_status_t status = CELIX_SUCCESS;
- *reader = (log_reader_data_pt) calloc(1, sizeof(**reader));
+ *reader = (log_reader_data_t *) calloc(1, sizeof(**reader));
if (*reader == NULL) {
status = CELIX_ENOMEM;
@@ -48,7 +48,7 @@ celix_status_t logReaderService_create(log_pt log, log_reader_data_pt *reader) {
return status;
}
-celix_status_t logReaderService_destroy(log_reader_data_pt *reader) {
+celix_status_t logReaderService_destroy(log_reader_data_t **reader) {
celix_status_t status = CELIX_SUCCESS;
free(*reader);
@@ -59,7 +59,7 @@ celix_status_t logReaderService_destroy(log_reader_data_pt *reader) {
-celix_status_t logReaderService_getLog(log_reader_data_pt reader, linked_list_pt *list) {
+celix_status_t logReaderService_getLog(log_reader_data_t *reader, linked_list_pt *list) {
celix_status_t status = CELIX_SUCCESS;
status = log_getEntries(reader->log, list);
@@ -67,15 +67,15 @@ celix_status_t logReaderService_getLog(log_reader_data_pt reader, linked_list_pt
return status;
}
-celix_status_t logReaderService_addLogListener(log_reader_data_pt reader, log_listener_pt listener) {
+celix_status_t logReaderService_addLogListener(log_reader_data_t *reader, log_listener_t *listener) {
return log_addLogListener(reader->log, listener);
}
-celix_status_t logReaderService_removeLogListener(log_reader_data_pt reader, log_listener_pt listener) {
+celix_status_t logReaderService_removeLogListener(log_reader_data_t *reader, log_listener_t *listener) {
return log_removeLogListener(reader->log, listener);
}
-celix_status_t logReaderService_removeAllLogListener(log_reader_data_pt reader) {
+celix_status_t logReaderService_removeAllLogListener(log_reader_data_t *reader) {
return log_removeAllLogListener(reader->log);
}
diff --git a/bundles/logging/log_service/src/log_reader_service_impl.h b/bundles/logging/log_service/src/log_reader_service_impl.h
index 71829f2..ef9d666 100644
--- a/bundles/logging/log_service/src/log_reader_service_impl.h
+++ b/bundles/logging/log_service/src/log_reader_service_impl.h
@@ -30,14 +30,14 @@
#include "log_reader_service.h"
#include "log.h"
-celix_status_t logReaderService_create(log_pt log, log_reader_data_pt *reader);
-celix_status_t logReaderService_destroy(log_reader_data_pt *reader);
+celix_status_t logReaderService_create(log_t *log, log_reader_data_t **reader);
+celix_status_t logReaderService_destroy(log_reader_data_t **reader);
-celix_status_t logReaderService_getLog(log_reader_data_pt reader, linked_list_pt *list);
+celix_status_t logReaderService_getLog(log_reader_data_t *reader, linked_list_pt *list);
-celix_status_t logReaderService_addLogListener(log_reader_data_pt reader, log_listener_pt listener);
-celix_status_t logReaderService_removeLogListener(log_reader_data_pt reader, log_listener_pt listener);
-celix_status_t logReaderService_removeAllLogListener(log_reader_data_pt reader);
+celix_status_t logReaderService_addLogListener(log_reader_data_t *reader, log_listener_t *listener);
+celix_status_t logReaderService_removeLogListener(log_reader_data_t *reader, log_listener_t *listener);
+celix_status_t logReaderService_removeAllLogListener(log_reader_data_t *reader);
#endif /* LOG_READER_SERVICE_IMPL_H_ */
diff --git a/bundles/logging/log_service/src/log_service_activator.c b/bundles/logging/log_service/src/log_service_activator.c
index 8c72fb1..13a43b1 100644
--- a/bundles/logging/log_service/src/log_service_activator.c
+++ b/bundles/logging/log_service/src/log_service_activator.c
@@ -43,23 +43,23 @@
#define STORE_DEBUG_PROPERTY "CELIX_LOG_STORE_DEBUG"
struct logActivator {
- bundle_context_pt bundleContext;
- service_registration_pt logServiceFactoryReg;
- service_registration_pt logReaderServiceReg;
+ celix_bundle_context_t *bundleContext;
+ service_registration_t *logServiceFactoryReg;
+ service_registration_t *logReaderServiceReg;
- bundle_listener_pt bundleListener;
- framework_listener_pt frameworkListener;
+ bundle_listener_t *bundleListener;
+ framework_listener_t *frameworkListener;
- log_pt logger;
+ log_t *logger;
service_factory_pt factory;
- log_reader_data_pt reader;
- log_reader_service_pt reader_service;
+ log_reader_data_t *reader;
+ log_reader_service_t *reader_service;
};
static celix_status_t bundleActivator_getMaxSize(struct logActivator *activator, int *max_size);
static celix_status_t bundleActivator_getStoreDebug(struct logActivator *activator, bool *store_debug);
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
struct logActivator * activator = NULL;
@@ -83,7 +83,7 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
struct logActivator * activator = (struct logActivator *) userData;
celix_status_t status = CELIX_SUCCESS;
@@ -108,8 +108,8 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
logFactory_create(activator->logger, &activator->factory);
- properties_pt props = properties_create();
- properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+ celix_properties_t *props = celix_properties_create();
+ celix_properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
bundleContext_registerServiceFactory(context, (char *) OSGI_LOGSERVICE_NAME, activator->factory, props, &activator->logServiceFactoryReg);
@@ -123,15 +123,15 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
activator->reader_service->removeLogListener = logReaderService_removeLogListener;
activator->reader_service->removeAllLogListener = logReaderService_removeAllLogListener;
- props = properties_create();
- properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+ props = celix_properties_create();
+ celix_properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
bundleContext_registerService(context, (char *) OSGI_LOGSERVICE_READER_SERVICE_NAME, activator->reader_service, props, &activator->logReaderServiceReg);
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
struct logActivator * activator = (struct logActivator *) userData;
serviceRegistration_unregister(activator->logReaderServiceReg);
@@ -155,7 +155,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
struct logActivator * activator = (struct logActivator *) userData;
free(activator);
diff --git a/bundles/logging/log_service/src/log_service_impl.c b/bundles/logging/log_service/src/log_service_impl.c
index a77e9ad..70456b5 100644
--- a/bundles/logging/log_service/src/log_service_impl.c
+++ b/bundles/logging/log_service/src/log_service_impl.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* log_service_impl.c
*
* \date Jun 22, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -30,11 +30,11 @@
#include "bundle.h"
struct log_service_data {
- log_pt log;
- bundle_pt bundle;
+ log_t *log;
+ celix_bundle_t *bundle;
};
-celix_status_t logService_create(log_pt log, bundle_pt bundle, log_service_data_pt *logger) {
+celix_status_t logService_create(log_t *log, celix_bundle_t *bundle, log_service_data_t **logger) {
celix_status_t status = CELIX_SUCCESS;
*logger = calloc(1, sizeof(struct log_service_data));
if (*logger == NULL) {
@@ -47,7 +47,7 @@ celix_status_t logService_create(log_pt log, bundle_pt bundle, log_service_data_
return status;
}
-celix_status_t logService_destroy(log_service_data_pt *logger) {
+celix_status_t logService_destroy(log_service_data_t **logger) {
celix_status_t status = CELIX_SUCCESS;
free(*logger);
@@ -56,21 +56,21 @@ celix_status_t logService_destroy(log_service_data_pt *logger) {
return status;
}
-celix_status_t logService_log(log_service_data_pt logger, log_level_t level, char * message) {
+celix_status_t logService_log(log_service_data_t *logger, log_level_t level, char * message) {
return logService_logSr(logger, NULL, level, message);
}
-celix_status_t logService_logSr(log_service_data_pt logger, service_reference_pt reference, log_level_t level, char * message) {
+celix_status_t logService_logSr(log_service_data_t *logger, service_reference_pt reference, log_level_t level, char * message) {
celix_status_t status;
- log_entry_pt entry = NULL;
- bundle_pt bundle = logger->bundle;
+ log_entry_t *entry = NULL;
+ celix_bundle_t *bundle = logger->bundle;
bundle_archive_pt archive = NULL;
module_pt module = NULL;
const char *symbolicName = NULL;
long bundleId = -1;
if (reference != NULL) {
- serviceReference_getBundle(reference, &bundle);
+ serviceReference_getBundle(reference, &bundle);
}
status = bundle_getArchive(bundle, &archive);
@@ -88,8 +88,8 @@ celix_status_t logService_logSr(log_service_data_pt logger, service_reference_pt
}
if(status == CELIX_SUCCESS && symbolicName != NULL && message != NULL){
- status = logEntry_create(bundleId, symbolicName, reference, level, message, 0, &entry);
- log_addEntry(logger->log, entry);
+ status = logEntry_create(bundleId, symbolicName, reference, level, message, 0, &entry);
+ log_addEntry(logger->log, entry);
}
return status;
diff --git a/bundles/logging/log_service/src/log_service_impl.h b/bundles/logging/log_service/src/log_service_impl.h
index 04c986e..8067f83 100644
--- a/bundles/logging/log_service/src/log_service_impl.h
+++ b/bundles/logging/log_service/src/log_service_impl.h
@@ -30,10 +30,10 @@
#include "log_service.h"
#include "log.h"
-celix_status_t logService_create(log_pt log, bundle_pt bundle, log_service_data_pt *logger);
-celix_status_t logService_destroy(log_service_data_pt *logger);
-celix_status_t logService_log(log_service_data_pt logger, log_level_t level, char * message);
-celix_status_t logService_logSr(log_service_data_pt logger, service_reference_pt reference, log_level_t level, char * message);
+celix_status_t logService_create(log_t *log, celix_bundle_t *bundle, log_service_data_t **logger);
+celix_status_t logService_destroy(log_service_data_t **logger);
+celix_status_t logService_log(log_service_data_t *logger, log_level_t level, char * message);
+celix_status_t logService_logSr(log_service_data_t *logger, service_reference_pt reference, log_level_t level, char * message);
#endif /* LOG_SERVICE_IMPL_H_ */
diff --git a/bundles/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c b/bundles/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c
index 315ebc6..4fede54 100644
--- a/bundles/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c
+++ b/bundles/pubsub/examples/pubsub/subscriber/private/src/ps_sub_activator.c
@@ -43,14 +43,14 @@ struct subscriberActivator {
pubsub_subscriber_t *subsvc;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
struct subscriberActivator * act = calloc(1,sizeof(struct subscriberActivator));
*userData = act;
arrayList_create(&(act->registrationList));
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
struct subscriberActivator * act = (struct subscriberActivator *) userData;
pubsub_subscriber_t *subsvc = calloc(1,sizeof(*subsvc));
@@ -81,7 +81,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
struct subscriberActivator * act = (struct subscriberActivator *) userData;
int i;
@@ -96,7 +96,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
struct subscriberActivator * act = (struct subscriberActivator *) userData;
diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
index 011b9d5..4316dcd 100644
--- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
+++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
@@ -85,7 +85,7 @@ typedef struct pubsub_tcpBufferPartList {
pubsub_tcp_msg_header_t default_header;
unsigned int bufferSize;
char *buffer;
-} *pubsub_tcpBufferPartList_pt;
+} pubsub_tcpBufferPartList_t;
typedef struct psa_tcp_connection_entry {
@@ -95,16 +95,16 @@ typedef struct psa_tcp_connection_entry {
socklen_t len;
} psa_tcp_connection_entry_t;
-static inline int pubsub_tcpHandler_setInAddr(pubsub_tcpHandler_pt handle, const char *hostname, int port, struct sockaddr_in *inp);
-static inline int pubsub_tcpHandler_closeConnectionEntry(pubsub_tcpHandler_pt handle, psa_tcp_connection_entry_t *entry, bool lock);
-static inline int pubsub_tcpHandler_closeConnection(pubsub_tcpHandler_pt handle, int fd);
+static inline int pubsub_tcpHandler_setInAddr(pubsub_tcpHandler_t *handle, const char *hostname, int port, struct sockaddr_in *inp);
+static inline int pubsub_tcpHandler_closeConnectionEntry(pubsub_tcpHandler_t *handle, psa_tcp_connection_entry_t *entry, bool lock);
+static inline int pubsub_tcpHandler_closeConnection(pubsub_tcpHandler_t *handle, int fd);
//
// Create a handle
//
-pubsub_tcpHandler_pt pubsub_tcpHandler_create(log_helper_t *logHelper) {
- pubsub_tcpHandler_pt handle = calloc(sizeof(*handle), 1);
+pubsub_tcpHandler_t *pubsub_tcpHandler_create(log_helper_t *logHelper) {
+ pubsub_tcpHandler_t *handle = calloc(sizeof(*handle), 1);
if (handle != NULL) {
handle->fd = -1;
handle->efd = epoll_create1(0);
@@ -125,7 +125,7 @@ pubsub_tcpHandler_pt pubsub_tcpHandler_create(log_helper_t *logHelper) {
//
// Destroys the handle
//
-void pubsub_tcpHandler_destroy(pubsub_tcpHandler_pt handle) {
+void pubsub_tcpHandler_destroy(pubsub_tcpHandler_t *handle) {
printf("### Destroying BufferHandler TCP\n");
if (handle != NULL) {
celixThreadRwlock_writeLock(&handle->dbLock);
@@ -147,7 +147,7 @@ void pubsub_tcpHandler_destroy(pubsub_tcpHandler_pt handle) {
int listSize = arrayList_size(handle->bufferLists);
int i;
for (i = 0; i < listSize; i++) {
- pubsub_tcpBufferPartList_pt item = arrayList_get(handle->bufferLists, i);
+ pubsub_tcpBufferPartList_t *item = arrayList_get(handle->bufferLists, i);
if (item) {
if (item->buffer) {
free(item->buffer);
@@ -167,7 +167,7 @@ void pubsub_tcpHandler_destroy(pubsub_tcpHandler_pt handle) {
// Destroys the handle
//
-int pubsub_tcpHandler_open(pubsub_tcpHandler_pt handle, char *url) {
+int pubsub_tcpHandler_open(pubsub_tcpHandler_t *handle, char *url) {
int rc = 0;
celixThreadRwlock_readLock(&handle->dbLock);
int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -209,7 +209,7 @@ int pubsub_tcpHandler_open(pubsub_tcpHandler_pt handle, char *url) {
// Destroys the handle
//
-int pubsub_tcpHandler_close(pubsub_tcpHandler_pt handle) {
+int pubsub_tcpHandler_close(pubsub_tcpHandler_t *handle) {
int rc = 0;
if (handle != NULL) {
celixThreadRwlock_writeLock(&handle->dbLock);
@@ -234,7 +234,7 @@ int pubsub_tcpHandler_close(pubsub_tcpHandler_pt handle) {
return rc;
}
-int pubsub_tcpHandler_connect(pubsub_tcpHandler_pt handle, char *url) {
+int pubsub_tcpHandler_connect(pubsub_tcpHandler_t *handle, char *url) {
pubsub_tcpHandler_url_t url_info;
pubsub_tcpHandler_setUrlInfo(url, &url_info);
psa_tcp_connection_entry_t *entry = NULL;
@@ -295,7 +295,7 @@ int pubsub_tcpHandler_connect(pubsub_tcpHandler_pt handle, char *url) {
// Destroys the handle
//
-int pubsub_tcpHandler_disconnect(pubsub_tcpHandler_pt handle, char *url) {
+int pubsub_tcpHandler_disconnect(pubsub_tcpHandler_t *handle, char *url) {
int rc = 0;
if (handle != NULL) {
celixThreadRwlock_writeLock(&handle->dbLock);
@@ -309,8 +309,7 @@ int pubsub_tcpHandler_disconnect(pubsub_tcpHandler_pt handle, char *url) {
// Destroys the handle
//
-static inline
-int pubsub_tcpHandler_closeConnectionEntry(pubsub_tcpHandler_pt handle, psa_tcp_connection_entry_t *entry, bool lock) {
+static inline int pubsub_tcpHandler_closeConnectionEntry(pubsub_tcpHandler_t *handle, psa_tcp_connection_entry_t *entry, bool lock) {
int rc = 0;
if (handle != NULL && entry != NULL) {
fprintf(stdout, "[TCP Socket] Close connection to url: %s: \n", entry->url);
@@ -338,8 +337,7 @@ int pubsub_tcpHandler_closeConnectionEntry(pubsub_tcpHandler_pt handle, psa_tcp_
// Destroys the handle
//
-static inline
-int pubsub_tcpHandler_closeConnection(pubsub_tcpHandler_pt handle, int fd) {
+static inline int pubsub_tcpHandler_closeConnection(pubsub_tcpHandler_t *handle, int fd) {
int rc = 0;
if (handle != NULL) {
bool use_handle_fd = false;
@@ -363,7 +361,7 @@ int pubsub_tcpHandler_closeConnection(pubsub_tcpHandler_pt handle, int fd) {
return rc;
}
-int pubsub_tcpHandler_listen(pubsub_tcpHandler_pt handle, char *url) {
+int pubsub_tcpHandler_listen(pubsub_tcpHandler_t *handle, char *url) {
handle->fd = pubsub_tcpHandler_open(handle, url);
handle->url = strndup(url, 1024 * 1024);
int rc = handle->fd;
@@ -409,7 +407,7 @@ int pubsub_tcpHandler_listen(pubsub_tcpHandler_pt handle, char *url) {
}
-int pubsub_tcpHandler_setInAddr(pubsub_tcpHandler_pt handle, const char *hostname, int port, struct sockaddr_in *inp) {
+int pubsub_tcpHandler_setInAddr(pubsub_tcpHandler_t *handle, const char *hostname, int port, struct sockaddr_in *inp) {
struct hostent *hp;
bzero(inp, sizeof(struct sockaddr_in)); // zero the struct
if (hostname == 0 || hostname[0] == 0) {
@@ -470,7 +468,7 @@ void pubsub_tcpHandler_free_setUrlInfo(pubsub_tcpHandler_url_t *url_info) {
}
-int pubsub_tcpHandler_createReceiveBufferStore(pubsub_tcpHandler_pt handle, unsigned int maxNofBuffers,
+int pubsub_tcpHandler_createReceiveBufferStore(pubsub_tcpHandler_t *handle, unsigned int maxNofBuffers,
unsigned int bufferSize) {
if (handle != NULL) {
int i = 0;
@@ -479,7 +477,7 @@ int pubsub_tcpHandler_createReceiveBufferStore(pubsub_tcpHandler_pt handle, unsi
return -1;
}
for (i = 0; i < maxNofBuffers; i++) {
- pubsub_tcpBufferPartList_pt item = calloc(1, sizeof(struct pubsub_tcpBufferPartList));
+ pubsub_tcpBufferPartList_t *item = calloc(1, sizeof(struct pubsub_tcpBufferPartList));
item->buffer = calloc(sizeof(char), bufferSize);
item->bufferSize = bufferSize;
arrayList_add(handle->bufferLists, item);
@@ -489,7 +487,7 @@ int pubsub_tcpHandler_createReceiveBufferStore(pubsub_tcpHandler_pt handle, unsi
return 0;
}
-void pubsub_tcpHandler_setTimeout(pubsub_tcpHandler_pt handle, unsigned int timeout) {
+void pubsub_tcpHandler_setTimeout(pubsub_tcpHandler_t *handle, unsigned int timeout) {
if (handle != NULL) {
celixThreadRwlock_writeLock(&handle->dbLock);
handle->timeout = timeout;
@@ -502,7 +500,7 @@ void pubsub_tcpHandler_setTimeout(pubsub_tcpHandler_pt handle, unsigned int time
// Reads data from the filedescriptor which has date (determined by epoll()) and stores it in the internal structure
// If the message is completely reassembled true is returned and the index and size have valid values
//
-int pubsub_tcpHandler_dataAvailable(pubsub_tcpHandler_pt handle, int fd, unsigned int *index, unsigned int *size) {
+int pubsub_tcpHandler_dataAvailable(pubsub_tcpHandler_t *handle, int fd, unsigned int *index, unsigned int *size) {
celixThreadRwlock_writeLock(&handle->dbLock);
if (handle->bufferLists == NULL) {
int nbytes = recv(fd, &handle->default_buffer, handle->default_bufferSize, MSG_PEEK);
@@ -510,7 +508,7 @@ int pubsub_tcpHandler_dataAvailable(pubsub_tcpHandler_pt handle, int fd, unsigne
return nbytes;
}
int listSize = arrayList_size(handle->bufferLists);
- pubsub_tcpBufferPartList_pt item = arrayList_get(handle->bufferLists, handle->bufferIdx);
+ pubsub_tcpBufferPartList_t *item = arrayList_get(handle->bufferLists, handle->bufferIdx);
if (!handle->bypassHeader) {
// Only read the header, we don't know yet where to store the payload
int nbytes = recv(fd, item->buffer, sizeof(pubsub_tcp_msg_header_t) + sizeof(unsigned int), MSG_PEEK);
@@ -548,12 +546,11 @@ int pubsub_tcpHandler_dataAvailable(pubsub_tcpHandler_pt handle, int fd, unsigne
//
// Read out the message which is indicated available by the largeUdp_dataAvailable function
//
-int
-pubsub_tcpHandler_read(pubsub_tcpHandler_pt handle, unsigned int index, pubsub_tcp_msg_header_t **header,
- void **buffer, unsigned int size) {
+int pubsub_tcpHandler_read(pubsub_tcpHandler_t *handle, unsigned int index, pubsub_tcp_msg_header_t **header,
+ void **buffer, unsigned int size) {
int result = 0;
celixThreadRwlock_readLock(&handle->dbLock);
- pubsub_tcpBufferPartList_pt item = arrayList_get(handle->bufferLists, index);
+ pubsub_tcpBufferPartList_t *item = arrayList_get(handle->bufferLists, index);
if (item) {
if (handle->bypassHeader) {
*header = &item->default_header;
@@ -573,7 +570,7 @@ pubsub_tcpHandler_read(pubsub_tcpHandler_pt handle, unsigned int index, pubsub_t
return result;
}
-int pubsub_tcpHandler_addMessageHandler(pubsub_tcpHandler_pt handle, void *payload,
+int pubsub_tcpHandler_addMessageHandler(pubsub_tcpHandler_t *handle, void *payload,
pubsub_tcpHandler_processMessage_callback_t processMessageCallback) {
int result = 0;
celixThreadRwlock_writeLock(&handle->dbLock);
@@ -583,7 +580,7 @@ int pubsub_tcpHandler_addMessageHandler(pubsub_tcpHandler_pt handle, void *paylo
return result;
}
-int pubsub_tcpHandler_addConnectionCallback(pubsub_tcpHandler_pt handle, void *payload,
+int pubsub_tcpHandler_addConnectionCallback(pubsub_tcpHandler_t *handle, void *payload,
pubsub_tcpHandler_connectMessage_callback_t connectMessageCallback,
pubsub_tcpHandler_connectMessage_callback_t disconnectMessageCallback) {
int result = 0;
@@ -599,7 +596,7 @@ int pubsub_tcpHandler_addConnectionCallback(pubsub_tcpHandler_pt handle, void *p
//
// Write large data to TCP. .
//
-int pubsub_tcpHandler_write(pubsub_tcpHandler_pt handle, pubsub_tcp_msg_header_t *header, void *buffer,
+int pubsub_tcpHandler_write(pubsub_tcpHandler_t *handle, pubsub_tcp_msg_header_t *header, void *buffer,
unsigned int size, int flags) {
celixThreadRwlock_readLock(&handle->dbLock);
int result = 0;
@@ -656,11 +653,11 @@ int pubsub_tcpHandler_write(pubsub_tcpHandler_pt handle, pubsub_tcp_msg_header_t
return (result == 0 ? written : result);
}
-const char *pubsub_tcpHandler_url(pubsub_tcpHandler_pt handle) {
+const char *pubsub_tcpHandler_url(pubsub_tcpHandler_t *handle) {
return handle->url;
}
-int pubsub_tcpHandler_handler(pubsub_tcpHandler_pt handle) {
+int pubsub_tcpHandler_handler(pubsub_tcpHandler_t *handle) {
int rc = 0;
if (handle->efd >= 0) {
struct epoll_event events[MAX_EPOLL_EVENTS];
diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.h b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.h
index 0aebbd2..c618a6f 100644
--- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.h
+++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.h
@@ -26,6 +26,7 @@
#ifndef _PUBSUB_TCP_BUFFER_HANDLER_H_
#define _PUBSUB_TCP_BUFFER_HANDLER_H_
+
#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -35,7 +36,6 @@
#include "celix_threads.h"
#include "pubsub_tcp_msg_header.h"
-
typedef struct pubsub_tcpHandler_url {
char *url;
char *protocol;
@@ -43,30 +43,29 @@ typedef struct pubsub_tcpHandler_url {
unsigned int portnr;
} pubsub_tcpHandler_url_t;
-typedef struct pubsub_tcpHandler pubsub_tcpHandler_t;
-typedef struct pubsub_tcpHandler *pubsub_tcpHandler_pt;
+typedef struct pubsub_tcpHandler pubsub_tcpHandler_t;
typedef void (*pubsub_tcpHandler_processMessage_callback_t)(void* payload, const pubsub_tcp_msg_header_t* header, const unsigned char * buffer, size_t size, struct timespec *receiveTime);
typedef void (*pubsub_tcpHandler_connectMessage_callback_t)(void* payload, const char *url, bool lock);
-pubsub_tcpHandler_pt pubsub_tcpHandler_create(log_helper_t *logHelper);
-void pubsub_tcpHandler_destroy(pubsub_tcpHandler_pt handle);
-int pubsub_tcpHandler_open(pubsub_tcpHandler_pt handle, char* url);
-int pubsub_tcpHandler_close(pubsub_tcpHandler_pt handle);
-int pubsub_tcpHandler_connect(pubsub_tcpHandler_pt handle, char* url);
-int pubsub_tcpHandler_disconnect(pubsub_tcpHandler_pt handle, char* url);
-int pubsub_tcpHandler_listen(pubsub_tcpHandler_pt handle, char* url);
+pubsub_tcpHandler_t *pubsub_tcpHandler_create(log_helper_t *logHelper);
+void pubsub_tcpHandler_destroy(pubsub_tcpHandler_t *handle);
+int pubsub_tcpHandler_open(pubsub_tcpHandler_t *handle, char* url);
+int pubsub_tcpHandler_close(pubsub_tcpHandler_t *handle);
+int pubsub_tcpHandler_connect(pubsub_tcpHandler_t *handle, char* url);
+int pubsub_tcpHandler_disconnect(pubsub_tcpHandler_t *handle, char* url);
+int pubsub_tcpHandler_listen(pubsub_tcpHandler_t *handle, char* url);
-int pubsub_tcpHandler_createReceiveBufferStore(pubsub_tcpHandler_pt handle, unsigned int maxNofBuffers, unsigned int bufferSize);
-void pubsub_tcpHandler_setTimeout(pubsub_tcpHandler_pt handle, unsigned int timeout);
+int pubsub_tcpHandler_createReceiveBufferStore(pubsub_tcpHandler_t *handle, unsigned int maxNofBuffers, unsigned int bufferSize);
+void pubsub_tcpHandler_setTimeout(pubsub_tcpHandler_t *handle, unsigned int timeout);
-int pubsub_tcpHandler_dataAvailable(pubsub_tcpHandler_pt handle, int fd, unsigned int *index, unsigned int *size);
-int pubsub_tcpHandler_read(pubsub_tcpHandler_pt handle, unsigned int index, pubsub_tcp_msg_header_t** header, void ** buffer, unsigned int size);
-int pubsub_tcpHandler_handler(pubsub_tcpHandler_pt handle);
-int pubsub_tcpHandler_write(pubsub_tcpHandler_pt handle, pubsub_tcp_msg_header_t* header, void* buffer, unsigned int size, int flags);
-int pubsub_tcpHandler_addMessageHandler(pubsub_tcpHandler_pt handle, void* payload, pubsub_tcpHandler_processMessage_callback_t processMessageCallback);
-int pubsub_tcpHandler_addConnectionCallback(pubsub_tcpHandler_pt handle, void* payload, pubsub_tcpHandler_connectMessage_callback_t connectMessageCallback, pubsub_tcpHandler_connectMessage_callback_t disconnectMessageCallback);
+int pubsub_tcpHandler_dataAvailable(pubsub_tcpHandler_t *handle, int fd, unsigned int *index, unsigned int *size);
+int pubsub_tcpHandler_read(pubsub_tcpHandler_t *handle, unsigned int index, pubsub_tcp_msg_header_t** header, void ** buffer, unsigned int size);
+int pubsub_tcpHandler_handler(pubsub_tcpHandler_t *handle);
+int pubsub_tcpHandler_write(pubsub_tcpHandler_t *handle, pubsub_tcp_msg_header_t* header, void* buffer, unsigned int size, int flags);
+int pubsub_tcpHandler_addMessageHandler(pubsub_tcpHandler_t *handle, void* payload, pubsub_tcpHandler_processMessage_callback_t processMessageCallback);
+int pubsub_tcpHandler_addConnectionCallback(pubsub_tcpHandler_t *handle, void* payload, pubsub_tcpHandler_connectMessage_callback_t connectMessageCallback, pubsub_tcpHandler_connectMessage_callback_t disconnectMessageCallback);
-const char* pubsub_tcpHandler_url(pubsub_tcpHandler_pt handle);
+const char* pubsub_tcpHandler_url(pubsub_tcpHandler_t *handle);
void pubsub_tcpHandler_setUrlInfo(char *url, pubsub_tcpHandler_url_t *url_info);
void pubsub_tcpHandler_free_setUrlInfo(pubsub_tcpHandler_url_t *url_info);
diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_msg_header.h b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_msg_header.h
index b515a10..e47e76d 100644
--- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_msg_header.h
+++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_msg_header.h
@@ -29,6 +29,5 @@ typedef struct pubsub_tcp_msg_header {
uint64_t sendtimeSeconds; //seconds since epoch
uint64_t sendTimeNanoseconds; //ns since epoch
} pubsub_tcp_msg_header_t;
-typedef struct pubsub_tcp_msg_header *pubsub_tcp_msg_header_pt;
#endif
\ No newline at end of file
diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c
index 6c6bc4a..d65c6f7 100644
--- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c
+++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_receiver.c
@@ -60,8 +60,8 @@ struct pubsub_tcp_topic_receiver {
char *topic;
char scopeAndTopicFilter[5];
bool metricsEnabled;
- pubsub_tcpHandler_pt socketHandler;
- pubsub_tcpHandler_pt sharedSocketHandler;
+ pubsub_tcpHandler_t *socketHandler;
+ pubsub_tcpHandler_t *sharedSocketHandler;
struct {
celix_thread_t thread;
@@ -172,7 +172,7 @@ pubsub_tcp_topic_receiver_t *pubsub_tcpTopicReceiver_create(celix_bundle_context
/* When it's an endpoint share the socket with the receiver */
if (staticBindUrl != NULL || (isEndPointTypeClient && staticConnectUrls != NULL)) {
celixThreadMutex_lock(&receiver->thread.mutex);
- pubsub_tcpHandler_pt entry = hashMap_get(endPointStore->map, (isEndPointTypeServer) ? staticBindUrl : staticConnectUrls);
+ pubsub_tcpHandler_t *entry = hashMap_get(endPointStore->map, (isEndPointTypeServer) ? staticBindUrl : staticConnectUrls);
if (entry != NULL) {
receiver->socketHandler = entry;
receiver->sharedSocketHandler = entry;
diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_sender.c b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_sender.c
index 83ff981..275fdb6 100644
--- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_sender.c
+++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_topic_sender.c
@@ -54,8 +54,8 @@ struct pubsub_tcp_topic_sender {
pubsub_serializer_service_t *serializer;
uuid_t fwUUID;
bool metricsEnabled;
- pubsub_tcpHandler_pt socketHandler;
- pubsub_tcpHandler_pt sharedSocketHandler;
+ pubsub_tcpHandler_t *socketHandler;
+ pubsub_tcpHandler_t *sharedSocketHandler;
char *scope;
char *topic;
@@ -160,7 +160,7 @@ pubsub_tcp_topic_sender_t *pubsub_tcpTopicSender_create(
if (staticConnectUrls != NULL || (isEndPointTypeServer && staticBindUrl != NULL)) {
celixThreadMutex_lock(&endPointStore->mutex);
sender->sharedSocketHandler = sender->socketHandler;
- pubsub_tcpHandler_pt entry = hashMap_get(endPointStore->map, staticConnectUrls);
+ pubsub_tcpHandler_t *entry = hashMap_get(endPointStore->map, staticConnectUrls);
if (entry == NULL) {
entry = sender->socketHandler;
hashMap_put(endPointStore->map, (void *) (isEndPointTypeClient ? staticConnectUrls : staticBindUrl), entry);
diff --git a/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.c b/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.c
index cb61c71..ed09200 100644
--- a/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.c
+++ b/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.c
@@ -54,7 +54,7 @@ typedef struct udpPartList {
unsigned int msg_size;
unsigned int nrPartsRemaining;
char *data;
-} *udpPartList_pt;
+} udpPartList_t;
typedef struct msg_part_header {
@@ -73,10 +73,10 @@ typedef struct msg_part_header {
//
// Create a handle
//
-largeUdp_pt largeUdp_create(unsigned int maxNrUdpReceptions)
+largeUdp_t *largeUdp_create(unsigned int maxNrUdpReceptions)
{
printf("## Creating large UDP\n");
- largeUdp_pt handle = calloc(sizeof(*handle), 1);
+ largeUdp_t *handle = calloc(sizeof(*handle), 1);
if (handle != NULL) {
handle->maxNrLists = maxNrUdpReceptions;
if (arrayList_create(&handle->udpPartLists) != CELIX_SUCCESS) {
@@ -92,7 +92,7 @@ largeUdp_pt largeUdp_create(unsigned int maxNrUdpReceptions)
//
// Destroys the handle
//
-void largeUdp_destroy(largeUdp_pt handle)
+void largeUdp_destroy(largeUdp_t *handle)
{
printf("### Destroying large UDP\n");
if (handle != NULL) {
@@ -100,7 +100,7 @@ void largeUdp_destroy(largeUdp_pt handle)
int nrUdpLists = arrayList_size(handle->udpPartLists);
int i;
for (i=0; i < nrUdpLists; i++) {
- udpPartList_pt udpPartList = arrayList_remove(handle->udpPartLists, i);
+ udpPartList_t *udpPartList = arrayList_remove(handle->udpPartLists, i);
if (udpPartList) {
if (udpPartList->data) {
free(udpPartList->data);
@@ -120,7 +120,7 @@ void largeUdp_destroy(largeUdp_pt handle)
//
// Write large data to UDP. This function splits the data in chunks and sends these chunks with a header over UDP.
//
-int largeUdp_sendmsg(largeUdp_pt handle, int fd, struct iovec *largeMsg_iovec, int len, int flags, struct sockaddr_in *dest_addr, size_t addrlen)
+int largeUdp_sendmsg(largeUdp_t *handle, int fd, struct iovec *largeMsg_iovec, int len, int flags, struct sockaddr_in *dest_addr, size_t addrlen)
{
int n;
int result = 0;
@@ -193,7 +193,7 @@ int largeUdp_sendmsg(largeUdp_pt handle, int fd, struct iovec *largeMsg_iovec, i
//
// Write large data to UDP. This function splits the data in chunks and sends these chunks with a header over UDP.
//
-int largeUdp_sendto(largeUdp_pt handle, int fd, void *buf, size_t count, int flags, struct sockaddr_in *dest_addr, size_t addrlen)
+int largeUdp_sendto(largeUdp_t *handle, int fd, void *buf, size_t count, int flags, struct sockaddr_in *dest_addr, size_t addrlen)
{
int n;
int nr_buffers = (count / MAX_PART_SIZE) + 1;
@@ -241,7 +241,7 @@ int largeUdp_sendto(largeUdp_pt handle, int fd, void *buf, size_t count, int fla
// Reads data from the filedescriptor which has date (determined by epoll()) and stores it in the internal structure
// If the message is completely reassembled true is returned and the index and size have valid values
//
-bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, unsigned int *size) {
+bool largeUdp_dataAvailable(largeUdp_t *handle, int fd, unsigned int *index, unsigned int *size) {
msg_part_header_t header;
int result = false;
// Only read the header, we don't know yet where to store the payload
@@ -269,7 +269,7 @@ bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, uns
int i;
bool found = false;
for (i = 0; i < nrUdpLists; i++) {
- udpPartList_pt udpPartList = arrayList_get(handle->udpPartLists, i);
+ udpPartList_t *udpPartList = arrayList_get(handle->udpPartLists, i);
if (udpPartList->msg_ident == header.msg_ident) {
found = true;
@@ -305,7 +305,7 @@ bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, uns
}
if (found == false) {
- udpPartList_pt udpPartList = NULL;
+ udpPartList_t *udpPartList = NULL;
if (nrUdpLists == handle->maxNrLists) {
// remove list at index 0
udpPartList = arrayList_remove(handle->udpPartLists, 0);
@@ -348,12 +348,12 @@ bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, uns
//
// Read out the message which is indicated available by the largeUdp_dataAvailable function
//
-int largeUdp_read(largeUdp_pt handle, unsigned int index, void ** buffer, unsigned int size)
+int largeUdp_read(largeUdp_t *handle, unsigned int index, void ** buffer, unsigned int size)
{
int result = 0;
pthread_mutex_lock(&handle->dbLock);
- udpPartList_pt udpPartList = arrayList_remove(handle->udpPartLists, index);
+ udpPartList_t *udpPartList = arrayList_remove(handle->udpPartLists, index);
if (udpPartList) {
*buffer = udpPartList->data;
free(udpPartList);
diff --git a/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.h b/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.h
index 66d7506..f2f01dc 100644
--- a/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.h
+++ b/bundles/pubsub/pubsub_admin_udp_mc/src/large_udp.h
@@ -33,14 +33,14 @@
#include <sys/socket.h>
#include <netinet/in.h>
-typedef struct largeUdp *largeUdp_pt;
+typedef struct largeUdp largeUdp_t;
-largeUdp_pt largeUdp_create(unsigned int maxNrUdpReceptions);
-void largeUdp_destroy(largeUdp_pt handle);
+largeUdp_t *largeUdp_create(unsigned int maxNrUdpReceptions);
+void largeUdp_destroy(largeUdp_t *handle);
-int largeUdp_sendto(largeUdp_pt handle, int fd, void *buf, size_t count, int flags, struct sockaddr_in *dest_addr, size_t addrlen);
-int largeUdp_sendmsg(largeUdp_pt handle, int fd, struct iovec *largeMsg_iovec, int len, int flags, struct sockaddr_in *dest_addr, size_t addrlen);
-bool largeUdp_dataAvailable(largeUdp_pt handle, int fd, unsigned int *index, unsigned int *size);
-int largeUdp_read(largeUdp_pt handle, unsigned int index, void ** buffer, unsigned int size);
+int largeUdp_sendto(largeUdp_t *handle, int fd, void *buf, size_t count, int flags, struct sockaddr_in *dest_addr, size_t addrlen);
+int largeUdp_sendmsg(largeUdp_t *handle, int fd, struct iovec *largeMsg_iovec, int len, int flags, struct sockaddr_in *dest_addr, size_t addrlen);
+bool largeUdp_dataAvailable(largeUdp_t *handle, int fd, unsigned int *index, unsigned int *size);
+int largeUdp_read(largeUdp_t *handle, unsigned int index, void ** buffer, unsigned int size);
#endif /* _LARGE_UDP_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 e26fc31..632d6f4 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
@@ -54,7 +54,7 @@ struct pubsub_udpmc_topic_receiver {
char *scope;
char *topic;
char* ifIpAddress;
- largeUdp_pt largeUdpHandle;
+ largeUdp_t *largeUdpHandle;
int topicEpollFd; // EPOLL filedescriptor where the sockets are registered.
struct {
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 3f37325..a6cde47 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
@@ -69,7 +69,7 @@ typedef struct psa_udpmc_bounded_service_entry {
hash_map_t *msgTypes;
hash_map_t *msgTypeIds;
int getCount;
- largeUdp_pt largeUdpHandle;
+ largeUdp_t *largeUdpHandle;
} psa_udpmc_bounded_service_entry_t;
typedef struct pubsub_msg {
diff --git a/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c b/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
index f96ba39..791ad3d 100644
--- a/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
+++ b/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
@@ -56,7 +56,7 @@ static void pubsub_discovery_addDiscoveredEndpoint(pubsub_discovery_t *disc, cel
static void pubsub_discovery_removeDiscoveredEndpoint(pubsub_discovery_t *disc, const char *uuid);
/* Discovery activator functions */
-pubsub_discovery_t* pubsub_discovery_create(bundle_context_pt context, log_helper_t *logHelper) {
+pubsub_discovery_t* pubsub_discovery_create(celix_bundle_context_t *context, log_helper_t *logHelper) {
pubsub_discovery_t *disc = calloc(1, sizeof(*disc));
disc->logHelper = logHelper;
disc->context = context;
diff --git a/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.h b/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.h
index 6a51902..44b8b7f 100644
--- a/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.h
+++ b/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.h
@@ -45,7 +45,7 @@
#define PUBSUB_DISCOVERY_ETCD_TTL_DEFAULT 30
typedef struct pubsub_discovery {
- bundle_context_pt context;
+ celix_bundle_context_t *context;
log_helper_t *logHelper;
celix_thread_mutex_t discoveredEndpointsMutex; //when locked with EndpointsListenersMutex -> first lock this
@@ -86,7 +86,7 @@ typedef struct pubsub_announce_entry {
} pubsub_announce_entry_t;
-pubsub_discovery_t* pubsub_discovery_create(bundle_context_pt context, log_helper_t *logHelper);
+pubsub_discovery_t* pubsub_discovery_create(celix_bundle_context_t *context, log_helper_t *logHelper);
celix_status_t pubsub_discovery_destroy(pubsub_discovery_t *node_discovery);
celix_status_t pubsub_discovery_start(pubsub_discovery_t *node_discovery);
celix_status_t pubsub_discovery_stop(pubsub_discovery_t *node_discovery);
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 618f9a4..bc3107c 100644
--- a/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.c
+++ b/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.c
@@ -46,8 +46,8 @@ typedef enum
FILE_INPUT_TYPE;
struct pubsub_json_serializer {
- bundle_context_pt bundle_context;
- log_helper_pt loghelper;
+ celix_bundle_context_t *bundle_context;
+ log_helper_t *loghelper;
};
@@ -85,7 +85,7 @@ static void dfi_log(void *handle, int level, const char *file, int line, const c
free(logStr);
}
-celix_status_t pubsubSerializer_create(bundle_context_pt context, pubsub_json_serializer_t** serializer) {
+celix_status_t pubsubSerializer_create(celix_bundle_context_t *context, pubsub_json_serializer_t** serializer) {
celix_status_t status = CELIX_SUCCESS;
*serializer = calloc(1, sizeof(**serializer));
@@ -231,7 +231,7 @@ static char* pubsubSerializer_getMsgDescriptionDir(celix_bundle_t *bundle) {
bundle_isSystemBundle(bundle, &isSystemBundle);
if (isSystemBundle == true) {
- bundle_context_pt context;
+ celix_bundle_context_t *context;
bundle_getContext(bundle, &context);
const char *prop = NULL;
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 9a850f2..50ba9cf 100644
--- a/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.h
+++ b/bundles/pubsub/pubsub_serializer_json/src/pubsub_serializer_impl.h
@@ -31,7 +31,7 @@
typedef struct pubsub_json_serializer pubsub_json_serializer_t;
-celix_status_t pubsubSerializer_create(bundle_context_pt context, pubsub_json_serializer_t **serializer);
+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, celix_bundle_t *bundle, hash_map_pt* serializerMap);
diff --git a/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c b/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c
index b4811a2..b73780f 100644
--- a/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c
+++ b/bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c
@@ -44,12 +44,10 @@ typedef struct pstm_activator {
pubsub_discovered_endpoint_listener_t discListenerSvc;
long discListenerSvcId;
-
command_service_t shellCmdSvc;
long shellCmdSvcId;
-
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
} pstm_activator_t;
diff --git a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c
index 46a1889..04f69cf 100644
--- a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c
+++ b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c
@@ -48,7 +48,7 @@
static void *pstm_psaHandlingThread(void *data);
-celix_status_t pubsub_topologyManager_create(bundle_context_pt context, log_helper_pt logHelper, pubsub_topology_manager_t **out) {
+celix_status_t pubsub_topologyManager_create(celix_bundle_context_t *context, log_helper_t *logHelper, pubsub_topology_manager_t **out) {
celix_status_t status = CELIX_SUCCESS;
pubsub_topology_manager_t *manager = calloc(1, sizeof(*manager));
diff --git a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h
index 9dcc13a..8864c66 100644
--- a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h
+++ b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h
@@ -36,7 +36,7 @@
typedef struct pubsub_topology_manager {
- bundle_context_pt context;
+ celix_bundle_context_t *context;
struct {
celix_thread_mutex_t mutex;
@@ -75,7 +75,7 @@ typedef struct pubsub_topology_manager {
bool running;
} psaHandling;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
bool verbose;
} pubsub_topology_manager_t;
@@ -107,7 +107,7 @@ typedef struct pstm_topic_receiver_or_sender_entry {
celix_properties_t *subscriberProperties;
} pstm_topic_receiver_or_sender_entry_t;
-celix_status_t pubsub_topologyManager_create(bundle_context_pt context, log_helper_pt logHelper, pubsub_topology_manager_t **manager);
+celix_status_t pubsub_topologyManager_create(celix_bundle_context_t *context, log_helper_t *logHelper, pubsub_topology_manager_t **manager);
celix_status_t pubsub_topologyManager_destroy(pubsub_topology_manager_t *manager);
void pubsub_topologyManager_psaAdded(void *handle, void *svc, const celix_properties_t *props);
diff --git a/bundles/remote_services/discovery_common/include/discovery.h b/bundles/remote_services/discovery_common/include/discovery.h
index 4c8e9c5..2c0501f 100644
--- a/bundles/remote_services/discovery_common/include/discovery.h
+++ b/bundles/remote_services/discovery_common/include/discovery.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* discovery.h
*
* \date Sep 29, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef DISCOVERY_H_
@@ -39,50 +39,50 @@
#include "log_helper.h"
-#define DISCOVERY_SERVER_INTERFACE "DISCOVERY_CFG_SERVER_INTERFACE"
-#define DISCOVERY_SERVER_IP "DISCOVERY_CFG_SERVER_IP"
-#define DISCOVERY_SERVER_PORT "DISCOVERY_CFG_SERVER_PORT"
-#define DISCOVERY_SERVER_PATH "DISCOVERY_CFG_SERVER_PATH"
-#define DISCOVERY_POLL_ENDPOINTS "DISCOVERY_CFG_POLL_ENDPOINTS"
-#define DISCOVERY_SERVER_MAX_EP "DISCOVERY_CFG_SERVER_MAX_EP"
+#define DISCOVERY_SERVER_INTERFACE "DISCOVERY_CFG_SERVER_INTERFACE"
+#define DISCOVERY_SERVER_IP "DISCOVERY_CFG_SERVER_IP"
+#define DISCOVERY_SERVER_PORT "DISCOVERY_CFG_SERVER_PORT"
+#define DISCOVERY_SERVER_PATH "DISCOVERY_CFG_SERVER_PATH"
+#define DISCOVERY_POLL_ENDPOINTS "DISCOVERY_CFG_POLL_ENDPOINTS"
+#define DISCOVERY_SERVER_MAX_EP "DISCOVERY_CFG_SERVER_MAX_EP"
struct discovery {
- bundle_context_t* context;
+ celix_bundle_context_t *context;
celix_thread_mutex_t listenerReferencesMutex;
celix_thread_mutex_t discoveredServicesMutex;
- hash_map_t* listenerReferences; //key=serviceReference, value=nop
- hash_map_t* discoveredServices; //key=endpointId (string), value=endpoint_description_pt
+ hash_map_t *listenerReferences; //key=serviceReference, value=nop
+ hash_map_t *discoveredServices; //key=endpointId (string), value=endpoint_description_t *
- endpoint_discovery_poller_t* poller;
- endpoint_discovery_server_t* server;
+ endpoint_discovery_poller_t *poller;
+ endpoint_discovery_server_t *server;
- log_helper_t* loghelper;
+ log_helper_t *loghelper;
- discovery_impl_t* pImpl;
+ discovery_impl_t *pImpl;
};
/* those one could be put into a general discovery.h - file */
-celix_status_t discovery_create(bundle_context_pt context, discovery_pt *discovery);
-celix_status_t discovery_destroy(discovery_pt discovery);
+celix_status_t discovery_create(celix_bundle_context_t *context, discovery_t **discovery);
+celix_status_t discovery_destroy(discovery_t *discovery);
-celix_status_t discovery_start(discovery_pt discovery);
-celix_status_t discovery_stop(discovery_pt discovery);
+celix_status_t discovery_start(discovery_t *discovery);
+celix_status_t discovery_stop(discovery_t *discovery);
-celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt endpoint, char *matchedFilter);
-celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt endpoint, char *matchedFilter);
+celix_status_t discovery_endpointAdded(void *handle, endpoint_description_t *endpoint, char *matchedFilter);
+celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_t *endpoint, char *matchedFilter);
celix_status_t discovery_endpointListenerAdding(void * handle, service_reference_pt reference, void **service);
celix_status_t discovery_endpointListenerAdded(void * handle, service_reference_pt reference, void * service);
celix_status_t discovery_endpointListenerModified(void * handle, service_reference_pt reference, void * service);
celix_status_t discovery_endpointListenerRemoved(void * handle, service_reference_pt reference, void * service);
-celix_status_t discovery_informEndpointListeners(discovery_pt discovery, endpoint_description_pt endpoint, bool endpointAdded);
-celix_status_t discovery_updateEndpointListener(discovery_pt discovery, service_reference_pt reference, endpoint_listener_pt service);
+celix_status_t discovery_informEndpointListeners(discovery_t *discovery, endpoint_description_t *endpoint, bool endpointAdded);
+celix_status_t discovery_updateEndpointListener(discovery_t *discovery, service_reference_pt reference, endpoint_listener_t *service);
-celix_status_t discovery_addDiscoveredEndpoint(discovery_pt discovery, endpoint_description_pt endpoint);
-celix_status_t discovery_removeDiscoveredEndpoint(discovery_pt discovery, endpoint_description_pt endpoint);
+celix_status_t discovery_addDiscoveredEndpoint(discovery_t *discovery, endpoint_description_t *endpoint);
+celix_status_t discovery_removeDiscoveredEndpoint(discovery_t *discovery, endpoint_description_t *endpoint);
#endif /* DISCOVERY_H_ */
diff --git a/bundles/remote_services/discovery_common/include/discovery_type.h b/bundles/remote_services/discovery_common/include/discovery_type.h
index 222a495..1b8b8ef 100644
--- a/bundles/remote_services/discovery_common/include/discovery_type.h
+++ b/bundles/remote_services/discovery_common/include/discovery_type.h
@@ -20,8 +20,7 @@
#ifndef DISCOVERY_TYPE_H_
#define DISCOVERY_TYPE_H_
-typedef struct discovery discovery_t;
-typedef struct discovery* discovery_pt;
+typedef struct discovery discovery_t;
typedef struct discovery_impl discovery_impl_t;
#endif //DISCOVERY_TYPE_H_
\ No newline at end of file
diff --git a/bundles/remote_services/discovery_common/include/endpoint_descriptor_reader.h b/bundles/remote_services/discovery_common/include/endpoint_descriptor_reader.h
index 7a05d9e..0a8b640 100644
--- a/bundles/remote_services/discovery_common/include/endpoint_descriptor_reader.h
+++ b/bundles/remote_services/discovery_common/include/endpoint_descriptor_reader.h
@@ -31,12 +31,12 @@
#include "celix_errno.h"
#include "array_list.h"
-typedef struct endpoint_descriptor_reader *endpoint_descriptor_reader_pt;
+typedef struct endpoint_descriptor_reader endpoint_descriptor_reader_t;
-celix_status_t endpointDescriptorReader_create(endpoint_discovery_poller_pt poller, endpoint_descriptor_reader_pt *reader);
-celix_status_t endpointDescriptorReader_destroy(endpoint_descriptor_reader_pt reader);
+celix_status_t endpointDescriptorReader_create(endpoint_discovery_poller_t *poller, endpoint_descriptor_reader_t * *reader);
+celix_status_t endpointDescriptorReader_destroy(endpoint_descriptor_reader_t * reader);
-celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_pt reader, char *document, array_list_pt *endpoints);
+celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_t * reader, char *document, array_list_pt *endpoints);
#endif /* ENDPOINT_DESCRIPTOR_READER_H_ */
diff --git a/bundles/remote_services/discovery_common/include/endpoint_descriptor_writer.h b/bundles/remote_services/discovery_common/include/endpoint_descriptor_writer.h
index 3c5a9be..96fa4f4 100644
--- a/bundles/remote_services/discovery_common/include/endpoint_descriptor_writer.h
+++ b/bundles/remote_services/discovery_common/include/endpoint_descriptor_writer.h
@@ -30,10 +30,10 @@
#include "celix_errno.h"
#include "array_list.h"
-typedef struct endpoint_descriptor_writer *endpoint_descriptor_writer_pt;
+typedef struct endpoint_descriptor_writer endpoint_descriptor_writer_t;
-celix_status_t endpointDescriptorWriter_create(endpoint_descriptor_writer_pt *writer);
-celix_status_t endpointDescriptorWriter_destroy(endpoint_descriptor_writer_pt writer);
-celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_pt writer, array_list_pt endpoints, char **document);
+celix_status_t endpointDescriptorWriter_create(endpoint_descriptor_writer_t **writer);
+celix_status_t endpointDescriptorWriter_destroy(endpoint_descriptor_writer_t *writer);
+celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_t *writer, array_list_pt endpoints, char **document);
#endif /* ENDPOINT_DESCRIPTOR_WRITER_H_ */
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 ac8324f..e399ddd 100644
--- a/bundles/remote_services/discovery_common/include/endpoint_discovery_poller.h
+++ b/bundles/remote_services/discovery_common/include/endpoint_discovery_poller.h
@@ -32,12 +32,11 @@
#include "log_helper.h"
typedef struct endpoint_discovery_poller endpoint_discovery_poller_t;
-typedef struct endpoint_discovery_poller *endpoint_discovery_poller_pt;
struct endpoint_discovery_poller {
- discovery_pt discovery;
+ discovery_t *discovery;
hash_map_pt entries;
- log_helper_pt* loghelper;
+ log_helper_t **loghelper;
celix_thread_mutex_t pollerLock;
celix_thread_t pollerThread;
@@ -48,12 +47,12 @@ struct endpoint_discovery_poller {
volatile bool running;
};
-celix_status_t endpointDiscoveryPoller_create(discovery_pt discovery, bundle_context_pt context, const char* defaultPollEndpoints, endpoint_discovery_poller_pt *poller);
-celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_pt poller);
+celix_status_t endpointDiscoveryPoller_create(discovery_t *discovery, celix_bundle_context_t *context, const char* defaultPollEndpoints, endpoint_discovery_poller_t **poller);
+celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_t *poller);
-celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url);
-celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url);
+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_pt poller, array_list_pt urls);
+celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, array_list_pt urls);
#endif /* ENDPOINT_DISCOVERY_POLLER_H_ */
diff --git a/bundles/remote_services/discovery_common/include/endpoint_discovery_server.h b/bundles/remote_services/discovery_common/include/endpoint_discovery_server.h
index d70c145..997e81e 100644
--- a/bundles/remote_services/discovery_common/include/endpoint_discovery_server.h
+++ b/bundles/remote_services/discovery_common/include/endpoint_discovery_server.h
@@ -19,9 +19,9 @@
/*
* endpoint_discovery_server.h
*
- * \date Aug 12, 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \date Aug 12, 2014
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef ENDPOINT_DISCOVERY_SERVER_H_
@@ -31,7 +31,6 @@
#include "discovery_type.h"
typedef struct endpoint_discovery_server endpoint_discovery_server_t;
-typedef struct endpoint_discovery_server *endpoint_discovery_server_pt;
/**
* Creates and starts a new instance of an endpoint discovery server.
@@ -42,12 +41,12 @@ typedef struct endpoint_discovery_server *endpoint_discovery_server_pt;
* @return CELIX_SUCCESS when successful.
*/
celix_status_t endpointDiscoveryServer_create(
- discovery_pt discovery,
- bundle_context_pt context,
- const char* defaultServerPath,
- const char* defaultServerPort,
- const char* defaultServerIp,
- endpoint_discovery_server_pt *server);
+ discovery_t *discovery,
+ celix_bundle_context_t *context,
+ const char *defaultServerPath,
+ const char *defaultServerPort,
+ const char *defaultServerIp,
+ endpoint_discovery_server_t **server);
/**
* Stops and destroys a given instance of an endpoint discovery server.
@@ -55,7 +54,7 @@ celix_status_t endpointDiscoveryServer_create(
* @param server [in] the pointer to the instance to destroy.
* @return CELIX_SUCCESS when successful.
*/
-celix_status_t endpointDiscoveryServer_destroy(endpoint_discovery_server_pt server);
+celix_status_t endpointDiscoveryServer_destroy(endpoint_discovery_server_t *server);
/**
* Adds a given endpoint description to expose through the given discovery server.
@@ -64,7 +63,7 @@ celix_status_t endpointDiscoveryServer_destroy(endpoint_discovery_server_pt serv
* @param endpoint [in] the endpoint description to expose.
* @return CELIX_SUCCESS when successful.
*/
-celix_status_t endpointDiscoveryServer_addEndpoint(endpoint_discovery_server_pt server, endpoint_description_pt endpoint);
+celix_status_t endpointDiscoveryServer_addEndpoint(endpoint_discovery_server_t *server, endpoint_description_t *endpoint);
/**
* Removes a given endpoint description from exposure through the given discovery server.
@@ -73,7 +72,7 @@ celix_status_t endpointDiscoveryServer_addEndpoint(endpoint_discovery_server_pt
* @param endpoint [in] the endpoint description to remove.
* @return CELIX_SUCCESS when successful.
*/
-celix_status_t endpointDiscoveryServer_removeEndpoint( endpoint_discovery_server_pt server, endpoint_description_pt endpoint);
+celix_status_t endpointDiscoveryServer_removeEndpoint(endpoint_discovery_server_t *server, endpoint_description_t *endpoint);
/**
* Returns the url, which is used by the discovery server to announce the endpoints
@@ -82,7 +81,7 @@ celix_status_t endpointDiscoveryServer_removeEndpoint( endpoint_discovery_server
* @param url [out] url which is used to announce the endpoints.
* @return CELIX_SUCCESS when successful.
*/
-celix_status_t endpointDiscoveryServer_getUrl(endpoint_discovery_server_pt server, char* url);
+celix_status_t endpointDiscoveryServer_getUrl(endpoint_discovery_server_t *server, char* url);
#endif /* ENDPOINT_DISCOVERY_SERVER_H_ */
diff --git a/bundles/remote_services/discovery_common/src/discovery.c b/bundles/remote_services/discovery_common/src/discovery.c
index d1ce209..903c72e 100644
--- a/bundles/remote_services/discovery_common/src/discovery.c
+++ b/bundles/remote_services/discovery_common/src/discovery.c
@@ -37,9 +37,9 @@
#include "endpoint_discovery_server.h"
-celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
+celix_status_t discovery_endpointAdded(void *handle, endpoint_description_t *endpoint, char *matchedFilter) {
celix_status_t status;
- discovery_pt discovery = handle;
+ discovery_t *discovery = handle;
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Endpoint for %s, with filter \"%s\" added...", endpoint->service, matchedFilter);
@@ -48,9 +48,9 @@ celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt end
return status;
}
-celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
+celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_t *endpoint, char *matchedFilter) {
celix_status_t status;
- discovery_pt discovery = handle;
+ discovery_t *discovery = handle;
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Endpoint for %s, with filter \"%s\" removed...", endpoint->service, matchedFilter);
@@ -61,7 +61,7 @@ celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt e
celix_status_t discovery_endpointListenerAdding(void* handle, service_reference_pt reference, void** service) {
celix_status_t status = CELIX_SUCCESS;
- discovery_pt discovery = handle;
+ discovery_t *discovery = handle;
bundleContext_getService(discovery->context, reference, service);
@@ -70,14 +70,14 @@ celix_status_t discovery_endpointListenerAdding(void* handle, service_reference_
celix_status_t discovery_endpointListenerAdded(void* handle, service_reference_pt reference, void* service) {
celix_status_t status = CELIX_SUCCESS;
- discovery_pt discovery = handle;
+ discovery_t *discovery = handle;
const char *discoveryListener = NULL;
serviceReference_getProperty(reference, "DISCOVERY", &discoveryListener);
const char *scope = NULL;
serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
- filter_pt filter = filter_create(scope);
+ celix_filter_t *filter = celix_filter_create(scope);
if (discoveryListener != NULL && strcmp(discoveryListener, "true") == 0) {
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "EndpointListener Ignored - Discovery listener");
@@ -86,12 +86,12 @@ celix_status_t discovery_endpointListenerAdded(void* handle, service_reference_p
hash_map_iterator_pt iter = hashMapIterator_create(discovery->discoveredServices);
while (hashMapIterator_hasNext(iter)) {
- endpoint_description_pt endpoint = hashMapIterator_nextValue(iter);
+ endpoint_description_t *endpoint = hashMapIterator_nextValue(iter);
bool matchResult = false;
filter_match(filter, endpoint->properties, &matchResult);
if (matchResult) {
- endpoint_listener_pt listener = service;
+ endpoint_listener_t *listener = service;
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "EndpointListener Added - Add Scope");
@@ -109,7 +109,7 @@ celix_status_t discovery_endpointListenerAdded(void* handle, service_reference_p
celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
}
- filter_destroy(filter);
+ celix_filter_destroy(filter);
return status;
}
@@ -127,7 +127,7 @@ celix_status_t discovery_endpointListenerModified(void * handle, service_referen
celix_status_t discovery_endpointListenerRemoved(void * handle, service_reference_pt reference, void * service) {
celix_status_t status;
- discovery_pt discovery = handle;
+ discovery_t *discovery = handle;
status = celixThreadMutex_lock(&discovery->listenerReferencesMutex);
@@ -144,7 +144,7 @@ celix_status_t discovery_endpointListenerRemoved(void * handle, service_referenc
return status;
}
-celix_status_t discovery_informEndpointListeners(discovery_pt discovery, endpoint_description_pt endpoint, bool endpointAdded) {
+celix_status_t discovery_informEndpointListeners(discovery_t *discovery, endpoint_description_t *endpoint, bool endpointAdded) {
celix_status_t status;
// Inform listeners of new endpoint
@@ -157,31 +157,27 @@ celix_status_t discovery_informEndpointListeners(discovery_pt discovery, endpoin
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
service_reference_pt reference = hashMapEntry_getKey(entry);
- endpoint_listener_pt listener = NULL;
+ endpoint_listener_t *listener = NULL;
const char* scope = NULL;
serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
- filter_pt filter = filter_create(scope);
- bool matchResult = false;
+ celix_filter_t *filter = celix_filter_create(scope);
+ bool matchResult = celix_filter_match(filter, endpoint->properties);
+ if (matchResult) {
+ bundleContext_getService(discovery->context, reference, (void **) &listener);
+ if (endpointAdded) {
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Adding service (%s)", endpoint->service);
- status = filter_match(filter, endpoint->properties, &matchResult);
- if (status == CELIX_SUCCESS) {
- if (matchResult) {
- bundleContext_getService(discovery->context, reference, (void **) &listener);
- if (endpointAdded) {
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Adding service (%s)", endpoint->service);
+ listener->endpointAdded(listener->handle, endpoint, (char*)scope);
+ } else {
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Removing service (%s)", endpoint->service);
- listener->endpointAdded(listener->handle, endpoint, (char*)scope);
- } else {
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Removing service (%s)", endpoint->service);
-
- listener->endpointRemoved(listener->handle, endpoint, (char*)scope);
- }
+ listener->endpointRemoved(listener->handle, endpoint, (char*)scope);
}
-
- filter_destroy(filter);
}
+
+ celix_filter_destroy(filter);
}
hashMapIterator_destroy(iter);
}
@@ -192,7 +188,7 @@ celix_status_t discovery_informEndpointListeners(discovery_pt discovery, endpoin
return status;
}
-celix_status_t discovery_addDiscoveredEndpoint(discovery_pt discovery, endpoint_description_pt endpoint) {
+celix_status_t discovery_addDiscoveredEndpoint(discovery_t *discovery, endpoint_description_t *endpoint) {
celix_status_t status;
status = celixThreadMutex_lock(&discovery->discoveredServicesMutex);
@@ -215,7 +211,7 @@ celix_status_t discovery_addDiscoveredEndpoint(discovery_pt discovery, endpoint_
return status;
}
-celix_status_t discovery_removeDiscoveredEndpoint(discovery_pt discovery, endpoint_description_pt endpoint) {
+celix_status_t discovery_removeDiscoveredEndpoint(discovery_t *discovery, endpoint_description_t *endpoint) {
celix_status_t status;
status = celixThreadMutex_lock(&discovery->discoveredServicesMutex);
diff --git a/bundles/remote_services/discovery_common/src/discovery_activator.c b/bundles/remote_services/discovery_common/src/discovery_activator.c
index a28e39e..b089ced 100644
--- a/bundles/remote_services/discovery_common/src/discovery_activator.c
+++ b/bundles/remote_services/discovery_common/src/discovery_activator.c
@@ -38,19 +38,19 @@
#include "remote_constants.h"
struct activator {
- bundle_context_pt context;
- discovery_pt discovery;
- log_helper_pt loghelper;
+ celix_bundle_context_t *context;
+ discovery_t *discovery;
+ log_helper_t *loghelper;
- service_tracker_pt endpointListenerTracker;
- endpoint_listener_pt endpointListener;
- service_registration_pt endpointListenerService;
+ service_tracker_t *endpointListenerTracker;
+ endpoint_listener_t *endpointListener;
+ service_registration_t *endpointListenerService;
};
-celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_pt *tracker) {
+celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_t **tracker) {
celix_status_t status;
- service_tracker_customizer_pt customizer = NULL;
+ service_tracker_customizer_t *customizer = NULL;
status = serviceTrackerCustomizer_create(activator->discovery, discovery_endpointListenerAdding, discovery_endpointListenerAdded, discovery_endpointListenerModified,
discovery_endpointListenerRemoved, &customizer);
@@ -91,7 +91,7 @@ celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **us
return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
celix_status_t status;
struct activator *activator = userData;
const char *uuid = NULL;
@@ -128,7 +128,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
}
if (status == CELIX_SUCCESS) {
- endpoint_listener_pt endpointListener = calloc(1, sizeof(struct endpoint_listener));
+ endpoint_listener_t *endpointListener = calloc(1, sizeof(struct endpoint_listener));
if (endpointListener) {
endpointListener->handle = activator->discovery;
@@ -148,7 +148,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
celix_status_t status;
struct activator *activator = userData;
@@ -164,7 +164,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
celix_status_t status;
struct activator *activator = userData;
diff --git a/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c b/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c
index f12dfe7..d4e3668 100644
--- a/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c
+++ b/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c
@@ -37,12 +37,12 @@
struct endpoint_descriptor_reader {
xmlTextReaderPtr reader;
- log_helper_pt* loghelper;
+ log_helper_t **loghelper;
};
static valueType valueTypeFromString(char *name);
-celix_status_t endpointDescriptorReader_create(endpoint_discovery_poller_pt poller, endpoint_descriptor_reader_pt *reader) {
+celix_status_t endpointDescriptorReader_create(endpoint_discovery_poller_t *poller, endpoint_descriptor_reader_t **reader) {
celix_status_t status = CELIX_SUCCESS;
*reader = malloc(sizeof(**reader));
@@ -56,7 +56,7 @@ celix_status_t endpointDescriptorReader_create(endpoint_discovery_poller_pt poll
return status;
}
-celix_status_t endpointDescriptorReader_destroy(endpoint_descriptor_reader_pt reader) {
+celix_status_t endpointDescriptorReader_destroy(endpoint_descriptor_reader_t *reader) {
celix_status_t status = CELIX_SUCCESS;
reader->loghelper = NULL;
@@ -89,7 +89,7 @@ void endpointDescriptorReader_addMultiValuedProperty(celix_properties_t *propert
}
}
-celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_pt reader, char *document, array_list_pt *endpoints) {
+celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_t *reader, char *document, array_list_pt *endpoints) {
celix_status_t status = CELIX_SUCCESS;
reader->reader = xmlReaderForMemory(document, (int) strlen(document), NULL, "UTF-8", 0);
@@ -197,7 +197,7 @@ celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader
inXml = false;
}
} else if (xmlStrcmp(localname, ENDPOINT_DESCRIPTION) == 0) {
- endpoint_description_pt endpointDescription = NULL;
+ endpoint_description_t *endpointDescription = NULL;
// Completely parsed endpoint description, add it to our list of results...
if(endpointDescription_create(endpointProperties, &endpointDescription) == CELIX_SUCCESS){
arrayList_add(endpointDescriptions, endpointDescription);
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 4a5bcd7..78952d9 100644
--- a/bundles/remote_services/discovery_common/src/endpoint_descriptor_writer.c
+++ b/bundles/remote_services/discovery_common/src/endpoint_descriptor_writer.c
@@ -1,20 +1,20 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* endpoint_descriptor_writer.c
@@ -23,6 +23,7 @@
* \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
+
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlwriter.h>
@@ -39,11 +40,11 @@ struct endpoint_descriptor_writer {
xmlTextWriterPtr writer;
};
-static celix_status_t endpointDescriptorWriter_writeEndpoint(endpoint_descriptor_writer_pt writer, endpoint_description_pt endpoint);
+static celix_status_t endpointDescriptorWriter_writeEndpoint(endpoint_descriptor_writer_t *writer, endpoint_description_t *endpoint);
static char* valueTypeToString(valueType type);
-celix_status_t endpointDescriptorWriter_create(endpoint_descriptor_writer_pt *writer) {
+celix_status_t endpointDescriptorWriter_create(endpoint_descriptor_writer_t **writer) {
celix_status_t status = CELIX_SUCCESS;
*writer = malloc(sizeof(**writer));
@@ -64,14 +65,14 @@ celix_status_t endpointDescriptorWriter_create(endpoint_descriptor_writer_pt *wr
return status;
}
-celix_status_t endpointDescriptorWriter_destroy(endpoint_descriptor_writer_pt writer) {
+celix_status_t endpointDescriptorWriter_destroy(endpoint_descriptor_writer_t *writer) {
xmlFreeTextWriter(writer->writer);
xmlBufferFree(writer->buffer);
free(writer);
return CELIX_SUCCESS;
}
-celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_pt writer, array_list_pt endpoints, char **document) {
+celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_t *writer, array_list_pt endpoints, char **document) {
celix_status_t status = CELIX_SUCCESS;
int rc;
@@ -85,7 +86,7 @@ celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer
} else {
unsigned int i;
for (i = 0; i < arrayList_size(endpoints); i++) {
- endpoint_description_pt endpoint = arrayList_get(endpoints, i);
+ endpoint_description_t *endpoint = arrayList_get(endpoints, i);
status = endpointDescriptorWriter_writeEndpoint(writer, endpoint);
}
if (status == CELIX_SUCCESS) {
@@ -130,7 +131,7 @@ static celix_status_t endpointDescriptorWriter_writeUntypedValue(xmlTextWriterPt
return CELIX_SUCCESS;
}
-static celix_status_t endpointDescriptorWriter_writeEndpoint(endpoint_descriptor_writer_pt writer, endpoint_description_pt endpoint) {
+static celix_status_t endpointDescriptorWriter_writeEndpoint(endpoint_descriptor_writer_t *writer, endpoint_description_t *endpoint) {
celix_status_t status = CELIX_SUCCESS;
if (endpoint == NULL || writer == NULL) {
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 2baec0c..51291a5 100644
--- a/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c
+++ b/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c
@@ -46,14 +46,14 @@
#define DEFAULT_POLL_TIMEOUT "10" // seconds
static void *endpointDiscoveryPoller_performPeriodicPoll(void *data);
-celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_pt poller, char *url, array_list_pt currentEndpoints);
-static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_poller_pt poller, char *url, array_list_pt *updatedEndpoints);
+celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_t *poller, char *url, array_list_pt currentEndpoints);
+static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_poller_t *poller, char *url, array_list_pt *updatedEndpoints);
static celix_status_t endpointDiscoveryPoller_endpointDescriptionEquals(const void *endpointPtr, const void *comparePtr, bool *equals);
/**
* Allocates memory and initializes a new endpoint_discovery_poller instance.
*/
-celix_status_t endpointDiscoveryPoller_create(discovery_pt discovery, bundle_context_pt context, const char* defaultPollEndpoints, endpoint_discovery_poller_pt *poller) {
+celix_status_t endpointDiscoveryPoller_create(discovery_t *discovery, celix_bundle_context_t *context, const char* defaultPollEndpoints, endpoint_discovery_poller_t **poller) {
celix_status_t status;
*poller = malloc(sizeof(struct endpoint_discovery_poller));
@@ -124,7 +124,7 @@ celix_status_t endpointDiscoveryPoller_create(discovery_pt discovery, bundle_con
/**
* Destroys and frees up memory for a given endpoint_discovery_poller struct.
*/
-celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_pt poller) {
+celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_t *poller) {
celix_status_t status;
poller->running = false;
@@ -160,7 +160,7 @@ celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_pt poll
}
-celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_pt poller, array_list_pt urls) {
+celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, array_list_pt urls) {
celixThreadMutex_lock(&(poller)->pollerLock);
hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries);
@@ -181,7 +181,7 @@ celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_
/**
* Adds a new endpoint URL to the list of polled endpoints.
*/
-celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) {
+celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_t *poller, char *url) {
celix_status_t status;
status = celixThreadMutex_lock(&(poller)->pollerLock);
@@ -209,7 +209,7 @@ celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_p
/**
* Removes an endpoint URL from the list of polled endpoints.
*/
-celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) {
+celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_t *poller, char *url) {
celix_status_t status = CELIX_SUCCESS;
if (celixThreadMutex_lock(&poller->pollerLock) != CELIX_SUCCESS) {
@@ -228,7 +228,7 @@ celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discover
if (entries != NULL) {
for (unsigned int i = arrayList_size(entries); i > 0; i--) {
- endpoint_description_pt endpoint = arrayList_get(entries, i - 1);
+ endpoint_description_t *endpoint = arrayList_get(entries, i - 1);
discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
arrayList_remove(entries, i - 1);
endpointDescription_destroy(endpoint);
@@ -247,7 +247,7 @@ celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discover
-celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_pt poller, char *url, array_list_pt currentEndpoints) {
+celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_t *poller, char *url, array_list_pt currentEndpoints) {
celix_status_t status;
array_list_pt updatedEndpoints = NULL;
@@ -258,7 +258,7 @@ celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_pt poller,
if (status == CELIX_SUCCESS) {
if (updatedEndpoints != NULL) {
for (unsigned int i = arrayList_size(currentEndpoints); i > 0; i--) {
- endpoint_description_pt endpoint = arrayList_get(currentEndpoints, i - 1);
+ endpoint_description_t *endpoint = arrayList_get(currentEndpoints, i - 1);
if (!arrayList_contains(updatedEndpoints, endpoint)) {
status = discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
@@ -268,7 +268,7 @@ celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_pt poller,
}
for (int i = arrayList_size(updatedEndpoints); i > 0; i--) {
- endpoint_description_pt endpoint = arrayList_remove(updatedEndpoints, 0);
+ endpoint_description_t *endpoint = arrayList_remove(updatedEndpoints, 0);
if (!arrayList_contains(currentEndpoints, endpoint)) {
arrayList_add(currentEndpoints, endpoint);
@@ -289,7 +289,7 @@ celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_pt poller,
}
static void *endpointDiscoveryPoller_performPeriodicPoll(void *data) {
- endpoint_discovery_poller_pt poller = (endpoint_discovery_poller_pt) data;
+ endpoint_discovery_poller_t *poller = (endpoint_discovery_poller_t *) data;
useconds_t interval = (useconds_t) (poller->poll_interval * 1000000L);
@@ -347,7 +347,7 @@ static size_t endpointDiscoveryPoller_writeMemory(void *contents, size_t size, s
return realsize;
}
-static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_poller_pt poller, char *url, array_list_pt *updatedEndpoints) {
+static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_poller_t *poller, char *url, array_list_pt *updatedEndpoints) {
celix_status_t status = CELIX_SUCCESS;
@@ -375,7 +375,7 @@ static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_po
// process endpoints file
if (res == CURLE_OK) {
- endpoint_descriptor_reader_pt reader = NULL;
+ endpoint_descriptor_reader_t *reader = NULL;
status = endpointDescriptorReader_create(poller, &reader);
if (status == CELIX_SUCCESS) {
@@ -398,8 +398,8 @@ static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_po
}
static celix_status_t endpointDiscoveryPoller_endpointDescriptionEquals(const void *endpointPtr, const void *comparePtr, bool *equals) {
- endpoint_description_pt endpoint = (endpoint_description_pt) endpointPtr;
- endpoint_description_pt compare = (endpoint_description_pt) comparePtr;
+ endpoint_description_t *endpoint = (endpoint_description_t *) endpointPtr;
+ endpoint_description_t *compare = (endpoint_description_t *) comparePtr;
if (strcmp(endpoint->id, compare->id) == 0) {
*equals = true;
diff --git a/bundles/remote_services/discovery_common/src/endpoint_discovery_server.c b/bundles/remote_services/discovery_common/src/endpoint_discovery_server.c
index b047cf6..72e6fdc 100644
--- a/bundles/remote_services/discovery_common/src/endpoint_discovery_server.c
+++ b/bundles/remote_services/discovery_common/src/endpoint_discovery_server.c
@@ -19,10 +19,11 @@
/*
* endpoint_discovery_server.c
*
- * \date Aug 12, 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \date Aug 12, 2014
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
+
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
@@ -38,28 +39,28 @@
#include "endpoint_descriptor_writer.h"
// defines how often the webserver is restarted (with an increased port number)
-#define MAX_NUMBER_OF_RESTARTS 15
+#define MAX_NUMBER_OF_RESTARTS 15
#define DEFAULT_SERVER_THREADS "1"
#define CIVETWEB_REQUEST_NOT_HANDLED 0
#define CIVETWEB_REQUEST_HANDLED 1
static const char *response_headers =
- "HTTP/1.1 200 OK\r\n"
- "Cache: no-cache\r\n"
- "Content-Type: application/xml;charset=utf-8\r\n"
- "\r\n";
+ "HTTP/1.1 200 OK\r\n"
+ "Cache: no-cache\r\n"
+ "Content-Type: application/xml;charset=utf-8\r\n"
+ "\r\n";
struct endpoint_discovery_server {
- log_helper_pt* loghelper;
- hash_map_pt entries; // key = endpointId, value = endpoint_descriptor_pt
+ log_helper_t **loghelper;
+ hash_map_pt entries; // key = endpointId, value = endpoint_descriptor_pt
- celix_thread_mutex_t serverLock;
+ celix_thread_mutex_t serverLock;
- const char* path;
- const char *port;
- const char* ip;
- struct mg_context* ctx;
+ const char *path;
+ const char *port;
+ const char *ip;
+ struct mg_context *ctx;
};
// Forward declarations...
@@ -70,385 +71,384 @@ static char* format_path(const char* path);
static celix_status_t endpointDiscoveryServer_getIpAddress(char* interface, char** ip);
#endif
-celix_status_t endpointDiscoveryServer_create(
- discovery_pt discovery,
- bundle_context_pt context,
- const char* defaultServerPath,
- const char* defaultServerPort,
- const char* defaultServerIp,
- endpoint_discovery_server_pt *server) {
- celix_status_t status;
-
- const char *port = NULL;
- const char *ip = NULL;
- char *detectedIp = NULL;
- const char *path = NULL;
- const char *retries = NULL;
-
- int max_ep_num = MAX_NUMBER_OF_RESTARTS;
-
- *server = malloc(sizeof(struct endpoint_discovery_server));
- if (!*server) {
- return CELIX_ENOMEM;
- }
-
- (*server)->loghelper = &discovery->loghelper;
- (*server)->entries = hashMap_create(&utils_stringHash, NULL, &utils_stringEquals, NULL);
- if (!(*server)->entries) {
- return CELIX_ENOMEM;
- }
-
- status = celixThreadMutex_create(&(*server)->serverLock, NULL);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
-
- bundleContext_getProperty(context, DISCOVERY_SERVER_IP, &ip);
+celix_status_t endpointDiscoveryServer_create(discovery_t *discovery,
+ celix_bundle_context_t *context,
+ const char* defaultServerPath,
+ const char* defaultServerPort,
+ const char* defaultServerIp,
+ endpoint_discovery_server_t **server) {
+ celix_status_t status;
+
+ const char *port = NULL;
+ const char *ip = NULL;
+ char *detectedIp = NULL;
+ const char *path = NULL;
+ const char *retries = NULL;
+
+ int max_ep_num = MAX_NUMBER_OF_RESTARTS;
+
+ *server = malloc(sizeof(struct endpoint_discovery_server));
+ if (!*server) {
+ return CELIX_ENOMEM;
+ }
+
+ (*server)->loghelper = &discovery->loghelper;
+ (*server)->entries = hashMap_create(&utils_stringHash, NULL, &utils_stringEquals, NULL);
+ if (!(*server)->entries) {
+ return CELIX_ENOMEM;
+ }
+
+ status = celixThreadMutex_create(&(*server)->serverLock, NULL);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
+
+ bundleContext_getProperty(context, DISCOVERY_SERVER_IP, &ip);
#ifndef ANDROID
- if (ip == NULL) {
- const char *interface = NULL;
+ if (ip == NULL) {
+ const char *interface = NULL;
- bundleContext_getProperty(context, DISCOVERY_SERVER_INTERFACE, &interface);
- if ((interface != NULL) && (endpointDiscoveryServer_getIpAddress((char*)interface, &detectedIp) != CELIX_SUCCESS)) {
- logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_WARNING, "Could not retrieve IP address for interface %s", interface);
- }
+ bundleContext_getProperty(context, DISCOVERY_SERVER_INTERFACE, &interface);
+ if ((interface != NULL) && (endpointDiscoveryServer_getIpAddress((char*)interface, &detectedIp) != CELIX_SUCCESS)) {
+ logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_WARNING, "Could not retrieve IP address for interface %s", interface);
+ }
- if (detectedIp == NULL) {
- endpointDiscoveryServer_getIpAddress(NULL, &detectedIp);
- }
+ if (detectedIp == NULL) {
+ endpointDiscoveryServer_getIpAddress(NULL, &detectedIp);
+ }
- ip = detectedIp;
- }
+ ip = detectedIp;
+ }
#endif
- if (ip != NULL) {
- logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_INFO, "Using %s for service annunciation", ip);
- (*server)->ip = strdup(ip);
- }
- else {
- logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_WARNING, "No IP address for service annunciation set. Using %s", defaultServerIp);
- (*server)->ip = strdup((char*) defaultServerIp);
- }
-
- if (detectedIp != NULL) {
- free(detectedIp);
- }
-
- bundleContext_getProperty(context, DISCOVERY_SERVER_PORT, &port);
- if (port == NULL) {
- port = defaultServerPort;
- }
-
- bundleContext_getProperty(context, DISCOVERY_SERVER_PATH, &path);
- if (path == NULL) {
- path = defaultServerPath;
- }
-
- bundleContext_getProperty(context, DISCOVERY_SERVER_MAX_EP, &retries);
- if (retries != NULL) {
- errno=0;
- max_ep_num = strtol(retries,NULL,10);
- if(errno!=0 || max_ep_num<=0){
- max_ep_num=MAX_NUMBER_OF_RESTARTS;
- }
- }
-
- (*server)->path = format_path(path);
-
- const struct mg_callbacks callbacks = {
- .begin_request = endpointDiscoveryServer_callback,
- };
-
- unsigned int port_counter = 0;
- char newPort[10];
-
- do {
- const char *options[] = {
- "listening_ports", port,
- "num_threads", DEFAULT_SERVER_THREADS,
- NULL
- };
-
- (*server)->ctx = mg_start(&callbacks, (*server), options);
-
- if ((*server)->ctx != NULL)
- {
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Starting discovery server on port %s...", port);
- }
- else {
- errno = 0;
- char* endptr = (char*)port;
- long currentPort = strtol(port, &endptr, 10);
-
- if (*endptr || errno != 0) {
- currentPort = strtol(defaultServerPort, NULL, 10);
- }
-
- port_counter++;
- snprintf(&newPort[0], 10, "%ld", (currentPort+1));
-
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_WARNING, "Error while starting discovery server on port %s - retrying on port %s...", port, newPort);
- port = newPort;
-
- }
-
- } while(((*server)->ctx == NULL) && (port_counter < max_ep_num));
-
- (*server)->port = strdup(port);
-
- return status;
+ if (ip != NULL) {
+ logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_INFO, "Using %s for service annunciation", ip);
+ (*server)->ip = strdup(ip);
+ }
+ else {
+ logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_WARNING, "No IP address for service annunciation set. Using %s", defaultServerIp);
+ (*server)->ip = strdup((char*) defaultServerIp);
+ }
+
+ if (detectedIp != NULL) {
+ free(detectedIp);
+ }
+
+ bundleContext_getProperty(context, DISCOVERY_SERVER_PORT, &port);
+ if (port == NULL) {
+ port = defaultServerPort;
+ }
+
+ bundleContext_getProperty(context, DISCOVERY_SERVER_PATH, &path);
+ if (path == NULL) {
+ path = defaultServerPath;
+ }
+
+ bundleContext_getProperty(context, DISCOVERY_SERVER_MAX_EP, &retries);
+ if (retries != NULL) {
+ errno=0;
+ max_ep_num = strtol(retries,NULL,10);
+ if(errno!=0 || max_ep_num<=0){
+ max_ep_num=MAX_NUMBER_OF_RESTARTS;
+ }
+ }
+
+ (*server)->path = format_path(path);
+
+ const struct mg_callbacks callbacks = {
+ .begin_request = endpointDiscoveryServer_callback,
+ };
+
+ unsigned int port_counter = 0;
+ char newPort[10];
+
+ do {
+ const char *options[] = {
+ "listening_ports", port,
+ "num_threads", DEFAULT_SERVER_THREADS,
+ NULL
+ };
+
+ (*server)->ctx = mg_start(&callbacks, (*server), options);
+
+ if ((*server)->ctx != NULL)
+ {
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Starting discovery server on port %s...", port);
+ }
+ else {
+ errno = 0;
+ char* endptr = (char*)port;
+ long currentPort = strtol(port, &endptr, 10);
+
+ if (*endptr || errno != 0) {
+ currentPort = strtol(defaultServerPort, NULL, 10);
+ }
+
+ port_counter++;
+ snprintf(&newPort[0], 10, "%ld", (currentPort+1));
+
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_WARNING, "Error while starting discovery server on port %s - retrying on port %s...", port, newPort);
+ port = newPort;
+
+ }
+
+ } while(((*server)->ctx == NULL) && (port_counter < max_ep_num));
+
+ (*server)->port = strdup(port);
+
+ return status;
}
-celix_status_t endpointDiscoveryServer_getUrl(endpoint_discovery_server_pt server, char* url)
+celix_status_t endpointDiscoveryServer_getUrl(endpoint_discovery_server_t *server, char* url)
{
- celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
- if (server->ip && server->port && server->path) {
- sprintf(url, "http://%s:%s/%s", server->ip, server->port, server->path);
- status = CELIX_SUCCESS;
- }
+ if (server->ip && server->port && server->path) {
+ sprintf(url, "http://%s:%s/%s", server->ip, server->port, server->path);
+ status = CELIX_SUCCESS;
+ }
- return status;
+ return status;
}
-celix_status_t endpointDiscoveryServer_destroy(endpoint_discovery_server_pt server) {
- celix_status_t status;
+celix_status_t endpointDiscoveryServer_destroy(endpoint_discovery_server_t *server) {
+ celix_status_t status;
- // stop & block until the actual server is shut down...
- if (server->ctx != NULL) {
- mg_stop(server->ctx);
- server->ctx = NULL;
- }
+ // stop & block until the actual server is shut down...
+ if (server->ctx != NULL) {
+ mg_stop(server->ctx);
+ server->ctx = NULL;
+ }
- status = celixThreadMutex_lock(&server->serverLock);
+ status = celixThreadMutex_lock(&server->serverLock);
- hashMap_destroy(server->entries, true /* freeKeys */, false /* freeValues */);
+ hashMap_destroy(server->entries, true /* freeKeys */, false /* freeValues */);
- status = celixThreadMutex_unlock(&server->serverLock);
- status = celixThreadMutex_destroy(&server->serverLock);
+ status = celixThreadMutex_unlock(&server->serverLock);
+ status = celixThreadMutex_destroy(&server->serverLock);
- free((void*) server->path);
- free((void*) server->port);
- free((void*) server->ip);
+ free((void*) server->path);
+ free((void*) server->port);
+ free((void*) server->ip);
- free(server);
+ free(server);
- return status;
+ return status;
}
-celix_status_t endpointDiscoveryServer_addEndpoint(endpoint_discovery_server_pt server, endpoint_description_pt endpoint) {
- celix_status_t status;
+celix_status_t endpointDiscoveryServer_addEndpoint(endpoint_discovery_server_t *server, endpoint_description_t *endpoint) {
+ celix_status_t status;
- status = celixThreadMutex_lock(&server->serverLock);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = celixThreadMutex_lock(&server->serverLock);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
- // create a local copy of the endpointId which we can control...
- char* endpointId = strdup(endpoint->id);
- endpoint_description_pt cur_value = hashMap_get(server->entries, endpointId);
- if (!cur_value) {
- logHelper_log(*server->loghelper, OSGI_LOGSERVICE_INFO, "exposing new endpoint \"%s\"...", endpointId);
+ // create a local copy of the endpointId which we can control...
+ char* endpointId = strdup(endpoint->id);
+ endpoint_description_t *cur_value = hashMap_get(server->entries, endpointId);
+ if (!cur_value) {
+ logHelper_log(*server->loghelper, OSGI_LOGSERVICE_INFO, "exposing new endpoint \"%s\"...", endpointId);
- hashMap_put(server->entries, endpointId, endpoint);
- }
+ hashMap_put(server->entries, endpointId, endpoint);
+ }
- status = celixThreadMutex_unlock(&server->serverLock);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = celixThreadMutex_unlock(&server->serverLock);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
- return status;
+ return status;
}
-celix_status_t endpointDiscoveryServer_removeEndpoint(endpoint_discovery_server_pt server, endpoint_description_pt endpoint) {
- celix_status_t status;
+celix_status_t endpointDiscoveryServer_removeEndpoint(endpoint_discovery_server_t *server, endpoint_description_t *endpoint) {
+ celix_status_t status;
- status = celixThreadMutex_lock(&server->serverLock);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = celixThreadMutex_lock(&server->serverLock);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
- hash_map_entry_pt entry = hashMap_getEntry(server->entries, endpoint->id);
- if (entry) {
- char* key = hashMapEntry_getKey(entry);
+ hash_map_entry_pt entry = hashMap_getEntry(server->entries, endpoint->id);
+ if (entry) {
+ char* key = hashMapEntry_getKey(entry);
- logHelper_log(*server->loghelper, OSGI_LOGSERVICE_INFO, "removing endpoint \"%s\"...\n", key);
+ logHelper_log(*server->loghelper, OSGI_LOGSERVICE_INFO, "removing endpoint \"%s\"...\n", key);
- hashMap_remove(server->entries, key);
+ hashMap_remove(server->entries, key);
- // we've made this key, see _addEndpoint above...
- free((void*) key);
- }
+ // we've made this key, see _addEndpoint above...
+ free((void*) key);
+ }
- status = celixThreadMutex_unlock(&server->serverLock);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = celixThreadMutex_unlock(&server->serverLock);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
- return status;
+ return status;
}
static char* format_path(const char* path) {
- char* result = strdup(path);
- result = utils_stringTrim(result);
- // check whether the path starts with a leading slash...
- if (result[0] != '/') {
- size_t len = strlen(result);
- result = realloc(result, len + 2);
- memmove(result + 1, result, len);
- result[0] = '/';
- result[len + 1] = 0;
- }
- return result;
+ char* result = strdup(path);
+ result = utils_stringTrim(result);
+ // check whether the path starts with a leading slash...
+ if (result[0] != '/') {
+ size_t len = strlen(result);
+ result = realloc(result, len + 2);
+ memmove(result + 1, result, len);
+ result[0] = '/';
+ result[len + 1] = 0;
+ }
+ return result;
}
-static celix_status_t endpointDiscoveryServer_getEndpoints(endpoint_discovery_server_pt server, const char* the_endpoint_id, array_list_pt *endpoints) {
- celix_status_t status;
+static celix_status_t endpointDiscoveryServer_getEndpoints(endpoint_discovery_server_t *server, const char* the_endpoint_id, array_list_pt *endpoints) {
+ celix_status_t status;
- status = arrayList_create(endpoints);
- if (status != CELIX_SUCCESS) {
- return CELIX_ENOMEM;
- }
+ status = arrayList_create(endpoints);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_ENOMEM;
+ }
- hash_map_iterator_pt iter = hashMapIterator_create(server->entries);
- while (hashMapIterator_hasNext(iter)) {
- hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+ hash_map_iterator_pt iter = hashMapIterator_create(server->entries);
+ while (hashMapIterator_hasNext(iter)) {
+ hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- char* endpoint_id = hashMapEntry_getKey(entry);
- if (the_endpoint_id == NULL || strcmp(the_endpoint_id, endpoint_id) == 0) {
- endpoint_description_pt endpoint = hashMapEntry_getValue(entry);
+ char* endpoint_id = hashMapEntry_getKey(entry);
+ if (the_endpoint_id == NULL || strcmp(the_endpoint_id, endpoint_id) == 0) {
+ endpoint_description_t *endpoint = hashMapEntry_getValue(entry);
- arrayList_add(*endpoints, endpoint);
- }
- }
- hashMapIterator_destroy(iter);
+ arrayList_add(*endpoints, endpoint);
+ }
+ }
+ hashMapIterator_destroy(iter);
- return status;
+ return status;
}
static int endpointDiscoveryServer_writeEndpoints(struct mg_connection* conn, array_list_pt endpoints) {
- celix_status_t status;
- int rv = CIVETWEB_REQUEST_NOT_HANDLED;
+ celix_status_t status;
+ int rv = CIVETWEB_REQUEST_NOT_HANDLED;
- endpoint_descriptor_writer_pt writer = NULL;
- status = endpointDescriptorWriter_create(&writer);
- if (status == CELIX_SUCCESS) {
+ endpoint_descriptor_writer_t *writer = NULL;
+ status = endpointDescriptorWriter_create(&writer);
+ if (status == CELIX_SUCCESS) {
- char *buffer = NULL;
- status = endpointDescriptorWriter_writeDocument(writer, endpoints, &buffer);
- if (buffer) {
- mg_write(conn, response_headers, strlen(response_headers));
- mg_write(conn, buffer, strlen(buffer));
- }
+ char *buffer = NULL;
+ status = endpointDescriptorWriter_writeDocument(writer, endpoints, &buffer);
+ if (buffer) {
+ mg_write(conn, response_headers, strlen(response_headers));
+ mg_write(conn, buffer, strlen(buffer));
+ }
- rv = CIVETWEB_REQUEST_HANDLED;
- }
+ rv = CIVETWEB_REQUEST_HANDLED;
+ }
- if(writer!=NULL){
- endpointDescriptorWriter_destroy(writer);
- }
+ if (writer != NULL) {
+ endpointDescriptorWriter_destroy(writer);
+ }
- return rv;
+ return rv;
}
// returns all endpoints as XML...
-static int endpointDiscoveryServer_returnAllEndpoints(endpoint_discovery_server_pt server, struct mg_connection* conn) {
- int status = CIVETWEB_REQUEST_NOT_HANDLED;
+static int endpointDiscoveryServer_returnAllEndpoints(endpoint_discovery_server_t *server, struct mg_connection* conn) {
+ int status = CIVETWEB_REQUEST_NOT_HANDLED;
- array_list_pt endpoints = NULL;
+ array_list_pt endpoints = NULL;
- if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
- endpointDiscoveryServer_getEndpoints(server, NULL, &endpoints);
- if (endpoints) {
- status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
+ if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
+ endpointDiscoveryServer_getEndpoints(server, NULL, &endpoints);
+ if (endpoints) {
+ status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
- arrayList_destroy(endpoints);
- }
+ arrayList_destroy(endpoints);
+ }
- celixThreadMutex_unlock(&server->serverLock);
- }
+ celixThreadMutex_unlock(&server->serverLock);
+ }
- return status;
+ return status;
}
// returns a single endpoint as XML...
-static int endpointDiscoveryServer_returnEndpoint(endpoint_discovery_server_pt server, struct mg_connection* conn, const char* endpoint_id) {
- int status = CIVETWEB_REQUEST_NOT_HANDLED;
+static int endpointDiscoveryServer_returnEndpoint(endpoint_discovery_server_t *server, struct mg_connection* conn, const char* endpoint_id) {
+ int status = CIVETWEB_REQUEST_NOT_HANDLED;
- array_list_pt endpoints = NULL;
+ array_list_pt endpoints = NULL;
- if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
- endpointDiscoveryServer_getEndpoints(server, endpoint_id, &endpoints);
- if (endpoints) {
- status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
+ if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
+ endpointDiscoveryServer_getEndpoints(server, endpoint_id, &endpoints);
+ if (endpoints) {
+ status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
- arrayList_destroy(endpoints);
- }
+ arrayList_destroy(endpoints);
+ }
- celixThreadMutex_unlock(&server->serverLock);
- }
+ celixThreadMutex_unlock(&server->serverLock);
+ }
- return status;
+ return status;
}
static int endpointDiscoveryServer_callback(struct mg_connection* conn) {
- int status = CIVETWEB_REQUEST_NOT_HANDLED;
+ int status = CIVETWEB_REQUEST_NOT_HANDLED;
- const struct mg_request_info *request_info = mg_get_request_info(conn);
- if (request_info->uri != NULL && strcmp("GET", request_info->request_method) == 0) {
- endpoint_discovery_server_pt server = request_info->user_data;
+ const struct mg_request_info *request_info = mg_get_request_info(conn);
+ if (request_info->uri != NULL && strcmp("GET", request_info->request_method) == 0) {
+ endpoint_discovery_server_t *server = request_info->user_data;
- const char *uri = request_info->uri;
- const size_t path_len = strlen(server->path);
- const size_t uri_len = strlen(uri);
+ const char *uri = request_info->uri;
+ const size_t path_len = strlen(server->path);
+ const size_t uri_len = strlen(uri);
- if (strncmp(server->path, uri, strlen(server->path)) == 0) {
- // Be lenient when it comes to the trailing slash...
- if (path_len == uri_len || (uri_len == (path_len + 1) && uri[path_len] == '/')) {
- status = endpointDiscoveryServer_returnAllEndpoints(server, conn);
- } else {
- const char* endpoint_id = uri + path_len + 1; // right after the slash...
+ if (strncmp(server->path, uri, strlen(server->path)) == 0) {
+ // Be lenient when it comes to the trailing slash...
+ if (path_len == uri_len || (uri_len == (path_len + 1) && uri[path_len] == '/')) {
+ status = endpointDiscoveryServer_returnAllEndpoints(server, conn);
+ } else {
+ const char* endpoint_id = uri + path_len + 1; // right after the slash...
- status = endpointDiscoveryServer_returnEndpoint(server, conn, endpoint_id);
- }
- }
- }
+ status = endpointDiscoveryServer_returnEndpoint(server, conn, endpoint_id);
+ }
+ }
+ }
- return status;
+ return status;
}
#ifndef ANDROID
static celix_status_t endpointDiscoveryServer_getIpAddress(char* interface, char** ip) {
- celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
- struct ifaddrs *ifaddr, *ifa;
- char host[NI_MAXHOST];
-
- if (getifaddrs(&ifaddr) != -1)
- {
- for (ifa = ifaddr; ifa != NULL && status != CELIX_SUCCESS; ifa = ifa->ifa_next)
- {
- if (ifa->ifa_addr == NULL)
- continue;
-
- if ((getnameinfo(ifa->ifa_addr,sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
- if (interface == NULL) {
- *ip = strdup(host);
- status = CELIX_SUCCESS;
- }
- else if (strcmp(ifa->ifa_name, interface) == 0) {
- *ip = strdup(host);
- status = CELIX_SUCCESS;
- }
- }
- }
-
- freeifaddrs(ifaddr);
- }
-
- return status;
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+
+ struct ifaddrs *ifaddr, *ifa;
+ char host[NI_MAXHOST];
+
+ if (getifaddrs(&ifaddr) != -1)
+ {
+ for (ifa = ifaddr; ifa != NULL && status != CELIX_SUCCESS; ifa = ifa->ifa_next)
+ {
+ if (ifa->ifa_addr == NULL)
+ continue;
+
+ if ((getnameinfo(ifa->ifa_addr,sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
+ if (interface == NULL) {
+ *ip = strdup(host);
+ status = CELIX_SUCCESS;
+ }
+ else if (strcmp(ifa->ifa_name, interface) == 0) {
+ *ip = strdup(host);
+ status = CELIX_SUCCESS;
+ }
+ }
+ }
+
+ freeifaddrs(ifaddr);
+ }
+
+ return status;
}
#endif
diff --git a/bundles/remote_services/discovery_configured/src/discovery_impl.c b/bundles/remote_services/discovery_configured/src/discovery_impl.c
index 89c777e..a0c12e0 100644
--- a/bundles/remote_services/discovery_configured/src/discovery_impl.c
+++ b/bundles/remote_services/discovery_configured/src/discovery_impl.c
@@ -37,7 +37,7 @@
#include "discovery_impl.h"
-celix_status_t discovery_create(bundle_context_pt context, discovery_pt *discovery) {
+celix_status_t discovery_create(celix_bundle_context_t *context, discovery_t **discovery) {
celix_status_t status;
*discovery = malloc(sizeof(struct discovery));
@@ -61,7 +61,7 @@ celix_status_t discovery_create(bundle_context_pt context, discovery_pt *discove
return status;
}
-celix_status_t discovery_start(discovery_pt discovery) {
+celix_status_t discovery_start(discovery_t *discovery) {
celix_status_t status;
logHelper_start(discovery->loghelper);
@@ -79,7 +79,7 @@ celix_status_t discovery_start(discovery_pt discovery) {
return status;
}
-celix_status_t discovery_stop(discovery_pt discovery) {
+celix_status_t discovery_stop(discovery_t *discovery) {
celix_status_t status;
status = endpointDiscoveryServer_destroy(discovery->server);
@@ -90,7 +90,7 @@ celix_status_t discovery_stop(discovery_pt discovery) {
return status;
}
-celix_status_t discovery_destroy(discovery_pt discovery) {
+celix_status_t discovery_destroy(discovery_t *discovery) {
celix_status_t status = CELIX_SUCCESS;
discovery->context = NULL;
diff --git a/bundles/remote_services/discovery_configured/src/discovery_impl.h b/bundles/remote_services/discovery_configured/src/discovery_impl.h
index a9d56c1..9aa9097 100644
--- a/bundles/remote_services/discovery_configured/src/discovery_impl.h
+++ b/bundles/remote_services/discovery_configured/src/discovery_impl.h
@@ -45,18 +45,18 @@
//struct discovery_impl {
-// bundle_context_pt context;
+// celix_bundle_context_t *context;
//
// celix_thread_mutex_t listenerReferencesMutex;
// celix_thread_mutex_t discoveredServicesMutex;
//
// hash_map_pt listenerReferences; //key=serviceReference, value=nop
-// hash_map_pt discoveredServices; //key=endpointId (string), value=endpoint_description_pt
+// hash_map_pt discoveredServices; //key=endpointId (string), value=endpoint_description_t *
//
-// endpoint_discovery_poller_pt poller;
-// endpoint_discovery_server_pt server;
+// endpoint_discovery_poller_t *poller;
+// endpoint_discovery_server_t *server;
//
-// log_helper_pt loghelper;
+// log_helper_t *loghelper;
//};
#endif /* DISCOVERY_IMPL_H_ */
diff --git a/bundles/remote_services/discovery_etcd/src/discovery_impl.c b/bundles/remote_services/discovery_etcd/src/discovery_impl.c
index 500399e..7d23186 100644
--- a/bundles/remote_services/discovery_etcd/src/discovery_impl.c
+++ b/bundles/remote_services/discovery_etcd/src/discovery_impl.c
@@ -20,8 +20,8 @@
* discovery_impl.c
*
* \date Aug 8, 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdio.h>
#include <stdlib.h>
@@ -50,143 +50,143 @@
-celix_status_t discovery_create(bundle_context_pt context, discovery_t** out) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t discovery_create(celix_bundle_context_t *context, discovery_t** out) {
+ celix_status_t status = CELIX_SUCCESS;
- discovery_t* discovery = calloc(1, sizeof(*discovery));
- discovery_impl_t* pImpl = calloc(1, sizeof(*pImpl));
+ discovery_t* discovery = calloc(1, sizeof(*discovery));
+ discovery_impl_t* pImpl = calloc(1, sizeof(*pImpl));
- if (discovery != NULL && pImpl != NULL) {
- discovery->pImpl = pImpl;
- discovery->context = context;
- discovery->poller = NULL;
- discovery->server = NULL;
+ if (discovery != NULL && pImpl != NULL) {
+ discovery->pImpl = pImpl;
+ discovery->context = context;
+ discovery->poller = NULL;
+ discovery->server = NULL;
- discovery->listenerReferences = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2,
- NULL);
- discovery->discoveredServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+ discovery->listenerReferences = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2,
+ NULL);
+ discovery->discoveredServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
- status = celixThreadMutex_create(&discovery->listenerReferencesMutex, NULL);
- status = celixThreadMutex_create(&discovery->discoveredServicesMutex, NULL);
+ status = celixThreadMutex_create(&discovery->listenerReferencesMutex, NULL);
+ status = celixThreadMutex_create(&discovery->discoveredServicesMutex, NULL);
- logHelper_create(context, &discovery->loghelper);
- } else {
- status = CELIX_ENOMEM;
- free(discovery);
- free(pImpl);
- }
+ logHelper_create(context, &discovery->loghelper);
+ } else {
+ status = CELIX_ENOMEM;
+ free(discovery);
+ free(pImpl);
+ }
- if (status == CELIX_SUCCESS) {
- *out = discovery;
- }
+ if (status == CELIX_SUCCESS) {
+ *out = discovery;
+ }
- return status;
+ return status;
}
-celix_status_t discovery_destroy(discovery_pt discovery) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t discovery_destroy(discovery_t *discovery) {
+ celix_status_t status = CELIX_SUCCESS;
- discovery->context = NULL;
- discovery->poller = NULL;
- discovery->server = NULL;
+ discovery->context = NULL;
+ discovery->poller = NULL;
+ discovery->server = NULL;
- celixThreadMutex_lock(&discovery->discoveredServicesMutex);
+ celixThreadMutex_lock(&discovery->discoveredServicesMutex);
- hashMap_destroy(discovery->discoveredServices, false, false);
- discovery->discoveredServices = NULL;
+ hashMap_destroy(discovery->discoveredServices, false, false);
+ discovery->discoveredServices = NULL;
- celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
+ celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
- celixThreadMutex_destroy(&discovery->discoveredServicesMutex);
+ celixThreadMutex_destroy(&discovery->discoveredServicesMutex);
- celixThreadMutex_lock(&discovery->listenerReferencesMutex);
+ celixThreadMutex_lock(&discovery->listenerReferencesMutex);
- hashMap_destroy(discovery->listenerReferences, false, false);
- discovery->listenerReferences = NULL;
+ hashMap_destroy(discovery->listenerReferences, false, false);
+ discovery->listenerReferences = NULL;
- celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
+ celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
- celixThreadMutex_destroy(&discovery->listenerReferencesMutex);
+ celixThreadMutex_destroy(&discovery->listenerReferencesMutex);
- logHelper_destroy(&discovery->loghelper);
+ logHelper_destroy(&discovery->loghelper);
- free(discovery);
+ free(discovery);
- return status;
+ return status;
}
-celix_status_t discovery_start(discovery_pt discovery) {
+celix_status_t discovery_start(discovery_t *discovery) {
celix_status_t status = CELIX_SUCCESS;
- const char *port = NULL;
- const char *path = NULL;
+ const char *port = NULL;
+ const char *path = NULL;
- logHelper_start(discovery->loghelper);
+ logHelper_start(discovery->loghelper);
- bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PORT, &port);
- if (port == NULL) {
- port = DEFAULT_SERVER_PORT;
- }
+ bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PORT, &port);
+ if (port == NULL) {
+ port = DEFAULT_SERVER_PORT;
+ }
- bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PATH, &path);
- if (path == NULL) {
- path = DEFAULT_SERVER_PATH;
- }
+ bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PATH, &path);
+ if (path == NULL) {
+ path = DEFAULT_SERVER_PATH;
+ }
status = endpointDiscoveryPoller_create(discovery, discovery->context, DEFAULT_POLL_ENDPOINTS, &discovery->poller);
if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
+ return CELIX_BUNDLE_EXCEPTION;
}
status = endpointDiscoveryServer_create(discovery, discovery->context, DEFAULT_SERVER_PATH, DEFAULT_SERVER_PORT, DEFAULT_SERVER_IP, &discovery->server);
if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
+ return CELIX_BUNDLE_EXCEPTION;
}
status = etcdWatcher_create(discovery, discovery->context, &discovery->pImpl->watcher);
if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
+ return CELIX_BUNDLE_EXCEPTION;
}
return status;
}
-celix_status_t discovery_stop(discovery_pt discovery) {
- celix_status_t status;
+celix_status_t discovery_stop(discovery_t *discovery) {
+ celix_status_t status;
- status = etcdWatcher_destroy(discovery->pImpl->watcher);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = etcdWatcher_destroy(discovery->pImpl->watcher);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
- status = endpointDiscoveryServer_destroy(discovery->server);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = endpointDiscoveryServer_destroy(discovery->server);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
- status = endpointDiscoveryPoller_destroy(discovery->poller);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
- hash_map_iterator_pt iter;
+ status = endpointDiscoveryPoller_destroy(discovery->poller);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
+ hash_map_iterator_pt iter;
- celixThreadMutex_lock(&discovery->discoveredServicesMutex);
+ celixThreadMutex_lock(&discovery->discoveredServicesMutex);
- iter = hashMapIterator_create(discovery->discoveredServices);
- while (hashMapIterator_hasNext(iter)) {
- hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- endpoint_description_pt endpoint = hashMapEntry_getValue(entry);
+ iter = hashMapIterator_create(discovery->discoveredServices);
+ while (hashMapIterator_hasNext(iter)) {
+ hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+ endpoint_description_t *endpoint = hashMapEntry_getValue(entry);
- discovery_informEndpointListeners(discovery, endpoint, false);
- }
- hashMapIterator_destroy(iter);
+ discovery_informEndpointListeners(discovery, endpoint, false);
+ }
+ hashMapIterator_destroy(iter);
- celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
+ celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
- logHelper_stop(discovery->loghelper);
+ logHelper_stop(discovery->loghelper);
- return status;
+ return status;
}
diff --git a/bundles/remote_services/discovery_etcd/src/etcd_watcher.c b/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
index 1bf8b84..c9dee47 100644
--- a/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
+++ b/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
@@ -43,16 +43,16 @@
#include "endpoint_discovery_poller.h"
struct etcd_watcher {
- etcdlib_t *etcdlib;
+ etcdlib_t *etcdlib;
- discovery_pt discovery;
- log_helper_pt* loghelper;
+ discovery_t *discovery;
+ log_helper_t **loghelper;
hash_map_pt entries;
- celix_thread_mutex_t watcherLock;
- celix_thread_t watcherThread;
+ celix_thread_mutex_t watcherLock;
+ celix_thread_t watcherThread;
- volatile bool running;
+ volatile bool running;
};
@@ -75,7 +75,7 @@ struct etcd_watcher {
// note that the rootNode shouldn't have a leading slash
-static celix_status_t etcdWatcher_getRootPath(bundle_context_pt context, char* rootNode) {
+static celix_status_t etcdWatcher_getRootPath(celix_bundle_context_t *context, char* rootNode) {
celix_status_t status = CELIX_SUCCESS;
const char* rootPath = NULL;
@@ -89,7 +89,7 @@ static celix_status_t etcdWatcher_getRootPath(bundle_context_pt context, char* r
return status;
}
-static celix_status_t etcdWatcher_getLocalNodePath(bundle_context_pt context, char* localNodePath) {
+static celix_status_t etcdWatcher_getLocalNodePath(celix_bundle_context_t *context, char* localNodePath) {
celix_status_t status = CELIX_SUCCESS;
char rootPath[MAX_ROOTNODE_LENGTH];
const char* uuid = NULL;
@@ -111,7 +111,7 @@ static celix_status_t etcdWatcher_getLocalNodePath(bundle_context_pt context, ch
}
static void add_node(const char *key, const char *value, void* arg) {
- discovery_pt discovery = (discovery_pt) arg;
+ discovery_t *discovery = (discovery_t *) arg;
endpointDiscoveryPoller_addDiscoveryEndpoint(discovery->poller, (char *) value);
}
@@ -122,7 +122,7 @@ static void add_node(const char *key, const char *value, void* arg) {
* returns the modifiedIndex of the last modified
* discovery endpoint (see etcd documentation).
*/
-static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(etcd_watcher_pt watcher, discovery_pt discovery, long long* highestModified) {
+static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(etcd_watcher_t *watcher, discovery_t *discovery, long long* highestModified) {
celix_status_t status = CELIX_SUCCESS;
char rootPath[MAX_ROOTNODE_LENGTH];
@@ -138,7 +138,7 @@ static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(etcd_watcher_pt
}
-static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
+static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_t *watcher)
{
celix_status_t status = CELIX_BUNDLE_EXCEPTION;
char localNodePath[MAX_LOCALNODE_LENGTH];
@@ -149,8 +149,8 @@ static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
const char* ttlStr = NULL;
int ttl;
- bundle_context_pt context = watcher->discovery->context;
- endpoint_discovery_server_pt server = watcher->discovery->server;
+ celix_bundle_context_t *context = watcher->discovery->context;
+ endpoint_discovery_server_t *server = watcher->discovery->server;
// register own framework
if ((status = etcdWatcher_getLocalNodePath(context, localNodePath)) != CELIX_SUCCESS) {
@@ -194,9 +194,9 @@ static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
-static celix_status_t etcdWatcher_addEntry(etcd_watcher_pt watcher, char* key, char* value) {
+static celix_status_t etcdWatcher_addEntry(etcd_watcher_t *watcher, char* key, char* value) {
celix_status_t status = CELIX_BUNDLE_EXCEPTION;
- endpoint_discovery_poller_pt poller = watcher->discovery->poller;
+ endpoint_discovery_poller_t *poller = watcher->discovery->poller;
if (!hashMap_containsKey(watcher->entries, key)) {
status = endpointDiscoveryPoller_addDiscoveryEndpoint(poller, value);
@@ -209,9 +209,9 @@ static celix_status_t etcdWatcher_addEntry(etcd_watcher_pt watcher, char* key, c
return status;
}
-static celix_status_t etcdWatcher_removeEntry(etcd_watcher_pt watcher, char* key, char* value) {
+static celix_status_t etcdWatcher_removeEntry(etcd_watcher_t *watcher, char* key, char* value) {
celix_status_t status = CELIX_BUNDLE_EXCEPTION;
- endpoint_discovery_poller_pt poller = watcher->discovery->poller;
+ endpoint_discovery_poller_t *poller = watcher->discovery->poller;
hash_map_entry_pt entry = hashMap_getEntry(watcher->entries, key);
@@ -249,12 +249,12 @@ static celix_status_t etcdWatcher_removeEntry(etcd_watcher_pt watcher, char* key
* changing discovery endpoint information within etcd.
*/
static void* etcdWatcher_run(void* data) {
- etcd_watcher_pt watcher = (etcd_watcher_pt) data;
+ etcd_watcher_t *watcher = (etcd_watcher_t *) data;
time_t timeBeforeWatch = time(NULL);
char rootPath[MAX_ROOTNODE_LENGTH];
long long highestModified = 0;
- bundle_context_pt context = watcher->discovery->context;
+ celix_bundle_context_t *context = watcher->discovery->context;
etcdWatcher_addAlreadyExistingWatchpoints(watcher, watcher->discovery, &highestModified);
etcdWatcher_getRootPath(context, rootPath);
@@ -304,8 +304,7 @@ static void* etcdWatcher_run(void* data) {
* the ectdWatcher needs to have access to the endpoint_discovery_poller and therefore is only
* allowed to be created after the endpoint_discovery_poller
*/
-celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt context,
- etcd_watcher_pt *watcher)
+celix_status_t etcdWatcher_create(discovery_t *discovery, celix_bundle_context_t *context, etcd_watcher_t **watcher)
{
celix_status_t status = CELIX_SUCCESS;
@@ -371,7 +370,7 @@ celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt cont
}
-celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher) {
+celix_status_t etcdWatcher_destroy(etcd_watcher_t *watcher) {
celix_status_t status = CELIX_SUCCESS;
char localNodePath[MAX_LOCALNODE_LENGTH];
diff --git a/bundles/remote_services/discovery_etcd/src/etcd_watcher.h b/bundles/remote_services/discovery_etcd/src/etcd_watcher.h
index 56bae92..e1a7522 100644
--- a/bundles/remote_services/discovery_etcd/src/etcd_watcher.h
+++ b/bundles/remote_services/discovery_etcd/src/etcd_watcher.h
@@ -32,10 +32,9 @@
#include "endpoint_discovery_poller.h"
typedef struct etcd_watcher etcd_watcher_t;
-typedef struct etcd_watcher *etcd_watcher_pt;
-celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt context, etcd_watcher_pt *watcher);
-celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher);
+celix_status_t etcdWatcher_create(discovery_t *discovery, celix_bundle_context_t *context, etcd_watcher_t **watcher);
+celix_status_t etcdWatcher_destroy(etcd_watcher_t *watcher);
#endif /* ETCD_WATCHER_H_ */
diff --git a/bundles/remote_services/discovery_shm/src/discovery_impl.c b/bundles/remote_services/discovery_shm/src/discovery_impl.c
index fadff8c..f8c805a 100644
--- a/bundles/remote_services/discovery_shm/src/discovery_impl.c
+++ b/bundles/remote_services/discovery_shm/src/discovery_impl.c
@@ -48,7 +48,7 @@
#include "endpoint_discovery_poller.h"
#include "endpoint_discovery_server.h"
-celix_status_t discovery_create(bundle_context_pt context, discovery_t** out) {
+celix_status_t discovery_create(celix_bundle_context_t *context, discovery_t** out) {
celix_status_t status = CELIX_SUCCESS;
discovery_t* discovery = calloc(1, sizeof(*discovery));
@@ -83,7 +83,7 @@ celix_status_t discovery_create(bundle_context_pt context, discovery_t** out) {
-celix_status_t discovery_destroy(discovery_pt discovery) {
+celix_status_t discovery_destroy(discovery_t *discovery) {
celix_status_t status = CELIX_SUCCESS;
discovery->context = NULL;
@@ -116,7 +116,7 @@ celix_status_t discovery_destroy(discovery_pt discovery) {
return status;
}
-celix_status_t discovery_start(discovery_pt discovery) {
+celix_status_t discovery_start(discovery_t *discovery) {
celix_status_t status;
status = endpointDiscoveryPoller_create(discovery, discovery->context, DEFAULT_POLL_ENDPOINTS, &discovery->poller);
@@ -131,7 +131,7 @@ celix_status_t discovery_start(discovery_pt discovery) {
return status;
}
-celix_status_t discovery_stop(discovery_pt discovery) {
+celix_status_t discovery_stop(discovery_t *discovery) {
celix_status_t status;
status = discoveryShmWatcher_destroy(discovery);
@@ -150,7 +150,7 @@ celix_status_t discovery_stop(discovery_pt discovery) {
iter = hashMapIterator_create(discovery->discoveredServices);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- endpoint_description_pt endpoint = hashMapEntry_getValue(entry);
+ endpoint_description_t *endpoint = hashMapEntry_getValue(entry);
discovery_informEndpointListeners(discovery, endpoint, false);
}
diff --git a/bundles/remote_services/discovery_shm/src/discovery_shm.c b/bundles/remote_services/discovery_shm/src/discovery_shm.c
index 89569dc..53650ce 100644
--- a/bundles/remote_services/discovery_shm/src/discovery_shm.c
+++ b/bundles/remote_services/discovery_shm/src/discovery_shm.c
@@ -67,7 +67,7 @@ struct shmData {
void* shmAddress;
-static celix_status_t discoveryShm_removeWithIndex(shmData_pt data, int index);
+static celix_status_t discoveryShm_removeWithIndex(shmData_t *data, int index);
/* returns the ftok key to identify shared memory*/
static key_t discoveryShm_getKey() {
@@ -75,10 +75,10 @@ static key_t discoveryShm_getKey() {
}
/* creates a new shared memory block */
-celix_status_t discoveryShm_create(shmData_pt* data) {
+celix_status_t discoveryShm_create(shmData_t **data) {
celix_status_t status;
- shmData_pt shmData = calloc(1, sizeof(*shmData));
+ shmData_t *shmData = calloc(1, sizeof(*shmData));
key_t shmKey = discoveryShm_getKey();
if (!shmData) {
@@ -116,7 +116,7 @@ celix_status_t discoveryShm_create(shmData_pt* data) {
return status;
}
-celix_status_t discoveryShm_attach(shmData_pt* data) {
+celix_status_t discoveryShm_attach(shmData_t **data) {
celix_status_t status = CELIX_SUCCESS;
key_t shmKey = ftok(DISCOVERY_SHM_FILENAME, DISCOVERY_SHM_FTOK_ID);
int shmId = -1;
@@ -137,7 +137,7 @@ celix_status_t discoveryShm_attach(shmData_pt* data) {
return status;
}
-static celix_status_t discoveryShm_getwithIndex(shmData_pt data, char* key, char* value, int* index) {
+static celix_status_t discoveryShm_getwithIndex(shmData_t *data, char* key, char* value, int* index) {
celix_status_t status = CELIX_BUNDLE_EXCEPTION;
time_t currentTime = time(NULL);
unsigned int i;
@@ -161,7 +161,7 @@ static celix_status_t discoveryShm_getwithIndex(shmData_pt data, char* key, char
return status;
}
-celix_status_t discoveryShm_getKeys(shmData_pt data, char** keys, int* size) {
+celix_status_t discoveryShm_getKeys(shmData_t *data, char** keys, int* size) {
celix_status_t status;
status = celixThreadMutex_lock(&data->globalLock);
@@ -184,7 +184,7 @@ celix_status_t discoveryShm_getKeys(shmData_pt data, char** keys, int* size) {
return status;
}
-celix_status_t discoveryShm_set(shmData_pt data, char *key, char* value) {
+celix_status_t discoveryShm_set(shmData_t *data, char *key, char* value) {
celix_status_t status;
int index = -1;
@@ -215,7 +215,7 @@ celix_status_t discoveryShm_set(shmData_pt data, char *key, char* value) {
return status;
}
-celix_status_t discoveryShm_get(shmData_pt data, char* key, char* value) {
+celix_status_t discoveryShm_get(shmData_t *data, char* key, char* value) {
celix_status_t status;
status = celixThreadMutex_lock(&data->globalLock);
@@ -229,7 +229,7 @@ celix_status_t discoveryShm_get(shmData_pt data, char* key, char* value) {
return status;
}
-static celix_status_t discoveryShm_removeWithIndex(shmData_pt data, int index) {
+static celix_status_t discoveryShm_removeWithIndex(shmData_t *data, int index) {
celix_status_t status = CELIX_SUCCESS;
data->numOfEntries--;
@@ -240,7 +240,7 @@ static celix_status_t discoveryShm_removeWithIndex(shmData_pt data, int index) {
return status;
}
-celix_status_t discoveryShm_remove(shmData_pt data, char* key) {
+celix_status_t discoveryShm_remove(shmData_t *data, char* key) {
celix_status_t status;
int index = -1;
@@ -259,7 +259,7 @@ celix_status_t discoveryShm_remove(shmData_pt data, char* key) {
return status;
}
-celix_status_t discoveryShm_detach(shmData_pt data) {
+celix_status_t discoveryShm_detach(shmData_t *data) {
celix_status_t status = CELIX_BUNDLE_EXCEPTION;
if (data->numOfEntries == 0) {
@@ -272,7 +272,7 @@ celix_status_t discoveryShm_detach(shmData_pt data) {
return status;
}
-celix_status_t discoveryShm_destroy(shmData_pt data) {
+celix_status_t discoveryShm_destroy(shmData_t *data) {
celix_status_t status = CELIX_BUNDLE_EXCEPTION;
if (shmctl(data->shmId, IPC_RMID, 0) == 0) {
diff --git a/bundles/remote_services/discovery_shm/src/discovery_shm.h b/bundles/remote_services/discovery_shm/src/discovery_shm.h
index 9c4593b..e84be51 100644
--- a/bundles/remote_services/discovery_shm/src/discovery_shm.h
+++ b/bundles/remote_services/discovery_shm/src/discovery_shm.h
@@ -41,16 +41,16 @@
// we currently support 64 separate discovery instances
#define SHM_DATA_MAX_ENTRIES 64
-typedef struct shmData* shmData_pt;
+typedef struct shmData shmData_t;
/* creates a new shared memory block */
-celix_status_t discoveryShm_create(shmData_pt* data);
-celix_status_t discoveryShm_attach(shmData_pt* data);
-celix_status_t discoveryShm_set(shmData_pt data, char *key, char* value);
-celix_status_t discoveryShm_get(shmData_pt data, char* key, char* value);
-celix_status_t discoveryShm_getKeys(shmData_pt data, char** keys, int* size);
-celix_status_t discoveryShm_remove(shmData_pt data, char* key);
-celix_status_t discoveryShm_detach(shmData_pt data);
-celix_status_t discoveryShm_destroy(shmData_pt data);
+celix_status_t discoveryShm_create(shmData_t **data);
+celix_status_t discoveryShm_attach(shmData_t **data);
+celix_status_t discoveryShm_set(shmData_t *data, char *key, char* value);
+celix_status_t discoveryShm_get(shmData_t *data, char* key, char* value);
+celix_status_t discoveryShm_getKeys(shmData_t *data, char** keys, int* size);
+celix_status_t discoveryShm_remove(shmData_t *data, char* key);
+celix_status_t discoveryShm_detach(shmData_t *data);
+celix_status_t discoveryShm_destroy(shmData_t *data);
#endif
diff --git a/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.c b/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.c
index ef7df71..c31c968 100644
--- a/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.c
+++ b/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.c
@@ -50,7 +50,7 @@
struct shm_watcher {
- shmData_pt shmData;
+ shmData_t *shmData;
celix_thread_t watcherThread;
celix_thread_mutex_t watcherLock;
@@ -66,7 +66,7 @@ static celix_status_t discoveryShmWatcher_getRootPath(char* rootNode) {
return status;
}
-static celix_status_t discoveryShmWatcher_getLocalNodePath(bundle_context_pt context, char* localNodePath) {
+static celix_status_t discoveryShmWatcher_getLocalNodePath(celix_bundle_context_t *context, char* localNodePath) {
celix_status_t status;
char rootPath[MAX_ROOTNODE_LENGTH];
const char* uuid = NULL;
@@ -89,9 +89,9 @@ static celix_status_t discoveryShmWatcher_getLocalNodePath(bundle_context_pt con
}
/* retrieves all endpoints from shm and syncs them with the ones already available */
-static celix_status_t discoveryShmWatcher_syncEndpoints(discovery_pt discovery) {
+static celix_status_t discoveryShmWatcher_syncEndpoints(discovery_t *discovery) {
celix_status_t status = CELIX_SUCCESS;
- shm_watcher_pt watcher = discovery->pImpl->watcher;
+ shm_watcher_t *watcher = discovery->pImpl->watcher;
char** shmKeyArr = calloc(SHM_DATA_MAX_ENTRIES, sizeof(*shmKeyArr));
array_list_pt registeredKeyArr = NULL;
@@ -155,8 +155,8 @@ static celix_status_t discoveryShmWatcher_syncEndpoints(discovery_pt discovery)
}
static void* discoveryShmWatcher_run(void* data) {
- discovery_pt discovery = (discovery_pt) data;
- shm_watcher_pt watcher = discovery->pImpl->watcher;
+ discovery_t *discovery = (discovery_t *) data;
+ shm_watcher_t *watcher = discovery->pImpl->watcher;
char localNodePath[MAX_LOCALNODE_LENGTH];
char url[MAX_LOCALNODE_LENGTH];
@@ -181,9 +181,9 @@ static void* discoveryShmWatcher_run(void* data) {
return NULL;
}
-celix_status_t discoveryShmWatcher_create(discovery_pt discovery) {
+celix_status_t discoveryShmWatcher_create(discovery_t *discovery) {
celix_status_t status = CELIX_SUCCESS;
- shm_watcher_pt watcher = NULL;
+ shm_watcher_t *watcher = NULL;
watcher = calloc(1, sizeof(*watcher));
@@ -223,9 +223,9 @@ celix_status_t discoveryShmWatcher_create(discovery_pt discovery) {
return status;
}
-celix_status_t discoveryShmWatcher_destroy(discovery_pt discovery) {
+celix_status_t discoveryShmWatcher_destroy(discovery_t *discovery) {
celix_status_t status;
- shm_watcher_pt watcher = discovery->pImpl->watcher;
+ shm_watcher_t *watcher = discovery->pImpl->watcher;
char localNodePath[MAX_LOCALNODE_LENGTH];
celixThreadMutex_lock(&watcher->watcherLock);
diff --git a/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.h b/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.h
index 4e7e1d5..0e4ed9d 100644
--- a/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.h
+++ b/bundles/remote_services/discovery_shm/src/discovery_shmWatcher.h
@@ -32,10 +32,9 @@
#include "endpoint_discovery_poller.h"
typedef struct shm_watcher shm_watcher_t;
-typedef struct shm_watcher *shm_watcher_pt;
-celix_status_t discoveryShmWatcher_create(discovery_pt discovery);
-celix_status_t discoveryShmWatcher_destroy(discovery_pt discovery);
+celix_status_t discoveryShmWatcher_create(discovery_t *discovery);
+celix_status_t discoveryShmWatcher_destroy(discovery_t *discovery);
#endif /* DISCOVERY_SHM_WATCHER_H_ */
diff --git a/bundles/remote_services/examples/calculator_api/include/calculator_service.h b/bundles/remote_services/examples/calculator_api/include/calculator_service.h
index 579e06f..d654bf9 100644
--- a/bundles/remote_services/examples/calculator_api/include/calculator_service.h
+++ b/bundles/remote_services/examples/calculator_api/include/calculator_service.h
@@ -30,9 +30,9 @@
#define CALCULATOR_SERVICE "org.apache.celix.calc.api.Calculator"
#define CALCULATOR_CONFIGURATION_TYPE "org.amdatu.remote.admin.http"
-typedef struct calculator *calculator_pt;
+typedef struct calculator calculator_t;
-typedef struct calculator_service *calculator_service_pt;
+typedef struct calculator_service calculator_service_t;
/*
* The calculator service definition corresponds to the following Java interface:
@@ -44,10 +44,10 @@ typedef struct calculator_service *calculator_service_pt;
* }
*/
struct calculator_service {
- calculator_pt calculator;
- int (*add)(calculator_pt calculator, double a, double b, double *result);
- int (*sub)(calculator_pt calculator, double a, double b, double *result);
- int (*sqrt)(calculator_pt calculator, double a, double *result);
+ calculator_t *calculator;
+ int (*add)(calculator_t *calculator, double a, double b, double *result);
+ int (*sub)(calculator_t *calculator, double a, double b, double *result);
+ int (*sqrt)(calculator_t *calculator, double a, double *result);
};
diff --git a/bundles/remote_services/examples/calculator_service/CMakeLists.txt b/bundles/remote_services/examples/calculator_service/CMakeLists.txt
index e3e739a..b47a3ae 100644
--- a/bundles/remote_services/examples/calculator_service/CMakeLists.txt
+++ b/bundles/remote_services/examples/calculator_service/CMakeLists.txt
@@ -16,9 +16,9 @@
# under the License.
add_celix_bundle(calculator
- SOURCES
- src/calculator_impl
- src/calculator_activator
+ SOURCES
+ src/calculator_impl
+ src/calculator_activator
SYMBOLIC_NAME "apache_celix_remoting_calculator_impl"
VERSION 0.0.1
)
diff --git a/bundles/remote_services/examples/calculator_service/src/calculator_activator.c b/bundles/remote_services/examples/calculator_service/src/calculator_activator.c
index 541162f..c412ba1 100644
--- a/bundles/remote_services/examples/calculator_service/src/calculator_activator.c
+++ b/bundles/remote_services/examples/calculator_service/src/calculator_activator.c
@@ -1,28 +1,29 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* calculator_activator.c
*
* \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
+
#include <stdlib.h>
#include "bundle_activator.h"
@@ -33,70 +34,70 @@
#include "remote_constants.h"
struct activator {
- calculator_pt calculator;
- calculator_service_pt service;
+ calculator_t *calculator;
+ calculator_service_t *service;
- service_registration_pt calculatorReg;
+ service_registration_t *calculatorReg;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator;
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator;
- activator = calloc(1, sizeof(*activator));
- if (!activator) {
- status = CELIX_ENOMEM;
- } else {
- activator->calculatorReg = NULL;
+ activator = calloc(1, sizeof(*activator));
+ if (!activator) {
+ status = CELIX_ENOMEM;
+ } else {
+ activator->calculatorReg = NULL;
- *userData = activator;
- }
+ *userData = activator;
+ }
- return status;
+ return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
-
- status = calculator_create(&activator->calculator);
- if (status == CELIX_SUCCESS) {
- activator->service = calloc(1, sizeof(*activator->service));
- if (!activator->service) {
- status = CELIX_ENOMEM;
- } else {
- activator->service->calculator = activator->calculator;
- activator->service->add = calculator_add;
- activator->service->sub = calculator_sub;
- activator->service->sqrt = calculator_sqrt;
-
- celix_properties_t *properties = celix_properties_create();
- celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_INTERFACES, CALCULATOR_SERVICE);
- celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_CONFIGS, CALCULATOR_CONFIGURATION_TYPE);
- bundleContext_registerService(context, CALCULATOR_SERVICE, activator->service, properties, &activator->calculatorReg);
- }
- }
-
- return status;
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator = userData;
+
+ status = calculator_create(&activator->calculator);
+ if (status == CELIX_SUCCESS) {
+ activator->service = calloc(1, sizeof(*activator->service));
+ if (!activator->service) {
+ status = CELIX_ENOMEM;
+ } else {
+ activator->service->calculator = activator->calculator;
+ activator->service->add = calculator_add;
+ activator->service->sub = calculator_sub;
+ activator->service->sqrt = calculator_sqrt;
+
+ celix_properties_t *properties = celix_properties_create();
+ celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_INTERFACES, CALCULATOR_SERVICE);
+ celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_CONFIGS, CALCULATOR_CONFIGURATION_TYPE);
+ bundleContext_registerService(context, CALCULATOR_SERVICE, activator->service, properties, &activator->calculatorReg);
+ }
+ }
+
+ return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator = userData;
- serviceRegistration_unregister(activator->calculatorReg);
+ serviceRegistration_unregister(activator->calculatorReg);
- free(activator->service);
+ free(activator->service);
- calculator_destroy(&activator->calculator);
+ calculator_destroy(&activator->calculator);
- return status;
+ return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
+ celix_status_t status = CELIX_SUCCESS;
- free(userData);
+ free(userData);
- return status;
+ return status;
}
diff --git a/bundles/remote_services/examples/calculator_service/src/calculator_impl.c b/bundles/remote_services/examples/calculator_service/src/calculator_impl.c
index adccb52..f6f4821 100644
--- a/bundles/remote_services/examples/calculator_service/src/calculator_impl.c
+++ b/bundles/remote_services/examples/calculator_service/src/calculator_impl.c
@@ -1,28 +1,29 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* calculator_impl.c
*
* \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
+
#include <math.h>
#include <stdlib.h>
@@ -30,50 +31,50 @@
#include "calculator_impl.h"
-celix_status_t calculator_create(calculator_pt *calculator) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t calculator_create(calculator_t **calculator) {
+ celix_status_t status = CELIX_SUCCESS;
- *calculator = calloc(1, sizeof(**calculator));
- if (!*calculator) {
- status = CELIX_ENOMEM;
- }
+ *calculator = calloc(1, sizeof(**calculator));
+ if (!*calculator) {
+ status = CELIX_ENOMEM;
+ }
- return status;
+ return status;
}
-celix_status_t calculator_destroy(calculator_pt *calculator) {
- free(*calculator);
- return CELIX_SUCCESS;
+celix_status_t calculator_destroy(calculator_t **calculator) {
+ free(*calculator);
+ return CELIX_SUCCESS;
}
-celix_status_t calculator_add(calculator_pt calculator, double a, double b, double *result) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t calculator_add(calculator_t *calculator, double a, double b, double *result) {
+ celix_status_t status = CELIX_SUCCESS;
- *result = a + b;
- printf("CALCULATOR: Add: %f + %f = %f\n", a, b, *result);
+ *result = a + b;
+ printf("CALCULATOR: Add: %f + %f = %f\n", a, b, *result);
- return status;
+ return status;
}
-celix_status_t calculator_sub(calculator_pt calculator, double a, double b, double *result) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t calculator_sub(calculator_t *calculator, double a, double b, double *result) {
+ celix_status_t status = CELIX_SUCCESS;
- *result = a - b;
- printf("CALCULATOR: Sub: %f + %f = %f\n", a, b, *result);
+ *result = a - b;
+ printf("CALCULATOR: Sub: %f + %f = %f\n", a, b, *result);
- return status;
+ return status;
}
-celix_status_t calculator_sqrt(calculator_pt calculator, double a, double *result) {
- celix_status_t status = CELIX_SUCCESS;
+celix_status_t calculator_sqrt(calculator_t *calculator, double a, double *result) {
+ celix_status_t status = CELIX_SUCCESS;
- if (a > 0) {
- *result = sqrt(a);
- printf("CALCULATOR: Sqrt: %f = %f\n", a, *result);
- } else {
- printf("CALCULATOR: Sqrt: %f = ERR\n", a);
- status = CELIX_ILLEGAL_ARGUMENT;
- }
+ if (a > 0) {
+ *result = sqrt(a);
+ printf("CALCULATOR: Sqrt: %f = %f\n", a, *result);
+ } else {
+ printf("CALCULATOR: Sqrt: %f = ERR\n", a);
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
- return status;
+ return status;
}
diff --git a/bundles/remote_services/examples/calculator_service/src/calculator_impl.h b/bundles/remote_services/examples/calculator_service/src/calculator_impl.h
index 6967ec4..524442d 100644
--- a/bundles/remote_services/examples/calculator_service/src/calculator_impl.h
+++ b/bundles/remote_services/examples/calculator_service/src/calculator_impl.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* calculator_impl.h
*
* \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef CALCULATOR_IMPL_H_
@@ -34,10 +34,10 @@
struct calculator {
};
-celix_status_t calculator_create(calculator_pt *calculator);
-celix_status_t calculator_destroy(calculator_pt *calculator);
-celix_status_t calculator_add(calculator_pt calculator, double a, double b, double *result);
-celix_status_t calculator_sub(calculator_pt calculator, double a, double b, double *result);
-celix_status_t calculator_sqrt(calculator_pt calculator, double a, double *result);
+celix_status_t calculator_create(calculator_t **calculator);
+celix_status_t calculator_destroy(calculator_t **calculator);
+celix_status_t calculator_add(calculator_t *calculator, double a, double b, double *result);
+celix_status_t calculator_sub(calculator_t *calculator, double a, double b, double *result);
+celix_status_t calculator_sqrt(calculator_t *calculator, double a, double *result);
#endif /* CALCULATOR_IMPL_H_ */
diff --git a/bundles/remote_services/examples/calculator_shell/src/add_command.c b/bundles/remote_services/examples/calculator_shell/src/add_command.c
index 04df878..4bce883 100644
--- a/bundles/remote_services/examples/calculator_shell/src/add_command.c
+++ b/bundles/remote_services/examples/calculator_shell/src/add_command.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* add_command.c
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -37,8 +37,8 @@
static celix_status_t addCommand_isNumeric(char *number, bool *ret);
-void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
- celix_status_t status = CELIX_SUCCESS;
+void addCommand_execute(celix_bundle_context_t *context, char *line, FILE *out, FILE *err) {
+ celix_status_t status = CELIX_SUCCESS;
service_reference_pt calculatorService = NULL;
status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
@@ -46,52 +46,52 @@ void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *
fprintf(err, "ADD: Cannot get reference for %s.\n", CALCULATOR_SERVICE);
}
if (status == CELIX_SUCCESS) {
- char *token = line;
- strtok_r(line, " ", &token);
- char *aStr = strtok_r(NULL, " ", &token);
- char *bStr = strtok_r(NULL, " ", &token);
- bool aNumeric, bNumeric;
- if (aStr != NULL && bStr != NULL) {
- addCommand_isNumeric(aStr, &aNumeric);
- addCommand_isNumeric(bStr, &bNumeric);
- if(aNumeric && bNumeric){
- calculator_service_pt calculator = NULL;
- status = bundleContext_getService(context, calculatorService, (void *) &calculator);
- if (status == CELIX_SUCCESS && calculator != NULL) {
- double a = atof(aStr);
- double b = atof(bStr);
- double result = 0;
- status = calculator->add(calculator->calculator, a, b, &result);
- if (status == CELIX_SUCCESS) {
- fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
- } else {
- fprintf(err, "ADD: Unexpected exception in Calc service\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
- } else {
- fprintf(err, "ADD: Requires 2 numerical parameter\n");
- }
- } else {
- fprintf(err, "ADD: Requires 2 numerical parameter\n");
- }
+ char *token = line;
+ strtok_r(line, " ", &token);
+ char *aStr = strtok_r(NULL, " ", &token);
+ char *bStr = strtok_r(NULL, " ", &token);
+ bool aNumeric, bNumeric;
+ if (aStr != NULL && bStr != NULL) {
+ addCommand_isNumeric(aStr, &aNumeric);
+ addCommand_isNumeric(bStr, &bNumeric);
+ if (aNumeric && bNumeric) {
+ calculator_service_t *calculator = NULL;
+ status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+ if (status == CELIX_SUCCESS && calculator != NULL) {
+ double a = atof(aStr);
+ double b = atof(bStr);
+ double result = 0;
+ status = calculator->add(calculator->calculator, a, b, &result);
+ if (status == CELIX_SUCCESS) {
+ fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
+ } else {
+ fprintf(err, "ADD: Unexpected exception in Calc service\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+ } else {
+ fprintf(err, "ADD: Requires 2 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "ADD: Requires 2 numerical parameter\n");
+ }
} else {
- fprintf(err, "No calc service available\n");
+ fprintf(err, "No calc service available\n");
}
//return status;
}
static celix_status_t addCommand_isNumeric(char *number, bool *ret) {
- celix_status_t status = CELIX_SUCCESS;
- *ret = true;
- while(*number) {
- if(!isdigit(*number) && *number != '.') {
- *ret = false;
- break;
- }
- number++;
- }
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ *ret = true;
+ while(*number) {
+ if(!isdigit(*number) && *number != '.') {
+ *ret = false;
+ break;
+ }
+ number++;
+ }
+ return status;
}
diff --git a/bundles/remote_services/examples/calculator_shell/src/add_command.h b/bundles/remote_services/examples/calculator_shell/src/add_command.h
index 58a7bda..0ee05a2 100644
--- a/bundles/remote_services/examples/calculator_shell/src/add_command.h
+++ b/bundles/remote_services/examples/calculator_shell/src/add_command.h
@@ -1,32 +1,32 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* add_command.h
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef ADD_COMMAND_H_
#define ADD_COMMAND_H_
-void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
+void addCommand_execute(celix_bundle_context_t *context, char *line, FILE *out, FILE *err);
#endif /* ADD_COMMAND_H_ */
diff --git a/bundles/remote_services/examples/calculator_shell/src/calculator_shell_activator.c b/bundles/remote_services/examples/calculator_shell/src/calculator_shell_activator.c
index 3a33580..c357f1c 100644
--- a/bundles/remote_services/examples/calculator_shell/src/calculator_shell_activator.c
+++ b/bundles/remote_services/examples/calculator_shell/src/calculator_shell_activator.c
@@ -1,28 +1,29 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* calculator_shell_activator.c
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
+
#include <stdlib.h>
#include <string.h>
#include <command.h>
@@ -36,90 +37,90 @@
#include "sqrt_command.h"
struct activator {
- service_registration_pt addCommand;
- command_service_pt addCmd;
- command_service_pt addCmdSrv;
+ service_registration_t *addCommand;
+ command_service_t *addCmd;
+ command_service_t *addCmdSrv;
- service_registration_pt subCommand;
- command_service_pt subCmd;
- command_service_pt subCmdSrv;
+ service_registration_t *subCommand;
+ command_service_t *subCmd;
+ command_service_t *subCmdSrv;
- service_registration_pt sqrtCommand;
- command_service_pt sqrtCmd;
- command_service_pt sqrtCmdSrv;
+ service_registration_t *sqrtCommand;
+ command_service_t *sqrtCmd;
+ command_service_t *sqrtCmdSrv;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- if (status == CELIX_SUCCESS) {
- *userData = calloc(1, sizeof(struct activator));
- if (!*userData) {
- status = CELIX_ENOMEM;
- } else {
- ((struct activator *) (*userData))->addCommand = NULL;
- ((struct activator *) (*userData))->subCommand = NULL;
- ((struct activator *) (*userData))->sqrtCommand = NULL;
-
- ((struct activator *) (*userData))->addCmd = NULL;
- ((struct activator *) (*userData))->subCmd = NULL;
- ((struct activator *) (*userData))->sqrtCmd = NULL;
-
- ((struct activator *) (*userData))->addCmdSrv = NULL;
- ((struct activator *) (*userData))->subCmdSrv = NULL;
- ((struct activator *) (*userData))->sqrtCmdSrv = NULL;
- }
- }
-
- return CELIX_SUCCESS;
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+ if (status == CELIX_SUCCESS) {
+ *userData = calloc(1, sizeof(struct activator));
+ if (!*userData) {
+ status = CELIX_ENOMEM;
+ } else {
+ ((struct activator *) (*userData))->addCommand = NULL;
+ ((struct activator *) (*userData))->subCommand = NULL;
+ ((struct activator *) (*userData))->sqrtCommand = NULL;
+
+ ((struct activator *) (*userData))->addCmd = NULL;
+ ((struct activator *) (*userData))->subCmd = NULL;
+ ((struct activator *) (*userData))->sqrtCmd = NULL;
+
+ ((struct activator *) (*userData))->addCmdSrv = NULL;
+ ((struct activator *) (*userData))->subCmdSrv = NULL;
+ ((struct activator *) (*userData))->sqrtCmdSrv = NULL;
+ }
+ }
+
+ return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
- struct activator * activator = (struct activator *) userData;
+ struct activator * activator = (struct activator *) userData;
- activator->addCmdSrv = calloc(1, sizeof(*activator->addCmdSrv));
- activator->addCmdSrv->handle = context;
- activator->addCmdSrv->executeCommand = (void *)addCommand_execute;
- celix_properties_t *props = celix_properties_create();
- celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "add");
- bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->addCmdSrv, props, &activator->addCommand);
+ activator->addCmdSrv = calloc(1, sizeof(*activator->addCmdSrv));
+ activator->addCmdSrv->handle = context;
+ activator->addCmdSrv->executeCommand = (void *)addCommand_execute;
+ celix_properties_t *props = celix_properties_create();
+ celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "add");
+ bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->addCmdSrv, props, &activator->addCommand);
- activator->sqrtCmdSrv = calloc(1, sizeof(*activator->sqrtCmdSrv));
- activator->sqrtCmdSrv->handle = context;
- activator->sqrtCmdSrv->executeCommand = (void *)sqrtCommand_execute;
- props = celix_properties_create();
- celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "sqrt");
- bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->sqrtCmdSrv, props, &activator->sqrtCommand);
+ activator->sqrtCmdSrv = calloc(1, sizeof(*activator->sqrtCmdSrv));
+ activator->sqrtCmdSrv->handle = context;
+ activator->sqrtCmdSrv->executeCommand = (void *)sqrtCommand_execute;
+ props = celix_properties_create();
+ celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "sqrt");
+ bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->sqrtCmdSrv, props, &activator->sqrtCommand);
- activator->subCmdSrv = calloc(1, sizeof(*activator->subCmdSrv));
- activator->subCmdSrv->handle = context;
- activator->subCmdSrv->executeCommand = (void *)subCommand_execute;
- props = celix_properties_create();
- celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "sub");
- bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->subCmdSrv, props, &activator->subCommand);
+ activator->subCmdSrv = calloc(1, sizeof(*activator->subCmdSrv));
+ activator->subCmdSrv->handle = context;
+ activator->subCmdSrv->executeCommand = (void *)subCommand_execute;
+ props = celix_properties_create();
+ celix_properties_set(props, OSGI_SHELL_COMMAND_NAME, "sub");
+ bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->subCmdSrv, props, &activator->subCommand);
- return status;
+ return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
- struct activator * activator = (struct activator *) userData;
- serviceRegistration_unregister(activator->addCommand);
- serviceRegistration_unregister(activator->subCommand);
- serviceRegistration_unregister(activator->sqrtCommand);
+ struct activator * activator = (struct activator *) userData;
+ serviceRegistration_unregister(activator->addCommand);
+ serviceRegistration_unregister(activator->subCommand);
+ serviceRegistration_unregister(activator->sqrtCommand);
- free(activator->addCmdSrv);
- free(activator->subCmdSrv);
- free(activator->sqrtCmdSrv);
+ free(activator->addCmdSrv);
+ free(activator->subCmdSrv);
+ free(activator->sqrtCmdSrv);
- return status;
+ return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- free(userData);
- return CELIX_SUCCESS;
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
+ free(userData);
+ return CELIX_SUCCESS;
}
diff --git a/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c b/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c
index 928cd59..9b9d95f 100644
--- a/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c
+++ b/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* sqrt_command.c
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -35,8 +35,8 @@
static celix_status_t sqrtCommand_isNumeric(char *number, bool *ret);
-void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
- celix_status_t status = CELIX_SUCCESS;
+void sqrtCommand_execute(celix_bundle_context_t *context, char *line, FILE *out, FILE *err) {
+ celix_status_t status = CELIX_SUCCESS;
service_reference_pt calculatorService = NULL;
status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
@@ -44,49 +44,49 @@ void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE
fprintf(err, "SQRT: Cannot get reference for %s.\n", CALCULATOR_SERVICE);
}
if (status == CELIX_SUCCESS) {
- char *token = line;
- strtok_r(line, " ", &token);
- char *aStr = strtok_r(NULL, " ", &token);
- if(aStr != NULL){
- bool numeric;
- sqrtCommand_isNumeric(aStr, &numeric);
- if (numeric) {
- calculator_service_pt calculator = NULL;
- status = bundleContext_getService(context, calculatorService, (void *) &calculator);
- if (status == CELIX_SUCCESS && calculator != NULL) {
- double a = atof(aStr);
- double result = 0;
- status = calculator->sqrt(calculator->calculator, a, &result);
- if (status == CELIX_SUCCESS) {
- fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
- } else {
- fprintf(err, "SQRT: Unexpected exception in Calc service\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
- } else {
- fprintf(err, "SQRT: Requires 1 numerical parameter\n");
- }
- } else {
- fprintf(err, "SQRT: Requires 1 numerical parameter\n");
- }
+ char *token = line;
+ strtok_r(line, " ", &token);
+ char *aStr = strtok_r(NULL, " ", &token);
+ if(aStr != NULL){
+ bool numeric;
+ sqrtCommand_isNumeric(aStr, &numeric);
+ if (numeric) {
+ calculator_service_t *calculator = NULL;
+ status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+ if (status == CELIX_SUCCESS && calculator != NULL) {
+ double a = atof(aStr);
+ double result = 0;
+ status = calculator->sqrt(calculator->calculator, a, &result);
+ if (status == CELIX_SUCCESS) {
+ fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
+ } else {
+ fprintf(err, "SQRT: Unexpected exception in Calc service\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+ } else {
+ fprintf(err, "SQRT: Requires 1 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "SQRT: Requires 1 numerical parameter\n");
+ }
} else {
- fprintf(err, "No calc service available\n");
+ fprintf(err, "No calc service available\n");
}
//return status;
}
static celix_status_t sqrtCommand_isNumeric(char *number, bool *ret) {
- celix_status_t status = CELIX_SUCCESS;
- *ret = true;
- while(*number) {
- if(!isdigit(*number) && *number != '.') {
- *ret = false;
- break;
- }
- number++;
- }
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ *ret = true;
+ while(*number) {
+ if(!isdigit(*number) && *number != '.') {
+ *ret = false;
+ break;
+ }
+ number++;
+ }
+ return status;
}
diff --git a/bundles/remote_services/examples/calculator_shell/src/sqrt_command.h b/bundles/remote_services/examples/calculator_shell/src/sqrt_command.h
index c9d07d2..28655a1 100644
--- a/bundles/remote_services/examples/calculator_shell/src/sqrt_command.h
+++ b/bundles/remote_services/examples/calculator_shell/src/sqrt_command.h
@@ -1,32 +1,32 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* sqrt_command.h
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef SQRT_COMMAND_H_
#define SQRT_COMMAND_H_
-void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
+void sqrtCommand_execute(celix_bundle_context_t *context, char *line, FILE *out, FILE *err);
#endif /* SQRT_COMMAND_H_ */
diff --git a/bundles/remote_services/examples/calculator_shell/src/sub_command.c b/bundles/remote_services/examples/calculator_shell/src/sub_command.c
index ce0d388..c08b035 100644
--- a/bundles/remote_services/examples/calculator_shell/src/sub_command.c
+++ b/bundles/remote_services/examples/calculator_shell/src/sub_command.c
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* sub_command.c
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
@@ -35,8 +35,8 @@
static celix_status_t subCommand_isNumeric(char *number, bool *ret);
-void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
- celix_status_t status = CELIX_SUCCESS;
+void subCommand_execute(celix_bundle_context_t *context, char *line, FILE *out, FILE *err) {
+ celix_status_t status = CELIX_SUCCESS;
service_reference_pt calculatorService = NULL;
status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
@@ -44,52 +44,52 @@ void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *
fprintf(err, "SUB: Cannot get reference for %s\n", CALCULATOR_SERVICE);
}
if (status == CELIX_SUCCESS) {
- char *token = line;
- strtok_r(line, " ", &token);
- char *aStr = strtok_r(NULL, " ", &token);
- char *bStr = strtok_r(NULL, " ", &token);
- if(aStr != NULL && bStr != NULL ){
- bool aNumeric, bNumeric;
- subCommand_isNumeric(aStr, &aNumeric);
- subCommand_isNumeric(bStr, &bNumeric);
- if (aNumeric && bNumeric) {
- calculator_service_pt calculator = NULL;
- status = bundleContext_getService(context, calculatorService, (void *) &calculator);
- if (status == CELIX_SUCCESS && calculator != NULL) {
- double a = atof(aStr);
- double b = atof(bStr);
- double result = 0;
- status = calculator->sub(calculator->calculator, a, b, &result);
- if (status == CELIX_SUCCESS) {
- fprintf(out, "CALCULATOR_SHELL: Sub: %f - %f = %f\n", a, b, result);
- } else {
- fprintf(err, "SUB: Unexpected exception in Calc service\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
- } else {
- fprintf(err, "SUB: Requires 2 numerical parameter\n");
- }
- } else {
- fprintf(err, "SUB: Requires 2 numerical parameter\n");
- }
+ char *token = line;
+ strtok_r(line, " ", &token);
+ char *aStr = strtok_r(NULL, " ", &token);
+ char *bStr = strtok_r(NULL, " ", &token);
+ if(aStr != NULL && bStr != NULL ){
+ bool aNumeric, bNumeric;
+ subCommand_isNumeric(aStr, &aNumeric);
+ subCommand_isNumeric(bStr, &bNumeric);
+ if (aNumeric && bNumeric) {
+ calculator_service_t *calculator = NULL;
+ status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+ if (status == CELIX_SUCCESS && calculator != NULL) {
+ double a = atof(aStr);
+ double b = atof(bStr);
+ double result = 0;
+ status = calculator->sub(calculator->calculator, a, b, &result);
+ if (status == CELIX_SUCCESS) {
+ fprintf(out, "CALCULATOR_SHELL: Sub: %f - %f = %f\n", a, b, result);
+ } else {
+ fprintf(err, "SUB: Unexpected exception in Calc service\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+ } else {
+ fprintf(err, "SUB: Requires 2 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "SUB: Requires 2 numerical parameter\n");
+ }
} else {
- fprintf(err, "No calc service available\n");
+ fprintf(err, "No calc service available\n");
}
//return status;
}
static celix_status_t subCommand_isNumeric(char *number, bool *ret) {
- celix_status_t status = CELIX_SUCCESS;
- *ret = true;
- while(*number) {
- if(!isdigit(*number) && *number != '.') {
- *ret = false;
- break;
- }
- number++;
- }
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+ *ret = true;
+ while(*number) {
+ if(!isdigit(*number) && *number != '.') {
+ *ret = false;
+ break;
+ }
+ number++;
+ }
+ return status;
}
diff --git a/bundles/remote_services/examples/calculator_shell/src/sub_command.h b/bundles/remote_services/examples/calculator_shell/src/sub_command.h
index cf13616..7b9b777 100644
--- a/bundles/remote_services/examples/calculator_shell/src/sub_command.h
+++ b/bundles/remote_services/examples/calculator_shell/src/sub_command.h
@@ -1,32 +1,32 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* sub_command.h
*
* \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef SUB_COMMAND_H_
#define SUB_COMMAND_H_
-void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
+void subCommand_execute(celix_bundle_context_t *context, char *line, FILE *out, FILE *err);
#endif /* SUB_COMMAND_H_ */
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.c b/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.c
index 74eb259..f87d875 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.c
+++ b/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <unistd.h>
-static celix_status_t dfi_findFileForFramework(bundle_context_pt context, const char *fileName, FILE **out) {
+static celix_status_t dfi_findFileForFramework(celix_bundle_context_t *context, const char *fileName, FILE **out) {
celix_status_t status;
char pwd[1024];
@@ -48,7 +48,7 @@ static celix_status_t dfi_findFileForFramework(bundle_context_pt context, const
return status;
}
-static celix_status_t dfi_findFileForBundle(bundle_pt bundle, const char *fileName, FILE **out) {
+static celix_status_t dfi_findFileForBundle(celix_bundle_t *bundle, const char *fileName, FILE **out) {
celix_status_t status;
//Checking if descriptor is in root dir of bundle
@@ -85,7 +85,7 @@ static celix_status_t dfi_findFileForBundle(bundle_pt bundle, const char *fileNa
return status;
}
-celix_status_t dfi_findDescriptor(bundle_context_pt context, bundle_pt bundle, const char *name, FILE **out) {
+celix_status_t dfi_findDescriptor(celix_bundle_context_t *context, celix_bundle_t *bundle, const char *name, FILE **out) {
celix_status_t status;
char fileName[128];
@@ -107,7 +107,7 @@ celix_status_t dfi_findDescriptor(bundle_context_pt context, bundle_pt bundle, c
return status;
}
-celix_status_t dfi_findAvprDescriptor(bundle_context_pt context, bundle_pt bundle, const char *name, FILE **out) {
+celix_status_t dfi_findAvprDescriptor(celix_bundle_context_t *context, celix_bundle_t *bundle, const char *name, FILE **out) {
celix_status_t status;
char fileName[128];
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.h b/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.h
index b3056c4..02bb49c 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.h
+++ b/bundles/remote_services/remote_service_admin_dfi/src/dfi_utils.h
@@ -25,7 +25,7 @@
#include "celix_errno.h"
-celix_status_t dfi_findDescriptor(bundle_context_pt context, bundle_pt bundle, const char *name, FILE **out);
-celix_status_t dfi_findAvprDescriptor(bundle_context_pt context, bundle_pt bundle, const char *name, FILE **out);
+celix_status_t dfi_findDescriptor(celix_bundle_context_t *context, celix_bundle_t *bundle, const char *name, FILE **out);
+celix_status_t dfi_findAvprDescriptor(celix_bundle_context_t *context, celix_bundle_t *bundle, const char *name, FILE **out);
#endif
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c b/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c
index e5b4f46..a0bd763 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c
+++ b/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.c
@@ -1,20 +1,20 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
#include <jansson.h>
@@ -30,16 +30,16 @@
#include "dfi_utils.h"
struct export_reference {
- endpoint_description_pt endpoint; //owner
+ endpoint_description_t *endpoint; //owner
service_reference_pt reference;
};
struct export_registration {
- bundle_context_pt context;
+ celix_bundle_context_t * context;
struct export_reference exportReference;
char *servId;
dyn_interface_type *intf; //owner
- service_tracker_pt tracker;
+ service_tracker_t *tracker;
celix_thread_mutex_t mutex;
void *service; //protected by mutex
@@ -50,10 +50,10 @@ struct export_registration {
FILE *logFile;
};
-static void exportRegistration_addServ(export_registration_pt reg, service_reference_pt ref, void *service);
-static void exportRegistration_removeServ(export_registration_pt reg, service_reference_pt ref, void *service);
+static void exportRegistration_addServ(export_registration_t *reg, service_reference_pt ref, void *service);
+static void exportRegistration_removeServ(export_registration_t *reg, service_reference_pt ref, void *service);
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, FILE *logFile, export_registration_pt *out) {
+celix_status_t exportRegistration_create(log_helper_t *helper, service_reference_pt reference, endpoint_description_t *endpoint, celix_bundle_context_t *context, FILE *logFile, export_registration_t **out) {
celix_status_t status = CELIX_SUCCESS;
const char *servId = NULL;
@@ -62,7 +62,7 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
logHelper_log(helper, OSGI_LOGSERVICE_WARNING, "Cannot find service.id for ref");
}
- export_registration_pt reg = NULL;
+ export_registration_t *reg = NULL;
if (status == CELIX_SUCCESS) {
reg = calloc(1, sizeof(*reg));
if (reg == NULL) {
@@ -85,7 +85,7 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
const char *exports = NULL;
CELIX_DO_IF(status, serviceReference_getProperty(reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exports));
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
CELIX_DO_IF(status, serviceReference_getBundle(reference, &bundle));
FILE *descriptor = NULL;
@@ -123,7 +123,7 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
}
if (status == CELIX_SUCCESS) {
- service_tracker_customizer_pt cust = NULL;
+ service_tracker_customizer_t *cust = NULL;
status = serviceTrackerCustomizer_create(reg, NULL, (void *) exportRegistration_addServ, NULL,
(void *) exportRegistration_removeServ, &cust);
if (status == CELIX_SUCCESS) {
@@ -143,7 +143,7 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
return status;
}
-celix_status_t exportRegistration_call(export_registration_pt export, char *data, int datalength, char **responseOut, int *responseLength) {
+celix_status_t exportRegistration_call(export_registration_t *export, char *data, int datalength, char **responseOut, int *responseLength) {
int status = CELIX_SUCCESS;
*responseLength = -1;
@@ -164,7 +164,7 @@ celix_status_t exportRegistration_call(export_registration_pt export, char *data
return status;
}
-void exportRegistration_destroy(export_registration_pt reg) {
+void exportRegistration_destroy(export_registration_t *reg) {
if (reg != NULL) {
if (reg->intf != NULL) {
dyn_interface_type *intf = reg->intf;
@@ -173,7 +173,7 @@ void exportRegistration_destroy(export_registration_pt reg) {
}
if (reg->exportReference.endpoint != NULL) {
- endpoint_description_pt ep = reg->exportReference.endpoint;
+ endpoint_description_t *ep = reg->exportReference.endpoint;
reg->exportReference.endpoint = NULL;
endpointDescription_destroy(ep);
}
@@ -189,7 +189,7 @@ void exportRegistration_destroy(export_registration_pt reg) {
}
}
-celix_status_t exportRegistration_start(export_registration_pt reg) {
+celix_status_t exportRegistration_start(export_registration_t *reg) {
celix_status_t status = CELIX_SUCCESS;
serviceTracker_open(reg->tracker);
@@ -197,7 +197,7 @@ celix_status_t exportRegistration_start(export_registration_pt reg) {
}
-celix_status_t exportRegistration_stop(export_registration_pt reg) {
+celix_status_t exportRegistration_stop(export_registration_t *reg) {
celix_status_t status = CELIX_SUCCESS;
if (status == CELIX_SUCCESS) {
status = bundleContext_ungetServiceReference(reg->context, reg->exportReference.reference);
@@ -206,13 +206,13 @@ celix_status_t exportRegistration_stop(export_registration_pt reg) {
return status;
}
-static void exportRegistration_addServ(export_registration_pt reg, service_reference_pt ref, void *service) {
+static void exportRegistration_addServ(export_registration_t *reg, service_reference_pt ref, void *service) {
celixThreadMutex_lock(®->mutex);
reg->service = service;
celixThreadMutex_unlock(®->mutex);
}
-static void exportRegistration_removeServ(export_registration_pt reg, service_reference_pt ref, void *service) {
+static void exportRegistration_removeServ(export_registration_t *reg, service_reference_pt ref, void *service) {
celixThreadMutex_lock(®->mutex);
if (reg->service == service) {
reg->service = NULL;
@@ -221,22 +221,22 @@ static void exportRegistration_removeServ(export_registration_pt reg, service_re
}
-celix_status_t exportRegistration_close(export_registration_pt reg) {
+celix_status_t exportRegistration_close(export_registration_t *reg) {
celix_status_t status = CELIX_SUCCESS;
exportRegistration_stop(reg);
return status;
}
-celix_status_t exportRegistration_getException(export_registration_pt registration) {
+celix_status_t exportRegistration_getException(export_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
//TODO
return status;
}
-celix_status_t exportRegistration_getExportReference(export_registration_pt registration, export_reference_pt *out) {
+celix_status_t exportRegistration_getExportReference(export_registration_t *registration, export_reference_t **out) {
celix_status_t status = CELIX_SUCCESS;
- export_reference_pt ref = calloc(1, sizeof(*ref));
+ export_reference_t *ref = calloc(1, sizeof(*ref));
if (ref != NULL) {
ref->endpoint = registration->exportReference.endpoint;
ref->reference = registration->exportReference.reference;
@@ -251,13 +251,13 @@ celix_status_t exportRegistration_getExportReference(export_registration_pt regi
return status;
}
-celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference, endpoint_description_pt *endpoint) {
+celix_status_t exportReference_getExportedEndpoint(export_reference_t *reference, endpoint_description_t **endpoint) {
celix_status_t status = CELIX_SUCCESS;
*endpoint = reference->endpoint;
return status;
}
-celix_status_t exportReference_getExportedService(export_reference_pt reference, service_reference_pt *ref) {
+celix_status_t exportReference_getExportedService(export_reference_t *reference, service_reference_pt *ref) {
celix_status_t status = CELIX_SUCCESS;
*ref = reference->reference;
return status;
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.h b/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.h
index fb126ae..5454797 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.h
+++ b/bundles/remote_services/remote_service_admin_dfi/src/export_registration_dfi.h
@@ -25,14 +25,14 @@
#include "log_helper.h"
#include "endpoint_description.h"
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, FILE *logFile, export_registration_pt *registration);
-celix_status_t exportRegistration_close(export_registration_pt registration);
-void exportRegistration_destroy(export_registration_pt registration);
+celix_status_t exportRegistration_create(log_helper_t *helper, service_reference_pt reference, endpoint_description_t *endpoint, celix_bundle_context_t *context, FILE *logFile, export_registration_t **registration);
+celix_status_t exportRegistration_close(export_registration_t *registration);
+void exportRegistration_destroy(export_registration_t *registration);
-celix_status_t exportRegistration_start(export_registration_pt registration);
-celix_status_t exportRegistration_stop(export_registration_pt registration);
+celix_status_t exportRegistration_start(export_registration_t *registration);
+celix_status_t exportRegistration_stop(export_registration_t *registration);
-celix_status_t exportRegistration_call(export_registration_pt export, char *data, int datalength, char **response, int *responseLength);
+celix_status_t exportRegistration_call(export_registration_t *export, char *data, int datalength, char **response, int *responseLength);
#endif //CELIX_EXPORT_REGISTRATION_DFI_H
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c b/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
index f7f6567..64706ba 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
+++ b/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
@@ -30,8 +30,8 @@
#include "remote_service_admin_dfi_constants.h"
struct import_registration {
- bundle_context_pt context;
- endpoint_description_pt endpoint; //TODO owner? -> free when destroyed
+ celix_bundle_context_t *context;
+ endpoint_description_t * endpoint; //TODO owner? -> free when destroyed
const char *classObject; //NOTE owned by endpoint
version_pt version;
@@ -40,7 +40,7 @@ struct import_registration {
void *sendHandle;
service_factory_pt factory;
- service_registration_pt factoryReg;
+ service_registration_t *factoryReg;
hash_map_pt proxies; //key -> bundle, value -> service_proxy
celix_thread_mutex_t proxiesMutex; //protects proxies
@@ -54,17 +54,17 @@ struct service_proxy {
size_t count;
};
-static celix_status_t importRegistration_createProxy(import_registration_pt import, bundle_pt bundle,
+static celix_status_t importRegistration_createProxy(import_registration_t *import, celix_bundle_t *bundle,
struct service_proxy **proxy);
static void importRegistration_proxyFunc(void *userData, void *args[], void *returnVal);
static void importRegistration_destroyProxy(struct service_proxy *proxy);
-static void importRegistration_clearProxies(import_registration_pt import);
-static const char* importRegistration_getUrl(import_registration_pt reg);
-static const char* importRegistration_getServiceName(import_registration_pt reg);
+static void importRegistration_clearProxies(import_registration_t *import);
+static const char* importRegistration_getUrl(import_registration_t *reg);
+static const char* importRegistration_getServiceName(import_registration_t *reg);
-celix_status_t importRegistration_create(bundle_context_pt context, endpoint_description_pt endpoint, const char *classObject, const char* serviceVersion, FILE *logFile, import_registration_pt *out) {
+celix_status_t importRegistration_create(celix_bundle_context_t *context, endpoint_description_t *endpoint, const char *classObject, const char* serviceVersion, FILE *logFile, import_registration_t **out) {
celix_status_t status = CELIX_SUCCESS;
- import_registration_pt reg = calloc(1, sizeof(*reg));
+ import_registration_t *reg = calloc(1, sizeof(*reg));
if (reg != NULL) {
reg->factory = calloc(1, sizeof(*reg->factory));
@@ -100,7 +100,7 @@ celix_status_t importRegistration_create(bundle_context_pt context, endpoint_des
}
-celix_status_t importRegistration_setSendFn(import_registration_pt reg,
+celix_status_t importRegistration_setSendFn(import_registration_t *reg,
send_func_type send,
void *handle) {
celixThreadMutex_lock(®->mutex);
@@ -111,7 +111,7 @@ celix_status_t importRegistration_setSendFn(import_registration_pt reg,
return CELIX_SUCCESS;
}
-static void importRegistration_clearProxies(import_registration_pt import) {
+static void importRegistration_clearProxies(import_registration_t *import) {
if (import != NULL) {
pthread_mutex_lock(&import->proxiesMutex);
if (import->proxies != NULL) {
@@ -127,7 +127,7 @@ static void importRegistration_clearProxies(import_registration_pt import) {
}
}
-void importRegistration_destroy(import_registration_pt import) {
+void importRegistration_destroy(import_registration_t *import) {
if (import != NULL) {
if (import->proxies != NULL) {
hashMap_destroy(import->proxies, false, false);
@@ -148,7 +148,7 @@ void importRegistration_destroy(import_registration_pt import) {
}
}
-celix_status_t importRegistration_start(import_registration_pt import) {
+celix_status_t importRegistration_start(import_registration_t *import) {
celix_status_t status = CELIX_SUCCESS;
if (import->factoryReg == NULL && import->factory != NULL) {
celix_properties_t *props = celix_properties_copy(import->endpoint->properties);
@@ -159,7 +159,7 @@ celix_status_t importRegistration_start(import_registration_pt import) {
return status;
}
-celix_status_t importRegistration_stop(import_registration_pt import) {
+celix_status_t importRegistration_stop(import_registration_t *import) {
celix_status_t status = CELIX_SUCCESS;
if (import->factoryReg != NULL) {
@@ -173,7 +173,7 @@ celix_status_t importRegistration_stop(import_registration_pt import) {
}
-celix_status_t importRegistration_getService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **out) {
+celix_status_t importRegistration_getService(import_registration_t *import, celix_bundle_t *bundle, service_registration_t *registration, void **out) {
celix_status_t status = CELIX_SUCCESS;
/*
@@ -203,7 +203,7 @@ celix_status_t importRegistration_getService(import_registration_pt import, bund
return status;
}
-static celix_status_t importRegistration_createProxy(import_registration_pt import, bundle_pt bundle, struct service_proxy **out) {
+static celix_status_t importRegistration_createProxy(import_registration_t *import, celix_bundle_t *bundle, struct service_proxy **out) {
celix_status_t status;
dyn_interface_type* intf = NULL;
FILE *descriptor = NULL;
@@ -298,7 +298,7 @@ static celix_status_t importRegistration_createProxy(import_registration_pt impo
static void importRegistration_proxyFunc(void *userData, void *args[], void *returnVal) {
int status = CELIX_SUCCESS;
struct method_entry *entry = userData;
- import_registration_pt import = *((void **)args[0]);
+ import_registration_t *import = *((void **)args[0]);
if (import == NULL || import->send == NULL) {
status = CELIX_ILLEGAL_ARGUMENT;
@@ -348,7 +348,7 @@ static void importRegistration_proxyFunc(void *userData, void *args[], void *ret
}
}
-celix_status_t importRegistration_ungetService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **out) {
+celix_status_t importRegistration_ungetService(import_registration_t *import, celix_bundle_t *bundle, service_registration_t *registration, void **out) {
celix_status_t status = CELIX_SUCCESS;
assert(import != NULL);
@@ -388,38 +388,38 @@ static void importRegistration_destroyProxy(struct service_proxy *proxy) {
}
-celix_status_t importRegistration_close(import_registration_pt registration) {
+celix_status_t importRegistration_close(import_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
importRegistration_stop(registration);
return status;
}
-celix_status_t importRegistration_getException(import_registration_pt registration) {
+celix_status_t importRegistration_getException(import_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
//TODO
return status;
}
-celix_status_t importRegistration_getImportReference(import_registration_pt registration, import_reference_pt *reference) {
+celix_status_t importRegistration_getImportReference(import_registration_t *registration, import_reference_t **reference) {
celix_status_t status = CELIX_SUCCESS;
//TODO
return status;
}
-celix_status_t importReference_getImportedEndpoint(import_reference_pt reference) {
+celix_status_t importReference_getImportedEndpoint(import_reference_t *reference) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t importReference_getImportedService(import_reference_pt reference) {
+celix_status_t importReference_getImportedService(import_reference_t *reference) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-static const char* importRegistration_getUrl(import_registration_pt reg) {
+static const char* importRegistration_getUrl(import_registration_t *reg) {
return celix_properties_get(reg->endpoint->properties, RSA_DFI_ENDPOINT_URL, "!Error!");
}
-static const char* importRegistration_getServiceName(import_registration_pt reg) {
+static const char* importRegistration_getServiceName(import_registration_t *reg) {
return reg->endpoint->service;
}
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 01777e9..a7bbfe6 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
@@ -25,20 +25,20 @@
#include <celix_errno.h>
-typedef void (*send_func_type)(void *handle, endpoint_description_pt endpointDescription, char *request, char **reply, int* replyStatus);
+typedef void (*send_func_type)(void *handle, endpoint_description_t *endpointDescription, char *request, char **reply, int* replyStatus);
-celix_status_t importRegistration_create(bundle_context_pt context, endpoint_description_pt description, const char *classObject, const char* serviceVersion, FILE *logFile,
- import_registration_pt *import);
-celix_status_t importRegistration_close(import_registration_pt import);
-void importRegistration_destroy(import_registration_pt import);
+celix_status_t importRegistration_create(celix_bundle_context_t *context, endpoint_description_t *description, const char *classObject, const char* serviceVersion, FILE *logFile,
+ import_registration_t **import);
+celix_status_t importRegistration_close(import_registration_t *import);
+void importRegistration_destroy(import_registration_t *import);
-celix_status_t importRegistration_setSendFn(import_registration_pt reg,
+celix_status_t importRegistration_setSendFn(import_registration_t *reg,
send_func_type,
void *handle);
-celix_status_t importRegistration_start(import_registration_pt import);
-celix_status_t importRegistration_stop(import_registration_pt import);
+celix_status_t importRegistration_start(import_registration_t *import);
+celix_status_t importRegistration_stop(import_registration_t *import);
-celix_status_t importRegistration_getService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **service);
-celix_status_t importRegistration_ungetService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **service);
+celix_status_t importRegistration_getService(import_registration_t *import, celix_bundle_t *bundle, service_registration_t *registration, void **service);
+celix_status_t importRegistration_ungetService(import_registration_t *import, celix_bundle_t *bundle, service_registration_t *registration, void **service);
#endif //CELIX_IMPORT_REGISTRATION_DFI_H
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_activator.c b/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_activator.c
index 76f5459..3cb5524 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_activator.c
+++ b/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_activator.c
@@ -28,12 +28,12 @@
#include "import_registration_dfi.h"
struct activator {
- remote_service_admin_pt admin;
- remote_service_admin_service_pt adminService;
- service_registration_pt registration;
+ remote_service_admin_t *admin;
+ remote_service_admin_service_t *adminService;
+ service_registration_t *registration;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator;
@@ -50,10 +50,10 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
- remote_service_admin_service_pt remoteServiceAdmin = NULL;
+ remote_service_admin_service_t *remoteServiceAdmin = NULL;
status = remoteServiceAdmin_create(context, &activator->admin);
if (status == CELIX_SUCCESS) {
@@ -90,7 +90,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
@@ -105,7 +105,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c b/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c
index 04de351..df8e8ef 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c
+++ b/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c
@@ -57,8 +57,8 @@
logHelper_log((admin)->loghelper, OSGI_LOGSERVICE_ERROR, (msg), ##__VA_ARGS__)
struct remote_service_admin {
- bundle_context_pt context;
- log_helper_pt loghelper;
+ celix_bundle_context_t *context;
+ log_helper_t *loghelper;
celix_thread_mutex_t exportedServicesLock;
hash_map_pt exportedServices;
@@ -99,14 +99,14 @@ static const char *no_content_response_headers =
static const unsigned int DEFAULT_TIMEOUT = 0;
static int remoteServiceAdmin_callback(struct mg_connection *conn);
-static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_pt admin, service_reference_pt reference, celix_properties_t *props, char *interface, endpoint_description_pt *description);
-static celix_status_t remoteServiceAdmin_send(void *handle, endpoint_description_pt endpointDescription, char *request, char **reply, int* replyStatus);
+static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_t *admin, service_reference_pt reference, celix_properties_t *props, char *interface, endpoint_description_t **description);
+static celix_status_t remoteServiceAdmin_send(void *handle, endpoint_description_t *endpointDescription, char *request, char **reply, int* replyStatus);
static celix_status_t remoteServiceAdmin_getIpAddress(char* interface, char** ip);
static size_t remoteServiceAdmin_readCallback(void *ptr, size_t size, size_t nmemb, void *userp);
static size_t remoteServiceAdmin_write(void *contents, size_t size, size_t nmemb, void *userp);
-static void remoteServiceAdmin_log(remote_service_admin_pt admin, int level, const char *file, int line, const char *msg, ...);
+static void remoteServiceAdmin_log(remote_service_admin_t *admin, int level, const char *file, int line, const char *msg, ...);
-celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin) {
+celix_status_t remoteServiceAdmin_create(celix_bundle_context_t *context, remote_service_admin_t **admin) {
celix_status_t status = CELIX_SUCCESS;
*admin = calloc(1, sizeof(**admin));
@@ -196,7 +196,7 @@ celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_servi
}
-celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin)
+celix_status_t remoteServiceAdmin_destroy(remote_service_admin_t **admin)
{
celix_status_t status = CELIX_SUCCESS;
@@ -214,7 +214,7 @@ celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin)
}
-celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
+celix_status_t remoteServiceAdmin_stop(remote_service_admin_t *admin) {
celix_status_t status = CELIX_SUCCESS;
celixThreadMutex_lock(&admin->exportedServicesLock);
@@ -224,7 +224,7 @@ celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
array_list_pt exports = hashMapIterator_nextValue(iter);
int i;
for (i = 0; i < arrayList_size(exports); i++) {
- export_registration_pt export = arrayList_get(exports, i);
+ export_registration_t *export = arrayList_get(exports, i);
if (export != NULL) {
exportRegistration_stop(export);
exportRegistration_destroy(export);
@@ -239,7 +239,7 @@ celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
int i;
int size = arrayList_size(admin->importedServices);
for (i = 0; i < size ; i += 1) {
- import_registration_pt import = arrayList_get(admin->importedServices, i);
+ import_registration_t *import = arrayList_get(admin->importedServices, i);
if (import != NULL) {
importRegistration_stop(import);
importRegistration_destroy(import);
@@ -267,14 +267,14 @@ celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
*/
//void *remoteServiceAdmin_callback(enum mg_event event, struct mg_connection *conn, const struct mg_request_info *request_info) {
-celix_status_t importRegistration_getFactory(import_registration_pt import, service_factory_pt *factory);
+celix_status_t importRegistration_getFactory(import_registration_t *import, service_factory_pt *factory);
static int remoteServiceAdmin_callback(struct mg_connection *conn) {
int result = 1; // zero means: let civetweb handle it further, any non-zero value means it is handled by us...
const struct mg_request_info *request_info = mg_get_request_info(conn);
if (request_info->uri != NULL) {
- remote_service_admin_pt rsa = request_info->user_data;
+ remote_service_admin_t *rsa = request_info->user_data;
if (strncmp(request_info->uri, "/service/", 9) == 0 && strcmp("POST", request_info->request_method) == 0) {
@@ -294,17 +294,17 @@ static int remoteServiceAdmin_callback(struct mg_connection *conn) {
celixThreadMutex_lock(&rsa->exportedServicesLock);
//find endpoint
- export_registration_pt export = NULL;
+ export_registration_t *export = NULL;
hash_map_iterator_pt iter = hashMapIterator_create(rsa->exportedServices);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
array_list_pt exports = hashMapEntry_getValue(entry);
int expIt = 0;
for (expIt = 0; expIt < arrayList_size(exports); expIt++) {
- export_registration_pt check = arrayList_get(exports, expIt);
- export_reference_pt ref = NULL;
+ export_registration_t *check = arrayList_get(exports, expIt);
+ export_reference_t * ref = NULL;
exportRegistration_getExportReference(check, &ref);
- endpoint_description_pt checkEndpoint = NULL;
+ endpoint_description_t * checkEndpoint = NULL;
exportReference_getExportedEndpoint(ref, &checkEndpoint);
if (serviceId == checkEndpoint->serviceId) {
export = check;
@@ -353,7 +353,7 @@ static int remoteServiceAdmin_callback(struct mg_connection *conn) {
return result;
}
-celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations) {
+celix_status_t remoteServiceAdmin_exportService(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations) {
celix_status_t status = CELIX_SUCCESS;
bool export = false;
@@ -425,8 +425,8 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, c
if (status == CELIX_SUCCESS) {
const char *interface = provided;
- endpoint_description_pt endpoint = NULL;
- export_registration_pt registration = NULL;
+ endpoint_description_t *endpoint = NULL;
+ export_registration_t *registration = NULL;
remoteServiceAdmin_createEndpointDescription(admin, reference, properties, (char *) interface, &endpoint);
//TODO precheck if descriptor exists
@@ -454,12 +454,12 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, c
return status;
}
-celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration) {
+celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_t *admin, export_registration_t *registration) {
celix_status_t status;
logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA_DFI: Removing exported service");
- export_reference_pt ref = NULL;
+ export_reference_t * ref = NULL;
status = exportRegistration_getExportReference(registration, &ref);
if (status == CELIX_SUCCESS && ref != NULL) {
@@ -486,7 +486,7 @@ celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt
return status;
}
-static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_pt admin, service_reference_pt reference, celix_properties_t *props, char *interface, endpoint_description_pt *endpoint) {
+static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_t *admin, service_reference_pt reference, celix_properties_t *props, char *interface, endpoint_description_t **endpoint) {
celix_status_t status = CELIX_SUCCESS;
celix_properties_t *endpointProperties = celix_properties_create();
@@ -594,7 +594,7 @@ static celix_status_t remoteServiceAdmin_getIpAddress(char* interface, char** ip
}
-celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description)
+celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_t **description)
{
celix_status_t status = CELIX_SUCCESS;
@@ -606,17 +606,17 @@ celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_descriptio
}
-celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services) {
+celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_t *admin, array_list_pt *services) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services) {
+celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_t *admin, array_list_pt *services) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpointDescription, import_registration_pt *out) {
+celix_status_t remoteServiceAdmin_importService(remote_service_admin_t *admin, endpoint_description_t *endpointDescription, import_registration_t **out) {
celix_status_t status = CELIX_SUCCESS;
bool importService = false;
@@ -644,7 +644,7 @@ celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, e
}
if (importService) {
- import_registration_pt import = NULL;
+ import_registration_t *import = NULL;
const char *objectClass = celix_properties_get(endpointDescription->properties, "objectClass", NULL);
const char *serviceVersion = celix_properties_get(endpointDescription->properties, CELIX_FRAMEWORK_SERVICE_VERSION, NULL);
@@ -678,14 +678,14 @@ celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, e
}
-celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration) {
+celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_t *admin, import_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA_DFI: Removing imported service");
celixThreadMutex_lock(&admin->importedServicesLock);
int i;
int size = arrayList_size(admin->importedServices);
- import_registration_pt current = NULL;
+ import_registration_t * current = NULL;
for (i = 0; i < size; i += 1) {
current = arrayList_get(admin->importedServices, i);
if (current == registration) {
@@ -701,8 +701,8 @@ celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt
}
-static celix_status_t remoteServiceAdmin_send(void *handle, endpoint_description_pt endpointDescription, char *request, char **reply, int* replyStatus) {
- remote_service_admin_pt rsa = handle;
+static celix_status_t remoteServiceAdmin_send(void *handle, endpoint_description_t *endpointDescription, char *request, char **reply, int* replyStatus) {
+ remote_service_admin_t * rsa = handle;
struct post post;
post.readptr = request;
post.size = strlen(request);
@@ -792,7 +792,7 @@ static size_t remoteServiceAdmin_write(void *contents, size_t size, size_t nmemb
}
-static void remoteServiceAdmin_log(remote_service_admin_pt admin, int level, const char *file, int line, const char *msg, ...) {
+static void remoteServiceAdmin_log(remote_service_admin_t *admin, int level, const char *file, int line, const char *msg, ...) {
va_list ap;
va_start(ap, msg);
int levels[5] = {0, OSGI_LOGSERVICE_ERROR, OSGI_LOGSERVICE_WARNING, OSGI_LOGSERVICE_INFO, OSGI_LOGSERVICE_DEBUG};
diff --git a/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.h b/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.h
index c6ae173..74bb7dd 100644
--- a/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.h
+++ b/bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.h
@@ -26,29 +26,29 @@
#include "endpoint_description.h"
#include "export_registration_dfi.h"
-#include "remote_service_admin.h" //service typedef and remote_service_admin_pt typedef
+#include "remote_service_admin.h" //service typedef and remote_service_admin_t *typedef
//typedef struct remote_service_admin *remote_service_admin_pt;
-celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin);
-celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin);
+celix_status_t remoteServiceAdmin_create(celix_bundle_context_t *context, remote_service_admin_t **admin);
+celix_status_t remoteServiceAdmin_destroy(remote_service_admin_t **admin);
-celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin);
+celix_status_t remoteServiceAdmin_stop(remote_service_admin_t *admin);
-celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations);
-celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration);
-celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpoint, import_registration_pt *registration);
-celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration);
+celix_status_t remoteServiceAdmin_exportService(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations);
+celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_t *admin, export_registration_t *registration);
+celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_t *admin, array_list_pt *services);
+celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_t *admin, array_list_pt *services);
+celix_status_t remoteServiceAdmin_importService(remote_service_admin_t *admin, endpoint_description_t *endpoint, import_registration_t **registration);
+celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_t *admin, import_registration_t *registration);
-celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference, endpoint_description_pt *endpoint);
-celix_status_t exportReference_getExportedService(export_reference_pt reference, service_reference_pt *service);
+celix_status_t exportReference_getExportedEndpoint(export_reference_t *reference, endpoint_description_t **endpoint);
+celix_status_t exportReference_getExportedService(export_reference_t *reference, service_reference_pt *service);
-celix_status_t importReference_getImportedEndpoint(import_reference_pt reference);
-celix_status_t importReference_getImportedService(import_reference_pt reference);
+celix_status_t importReference_getImportedEndpoint(import_reference_t *reference);
+celix_status_t importReference_getImportedService(import_reference_t *reference);
-celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description);
+celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_t **description);
#endif /* REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_ */
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp
index 528e6b7..cbad298 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp
@@ -38,15 +38,15 @@ extern "C" {
#include "remote_service_admin.h"
#include "calculator_service.h"
- static framework_pt serverFramework = NULL;
- static bundle_context_pt serverContext = NULL;
+ static celix_framework_t *serverFramework = NULL;
+ static celix_bundle_context_t *serverContext = NULL;
- static framework_pt clientFramework = NULL;
- static bundle_context_pt clientContext = NULL;
+ static celix_framework_t *clientFramework = NULL;
+ static celix_bundle_context_t *clientContext = NULL;
static void setupFm(void) {
int rc = 0;
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
//server
rc = celixLauncher_launch("server.properties", &serverFramework);
@@ -90,7 +90,7 @@ extern "C" {
static void test1(void) {
celix_status_t rc;
service_reference_pt ref = NULL;
- tst_service_pt tst = NULL;
+ tst_service_t *tst = NULL;
int retries = 4;
while (ref == NULL && retries > 0) {
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp
index 8c4afa2..62b9f31 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp
@@ -39,13 +39,13 @@ extern "C" {
#define TST_CONFIGURATION_TYPE "org.amdatu.remote.admin.http"
static framework_pt framework = NULL;
- static bundle_context_pt context = NULL;
+ static celix_bundle_context_t *context = NULL;
static service_reference_pt rsaRef = NULL;
- static remote_service_admin_service_pt rsa = NULL;
+ static remote_service_admin_service_t *rsa = NULL;
static service_reference_pt calcRef = NULL;
- static calculator_service_pt calc = NULL;
+ static calculator_service_t *calc = NULL;
static void setupFm(void) {
int rc = 0;
@@ -53,7 +53,7 @@ extern "C" {
rc = celixLauncher_launch("config.properties", &framework);
CHECK_EQUAL(CELIX_SUCCESS, rc);
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
rc = framework_getFrameworkBundle(framework, &bundle);
CHECK_EQUAL(CELIX_SUCCESS, rc);
@@ -138,15 +138,15 @@ extern "C" {
CHECK_EQUAL(1, arrayList_size(regs));
- rc = rsa->exportRegistration_close(rsa->admin,(export_registration_pt)(arrayList_get(regs,0)));
+ rc = rsa->exportRegistration_close(rsa->admin,(export_registration_t *)(arrayList_get(regs,0)));
CHECK_EQUAL(CELIX_SUCCESS, rc);
}
static void testImportService(void) {
int rc = 0;
- import_registration_pt reg = NULL;
- endpoint_description_pt endpoint = NULL;
+ import_registration_t *reg = NULL;
+ endpoint_description_t *endpoint = NULL;
celix_properties_t *props = celix_properties_create();
celix_properties_set(props, OSGI_RSA_ENDPOINT_SERVICE_ID, "42");
@@ -192,11 +192,11 @@ extern "C" {
int size = arrayList_size(bundles);
int i;
for (i = 0; i < size; i += 1) {
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
module_pt module = NULL;
char *name = NULL;
- bundle = (bundle_pt) arrayList_get(bundles, i);
+ bundle = (celix_bundle_t *) arrayList_get(bundles, i);
bundle_getCurrentModule(bundle, &module);
module_getSymbolicName(module, &name);
printf("got bundle with symbolic name '%s'", name);
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c
index 75e75e0..9aae63a 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c
@@ -35,20 +35,20 @@
struct activator {
- bundle_context_pt context;
+ celix_bundle_context_t *context;
struct tst_service serv;
- service_registration_pt reg;
+ service_registration_t * reg;
- service_tracker_customizer_pt cust;
- service_tracker_pt tracker;
- calculator_service_pt calc;
+ service_tracker_customizer_t *cust;
+ service_tracker_t *tracker;
+ calculator_service_t *calc;
};
static celix_status_t addCalc(void * handle, service_reference_pt reference, void * service);
static celix_status_t removeCalc(void * handle, service_reference_pt reference, void * service);
static int test(void *handle);
-celix_status_t bundleActivator_create(bundle_context_pt context, void **out) {
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **out) {
celix_status_t status = CELIX_SUCCESS;
struct activator *act = calloc(1, sizeof(*act));
if (act != NULL) {
@@ -97,7 +97,7 @@ static celix_status_t removeCalc(void * handle, service_reference_pt reference,
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator * act = userData;
@@ -111,7 +111,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator * act = userData;
@@ -121,7 +121,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
struct activator *act = userData;
if (act != NULL) {
if (act->tracker != NULL) {
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h
index c8ca2e7..12cec6d 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h
@@ -27,6 +27,6 @@ struct tst_service {
int (*test)(void *handle);
};
-typedef struct tst_service *tst_service_pt;
+typedef struct tst_service tst_service_t;
#endif //CELIX_TST_SERVICE_H
diff --git a/bundles/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h b/bundles/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
index 3e9772d..d2c3096 100644
--- a/bundles/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
+++ b/bundles/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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_service_admin_shm_impl.h
*
* \date Sep 30, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef REMOTE_SERVICE_ADMIN_SHM_IMPL_H_
@@ -55,8 +55,8 @@ union semun {
};
struct recv_shm_thread {
- remote_service_admin_pt admin;
- endpoint_description_pt endpointDescription;
+ remote_service_admin_t *admin;
+ endpoint_description_t *endpointDescription;
};
struct ipc_segment {
@@ -66,8 +66,8 @@ struct ipc_segment {
};
struct remote_service_admin {
- bundle_context_pt context;
- log_helper_pt loghelper;
+ celix_bundle_context_t *context;
+ log_helper_t *loghelper;
celix_thread_mutex_t exportedServicesLock;
hash_map_pt exportedServices;
@@ -87,6 +87,6 @@ struct remote_service_admin {
typedef struct recv_shm_thread *recv_shm_thread_pt;
typedef struct ipc_segment *ipc_segment_pt;
-celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin);
+celix_status_t remoteServiceAdmin_stop(remote_service_admin_t *admin);
#endif /* REMOTE_SERVICE_ADMIN_SHM_IMPL_H_ */
diff --git a/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c b/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
index a2b72d0..b744c6b 100644
--- a/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
+++ b/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
@@ -33,12 +33,12 @@
#include "import_registration_impl.h"
struct activator {
- remote_service_admin_pt admin;
- remote_service_admin_service_pt adminService;
- service_registration_pt registration;
+ remote_service_admin_t *admin;
+ remote_service_admin_service_t *adminService;
+ service_registration_t *registration;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator;
@@ -55,10 +55,10 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
celix_status_t status;
struct activator *activator = userData;
- remote_service_admin_service_pt remoteServiceAdmin = NULL;
+ remote_service_admin_service_t *remoteServiceAdmin = NULL;
status = remoteServiceAdmin_create(context, &activator->admin);
if (status == CELIX_SUCCESS) {
@@ -95,7 +95,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
@@ -111,7 +111,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
diff --git a/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c b/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
index 8b60955..a20b1e7 100644
--- a/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
+++ b/bundles/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
@@ -52,19 +52,19 @@ static celix_status_t remoteServiceAdmin_lock(int semId, int semNr);
static celix_status_t remoteServiceAdmin_unlock(int semId, int semNr);
static int remoteServiceAdmin_getCount(int semId, int semNr);
-celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_pt admin, export_registration_pt registration, service_reference_pt reference, char *interface);
-celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_pt admin, service_reference_pt reference, celix_properties_t *endpointProperties, char *interface, endpoint_description_pt *description);
+celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_t *admin, export_registration_t *registration, service_reference_pt reference, char *interface);
+celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_t *admin, service_reference_pt reference, celix_properties_t *endpointProperties, char *interface, endpoint_description_t **description);
-celix_status_t remoteServiceAdmin_createOrAttachShm(hash_map_pt ipcSegment, remote_service_admin_pt admin, endpoint_description_pt endpointDescription, bool createIfNotFound);
-celix_status_t remoteServiceAdmin_getIpcSegment(remote_service_admin_pt admin, endpoint_description_pt endpointDescription, ipc_segment_pt* ipc);
+celix_status_t remoteServiceAdmin_createOrAttachShm(hash_map_pt ipcSegment, remote_service_admin_t *admin, endpoint_description_t *endpointDescription, bool createIfNotFound);
+celix_status_t remoteServiceAdmin_getIpcSegment(remote_service_admin_t *admin, endpoint_description_t *endpointDescription, ipc_segment_pt* ipc);
celix_status_t remoteServiceAdmin_detachIpcSegment(ipc_segment_pt ipc);
celix_status_t remoteServiceAdmin_deleteIpcSegment(ipc_segment_pt ipc);
-celix_status_t remoteServiceAdmin_getSharedIdentifierFile(remote_service_admin_pt admin, char *fwUuid, char* servicename, char* outFile);
-celix_status_t remoteServiceAdmin_removeSharedIdentityFile(remote_service_admin_pt admin, char *fwUuid, char* servicename);
-celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin_pt admin);
+celix_status_t remoteServiceAdmin_getSharedIdentifierFile(remote_service_admin_t *admin, char *fwUuid, char* servicename, char* outFile);
+celix_status_t remoteServiceAdmin_removeSharedIdentityFile(remote_service_admin_t *admin, char *fwUuid, char* servicename);
+celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin_t *admin);
-celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin) {
+celix_status_t remoteServiceAdmin_create(celix_bundle_context_t *context, remote_service_admin_t **admin) {
celix_status_t status = CELIX_SUCCESS;
*admin = calloc(1, sizeof(**admin));
@@ -88,7 +88,7 @@ celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_servi
return status;
}
-celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt* admin) {
+celix_status_t remoteServiceAdmin_destroy(remote_service_admin_t **admin) {
celix_status_t status = CELIX_SUCCESS;
hashMap_destroy((*admin)->exportedServices, false, false);
@@ -105,7 +105,7 @@ celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt* admin) {
return status;
}
-celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
+celix_status_t remoteServiceAdmin_stop(remote_service_admin_t *admin) {
celix_status_t status = CELIX_SUCCESS;
celixThreadMutex_lock(&admin->exportedServicesLock);
@@ -115,7 +115,7 @@ celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
array_list_pt exports = hashMapIterator_nextValue(iter);
int i;
for (i = 0; i < arrayList_size(exports); i++) {
- export_registration_pt export = arrayList_get(exports, i);
+ export_registration_t *export = arrayList_get(exports, i);
exportRegistration_stopTracking(export);
}
}
@@ -129,13 +129,13 @@ celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
char* service = hashMapEntry_getKey(entry);
- import_registration_factory_pt importFactory = hashMapEntry_getValue(entry);
+ import_registration_factory_t *importFactory = hashMapEntry_getValue(entry);
if (importFactory != NULL) {
int i;
for (i = 0; i < arrayList_size(importFactory->registrations); i++) {
- import_registration_pt importRegistration = arrayList_get(importFactory->registrations, i);
+ import_registration_t *importRegistration = arrayList_get(importFactory->registrations, i);
if (importFactory->trackedFactory != NULL) {
importFactory->trackedFactory->unregisterProxyService(importFactory->trackedFactory->factory, importRegistration->endpointDescription);
@@ -255,7 +255,7 @@ static celix_status_t remoteServiceAdmin_unlock(int semId, int semNr) {
return status;
}
-celix_status_t remoteServiceAdmin_send(remote_service_admin_pt admin, endpoint_description_pt recpEndpoint, char *request, char **reply, int *replyStatus) {
+celix_status_t remoteServiceAdmin_send(remote_service_admin_t *admin, endpoint_description_t *recpEndpoint, char *request, char **reply, int *replyStatus) {
celix_status_t status = CELIX_SUCCESS;
ipc_segment_pt ipc = NULL;
@@ -301,8 +301,8 @@ celix_status_t remoteServiceAdmin_send(remote_service_admin_pt admin, endpoint_d
static void * remoteServiceAdmin_receiveFromSharedMemory(void *data) {
recv_shm_thread_pt thread_data = data;
- remote_service_admin_pt admin = thread_data->admin;
- endpoint_description_pt exportedEndpointDesc = thread_data->endpointDescription;
+ remote_service_admin_t *admin = thread_data->admin;
+ endpoint_description_t *exportedEndpointDesc = thread_data->endpointDescription;
ipc_segment_pt ipc;
@@ -324,7 +324,7 @@ static void * remoteServiceAdmin_receiveFromSharedMemory(void *data) {
int expIt = 0;
for (expIt = 0; expIt < arrayList_size(exports); expIt++) {
- export_registration_pt export = arrayList_get(exports, expIt);
+ export_registration_t *export = arrayList_get(exports, expIt);
if ((strcmp(exportedEndpointDesc->service, export->endpointDescription->service) == 0) && (export->endpoint != NULL)) {
char *reply = NULL;
@@ -359,7 +359,7 @@ static void * remoteServiceAdmin_receiveFromSharedMemory(void *data) {
return NULL;
}
-celix_status_t remoteServiceAdmin_getSharedIdentifierFile(remote_service_admin_pt admin, char *fwUuid, char* servicename, char* outFile) {
+celix_status_t remoteServiceAdmin_getSharedIdentifierFile(remote_service_admin_t *admin, char *fwUuid, char* servicename, char* outFile) {
celix_status_t status = CELIX_SUCCESS;
snprintf(outFile, RSA_FILEPATH_LENGTH, "%s/%s/%s", P_tmpdir, fwUuid, servicename);
@@ -386,7 +386,7 @@ celix_status_t remoteServiceAdmin_getSharedIdentifierFile(remote_service_admin_p
return status;
}
-celix_status_t remoteServiceAdmin_removeSharedIdentityFile(remote_service_admin_pt admin, char *fwUuid, char* servicename) {
+celix_status_t remoteServiceAdmin_removeSharedIdentityFile(remote_service_admin_t *admin, char *fwUuid, char* servicename) {
celix_status_t status = CELIX_SUCCESS;
char tmpPath[RSA_FILEPATH_LENGTH];
int retVal = 0;
@@ -405,7 +405,7 @@ celix_status_t remoteServiceAdmin_removeSharedIdentityFile(remote_service_admin_
return status;
}
-celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin_pt admin) {
+celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin_t *admin) {
char tmpDir[RSA_FILEPATH_LENGTH];
const char* fwUuid = NULL;
bundleContext_getProperty(admin->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &fwUuid);
@@ -456,7 +456,7 @@ celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin
return retVal;
}
-celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations) {
+celix_status_t remoteServiceAdmin_exportService(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations) {
celix_status_t status = CELIX_SUCCESS;
arrayList_create(registrations);
@@ -519,7 +519,7 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, c
int iter = 0;
for (iter = 0; iter < arrayList_size(interfaces); iter++) {
char *interface = arrayList_get(interfaces, iter);
- export_registration_pt registration = NULL;
+ export_registration_t *registration = NULL;
exportRegistration_create(admin->loghelper, reference, NULL, admin, admin->context, ®istration);
arrayList_add(*registrations, registration);
@@ -565,11 +565,11 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, c
return status;
}
-celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration) {
+celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_t *admin, export_registration_t *registration) {
celix_status_t status;
ipc_segment_pt ipc = NULL;
- export_reference_pt ref = NULL;
+ export_reference_t *ref = NULL;
status = exportRegistration_getExportReference(registration, &ref);
if (status == CELIX_SUCCESS) {
@@ -626,7 +626,7 @@ celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt
return status;
}
-celix_status_t remoteServiceAdmin_getIpcSegment(remote_service_admin_pt admin, endpoint_description_pt endpointDescription, ipc_segment_pt* ipc) {
+celix_status_t remoteServiceAdmin_getIpcSegment(remote_service_admin_t *admin, endpoint_description_t *endpointDescription, ipc_segment_pt* ipc) {
(*ipc) = (hashMap_containsKey(admin->importedIpcSegment, endpointDescription) == true) ? hashMap_get(admin->importedIpcSegment, endpointDescription) : NULL;
return (*ipc != NULL) ? CELIX_SUCCESS : CELIX_ILLEGAL_ARGUMENT;
@@ -640,7 +640,7 @@ celix_status_t remoteServiceAdmin_deleteIpcSegment(ipc_segment_pt ipc) {
return ((semctl(ipc->semId, 1 /*ignored*/, IPC_RMID) != -1) && (shmctl(ipc->shmId, IPC_RMID, 0) != -1)) ? CELIX_SUCCESS : CELIX_BUNDLE_EXCEPTION;
}
-celix_status_t remoteServiceAdmin_createOrAttachShm(hash_map_pt ipcSegment, remote_service_admin_pt admin, endpoint_description_pt endpointDescription, bool createIfNotFound) {
+celix_status_t remoteServiceAdmin_createOrAttachShm(hash_map_pt ipcSegment, remote_service_admin_t *admin, endpoint_description_t *endpointDescription, bool createIfNotFound) {
celix_status_t status = CELIX_SUCCESS;
/* setup ipc sehment */
@@ -724,7 +724,7 @@ celix_status_t remoteServiceAdmin_createOrAttachShm(hash_map_pt ipcSegment, remo
return status;
}
-celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_pt admin, export_registration_pt registration, service_reference_pt reference, char *interface) {
+celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_t *admin, export_registration_t *registration, service_reference_pt reference, char *interface) {
celix_status_t status = CELIX_SUCCESS;
celix_properties_t *endpointProperties = celix_properties_create();
@@ -785,7 +785,7 @@ celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_pt admin,
celix_properties_set(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME, (char *) RSA_SEM_DEFAULT_FTOK_ID);
}
- endpoint_description_pt endpointDescription = NULL;
+ endpoint_description_t *endpointDescription = NULL;
remoteServiceAdmin_createEndpointDescription(admin, reference, endpointProperties, interface, &endpointDescription);
exportRegistration_setEndpointDescription(registration, endpointDescription);
@@ -796,7 +796,7 @@ celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_pt admin,
return status;
}
-celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_pt admin, service_reference_pt reference, celix_properties_t *endpointProperties, char *interface, endpoint_description_pt *description) {
+celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_t *admin, service_reference_pt reference, celix_properties_t *endpointProperties, char *interface, endpoint_description_t **description) {
celix_status_t status = CELIX_SUCCESS;
*description = calloc(1, sizeof(**description));
@@ -817,7 +817,7 @@ celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin
return status;
}
-celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description) {
+celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_t **description) {
celix_status_t status = CELIX_SUCCESS;
celix_properties_destroy((*description)->properties);
@@ -827,24 +827,24 @@ celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_descriptio
return status;
}
-celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services) {
+celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_t *admin, array_list_pt *services) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services) {
+celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_t *admin, array_list_pt *services) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpointDescription, import_registration_pt *registration) {
+celix_status_t remoteServiceAdmin_importService(remote_service_admin_t *admin, endpoint_description_t *endpointDescription, import_registration_t **registration) {
celix_status_t status = CELIX_SUCCESS;
logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA: Import service %s", endpointDescription->service);
celixThreadMutex_lock(&admin->importedServicesLock);
- import_registration_factory_pt registration_factory = (import_registration_factory_pt) hashMap_get(admin->importedServices, endpointDescription->service);
+ import_registration_factory_t *registration_factory = (import_registration_factory_t *) hashMap_get(admin->importedServices, endpointDescription->service);
// check whether we already have a registration_factory registered in the hashmap
if (registration_factory == NULL) {
@@ -874,7 +874,7 @@ celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, e
return status;
}
-celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration) {
+celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_t *admin, import_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
if (registration != NULL) {
@@ -882,8 +882,8 @@ celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt
celixThreadMutex_lock(&admin->importedServicesLock);
ipc_segment_pt ipc = NULL;
- endpoint_description_pt endpointDescription = (endpoint_description_pt) registration->endpointDescription;
- import_registration_factory_pt registration_factory = (import_registration_factory_pt) hashMap_get(admin->importedServices, endpointDescription->service);
+ endpoint_description_t *endpointDescription = (endpoint_description_t *) registration->endpointDescription;
+ import_registration_factory_t *registration_factory = (import_registration_factory_t *) hashMap_get(admin->importedServices, endpointDescription->service);
// detach from IPC
if (remoteServiceAdmin_getIpcSegment(admin, endpointDescription, &ipc) != CELIX_SUCCESS) {
diff --git a/bundles/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp b/bundles/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp
index 4902574..987a415 100644
--- a/bundles/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp
+++ b/bundles/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp
@@ -44,14 +44,14 @@ extern "C" {
#define CALCULATOR_ENDPOINT "apache_celix_remoting_calculator_endpoint"
static framework_pt serverFramework = NULL;
- static bundle_context_pt serverContext = NULL;
+ static celix_bundle_context_t *serverContext = NULL;
static framework_pt clientFramework = NULL;
- static bundle_context_pt clientContext = NULL;
+ static celix_bundle_context_t *clientContext = NULL;
static void setupFm(void) {
int rc = 0;
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
//server
rc = celixLauncher_launch("server.properties", &serverFramework);
@@ -94,7 +94,7 @@ extern "C" {
static void test1(void) {
celix_status_t status;
service_reference_pt ref = NULL;
- calculator_service_pt calcService = NULL;
+ calculator_service_t *calcService = NULL;
int retries = 6;
while (ref == NULL && retries > 0) {
@@ -156,7 +156,7 @@ extern "C" {
return status;
}
- static celix_status_t getSpecifiedBundles(bundle_context_pt context, array_list_pt bundleNames, array_list_pt retrievedBundles) {
+ static celix_status_t getSpecifiedBundles(celix_bundle_context_t *context, array_list_pt bundleNames, array_list_pt retrievedBundles) {
celix_status_t status;
array_list_pt bundles = NULL;
@@ -170,7 +170,7 @@ extern "C" {
module_pt module = NULL;
const char *name = NULL;
- bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
+ celix_bundle_t *bundle = (celix_bundle_t *) arrayList_get(bundles, i);
status = bundle_getCurrentModule(bundle, &module);
@@ -213,14 +213,14 @@ extern "C" {
return status;
}
- static celix_status_t stopStartPermutation(bundle_context_pt context, long* permutation, int size) {
+ static celix_status_t stopStartPermutation(celix_bundle_context_t *context, long* permutation, int size) {
celix_status_t status = CELIX_SUCCESS;
int y = 0;
printf("Test stop/start permutation: ");
for (y = 0; (y < size) && (status == CELIX_SUCCESS); y++) {
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
status = bundleContext_getBundleById(context, permutation[y], &bundle);
@@ -241,7 +241,7 @@ extern "C" {
// stop all bundles
if (status == CELIX_SUCCESS) {
for (y = 0; (y < size) && (status == CELIX_SUCCESS); y++) {
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
status = bundleContext_getBundleById(context, permutation[y], &bundle);
@@ -255,7 +255,7 @@ extern "C" {
// verify stop state
if (status == CELIX_SUCCESS) {
for (y = 0; (y < size) && (status == CELIX_SUCCESS); y++) {
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
status = bundleContext_getBundleById(context, permutation[y], &bundle);
@@ -275,7 +275,7 @@ extern "C" {
if (status == CELIX_SUCCESS) {
for (y = 0; (y < size) && (status == CELIX_SUCCESS); y++) {
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
status = bundleContext_getBundleById(context, permutation[y], &bundle);
@@ -289,7 +289,7 @@ extern "C" {
// verify started state
if (status == CELIX_SUCCESS) {
for (y = 0; (y < size) && (status == CELIX_SUCCESS); y++) {
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
status = bundleContext_getBundleById(context, permutation[y], &bundle);
@@ -400,7 +400,7 @@ extern "C" {
/*
static void testProxyRemoval(void) {
celix_status_t status;
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
array_list_pt bundleNames = NULL;
array_list_pt proxyBundle = NULL;
service_reference_pt ref = NULL;
@@ -431,7 +431,7 @@ extern "C" {
/*
static void testEndpointRemoval(void) {
celix_status_t status;
- bundle_pt bundle = NULL;
+ celix_bundle_t *bundle = NULL;
array_list_pt bundleNames = NULL;
array_list_pt endpointBundle = NULL;
service_reference_pt ref = NULL;
diff --git a/bundles/remote_services/rsa_common/src/endpoint_description.c b/bundles/remote_services/rsa_common/src/endpoint_description.c
index 616e5f9..174accc 100644
--- a/bundles/remote_services/rsa_common/src/endpoint_description.c
+++ b/bundles/remote_services/rsa_common/src/endpoint_description.c
@@ -35,7 +35,7 @@
static celix_status_t endpointDescription_verifyLongProperty(celix_properties_t *properties, char *propertyName, unsigned long *longProperty);
-celix_status_t endpointDescription_create(celix_properties_t *properties, endpoint_description_pt *endpointDescription) {
+celix_status_t endpointDescription_create(celix_properties_t *properties, endpoint_description_t **endpointDescription) {
celix_status_t status = CELIX_SUCCESS;
unsigned long serviceId = 0UL;
@@ -44,7 +44,7 @@ celix_status_t endpointDescription_create(celix_properties_t *properties, endpoi
return status;
}
- endpoint_description_pt ep = calloc(1,sizeof(*ep));
+ endpoint_description_t *ep = calloc(1,sizeof(*ep));
ep->properties = properties;
ep->frameworkUUID = (char*)celix_properties_get(properties, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, NULL);
@@ -68,7 +68,7 @@ celix_status_t endpointDescription_create(celix_properties_t *properties, endpoi
return status;
}
-celix_status_t endpointDescription_destroy(endpoint_description_pt description) {
+celix_status_t endpointDescription_destroy(endpoint_description_t *description) {
celix_properties_destroy(description->properties);
free(description->service);
free(description);
diff --git a/bundles/remote_services/rsa_common/src/export_registration_impl.c b/bundles/remote_services/rsa_common/src/export_registration_impl.c
index 1c684e7..e378a9c 100644
--- a/bundles/remote_services/rsa_common/src/export_registration_impl.c
+++ b/bundles/remote_services/rsa_common/src/export_registration_impl.c
@@ -34,7 +34,7 @@
struct export_reference {
- endpoint_description_pt endpoint;
+ endpoint_description_t *endpoint;
service_reference_pt reference;
};
@@ -43,9 +43,9 @@ celix_status_t exportRegistration_endpointAdded(void * handle, service_reference
celix_status_t exportRegistration_endpointModified(void * handle, service_reference_pt reference, void *service);
celix_status_t exportRegistration_endpointRemoved(void * handle, service_reference_pt reference, void *service);
-celix_status_t exportRegistration_createEndpointTracker(export_registration_pt registration, service_tracker_pt *tracker);
+celix_status_t exportRegistration_createEndpointTracker(export_registration_t *registration, service_tracker_t **tracker);
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, remote_service_admin_pt rsa, bundle_context_pt context, export_registration_pt *registration) {
+celix_status_t exportRegistration_create(log_helper_t *helper, service_reference_pt reference, endpoint_description_t *endpoint, remote_service_admin_t *rsa, celix_bundle_context_t *context, export_registration_t **registration) {
celix_status_t status = CELIX_SUCCESS;
*registration = calloc(1, sizeof(**registration));
@@ -68,7 +68,7 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
return status;
}
-celix_status_t exportRegistration_destroy(export_registration_pt *registration) {
+celix_status_t exportRegistration_destroy(export_registration_t **registration) {
celix_status_t status = CELIX_SUCCESS;
remoteServiceAdmin_destroyEndpointDescription(&(*registration)->endpointDescription);
@@ -77,7 +77,7 @@ celix_status_t exportRegistration_destroy(export_registration_pt *registration)
return status;
}
-celix_status_t exportRegistration_startTracking(export_registration_pt registration) {
+celix_status_t exportRegistration_startTracking(export_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
if (registration->endpointTracker == NULL) {
@@ -90,7 +90,7 @@ celix_status_t exportRegistration_startTracking(export_registration_pt registrat
return status;
}
-celix_status_t exportRegistration_stopTracking(export_registration_pt registration) {
+celix_status_t exportRegistration_stopTracking(export_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
if (registration->endpointTracker != NULL) {
@@ -115,10 +115,10 @@ celix_status_t exportRegistration_stopTracking(export_registration_pt registrati
return status;
}
-celix_status_t exportRegistration_createEndpointTracker(export_registration_pt registration, service_tracker_pt *tracker) {
+celix_status_t exportRegistration_createEndpointTracker(export_registration_t *registration, service_tracker_t **tracker) {
celix_status_t status;
- service_tracker_customizer_pt customizer = NULL;
+ service_tracker_customizer_t *customizer = NULL;
status = serviceTrackerCustomizer_create(registration, exportRegistration_endpointAdding,
exportRegistration_endpointAdded, exportRegistration_endpointModified, exportRegistration_endpointRemoved, &customizer);
@@ -135,7 +135,7 @@ celix_status_t exportRegistration_createEndpointTracker(export_registration_pt r
celix_status_t exportRegistration_endpointAdding(void * handle, service_reference_pt reference, void **service) {
celix_status_t status;
- export_registration_pt registration = handle;
+ export_registration_t *registration = handle;
status = bundleContext_getService(registration->context, reference, service);
@@ -144,9 +144,9 @@ celix_status_t exportRegistration_endpointAdding(void * handle, service_referenc
celix_status_t exportRegistration_endpointAdded(void * handle, service_reference_pt reference, void *endpoint_service) {
celix_status_t status = CELIX_SUCCESS;
- export_registration_pt registration = handle;
+ export_registration_t *registration = handle;
- remote_endpoint_service_pt endpoint = endpoint_service;
+ remote_endpoint_service_t *endpoint = endpoint_service;
if (registration->endpoint == NULL) {
registration->endpoint = endpoint;
void *service = NULL;
@@ -167,9 +167,9 @@ celix_status_t exportRegistration_endpointModified(void * handle, service_refere
celix_status_t exportRegistration_endpointRemoved(void * handle, service_reference_pt reference, void *service) {
celix_status_t status = CELIX_SUCCESS;
- export_registration_pt registration = handle;
+ export_registration_t *registration = handle;
- remote_endpoint_service_pt endpoint = service;
+ remote_endpoint_service_t *endpoint = service;
if (registration->endpoint != NULL) {
endpoint->setService(endpoint->endpoint, NULL);
}
@@ -177,7 +177,7 @@ celix_status_t exportRegistration_endpointRemoved(void * handle, service_referen
return status;
}
-celix_status_t exportRegistration_open(export_registration_pt registration) {
+celix_status_t exportRegistration_open(export_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
const char *bundleStore = NULL;
@@ -200,7 +200,7 @@ celix_status_t exportRegistration_open(export_registration_pt registration) {
return status;
}
-celix_status_t exportRegistration_close(export_registration_pt registration) {
+celix_status_t exportRegistration_close(export_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
exportRegistration_stopTracking(registration);
@@ -211,12 +211,12 @@ celix_status_t exportRegistration_close(export_registration_pt registration) {
return status;
}
-celix_status_t exportRegistration_getException(export_registration_pt registration) {
+celix_status_t exportRegistration_getException(export_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t exportRegistration_getExportReference(export_registration_pt registration, export_reference_pt *reference) {
+celix_status_t exportRegistration_getExportReference(export_registration_t *registration, export_reference_t **reference) {
celix_status_t status = CELIX_SUCCESS;
registration->exportReference = calloc(1, sizeof(*registration->exportReference));
@@ -233,7 +233,7 @@ celix_status_t exportRegistration_getExportReference(export_registration_pt regi
return status;
}
-celix_status_t exportRegistration_setEndpointDescription(export_registration_pt registration, endpoint_description_pt endpointDescription) {
+celix_status_t exportRegistration_setEndpointDescription(export_registration_t *registration, endpoint_description_t *endpointDescription) {
celix_status_t status = CELIX_SUCCESS;
registration->endpointDescription = endpointDescription;
@@ -241,7 +241,7 @@ celix_status_t exportRegistration_setEndpointDescription(export_registration_pt
return status;
}
-celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference, endpoint_description_pt *endpoint) {
+celix_status_t exportReference_getExportedEndpoint(export_reference_t *reference, endpoint_description_t **endpoint) {
celix_status_t status = CELIX_SUCCESS;
*endpoint = reference->endpoint;
@@ -249,7 +249,7 @@ celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference
return status;
}
-celix_status_t exportReference_getExportedService(export_reference_pt reference, service_reference_pt *service) {
+celix_status_t exportReference_getExportedService(export_reference_t *reference, service_reference_pt *service) {
celix_status_t status = CELIX_SUCCESS;
*service = reference->reference;
return status;
diff --git a/bundles/remote_services/rsa_common/src/export_registration_impl.h b/bundles/remote_services/rsa_common/src/export_registration_impl.h
index bb276f9..c32a3b6 100644
--- a/bundles/remote_services/rsa_common/src/export_registration_impl.h
+++ b/bundles/remote_services/rsa_common/src/export_registration_impl.h
@@ -33,29 +33,29 @@
#include "log_helper.h"
struct export_registration {
- bundle_context_pt context;
- remote_service_admin_pt rsa;
- endpoint_description_pt endpointDescription;
+ celix_bundle_context_t *context;
+ remote_service_admin_t *rsa;
+ endpoint_description_t *endpointDescription;
service_reference_pt reference;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
- service_tracker_pt tracker;
- service_tracker_pt endpointTracker;
+ service_tracker_t *tracker;
+ service_tracker_t *endpointTracker;
- remote_endpoint_service_pt endpoint;
+ remote_endpoint_service_t *endpoint;
- export_reference_pt exportReference;
- bundle_pt bundle;
+ export_reference_t *exportReference;
+ celix_bundle_t *bundle;
bool closed;
};
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, remote_service_admin_pt rsa, bundle_context_pt context, export_registration_pt *registration);
-celix_status_t exportRegistration_destroy(export_registration_pt *registration);
-celix_status_t exportRegistration_open(export_registration_pt registration);
+celix_status_t exportRegistration_create(log_helper_t *helper, service_reference_pt reference, endpoint_description_t *endpoint, remote_service_admin_t *rsa, celix_bundle_context_t *context, export_registration_t **registration);
+celix_status_t exportRegistration_destroy(export_registration_t **registration);
+celix_status_t exportRegistration_open(export_registration_t *registration);
-celix_status_t exportRegistration_setEndpointDescription(export_registration_pt registration, endpoint_description_pt endpointDescription);
-celix_status_t exportRegistration_startTracking(export_registration_pt registration);
-celix_status_t exportRegistration_stopTracking(export_registration_pt registration);
+celix_status_t exportRegistration_setEndpointDescription(export_registration_t *registration, endpoint_description_t *endpointDescription);
+celix_status_t exportRegistration_startTracking(export_registration_t *registration);
+celix_status_t exportRegistration_stopTracking(export_registration_t *registration);
#endif /* EXPORT_REGISTRATION_IMPL_H_ */
diff --git a/bundles/remote_services/rsa_common/src/import_registration_impl.c b/bundles/remote_services/rsa_common/src/import_registration_impl.c
index eccd288..82701a0 100644
--- a/bundles/remote_services/rsa_common/src/import_registration_impl.c
+++ b/bundles/remote_services/rsa_common/src/import_registration_impl.c
@@ -35,7 +35,7 @@
#include "remote_service_admin_impl.h"
struct import_reference {
- endpoint_description_pt endpoint;
+ endpoint_description_t *endpoint;
service_reference_pt reference;
};
@@ -46,7 +46,7 @@ celix_status_t importRegistration_proxyFactoryAdded(void * handle, service_refer
celix_status_t importRegistration_proxyFactoryModified(void * handle, service_reference_pt reference, void *service);
celix_status_t importRegistration_proxyFactoryRemoved(void * handle, service_reference_pt reference, void *service);
-celix_status_t importRegistration_create(endpoint_description_pt endpoint, remote_service_admin_pt rsa, sendToHandle sendToCallback, bundle_context_pt context, import_registration_pt *registration) {
+celix_status_t importRegistration_create(endpoint_description_t *endpoint, remote_service_admin_t *rsa, sendToHandle sendToCallback, celix_bundle_context_t *context, import_registration_t **registration) {
celix_status_t status = CELIX_SUCCESS;
*registration = calloc(1, sizeof(**registration));
@@ -65,7 +65,7 @@ celix_status_t importRegistration_create(endpoint_description_pt endpoint, remot
return status;
}
-celix_status_t importRegistration_destroy(import_registration_pt registration)
+celix_status_t importRegistration_destroy(import_registration_t *registration)
{
free(registration);
@@ -73,7 +73,7 @@ celix_status_t importRegistration_destroy(import_registration_pt registration)
}
-celix_status_t importRegistrationFactory_create(log_helper_pt helper, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory) {
+celix_status_t importRegistrationFactory_create(log_helper_t *helper, char* serviceName, celix_bundle_context_t *context, import_registration_factory_t **registration_factory) {
celix_status_t status = CELIX_SUCCESS;
*registration_factory = calloc(1, sizeof(**registration_factory));
@@ -93,7 +93,7 @@ celix_status_t importRegistrationFactory_create(log_helper_pt helper, char* serv
-celix_status_t importRegistrationFactory_destroy(import_registration_factory_pt* registration_factory) {
+celix_status_t importRegistrationFactory_destroy(import_registration_factory_t **registration_factory) {
celix_status_t status = CELIX_SUCCESS;
if (*registration_factory != NULL)
@@ -112,7 +112,7 @@ celix_status_t importRegistrationFactory_destroy(import_registration_factory_pt*
}
-celix_status_t importRegistrationFactory_open(import_registration_factory_pt registration_factory)
+celix_status_t importRegistrationFactory_open(import_registration_factory_t *registration_factory)
{
celix_status_t status;
@@ -141,7 +141,7 @@ celix_status_t importRegistrationFactory_open(import_registration_factory_pt reg
return status;
}
-celix_status_t importRegistrationFactory_close(import_registration_factory_pt registration_factory)
+celix_status_t importRegistrationFactory_close(import_registration_factory_t *registration_factory)
{
celix_status_t status = CELIX_SUCCESS;
@@ -158,9 +158,9 @@ celix_status_t importRegistrationFactory_close(import_registration_factory_pt re
}
-celix_status_t importRegistration_createProxyFactoryTracker(import_registration_factory_pt registration_factory, service_tracker_pt *tracker) {
+celix_status_t importRegistration_createProxyFactoryTracker(import_registration_factory_t *registration_factory, service_tracker_t **tracker) {
celix_status_t status;
- service_tracker_customizer_pt customizer = NULL;
+ service_tracker_customizer_t *customizer = NULL;
status = serviceTrackerCustomizer_create(registration_factory, importRegistration_proxyFactoryAdding, importRegistration_proxyFactoryAdded, importRegistration_proxyFactoryModified, importRegistration_proxyFactoryRemoved, &customizer);
@@ -181,7 +181,7 @@ celix_status_t importRegistration_createProxyFactoryTracker(import_registration_
celix_status_t importRegistration_proxyFactoryAdding(void * handle, service_reference_pt reference, void **service) {
celix_status_t status = CELIX_SUCCESS;
- import_registration_factory_pt registration_factory = (import_registration_factory_pt) handle;
+ import_registration_factory_t *registration_factory = (import_registration_factory_t *) handle;
bundleContext_getService(registration_factory->context, reference, service);
@@ -191,8 +191,8 @@ celix_status_t importRegistration_proxyFactoryAdding(void * handle, service_refe
celix_status_t importRegistration_proxyFactoryAdded(void * handle, service_reference_pt reference, void *service) {
celix_status_t status = CELIX_SUCCESS;
- import_registration_factory_pt registration_factory = (import_registration_factory_pt) handle;
- registration_factory->trackedFactory = (remote_proxy_factory_service_pt) service;
+ import_registration_factory_t *registration_factory = (import_registration_factory_t *) handle;
+ registration_factory->trackedFactory = (remote_proxy_factory_service_t *) service;
return status;
}
@@ -206,7 +206,7 @@ celix_status_t importRegistration_proxyFactoryModified(void * handle, service_re
celix_status_t importRegistration_proxyFactoryRemoved(void * handle, service_reference_pt reference, void *service) {
celix_status_t status = CELIX_SUCCESS;
- import_registration_factory_pt registration_factory = (import_registration_factory_pt) handle;
+ import_registration_factory_t *registration_factory = (import_registration_factory_t *) handle;
registration_factory->trackedFactory = NULL;
return status;
@@ -214,7 +214,7 @@ celix_status_t importRegistration_proxyFactoryRemoved(void * handle, service_ref
-celix_status_t importRegistrationFactory_install(log_helper_pt helper, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory)
+celix_status_t importRegistrationFactory_install(log_helper_t *helper, char* serviceName, celix_bundle_context_t *context, import_registration_factory_t **registration_factory)
{
celix_status_t status;
@@ -238,13 +238,13 @@ celix_status_t importRegistrationFactory_install(log_helper_pt helper, char* ser
-celix_status_t importRegistration_getException(import_registration_pt registration) {
+celix_status_t importRegistration_getException(import_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t importRegistration_getImportReference(import_registration_pt registration, import_reference_pt *reference) {
+celix_status_t importRegistration_getImportReference(import_registration_t *registration, import_reference_t **reference) {
celix_status_t status = CELIX_SUCCESS;
if (registration->importReference == NULL) {
@@ -262,12 +262,12 @@ celix_status_t importRegistration_getImportReference(import_registration_pt regi
return status;
}
-celix_status_t importReference_getImportedEndpoint(import_reference_pt reference) {
+celix_status_t importReference_getImportedEndpoint(import_reference_t *reference) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
-celix_status_t importReference_getImportedService(import_reference_pt reference) {
+celix_status_t importReference_getImportedService(import_reference_t *reference) {
celix_status_t status = CELIX_SUCCESS;
return status;
}
\ No newline at end of file
diff --git a/bundles/remote_services/rsa_common/src/import_registration_impl.h b/bundles/remote_services/rsa_common/src/import_registration_impl.h
index 7aa397f..06fb510 100644
--- a/bundles/remote_services/rsa_common/src/import_registration_impl.h
+++ b/bundles/remote_services/rsa_common/src/import_registration_impl.h
@@ -33,13 +33,13 @@
#include "log_helper.h"
struct import_registration {
- bundle_context_pt context;
- endpoint_description_pt endpointDescription;
+ celix_bundle_context_t *context;
+ endpoint_description_t *endpointDescription;
service_reference_pt reference;
- import_reference_pt importReference;
+ import_reference_t *importReference;
- remote_service_admin_pt rsa;
+ remote_service_admin_t *rsa;
sendToHandle sendToCallback;
bool closed;
@@ -47,34 +47,33 @@ struct import_registration {
-struct import_registration_factory
-{
- char* serviceName;
- log_helper_pt loghelper;
- remote_proxy_factory_service_pt trackedFactory;
- service_tracker_pt proxyFactoryTracker;
- bundle_context_pt context;
+struct import_registration_factory {
+ char *serviceName;
+ log_helper_t *loghelper;
+ remote_proxy_factory_service_t *trackedFactory;
+ service_tracker_t *proxyFactoryTracker;
+ celix_bundle_context_t *context;
array_list_pt registrations;
- bundle_pt bundle;
+ celix_bundle_t *bundle;
};
-celix_status_t importRegistration_create(endpoint_description_pt endpoint, remote_service_admin_pt rsa, sendToHandle callback, bundle_context_pt context, import_registration_pt *registration);
-celix_status_t importRegistration_destroy(import_registration_pt registration);
+celix_status_t importRegistration_create(endpoint_description_t *endpoint, remote_service_admin_t *rsa, sendToHandle callback, celix_bundle_context_t *context, import_registration_t **registration);
+celix_status_t importRegistration_destroy(import_registration_t *registration);
-celix_status_t importRegistration_setEndpointDescription(import_registration_pt registration, endpoint_description_pt endpointDescription);
-celix_status_t importRegistration_setHandler(import_registration_pt registration, void * handler);
-celix_status_t importRegistration_setCallback(import_registration_pt registration, sendToHandle callback);
+celix_status_t importRegistration_setEndpointDescription(import_registration_t *registration, endpoint_description_t *endpointDescription);
+celix_status_t importRegistration_setHandler(import_registration_t *registration, void * handler);
+celix_status_t importRegistration_setCallback(import_registration_t *registration, sendToHandle callback);
-celix_status_t importRegistration_getException(import_registration_pt registration);
-celix_status_t importRegistration_getImportReference(import_registration_pt registration, import_reference_pt *reference);
+celix_status_t importRegistration_getException(import_registration_t *registration);
+celix_status_t importRegistration_getImportReference(import_registration_t *registration, import_reference_t **reference);
-celix_status_t importRegistration_createProxyFactoryTracker(import_registration_factory_pt registration_factory, service_tracker_pt *tracker);
+celix_status_t importRegistration_createProxyFactoryTracker(import_registration_factory_t *registration_factory, service_tracker_t **tracker);
-celix_status_t importRegistrationFactory_destroy(import_registration_factory_pt* registration_factory);
-//celix_status_t importRegistrationFactory_open(import_registration_factory_pt registration_factory);
-celix_status_t importRegistrationFactory_close(import_registration_factory_pt registration_factory);
-celix_status_t importRegistrationFactory_install(log_helper_pt helper, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory);
+celix_status_t importRegistrationFactory_destroy(import_registration_factory_t **registration_factory);
+//celix_status_t importRegistrationFactory_open(import_registration_factory_t *registration_factory);
+celix_status_t importRegistrationFactory_close(import_registration_factory_t *registration_factory);
+celix_status_t importRegistrationFactory_install(log_helper_t *helper, char* serviceName, celix_bundle_context_t *context, import_registration_factory_t **registration_factory);
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
index 64e5116..dfbaaf3 100644
--- a/bundles/remote_services/rsa_common/src/remote_proxy_factory_impl.c
+++ b/bundles/remote_services/rsa_common/src/remote_proxy_factory_impl.c
@@ -31,17 +31,17 @@
#include "remote_proxy.h"
typedef struct proxy_instance {
- service_registration_pt registration_ptr;
+ service_registration_t *registration_ptr;
void *service;
celix_properties_t *properties;
} *proxy_instance_pt;
-static celix_status_t remoteProxyFactory_registerProxyService(remote_proxy_factory_pt remote_proxy_factory_ptr, endpoint_description_pt endpointDescription, remote_service_admin_pt rsa, sendToHandle sendToCallback);
-static celix_status_t remoteProxyFactory_unregisterProxyService(remote_proxy_factory_pt remote_proxy_factory_ptr, endpoint_description_pt endpointDescription);
+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(bundle_context_pt context, char *service, void *handle,
+celix_status_t remoteProxyFactory_create(celix_bundle_context_t *context, char *service, void *handle,
createProxyService create, destroyProxyService destroy,
- remote_proxy_factory_pt *remote_proxy_factory_ptr) {
+ 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));
@@ -68,7 +68,7 @@ celix_status_t remoteProxyFactory_create(bundle_context_pt context, char *servic
return status;
}
-celix_status_t remoteProxyFactory_destroy(remote_proxy_factory_pt *remote_proxy_factory_ptr) {
+celix_status_t remoteProxyFactory_destroy(remote_proxy_factory_t **remote_proxy_factory_ptr) {
celix_status_t status = CELIX_SUCCESS;
if (!*remote_proxy_factory_ptr) {
@@ -91,7 +91,7 @@ celix_status_t remoteProxyFactory_destroy(remote_proxy_factory_pt *remote_proxy_
return status;
}
-celix_status_t remoteProxyFactory_register(remote_proxy_factory_pt remote_proxy_factory_ptr) {
+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));
@@ -120,7 +120,7 @@ celix_status_t remoteProxyFactory_register(remote_proxy_factory_pt remote_proxy_
return status;
}
-celix_status_t remoteProxyFactory_unregister(remote_proxy_factory_pt remote_proxy_factory_ptr) {
+celix_status_t remoteProxyFactory_unregister(remote_proxy_factory_t *remote_proxy_factory_ptr) {
celix_status_t status = CELIX_SUCCESS;
if (!remote_proxy_factory_ptr) {
@@ -157,7 +157,7 @@ celix_status_t remoteProxyFactory_unregister(remote_proxy_factory_pt remote_prox
}
-static celix_status_t remoteProxyFactory_registerProxyService(remote_proxy_factory_pt remote_proxy_factory_ptr, endpoint_description_pt endpointDescription, remote_service_admin_pt rsa, sendToHandle sendToCallback) {
+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;
@@ -217,7 +217,7 @@ static celix_status_t remoteProxyFactory_registerProxyService(remote_proxy_facto
return status;
}
-static celix_status_t remoteProxyFactory_unregisterProxyService(remote_proxy_factory_pt remote_proxy_factory_ptr, endpoint_description_pt endpointDescription) {
+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;
diff --git a/bundles/remote_services/rsa_common/src/remote_service_admin_impl.h b/bundles/remote_services/rsa_common/src/remote_service_admin_impl.h
index 528e813..b518c93 100644
--- a/bundles/remote_services/rsa_common/src/remote_service_admin_impl.h
+++ b/bundles/remote_services/rsa_common/src/remote_service_admin_impl.h
@@ -32,18 +32,18 @@
#define BUNDLE_STORE_PROPERTY_NAME "ENDPOINTS"
#define DEFAULT_BUNDLE_STORE "endpoints"
-celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin);
-celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin);
+celix_status_t remoteServiceAdmin_create(celix_bundle_context_t *context, remote_service_admin_t **admin);
+celix_status_t remoteServiceAdmin_destroy(remote_service_admin_t **admin);
-celix_status_t remoteServiceAdmin_send(remote_service_admin_pt rsa, endpoint_description_pt endpointDescription, char *methodSignature, char **reply, int* replyStatus);
+celix_status_t remoteServiceAdmin_send(remote_service_admin_t *rsa, endpoint_description_t *endpointDescription, char *methodSignature, char **reply, int* replyStatus);
-celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations);
-celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration);
-celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpoint, import_registration_pt *registration);
-celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration);
+celix_status_t remoteServiceAdmin_exportService(remote_service_admin_t *admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations);
+celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_t *admin, export_registration_t *registration);
+celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_t *admin, array_list_pt *services);
+celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_t *admin, array_list_pt *services);
+celix_status_t remoteServiceAdmin_importService(remote_service_admin_t *admin, endpoint_description_t *endpoint, import_registration_t **registration);
+celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_t *admin, import_registration_t *registration);
-celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description);
+celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_t **description);
#endif /* REMOTE_SERVICE_ADMIN_IMPL_H_ */
diff --git a/bundles/remote_services/rsa_spi/include/endpoint_description.h b/bundles/remote_services/rsa_spi/include/endpoint_description.h
index 2b12b6d..363331b 100644
--- a/bundles/remote_services/rsa_spi/include/endpoint_description.h
+++ b/bundles/remote_services/rsa_spi/include/endpoint_description.h
@@ -41,10 +41,9 @@ struct endpoint_description {
};
typedef struct endpoint_description endpoint_description_t;
-typedef endpoint_description_t* endpoint_description_pt;
-celix_status_t endpointDescription_create(celix_properties_t *properties, endpoint_description_pt *endpointDescription);
-celix_status_t endpointDescription_destroy(endpoint_description_pt description);
+celix_status_t endpointDescription_create(celix_properties_t *properties, endpoint_description_t **endpointDescription);
+celix_status_t endpointDescription_destroy(endpoint_description_t *description);
#endif /* ENDPOINT_DESCRIPTION_H_ */
diff --git a/bundles/remote_services/rsa_spi/include/endpoint_listener.h b/bundles/remote_services/rsa_spi/include/endpoint_listener.h
index 9e76578..d898138 100644
--- a/bundles/remote_services/rsa_spi/include/endpoint_listener.h
+++ b/bundles/remote_services/rsa_spi/include/endpoint_listener.h
@@ -1,27 +1,27 @@
/**
- *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
+ * 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
+ * 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.
+ * 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.
*/
/*
* endpoint_listener.h
*
* \date Sep 29, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
*/
#ifndef ENDPOINT_LISTENER_H_
@@ -37,13 +37,12 @@ static const char * const OSGI_ENDPOINT_LISTENER_SERVICE = "endpoint_listener";
static const char * const OSGI_ENDPOINT_LISTENER_SCOPE = "endpoint.listener.scope";
struct endpoint_listener {
- void *handle;
- celix_status_t (*endpointAdded)(void *handle, endpoint_description_pt endpoint, char *matchedFilter);
- celix_status_t (*endpointRemoved)(void *handle, endpoint_description_pt endpoint, char *matchedFilter);
+ void *handle;
+ celix_status_t (*endpointAdded)(void *handle, endpoint_description_t *endpoint, char *matchedFilter);
+ celix_status_t (*endpointRemoved)(void *handle, endpoint_description_t *endpoint, char *matchedFilter);
};
typedef struct endpoint_listener endpoint_listener_t;
-typedef endpoint_listener_t *endpoint_listener_pt;
#endif /* ENDPOINT_LISTENER_H_ */
diff --git a/bundles/remote_services/rsa_spi/include/export_registration.h b/bundles/remote_services/rsa_spi/include/export_registration.h
index 6ddffc5..96fca2c 100644
--- a/bundles/remote_services/rsa_spi/include/export_registration.h
+++ b/bundles/remote_services/rsa_spi/include/export_registration.h
@@ -24,15 +24,15 @@
#include "endpoint_description.h"
#include "service_reference.h"
-typedef struct export_registration *export_registration_pt;
+typedef struct export_registration export_registration_t;
-typedef struct export_reference *export_reference_pt;
+typedef struct export_reference export_reference_t;
-celix_status_t exportRegistration_close(export_registration_pt registration);
-celix_status_t exportRegistration_getException(export_registration_pt registration);
-celix_status_t exportRegistration_getExportReference(export_registration_pt registration, export_reference_pt *reference);
+celix_status_t exportRegistration_close(export_registration_t *registration);
+celix_status_t exportRegistration_getException(export_registration_t *registration);
+celix_status_t exportRegistration_getExportReference(export_registration_t *registration, export_reference_t **reference);
-celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference, endpoint_description_pt *endpoint);
-celix_status_t exportReference_getExportedService(export_reference_pt reference, service_reference_pt *service);
+celix_status_t exportReference_getExportedEndpoint(export_reference_t *reference, endpoint_description_t **endpoint);
+celix_status_t exportReference_getExportedService(export_reference_t *reference, service_reference_pt *service);
#endif //CELIX_EXPORT_REGISTRATION_H
diff --git a/bundles/remote_services/rsa_spi/include/import_registration.h b/bundles/remote_services/rsa_spi/include/import_registration.h
index d405bcd..0186c04 100644
--- a/bundles/remote_services/rsa_spi/include/import_registration.h
+++ b/bundles/remote_services/rsa_spi/include/import_registration.h
@@ -24,16 +24,16 @@
#include "endpoint_description.h"
#include "service_reference.h"
-typedef struct import_registration *import_registration_pt;
+typedef struct import_registration import_registration_t;
-typedef struct import_reference *import_reference_pt;
+typedef struct import_reference import_reference_t;
-celix_status_t importRegistration_close(import_registration_pt registration);
-celix_status_t importRegistration_getException(import_registration_pt registration);
-celix_status_t importRegistration_getImportReference(import_registration_pt registration, import_reference_pt *reference);
+celix_status_t importRegistration_close(import_registration_t *registration);
+celix_status_t importRegistration_getException(import_registration_t *registration);
+celix_status_t importRegistration_getImportReference(import_registration_t *registration, import_reference_t **reference);
-celix_status_t importReference_getImportedEndpoint(import_reference_pt reference);
-celix_status_t importReference_getImportedService(import_reference_pt reference);
+celix_status_t importReference_getImportedEndpoint(import_reference_t *reference);
+celix_status_t importReference_getImportedService(import_reference_t *reference);
#endif //CELIX_IMPORT_REGISTRATION_H
diff --git a/bundles/remote_services/rsa_spi/include/remote_endpoint.h b/bundles/remote_services/rsa_spi/include/remote_endpoint.h
index ab80abb..8dc27a5 100644
--- a/bundles/remote_services/rsa_spi/include/remote_endpoint.h
+++ b/bundles/remote_services/rsa_spi/include/remote_endpoint.h
@@ -30,15 +30,14 @@
#define OSGI_RSA_REMOTE_ENDPOINT "remote_endpoint"
typedef struct remote_endpoint remote_endpoint_t;
-typedef remote_endpoint_t* remote_endpoint_pt;
struct remote_endpoint_service {
- remote_endpoint_pt endpoint;
- celix_status_t (*setService)(remote_endpoint_pt endpoint, void *service);
- celix_status_t (*handleRequest)(remote_endpoint_pt endpoint, char *data, char **reply);
+ remote_endpoint_t *endpoint;
+ celix_status_t (*setService)(remote_endpoint_t *endpoint, void *service);
+ celix_status_t (*handleRequest)(remote_endpoint_t *endpoint, char *data, char **reply);
};
-typedef struct remote_endpoint_service *remote_endpoint_service_pt;
+typedef struct remote_endpoint_service remote_endpoint_service_t;
#endif /* REMOTE_ENDPOINT_H_ */
diff --git a/bundles/remote_services/rsa_spi/include/remote_proxy.h b/bundles/remote_services/rsa_spi/include/remote_proxy.h
index a024ef8..9ee8fbf 100644
--- a/bundles/remote_services/rsa_spi/include/remote_proxy.h
+++ b/bundles/remote_services/rsa_spi/include/remote_proxy.h
@@ -33,20 +33,20 @@
#define OSGI_RSA_REMOTE_PROXY_FACTORY "remote_proxy_factory"
#define OSGI_RSA_REMOTE_PROXY_TIMEOUT "remote_proxy_timeout"
-typedef celix_status_t (*sendToHandle)(remote_service_admin_pt remote_service_admin_ptr, endpoint_description_pt endpointDescription, char *request, char **reply, int* replyStatus);
-typedef celix_status_t (*createProxyService)(void *handle, endpoint_description_pt endpointDescription, remote_service_admin_pt rsa, sendToHandle sendToCallback, celix_properties_t *properties, void **service);
+typedef celix_status_t (*sendToHandle)(remote_service_admin_t *remote_service_admin_ptr, endpoint_description_t *endpointDescription, char *request, char **reply, int* replyStatus);
+typedef celix_status_t (*createProxyService)(void *handle, endpoint_description_t *endpointDescription, remote_service_admin_t *rsa, sendToHandle sendToCallback, celix_properties_t *properties, void **service);
typedef celix_status_t (*destroyProxyService)(void *handle, void *service);
-typedef struct remote_proxy_factory *remote_proxy_factory_pt;
-typedef struct remote_proxy_factory_service *remote_proxy_factory_service_pt;
+typedef struct remote_proxy_factory remote_proxy_factory_t;
+typedef struct remote_proxy_factory_service remote_proxy_factory_service_t;
struct remote_proxy_factory {
- bundle_context_pt context_ptr;
+ celix_bundle_context_t *context_ptr;
char *service;
- remote_proxy_factory_service_pt remote_proxy_factory_service_ptr;
+ remote_proxy_factory_service_t *remote_proxy_factory_service_ptr;
celix_properties_t *properties;
- service_registration_pt registration;
+ service_registration_t *registration;
hash_map_pt proxy_instances;
@@ -57,18 +57,18 @@ struct remote_proxy_factory {
};
struct remote_proxy_factory_service {
- remote_proxy_factory_pt factory;
- celix_status_t (*registerProxyService)(remote_proxy_factory_pt proxyFactoryService, endpoint_description_pt endpoint, remote_service_admin_pt remote_service_admin_ptr, sendToHandle callback);
- celix_status_t (*unregisterProxyService)(remote_proxy_factory_pt proxyFactoryService, endpoint_description_pt endpoint);
+ remote_proxy_factory_t *factory;
+ celix_status_t (*registerProxyService)(remote_proxy_factory_t *proxyFactoryService, endpoint_description_t *endpoint, remote_service_admin_t *remote_service_admin_ptr, sendToHandle callback);
+ celix_status_t (*unregisterProxyService)(remote_proxy_factory_t *proxyFactoryService, endpoint_description_t *endpoint);
};
-celix_status_t remoteProxyFactory_create(bundle_context_pt context, char *service, void *handle,
+celix_status_t remoteProxyFactory_create(celix_bundle_context_t *context, char *service, void *handle,
createProxyService create, destroyProxyService destroy,
- remote_proxy_factory_pt *remote_proxy_factory_ptr);
-celix_status_t remoteProxyFactory_destroy(remote_proxy_factory_pt *remote_proxy_factory_ptr);
+ remote_proxy_factory_t **remote_proxy_factory_ptr);
+celix_status_t remoteProxyFactory_destroy(remote_proxy_factory_t **remote_proxy_factory_ptr);
-celix_status_t remoteProxyFactory_register(remote_proxy_factory_pt remote_proxy_factory_ptr);
-celix_status_t remoteProxyFactory_unregister(remote_proxy_factory_pt remote_proxy_factory_ptr);
+celix_status_t remoteProxyFactory_register(remote_proxy_factory_t *remote_proxy_factory_ptr);
+celix_status_t remoteProxyFactory_unregister(remote_proxy_factory_t *remote_proxy_factory_ptr);
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 c195469..d513deb 100644
--- a/bundles/remote_services/rsa_spi/include/remote_service_admin.h
+++ b/bundles/remote_services/rsa_spi/include/remote_service_admin.h
@@ -35,40 +35,37 @@
#define OSGI_RSA_REMOTE_SERVICE_ADMIN "remote_service_admin"
typedef struct import_registration_factory import_registration_factory_t;
-typedef import_registration_factory_t* import_registration_factory_pt;
-//TODO refactor remote_service_admin_pt usage to void *handle;
+//TODO refactor remote_service_admin_t* usage to void *handle;
typedef struct remote_service_admin remote_service_admin_t;
-typedef remote_service_admin_t* remote_service_admin_pt;
struct remote_service_admin_service {
- remote_service_admin_pt admin;
- celix_status_t (*exportService)(remote_service_admin_pt admin, char *serviceId, celix_properties_t *properties, array_list_pt *registrations);
- celix_status_t (*removeExportedService)(remote_service_admin_pt admin, export_registration_pt registration);
- celix_status_t (*getExportedServices)(remote_service_admin_pt admin, array_list_pt *services);
- celix_status_t (*getImportedEndpoints)(remote_service_admin_pt admin, array_list_pt *services);
- celix_status_t (*importService)(remote_service_admin_pt admin, endpoint_description_pt endpoint, import_registration_pt *registration);
+ 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 (*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 (*importService)(remote_service_admin_t *admin, endpoint_description_t *endpoint, import_registration_t **registration);
- celix_status_t (*exportReference_getExportedEndpoint)(export_reference_pt reference, endpoint_description_pt *endpoint);
- celix_status_t (*exportReference_getExportedService)(export_reference_pt reference, service_reference_pt *service);
+ celix_status_t (*exportReference_getExportedEndpoint)(export_reference_t *reference, endpoint_description_t **endpoint);
+ celix_status_t (*exportReference_getExportedService)(export_reference_t *reference, service_reference_pt *service);
- celix_status_t (*exportRegistration_close)(remote_service_admin_pt admin, export_registration_pt registration);
- celix_status_t (*exportRegistration_getException)(export_registration_pt registration);
- celix_status_t (*exportRegistration_getExportReference)(export_registration_pt registration, export_reference_pt *reference);
- celix_status_t (*exportRegistration_freeExportReference)(export_reference_pt *reference);
- celix_status_t (*exportRegistration_getEndpointDescription)(export_registration_pt registration, endpoint_description_pt endpointDescription);
+ celix_status_t (*exportRegistration_close)(remote_service_admin_t *admin, export_registration_t *registration);
+ celix_status_t (*exportRegistration_getException)(export_registration_t *registration);
+ celix_status_t (*exportRegistration_getExportReference)(export_registration_t *registration, export_reference_t **reference);
+ celix_status_t (*exportRegistration_freeExportReference)(export_reference_t **reference);
+ celix_status_t (*exportRegistration_getEndpointDescription)(export_registration_t *registration, endpoint_description_t *endpointDescription);
- celix_status_t (*importReference_getImportedEndpoint)(import_reference_pt reference);
- celix_status_t (*importReference_getImportedService)(import_reference_pt reference);
+ celix_status_t (*importReference_getImportedEndpoint)(import_reference_t *reference);
+ celix_status_t (*importReference_getImportedService)(import_reference_t *reference);
- celix_status_t (*importRegistration_close)(remote_service_admin_pt admin, import_registration_pt registration);
- celix_status_t (*importRegistration_getException)(import_registration_pt registration);
- celix_status_t (*importRegistration_getImportReference)(import_registration_pt registration, import_reference_pt *reference);
+ celix_status_t (*importRegistration_close)(remote_service_admin_t *admin, import_registration_t *registration);
+ celix_status_t (*importRegistration_getException)(import_registration_t *registration);
+ celix_status_t (*importRegistration_getImportReference)(import_registration_t *registration, import_reference_t **reference);
};
typedef struct remote_service_admin_service remote_service_admin_service_t;
-typedef remote_service_admin_service_t* remote_service_admin_service_pt;
#endif /* REMOTE_SERVICE_ADMIN_H_ */
diff --git a/bundles/remote_services/topology_manager/src/activator.c b/bundles/remote_services/topology_manager/src/activator.c
index 699752b..7e1658b 100644
--- a/bundles/remote_services/topology_manager/src/activator.c
+++ b/bundles/remote_services/topology_manager/src/activator.c
@@ -44,32 +44,32 @@
#include "topology_manager.h"
struct activator {
- bundle_context_pt context;
+ celix_bundle_context_t *context;
topology_manager_pt manager;
- service_tracker_pt endpointListenerTracker;
- service_tracker_pt remoteServiceAdminTracker;
+ service_tracker_t *endpointListenerTracker;
+ service_tracker_t *remoteServiceAdminTracker;
celix_service_listener_t *serviceListener;
- endpoint_listener_pt endpointListener;
- service_registration_pt endpointListenerService;
+ endpoint_listener_t *endpointListener;
+ service_registration_t *endpointListenerService;
listener_hook_service_pt hookService;
- service_registration_pt hook;
+ service_registration_t *hook;
tm_scope_service_pt scopeService;
- service_registration_pt scopeReg;
+ service_registration_t *scopeReg;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
};
-static celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_pt *tracker);
-static celix_status_t bundleActivator_createRSATracker(struct activator *activator, service_tracker_pt *tracker);
+static celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_t **tracker);
+static celix_status_t bundleActivator_createRSATracker(struct activator *activator, service_tracker_t **tracker);
static celix_status_t bundleActivator_createServiceListener(struct activator *activator, celix_service_listener_t **listener);
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = NULL;
void *scope;
@@ -126,10 +126,10 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
return status;
}
-static celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_pt *tracker) {
+static celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_t **tracker) {
celix_status_t status;
- service_tracker_customizer_pt customizer = NULL;
+ service_tracker_customizer_t *customizer = NULL;
status = serviceTrackerCustomizer_create(activator->manager, topologyManager_endpointListenerAdding, topologyManager_endpointListenerAdded, topologyManager_endpointListenerModified,
topologyManager_endpointListenerRemoved, &customizer);
@@ -141,10 +141,10 @@ static celix_status_t bundleActivator_createEPLTracker(struct activator *activat
return status;
}
-static celix_status_t bundleActivator_createRSATracker(struct activator *activator, service_tracker_pt *tracker) {
+static celix_status_t bundleActivator_createRSATracker(struct activator *activator, service_tracker_t **tracker) {
celix_status_t status;
- service_tracker_customizer_pt customizer = NULL;
+ service_tracker_customizer_t *customizer = NULL;
status = serviceTrackerCustomizer_create(activator->manager, topologyManager_rsaAdding, topologyManager_rsaAdded, topologyManager_rsaModified, topologyManager_rsaRemoved, &customizer);
@@ -169,11 +169,11 @@ static celix_status_t bundleActivator_createServiceListener(struct activator *ac
return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
celix_status_t status;
struct activator *activator = userData;
- endpoint_listener_pt endpointListener = malloc(sizeof(*endpointListener));
+ endpoint_listener_t *endpointListener = malloc(sizeof(*endpointListener));
endpointListener->handle = activator->manager;
endpointListener->endpointAdded = topologyManager_addImportedService;
endpointListener->endpointRemoved = topologyManager_removeImportedService;
@@ -238,7 +238,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
@@ -266,7 +266,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
diff --git a/bundles/remote_services/topology_manager/src/scope.c b/bundles/remote_services/topology_manager/src/scope.c
index 4128c6d..e6d5a99 100644
--- a/bundles/remote_services/topology_manager/src/scope.c
+++ b/bundles/remote_services/topology_manager/src/scope.c
@@ -247,7 +247,7 @@ static celix_status_t import_equal(const void *src, const void *dest, bool *equa
return status;
}
-bool scope_allowImport(scope_pt scope, endpoint_description_pt endpoint) {
+bool scope_allowImport(scope_pt scope, endpoint_description_t *endpoint) {
bool allowImport = false;
array_list_iterator_pt iter;
diff --git a/bundles/remote_services/topology_manager/src/scope.h b/bundles/remote_services/topology_manager/src/scope.h
index c9dc6d7..0c1afc7 100644
--- a/bundles/remote_services/topology_manager/src/scope.h
+++ b/bundles/remote_services/topology_manager/src/scope.h
@@ -85,7 +85,7 @@ void scope_setImportScopeChangedCallback(scope_pt scope, celix_status_t (*change
* \return true import allowed
* false import not allowed
*/
-bool scope_allowImport(scope_pt scope, endpoint_description_pt endpoint);
+bool scope_allowImport(scope_pt scope, endpoint_description_t *endpoint);
/* \brief Test if scope allows import of service
*
diff --git a/bundles/remote_services/topology_manager/src/topology_manager.c b/bundles/remote_services/topology_manager/src/topology_manager.c
index d1e5352..906407c 100644
--- a/bundles/remote_services/topology_manager/src/topology_manager.c
+++ b/bundles/remote_services/topology_manager/src/topology_manager.c
@@ -46,7 +46,7 @@
#include "hash_map.h"
struct topology_manager {
- bundle_context_pt context;
+ celix_bundle_context_t *context;
celix_thread_mutex_t rsaListLock;
celix_thread_mutexattr_t rsaListLockAttr;
@@ -64,15 +64,15 @@ struct topology_manager {
scope_pt scope;
- log_helper_pt loghelper;
+ log_helper_t *loghelper;
};
celix_status_t topologyManager_exportScopeChanged(void *handle, char *service_name);
celix_status_t topologyManager_importScopeChanged(void *handle, char *service_name);
-celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt manager, remote_service_admin_service_pt rsa, array_list_pt registrations);
-celix_status_t topologyManager_notifyListenersEndpointRemoved(topology_manager_pt manager, remote_service_admin_service_pt rsa, export_registration_pt export);
+celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt manager, remote_service_admin_service_t *rsa, array_list_pt registrations);
+celix_status_t topologyManager_notifyListenersEndpointRemoved(topology_manager_pt manager, remote_service_admin_service_t *rsa, export_registration_t *export);
-celix_status_t topologyManager_create(bundle_context_pt context, log_helper_pt logHelper, topology_manager_pt *manager, void **scope) {
+celix_status_t topologyManager_create(celix_bundle_context_t *context, log_helper_t *logHelper, topology_manager_pt *manager, void **scope) {
celix_status_t status = CELIX_SUCCESS;
*manager = calloc(1, sizeof(**manager));
@@ -159,7 +159,7 @@ celix_status_t topologyManager_closeImports(topology_manager_pt manager) {
hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- endpoint_description_pt ep = hashMapEntry_getKey(entry);
+ endpoint_description_t *ep = hashMapEntry_getKey(entry);
hash_map_pt imports = hashMapEntry_getValue(entry);
if (imports != NULL) {
@@ -169,8 +169,8 @@ celix_status_t topologyManager_closeImports(topology_manager_pt manager) {
while (hashMapIterator_hasNext(importsIter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(importsIter);
- remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
- import_registration_pt import = hashMapEntry_getValue(entry);
+ remote_service_admin_service_t *rsa = hashMapEntry_getKey(entry);
+ import_registration_t *import = hashMapEntry_getValue(entry);
status = rsa->importRegistration_close(rsa->admin, import);
if (status == CELIX_SUCCESS) {
@@ -204,7 +204,7 @@ celix_status_t topologyManager_rsaAdded(void * handle, service_reference_pt refe
celix_status_t status;
topology_manager_pt manager = (topology_manager_pt) handle;
celix_properties_t *serviceProperties = NULL;
- remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
+ remote_service_admin_service_t *rsa = (remote_service_admin_service_t *) service;
logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Added RSA");
status = celixThreadMutex_lock(&manager->rsaListLock);
@@ -223,9 +223,9 @@ celix_status_t topologyManager_rsaAdded(void * handle, service_reference_pt refe
while (hashMapIterator_hasNext(importedServicesIterator)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(importedServicesIterator);
- endpoint_description_pt endpoint = hashMapEntry_getKey(entry);
+ endpoint_description_t *endpoint = hashMapEntry_getKey(entry);
if (scope_allowImport(manager->scope, endpoint)) {
- import_registration_pt import = NULL;
+ import_registration_t *import = NULL;
status = rsa->importService(rsa->admin, endpoint, &import);
if (status == CELIX_SUCCESS) {
@@ -298,7 +298,7 @@ celix_status_t topologyManager_rsaModified(void * handle, service_reference_pt r
celix_status_t topologyManager_rsaRemoved(void * handle, service_reference_pt reference, void * service) {
celix_status_t status = CELIX_SUCCESS;
topology_manager_pt manager = (topology_manager_pt) handle;
- remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
+ remote_service_admin_service_t *rsa = (remote_service_admin_service_t *) service;
if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
hash_map_iterator_pt iter = hashMapIterator_create(manager->exportedServices);
@@ -319,7 +319,7 @@ celix_status_t topologyManager_rsaRemoved(void * handle, service_reference_pt re
int exportsIter = 0;
int exportListSize = arrayList_size(exports_list);
for (exportsIter = 0; exports_list != NULL && exportsIter < exportListSize; exportsIter++) {
- export_registration_pt export = arrayList_get(exports_list, exportsIter);
+ export_registration_t *export = arrayList_get(exports_list, exportsIter);
topologyManager_notifyListenersEndpointRemoved(manager, rsa, export);
rsa->exportRegistration_close(rsa->admin, export);
}
@@ -349,7 +349,7 @@ celix_status_t topologyManager_rsaRemoved(void * handle, service_reference_pt re
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
hash_map_pt imports = hashMapEntry_getValue(entry);
- import_registration_pt import = hashMap_get(imports, rsa);
+ import_registration_t *import = hashMap_get(imports, rsa);
if (import != NULL) {
celix_status_t subStatus = rsa->importRegistration_close(rsa->admin, import);
@@ -415,7 +415,7 @@ celix_status_t topologyManager_serviceChanged(void *listener, celix_service_even
celix_status_t topologyManager_exportScopeChanged(void *handle, char *filterStr) {
celix_status_t status = CELIX_SUCCESS;
topology_manager_pt manager = (topology_manager_pt) handle;
- service_registration_pt reg = NULL;
+ service_registration_t *reg = NULL;
const char* serviceId = NULL;
bool found;
celix_properties_t *props;
@@ -489,7 +489,7 @@ celix_status_t topologyManager_exportScopeChanged(void *handle, char *filterStr)
celix_status_t topologyManager_importScopeChanged(void *handle, char *service_name) {
celix_status_t status = CELIX_SUCCESS;
- endpoint_description_pt endpoint;
+ endpoint_description_t *endpoint;
topology_manager_pt manager = (topology_manager_pt) handle;
bool found = false;
@@ -523,7 +523,7 @@ celix_status_t topologyManager_importScopeChanged(void *handle, char *service_na
return status;
}
-celix_status_t topologyManager_addImportedService(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
+celix_status_t topologyManager_addImportedService(void *handle, endpoint_description_t *endpoint, char *matchedFilter) {
celix_status_t status = CELIX_SUCCESS;
topology_manager_pt manager = handle;
@@ -539,8 +539,8 @@ celix_status_t topologyManager_addImportedService(void *handle, endpoint_descrip
int size = arrayList_size(manager->rsaList);
for (int iter = 0; iter < size; iter++) {
- import_registration_pt import = NULL;
- remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
+ import_registration_t *import = NULL;
+ remote_service_admin_service_t *rsa = arrayList_get(manager->rsaList, iter);
celix_status_t substatus = rsa->importService(rsa->admin, endpoint, &import);
if (substatus == CELIX_SUCCESS) {
hashMap_put(imports, rsa, import);
@@ -560,7 +560,7 @@ celix_status_t topologyManager_addImportedService(void *handle, endpoint_descrip
return status;
}
-celix_status_t topologyManager_removeImportedService(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
+celix_status_t topologyManager_removeImportedService(void *handle, endpoint_description_t *endpoint, char *matchedFilter) {
celix_status_t status = CELIX_SUCCESS;
topology_manager_pt manager = handle;
@@ -571,7 +571,7 @@ celix_status_t topologyManager_removeImportedService(void *handle, endpoint_desc
hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- endpoint_description_pt ep = hashMapEntry_getKey(entry);
+ endpoint_description_t *ep = hashMapEntry_getKey(entry);
hash_map_pt imports = hashMapEntry_getValue(entry);
if (imports != NULL && strcmp(endpoint->id, ep->id) == 0) {
@@ -579,8 +579,8 @@ celix_status_t topologyManager_removeImportedService(void *handle, endpoint_desc
while (hashMapIterator_hasNext(importsIter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(importsIter);
- remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
- import_registration_pt import = hashMapEntry_getValue(entry);
+ remote_service_admin_service_t *rsa = hashMapEntry_getKey(entry);
+ import_registration_t *import = hashMapEntry_getValue(entry);
celix_status_t substatus = rsa->importRegistration_close(rsa->admin, import);
if (substatus == CELIX_SUCCESS) {
hashMapIterator_remove(importsIter);
@@ -620,7 +620,7 @@ celix_status_t topologyManager_addExportedService(topology_manager_pt manager, s
}
for (int iter = 0; iter < size; iter++) {
- remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
+ remote_service_admin_service_t *rsa = arrayList_get(manager->rsaList, iter);
array_list_pt endpoints = NULL;
celix_status_t substatus = rsa->exportService(rsa->admin, serviceId, serviceProperties, &endpoints);
@@ -651,13 +651,13 @@ celix_status_t topologyManager_removeExportedService(topology_manager_pt manager
hash_map_iterator_pt iter = hashMapIterator_create(exports);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
+ remote_service_admin_service_t *rsa = hashMapEntry_getKey(entry);
array_list_pt exportRegistrations = hashMapEntry_getValue(entry);
int size = arrayList_size(exportRegistrations);
for (int exportsIter = 0; exportsIter < size; exportsIter++) {
- export_registration_pt export = arrayList_get(exportRegistrations, exportsIter);
+ export_registration_t *export = arrayList_get(exportRegistrations, exportsIter);
topologyManager_notifyListenersEndpointRemoved(manager, rsa, export);
rsa->exportRegistration_close(rsa->admin, export);
}
@@ -682,10 +682,10 @@ celix_status_t topologyManager_removeExportedService(topology_manager_pt manager
return status;
}
-celix_status_t topologyManager_getEndpointDescriptionForExportRegistration(remote_service_admin_service_pt rsa, export_registration_pt export, endpoint_description_pt *endpoint) {
+celix_status_t topologyManager_getEndpointDescriptionForExportRegistration(remote_service_admin_service_t *rsa, export_registration_t *export, endpoint_description_t **endpoint) {
celix_status_t status;
- export_reference_pt reference = NULL;
+ export_reference_t *reference = NULL;
status = rsa->exportRegistration_getExportReference(export, &reference);
if (status == CELIX_SUCCESS) {
@@ -728,22 +728,22 @@ celix_status_t topologyManager_endpointListenerAdded(void* handle, service_refer
while (hashMapIterator_hasNext(rsaIter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(rsaIter);
- remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
+ remote_service_admin_service_t *rsa = hashMapEntry_getKey(entry);
array_list_pt registrations = hashMapEntry_getValue(entry);
int arrayListSize = arrayList_size(registrations);
int cnt = 0;
for (; cnt < arrayListSize; cnt++) {
- export_registration_pt export = arrayList_get(registrations, cnt);
- endpoint_description_pt endpoint = NULL;
+ export_registration_t *export = arrayList_get(registrations, cnt);
+ endpoint_description_t *endpoint = NULL;
status = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
if (status == CELIX_SUCCESS) {
bool matchResult = false;
filter_match(filter, endpoint->properties, &matchResult);
if (matchResult) {
- endpoint_listener_pt listener = (endpoint_listener_pt) service;
+ endpoint_listener_t *listener = (endpoint_listener_t *) service;
status = listener->endpointAdded(listener->handle, endpoint, (char*)scope);
}
}
@@ -787,7 +787,7 @@ celix_status_t topologyManager_endpointListenerRemoved(void * handle, service_re
return status;
}
-celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt manager, remote_service_admin_service_pt rsa, array_list_pt registrations) {
+celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt manager, remote_service_admin_service_t *rsa, array_list_pt registrations) {
celix_status_t status = CELIX_SUCCESS;
if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
@@ -795,7 +795,7 @@ celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt
hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
while (hashMapIterator_hasNext(iter)) {
const char* scope = NULL;
- endpoint_listener_pt epl = NULL;
+ endpoint_listener_t *epl = NULL;
service_reference_pt reference = hashMapIterator_nextKey(iter);
serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
@@ -806,8 +806,8 @@ celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt
int regSize = arrayList_size(registrations);
for (int regIt = 0; regIt < regSize; regIt++) {
- export_registration_pt export = arrayList_get(registrations, regIt);
- endpoint_description_pt endpoint = NULL;
+ export_registration_t *export = arrayList_get(registrations, regIt);
+ endpoint_description_t *endpoint = NULL;
celix_status_t substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
if (substatus == CELIX_SUCCESS) {
bool matchResult = false;
@@ -829,14 +829,14 @@ celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt
return status;
}
... 1058 lines suppressed ...