00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __RCON_PROTOCOL_H_
00024 #define __RCON_PROTOCOL_H_
00025
00026 #include "player.h"
00027 #include <QThread>
00028 #include <QUdpSocket>
00029
00030 class Server;
00031
00035 class MAIN_EXPORT RConProtocol : public QObject
00036 {
00037 Q_OBJECT
00038
00039 public:
00040 virtual ~RConProtocol();
00041
00042 bool isConnected() const { return connected; }
00043 const QList<Player> &playerList() const { return players; }
00044
00045 public slots:
00046 virtual void disconnectFromServer()=0;
00047 virtual void sendCommand(const QString &cmd)=0;
00048 virtual void sendPassword(const QString &password)=0;
00049
00050 signals:
00051 void disconnected();
00052 void invalidPassword();
00053 void messageReceived(const QString &cmd);
00054 void playerListUpdated();
00055 void serverNameChanged(const QString &name);
00056
00057 protected:
00058 RConProtocol(Server *server);
00059
00060 const QHostAddress &address() const { return serverAddress; }
00061 quint16 port() const { return serverPort; }
00062
00063 bool connected;
00064 QList<Player> players;
00065 QUdpSocket socket;
00066
00067 friend class Server;
00068
00069 protected slots:
00070 virtual void packetReady()=0;
00071
00072 private:
00073 QHostAddress serverAddress;
00074 quint16 serverPort;
00075 };
00076
00077 #endif