00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __DBUSXX_CONNECTION_H
00026 #define __DBUSXX_CONNECTION_H
00027
00028 #include <list>
00029
00030 #include "api.h"
00031 #include "types.h"
00032 #include "util.h"
00033 #include "message.h"
00034 #include "pendingcall.h"
00035
00036 namespace DBus {
00037
00038 class Connection;
00039
00040 typedef Slot<bool, const Message&> MessageSlot;
00041
00042 typedef std::list<Connection> ConnectionList;
00043
00044 class ObjectAdaptor;
00045 class Dispatcher;
00046
00047 class DXXAPI Connection
00048 {
00049 public:
00050
00051 static Connection SystemBus();
00052
00053 static Connection SessionBus();
00054
00055 static Connection ActivationBus();
00056
00057 struct Private;
00058
00059 typedef std::list<Private*> PrivatePList;
00060
00061 Connection( Private* );
00062
00063 Connection( const char* address, bool priv = true );
00064
00065 Connection( const Connection& c );
00066
00067 virtual ~Connection();
00068
00069 Dispatcher* setup( Dispatcher* );
00070
00071 bool operator == ( const Connection& ) const;
00072
00129 void add_match( const char* rule );
00130
00143 void remove_match( const char* rule );
00144
00156 bool add_filter( MessageSlot& s);
00157
00167 void remove_filter( MessageSlot& s);
00168
00199 bool unique_name( const char* n );
00200
00216 const char* unique_name() const;
00217
00262 bool register_bus();
00263
00275 bool connected() const;
00276
00314 void disconnect();
00315
00328 void exit_on_disconnect( bool exit );
00329
00333 void flush();
00334
00355 bool send( const Message& msg, unsigned int* serial = NULL );
00356
00382 Message send_blocking( Message& msg, int timeout = -1);
00383
00409 PendingCall send_async( Message& msg, int timeout = -1);
00410
00411 void request_name( const char* name, int flags = 0 );
00412
00413 unsigned long sender_unix_uid(const char *sender);
00414
00428 bool has_name( const char* name );
00429
00446 bool start_service( const char* name, unsigned long flags );
00447
00448 const std::vector<std::string>& names();
00449
00450 private:
00451
00452 DXXAPILOCAL void init();
00453
00454 private:
00455
00456 RefPtrI<Private> _pvt;
00457
00458 friend class ObjectAdaptor;
00459 };
00460
00461 }
00462
00463 #endif//__DBUSXX_CONNECTION_H