History log of /openbmc/sdbusplus/include/ (Results 226 – 250 of 269)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
05a3504215-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

message: move enum-string conversion routines

Move enum conversion routines out of the 'details' namespace
so they are available for library users and consolidate them
in the 'native_types' header.

message: move enum-string conversion routines

Move enum conversion routines out of the 'details' namespace
so they are available for library users and consolidate them
in the 'native_types' header.

In order to support future work of template-specialization on
`variant` types, this also added a level of indirection in the
generated specializations for enums so that they are handled
through a struct-with-op pattern. (Functions cannot be partially
specialized and overloading the template with std::variant support
requires that).

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

show more ...

145892c914-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

message: read: move enum exception higher

In order to better handle trying the next enumeration when
parsing variants with multiple enum types, switch the usage
of string-to-enum to the one returnin

message: read: move enum exception higher

In order to better handle trying the next enumeration when
parsing variants with multiple enum types, switch the usage
of string-to-enum to the one returning a std::optional. This
requires adding the exception (for bad enum parsing) into the
higher level 'read_single' implementation for enums.

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

show more ...

d51e593914-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

message: define and use C++17 style _v aliases

Create C++17 `foo_v` style aliases and replace all usages of
template `foo<...>::value` with them.

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

message: define and use C++17 style _v aliases

Create C++17 `foo_v` style aliases and replace all usages of
template `foo<...>::value` with them.

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

show more ...

9245868114-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

utility: container_traits: define C++17 _v aliases

Define C++17 'foo_v' style aliases and replace usages of
'foo<...>::value' with them.

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

utility: container_traits: define C++17 _v aliases

Define C++17 'foo_v' style aliases and replace usages of
'foo<...>::value' with them.

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

show more ...

64f0122614-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 ...

b16ea98814-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

utility: type_traits: use C++14 '_t' style

Add a foo_t variant of all type templates and refactor
usages to use the foo_t variant instead of `foo<...>::type`.

Signed-off-by: Patrick Williams <patri

utility: type_traits: use C++14 '_t' style

Add a foo_t variant of all type templates and refactor
usages to use the foo_t variant instead of `foo<...>::type`.

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

show more ...

34cf693214-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

2b7da24914-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

message: use C++14 enable_if_t

Avoid the `enable_if<...>::type` and use the preferred C++14
`enable_if_t` short-hand.

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

message: use C++14 enable_if_t

Avoid the `enable_if<...>::type` and use the preferred C++14
`enable_if_t` short-hand.

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

show more ...

5a14953614-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

message: read: DRY the string specializations

The specializations for std::string, string_wrapper, and
string_path_wrapper are almost identical. Do some minor
refactoring and DRYing so that the sam

message: read: DRY the string specializations

The specializations for std::string, string_wrapper, and
string_path_wrapper are almost identical. Do some minor
refactoring and DRYing so that the same template specialization
can be used for all 3.

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

show more ...

1013c5ec13-Jul-2021 Patrick Williams <patrick@stwcx.xyz>

server: remove bindings.hpp

binding.hpp had an unused template definition that was used as
an overload for converting enums to strings. This function is
no longer used within the library nor genera

server: remove bindings.hpp

binding.hpp had an unused template definition that was used as
an overload for converting enums to strings. This function is
no longer used within the library nor generated bindings. Remove
it and clean up the documentation of the generated version of this
function for enums to match the actual namespace where they are
defined.

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

show more ...

285f78b101-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 ...

226bc42a05-May-2021 William A. Kennington III <wak@google.com>

native_types: Migrate large functions to shared lib

This speeds up compilation of changes and should save space in users of
the functions.

Change-Id: Iee9029800c11dcd4e94f165766836bae327ee9b5
Signe

native_types: Migrate large functions to shared lib

This speeds up compilation of changes and should save space in users of
the functions.

Change-Id: Iee9029800c11dcd4e94f165766836bae327ee9b5
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...

472b702215-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 ...

d06072e721-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 ...

f886012826-Apr-2021 Ed Tanous <edtanous@google.com>

Make object_path operator/ const

This is a minor change to make operator/ const. It likely should've
been const initially, but I didn't think of it, and I didn't have a
const example of an input in

Make object_path operator/ const

This is a minor change to make operator/ const. It likely should've
been const initially, but I didn't think of it, and I didn't have a
const example of an input initially.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ifb115a26cce6baa834752ceebdd81dc0d2e0cf14

show more ...

533218b420-Apr-2021 Patrick Williams <patrick@stwcx.xyz>

sdbuspp_support: correct return value from method callbacks

It was reported that even successful method calls were observed with
dbus-monitor to have an error string:

error_name=org.freedesktop

sdbuspp_support: correct return value from method callbacks

It was reported that even successful method calls were observed with
dbus-monitor to have an error string:

error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=2
string "Unknown method DeleteAll or interface
xyz.openbmc_project.Collection.DeleteAll."

Looking at the sd-bus code for this string, I noticed that there is a
for-loop that iterates through the vtable and continues looking for
additional vtable callbacks if a 0 is returned from a callback. At
the end of the loop, this string is added.

This behavior is also mentioned in the man page for vtable entries:

When a request is received, any associated callbacks are called
sequentially until a callback returns a non-zero integer. Return
zero from a callback to give other callbacks the chance to process
the request.

`method_callback` in sdbuspp_support/server.hpp was returning a 0 instead
of a positive integer indicating success. Modify the support callbacks
so that they all return a non-zero return to indicate non-delegation.

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

show more ...

c9978e3b19-Feb-2021 William A. Kennington III <wak@google.com>

message: Add call method

The message already knows what bus it belongs to from its construction.

Change-Id: I4fa38b2e4f6aa1dc537d8f7ce923e48e54d8ab7b
Signed-off-by: William A. Kennington III <wak@g

message: Add call method

The message already knows what bus it belongs to from its construction.

Change-Id: I4fa38b2e4f6aa1dc537d8f7ce923e48e54d8ab7b
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...

d8543d0908-Apr-2021 Jason Ling <jasonling@google.com>

native_types: add missing header file

sd_bus_path_encode is used so include systemd/sd-bus.h

Tested:
compiles

Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: Ia17492dc283bd4bee9b98ea64

native_types: add missing header file

sd_bus_path_encode is used so include systemd/sd-bus.h

Tested:
compiles

Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: Ia17492dc283bd4bee9b98ea648eb9983714c5d49

show more ...

74a2711807-Apr-2021 Ed Tanous <edtanous@google.com>

Implement operator /= for object_path

This probably should've been implemented as part of
fa0fa3b0fa5a9d59c37b6edbc53cc21b7c2a16b0 Implement path encoding and
decoding but alas, it was not. This co

Implement operator /= for object_path

This probably should've been implemented as part of
fa0fa3b0fa5a9d59c37b6edbc53cc21b7c2a16b0 Implement path encoding and
decoding but alas, it was not. This commit adds the relatively simple
operator/= overloads to object_path. This allows calling code to do
operations like:

object_path myPath("/foo");
myPath /= "bar";

Which would result in the object path /foo/bar.

In the implementation, this actually just calls into operator/, and does
a relatively naive replace of the content in the new object. Given how
the sd_bus_path_encode API is organized, there doesn't appear to be a
way to call into it and "append" to an existing thing, so constructing a
new string and assigning it to the current object was the best I could
come up with in terms of efficiency.

This includes overloads for both const char* and const std::string&,
both of which have essentially the same behavior.

Tested:
New unit tests included in commit, and pass.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Idfb7f7f2dc94ea3773841c9ae62cd671327db2cd

show more ...

fa0fa3b031-Mar-2021 Ed Tanous <edtanous@google.com>

Implement path encoding and decoding

sdbus has methods for encoding and decoding paths in a lossless way.
This commit adds those methods to object_path in such a way that those
functions are called

Implement path encoding and decoding

sdbus has methods for encoding and decoding paths in a lossless way.
This commit adds those methods to object_path in such a way that those
functions are called implicitly when building strings, the hope being
that any API choosing to use object_path need not write its own escaping
functions, and said escaping will happen implicitly.

The explicit changes to make this happen are.
1. filename() now calls into sd_bus_path_decode, rather than writing its
own method. This means that the strings returned from the method now no
longer need decoding explicitly, and can largely be used as-is. For
paths that did not require escaping, the behavior should be identical.
For paths that did require escaping, this method will now return the raw
version of the path. Existing usages should remain the same, and impact
is unlikely, given that most sdbusplus users don't explicitly escape
strings, and filename() is relatively new.

2. a operator/ method is added to the object_path object. Similar to
operator/ on std::filesystem::path, this allows generating a new
object_path from an existing one, by adding a new leaf node to the path.
Functionally this allows nearly any value to be escaped into a dbus
path. An example of a common usage of this might be

object_path myPath = "/";
object_path myNewPath = myPath / "Foo-bar";

The above line will implicitly escape the - in the name. Overloads for
both const std::string& and const char* have been added.

One motivating example where the above would be useful is to remove the
escapePathForDbus method in bmcweb.
https://github.com/openbmc/bmcweb/blob/88b3dd12851cd7bdd4b5c065ba99f40feafb775e/include/dbus_utility.hpp#L47

and the similarly named method in dbus-sensors
https://github.com/openbmc/dbus-sensors/blob/6cb732a31b7664089124b00e806311768bc24a87/src/SensorPaths.cpp#L49
both written by the same author (not me), and centralize them in
sdbusplus where they belong.

Functionally this commit also includes a new utility/memory.hpp, that
allows for C-style RAII using freep, mfree and the _cleanup_free_
attributes. These were largely copied as-is from alloc-util.h in
systemd on latest patchset recommendations.

Tested:
Unit tests have been updated to include all new code paths, and some
common items that might need escaped. Unit tests pass.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If77b8bc5f75709b59353570a9c14383cac44dcd4

show more ...

95874d9319-Feb-2021 Ed Tanous <edtanous@google.com>

Standardize the asio helper methods

As a general rule, std::networking/asio methods take a single callback
handler. This is done intentionally, as it allows objects that cannot
be taken by referenc

Standardize the asio helper methods

As a general rule, std::networking/asio methods take a single callback
handler. This is done intentionally, as it allows objects that cannot
be taken by reference to be taken directly by move.

The latest helper methods for properties seems to have taken a
javascript style approach, with "onSuccess" and "onError" handlers.
This works fine in js, where everything is reference counted, but
doesn't work in all cases in c++.

As an strawman.

std::unique_ptr<Thing> myThing;
setProperty(......
[myThing{std::move(myThing)}](std::error_code){
... Use MyThing
},
[myThing{std::move(myThing)}](){
... Use mything
});

The above code doesn't work, as you can't move out of myThing twice.
Sure, you could make myThing a shared_ptr, but that's wasteful, and
defeats c++es policy of "you don't pay for what you don't use".

This commit changes the new handlers to use more standard prototypes
that accept a single callback, and return error codes on failure.

I was able to find only one usage of these methods in the codebase,
inside telemetry, with a single getProperty call. For that method, I
have left the old version of this method present, and marked it with the
c++17 [[deprecated]] flag, along with a note on what to do instead.
This is to avoid a hard binding between this patchset and
https://gerrit.openbmc-project.xyz/c/openbmc/telemetry/+/40878
which should allow them to be merged in whatever order we like.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia28e41fad5031656cef4d766c59baa948ea781e5

show more ...

4b64623622-Feb-2021 Patrick Williams <patrick@stwcx.xyz>

clang-format fixes for latest

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

32ffb03d12-Oct-2020 Patrick Williams <patrick@stwcx.xyz>

server: un-inline various large functions

Save approximiately 70k (ARM32) of size from the generated library of
libphosphor-dbus.so by un-inlining various large functions.

Signed-off-by: Patrick Wi

server: un-inline various large functions

Save approximiately 70k (ARM32) of size from the generated library of
libphosphor-dbus.so by un-inlining various large functions.

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

show more ...

e659436d10-Oct-2020 Patrick Williams <patrick@stwcx.xyz>

server/interface: simplify property_changed

The previous property_changed implementation created a dynamic vector to
hold two elements. Switch to std::array to simplify the code and
compiled functi

server/interface: simplify property_changed

The previous property_changed implementation created a dynamic vector to
hold two elements. Switch to std::array to simplify the code and
compiled function size.

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

show more ...

1d35f91a09-Oct-2020 Patrick Williams <patrick@stwcx.xyz>

sdbus++: create server support functions

Reduce the complexity of the generated bindings by taking the
common patterns and moving them to support template functions.
This has the side-effect of a sm

sdbus++: create server support functions

Reduce the complexity of the generated bindings by taking the
common patterns and moving them to support template functions.
This has the side-effect of a small space savings a library
of generated bindings.

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

show more ...

1234567891011