diff options
| author | Sebastian | 2010-05-12 19:42:27 +0200 |
|---|---|---|
| committer | Sebastian | 2010-05-12 19:42:27 +0200 |
| commit | ce3329047d378a14006ce74ec273ac59e3375303 (patch) | |
| tree | 782430f270b4c7aca1b35d5b7813518e3797c555 /src/net/pvsServiceDiscovery.h | |
| download | pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.gz pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.xz pvs-ce3329047d378a14006ce74ec273ac59e3375303.zip | |
initial import of latest svn version
Diffstat (limited to 'src/net/pvsServiceDiscovery.h')
| -rw-r--r-- | src/net/pvsServiceDiscovery.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/net/pvsServiceDiscovery.h b/src/net/pvsServiceDiscovery.h new file mode 100644 index 0000000..08a38b8 --- /dev/null +++ b/src/net/pvsServiceDiscovery.h @@ -0,0 +1,57 @@ +/* +# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# src/net/pvsServiceDiscovery.cpp +# - handle console broadcasts, tell client to connect on match +# ----------------------------------------------------------------------------- +*/ + +#ifndef PVSSERVICEDISCOVERY_H_ +#define PVSSERVICEDISCOVERY_H_ + +#include <QtNetwork/QUdpSocket> +#include <QtCore/QDateTime> + +class PVS; +class PVSDiscoveredServer; +typedef QList<PVSDiscoveredServer*> tServerList; + +class PVSServiceDiscovery : public QObject +{ + Q_OBJECT +public: + PVSServiceDiscovery(PVS* client); + virtual ~PVSServiceDiscovery(); + void connectToSession(QString name, QString passwd); + bool nameExists(QString name); + QStringList getAllServers(); + +protected: + void timerEvent(QTimerEvent *event); + +private Q_SLOTS: + void sock_dataArrival(); + void sendServerToGui(PVSDiscoveredServer*); + +private: + void handleDiscovery(QHostAddress host, int port, QByteArray hash); + void setTimerInterval(); + QUdpSocket _sock; + QString _sessionName; + QString _sessionPasswd; + PVS *_client; + QDateTime _last; ///< to protect us from being abused as a ddos zombie + tServerList _servers; + int _currentServer; + int _timerId; +}; + +#endif /* PVSSERVICEDISCOVERY_H_ */ |
