- void createClassInfo(QObject *obj);
- void setArgTypes(QObject* obj, int methodId);
- void setMethodName(QObject* obj, int methodId);
-
- void receivePeerSignal(const QVariant &packedFunc);
-
- void _detachSignals(QObject *sender);
- void _detachSlots(QObject *receiver);
-
- // containg a list of argtypes for fast access
- QHash<QByteArray, ClassInfo*> _classInfo;
-
- // we use one introSpector per QObject
- QHash<QObject*, ClassIntrospector*> _specHash;
-
- // RPC function -> (object, slot ID)
- typedef QPair<QObject*, int> MethodId;
- typedef QMultiHash<QByteArray, MethodId> SlotHash;
- SlotHash _attachedSlots;
-
-
- // Hash of used QIODevices
- QHash<QIODevice*, quint32> _peerByteCount;
-
- int _rpcType;
- int _maxClients;
+ template<class T>
+ class PeerMessageEvent;
+
+ void init();
+ void initServer();
+ void initClient();
+
+ static const QMetaObject *metaObject(const QObject *obj);
+
+ void removePeer(Peer *peer);
+ void removeAllPeers();
+
+ template<class T>
+ void dispatch(const T &protoMessage);
+ template<class T>
+ void dispatch(Peer *peer, const T &protoMessage);
+
+ void handle(Peer *peer, const Protocol::SyncMessage &syncMessage);
+ void handle(Peer *peer, const Protocol::RpcCall &rpcCall);
+ void handle(Peer *peer, const Protocol::InitRequest &initRequest);
+ void handle(Peer *peer, const Protocol::InitData &initData);
+
+ template<class T>
+ void handle(Peer *, T) { Q_ASSERT(0); }
+
+ bool invokeSlot(QObject *receiver, int methodId, const QVariantList ¶ms, QVariant &returnValue, Peer *peer = 0);
+ bool invokeSlot(QObject *receiver, int methodId, const QVariantList ¶ms = QVariantList(), Peer *peer = 0);
+
+ void requestInit(SyncableObject *obj);
+ QVariantMap initData(SyncableObject *obj) const;
+ void setInitData(SyncableObject *obj, const QVariantMap &properties);
+
+ static void disconnectDevice(QIODevice *dev, const QString &reason = QString());
+
+ QSet<Peer *> _peers;
+
+ // containg a list of argtypes for fast access
+ QHash<const QMetaObject *, ExtendedMetaObject *> _extendedMetaObjects;
+
+ // SignalRelay for all manually attached signals
+ SignalRelay *_signalRelay;
+
+ // RPC function -> (object, slot ID)
+ typedef QPair<QObject *, int> MethodId;
+ typedef QMultiHash<QByteArray, MethodId> SlotHash;
+ SlotHash _attachedSlots;
+
+ // slaves for sync
+ typedef QHash<QString, SyncableObject *> ObjectId;
+ QHash<QByteArray, ObjectId> _syncSlave;
+
+ ProxyMode _proxyMode;
+ int _heartBeatInterval;
+ int _maxHeartBeatCount;
+
+ bool _secure; // determines if all connections are in a secured state (using ssl or internal connections)
+
+ friend class SignalRelay;
+ friend class SyncableObject;
+ friend class Peer;