1 #ifndef TORCNETWORKEDCONTEXT_H 2 #define TORCNETWORKEDCONTEXT_H 6 #include <QReadWriteLock> 7 #include <QHostAddress> 36 static
bool WeActAsServer (
int Priority, qint64 StartTime, const QString &UUID);
37 TorcNetworkService(const QString &Name, const QString &UUID,
int Port,
bool Secure, const QList<QHostAddress> &Addresses);
76 void SetHost (const QString &Host);
86 QVariant
ToMap (
void);
90 void ScheduleRetry (
void);
91 void QueryPeerDetails (
void);
105 ServiceSources m_sources;
106 QString m_debugString;
107 QList<QHostAddress> m_addresses;
108 int m_preferredAddressIndex;
113 bool m_retryScheduled;
126 Q_CLASSINFO(
"Version",
"1.0.0")
127 Q_CLASSINFO("GetPeers", "type=peers")
128 Q_PROPERTY(QVariantList peers READ GetPeers NOTIFY PeersChanged)
136 QString GetUIName (
void);
139 void PeersChanged (
void);
140 void PeerConnected (QString &Name, QString &UUID);
141 void PeerDisconnected (QString &Name, QString &UUID);
144 void RequestCancelled (const QString &UUID,
TorcRPCRequest *Request);
147 QVariantList GetPeers (
void);
148 void SubscriberDeleted (QObject *Subscriber);
152 void HandleNewRequest (const QString &UUID,
TorcRPCRequest *Request);
153 void HandleCancelRequest (const QString &UUID,
TorcRPCRequest *Request);
157 ~TorcNetworkedContext();
161 bool event (QEvent* Event);
164 Q_DISABLE_COPY(TorcNetworkedContext)
170 QList<QString> m_serviceList;
176 #endif // TORCNETWORKEDCONTEXT_H void SetSource(ServiceSource Source)
A class to encapsulate an incoming HTTP request.
static bool WeActAsServer(int Priority, qint64 StartTime, const QString &UUID)
Determine whether we (the local device) should be the server for peer to peer communications.
void SetAPIVersion(const QString &Version)
void RemoteRequest(TorcRPCRequest *Request)
Overlays the Websocket protocol over a QTcpSocket.
void RemoveSource(ServiceSource Source)
void SetHost(const QString &Host)
QList< QHostAddress > GetAddresses(void)
A wrapper around QNetworkRequest.
void Connect(void)
Establish a WebSocket connection to the peer if necessary.
A class encapsulating a Remote Procedure Call.
void CancelRequest(TorcRPCRequest *Request)
Encapsulates information on a discovered Torc peer.
void PriorityChanged(void)
void SetPriority(int Priority)
void SetStartTime(qint64 StartTime)
QString GetAPIVersion(void)
void StartTimeChanged(void)
void ConnectedChanged(void)
qint64 GetStartTime(void)
void RequestReady(TorcNetworkRequest *Request)
void SetWebSocketThread(TorcWebSocketThread *Thread)
TorcNetworkedContext * gNetworkedContext
ServiceSources GetSources(void)
void ApiVersionChanged(void)
Wraps a TorcQThread around a TorcWebsocket.
A class to discover and connect to other Torc applications.