153 typedef QList<QPair<DBusTimeout *, int> > PendingTimeoutList; |
153 typedef QList<QPair<DBusTimeout *, int> > PendingTimeoutList; |
154 |
154 |
155 typedef QMultiHash<QString, SignalHook> SignalHookHash; |
155 typedef QMultiHash<QString, SignalHook> SignalHookHash; |
156 typedef QHash<QString, QDBusMetaObject* > MetaObjectHash; |
156 typedef QHash<QString, QDBusMetaObject* > MetaObjectHash; |
157 typedef QHash<QByteArray, int> MatchRefCountHash; |
157 typedef QHash<QByteArray, int> MatchRefCountHash; |
158 typedef QHash<QString, int> WatchedServicesHash; |
158 |
|
159 struct WatchedServiceData { |
|
160 WatchedServiceData() : refcount(0) {} |
|
161 QString owner; |
|
162 int refcount; |
|
163 }; |
|
164 typedef QHash<QString, WatchedServiceData> WatchedServicesHash; |
159 |
165 |
160 public: |
166 public: |
161 // public methods are entry points from other objects |
167 // public methods are entry points from other objects |
162 explicit QDBusConnectionPrivate(QObject *parent = 0); |
168 explicit QDBusConnectionPrivate(QObject *parent = 0); |
163 ~QDBusConnectionPrivate(); |
169 ~QDBusConnectionPrivate(); |
175 QDBusMessage sendWithReply(const QDBusMessage &message, int mode, int timeout = -1); |
181 QDBusMessage sendWithReply(const QDBusMessage &message, int mode, int timeout = -1); |
176 QDBusMessage sendWithReplyLocal(const QDBusMessage &message); |
182 QDBusMessage sendWithReplyLocal(const QDBusMessage &message); |
177 QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1); |
183 QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1); |
178 int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, |
184 int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, |
179 const char *returnMethod, const char *errorMethod, int timeout = -1); |
185 const char *returnMethod, const char *errorMethod, int timeout = -1); |
180 bool connectSignal(const QString &service, const QString &owner, const QString &path, const QString& interface, |
186 bool connectSignal(const QString &service, const QString &path, const QString& interface, |
181 const QString &name, const QStringList &argumentMatch, const QString &signature, |
187 const QString &name, const QStringList &argumentMatch, const QString &signature, |
182 QObject *receiver, const char *slot); |
188 QObject *receiver, const char *slot); |
183 void connectSignal(const QString &key, const SignalHook &hook); |
189 void connectSignal(const QString &key, const SignalHook &hook); |
184 SignalHookHash::Iterator disconnectSignal(SignalHookHash::Iterator &it); |
190 SignalHookHash::Iterator disconnectSignal(SignalHookHash::Iterator &it); |
185 bool disconnectSignal(const QString &service, const QString &path, const QString& interface, |
191 bool disconnectSignal(const QString &service, const QString &path, const QString& interface, |
186 const QString &name, const QStringList &argumentMatch, const QString &signature, |
192 const QString &name, const QStringList &argumentMatch, const QString &signature, |
187 QObject *receiver, const char *slot); |
193 QObject *receiver, const char *slot); |
188 void registerObject(const ObjectTreeNode *node); |
194 void registerObject(const ObjectTreeNode *node); |
189 void connectRelay(const QString &service, const QString ¤tOwner, |
195 void connectRelay(const QString &service, |
190 const QString &path, const QString &interface, |
196 const QString &path, const QString &interface, |
191 QDBusAbstractInterface *receiver, const char *signal); |
197 QDBusAbstractInterface *receiver, const char *signal); |
192 void disconnectRelay(const QString &service, const QString ¤tOwner, |
198 void disconnectRelay(const QString &service, |
193 const QString &path, const QString &interface, |
199 const QString &path, const QString &interface, |
194 QDBusAbstractInterface *receiver, const char *signal); |
200 QDBusAbstractInterface *receiver, const char *signal); |
195 |
201 |
196 bool handleMessage(const QDBusMessage &msg); |
202 bool handleMessage(const QDBusMessage &msg); |
197 void waitForFinished(QDBusPendingCallPrivate *pcall); |
203 void waitForFinished(QDBusPendingCallPrivate *pcall); |
220 void sendError(const QDBusMessage &msg, QDBusError::ErrorType code); |
226 void sendError(const QDBusMessage &msg, QDBusError::ErrorType code); |
221 void deliverCall(QObject *object, int flags, const QDBusMessage &msg, |
227 void deliverCall(QObject *object, int flags, const QDBusMessage &msg, |
222 const QList<int> &metaTypes, int slotIdx); |
228 const QList<int> &metaTypes, int slotIdx); |
223 |
229 |
224 bool isServiceRegisteredByThread(const QString &serviceName) const; |
230 bool isServiceRegisteredByThread(const QString &serviceName) const; |
|
231 |
|
232 QString getNameOwnerNoCache(const QString &service); |
225 |
233 |
226 protected: |
234 protected: |
227 void customEvent(QEvent *e); |
235 void customEvent(QEvent *e); |
228 void timerEvent(QTimerEvent *e); |
236 void timerEvent(QTimerEvent *e); |
229 |
237 |
282 |
290 |
283 public: |
291 public: |
284 // static methods |
292 // static methods |
285 static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int>& params); |
293 static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int>& params); |
286 static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, |
294 static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, |
287 const QString &service, const QString &owner, |
295 const QString &service, |
288 const QString &path, const QString &interface, const QString &name, |
296 const QString &path, const QString &interface, const QString &name, |
289 const QStringList &argMatch, |
297 const QStringList &argMatch, |
290 QObject *receiver, const char *signal, int minMIdx, |
298 QObject *receiver, const char *signal, int minMIdx, |
291 bool buildSignature); |
299 bool buildSignature); |
292 static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *); |
300 static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *); |