summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2014-01-09 23:04:45 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-06-02 18:15:56 +0200
commit8ddfc4b55d06d7d2aeb34358628dc8fea186f106 (patch)
tree9ef3f644145112f02c2d302c2b149f1444299c9a /Makefile.am
parent356b2dc5b81b073cfe1734df656fd34bef61c39d (diff)
downloadsssd-8ddfc4b55d06d7d2aeb34358628dc8fea186f106.tar.gz
sssd-8ddfc4b55d06d7d2aeb34358628dc8fea186f106.tar.xz
sssd-8ddfc4b55d06d7d2aeb34358628dc8fea186f106.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> (cherry picked from commit b699c4d7f85a5404be1d1ee9450331aea869b886) Conflicts: Makefile.am
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am47
1 files changed, 46 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 8d92326de..de916d3ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -133,7 +133,8 @@ if HAVE_CHECK
debug-tests \
ipa_hbac-tests \
sss_idmap-tests \
- responder_socket_access-tests
+ responder_socket_access-tests \
+ sbus_codegen_tests
if BUILD_SSH
non_interactive_check_based_tests += sysdb_ssh-tests
@@ -437,6 +438,7 @@ dist_noinst_HEADERS = \
src/responder/ssh/sshsrv_private.h \
src/sbus/sbus_client.h \
src/sbus/sssd_dbus.h \
+ src/sbus/sssd_dbus_meta.h \
src/sbus/sssd_dbus_private.h \
src/db/sysdb.h \
src/db/sysdb_sudo.h \
@@ -561,6 +563,7 @@ libsss_util_la_SOURCES = \
src/sbus/sbus_client.c \
src/sbus/sssd_dbus_common.c \
src/sbus/sssd_dbus_connection.c \
+ src/sbus/sssd_dbus_meta.c \
src/sbus/sssd_dbus_server.c \
src/util/util.c \
src/util/memory.c \
@@ -637,6 +640,37 @@ include_HEADERS = \
src/sss_client/idmap/sss_nss_idmap.h
####################
+# Sbus Codegen #
+####################
+
+# Yes, the goal here is that the generated files end up in $(srcdir)
+# not $(builddir). Always use $(srcdir) here.
+CODEGEN_XML = \
+ $(srcdir)/src/tests/sbus_codegen_tests.xml
+
+SBUS_CODEGEN = src/sbus/sbus_codegen
+
+EXTRA_DIST += \
+ $(SBUS_CODEGEN) \
+ $(CODEGEN_XML)
+
+SUFFIXES = .xml _generated.h _generated.c
+
+.xml_generated.h:
+ $(srcdir)/$(SBUS_CODEGEN) --mode=header --output=$@ $<
+.xml_generated.c:
+ $(srcdir)/$(SBUS_CODEGEN) --mode=source --output=$@ $<
+
+# Regenerate when codegen changes
+CODEGEN_CODE = \
+ $(CODEGEN_XML:.xml=_generated.c) \
+ $(CODEGEN_XML:.xml=_generated.h)
+
+$(CODEGEN_CODE): $(SBUS_CODEGEN)
+
+BUILT_SOURCES = $(CODEGEN_CODE)
+
+####################
# Program Binaries #
####################
sssd_SOURCES = \
@@ -1257,6 +1291,17 @@ krb5_child_test_LDADD = \
$(SSSD_INTERNAL_LTLIBS) \
libsss_test_common.la
+sbus_codegen_tests_SOURCES = \
+ src/tests/sbus_codegen_tests.c \
+ src/tests/sbus_codegen_tests_generated.c \
+ src/tests/sbus_codegen_tests_generated.h
+sbus_codegen_tests_CFLAGS = \
+ $(CHECK_CFLAGS)
+sbus_codegen_tests_LDADD = \
+ $(SSSD_INTERNAL_LTLIBS) \
+ $(SSSD_LIBS) \
+ $(CHECK_LIBS)
+
if HAVE_CMOCKA
TEST_MOCK_RESP_OBJ = \