src/core/serverapi/rconprotocol.h
00001 //------------------------------------------------------------------------------
00002 // rconprotocol.h
00003 //------------------------------------------------------------------------------
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018 // 02110-1301, USA.
00019 //
00020 //------------------------------------------------------------------------------
00021 // Copyright (C) 2010 "Blzut3" <admin@maniacsvault.net>
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                 bool                    connected;
00061                 QList<Player>   players;
00062                 Server                  *server;
00063                 QUdpSocket              socket;
00064 
00065                 friend class Server;
00066 
00067         protected slots:
00068                 virtual void    packetReady()=0;
00069 };
00070 
00071 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator