From: Paul Fertser <fercerpav@gmail.com>
To: openbmc@lists.ozlabs.org
Subject: sdbusplus reading InterfacesAdded issue: not all variants are created equal
Date: Thu, 23 Dec 2021 18:45:26 +0300 [thread overview]
Message-ID: <YcSZlt4HPeBO3sL3@home.paul.comp> (raw)
Hello,
While digging into current state of SNMP notifications (traps) support
in OpenBMC I found some code I have no idea how to properly improve.
phosphor-dbus-monitor has a handler that's meant to be called whenever
a new log entry is created by monitoring InterfacesAdded signals on
D-Bus logger paths. The processing is at
https://github.com/openbmc/phosphor-dbus-monitor/blob/master/src/snmp_trap.cpp#L28
It seems OK until you look into PathInterfacesAdded definition which
includes a hard-coded std::variant<>:
https://github.com/openbmc/phosphor-dbus-monitor/blob/master/src/data_types.hpp#L66
This already raises suspicions and rightfully so: the interface we're
specifically interested in, xyz.openbmc_project.Logging.Entry,
includes AdditionalData property which should be of type
std::vector<std::string> , but that's not in the list of the allowed
hardcoded variants.
If I'm trying to use the std::variant<> type suitable for
Logging.Entry then msg.read() fails with InvalidEnum error, probably
trying to parse data about other interfaces, and this is a bad idea
anyway.
So what is the correct method of using statically-typed sdbusplus APIs
to parse such a "dynamic" reply?
--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav@gmail.com
next reply other threads:[~2021-12-23 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 15:45 Paul Fertser [this message]
2021-12-23 16:24 ` sdbusplus reading InterfacesAdded issue: not all variants are created equal Patrick Williams
2021-12-24 12:53 ` Paul Fertser
2021-12-24 19:21 ` Paul Fertser
2021-12-23 18:14 ` Ed Tanous
2021-12-24 12:48 ` Paul Fertser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YcSZlt4HPeBO3sL3@home.paul.comp \
--to=fercerpav@gmail.com \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.