File: DBusKit_1.html

package info (click to toggle)
dbuskit 0.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 3,552 kB
  • sloc: objc: 10,309; sh: 9,443; ansic: 200; makefile: 20
file content (494 lines) | stat: -rw-r--r-- 30,307 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on April 14, 2013 by texi2html 1.82
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>GNUstep D-Bus Programming Manual: 1. Introduction</title>

<meta name="description" content="GNUstep D-Bus Programming Manual: 1. Introduction">
<meta name="keywords" content="GNUstep D-Bus Programming Manual: 1. Introduction">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="Introduction"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#An-IPC-primer" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Introduction-1"></a>
<h1 class="chapter">1. Introduction</h1>

<p>The aim of this manual is to familiarise the reader with the concepts
and tools necessary to successfully integrate a GNUstep application into
a desktop environment based around message exchange through the D-Bus
messaging bus facilities. The manual tries to give succinct explanation
of the concepts involved, providing illustrative examples whenever
possible.
</p>
<p>It will be most useful to a reader who has basic working
knowledge of the Objective-C programming language and the OpenStep APIs
(either from the GNUstep implementation or from Apple&rsquo;s Cocoa). In depth
knowledge of the Distributed Objects system or D-Bus is also beneficial
but not required.
</p>
<hr size="6">
<a name="An-IPC-primer"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Introduction" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Distributed-Objects" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Introduction" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">1.1 An IPC primer</h2>
<a name="index-IPC"></a>
<a name="index-inter_002dprocess-communication"></a>
<p>A typical modern computer system executes multiple units of computation
at the same time. Even with a single-core CPU, the operating system will
constantly switch between different units of computation by employing
different multitasking strategies. This approach has a number of
advantages, e.g.:
</p><ul>
<li>
It facilitates isolation of processes from one another: A
malignant process cannot easily modify the memory of other processes on
the system.
</li><li>
It allows privilege separation: It is not necessary that a
web-browser has the same rights as a partitioning utility. Running both
in different processes allows the operating system to assign different
privileges to both.
</li><li>
It increases modularity: You can easily change one part of the
software on your computer without disturbing the other parts.
</li><li>
 If the computer has more than one CPU, computation can be sped up
by running more than one process (or thread) in parallel.
</li></ul>
<p>To leverage these advantages effectively, different processes or
applications need a mechanism for inter-process communication (IPC) that
allows them to exchange information (and ensure synchronisation if
needed). 
</p>
<a name="index-message-passing"></a>
<p>One way to implement an IPC mechanism is by using the message passing
paradigm. Entities in a message passing system communicate by exchanging
messages with each other, which makes it a natural fit for object
oriented languages, where the basic abstraction is the object.
</p>
<p>The message passing paradigm is also used in Objective-C (actually
Objective-C inherited it from Smalltalk), where you interact with
objects by sending messages to them. E.g. the intended meaning of
</p><table><tr><td>&nbsp;</td><td><pre class="example">[alice greet];
</pre></td></tr></table>
<p>would be sending the <code>-greet</code> message to the <code>alice</code> object,
which is referred to as the <em>receiver</em> of the message. This idiom
can be quite easily extended beyond the single process case, which the
NeXT did by including the <em>Distributed Objects</em> system in the
OpenStep specification that GNUstep implements. The message passing
paradigm is also employed by D-Bus, and we will look at the similarities
and differences of both systems in the following sections.
</p>
<hr size="6">
<a name="Distributed-Objects"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#An-IPC-primer" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#D_002dBus" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Introduction" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">1.2 Distributed Objects</h2>
<a name="index-Distributed-Objects"></a>
<a name="index-DO"></a>

<p>The GNUstep Distributed Objects (DO) System is designed to go out of a
programmer&rsquo;s way. Since ordinary (intra-process) usage Objective-C
already has message passing semantics, Distributed Objects simply
extends these semantics to objects in other processes.
</p>
<p>This works by usage of the proxy design pattern. A proxy is a stand-in
object that receives messages <em>in lieu</em> of another object and
forwards them (most likely after processing them as it sees fit). In the
case of Distributed Objects, the proxy will take the message that is
being sent to the remote object, encode it a <code>NSInvocation</code>
object and send a serialised version of the invocation to the remote
process where it is invoked on the receiver it was initially intended
for. 
</p>
<p>Establishing a connection to a remote object using DO is thus a simple
three step process:
</p><ol>
<li> Look up a process that exposes (&rsquo;vends&rsquo;, in DO parlance) an object.
</li><li> Establish a communication channel to the process.
</li><li> Create a proxy object to send messages to the remote object.
</li></ol>
<p>Afterwards, the generated proxy can be used just like any in-process
object.
</p>
<p>Task 1. involves the <code>NSPortNameServer</code> class which can be used to
obtain a communication endpoint (<code>NSPort</code>) to a service with a
specific name: 
</p><table><tr><td>&nbsp;</td><td><pre class="example">NSPort *sendPort = [[NSPortNameServer systemDefaultPortNameServer]
  portForName: @&quot;MyService&quot;];
</pre></td></tr></table>
<p>Task 2. involves <code>NSPort</code> and <code>NSConnection</code>. While the former
is concerned with the low-level details of encoding messages to a wire
format, the latter manages sending messages over ports. A connection to
the above <code>MyService</code> using the created <code>sendPort</code> could be
obtained like this:
</p><table><tr><td>&nbsp;</td><td><pre class="example">NSConnection *c = [NSConnection connectionWithReceivePort: [NSPort port]
                                                 sendPort: sendPort];
</pre></td></tr></table>

<p>Task 3. is done by calling <code>-rootProxy</code> on the <code>NSConnection</code>
object. This will return an instance of <code>NSDistantObject</code>: A proxy
that will use <code>NSConnection</code> and <code>NSPort</code> to forward messages
to the remote object.
</p><table><tr><td>&nbsp;</td><td><pre class="example">id remoteObject = [c rootProxy];
</pre></td></tr></table>

<p>The DO mode of operation has a few notable advantages:
</p><ul>
<li> Usual message passing semantics apply.
</li><li> The native Objective-C type system is used in both processes. No
type conversion is necessary.
</li><li> New objects can be vended implicitly by returning them from the
root proxy. New proxies will be created automatically for them.
</li><li> DO can make intelligent decisions about the remote objects: If
process <em>A</em> has vended object <em>O</em> to process <em>B</em>
(yielding the proxy <em>P(O)</em>), and <em>B</em>  latter vends
<em>P(O)</em> to <em>A</em>, <em>A</em> will not use <em>P(P(O))</em>, but its
local reference to <em>O</em>.
</li></ul>
<p>It goes without saying that DO is pretty useful and GNUstep uses it in
many places. It drives, for example, the services architecture, the pasteboard
server, or the distributed notification system. For further information
about DO, please consult the
<a href="../../Base/ProgrammingManual/manual_7.html">Objective-C GNUstep Base Programming Manual</a>. We will now turn our attention to the D-Bus
IPC system.
</p>
<hr size="6">
<a name="D_002dBus"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Distributed-Objects" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Message-Busses" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Introduction" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">1.3 D-Bus</h2>
<a name="index-D_002dBus"></a>

<p>Distributed Objects has already been part of NeXT&rsquo;s OpenStep
Specification, which appeared in 1994 and thus predates the D-Bus IPC
system for quite some time.  But while DO is only useful in an
Objective-C context, D-Bus was created to suit the needs of desktop
environments such as KDE or GNOME, which use (among others) C or
C++ as their core programming languages. 
</p><hr size="6">
<a name="Message-Busses"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#D_002dBus" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Services" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#D_002dBus" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">1.3.1 Message Busses</h3>
<a name="index-message-bus"></a>
<p>One core concept of D-Bus is that of the message bus. A standard desktop
system that uses D-Bus usually has two active message buses, dubbed the
<em>well-known buses</em>. One is the <em>system bus</em>, to which
system-wide services connect, the other is the <em>session bus</em> which
is started per user session and allows applications on the user&rsquo;s
desktop to communicate. 
</p>
<p>The purpose of a bus, which is running as a separate process (the
<em>dbus-daemon</em>), is to provide name-services to the connected
applications and route messages between them.
</p><hr size="6">
<a name="Services"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Message-Busses" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Object-Paths" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#D_002dBus" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">1.3.2 Services</h3>
<a name="index-service_002c-D_002dBus"></a>
<a name="index-D_002dBus-service"></a>
<p>A process that connects to a message bus is considered to be a
<em>service</em>, even if it will not expose any object to the bus. A
unique name, which starts with a colon (e.g. <em>:1.1</em>) and is
required for message routing, will be assigned to every service by the
bus. The service can also request further names from the bus. A text
editor might, for example, want to request the name
<em>org.gnustep.TextEditor</em> from the bus. These names are referred to
as <em>well-known names</em> and usually utilise reverse-DNS notation.
</p>
<p>These names can be subject to different assignment policies. A service
can specify that it wants to be queued for a name that has already be
assigned. It will then become the owner of the name when the last
previous owner exits or releases the name. Alternatively, the service
can request to replace an existing name, a feature that can be used to
ensure that only one application of a specific type is running (as would
be the case for, e.g., a screensaver).
</p><hr size="6">
<a name="Object-Paths"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Services" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Interfaces" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#D_002dBus" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">1.3.3 Object Paths</h3>
<a name="index-object-path_002c-D_002dBus"></a>
<a name="index-D_002dBus-object-path"></a>

<p>When using DO, the object graph vended by a service is generated
implicitly: If a message send to a remote object returns another object,
that object will implicitly be vended and wrapped in a proxy for use by
the other process. D-Bus operates quite differently in that respect:
Every object needs to be assigned a name that can be used by remote
processes to interact with the object. These object names are organised
in the directory-like structure, where each object is uniquely
identified by its <em>object path</em>. The UDisks service
(<em>org.freedesktop.UDisks</em>) on the system bus does, for example,
expose different disks of a computer at different paths:
</p><table><tr><td>&nbsp;</td><td><pre class="example">/org/freedesktop/UDisks/devices/sda
/org/freedesktop/UDisks/devices/sdb
</pre></td></tr></table>
<p>It is worth noting that it is a D-Bus convention to have the root object
of the service not reside at the root path (&ldquo;/&rdquo;) but at one that
corresponds to the service name with all dots replaced by the path
separator. Thus you don not access the root object of
<em>org.freedesktop.UDisks</em> at &ldquo;/&rdquo; but at &ldquo;/org/freedesktop/UDisks&rdquo;.
The reason for this is to ensure proper name-spacing if different code
modules in a single process have registered multiple names on the bus
(which will all point to the same unique name).
</p><hr size="6">
<a name="Interfaces"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Object-Paths" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Type-System" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#D_002dBus" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">1.3.4 Interfaces</h3>
<a name="index-interface_002c-D_002dBus"></a>
<a name="index-D_002dBus-interface"></a>
<p>D-Bus object-path nodes are the receivers and senders of D-Bus messages.
They receive calls to methods and emit signals, which are broadcast by
the bus and can be watched for by other applications. These methods and
signals can be aggregated into <em>interfaces</em>, which are a bit, but
not quite, like Objective-C protocols. One interface that almost every
D-Bus object implements is <em>org.freedesktop.Introspectable</em>, which
has as its sole member the <code>Introspect()</code>-method. This will return
XML-encoded information about all methods, signals, and properties the
object exposes. 
</p>
<p>Interfaces are also used as namespaces for their members: Identically
named methods with different implementations are allowed to appear in
multiple interfaces, something that is not possible with Objective-C
protocols.
</p>
<hr size="6">
<a name="Type-System"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Interfaces" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Comparison" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#D_002dBus" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">1.3.5 Type System</h3>
<a name="index-type-system_002c-D_002dBus"></a>
<a name="index-D_002dBus-type-system"></a>
<p>For arguments and values of methods, signals, and properties, D-Bus
defines its own type system, which is similar to the C type system. It
contains integer and floating point types of different sizes as well as
array and structure types. The type system represents dictionaries as
arrays of ordered pairs. Additionally, there is a type available for
references to objects (but these references are only valid within a
single service) and a variant type that, just like Objective-C&rsquo;s
<code>id</code>, allows for values of arbitrary types. This type system has to
be adopted by any application that wants to interface with D-Bus.
</p>
<hr size="6">
<a name="Comparison"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Type-System" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Introduction" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">1.4 Comparison</h2>

<table>
<thead><tr><th width="22%">Feature</th><th width="39%">Distributed Objects</th><th width="39%">D-Bus</th></tr></thead>
<tr><td width="22%">IPC paradigm</td><td width="39%">message passing</td><td width="39%">message passing</td></tr>
<tr><td width="22%">type system</td><td width="39%">native Objective-C type system</td><td width="39%">custom D-Bus
type system (C-like)</td></tr>
<tr><td width="22%">supported programming languages</td><td width="39%">Objective-C<a name="DOCF1" href="DBusKit_fot.html#FOOT1">(1)</a></td><td width="39%">many languages through bindings</td></tr>
<tr><td width="22%">polymorphism</td><td width="39%">no special provisions</td><td width="39%">through overloaded method names in
different interfaces</td></tr>
<tr><td width="22%">object-graph generation</td><td width="39%">implicit</td><td width="39%">explicit with named
objects</td></tr>
<tr><td width="22%">name service</td><td width="39%">provided by separate nameserver objects</td><td width="39%">integrated</td></tr>
<tr><td width="22%">delivery of broadcast information</td><td width="39%">distributed notification
system implemented on top of DO</td><td width="39%">integrated as D-Bus signals</td></tr>
</table>


<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Introduction" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_2.html#Using-D_002dBus-From-Objective_002dC" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="DBusKit.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_5.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="DBusKit_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>Niels Grewe</em> on <em>April 14, 2013</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
 </font>
 <br>

</p>
</body>
</html>