/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: Manuel Mausz (manuel@mausz.at) * Christian Raschko (c.raschko@netcore.at) */ #ifndef TSCOMMAND_H #define TSCOMMAND_H #include "tsheaders.h" #include #include #include #include #include //Commands #define TS_CMD_RECV_UNKNOWN 0xffffffff //!< Recv unknown command #define TS_CMD_SEND_LOGIN 0x0003bef4 //!< Send user, login #define TS_CMD_RECV_SERVER 0x0004bef4 //!< Recv server Information #define TS_CMD_SEND_DEFAULT 0x0005bef0 //!< Send default channel #define TS_CMD_RECV_CHANNEL 0x0006bef0 //!< Recv channels #define TS_CMD_RECV_USER 0x0007bef0 //!< Recv users #define TS_CMD_RECV_ACK 0x0000bef1 //!< Recv acknowledge #define TS_CMD_SEND_ACK 0xff00bef1 //!< pseudo command, send recv same id #define TS_CMD_RECV_URL 0x0008bef0 //!< Recv ISP Url #define TS_CMD_SEND_PING 0x0001bef4 //!< Send ping #define TS_CMD_RECV_PING 0x0002bef4 //!< Recv ping #define TS_CMD_SEND_LOGOUT 0x012cbef0 //!< Send logout user #define TS_CMD_RECV_LOGOUT 0x0065bef0 //!< Recv logout information #define TS_CMD_RECV_ADD_PLAYER 0x0064bef0 //!< Recv player login #define TS_CMD_RECV_PLAYER_FLAGS 0x0068bef0 //!< Recv player flags #define TS_CMD_RECV_ADD_CHANNEL 0x006ebef0 //!< Recv add channel #define TS_CMD_RECV_MOVE_PLAYER 0x0067bef0 //!< Recv move player #define TS_CMD_RECV_MOVE_PLAYER2 0x006dbef0 //!< Recv move player #define TS_CMD_RECV_DEL_CHANNEL 0x0073bef0 //!< Recv delete channel #define TS_CMD_RECV_SERVER_UPDATE 0x008cbef0 //!< Recv update server #define TS_CMD_SEND_ADD_CHANNEL 0x00c9bef0 //!< Send create channel #define TS_CMD_SEND_DEL_CHANNEL 0x00d1bef0 //!< Send delete channel #define TS_CMD_SEND_MOVE_PLAYER 0x014abef0 //!< Send move player #define TS_CMD_SEND_KICK_PLAYER 0x012dbef0 //!< Send kick player #define TS_CMD_SEND_SET_CHANNEL_PASSWORD 0x00cbbef0 //!< Send change channel #define TS_CMD_SEND_SET_CHANNEL_NAME 0x00cebef0 //!< Send change channel #define TS_CMD_SEND_SET_CHANNEL_TOPIC 0x00cfbef0 //!< Send change channel #define TS_CMD_SEND_SET_CHANNEL_DESCRIPTION 0x00d0bef0 //!< Send change channel #define TS_CMD_SEND_SET_CHANNEL_MAXPLAYERS 0x00d2bef0 //!< Send change channel #define TS_CMD_SEND_SET_CHANNEL_FLAGSCODEC 0x00cdbef0 //!< Send change channel #define TS_CMD_SEND_SET_CHANNEL_ORDER 0x00d4bef0 //!< Send change channel #define TS_CMD_RECV_SET_CHANNEL_NAME 0x006fbef0 //!< Recv change channel #define TS_CMD_RECV_SET_CHANNEL_TOPIC 0x0070bef0 //!< Recv change channel #define TS_CMD_RECV_SET_CHANNEL_DESCRIPTION 0x0072bef0 //!< Recv change channel #define TS_CMD_RECV_SET_CHANNEL_MAXPLAYERS 0x0074bef0 //!< Recv change channel #define TS_CMD_RECV_SET_CHANNEL_FLAGSCODEC 0x0071bef0 //!< Recv change channel #define TS_CMD_RECV_SET_CHANNEL_ORDER 0x0075bef0 //!< Recv change channel #define TS_CMD_RECV_CHANNEL_PASSWORD_CHANGED 0x00ccbef0 //!< Recv channel password changed //------------------------------------------------------------------------------ //! ABC TeamSpeak command. /*! Abstract base class for processing commands */ class TSCommand : public wxObject { DECLARE_CLASS(TSCommand) public: /*! CTor */ TSCommand(wxUint32 const &id) : m_Id(id) { } /*! DTor */ virtual ~TSCommand() { } /*! Check if this is the right class. * \param id Command id. * \return True if successful. */ virtual bool IsCommand(wxUint32 const &id) { if(m_Id == id) return true; else return false; } /*! Precess a command. * \param istrm Input stream. * \param ostrm Output stream. * \param cmd TSCmd object. * \return True if successful. */ virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd) = 0; /*! Gets the LastError message, call this method * to get more information for an error. * \return LastError message. */ wxString const &GetLastError() const { return m_LastError; } /*! Get command id. * \return Command id. */ wxUint32 GetId() const { return m_Id; } protected: //Sets the LastError message. void SetLastError(wxString const &str) { m_LastError = str; } const wxUint32 m_Id; wxString m_LastError; //class variable static wxUint32 m_Cnt; }; //------------------------------------------------------------------------------ //! TSCmdSendUser class TSCmdSendLogin : public TSCommand { public: TSCmdSendLogin():TSCommand(TS_CMD_SEND_LOGIN){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvServer class TSCmdRecvServer : public TSCommand { public: TSCmdRecvServer():TSCommand(TS_CMD_RECV_SERVER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendDefault class TSCmdSendDefault : public TSCommand { public: TSCmdSendDefault():TSCommand(TS_CMD_SEND_DEFAULT){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvChannel class TSCmdRecvChannel : public TSCommand { public: TSCmdRecvChannel():TSCommand(TS_CMD_RECV_CHANNEL){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvUser class TSCmdRecvUser : public TSCommand { public: TSCmdRecvUser():TSCommand(TS_CMD_RECV_USER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendAck class TSCmdSendAck : public TSCommand { public: TSCmdSendAck():TSCommand(TS_CMD_SEND_ACK){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvAck class TSCmdRecvAck : public TSCommand { public: TSCmdRecvAck():TSCommand(TS_CMD_RECV_ACK){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvUrl class TSCmdRecvUrl : public TSCommand { public: TSCmdRecvUrl():TSCommand(TS_CMD_RECV_URL){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendPing class TSCmdSendPing : public TSCommand { public: TSCmdSendPing():TSCommand(TS_CMD_SEND_PING){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvPing class TSCmdRecvPing : public TSCommand { public: TSCmdRecvPing():TSCommand(TS_CMD_RECV_PING){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendLogout class TSCmdSendLogout : public TSCommand { public: TSCmdSendLogout():TSCommand(TS_CMD_SEND_LOGOUT){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvLogoutInfo class TSCmdRecvLogout : public TSCommand { public: TSCmdRecvLogout():TSCommand(TS_CMD_RECV_LOGOUT){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvAddPlayer class TSCmdRecvAddPlayer : public TSCommand { public: TSCmdRecvAddPlayer():TSCommand(TS_CMD_RECV_ADD_PLAYER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvPlayerFlags class TSCmdRecvPlayerFlags : public TSCommand { public: TSCmdRecvPlayerFlags():TSCommand(TS_CMD_RECV_PLAYER_FLAGS){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvAddChannel class TSCmdRecvAddChannel : public TSCommand { public: TSCmdRecvAddChannel():TSCommand(TS_CMD_RECV_ADD_CHANNEL){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvMovePlayer class TSCmdRecvMovePlayer : public TSCommand { public: TSCmdRecvMovePlayer():TSCommand(TS_CMD_RECV_MOVE_PLAYER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvMovePlayer class TSCmdRecvMovePlayer2 : public TSCommand { public: TSCmdRecvMovePlayer2():TSCommand(TS_CMD_RECV_MOVE_PLAYER2){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvDelChannel class TSCmdRecvDelChannel : public TSCommand { public: TSCmdRecvDelChannel():TSCommand(TS_CMD_RECV_DEL_CHANNEL){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvServerUpdate class TSCmdRecvServerUpdate : public TSCommand { public: TSCmdRecvServerUpdate():TSCommand(TS_CMD_RECV_SERVER_UPDATE){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendAddChannel class TSCmdSendAddChannel : public TSCommand { public: TSCmdSendAddChannel():TSCommand(TS_CMD_SEND_ADD_CHANNEL){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendDelChannel class TSCmdSendDelChannel : public TSCommand { public: TSCmdSendDelChannel():TSCommand(TS_CMD_SEND_DEL_CHANNEL){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendMovePlayer class TSCmdSendMovePlayer : public TSCommand { public: TSCmdSendMovePlayer():TSCommand(TS_CMD_SEND_MOVE_PLAYER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelPassword class TSCmdSendSetChannelPassword : public TSCommand { public: TSCmdSendSetChannelPassword():TSCommand(TS_CMD_SEND_SET_CHANNEL_PASSWORD){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelName class TSCmdSendSetChannelName : public TSCommand { public: TSCmdSendSetChannelName():TSCommand(TS_CMD_SEND_SET_CHANNEL_NAME){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelTopic class TSCmdSendSetChannelTopic : public TSCommand { public: TSCmdSendSetChannelTopic():TSCommand(TS_CMD_SEND_SET_CHANNEL_TOPIC){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelDescription class TSCmdSendSetChannelDescription : public TSCommand { public: TSCmdSendSetChannelDescription():TSCommand(TS_CMD_SEND_SET_CHANNEL_DESCRIPTION){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelMaxPlayers class TSCmdSendSetChannelMaxPlayers : public TSCommand { public: TSCmdSendSetChannelMaxPlayers():TSCommand(TS_CMD_SEND_SET_CHANNEL_MAXPLAYERS){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelFlagsCodec class TSCmdSendSetChannelFlagsCodec : public TSCommand { public: TSCmdSendSetChannelFlagsCodec():TSCommand(TS_CMD_SEND_SET_CHANNEL_FLAGSCODEC){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendSetChannelOrder class TSCmdSendSetChannelOrder : public TSCommand { public: TSCmdSendSetChannelOrder():TSCommand(TS_CMD_SEND_SET_CHANNEL_ORDER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvSetChannelName class TSCmdRecvSetChannelName : public TSCommand { public: TSCmdRecvSetChannelName():TSCommand(TS_CMD_RECV_SET_CHANNEL_NAME){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvSetChannelTopic class TSCmdRecvSetChannelTopic : public TSCommand { public: TSCmdRecvSetChannelTopic():TSCommand(TS_CMD_RECV_SET_CHANNEL_TOPIC){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvSetChannelDescription class TSCmdRecvSetChannelDescription : public TSCommand { public: TSCmdRecvSetChannelDescription():TSCommand(TS_CMD_RECV_SET_CHANNEL_DESCRIPTION){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvSetChannelMaxPlayers class TSCmdRecvSetChannelMaxPlayers : public TSCommand { public: TSCmdRecvSetChannelMaxPlayers():TSCommand(TS_CMD_RECV_SET_CHANNEL_MAXPLAYERS){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvSetChannelFlagsCodec class TSCmdRecvSetChannelFlagsCodec : public TSCommand { public: TSCmdRecvSetChannelFlagsCodec():TSCommand(TS_CMD_RECV_SET_CHANNEL_FLAGSCODEC){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvSetChannelOrder class TSCmdRecvSetChannelOrder : public TSCommand { public: TSCmdRecvSetChannelOrder():TSCommand(TS_CMD_RECV_SET_CHANNEL_ORDER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdSendKickPlayer class TSCmdSendKickPlayer : public TSCommand { public: TSCmdSendKickPlayer():TSCommand(TS_CMD_SEND_KICK_PLAYER){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvChannelPasswordChanged class TSCmdRecvChannelPasswordChanged : public TSCommand { public: TSCmdRecvChannelPasswordChanged():TSCommand(TS_CMD_RECV_CHANNEL_PASSWORD_CHANGED){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; //------------------------------------------------------------------------------ //! TSCmdRecvUnknown class TSCmdRecvUnknown : public TSCommand { public: TSCmdRecvUnknown():TSCommand(TS_CMD_RECV_UNKNOWN){} //! See baseclass TSCommand for description. virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd); }; #endif