connection.h
Go to the documentation of this file.
1/*
2 *
3 * D-Bus++ - C++ bindings for D-Bus
4 *
5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
6 *
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24
25#ifndef __DBUSXX_CONNECTION_H
26#define __DBUSXX_CONNECTION_H
27
28#include <list>
29
30#include "api.h"
31#include "types.h"
32#include "util.h"
33#include "message.h"
34#include "pendingcall.h"
35
36namespace DBus
37{
38
39class Connection;
40
42
43typedef std::list<Connection> ConnectionList;
44
45class ObjectAdaptor;
46class Dispatcher;
47
49{
50public:
51
52 static Connection SystemBus();
53
54 static Connection SessionBus();
55
56 static Connection ActivationBus();
57
58 struct Private;
59
60 typedef std::list<Private *> PrivatePList;
61
62 Connection(Private *);
63
64 Connection(const char *address, bool priv = true);
65
66 Connection(const Connection &c);
67
68 virtual ~Connection();
69
70 Dispatcher *setup(Dispatcher *);
71
72 bool operator == (const Connection &) const;
73
130 void add_match(const char *rule);
131
144 void remove_match(const char *rule, bool throw_on_error);
145
157 bool add_filter(MessageSlot &s);
158
168 void remove_filter(MessageSlot &s);
169
200 bool unique_name(const char *n);
201
217 const char *unique_name() const;
218
263 bool register_bus();
264
276 bool connected() const;
277
315 void disconnect();
316
329 void exit_on_disconnect(bool exit);
330
334 void flush();
335
356 bool send(const Message &msg, unsigned int *serial = NULL);
357
383 Message send_blocking(Message &msg, int timeout = -1);
384
410 PendingCall send_async(Message &msg, int timeout = -1);
411
412 void request_name(const char *name, int flags = 0);
413
414 unsigned long sender_unix_uid(const char *sender);
415
429 bool has_name(const char *name);
430
447 bool start_service(const char *name, unsigned long flags);
448
449 const std::vector<std::string>& names();
450
451 void set_timeout(int timeout);
452
453 int get_timeout();
454
455private:
456
458
459private:
460
463
464 friend class ObjectAdaptor; // needed in order to register object paths for a connection
465};
466
467} /* namespace DBus */
468
469#endif//__DBUSXX_CONNECTION_H
#define DXXAPILOCAL
Definition: api.h:32
#define DXXAPI
Definition: api.h:36
Slot< bool, const Message & > MessageSlot
Definition: connection.h:41
std::list< Connection > ConnectionList
Definition: connection.h:43
Connection(Private *)
RefPtrI< Private > _pvt
Definition: connection.h:461
std::list< Private * > PrivatePList
Definition: connection.h:60
DXXAPILOCAL void init()
const std::vector< std::string > & names()