Skip to content

Commit

Permalink
capicxx-dbus-runtime 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzbichler committed Oct 27, 2020
1 parent 9f85f0f commit d1610ad
Show file tree
Hide file tree
Showing 73 changed files with 662 additions and 681 deletions.
25 changes: 2 additions & 23 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
Changes
=======
v3.1.12.11
- Prevent crash when deregistering managed service (via 'deregisterManagedStub*') and
another service (via 'unregisterService') in parallel with same DBus connection

v3.1.12.10
- Unregister mappings in DBusAddressTranslator (to free memory again) when
services/stubs are unregistered

v3.1.12.9
- Unregister mappings in DBusAddressTranslator (to free memory again) when
proxies are destroyed

v3.1.12.8
- Fixed crash in DBusConnectionTest

v3.1.12.7
- Adapted 'capi-dbus-add-support-for-custom-marshalling.patch' to be compatible with dbus version 1.12.x

v3.1.12.6
- Removed concurrent timeout handling

v3.1.12.5
- Ensure availability listeners are unregistered properly (to free memory) when
proxies are being destroyed in callback invoking the availability listener(s)
v3.2.0
- adapt to CommonAPI v3.2.0

v3.1.12.4
- support 'lock functors' in AttributeDispatcher(s)
Expand Down
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ PROJECT(libcommonapi-dbus)

# version of CommonAPI-DBus
SET( LIBCOMMONAPI_DBUS_MAJOR_VERSION 3 )
SET( LIBCOMMONAPI_DBUS_MINOR_VERSION 1 )
SET( LIBCOMMONAPI_DBUS_PATCH_VERSION 12 )
SET( LIBCOMMONAPI_DBUS_MINOR_VERSION 2 )
SET( LIBCOMMONAPI_DBUS_PATCH_VERSION 0 )

message(STATUS "Project name: ${PROJECT_NAME}")

Expand Down Expand Up @@ -59,10 +59,14 @@ message(STATUS "DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT is set to value: ${DBUS_D

SET(RPM_PACKAGE_VERSION "r0" CACHE STRING "rpm packet version") # used in e.g. commonapi-dbus.spec.in

# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
"Choose the type of build, options are: Debug Release." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

set(CMAKE_BUILD_TYPE_FOR_SPEC_IN "") # used in *.cmake.in
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_FOR_SPEC_IN)
Expand Down Expand Up @@ -123,9 +127,9 @@ message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
FIND_PACKAGE(PkgConfig)
FIND_PACKAGE(Threads REQUIRED)
if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
FIND_PACKAGE(CommonAPI 3.1.12 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
FIND_PACKAGE(CommonAPI 3.1.12 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()

message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
Expand Down Expand Up @@ -164,7 +168,7 @@ if (MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCOMMONAPI_INTERNAL_COMPILATION -DCOMMONAPI_DLL_COMPILATION /EHsc /wd4503")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCOMMONAPI_INTERNAL_COMPILATION -DCOMMONAPI_DLL_COMPILATION /wd4503")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP -fvisibility=hidden")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}")
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### CommonAPI C++ D-Bus Runtime

##### Copyright
Copyright (C) 2016-2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
Copyright (C) 2016-2017, GENIVI Alliance, Inc.
Copyright (C) 2016-2020, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
Copyright (C) 2016-2020, GENIVI Alliance, Inc.

This file is part of GENIVI Project IPC Common API C++.
Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0.
Expand Down Expand Up @@ -59,4 +59,4 @@ $ make install

You can change the installation directory by the CMake variable _CMAKE_INSTALL_PREFIX_ or you can let it uninstalled (skip the _make install_ command). If you want to use the uninstalled version of CommonAPI set the CMake variable _USE_INSTALLED_COMMONAPI_ to _OFF_.

For further build instructions (build for windows, build documentation, tests etc.) please refer to the CommonAPI D-Bus tutorial.
For further build instructions (build for windows, build documentation, tests etc.) please refer to the CommonAPI D-Bus tutorial.
7 changes: 5 additions & 2 deletions include/CommonAPI/DBus/CommonAPIDBus.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand All @@ -8,11 +8,14 @@

#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#define HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#endif

#include "DBusAddressTranslator.hpp"

#ifdef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#undef COMMONAPI_INTERNAL_COMPILATION
#undef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#endif

#endif // COMMONAPI_DBUS_HPP_

4 changes: 3 additions & 1 deletion include/CommonAPI/DBus/DBusAddress.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -26,6 +26,8 @@ class DBusAddress {
COMMONAPI_EXPORT DBusAddress(const DBusAddress &_source);
COMMONAPI_EXPORT virtual ~DBusAddress();

COMMONAPI_EXPORT DBusAddress &operator=(const DBusAddress &_other);

COMMONAPI_EXPORT bool operator==(const DBusAddress &_other) const;
COMMONAPI_EXPORT bool operator!=(const DBusAddress &_other) const;
COMMONAPI_EXPORT bool operator<(const DBusAddress &_other) const;
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusAddressTranslator.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusAttribute.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
6 changes: 5 additions & 1 deletion include/CommonAPI/DBus/DBusClientId.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -38,6 +38,10 @@ class COMMONAPI_EXPORT_CLASS_EXPLICIT DBusClientId
COMMONAPI_EXPORT const char * getDBusId();

COMMONAPI_EXPORT DBusMessage createMessage(const std::string objectPath, const std::string interfaceName, const std::string signalName) const;

COMMONAPI_EXPORT uid_t getUid() const;
COMMONAPI_EXPORT gid_t getGid() const;

protected:
std::string dbusId_;
};
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusConfig.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
4 changes: 1 addition & 3 deletions include/CommonAPI/DBus/DBusConnection.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -217,8 +217,6 @@ class DBusConnection
template<class Function, class... Arguments>
COMMONAPI_EXPORT void proxyPushFunctionToMainLoop(Function&& _function, Arguments&& ... _args);

COMMONAPI_EXPORT void setPendingCallTimedOut(DBusPendingCall* _pendingCall, ::DBusTimeout* _timeout) const;

#ifdef COMMONAPI_DBUS_TEST
inline std::weak_ptr<DBusMainloop> getLoop() { return loop_; }
#endif
Expand Down
8 changes: 4 additions & 4 deletions include/CommonAPI/DBus/DBusDaemonProxy.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -55,7 +55,7 @@ class DBusDaemonProxy : public DBusProxyBase,
typedef std::function<void(const CommonAPI::CallStatus&, std::string)> GetNameOwnerAsyncCallback;

COMMONAPI_EXPORT DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection);
COMMONAPI_EXPORT virtual ~DBusDaemonProxy() {}
COMMONAPI_EXPORT virtual ~DBusDaemonProxy();

COMMONAPI_EXPORT virtual bool isAvailable() const;
COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
Expand Down Expand Up @@ -112,7 +112,7 @@ class DBusDaemonProxy : public DBusProxyBase,
const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
if (!success) {
std::promise<CallStatus> promise;
promise.set_value(CallStatus::OUT_OF_MEMORY);
promise.set_value(CallStatus::SERIALIZATION_ERROR);
return promise.get_future();
}
outputStream.flush();
Expand Down Expand Up @@ -170,7 +170,7 @@ class DBusDaemonProxy : public DBusProxyBase,
const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
if (!success) {
std::promise<CallStatus> promise;
promise.set_value(CallStatus::OUT_OF_MEMORY);
promise.set_value(CallStatus::SERIALIZATION_ERROR);
return promise.get_future();
}
outputStream.flush();
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusDeployment.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusError.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
12 changes: 7 additions & 5 deletions include/CommonAPI/DBus/DBusErrorEvent.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -73,19 +73,21 @@ class DBusErrorEvent<

private:

template <int... DeplIn_ArgIndices>
template <size_t... DeplIn_ArgIndices>
inline void initialize(index_sequence<DeplIn_ArgIndices...>, const std::tuple<DeplIn_Args*...> &_in) {
in_ = std::make_tuple(std::get<DeplIn_ArgIndices>(_in)...);
}

template <int... InArgIndices_>
template <size_t... InArgIndices_>
void deserialize(const DBusMessage &_reply,
index_sequence<InArgIndices_...>) {
if (sizeof...(InArgs_) > 0) {
DBusInputStream dbusInputStream(_reply);
const bool success = DBusSerializableArguments<CommonAPI::Deployable<InArgs_, DeplIn_Args>...>::deserialize(dbusInputStream, std::get<InArgIndices_>(in_)...);
if (!success)
if (!success) {
COMMONAPI_ERROR("DBusErrorEvent::", __func__, "(", errorName_, "): deserialization failed!");
return;
}
this->notifyListeners(errorName_, std::move(std::get<InArgIndices_>(in_).getValue())...);
}
}
Expand All @@ -96,7 +98,7 @@ class DBusErrorEvent<

class DBusErrorEventHelper {
public:
template <int... ErrorEventsIndices_, class... ErrorEvents_>
template <size_t... ErrorEventsIndices_, class... ErrorEvents_>
static void notifyListeners(const DBusMessage &_reply,
const std::string &_errorName,
index_sequence<ErrorEventsIndices_...>,
Expand Down
6 changes: 3 additions & 3 deletions include/CommonAPI/DBus/DBusEvent.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -155,7 +155,7 @@ class DBusEvent: public Event_ {
std::get<3>(subscription_) = "";
}

template<int ... Indices_>
template<size_t ... Indices_>
inline void handleSignalDBusMessage(const DBusMessage &_message, index_sequence<Indices_...>) {
DBusInputStream input(_message);
if (DBusSerializableArguments<
Expand All @@ -165,7 +165,7 @@ class DBusEvent: public Event_ {
}
}

template<int ... Indices_>
template<size_t ... Indices_>
inline void handleSignalDBusMessage(const uint32_t tag, const DBusMessage &_message, index_sequence<Indices_...>) {
DBusInputStream input(_message);
if (DBusSerializableArguments<
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusFactory.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
Loading

0 comments on commit d1610ad

Please sign in to comment.