summaryrefslogtreecommitdiffstats
path: root/src/tests/sbus_codegen_tests_generated.h
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2014-02-25 10:29:23 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-04-19 10:32:50 +0200
commitdff909d473f43a6bd0f0286fa2d279c0ebe945c6 (patch)
tree61b2f3e2c33e28b51a8ffed64a73de364093557a /src/tests/sbus_codegen_tests_generated.h
parent7a9a6ee1b5f5479c3a6958401f9b34c571c3b6bf (diff)
downloadsssd-dff909d473f43a6bd0f0286fa2d279c0ebe945c6.tar.gz
sssd-dff909d473f43a6bd0f0286fa2d279c0ebe945c6.tar.xz
sssd-dff909d473f43a6bd0f0286fa2d279c0ebe945c6.zip
sbus: Add type-safe DBus method handlers and finish functions
Type safe method handlers allow methods not to have to do tedious unwrapping and wrapping of DBus method call messages or replies. Arguments of the following DBus types are supported in type-safe method handlers. In addition arrays of these are supported. y: uint8_t b: bool (but no arrays, yet) n: int16_t q: uint16_t i: int32_t u: uint32_t x: int64_t t: uint64_t d: double s: char * (utf8 string) o: char * (object path) As an exception, arrays of booleans are not supported, but could be added later. Other more complex types could be added later if desired. If a method has other argument types, then it must be marked as having a raw handler (see below). Internally each method can have a type specific invoker function which unpacks the incoming arguments and invokes the method handler with the correct arguments. Each method also has a finish which accepts the type-safe out arguments (ie: return values) and builds the reply message. Like other request 'finish' functions, these free the request talloc context, and are to be used in place of sbus_request_finish() or friends. Raw method handlers parse their own method arguments, and prepare their own reply (ideally using sbus_request_finish() helpers). They can also do strange things like have variable arguments. To mark a DBus method as having a raw method handler use the following annotation: <annotation name="org.freedesktop.sssd.RawHandler" value="true"/> Raw methods do not have invokers or finish functions. I've left all of the internal peer to peer communication using raw method handlers. No code changes here.
Diffstat (limited to 'src/tests/sbus_codegen_tests_generated.h')
-rw-r--r--src/tests/sbus_codegen_tests_generated.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/tests/sbus_codegen_tests_generated.h b/src/tests/sbus_codegen_tests_generated.h
index f41eca74b..23091a7bf 100644
--- a/src/tests/sbus_codegen_tests_generated.h
+++ b/src/tests/sbus_codegen_tests_generated.h
@@ -15,32 +15,56 @@
#define COM_PLANETEXPRESS_SHIP "com.planetexpress.Ship"
#define COM_PLANETEXPRESS_SHIP_MOVEUNIVERSE "MoveUniverse"
#define COM_PLANETEXPRESS_SHIP_CRASH_NOW "Crash"
+#define COM_PLANETEXPRESS_SHIP_LAND "Land"
#define COM_PLANETEXPRESS_SHIP_BECAMESENTIENT "BecameSentient"
#define COM_PLANETEXPRESS_SHIP_COLOR "Color"
/* constants for com.planetexpress.Pilot */
#define TEST_PILOT "com.planetexpress.Pilot"
+#define TEST_PILOT_BLINK "Blink"
#define TEST_PILOT_FULLNAME "FullName"
/* ------------------------------------------------------------------------
- * DBus Vtable handler structures
+ * DBus handlers
*
* These structures are filled in by implementors of the different
* dbus interfaces to handle method calls.
*
* Handler functions of type sbus_msg_handler_fn accept raw messages,
- * other handlers will be typed appropriately. If a handler that is
+ * other handlers are typed appropriately. If a handler that is
* set to NULL is invoked it will result in a
* org.freedesktop.DBus.Error.NotSupported error for the caller.
+ *
+ * Handlers have a matching xxx_finish() function (unless the method has
+ * accepts raw messages). These finish functions the
+ * sbus_request_return_and_finish() with the appropriate arguments to
+ * construct a valid reply. Once a finish function has been called, the
+ * @dbus_req it was called with is freed and no longer valid.
*/
/* vtable for com.planetexpress.Ship */
struct com_planetexpress_Ship {
struct sbus_vtable vtable; /* derive from sbus_vtable */
- sbus_msg_handler_fn MoveUniverse;
- sbus_msg_handler_fn crash_now;
+ int (*MoveUniverse)(struct sbus_request *req, void *data, bool arg_smoothly, uint32_t arg_speed_factor);
+ int (*crash_now)(struct sbus_request *req, void *data, const char *arg_where);
+ sbus_msg_handler_fn Land;
};
+/* finish function for MoveUniverse */
+int com_planetexpress_Ship_MoveUniverse_finish(struct sbus_request *req, const char *arg_where_we_crashed);
+
+/* finish function for Crash */
+int com_planetexpress_Ship_crash_now_finish(struct sbus_request *req);
+
+/* vtable for com.planetexpress.Pilot */
+struct test_pilot {
+ struct sbus_vtable vtable; /* derive from sbus_vtable */
+ int (*Blink)(struct sbus_request *req, void *data, uint32_t arg_duration);
+};
+
+/* finish function for Blink */
+int test_pilot_Blink_finish(struct sbus_request *req, bool arg_crashed);
+
/* ------------------------------------------------------------------------
* DBus Interface Metadata
*