a970d836 | 08-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
test: unpack_properties: add constructor hint
scan-build-14 with GCC-12 seems to be failing with the following warning: ``` ../../../test/unpack_properties.cpp:34:23: error: no matching member funct
test: unpack_properties: add constructor hint
scan-build-14 with GCC-12 seems to be failing with the following warning: ``` ../../../test/unpack_properties.cpp:34:23: error: no matching member function for call to 'emplace' error.emplace(reason, property); ```
Add a constructor to provide a hint and make scan-build happier.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ie5fa169a9c86e8c221adb5407efb6bef5681c9e0
show more ...
|
9cde21ff | 29-Aug-2022 |
Patrick Williams <patrick@stwcx.xyz> |
message: add unpack method
Add an unpack method that allows reading from the message as r-values. This simplifies the pattern:
``` foo f{}; bar b{}; msg.read(f,b);
// Can now be w
message: add unpack method
Add an unpack method that allows reading from the message as r-values. This simplifies the pattern:
``` foo f{}; bar b{}; msg.read(f,b);
// Can now be written as...
auto [f, b] = msg.unpack<foo, bar>(); ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ic2ae7f2c52d41702b8c7c3af6a2efb21558a7579
show more ...
|
f289c65f | 26-Aug-2022 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: update with latest
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I461b17ee197528f125239f3cb8678dca45eaa634 |
c8447d52 | 05-Jan-2022 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
added support for optionals in unpackProperties
- Added support for optionals - Added support for pointers - Removed support for moving data from input container - Removed support for container type
added support for optionals in unpackProperties
- Added support for optionals - Added support for pointers - Removed support for moving data from input container - Removed support for container types other than std::vector
Tested: - Unit tests are passing - Examples which use unpackProperties are working correctly
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I3dbd7333237a1373d784187951ad6abe217567d1
show more ...
|
b7329a90 | 28-Apr-2022 |
Patrick Williams <patrick@stwcx.xyz> |
message: append: support span
Change how we detect the ability to iterate over a type so that it supports additional types, such as span. Add test case to cover span. Add some static_asserts in th
message: append: support span
Change how we detect the ability to iterate over a type so that it supports additional types, such as span. Add test case to cover span. Add some static_asserts in the test cases to ensure we are triggering the correct add_multiple/add_single paths for a few assorted types.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I42ff496ab58af613940c9ceb979c71f468f125fc
show more ...
|
ba5460db | 30-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
server: object: default emit destruct signals
In the mailing list discussion [1] it was observed that there were cases where daemons like `phosphor-logging` do not end up emitting InterfacesRemoved
server: object: default emit destruct signals
In the mailing list discussion [1] it was observed that there were cases where daemons like `phosphor-logging` do not end up emitting InterfacesRemoved signals even when the holding sdbusplus::object_t was destructed.
After investigation, we determined that there are valid use cases for not calling `object->emit_added()` but still wanting the removal signals to be emitted. Specifically, the case of a daemon creating initial object prior to claiming a bus-name it is good to omit the emission.
I examined all cases where callers were using `action::defer_emit` and it was acceptable for all of them to later send the InterfacesRemoved signals on destruction. To enable the old behavior, if desired, I added a new enumeration which is `action::emit_no_signals`.
1. https://lore.kernel.org/openbmc/CAGm54UHMED4Np0MThLfp4H-i8R24o8pCns2-6MEzy1Me-9XJmA@mail.gmail.com/
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I70bd5d5f2ecc676bdc9475e8a2a27e02c52d9142
show more ...
|
9f11c979 | 14-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
format: copy configs from phosphor-dbus-interfaces and reformat
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Id9959785a8f68e95409f643bd5ec4f76591bc885 |
e944507f | 12-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
yaml: format with prettier
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I318c75f7b425e291097ddc2b9ea3f3ceda81b3a7 |
5770f51a | 10-Jan-2022 |
Paul Fertser <fercerpav@gmail.com> |
utility: add merge_variants_t
This type is useful for processing D-Bus messages containing information for multiple interfaces. For doing sdbusplus::message::message::read() on them one needs to def
utility: add merge_variants_t
This type is useful for processing D-Bus messages containing information for multiple interfaces. For doing sdbusplus::message::message::read() on them one needs to define an std::variant which would be a combination of all the PropertiesVariant's involved.
Signed-off-by: Paul Fertser <fercerpav@gmail.com> Change-Id: Idcb7b9841cc0253f2f7d5552dae540fba5ad488d
show more ...
|
4a46eb5a | 23-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
object: handle diamond inheritance
Commit 664922157bbbd14f0ad1692cee5547f60f6c617c added an inheritance to `server::object` to gain access to the bus-pointer. This was observed to cause a compile f
object: handle diamond inheritance
Commit 664922157bbbd14f0ad1692cee5547f60f6c617c added an inheritance to `server::object` to gain access to the bus-pointer. This was observed to cause a compile failure in some applications which had a diamond-inheritance structure due to a nested `object` inheritance:
`object<object<iface0, iface1>, object<iface2, iface3>>`
These clients probably should not have attempted a nested/diamond because the previous implementation would have resulted in a silent failure to make `action::emit_interface_added` work properly (since object itself doesn't have an `emit_added` function).
Improve the `object` so that: - Diamond inheritance is no longer possible with nested inherits. - The `action::emit_interface_added` action works properly with nested inherits.
This required adding some template specialization to determine if one of the type arguments to `object` were nested (ie. `object<Args0..., object<Args1...>, Args2...>`) and collapse out the nested `object` inheritance (so that the example acts exactly the same as `object<Args0..., Args1..., Args2...>`).
Tested: Enhance the existing `object::emit` test cases to operate on a nested `object` structure.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I10635a256aafbdc1e42439a49fa61127e06c8e36
show more ...
|
a735ca5c | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
vtable: shorten vtable type
Create an alias `sdbusplus::vtable_t` to `sdbusplus::vtable::vtable_t` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0c3a8e40827
vtable: shorten vtable type
Create an alias `sdbusplus::vtable_t` to `sdbusplus::vtable::vtable_t` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0c3a8e40827cb011a07d75c99550a371afdefc64
show more ...
|
ba33c2a2 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
manager,interface: use shortened types
Use the shortened alias types whenever possible for `manager` and `interface`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib0f10bd0912f366
manager,interface: use shortened types
Use the shortened alias types whenever possible for `manager` and `interface`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib0f10bd0912f3668dcb3fce660a95facdf02c23b
show more ...
|
0f282c48 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
bus: shorten bus type
Create an alias `sdbusplus::bus_t` to `sdbusplus::bus::bus` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9f17892eed5112d4946949861488
bus: shorten bus type
Create an alias `sdbusplus::bus_t` to `sdbusplus::bus::bus` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9f17892eed5112d49469498614884c02bba86011
show more ...
|
10d7aa12 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
message: shorten message type
Create an alias `sdbusplus::message_t` to `sdbusplus::message::message` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib400b12f
message: shorten message type
Create an alias `sdbusplus::message_t` to `sdbusplus::message::message` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib400b12fe4a412c0c0c3d26a88f3fae46445cfa8
show more ...
|
6d83cf53 | 19-Oct-2021 |
Szymon Dompke <szymon.dompke@intel.com> |
Add non-throwing version of unpackProperties
Some projects (e.g., bmcweb) don't use functions which throw exceptions. This change introduces unpackPropertiesNoThrow() function, which returns optiona
Add non-throwing version of unpackProperties
Some projects (e.g., bmcweb) don't use functions which throw exceptions. This change introduces unpackPropertiesNoThrow() function, which returns optional string. In case of mismatched type or missing property, it will contain its name. In case of no errors, std::nullopt will be returned.
As a side change, message returned by UnpackPropertyError::what() now also includes propertyName and reason.
Testing done: - Added unit tests for unpackPropertiesNoThrow(). - unpackProperties() functionality remained the same.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> Change-Id: I61318bb906de7d5a252414c1d3ea25322874e23e Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
a22dbf40 | 16-Jul-2021 |
Patrick Williams <patrick@stwcx.xyz> |
message: correctly unpack variants of enums
When a variant contains multiple types which can be converted from a string (such as two enums, or an enum and string), the previous code tried a conversi
message: correctly unpack variants of enums
When a variant contains multiple types which can be converted from a string (such as two enums, or an enum and string), the previous code tried a conversion from the first type in the variant. When the first type was an enum, this often threw an exception. When the first type was a string, this turned into a plain string containing the dbus enum value.
Add special cases to the variant unpacking to detect types which are convertible from strings and delegate to a template specialization of 'convert_from_string' which handles variants. This specialization will attempt all conversions first and then revert to a string as a fallback.
Fixes openbmc/sdbusplus#52.
Change-Id: Ide5a0030d595fbaf01122fa8a0ecdaa19ad0078c Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
87b6a8d3 | 15-Jul-2021 |
Patrick Williams <patrick@stwcx.xyz> |
message: template to check if convert_from_string exists
Add a SFINAE template to determine if convert_from_string exists for a type.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id:
message: template to check if convert_from_string exists
Add a SFINAE template to determine if convert_from_string exists for a type.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5202dacd50734e06a02955ed613e124d8fe0127f
show more ...
|
ea56ec3c | 14-Jul-2021 |
Patrick Williams <patrick@stwcx.xyz> |
test: add tests for enum parsing
Add test cases to cover the parsing of enums from generated bindings, including two DISABLED test cases to show the issues reported in openbmc/sdbusplus#52.
Signed-
test: add tests for enum parsing
Add test cases to cover the parsing of enums from generated bindings, including two DISABLED test cases to show the issues reported in openbmc/sdbusplus#52.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5a01529404c38ae6c30aadbdc7d8e20f3ccbcaab
show more ...
|
64f01226 | 14-Jul-2021 |
Patrick Williams <patrick@stwcx.xyz> |
use C++17 std::foo_v templates
Use the C++17 style `foo_v` template aliases rather than the older `foo<...>::value` style.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8510f94ead
use C++17 std::foo_v templates
Use the C++17 style `foo_v` template aliases rather than the older `foo<...>::value` style.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8510f94ead11142a71d5b1e17c64fdd53a74d741
show more ...
|
34cf6932 | 14-Jul-2021 |
Patrick Williams <patrick@stwcx.xyz> |
utility: dedup_variant: rename in C++14 '_t' style
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I10590aca0d68fe50caf0f36819fea2d73016370f |
8db46a0f | 05-May-2021 |
William A. Kennington III <wak@google.com> |
native_types: string_path_wrapper: Don't escape all strings
Not all strings require escaping when appending them to a path. This allows us to now append `openbmc_project` to `/xyz` and have expected
native_types: string_path_wrapper: Don't escape all strings
Not all strings require escaping when appending them to a path. This allows us to now append `openbmc_project` to `/xyz` and have expected behavior.
Change-Id: I49a2ee100455cff4067dcf3df61f3e145231eeba Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
285f78b1 | 01-May-2021 |
William A. Kennington III <wak@google.com> |
native_types: Reduce append allocation
This builds the string from left to right, instead of dealing with string inserts, optimizing for allocations. Uses our own hex encoder instead of relying on s
native_types: Reduce append allocation
This builds the string from left to right, instead of dealing with string inserts, optimizing for allocations. Uses our own hex encoder instead of relying on systemd libraries. This maintains explicit compatability with the systemd encoding scheme.
Change-Id: Ia6c2f4fb19984f549c6bac2d67d0b5d610022038 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
e39b3dcb | 05-May-2021 |
William A. Kennington III <wak@google.com> |
test/message/types: Convert ASSERTs to EXPECTs
None of the comparisons made in this test prevent the continuation of the test. This makes it easier to debug changes since all errors will now be repo
test/message/types: Convert ASSERTs to EXPECTs
None of the comparisons made in this test prevent the continuation of the test. This makes it easier to debug changes since all errors will now be reported instead of early termination.
Change-Id: Ifd849f5a7585ff13cb314980a1128e0f126723b6 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
472b7022 | 15-Apr-2021 |
William A. Kennington III <wak@google.com> |
message: Add call_async method
This makes it possible to perform an async method call that is agnostic to the event loop running the sd_bus state machine.
Change-Id: I32bc0fdf89c44cc6bab1c4622b143d
message: Add call_async method
This makes it possible to perform an async method call that is agnostic to the event loop running the sd_bus state machine.
Change-Id: I32bc0fdf89c44cc6bab1c4622b143d6e06098659 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
d06072e7 | 21-Apr-2021 |
Ed Tanous <edtanous@google.com> |
Fix #60 by adding encoding/decoding rules
This commit attempts to make encoding more compatible with things within openbmc that don't encode paths per the systemd method. It does this by forcing th
Fix #60 by adding encoding/decoding rules
This commit attempts to make encoding more compatible with things within openbmc that don't encode paths per the systemd method. It does this by forcing the first character of every path segment to be encoded, so /abc would be encoded as /_61bc. This is then used as a mechanism to determine if the path needs to be decoded per systemds rules.
The decode mechanisms are also modified to check whether the first element is encoded before decoding the portion.
Looking for input on whether this is an OK path. The hope would be that we slowly transition the system over to using the encoding mechanisms that can handle all ascii characters, and can round trip through encode/decode without loss. The hope is that this patch can be reversed at some point in the future.
As an aside, I tried reverting some of the patches, but they're somewhat ungainly to revert at this point, and would require reverting some bmcweb patches, which, if this patch is determined to be bad, I'm happy to do, but I'm hoping this will get us something in the interim
Tested: unit tests added and updated to cover some of the cases. Unit tests pass.
Change-Id: Ie9c8cd0627b8b086e8b0bb2287f28dd86eb98ee9 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|