Torc  0.1
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Properties | Friends | List of all members
TorcNetworkedContext Class Reference

A class to discover and connect to other Torc applications. More...

#include <torcnetworkedcontext.h>

Inheritance diagram for TorcNetworkedContext:
[legend]

Public Slots

QVariantList GetPeers (void)
 
void SubscriberDeleted (QObject *Subscriber)
 

Signals

void PeersChanged (void)
 
void PeerConnected (QString &Name, QString &UUID)
 
void PeerDisconnected (QString &Name, QString &UUID)
 
void NewPeer (TorcWebSocketThread *Socket, const QVariantMap &Data)
 
void NewRequest (const QString &UUID, TorcRPCRequest *Request)
 
void RequestCancelled (const QString &UUID, TorcRPCRequest *Request)
 

Public Member Functions

QString GetUIName (void)
 
- Public Member Functions inherited from TorcHTTPService
 TorcHTTPService (QObject *Parent, const QString &Signature, const QString &Name, const QMetaObject &MetaObject, const QString &Blacklist=QStringLiteral(""))
 
virtual ~TorcHTTPService ()
 
void ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override
 
QVariantMap ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override
 
QString GetMethod (int Index)
 
QVariant GetProperty (int Index)
 Get the value of a given property. More...
 
QVariantMap GetServiceDetails (void)
 Return a QVariantMap describing the services methods and properties. More...
 
virtual QString GetPresentationURL (void)
 
- Public Member Functions inherited from TorcHTTPHandler
 TorcHTTPHandler (const QString &Signature, const QString &Name)
 
virtual ~TorcHTTPHandler ()
 
QString Signature (void) const
 
bool GetRecursive (void) const
 
QString Name (void) const
 

Static Public Member Functions

static void PeerConnected (TorcWebSocketThread *Thread, const QVariantMap &Data)
 Respond to a valid WebSocket upgrade request and schedule creation of a WebSocket on the give QTcpSocket. More...
 
static void RemoteRequest (const QString &UUID, TorcRPCRequest *Request)
 Pass Request to the remote connection identified by UUID. More...
 
static void CancelRequest (const QString &UUID, TorcRPCRequest *Request, int Wait=1000)
 Cancel Request associated with the connection identified by UUID. More...
 

Protected Slots

void HandleNewPeer (TorcWebSocketThread *Thread, const QVariantMap &Data)
 
void HandleNewRequest (const QString &UUID, TorcRPCRequest *Request)
 
void HandleCancelRequest (const QString &UUID, TorcRPCRequest *Request)
 

Protected Member Functions

 TorcNetworkedContext ()
 
 ~TorcNetworkedContext ()
 
void Connected (TorcNetworkService *Peer)
 
void Disconnected (TorcNetworkService *Peer)
 
bool event (QEvent *Event)
 
- Protected Member Functions inherited from TorcHTTPService
void HandleSubscriberDeleted (QObject *Subscriber)
 

Properties

QVariantList peers
 

Friends

class TorcNetworkedContextObject
 
class TorcNetworkService
 

Additional Inherited Members

- Static Protected Member Functions inherited from TorcHTTPHandler
static bool MethodIsAuthorised (TorcHTTPRequest &Request, int Allowed)
 Check the current request is authorised and set the authentication header if not. More...
 
static void HandleOptions (TorcHTTPRequest &Request, int Allowed)
 
static void HandleFile (TorcHTTPRequest &Request, const QString &Filename, int Cache)
 
- Protected Attributes inherited from TorcHTTPService
QReadWriteLock m_httpServiceLock
 
- Protected Attributes inherited from TorcHTTPHandler
QString m_signature
 
bool m_recursive
 
QString m_name
 

Detailed Description

A class to discover and connect to other Torc applications.

"Torc peer discovery and connection"

TorcNetworkedContext searches for other Torc applications on the local network using UPnP and Bonjour (where available). When a new application is discovered, its details will be retrieved automatically and a websocket connection initiated if necessary.

The list of detected peers is available to the local UI via QAbstractListModel and hence this object must sit in the main thread. The peer list is also available to remote UIs via TorcHTTPService, which will process requests from multiple threads, hence limited locking is required around the peer list (the remote UI cannot write to the peer list, only read).

See also
TorcNetworkService

Definition at line 120 of file torcnetworkedcontext.h.

Constructor & Destructor Documentation

TorcNetworkedContext::TorcNetworkedContext ( )
protected

Definition at line 589 of file torcnetworkedcontext.cpp.

TorcNetworkedContext::~TorcNetworkedContext ( )
protected

Definition at line 610 of file torcnetworkedcontext.cpp.

Member Function Documentation

void TorcNetworkedContext::CancelRequest ( const QString &  UUID,
TorcRPCRequest Request,
int  Wait = 1000 
)
static

Cancel Request associated with the connection identified by UUID.

See TorcWebSocket::CancelRequest for details on blocking.

See also
TorcWebSocket::CancelRequest

Definition at line 843 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::Connected ( TorcNetworkService Peer)
protected

Definition at line 637 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::Disconnected ( TorcNetworkService Peer)
protected

Definition at line 647 of file torcnetworkedcontext.cpp.

bool TorcNetworkedContext::event ( QEvent *  Event)
protected

Definition at line 661 of file torcnetworkedcontext.cpp.

QVariantList TorcNetworkedContext::GetPeers ( void  )
slot

Definition at line 626 of file torcnetworkedcontext.cpp.

QString TorcNetworkedContext::GetUIName ( void  )
virtual

Reimplemented from TorcHTTPService.

Definition at line 621 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::HandleCancelRequest ( const QString &  UUID,
TorcRPCRequest Request 
)
protectedslot

Definition at line 889 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::HandleNewPeer ( TorcWebSocketThread Thread,
const QVariantMap &  Data 
)
protectedslot

Definition at line 912 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::HandleNewRequest ( const QString &  UUID,
TorcRPCRequest Request 
)
protectedslot

Definition at line 871 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::NewPeer ( TorcWebSocketThread Socket,
const QVariantMap &  Data 
)
signal
void TorcNetworkedContext::NewRequest ( const QString &  UUID,
TorcRPCRequest Request 
)
signal
void TorcNetworkedContext::PeerConnected ( TorcWebSocketThread Thread,
const QVariantMap &  Data 
)
static

Respond to a valid WebSocket upgrade request and schedule creation of a WebSocket on the give QTcpSocket.

See also
TorcWebSocket
TorcHTTPServer::UpgradeSocket

Definition at line 807 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::PeerConnected ( QString &  Name,
QString &  UUID 
)
signal
void TorcNetworkedContext::PeerDisconnected ( QString &  Name,
QString &  UUID 
)
signal
void TorcNetworkedContext::PeersChanged ( void  )
signal
void TorcNetworkedContext::RemoteRequest ( const QString &  UUID,
TorcRPCRequest Request 
)
static

Pass Request to the remote connection identified by UUID.

Definition at line 823 of file torcnetworkedcontext.cpp.

void TorcNetworkedContext::RequestCancelled ( const QString &  UUID,
TorcRPCRequest Request 
)
signal
void TorcNetworkedContext::SubscriberDeleted ( QObject *  Subscriber)
slot

Definition at line 907 of file torcnetworkedcontext.cpp.

Friends And Related Function Documentation

friend class TorcNetworkedContextObject
friend

Definition at line 122 of file torcnetworkedcontext.h.

friend class TorcNetworkService
friend

Definition at line 123 of file torcnetworkedcontext.h.

Property Documentation

QVariantList TorcNetworkedContext::peers
read

Definition at line 128 of file torcnetworkedcontext.h.


The documentation for this class was generated from the following files: