| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are many cases in which we want to have a mutable
capture so that the lambda takes over the parameter and
we can modify it after the async callback. By making the
top level lambda mutable, the users callback can be mutable.
Also remove a couple references to experimental and a copy
that I saw when I was fixing this issue.
Tested: Added test and made sure that refish which uses
many async_method_calls still worked fine
Change-Id: Ifb1f9d8b9217187799e2defe429e76a937297ca1
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The async_method_call() would throw despite the inferred promise that it
would not, because the handler would be passed an error_code object. But
that would only protect from the dbus method call itself. When it came
time to unpack the response, the read_into_tuple(...) method call would
throw if the received types did not match the expected types. And
because this throw would happen in a separate boost::asio context, the
throw would always be fatal. Now, any exception during the D-Bus call or
unpacking of parameters will result in an error_code getting passed into
the handler so it can take appropriate action.
This also updates the example to remove try/catch statements around the
async_method_call and yield_method_call examples and shows what happens
if the method calls fail because of different types of errors
(api/function does not exist vs. incorrect unpack types).
Tested-by: run asio-example to see that it works as expected:
# /tmp/asio-example
voidBar() -> 42
fooYield(yield, 41)...
async_send callback
error with async_send
ipmiInterface:execute(61)
async_method_call callback
/org/openbmc/control/bmc0
/org/openbmc/control/flash/bmc
fooYield(yield, 41)...
ipmi call returns OK!
foo(41) -> 42
async_method_call callback
async_method_call expected failure: generic:foo(41) -> 42
yielding call to foo OK! (-> 42)
22
async call to Properties.Get serialized via yield OK!
TestYieldFunction return 42
yielding call to foo OK! (-> 42)
yielding call to TestYieldFunction serialized via yield OK!
fooYield(yield, 41)...
foo(41) -> 42
async call to Properties.Get serialized via yield OK!
yielding call to foo OK! (-> 42)
TestYieldFunction expected error: generic:22
TestYieldFunctionNotExits expected error: generic:53
*** tick ***
*** tock ***
*** tick ***
*** tick ***
*** tick ***
Change-Id: I53c91484ed496556342b3ed0a58b690872a2d676
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
stuff
Change-Id: I48da27be7ba8c63f44c12a8b79fffb8f3e085648
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The yield_method_call() would throw despite the inferred promise that it
would not, because the caller could attach an error_code to the yield
object. But that would only protect from the dbus method call itself.
When it came time to unpack the response, the read(...) method call
would throw if the received types did not match the expected types. Now,
the method forces you to pass in an error_code and it will always return
the appropriate error instead of throw.
Tested-by: run asio-example to see that it works as expected:
# /tmp/asio-example
voidBar() -> 42
async_send callback
error with async_send
async_method_call callback
/org/openbmc/control/bmc0
/org/openbmc/control/flash/bmc
fooYield(yield, 41)...
ipmiInterface:execute(61)
ipmi call returns OK!
fooYield(yield, 41)...
foo(41) -> 42
async call to Properties.Get serialized via yield OK!
foo(41) -> 42
yielding call to foo OK! (-> 42)
TestYieldFunction return 42
yielding call to foo OK! (-> 42)
yielding call to TestYieldFunction serialized via yield OK!
async call to Properties.Get serialized via yield OK!
*** tick ***
*** tock ***
*** tick ***
*** tick ***
*** tick ***
*** tick ***
*** tick ***
Change-Id: Iea43acd432107b4149f8e549310cfce2518cbc1d
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we are using std::variant we should reference it directly
instead of using our own namespace alias.
Tested:
Built and ran through unit tests.
Change-Id: Ic3fd62ea74cf808b85ad7b7ffcce8c0a0bfb125d
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The intent of this commit is to allow building asio based event loops in
applications with BOOST_ASIO_NO_DEPRECATED flag set. This change is
largely a sed replace of io_service with io_context.
This will allow us to move to the networking TS at such time that it is
mature. Details on depreated interfaces are available here for
reference:
https://www.boost.org/doc/libs/1_69_0/doc/html/boost_asio/net_ts.html
Change-Id: Ie3cc699effcf855a649dee5bfce2f6616109429b
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After the below change in sdbusplus,
the variant usage needs to be switched to std::variant
https://github.com/openbmc/sdbusplus/commit/90778b430290c9ec8c33fb77b03e2552d9dd6905
Tested:
./configure --enable-boost
make
Change-Id: Ic1d156ad379eb56822f75e8046f83fa45f4ad56d
Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds new functions:
* new_default_user() -> return default user bus connection
* new_default_system() -> returns default system connection
And changes new_default() to return the default type of connection for
the user as per the man page:
https://www.freedesktop.org/software/systemd/man/sd_bus_default.html
Also, update the example and the README to use the default bus calls.
Change-Id: I13cd77dda847c4f6018da38e0019816da07710d1
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding the server-side of the coroutine path allows yielding
asynchronous method handling via coroutines. This means that a method
handler can call a yielding dbus call (or other asio-based asynchronous
call) without blocking the rest of the process.
The call path might look something like this:
service.thing/object/path/interface.my-method()
- do something
- yield_method_call(other.service, /other/path,
other.interface, other-method)
<yields to other coroutine>
execute other code in another context
<returns some time later with dbus call's response>
- use response from other method
<- return my-method response
This also changes the asio-example, pulling it apart into a
client/server model so it is more clear about how to use the yielding
async method handling and yielding async method calls.
Change-Id: I23ccf7a9a8dff787be78929959c1f018280a0392
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Few examples provided as a part of the repository are dependent on the
sdbus++ code generation tool, and the compilation will fail trying to
build the examples even in cases where the user disables sdbusapp during
configuration using --disable-sdbuspp option.
- Made a change in example/Makefile.am to build the examples which are
dependent on sdbus++ tool(which is dependent on few python packages)
only when the sdbuspp is enabled during configuration.
Resolves openbmc/sdbusplus#19
Change-Id: I1453536fd4c7df35e66f2ccfe7a890cced0d155d
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using a coroutine to asynchronously execute method calls gives the best
of both worlds:
1) better readability because the code reads like synchronous code
2) better throughput because it is actually asynchronous
When passed in a boost::asio::yield_context, the sdbusplus::asio dbus
connection members async_send and async_method_call will execute
asynchronously using coroutines.
This also adds an example of how this works in the
example/asio-example.cpp file.
Change-Id: Ifb71b2c757ecbfd16b3be95bdefc45a701ca0d51
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If requested, add in an asynchronous sd_event servicing mechanism so
sd_events can be used in conjunction with boost::asio events. Code
throughout the openbmc repositories use sd_events, especially for
timers. In some cases, we may want to add boost::asio event handling for
superior asynchronous eventing, but not want to rewrite all the existing
sd_event code. This gives us the best of both worlds, with a
low-overhead mechanism to handle the sd_events.
Change-Id: I3f8e2aafa3f733439e1494253698d17c2f3a2321
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Callbacks with no arguments failed to build due to an error in the
utility::get_first_arg template. It failed to provide a type member for
the void specialization. With this fix, it is possible to have a handler
that has no arguments.
Tested by: Added a new callback to the asio-example.cpp. Without the
template change, this caused the build to fail as expected.
After adding the template change, the build succeeds and the
example runs as expected.
Change-Id: Ib09b58c76df8cba57dc093ab37a4c1b68ea11ad3
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
| |
Added the header inclusion order to the .clang-format file generated
these changes.
Change-Id: Ia31b21d7ea451cac0309828006bc17c27cbd5bd5
Signed-off-by: Patrick Venture <venture@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In some cases, the callback may care where the message came from. Allow
the callback to receive the raw sdbusplus::message along with the
automatically extracted arguments.
This means that the registration mechanism as well as the callback
mechanism need to be aware of a 'message as a first parameter' situation
and behave accordingly. The registration needs to strip the message
parameter off in order to expose a correct DBus signature. The callback
mechanism needs to strip of the message parameter in order to properly
unpack the message, but add it back in before calling apply to execute
the function.
Tested: Added an example to example/asio-example.cpp and checked to see
that it builds. Was able to extract sender from message passed
into the IPMI handler.
Change-Id: I520e494d3baad34271e748465f30274353554728
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is already support for setting a property as const
(see vtable.hpp and corresponding test cases).
Implement this in the generated code by adding support
for a new yaml flag.
Closes openbmc/openbmc#2028
Tested: Added the const flag to the Software Priority property,
and changing the value via REST and busctl would fail with
"org.freedesktop.DBus.Error.PropertyReadOnly", but the code
update app was able to set its value.
Change-Id: I8534753233080366503fd4f1a0c224c2946e8764
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add properties server similar to boost-dbus that allows
for creating dbus interfaces during runtime. This adds
support for creating methods and get / set properties.
Get / set property callbacks are stored in flat_maps of
std::function allowing custom get / set functions. Methods
are also stored in this way allowing for creating of interfaces
without using any yaml. There is one C level callback for properties
get, properties set, and method calls that lookup the correct
std::function in the flat_map to call.
Tested: Ran asio-example on bmc, and updated fru-device.
Change-Id: I19881049f4307fe9c68f78df8854f14afdd6c362
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Add an async connection and example of usage. This
connection inherits the bus object and allows async
method calls using boost asio. Most of these concepts
are from boost-dbus.
Change-Id: I33b5349d543c9ff4b6ee1ce15346c709c052e1ae
Tested: Compiled and ran asio-example on bmc.
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add errors support for properties.
Closes openbmc/openbmc#1641
Tested: Verified that when an interface threw a defined property
error, the generated code caught it and returned an error to
the REST call.
Change-Id: I8cb8c77995026f12e373291822e4e0a623a84d81
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
|
|
|
|
|
|
|
|
|
| |
Spelling errors found using github.com/lucasdemarchi/codespell
A tool to fix common misspellings.
This tool is licensed under GNU General Public License, version 2.
Change-Id: I6dcf76a74487d04d4568d55d08d1b07f627e5e74
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
|
|
|
| |
Change-Id: If1d6b1f04514367cc544c2507a845b3e9d6d3435
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following problems existed:
* The sdbus++ output directory would not exist so invoke mkdir.
* The directory for the example schema is not in . but in $(srcdir),
so use -r directive to sdbus++ to set schema root accordingly.
* The mako template files generated into the build tree, so pass
sdbus++ the template path relative to $(top_builddir).
Change-Id: I76f70ed832c7cf0ce2a7b8a8ec21672ebcea9c02
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
|
|
|
|
|
|
| |
Create a small application which calls org.freedesktop.login1
to display a list of the active users.
Change-Id: I8d7879d98f6b89a9315aa0c71b928c50490dfedb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
|
|
|
|
|
|
|
| |
With example moved to the root directory and there being an explicit
makefile for the example calculator application, there is no need to
have sdbus++ default to 'example'.
Change-Id: I2a20883d7ea88b56e1bd073ef395c236215a4132
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
|
|
|
| |
Change-Id: Ie2ad4ff00208056c48c0d596053b20b82f1fb3a1
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
Change-Id: Icb6a6ca266181e9b401eec64dbbada8b7e334229
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|