Doomseeker
   
  • Doomseeker
  • Wadseeker
  • Download
  • Tracker
  • Git
  • Docs
  • Main Page
  • Classes
  • Files
  • File List
  • File Members

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                 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
   
Doomseeker © 2009-2024 The Doomseeker Team