Commit Graph
302 Commits
Author SHA1 Message Date
Sergey Bobrenok b5aee6d019 docs: add information about Buildroot package (#252) 2022-06-07 08:45:34 +02:00
Michal Hučko 5caea3b72b fix: invalid assert on event fd (#243) 2022-02-13 18:48:50 +01:00
Stanislav Angelovič b7a9c63ff0 refactor: add validity checks for names and paths (#242) 2022-02-11 21:53:37 +01:00
Stanislav Angelovic 7f437a6e06 fix(tests): printer for std::chrono in googletest v1.11.0 2022-02-09 11:43:12 +01:00
Benjamin Kaufmann f492472e9f Enable move for ObjectPath and Signature.
* Since ObjectPath and Signature have a user-declared copy-ctor and copy
  assignment operator the implicit declaration of corresponding move
  operations is disabled. Explicitly add defaulted versions so that
  move operations actually move instead of copy.

* See: https://github.com/Kistler-Group/sdbus-cpp/issues/230
2022-01-11 19:02:37 +01:00
Benjamin Kaufmann f673e57a47 Fix potential UB in creation of sdbus::Error.
See https://github.com/Kistler-Group/sdbus-cpp/issues/231
2022-01-11 19:01:22 +01:00
Stanislav Angelovic bca8e81037 build: version 1.1.0 v1.1.0 2021-12-22 13:17:31 +01:00
Stanislav Angelovic 33ff69ecd2 chore: remove unnecessary googletest CMake file 2021-12-22 13:10:30 +01:00
Stanislav Angelovic b8eb0e8ceb fix: minor fixes for async timeout handling 2021-12-21 13:52:14 +01:00
Stanislav Angelovic 23fdd0ce8f fix: use non-mutating find in signal unregistration 2021-12-20 10:05:24 +01:00
bb0f3f0242 Fix #88: Timeout handling. (#91)
fix timeout handling

* Despite what is documented in sd_bus_get_timeout(3), the timeout
  returned is actually an absolute time point of Linux's CLOCK_MONOTONIC
  clock. Hence, we first have to subtract the current time from the
  timeout in order to get a relative time that can be passed to poll.

* For async call timeouts to reliably work, we need a way to notify the
  event loop of a connection that is currently blocked waiting in poll.
  I.e. assume the event loop thread entered poll with a timeout set to
  T1. Afterwards, the main thread starts an async call C with a timeout
  T2 < T1. In order for C to be canceled after its timeout T1 has
  elapsed, we have to be able to notify the event loop so that it can
  update its poll data.

Co-authored-by: Urs Ritzmann <ursritzmann@protonmail.ch>
Co-authored-by: Lukasz Marcul <lukasz.marcul@onemeter.com>
2021-12-20 10:00:29 +01:00
Stanislav Angelovic 0b8f2d9752 fix: use correct path to README file for CPack 2021-12-15 12:46:05 +01:00
Stanislav Angelovic 9b8a15339e test: delete forgotten file 2021-12-14 21:59:46 +01:00
Stanislav Angelovic ef4d9bcba2 chore: add note on libsystemd-dev when libsystemd pkgconfig file is not found 2021-12-14 21:35:11 +01:00
Osama Ghanem 41d33117cc Fix #214: Add means to unregister signal handler 2021-12-14 16:48:50 +01:00
Lukasz Marcul 442670ec18 codegen: Support chrono literal timeout by ProxyGenerator
Allow to use human readable chrono literals to specify method call
timeout. The change is backward compatbile - if no unit is provided,
the fallback is "us".

Example:
<annotation name="org.freedesktop.DBus.Method.Timeout" value="500ms"/>
2021-12-14 16:47:01 +01:00
Marcel Hellwig b01db13ff7 fix method name in example 2021-12-01 16:18:58 +01:00
Stanislav Angelovič dc0f487751 Reword a few tutorial statements slightly 2021-11-22 14:27:28 +01:00
Urs Ritzmann 55310659e8 googletest-download: replace master with main 2021-11-16 17:47:25 +01:00
Urs Ritzmann 65782bbf43 tools version 1.0.0 v1.0.0 2021-10-25 09:02:37 +02:00
Urs Ritzmann 125cb1616c version 1.0.0 2021-10-25 09:02:37 +02:00
Urs Ritzmann f025b92d76 ci: pack only the g++ build 2021-10-25 09:00:30 +02:00
Urs Ritzmann 33aa5768a5 ci: create and upload deb package 2021-10-25 09:00:30 +02:00
Urs Ritzmann 0703324015 ci: update make commands to cmake 2021-10-25 09:00:30 +02:00
Urs Ritzmann f05f63cd48 cpack: remove test component
If -DBUILD_TESTS=ON, then creating debian packages fails
because dpkg-shlibdeps obiously can't find the sdbus-c++ dependency
for the tests package.

We could disable CPACK_DEBIAN_PACKAGE_SHLIBDEPS for the tests package.
Nevertheless I don't think we want a tests package at all.
2021-10-25 09:00:30 +02:00
riuriuriu de9cd46d8a update ChangeLog: v0.8.4 was never released 2021-10-18 14:16:30 +02:00
riuriuriu ca05b1541f fix non-virtual-dtor warning 2021-10-18 11:58:07 +02:00
Urs Ritzmann 35176c4988 integrationtests: differentiate BUS_NAME from INTERFACE_NAME
Even though they have the same value, they are something fundamentally different.
Therefore it is extremely confusing if the constant INTERFACE_NAME is passed
where actually a well-known BUS_NAME (destination) should go.
2021-10-18 11:58:07 +02:00
Urs Ritzmann a5ecbbfcec add examples for the ObjectManager API 2021-10-18 11:58:07 +02:00
Urs Ritzmann 4e908612ed introduce new ObjectManager API on generated stubs layer
ATTENTION: Breaking Change!
2021-10-18 11:58:07 +02:00
Stanislav Angelovič 1d930f324e update changelog: v0.9.0 v0.9.0 2021-10-15 15:20:46 +02:00
Rolf Lussi a341754533 add dependency to libsytemd-dev to sdbus-c++-dev package 2021-09-23 20:18:14 +02:00
Rolf Lussi 9cb8b89a01 add cpack to build debian packages, split the packages by components 2021-09-23 20:18:14 +02:00
Stanislav Angelovic c422de641a Support Error parameter in signal handlers 2021-09-17 19:25:39 +02:00
Stanislav Angelovic d77bb6b869 Fix potential race condition in Object destruction 2021-09-17 19:03:15 +02:00
Stanislav Angelovič 8320429ef7 chore: add gperf dependency for libsystemd build 2021-09-17 18:31:04 +02:00
Stanislav Angelovič a72e17b932 doc: add gperf dependency for libsystemd 2021-09-17 18:28:41 +02:00
Stanislav Angelovic b4f5c0f46c Catch sdbus-c++ exceptions flying from Proxy callbacks to libsystemd 2021-07-29 12:37:15 +02:00
Stanislav Angelovic 6433b38ed1 Add specific sections for tips and notes in the tutorial 2021-07-22 16:01:42 +02:00
Stanislav Angelovic a95fcf5693 Make resetting loop thread ID exception-safe 2021-07-22 13:48:43 +02:00
David Leeds 022831b8c3 Avoid propagating msg unpack exceptions to event loop
This change addresses conditions where an exception is thrown by the library upon receipt of a malformed message from an external
source, and propagated up to the event loop with no chance of
interception by the application. This issue is only experienced by
proxy convenience APIs, as low-level APIs allow the application to
unpack the message.

Strategy:
1. For malformed signals received by proxies: ignore the signal.
2. For malformed async method responses, translate the unpack
  exception into an sdbus::Error, and pass it to the caller as expected.
2021-07-20 18:39:36 +02:00
Stanislav Angelovic e16ffb1288 Provide access to D-Bus message in high-level API 2021-06-22 11:31:08 +02:00
David Leeds 75ea127374 connection: add createDefaultBusConnection()
This internally calls sd_bus_open(), which automatically selects the
system or session bus connection based on the presence and 
content of a DBUS_STARTER_BUS_TYPE environment variable and
whether the calling process has root privileges.

This option is very helpful when creating services and clients that will use the system bus in production, but connect to a session
for testing.

Additional changes:
* Removed assertions null-checking make_unique() return values.
  make_unique() calls new, and new is expected to throw or abort
  on failure, making the assertions unhelpful.
* Corrected a typo in the ClosesAndUnrefsBusWhenDestructed
  unit test for the system bus (tested the wrong function).
2021-06-21 15:55:23 +02:00
Sergey Bobrenok d74365c535 docs: Add information about conan recipe 2021-06-15 15:27:29 +02:00
Benjamin Kaufmann a5e94f07bf Fix issue #135: Segfault in Message::peekType()
* Add missing nullptr check in Message::peekType().

* According to its specification, sd_bus_message_peek_type() sets a
  given contents parameter to NULL if the next element in a message is
  not a container. Since assigning a nullptr to a std::string has
  undefined behaviour (typically resulting in an invalid memory access),
  Message::peekType() must not assign contentsSig unconditionally.
2021-06-15 15:26:10 +02:00
Urs RitzmannandStanislav Angelovic fa9569fdd9 Issue 133 race in proxy destruct (#177)
* fix construct/destruct order of mutex/data in AsnycCalls

Destroying a mutex which might still be owned leads to undefined behaviour.
It wasn't the case here but using the right order is more resistant to future bugs.

* proxy AsnycCalls: don't leave map in unspecified state

* fix 133: use thread-safe container for proxy interfaces list

* proxy callback payload uses concrete signalData

* proxy: revert adding the wrapper class InterfaceContainer

It's no longer required and simplifies the locking logic.

* Proxy: avoid additional lambda wrapper around signal callbacks

As proposed in
https://github.com/Kistler-Group/sdbus-cpp/pull/177#issuecomment-834439707
option 3.

Still TODO: Avoid relying on std::map's non-invalidatable by adding just
std::unique_ptr<Proxy::InterfaceData::SignalData> to the container.

* proxy: add missing underscore prefix

* proxy: put InterfaceData::SignalData into a unique_ptr

This ways, we avoid relying on std::map's non-invalidatable references.

* proxy: code style: get raw pointer directly

* style: fix code style

Co-authored-by: Stanislav Angelovic <stanislav.angelovic@siemens.com>
2021-06-03 18:53:38 +02:00
Marek Blaha 118faa58f6 Add API to get message path and message destination (#167)
* Add API to get message path

* Add API to get message destination

* Handle NULL message fields interface and member

Functions sd_bus_message_get_interface() and sd_bus_message_get_member()
can return null in case the message does not use those fields or does
not have them set.
2021-05-07 15:24:21 +02:00
David Leeds d65744b1fc Enable default construction of PendingAsyncCall (#180)
This is helpful in use cases where a user defined class wants to
store a PendingAsyncCall as a member variable, or in a STL
container.
2021-05-07 15:22:07 +02:00
David Leeds 6df67469ad proxy: add IProxy::getConnection() (#179)
This provides access to the proxy's bus connection so code using
the proxy does not need to store an external reference to it.

A matching function is already available in IObject.
2021-05-06 16:52:02 +02:00
Stanislav Angelovic b0a72cbe92 Make Message's setDestination() thread safe 2021-04-29 15:30:56 +00:00