summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Initialize transaction idAdriana Kobylak2017-02-013-0/+30
| | | | | | | | | | | Initialize the transaction id in the code generated by the sdbusplus tool. Generate a unique value if the transaction id has not been initialized and a caller requests it. This is the scenario for clients that have not made a dbus call yet and create journal entries. Change-Id: Ia7b926fd3f83963fac01fbd1ce4cdd59d2224008 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Store transaction id in thread local storageAdriana Kobylak2017-02-013-0/+64
| | | | | | | | | Implement the transaction id variable in a .C file and create an sdbusplus library with it. Create interfaces to set/get the transaction id. Change-Id: Id1df415d9cc05e4b96817c7a05c1be7052d05c65 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* transaction: Initial commit to create a transaction idAdriana Kobylak2017-02-014-0/+98
| | | | | | | | | | Create a README file to describe the transaction id. Hash specialization to create a unique transaction id by combining the hash values of the dbus bus name and message cookie. Change-Id: Ida52774857a7ed2cca9364da15f84a30d2c3af06 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Allow implicit string_wrapper conversionsBrad Bishop2017-01-302-0/+21
| | | | | | | | | | | | | 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>
* Don't emit InterfacesRemoved unless requestedBrad Bishop2017-01-241-2/+5
| | | | | | | | | | Don't invoke sd_bus_emit_object_removed unless sd_bus_emit_object_added was invoked at object creation time. Fixes openbmc/openbmc#971 Change-Id: Ib3b92af3a2c03b86008f0b4f36906a367786af45 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* message: Add get_cookie methodAdriana Kobylak2017-01-131-0/+11
| | | | | | | The message cookie will be used to generate a unique hash id. Change-Id: Iffb30a287659aa633b399fb1b2efaa450bf66240 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* bus: Add get_unique_name methodAdriana Kobylak2017-01-131-0/+11
| | | | | | | The dbus bus unique name will be used for generating a unique hash id. Change-Id: I275acdcc89ce7e459e87dfdca2b395ba7fa00f05 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* message: Change conversion ctor to inc ref-countPatrick Williams2017-01-134-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | There are cases of calling the message constructor where the ownership of the raw pointer is transfered and others where it is duplicated. The ownership-transfer use-cases are likely all embedded within sdbusplus itself and the ownership-duplicate cases tend to be done by external users. This causes the current API to be bug-prone as it requires something like: sdbusplus::message::message(sd_bus_message_ref(m)); Change the conversion constructor to not require the external _ref call and instead add a new constructor that bypasses the ref. Thus, the calling conventions now look like this: Ownership-duplicate: sdbusplus::message::message(m); // calls _ref. Ownership-transfer: sdbusplus::message::message(m, std::false_type()); // no _ref. Resolves openbmc/openbmc#950. Change-Id: Ia1ae527c4d1235b1625368cfffeb4ed495457768 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: allow obj-path and sig in STL containersPatrick Williams2017-01-102-0/+33
| | | | | | | | 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>
* sdbus++: Use native types for obj-path and signaturePatrick Williams2017-01-101-2/+4
| | | | | Change-Id: I6075a6a52553d0dc7dca6abc3442282f91fb5d44 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message-read: support obj-path and signaturePatrick Williams2017-01-092-1/+47
| | | | | Change-Id: Iafc2f26a10f0c5c84805e1d28bea8f17eaadc03c Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message-append: support obj-path and signaturePatrick Williams2017-01-092-0/+43
| | | | | Change-Id: I44d5195eba14c17f38cf2bf2b09eb071d54f59d8 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message-types: support obj-path and signaturePatrick Williams2017-01-092-0/+12
| | | | | Change-Id: I7cb1563af3375f2a8b22c78ac59f7e69f176933f Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: Add class for object-path and signaturesPatrick Williams2017-01-095-0/+67
| | | | | Change-Id: I1ca54ecc5d4033c41738bd224399f80b95094430 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* build: ensure C++14 is selectedPatrick Williams2017-01-061-2/+2
| | | | | | | | | | | | | | The expectation is that --enable-libsdbusplus is default, but the configure script had it default in some conditions and not default in others. As a result, if you left off --enable-libsdbusplus, C++14 support was not enabled. Fix this by making sure all conditions based on configure flags use the same logic rather then checking against 'yes' in some cases and 'no' in others. Change-Id: Ic658047c97aa266456c717fa605a4f4741fe94a7 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* message: added is_method_error methodChristian Andersen2016-12-191-0/+9
| | | | | Change-Id: I099744bed79e75da77e72167594c6ca14ef32209 Signed-off-by: Christian Andersen <c.andersen@kostal.com>
* sdbus++: fix pep8 issuesPatrick Williams2016-12-121-3/+7
| | | | | Change-Id: I3efcfb0575cdfecb86f72368f34d4d33d9e00318 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: Avoid using C++ reserved wordsPatrick Williams2016-12-121-1/+29
| | | | | | | | | | | | Some words are reserved in C++, so they cannot be used as function or variable names. If a YAML file specifies these we must come up with an alternative name for the generated C++ function. Do this by adding underscore characters to the generated name. Fixes openbmc/sdbusplus#10. Change-Id: I992caafb02fe71ea6ac2cf3c555a9956e4ba616a Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: fix incorrect type for variantPatrick Williams2016-12-121-1/+2
| | | | | Change-Id: Ib353e19793bda85815826f7b835fd6f3c5d8e908 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: Fix generation of enumsChristian Andersen2016-12-091-1/+3
| | | | | | | | | | | | | The fix to openbmc/sdbusplus#4 broke the generation of enums, because enums are currently not directly parsed by the cpp type conversion. This also means that there is additional work required to support enums nested into containers. Fixes openbmc/sdbusplus#8 Change-Id: I4f206fa899d84128bc7463d54c5b83e40e28d61f Signed-off-by: Christian Andersen <c.andersen@kostal.com>
* sdbus++: Handle parsing of multi-level containersChristian Andersen2016-12-091-12/+37
| | | | | | | | | | | The type array contructed by YAML is difficult to process recursively. So the type array gets preprocessed and converted to a recursive data structure. Fixes openbmc/sdbusplus#4 Change-Id: Ife8a47d9b6babd75835f496702ca5899ac6e18c3 Signed-off-by: Christian Andersen <c.andersen@kostal.com>
* sdbusplus: remove 'move' ops from server bindingsPatrick Williams2016-12-021-3/+4
| | | | | | | | | | | The generated server bindings register 'this' with sdbus, so if a move is allowed then the object pointer left with sdbus no longer exists. Disallow 'move' operations to prevent this. Fixes openbmc/sdbusplus#6. Change-Id: I470b1372042d21ce14ad0cd9bc1af68e7394bcb9 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>
* append/read: additional testcases for bool formsPatrick Williams2016-11-282-8/+16
| | | | | | | | Added test-cases for false r-value reference and l-values, in addition to existing false value. Change-Id: I36952f06d84f9da157a618fbe093a8ca63662ceb Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* bus: wrap response sd_bus_message into sdbusplus::messageChristian Andersen2016-11-231-1/+1
| | | | | | | The return value of the call should be the sdbusplus-wrapped message and not the low-level sd-bus message. Change-Id: Ifb9dc90ffd5032590c5669710897befd4bd1f743 Signed-off-by: Christian Andersen <c.andersen@kostal.com>
* sdbus++: generate valid code 0 return methodsPatrick Williams2016-11-221-1/+1
| | | | | | | | | | | A method with 0 returns could result in incorrectly generated code due to a mistake that looked at the param-count instead of the return-count. Fixes openbmc/sdbusplus#3. Change-Id: Ifbbd89ab8c8dcfee60c18446f30446b052992f3f Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* Removed leading spaces from templateAbhishek Pandit2016-11-182-10/+10
| | | | | | | | Removed leading spaces that were leaving trailing spaces in generated files. Change-Id: I99927e7b8fe3762cf0cc28d113e02eae2fcd4db3 Signed-off-by: Abhishek Pandit <abhishekpandit@google.com>
* Added readme with instructions on how to use sdbus++Abhishek Pandit2016-11-181-0/+31
| | | | | | | Added instructions for using sdbus++. Change-Id: Ibdd89f6971e05f16797ee04a2eeb1c4fc6a8676b Signed-off-by: Abhishek Pandit <abhishekpandit@google.com>
* Install server/bindings.hppChristian Andersen2016-11-181-0/+1
| | | | | Change-Id: Ic98c5cb0d04013c8cf7164ae417da82b3ab515ff Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: exception handling for property callbacksPatrick Williams2016-11-181-9/+25
| | | | | Change-Id: I4230d5ebc7d2a470d9ae2d3bb03a9918a29ba919 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: complete server support for enumerationsPatrick Williams2016-11-184-16/+54
| | | | | | | | | Perform final type conversion using 'convert*' functions to change between dbus strings and C++ enumerations for methods, properties, and signals. Change-Id: I22e8fd424eeecac176c64fcc3e7a5d3caf05804a Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: provide enum-string conversion functionsPatrick Williams2016-11-182-0/+65
| | | | | Change-Id: Ied31a6c11188fe3d0c909edb5c4bde3e337d96b3 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* exception: add InvalidEnumString errorPatrick Williams2016-11-181-0/+30
| | | | | Change-Id: I138d468cc5e16241b450108eedf79c4a4c317d87 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* server-bindings: convertForMessage utilityPatrick Williams2016-11-182-0/+30
| | | | | | | | | | | | | | | Some C++ types, such as enumerations, need some conversion before they can be added to a message. Provide a global utility which passes a C++ reference unchanged, which can be used in all server-bindings. Specific C++ types that need conversion will provide their own override of this in their own namespace/class. "Argument dependent lookup" rules will allow the override to be used where appropriate. Change-Id: I0e9f64974ea12093c1b67f28847da4696fa85f61 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: fix enumeration property default valuesPatrick Williams2016-11-182-3/+14
| | | | | | | | | | Current generation emits for enumerations: Enum property = EnumValue Fix this to be: Enum property = Enum::EnumValue Change-Id: Iae1e8e4ad73bf8623ed9f3b2d3ec57803c7f18bd Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: convert binding enum types to valid C++Patrick Williams2016-11-185-17/+59
| | | | | | | | | | | | When an enumeration is used in the bindings, the type of it depends on the context. We use 'string' types to send the enumeration across the dbus, so we need to use 'string' types when doing message operations. We use the real enum type when calling binding functions, so we need to specify that in prototypes. Change-Id: I31ab137b0c751d8a2bdec1c417a60455690ce103 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: add enumeration parsingPatrick Williams2016-11-183-1/+30
| | | | | Change-Id: I6d02574942b38adbe2dc537f5279721cde2c8bc7 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: generate markdown for errorsPatrick Williams2016-11-183-0/+17
| | | | | Change-Id: Iafdf4c30e312b0ef7faeea3e3a7379f1868a61dc Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: generate markdown for enumerationsPatrick Williams2016-11-181-4/+21
| | | | | Change-Id: I8b62aea7094e6e8e12d39e1341ebd07fc547b12b Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: clean up extra error responsePatrick Williams2016-11-172-3/+3
| | | | | | | | | | | | | The property set/get and method callback functions are suppose to return 1 or true to sdbus, otherwise the callbacks are treated as unhandled. Since the generated callbacks all populate the response message correctly, the result is that the client receives two messages but the 2nd (an error) is silently ignored by clients because it is a duplicate message. Clean this up, which reduces needless activity on the dbus. Change-Id: I39699e498b0d113ec9819670a92e44e8108c88db Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: enhance exception informationPatrick Williams2016-11-174-8/+20
| | | | | | | | | | Use both 'name' and 'description' for exceptions. All sdbusplus exceptions now have a 'name()' and 'description()' method which give the dbus error name and a human-readable description respectively. The standard 'what' is now '<name>: <description>'. Change-Id: Ic6cdb88350c07589cbfbf233e84a575632383af6 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: Prepend all errors with 'Error' namespacePatrick Williams2016-11-174-7/+9
| | | | | | | | | | | | | Old: Error identifier: com.example.Interface.LogicError Exception class: com::example::Interface::common::LogicError New: Error identifier: com.example.Interface.Error.LogicError Exception class: com::example::Interface::Error::LogicError Change-Id: I866046f4a0514f5bce40bdef46a218060d107765 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: use consistent typenames for propertiesPatrick Williams2016-11-176-22/+94
| | | | | | | | | | | | | | | | Previously, the generated code was assuming C++ names, but the example (Calculator.interface.yaml) used an arbitrary name ('integer'). This commit defines a consistent typename scheme and validates it when interfaces are generated. Use English typenames from the DBus protocol in interface files rather than the C++ name or a single-letter DBus name. Use square-bracket ([]) to identify sub-types for containers. Examples: 'int64', 'path', 'array[dict[string, byte]]' Change-Id: I38abe84c9cd3d5f839968349d2d3cfa0b8796cd0 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: add exception handling to server bindingsPatrick Williams2016-11-172-12/+52
| | | | | Change-Id: Id313bb05c7cb910b7669046cffac668bf04af11d Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* exception: define 'internal_exception' classPatrick Williams2016-11-171-0/+8
| | | | | | | | | | internal_exception will be used for sdbusplus-generated errors. These errors could be thrown by any sdbusplus call and therefore by any generated server binding. Define this class to differentiate between binding-defined errors and sdbusplus-defined errors. Change-Id: I725729c8e874b638cde8ce72289b87ed807d27c1 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: generate error cppPatrick Williams2016-11-173-1/+27
| | | | | Change-Id: I63ea5ea07ab4efb0da21ee10de7fe9db429c1ffd Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* sdbus++: generate error headerPatrick Williams2016-11-172-1/+30
| | | | Change-Id: I6e1beb1da2b5c3c3ea612b9aa688ea037d6173e6
* sdbus++: parse error info yamlPatrick Williams2016-11-174-2/+35
| | | | | Change-Id: I73361b6f9b48b32a206d1e6d3e52ff46195b3cbc Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
* exception: Create exception classPatrick Williams2016-11-172-0/+20
| | | | | Change-Id: I576ac6fdbca5ca7d186040c36abac1f0a5dc73cb Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
OpenPOWER on IntegriCloud