1dbus-binding-tool(1) User Commands dbus-binding-tool(1)
2
3
4
6 dbus-binding-tool - C language GLib bindings generation utility.
7
9 dbus-binding-tool [--force] [--help] [--ignore-unsupported]
10 [--mode=pretty|glib-client|glib-server] [--output=file] [--prefix=sym‐
11 bol-prefix] [--version] [file...]
12
14 dbus-binding-tool is used to expose a GObject via D-Bus. As input,
15 dbus-binding-tool uses a D-Bus Introspection XML file. As output, the
16 client-side or server-side bindings is generated. This output is a
17 header file which eases the use of a remote D-Bus object. Output is
18 sent to standard out or to the filename specified with the --output
19 argument.
20
22
23 The following is a sample D-Bus Introspection XML file which describes
24 an object that exposes one method, named ManyArgs:
25
26 <?xml version="1.0" encoding="UTF-8" ?>
27 <node name="/com/example/MyObject">
28 <interface name="com.example.MyObject">
29 <method name="ManyArgs">
30 <arg type="u" name="x" direction="in" />
31 <arg type="s" name="str" direction="in" />
32 <arg type="d" name="trouble" direction="in" />
33 <arg type="d" name="d_ret" direction="out" />
34 <arg type="s" name="str_ret" direction="out" />
35 </method>
36 </interface>
37 </node>
38
39 dbus-binding-tool supports annotations in the XML format to further
40 control how the bindings are generated.
41
42 client-side bindings
43 When building client-side bindings, the --mode=glib-client argument is
44 used. The client-side bindings support the "org.freedesk‐
45 top.DBus.Glib.NoReply" annotation. This is specified within the
46 <method> tag to indicate that the client is not expecting a reply to
47 the method call, so a reply should not be sent. This is often used to
48 speed up rapid method calls where there are no "out" arguments, and not
49 knowing if the method succeeded is an acceptable compromise to halve
50 the traffic on the bus. For example:
51
52 <method name "FooMethod">
53 [...]
54 <annotation name="org.freedesktop.DBus.GLib.NoReply" value="yes"/>
55 [...]
56 </method>
57
58 server-side bindings
59 When building server-side bindings, the --mode=glib-server argument is
60 used. Also the --prefix argument must be used when building server-
61 side bindings so that functions in the generated output are prefexed
62 with the specified value. The server-side bindings support the follow‐
63 ing annotations:
64
65 "org.freedesktop.DBus.GLib.CSymbol"
66
67 This annotation is used to specify the C symbol names for the various
68 types (interface, method, etc.), if it differs from the name D-Bus gen‐
69 erates.
70
71 <interface name="com.example.MyObject">
72 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object"/>
73 [...]
74 <method name "ManyArgs">
75 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_many_args"/>
76 [...]
77 </method>
78 </interface>
79
80 "org.freedesktop.DBus.GLib.Async"
81
82 This annotation marks the method implementation as an asynchronous
83 function, which does not return a response straight away but will send
84 the response at some later point to complete the call. This is used to
85 implement non-blocking services where method calls can take time.
86
87 When a method is asynchronous, the function prototype is different. It
88 is required that the function conform to the following rules:
89
90 · The function must return a value of type gboolean; TRUE on suc‐
91 cess, and FALSE otherwise.
92 · The first parameter is a pointer to an instance of the object.
93 · Following the object instance pointer are the method input values.
94 · The final parameter must be a (DBusGMethodInvocation *). This is
95 used when sending the response message back to the client, by
96 calling dbus_g_method_return or dbus_g_method_return_error.
97
98 For example:
99
100 <method name "FooMethod">
101 [...]
102 <annotation name="org.freedesktop.DBus.GLib.Async" value="yes"/>
103 [...]
104 </method>
105
106 "org.freedesktop.DBus.GLib.Const"
107
108 This attribute can only be applied to "out" <arg> nodes, and specifies
109 that the parameter is not being copied when returned. For example, this
110 turns a 's' argument from a (char **) to a (const char **), and results
111 in the argument not being freed by D-Bus after the message is sent.
112 For example:
113
114 <arg type="u" name="x" direction="out">
115 <annotation name="org.freedesktop.DBus.GLib.Const" value=""/>
116 </arg>
117
118 "org.freedesktop.DBus.GLib.ReturnVal"
119
120 This attribute can only be applied to "out" <arg> nodes, and alters the
121 expected function signature. It currently can be set to two values: ""
122 or "error". The argument marked with this attribute is not returned via
123 a pointer argument, but by the function's return value. If the
124 attribute's value is the empty string, the (GError *) argument is also
125 omitted so there is no standard way to return an error value. This is
126 very useful for interfacing with existing code, as it is possible to
127 match existing APIs. If the attribute's value is "error", then the
128 final argument is a (GError *) as usual. For example:
129
130 <arg type="u" name="x" direction="out">
131 <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
132 </arg>
133
135 The following options are supported:
136
137 --force
138
139 Overwrite the output file if it already exists with a newer time‐
140 stamp than the source files.
141
142
143
144 --help
145
146 Display usage information.
147
148
149
150 --ignore-unsupported
151
152 If set, then unsupported signatures for <method> parameters are
153 ignored.
154
155
156
157 --mode=pretty|glib-client|glib-server
158
159 If the value is "glib-client", then client bindings are generated.
160 If the value is "glib-server", then server bindings are generated.
161 If the value is "pretty", then the output is in a more human read‐
162 able format.
163
164
165
166 --output=file
167
168 Specify the output file.
169
170
171
172 --prefix=symbol-prefix
173
174 Functions in the generated output are prefixed with the symbol-pre‐
175 fix value.
176
177
178
179 --version
180
181 Display the version number of the dbus-binding-tool command.
182
183
184
186 The following operands are supported:
187
188 file A list of one or more input D-Bus Introspection XML
189 files to include in the generated output.
190
191
192
194 The following files are used by this application:
195
196 /usr/bin/dbus-binding-tool Executable for the D-Bus Binding Tool
197 application.
198
199
200
202 See attributes(5) for descriptions of the following attributes:
203
204
205 ┌─────────────────────────────┬─────────────────────────────┐
206 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
207 ├─────────────────────────────┼─────────────────────────────┤
208 │Availability │SUNWdbus-bindings │
209 ├─────────────────────────────┼─────────────────────────────┤
210 │Interface stability │Volatile │
211 └─────────────────────────────┴─────────────────────────────┘
212
214 dbus-cleanup-sockets(1), dbus-daemon(1), dbus-monitor(1), dbus-send(1),
215 dbus-uuidgen(1), libdbus-glib-1(3), attributes(5)
216
218 Written by Brian Cameron, Sun Microsystems Inc., 2009.
219
220
221
222SunOS 5.11 26 Feb 2009 dbus-binding-tool(1)