/* # 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 #include class PVS; class PVSDiscoveredServer; typedef QList 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(); void handleDiscovery(QHostAddress host, int port, QByteArray hash); protected: void timerEvent(QTimerEvent *event); private Q_SLOTS: void sock_dataArrival(); void sendServerToGui(PVSDiscoveredServer*); private: 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_ */