summaryrefslogtreecommitdiffstats
path: root/src/tests/sbus_codegen_tests_generated.c
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2014-01-09 23:04:45 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-02-24 11:14:12 +0100
commitb699c4d7f85a5404be1d1ee9450331aea869b886 (patch)
tree768eb8caba2a7c16adeecded05ee539b65d52a7d /src/tests/sbus_codegen_tests_generated.c
parent3ddbc81148d8bae386beb987195086ade9355f38 (diff)
downloadsssd-b699c4d7f85a5404be1d1ee9450331aea869b886.tar.gz
sssd-b699c4d7f85a5404be1d1ee9450331aea869b886.tar.xz
sssd-b699c4d7f85a5404be1d1ee9450331aea869b886.zip
sbus: Add meta data structures and code generator
These metadata structures hold the information about all the details of a DBus interface. They are typically generated from the canonical XML form of the DBus interface, although they may also be hand crafted. Add some handy functions for looking up methods, props, signals, in the metadata of an interface. Currently lookups are just done by looking through an array. If performance becomes an issue (ie: very large interfaces) it would be really easy to sort things and use bsearch(). Later commits will include some definitions using this metadata and related functions. DBus interfaces are defined here: http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format The introspection data format has become the standard way to represent a DBus interface. For many examples see /usr/share/dbus-1/interfaces/ on a typical linux machine. A word about annotations. These are extra flags or values that can be assigned to anything. So far, the codegen supports this annotation: org.freedesktop.DBus.GLib.CSymbol - An annotation specified in the specification that tells us what C symbol to generate for a given interface or method. By default the codegen will build up a symbol name from the DBus name. It is possible to confuse the code generator into producing invalid C code (with strange method names, for example), but the C compiler catches such silliness right away. Add tests testing basic features of the codegen and poking through the metadata it creates. Also test the metadata lookup functions. Generated code is checked in for easy discovery. An example of the XML interface definitions can be found at: src/tests/sbus_codegen_tests.xml And an example of the generated header can be found here: src/tests/sbus_codegen_tests_generated.h Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/tests/sbus_codegen_tests_generated.c')
-rw-r--r--src/tests/sbus_codegen_tests_generated.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/tests/sbus_codegen_tests_generated.c b/src/tests/sbus_codegen_tests_generated.c
new file mode 100644
index 000000000..556eea12c
--- /dev/null
+++ b/src/tests/sbus_codegen_tests_generated.c
@@ -0,0 +1,79 @@
+/* The following definitions are auto-generated from sbus_codegen_tests.xml */
+
+#include "util/util.h"
+#include "sbus/sssd_dbus.h"
+#include "sbus/sssd_dbus_meta.h"
+
+/* arguments for com.planetexpress.Ship.MoveUniverse */
+const struct sbus_arg_meta com_planetexpress_Ship_MoveUniverse__in[] = {
+ { "smoothly", "b" },
+ { "speed_factor", "u" },
+ { NULL, }
+};
+
+/* arguments for com.planetexpress.Ship.MoveUniverse */
+const struct sbus_arg_meta com_planetexpress_Ship_MoveUniverse__out[] = {
+ { "where_we_crashed", "s" },
+ { NULL, }
+};
+
+/* methods for com.planetexpress.Ship */
+const struct sbus_method_meta com_planetexpress_Ship__methods[] = {
+ {
+ "MoveUniverse", /* name */
+ com_planetexpress_Ship_MoveUniverse__in,
+ com_planetexpress_Ship_MoveUniverse__out,
+ },
+ { NULL, }
+};
+
+/* arguments for com.planetexpress.Ship.BecameSentient */
+const struct sbus_arg_meta com_planetexpress_Ship_BecameSentient__args[] = {
+ { "gender", "s" },
+ { NULL, }
+};
+
+/* signals for com.planetexpress.Ship */
+const struct sbus_signal_meta com_planetexpress_Ship__signals[] = {
+ {
+ "BecameSentient", /* name */
+ com_planetexpress_Ship_BecameSentient__args
+ },
+ { NULL, }
+};
+
+/* property info for com.planetexpress.Ship */
+const struct sbus_property_meta com_planetexpress_Ship__properties[] = {
+ {
+ "Color", /* name */
+ "s", /* signature */
+ SBUS_PROPERTY_READABLE,
+ },
+ { NULL, }
+};
+
+/* interface info for com.planetexpress.Ship */
+const struct sbus_interface_meta com_planetexpress_Ship_meta = {
+ "com.planetexpress.Ship", /* name */
+ com_planetexpress_Ship__methods,
+ com_planetexpress_Ship__signals,
+ com_planetexpress_Ship__properties
+};
+
+/* property info for com.planetexpress.Pilot */
+const struct sbus_property_meta test_pilot__properties[] = {
+ {
+ "FullName", /* name */
+ "s", /* signature */
+ SBUS_PROPERTY_READABLE | SBUS_PROPERTY_WRITABLE,
+ },
+ { NULL, }
+};
+
+/* interface info for com.planetexpress.Pilot */
+const struct sbus_interface_meta test_pilot_meta = {
+ "com.planetexpress.Pilot", /* name */
+ NULL, /* no methods */
+ NULL, /* no signals */
+ test_pilot__properties
+};