History log of /openbmc/sdbusplus/ (Results 151 – 175 of 836)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
9bf2b23f12-May-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: handle error includes in Python code

Simplify the mako templates by moving code that calculates the
includes for error interfaces into Python. As a side-effect, this
moves the includes fro

sdbus++: handle error includes in Python code

Simplify the mako templates by moving code that calculates the
includes for error interfaces into Python. As a side-effect, this
moves the includes from the `{server,client}.cpp` to hpp.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If2233e8615069a5c7630402c0cbee5d4f638f9d4

show more ...

fdfd3af111-May-2023 Patrick Williams <patrick@stwcx.xyz>

asio: connection: fix clang-tidy warning

With clang-16, numerous users of asio::connection are failing
clang-tidy with something like:

```
/usr/local/include/boost/asio/detail/impl/io_uring_descrip

asio: connection: fix clang-tidy warning

With clang-16, numerous users of asio::connection are failing
clang-tidy with something like:

```
/usr/local/include/boost/asio/detail/impl/io_uring_descriptor_service.ipp:109:3: error: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
io_uring_service_.register_io_object(impl.io_object_data_);
/usr/local/include/boost/asio/detail/impl/io_uring_descriptor_service.ipp:109:3: note: Called C++ object pointer is null
io_uring_service_.register_io_object(impl.io_object_data_);
```

I have looked through the Boost code and cannot figure out any path
where the object really is null and since we use this code everywhere
I highly suspect it is not. In any case, by using an alternative
constructor we seem to have appeased clang-tidy. Switch to the
socket constructor which takes an executor instead of a context.

Tested: Ran `ninja clang-tidy` in openbmc/estoraged with this change in
a subproject.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I58295b5515acc46b7879001ce3ae8145f00d9726

show more ...

3e20fa8b10-May-2023 Patrick Williams <patrick@stwcx.xyz>

stdexec: update to latest commit

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iab95a1aed6e33663e918a382d6f43eb34028c5a5

d214904410-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I5daa012bf76924eb7a7d22ed31b6b77ad2f723df
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

5bc767aa09-May-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: async: client: handle readonly flags for properties

When a property is marked 'const' or 'readonly' in an interface,
if we were to make a call to write the property we would end up
getting

sdbus++: async: client: handle readonly flags for properties

When a property is marked 'const' or 'readonly' in an interface,
if we were to make a call to write the property we would end up
getting a dbus error. Be explicit by not generating the write
function, just like we do in the server interfaces.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iecbc7b9ee3542c1972437a11a9a77c054b758cef

show more ...

9949a16908-May-2023 Patrick Williams <patrick@stwcx.xyz>

async: scope: forward exception correctly

There were test cases to cover an unhandled exception thrown by a
spawned task in the async::context, but I observed some cases where
this exception was sil

async: scope: forward exception correctly

There were test cases to cover an unhandled exception thrown by a
spawned task in the async::context, but I observed some cases where
this exception was silently dropped. The test cases only covered
spawned Senders and not spawned Coroutines. The underlying cause
of this was that in some cases the exception was deleted prior to
it being forwarded along to the async::context's scope.

When a task completes in the async::scope, the operational state
holding the task has to be deleted. There needs to be a careful
handshake to be able to trigger the scope while at the same time
deleting the object which is being executed (the scope_receiver),
so that there is not a memory leak. As part of this, if the task
completed with an unhandled exception, the complete function is
suppose to forward the exception to the scope. It is quite likely
that the exception is actually held by the operational state of the
task, which is going to be deleted prior to triggering the scope, so
we need to save this exception prior to the deletion.

Add a specific test case to cover the throwing coroutine, which
failed prior to this fix.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I7e24529a724c3338b6e155ba0a9b4220e1d2fa50

show more ...

90f8d9b413-Mar-2023 Hannu Lounento <hannu.lounento@vaisala.com>

Allow propagating exceptions from server methods

sdbusplus calls the D-Bus method implementation functions in such a way
that the callstack contains sd_bus C functions from libsystemd, and
sdbusplus

Allow propagating exceptions from server methods

sdbusplus calls the D-Bus method implementation functions in such a way
that the callstack contains sd_bus C functions from libsystemd, and
sdbusplus only catches the specific exceptions that match the errors
defined for the D-Bus method before returning execution to the C
functions. If any D-Bus method implementation propagates any other
exception than the errors the method declares, the C functions in the
callstack may leak resources.

There isn't any documentation or other statement that would prohibit
exceptions from being thrown / propagated from method implementations.
This seems to be a known issue though [1]:

By throwing an exception, you're not making an error return to the
calling client, but instead blowing through all of the `sd_bus` C
code with your C++ exception and putting your application into an
invalid state. At a minimum you are leaking memory.

Thus, catch any exceptions propagated from method implementations and
re-throw them from sdbusplus::bus::bus::process*().

Catching and re-throwing avoids resource leaks from sd_bus C functions.
And as a consequence it would allow propagating exceptions in the normal
way until the caller that is prepared to handle them -- ultimately even
up to main(). Propagating exceptions to `main()` allows for terminating
the process in a controlled fashion in case unexpected failures, which,
in turn, allows for a chance to recover from potential failures modes
that persist until application restart (e.g. due to some invalid state
stored in RAM).

Also, terminating the application, in which case the D-Bus daemon
returns the standard error org.freedesktop.DBus.Error.NoReply to the
client, avoids the need to declare an error for internal failures in the
D-Bus API. Internal errors in API add little value over
org.freedesktop.DBus.Error.NoReply and bloat the API as clients many
times can't handle them in any better way than
org.freedesktop.DBus.Error.NoReply.

Only std::exceptions are catched (i.e. not `catch (...)`) and propagated
to keep the implementation simple. The assumption is that only
exceptions (i.e. classes derived from std::exception) are used for
reporting errors.

Tested: With the calculator example changed to throw an unexpected exception:

From 914e045d1f92a1730d32f84ac7a74cd867c76760 Mon Sep 17 00:00:00 2001
From: Hannu Lounento <hannu.lounento@vaisala.com>
Date: Mon, 13 Mar 2023 15:53:17 +0200
Subject: [PATCH] [dbg] Add a propagating exception to the calculator example

Not to be merged to sdbusplus master but only for RFC / demonstration
purposes.

Can be triggered by commands like

busctl --user call net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator Clear
busctl --user get-property net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator LastResult
busctl --user set-property net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator LastResult x 1

Change-Id: Ie9f47227afe7e0fa9765c602bec987aea71b9b86
Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>
---
example/calculator-server.cpp | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/example/calculator-server.cpp b/example/calculator-server.cpp
index aa60662..eba9cc0 100644
--- a/example/calculator-server.cpp
+++ b/example/calculator-server.cpp
@@ -3,6 +3,7 @@
#include <net/poettering/Calculator/server.hpp>
#include <sdbusplus/server.hpp>

+#include <cstdlib>
#include <iostream>
#include <string_view>

@@ -42,10 +43,22 @@ struct Calculator : Calculator_inherit
/** Clear lastResult, broadcast 'Cleared' signal */
void clear() override
{
- auto v = lastResult();
- lastResult(0);
- cleared(v);
- return;
+ throw std::runtime_error{"A propagating exception"};
+ }
+
+ int64_t lastResult() const override
+ {
+ throw std::runtime_error{"A propagating exception"};
+ }
+
+ int64_t lastResult(int64_t /*value*/, bool /*skipSignal*/) override
+ {
+ throw std::runtime_error{"A propagating exception"};
+ }
+
+ int64_t lastResult(int64_t /*value*/) override
+ {
+ throw std::runtime_error{"A propagating exception"};
}
};

@@ -71,5 +84,13 @@ int main()
Calculator c1{b, path};

// Handle dbus processing forever.
- b.process_loop();
+ try
+ {
+ b.process_loop();
+ }
+ catch (const std::exception& e)
+ {
+ std::cerr << "Terminating due to a fatal condition: " << e.what() << std::endl;
+ return EXIT_FAILURE;
+ }
}
--
2.40.0

1) Built and executed unit tests:

sdbusplus$ rm -rf build/ && CXXFLAGS=-Wno-maybe-uninitialized meson setup build && cd build && ninja && ninja test
The Meson build system
Version: 0.62.2
Source dir: /path/to/sdbusplus
Build dir: /path/to/sdbusplus/build
Build type: native build
Project name: sdbusplus
Project version: 1.0.0
C compiler for the host machine: ccache cc (gcc 12.2.1 "cc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)")
C linker for the host machine: cc ld.bfd 2.37-37
C++ compiler for the host machine: ccache c++ (gcc 12.2.1 "c++ (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)")
C++ linker for the host machine: c++ ld.bfd 2.37-37
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Run-time dependency libsystemd found: YES 250
Program python3 (inflection, yaml, mako) found: YES (/usr/bin/python3) modules: inflection, yaml, mako
Run-time dependency Boost found: YES 1.76.0 (/usr)
Program sdbus++ found: YES (/path/to/sdbusplus/tools/sdbus++)
Program sdbus++ found: YES (overridden)
Program sdbus++-gen-meson found: YES (/path/to/sdbusplus/tools/sdbus++-gen-meson)
Program sdbus++-gen-meson found: YES (overridden)
Header <boost/asio.hpp> has symbol "boost::asio::io_context" : YES
Run-time dependency Boost (found: context, coroutine) found: YES 1.76.0 (/usr)
Run-time dependency GTest found: YES 1.11.0
Run-time dependency GMock found: YES 1.11.0
Build targets in project: 34

Found ninja-1.10.2 at /usr/bin/ninja
[77/77] Linking target example/calculator-client
[0/1] Running all tests.
1/21 test_async_task OK 0.03s
2/21 test_bus_list_names OK 0.02s
3/21 test_bus_match OK 0.02s
4/21 test_bus_exception OK 0.02s
5/21 test_exception_sdbus_error OK 0.02s
6/21 test_message_append OK 0.01s
7/21 test_message_native_types OK 0.01s
8/21 test_message_read OK 0.03s
9/21 test_message_types OK 0.02s
10/21 test_unpack_properties OK 0.02s
11/21 test_utility_tuple_to_array OK 0.02s
12/21 test_utility_type_traits OK 0.01s
13/21 test-bus_aio OK 0.01s
14/21 test-vtable OK 0.01s
15/21 test-server OK 0.01s
16/21 test-server-message-variant OK 0.01s
17/21 test_message_call OK 0.07s
18/21 test_event_event OK 0.31s
19/21 test_async_timer OK 0.51s
20/21 test_async_context OK 0.52s
21/21 test_timer OK 18.02s

Ok: 21
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0

[...]

-Wno-maybe-uninitialized was used because the current master
384943be7e81b08ed102abfaa3f2be2ad915e800 ("sdbus++: async: client: fix
client_t usage") failed to build with

In file included from /usr/include/gtest/internal/gtest-death-test-internal.h:39,
from /usr/include/gtest/gtest-death-test.h:41,
from /usr/include/gtest/gtest.h:64,
from /usr/include/gmock/internal/gmock-internal-utils.h:47,
from /usr/include/gmock/gmock-actions.h:145,
from /usr/include/gmock/gmock.h:59,
from ../include/sdbusplus/test/sdbus_mock.hpp:6,
from ../test/exception/sdbus_error.cpp:4:
In copy constructor ‘testing::internal::MatcherBase<T>::MatcherBase(const testing::internal::MatcherBase<T>&) [with T = sd_bus_error*]’,
inlined from ‘testing::Matcher<sd_bus_error*>::Matcher(const testing::Matcher<sd_bus_error*>&)’ at /usr/include/gtest/gtest-matchers.h:479:7,
inlined from ‘testing::internal::MockSpec<int(sd_bus_error*, int)> sdbusplus::SdBusMock::gmock_sd_bus_error_set_errno(const testing::Matcher<sd_bus_error*>&, const testing::Matcher<int>&)’ at ../include/sdbusplus/test/sdbus_mock.hpp:51:5,
inlined from ‘virtual void {anonymous}::SdBusError_NotSetErrno_Test::TestBody()’ at ../test/exception/sdbus_error.cpp:59:5:
/usr/include/gtest/gtest-matchers.h:302:33: error: ‘<unnamed>.testing::Matcher<sd_bus_error*>::<unnamed>.testing::internal::MatcherBase<sd_bus_error*>::buffer_’ may be used uninitialized [-Werror=maybe-uninitialized]
302 | : vtable_(other.vtable_), buffer_(other.buffer_) {
| ^~~~~~~~~~~~~~~~~~~~~~

on Fedora 36 with

$ gcc --version
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)

and

$ dnf info gtest-devel
[...]
Name : gtest-devel
Version : 1.11.0
Release : 2.fc36
Architecture : x86_64

2) Verified no memory leaks were reported by Valgrind anymore:

sdbusplus/build$ valgrind --leak-check=full --show-leak-kinds=all ./example/calculator-server
==61886== Memcheck, a memory error detector
==61886== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==61886== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==61886== Command: ./example/calculator-server
==61886==

and called the throwing method:

build$ busctl --user call net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator Clear
Call failed: Remote peer disconnected

and verified the process terminates but produces no memory leaks:

Terminating due to a fatal condition: A propagating exception
==61886==
==61886== HEAP SUMMARY:
==61886== in use at exit: 0 bytes in 0 blocks
==61886== total heap usage: 143 allocs, 143 frees, 96,732 bytes allocated
==61886==
==61886== All heap blocks were freed -- no leaks are possible
==61886==
==61886== For lists of detected and suppressed errors, rerun with: -s
==61886== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Similarly reading the `LastResult` property:

build$ valgrind --leak-check=full --show-leak-kinds=all ./example/calculator-server
==36140== Memcheck, a memory error detector
==36140== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==36140== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==36140== Command: ./example/calculator-server
==36140==

build$ busctl --user get-property net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator LastResult
Failed to get property LastResult on interface net.poettering.Calculator: Remote peer disconnected

Terminating due to a fatal condition: A propagating exception
==36140==
==36140== HEAP SUMMARY:
==36140== in use at exit: 0 bytes in 0 blocks
==36140== total heap usage: 148 allocs, 148 frees, 96,992 bytes allocated
==36140==
==36140== All heap blocks were freed -- no leaks are possible
==36140==
==36140== For lists of detected and suppressed errors, rerun with: -s
==36140== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

and writing the property:

==36383== Memcheck, a memory error detector
==36383== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==36383== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==36383== Command: ./example/calculator-server
==36383==

build$ busctl --user set-property net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator LastResult x 1

Terminating due to a fatal condition: A propagating exception
==36383==
==36383== HEAP SUMMARY:
==36383== in use at exit: 0 bytes in 0 blocks
==36383== total heap usage: 146 allocs, 146 frees, 97,010 bytes allocated
==36383==
==36383== All heap blocks were freed -- no leaks are possible
==36383==
==36383== For lists of detected and suppressed errors, rerun with: -s
==36383== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

[1] https://lore.kernel.org/openbmc/YTDvfIn4Z05mGdCx@heinlein/

Change-Id: I014099a91f526a92c0f6646e75b4029513ad19a8
Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>

show more ...

27877eb909-May-2023 Hannu Lounento <hannu.lounento@vaisala.com>

Replace interface member with bus

Going forward a bus_t instance will be needed and as the interface
instance is accessible through bus_t, remove the interface member.

Tested: Executed the unit tes

Replace interface member with bus

Going forward a bus_t instance will be needed and as the interface
instance is accessible through bus_t, remove the interface member.

Tested: Executed the unit tests

sdbusplus/build$ ninja test
[0/1] Running all tests.
1/20 test_async_task OK 0.03s
2/20 test_bus_list_names OK 0.03s
3/20 test_bus_match OK 0.02s
4/20 test_exception_sdbus_error OK 0.02s
5/20 test_message_append OK 0.02s
6/20 test_message_native_types OK 0.01s
7/20 test_message_read OK 0.03s
8/20 test_message_types OK 0.02s
9/20 test_unpack_properties OK 0.02s
10/20 test_utility_tuple_to_array OK 0.02s
11/20 test_utility_type_traits OK 0.02s
12/20 test-bus_aio OK 0.02s
13/20 test-vtable OK 0.01s
14/20 test-server OK 0.01s
15/20 test-server-message-variant OK 0.01s
16/20 test_message_call OK 0.09s
17/20 test_event_event OK 0.31s
18/20 test_async_timer OK 0.51s
19/20 test_async_context OK 0.52s
20/20 test_timer OK 18.02s

Ok: 20
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0

[...]

Change-Id: If10fdf03885feb233e77259d477d17417218aa2d
Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>

show more ...

384943be05-May-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: async: client: fix client_t usage

When using the "Alternatively,..." syntax from calculator-client, we
end up with the compiler error:

```
example/gen/net/poettering/Calculator/client.hpp:

sdbus++: async: client: fix client_t usage

When using the "Alternatively,..." syntax from calculator-client, we
end up with the compiler error:

```
example/gen/net/poettering/Calculator/client.hpp:149:40: error: ‘constexpr sdbusplus::client::net::poettering::details::Calculator<Proxy>::Calculator(sdbusplus::async::context&, Proxy) [with Proxy = sdbusplus::async::proxy_ns::proxy<true, true, false, false>]’ is private within this context
149 | std::forward<Args>(args)...)
```

Fix this by making the generated alias class a friend of the details
class, in addition to the client_t proxy. Add a compile test to ensure
this works. Fix up a few whitespace alignment to better match
clang-format expectations.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie0def6e6c96acc287c002c157d93016b4a79015c

show more ...

13c19dda04-May-2023 Jonathan Doman <jonathan.doman@intel.com>

asio: Emit PropertiesChanged signal

Earlier refactoring accidentally commented out the PropertiesChanged
signal in the set_handler callback. Add it back.

Change-Id: If64e2f5545078fb67b325e677b0a411

asio: Emit PropertiesChanged signal

Earlier refactoring accidentally commented out the PropertiesChanged
signal in the set_handler callback. Add it back.

Change-Id: If64e2f5545078fb67b325e677b0a411bcf8b8659
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>

show more ...

1fc197e603-May-2023 Patrick Williams <patrick@stwcx.xyz>

server: object: reduce potential warnings

Some compilers and linters are not handling C++20 requirements
similarly and one, rightly, complains when the object class is
used that:

object.hpp:198

server: object: reduce potential warnings

Some compilers and linters are not handling C++20 requirements
similarly and one, rightly, complains when the object class is
used that:

object.hpp:198:34: error: parameter type '...' is an abstract class

An abstract class cannot be a variable or function parameter, but a
reference to one can be. Switch the require statement to check a
`T&` instead of a `T` for the `emit_added` function calls.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iaad189c37c4962193cfa94cd777e385686e5a9da

show more ...

50f1daea26-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: async: client: example: add a few comments for clarity

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idf21e9652c005203a3f563b46605354e4711183d

65e4d30226-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: async: client: add generated property calls

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I25ad8c0c167af0a55e235e5a7b4a46a3019d94ae

ecfff5ce26-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: async: client: prettify the generated code

Make some minor whitespace changes to make the generated headers
look closer to what clang-format would generate.

Signed-off-by: Patrick Willia

sdbusplus: async: client: prettify the generated code

Make some minor whitespace changes to make the generated headers
look closer to what clang-format would generate.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ida6231d230101d570038c7e251ae34743a7949e5

show more ...

3cd1c34826-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: async: client: move context to constructor

The async::context is needed for every client invocation, since that
is how the async task is generated. Rather than pass it in as a
parameter on

sdbus++: async: client: move context to constructor

The async::context is needed for every client invocation, since that
is how the async task is generated. Rather than pass it in as a
parameter on each function invocation, add it as a constructor to the
client-proxy object.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic1c8ec2260b7d4774649de9559df466058a50e14

show more ...

0241d90626-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: async: client: add generated method calls

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I47cf5bc96b545dfe3f917655b5b94db8dac9c101

4a594c0125-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: add start of an async client

Add generator mako templates to generate a simple async client, a
corresponding implementation of the 'calculator' interface as a
client, and a client aggregati

sdbus++: add start of an async client

Add generator mako templates to generate a simple async client, a
corresponding implementation of the 'calculator' interface as a
client, and a client aggregation class (client_t) similar to the
server aggregation class we have (sdbusplus::server::object_t).

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6795b2d051bf4d759cb319a9388b23e29d140244

show more ...

af93b2db25-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: server: simplify header include templates

There are various callbacks within the mako templates for methods,
properties, and signals. This makes the mako template fairly difficult
to read

sdbus++: server: simplify header include templates

There are various callbacks within the mako templates for methods,
properties, and signals. This makes the mako template fairly difficult
to read (since there are big if-else trees for each callback type),
impossible to reuse, and poorer performing. Eliminate the
`callback-hpp-includes` type and move the code into Python directly.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id51f9a78bc57b718732172a3b6634f33740afd09

show more ...

1f3efd8725-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

async: proxy: use variant in property-set

The DBus.Properties.Set method doesn't take a raw type, but a variant
holding the type (just like Get returns a variant). Fix the function
call so that the

async: proxy: use variant in property-set

The DBus.Properties.Set method doesn't take a raw type, but a variant
holding the type (just like Get returns a variant). Fix the function
call so that the set value is wrapped in a variant.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3d33e0539c008dd66feeef0b866911768dae84e2

show more ...

b274c31325-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

async: proxy: fix property sub-proxy initialization

The proxy's Service and Path are either a string_view or string,
depending on the Preserved template parameter. If the constant
`dbus_prop_intf`

async: proxy: fix property sub-proxy initialization

The proxy's Service and Path are either a string_view or string,
depending on the Preserved template parameter. If the constant
`dbus_prop_intf` is a string_view but Preserved=True, there is no
implicit conversion from string_view to string, so the construction
of the sub-proxy fails. Use `auto` (as C-string) to allow
automatic implicit conversion to both string_view or string depending
on the Preserved value.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I88da5c224b379d32f1913d4de5464807b5415f5d

show more ...

62f4173320-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: move enum definitions to common header

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idaba9c5669025b113b701c7abeb28692e0393b78

b754c64a20-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: move interface name to common header

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I887b85d47e4e380426973f217bb94b1bec69f7aa

d0f578df17-Apr-2023 Arun Lal K M <arun.lal@intel.com>

Make register_method accept 'Flags'

Problem statement:
SD_BUS_METHOD() takes 'Flags' as one of it's arguments.
The flags parameter is used to specify a combination of D-Bus annotations.
Reference ht

Make register_method accept 'Flags'

Problem statement:
SD_BUS_METHOD() takes 'Flags' as one of it's arguments.
The flags parameter is used to specify a combination of D-Bus annotations.
Reference https://man7.org/linux/man-pages/man3/sd_bus_add_object.3.html

'register_method' function in file sdbusplus\include\sdbusplus\asio\object_server.hpp
makes the following call

method_callbacks_.emplace_back(name, std::move(func), argType.data(),
resultType.data());

This calls ends up in following function which calls SD_BUS_METHOD

constexpr vtable_t method(const char* member, const char* signature,
const char* result, sd_bus_message_handler_t handler,
decltype(vtable_t::flags) flags)
{
return vtable_t SD_BUS_METHOD(member, signature, result, handler, flags);
}

Problem is register_method does not take 'Flags' as one of it's arguments.
So SD_BUS_METHOD is called with flags = 0, default value.

Proposed solution:
Add 'Flags' as one of the arguments in register_method function.

Tested:
By passing flag SD_BUS_VTABLE_UNPRIVILEGED to register_method function
and making sure the property of flag is reflected in dbus.

Change-Id: I4845d3b7e3619c8b10bed9db0d92a90ec09578b4
Signed-off-by: Arun Lal K M <arun.lal@intel.com>

show more ...

1caa5e8a19-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

sdbus++: add common header file

There are some items generated under server and client which are
overlapping and some currently in server that will also be needed
for async bindings. Create a commo

sdbus++: add common header file

There are some items generated under server and client which are
overlapping and some currently in server that will also be needed
for async bindings. Create a common header file that they can
all include in order to reduce the content generated across all these
types.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id7af8542613503dbd745158c89892ca252eadf5a

show more ...

64bdf05718-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

server: object: reduce SFINAE

Use C++20 Concepts to reduce SFINAE in object.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I22be05b28a30cabafc10ca4f0c9eef124a20bc7f

12345678910>>...34