summaryrefslogtreecommitdiffstats
path: root/sdbusplus/message
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: always break template declarationsPatrick Venture2018-08-314-63/+126
| | | | | | | To better match the defined openbmc style. Change-Id: I68cda43857768bae4c904c367942cb1f0efa3e0c Signed-off-by: Patrick Venture <venture@google.com>
* update .clang-format header inclusion orderPatrick Venture2018-08-313-11/+12
| | | | | | | | Added the header inclusion order to the .clang-format file generated these changes. Change-Id: Ia31b21d7ea451cac0309828006bc17c27cbd5bd5 Signed-off-by: Patrick Venture <venture@google.com>
* Add sbusplus properties serverJames Feist2018-06-271-0/+5
| | | | | | | | | | | | | | | | | 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>
* message: Add error handling to sd_bus_message callsWilliam A. Kennington III2018-05-291-25/+119
| | | | | | | | | | | Previously, any errors decoding messages could cause the application to just crash instead of being able to handle the exception. The sd_bus_message methods provide error statuses that were just being thrown away. Make use of any returned error information to ensure application correctness. Change-Id: If9c04b1ce4f6e1f1f6ce441d02e3497fe47b7f3b Signed-off-by: William A. Kennington III <wak@google.com>
* sdbusplus::message::message Add sdbus interface injectionPatrick Venture2018-05-292-149/+228
| | | | | | | | | | | | By default message will use the sdbus singleton that points to the real library calls, however you can now pass in an interface pointer for it to use instead. This is handled automatically when the message is created by the sdbusplus::bus::bus as it will pass in its own interface upon creation (via a later CL). Note: This was originally part of another patchset. Change-Id: Iad49164f1a648e6d3af7d288a8953b5a5ab051bf Signed-off-by: Patrick Venture <venture@google.com>
* Spelling fixesGunnar Mills2018-04-082-3/+3
| | | | | | | | | 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>
* Allow reading and appending of more complex typesEd Tanous2018-03-073-81/+96
| | | | | | | | | | | | | | | | | | | | | This commit makes sdbusplus compatible with most containers that meet a few requirements. This includes: std::unordered_map std::array std::set boost::flat_set boost::flat_map Read requires a container to support emplace or emplace_back methods. Append requires a container to suport a const iterator Tested: The top level OpenBMC compiles properly, and the sdbusplus unit tests compile and pass, and unit tests have been updated with a few new types to ensure we see any breakages. Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I5eb1cf7dc07bacc7aca62d87844794223ad4de80 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* clang-format: Set IndentWrappedFunctionNames to trueAdriana Kobylak2018-02-282-20/+20
| | | | | | | | | Change IndentWrappedFunctionNames to true in the .clang-format file to indent function definitions that don't fit in a single line. Change-Id: Icbd9284b6b5cfc97f094fbf3434b255aabfd0109 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* message: fix a bug exposed by gcc 6.3Brad Bishop2018-02-141-2/+2
| | | | | | | | | Do not return a reference from type_id_single. This causes odr use of tuple_type_id which results in link failures. Change-Id: I67fbefe7dca21666b551199dc62f4348aa8dc12d Tested: Successfully built an application under gcc 6.3 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Update repo to conform to openbmc code standardAndrew Geissler2018-02-054-289/+385
| | | | | Change-Id: If1d6b1f04514367cc544c2507a845b3e9d6d3435 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
* message-append: char* passed to sd-bus as char**Patrick Williams2017-02-151-1/+20
| | | | | | | | | | | | | | If a call to message::append resulted in the templates generating a call to sd_bus_message_append_basic, all flavors of char* were being passed to sd_bus as char**. Fix by adding type-templates to distinguish between T and T* for the parameters to sd_bus_message_append_basic. Fixes openbmc/openbmc#1025. Change-Id: I2f3a204ae10803c677d1c3aecfa4d9eabc40b593 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: add server method for set-propertyPatrick Williams2017-02-031-1/+4
| | | | | | | | | Add a method to the server bindings that sets properties by looking up the name from a string. Change-Id: I7e9081b66dfeffd394155a574c2178a7cd039e2a Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Allow implicit string_wrapper conversionsBrad Bishop2017-01-301-0/+11
| | | | | | | | | | | | | Add comparison operators to allow string_wrappers to be implicity converted to strings for comparisons to cut down on casting and/or str member access. Do not allow std::string to be impliclitly converted to object_path to avoid a temporary string copy. Change-Id: I2e45a4fc3ee07d1df55f6fab2cfa35da205c150e Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: allow obj-path and sig in STL containersPatrick Williams2017-01-101-0/+21
| | | | | | | | Allow object_path and signatures to be used in std::vector, std::map, and std::unordered_map. Change-Id: Ieb592aa518bfae08da393632a1dd0ed0dd684c7a Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message-read: support obj-path and signaturePatrick Williams2017-01-091-1/+19
| | | | | Change-Id: Iafc2f26a10f0c5c84805e1d28bea8f17eaadc03c Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message-append: support obj-path and signaturePatrick Williams2017-01-091-0/+16
| | | | | Change-Id: I44d5195eba14c17f38cf2bf2b09eb071d54f59d8 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message-types: support obj-path and signaturePatrick Williams2017-01-091-0/+5
| | | | | Change-Id: I7cb1563af3375f2a8b22c78ac59f7e69f176933f Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: Add class for object-path and signaturesPatrick Williams2017-01-091-0/+49
| | | | | Change-Id: I1ca54ecc5d4033c41738bd224399f80b95094430 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: remove hard-coded boolean typesPatrick Williams2016-11-292-2/+2
| | | | | | | | | | In general we avoided hard-coded dbus characters and use type-deducation and sdbus constants. Fix boolean support to not hard-code 'b', but instead use type-deducation like the std::string support did. Change-Id: I8bbfebf60a0f6f33dc9d13b2ff3368ce7ca86285 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: pass 'bool' types to sdbus as 'int'Patrick Williams2016-11-282-0/+30
| | | | | | | | | | | | | sdbus requires dbus-boolean to be passed as 'int' and not 'bool'. Modify message append / read functions to ensure this requirement is met. See man-page for sd_bus_message_append_basic, SD_BUS_TYPE_BOOLEAN. Fixes openbmc/sdbusplus#7. Change-Id: Id020f1a8598f034551d30a0561c50cb1ab5d752d Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* Skip variant for unknown typesBrad Bishop2016-11-041-0/+1
| | | | | | | | | | | Reading a single variant didn't skip over the message data when encountering a type that doesn't exist in the template parameter list. Subseqeuent reads then point at the wrong data. Add a call to sdbus_message_skip in this case. Change-Id: Ia89baced1530698070f7ca4e47ba16f36c2fcafa Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* message::types: minor comment fixupPatrick Williams2016-09-121-1/+1
| | | | | Change-Id: I4b2b62c8879b6e3832252fde0918e6a5bb67d078 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* variant support for append/readPatrick Williams2016-09-123-0/+77
| | | | | Change-Id: I682275405e3c4f7c798317a60ea070b3b1a0846c Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* std::tuple support for append/readPatrick Williams2016-09-123-0/+65
| | | | | Change-Id: If914032fa4f655af509ac58a5e0057968f71aa32 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* std::map support for append/readPatrick Williams2016-09-123-0/+114
| | | | | Change-Id: I3b5510b8ba400cf4d3f936f01708cb17aa009e62 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* types: Use SD_BUS_TYPE_* instead of char-constsPatrick Williams2016-09-121-13/+14
| | | | | Change-Id: Ic05416de718c5e73a381d1382623d71cdaf31958 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* std::vector support for append/readPatrick Williams2016-09-123-18/+67
| | | | | Change-Id: I1820ee2213feb37fab10a491b1099032fd48c18d Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* Add message read functionalityPatrick Williams2016-09-121-0/+262
| | | | | | | C++ bindings for sd_bus_message_read* functions. Similar compile-time type deduction as the message::append interfaces. Change-Id: I88639bedb9703266f7282642ce261c28b736adfc
* Add message append functionalityPatrick Williams2016-09-081-0/+260
| | | | | | | | | | | | | | | | | | | Adds C++ binding to sd_bus_message_append* class functions. Uses type deduction to identify all of the parameters passed to the append function and, at compile-time, creates the appropriate dbus type string. Example: sdbusplus::message::append(m, "asdf"s); Is equal to: sd_bus_message_append_basic(m, 's', ("asdf"s).c_str()); Rather than use a naive sequence of ..._append_basic calls, the implementation will attempt to group multiple basic types into a single sd_bus_message_append call. Change-Id: I1341a0299573c61588fe225c07174b743cb3a282 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* Simplify mangled names for type_id_downcast_t.Patrick Williams2016-09-021-5/+7
| | | | | | | | | | | | | | | Since type_id_downcast_t was a type-alias, the full template set was placed into the mangled name for any function using it. Create a type_id_downcast structure to simplify the name mangling. This reduces a managled name like: enable_if<is_same<array_to_ptr_t<char, remove_cv< remove_reference< char[10]>>>, char*> To: enable_if<is_same<type_id_downcast<char[10]>, char*>> Change-Id: Idd169ce51082420fb4b6df40a8cd0bc5d874acd4 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* Add type_id templatesPatrick Williams2016-09-021-0/+157
C++ templates to assist in type conversions between C++ types and dbus types. These templates provide a compile-time conversion between built-in types and a C-string of dbus types. Example: uint32_t a = 0; const char* b = "a string"; auto t = sdbusplus::message::types::type_id(a, b); This results in a tuple equal to std::make_tuple('u','s', '\0')', which can be converted to a C-string("us") by tuple_to_array. In a subsequent commit this interface will be used to do a compile-time transformation from something like: msg->append(a, b) To: sd_bus_message_append(msg, "us", a, b); The type_id template can be extended to support tuples, STL containers, and user-defined types as needed. Change-Id: I913501b51ffc24bcf4219f4297a1e0f8ebed97b5 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
OpenPOWER on IntegriCloud