Using corba IDL to describe DBus services ?

Thiago Macieira thiago at kde.org
Wed Mar 28 11:21:58 PDT 2007


Havoc Pennington wrote:
>One thing we probably should do is establish a method for installing
>clean introspection files so users of static languages can generate
>proxies at compile time. This is a kind of limited compile-time-only
>type repository. I think there's quite a bit of discussion in the
>archives about how this might be done, but not sure there are any
>patches yet.

There's no patch needed. We just need to define where to install those 
files. KDE trunk (to-be-4.0) is already installing XML introspection 
files to $prefix/share/dbus-1/interfaces

$ ls ~/KDE4/share/dbus-1/interfaces
org.freedesktop.ScreenSaver.xml        org.kde.konsole.Konsole.xml
org.kde.FavIcon.xml                    
org.kde.konsole.SessionScripting.xml
org.kde.KCookieServer.xml              org.kde.konsole.Session.xml
org.kde.KDEPrint.KMFactory.xml         org.kde.KPager.xml
org.kde.kdesktop.Background.xml        org.kde.KResourcesManager.xml
org.kde.kdesktop.Desktop.xml           org.kde.krunner.Interface.xml
org.kde.kdialog.ProgressDialog.xml     org.kde.KSMServerInterface.xml
org.kde.KDirNotify.xml                 org.kde.KSpeech.xml
org.kde.khelpcenter.kcmhelpcenter.xml  org.kde.KSplash.xml
org.kde.KHTMLPart.xml                  org.kde.KWin.xml
org.kde.KIMIface.xml                   
org.kde.libkonq.KonqHistoryManager.xml
org.kde.KIO.Observer.xml               org.kde.libkonq.UndoManager.xml
org.kde.KIO.UIServer.xml               org.kde.MediaManager.xml
org.kde.KLauncher.xml                  org.kde.nsplugins.CallBack.xml
org.kde.KMediaPlayer.xml               org.kde.nsplugins.class.xml
org.kde.Konqueror.MainWindow.xml       org.kde.nsplugins.instance.xml
org.kde.Konqueror.Main.xml             org.kde.nsplugins.viewer.xml
org.kde.konqueror.Preloader.xml        org.kde.Phonon.AudioOutput.xml
org.kde.konsole.KonsoleScripting.xml

Some of those aren't technically public and shouldn't be installed.

If you are talking about the org.freedesktop.DBus.* XML files, I am not 
sure we have to. Most bindings already have a static class for the D-Bus 
bus's interfaces.

>I believe DCOP did not have separate IDL files, it just scanned the
>QObjects (the same way I mentioned a D-Bus binding would ideally work).
>GNOME did not use IPC nearly as pervasively as KDE, in part because I
>think the CORBA IDL approach made it too clunky, which means it was
>relatively easy to port.

There was one "kidl" file for DCOP. But it wasn't even close IDL: it was 
SGML. So it's actually closer to our XML files.

But no one used them. The building of DCOP classes was rather complicated 
(and has been translated into D-Bus for us), but it mostly started with 
the C++ programmer writing what he knows: C++ code:

1) programmer writes a .h header containing a C++ class that derives from 
DCOPObject

2) the buildsystem parses that .h with dcopidl and produces the .kidl file

3) from the .kidl file, with dcopidl2cpp, we produce either a 
classname_skel.{h,cpp} file or a classname_stub.{h,cpp}. Skeletons are 
server-side and stubs are client-side (i.e., proxies). Both classes 
inherit from the original class from #1.

This has translated to D-Bus as:

[optional] 1) programmer writes a .h header containing a C++ class that 
derives from QObject

[optional] 2) the buildsystem parses that .h with qdbuscpp2xml and 
produces a .xml file

3) from the .xml file, with qdbusxml2cpp, we produce either a 
classname_adaptor.{h,cpp} or a classname_iface.{h,cpp}. Adaptors are 
server-side and interfaces client-side (proxies). The original .h file is 
not used.

If you use the adaptor header generated in step #3 as input in #1, it'll 
be an idempotent process. So this can be used to hand-write a D-Bus 
server-side interface in C++ and then generate the client-side code.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070328/5083d6c3/attachment.pgp


More information about the dbus mailing list