summaryrefslogtreecommitdiffstats
path: root/tscommand.h
diff options
context:
space:
mode:
Diffstat (limited to 'tscommand.h')
-rw-r--r--tscommand.h524
1 files changed, 524 insertions, 0 deletions
diff --git a/tscommand.h b/tscommand.h
new file mode 100644
index 0000000..d7774a2
--- /dev/null
+++ b/tscommand.h
@@ -0,0 +1,524 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14 *
15 * Authors: Manuel Mausz (manuel@mausz.at)
16 * Christian Raschko (c.raschko@netcore.at)
17 */
18
19#ifndef TSCOMMAND_H
20#define TSCOMMAND_H
21
22#include "tsheaders.h"
23
24#include <wx/wx.h>
25#include <wx/stream.h>
26#include <wx/datstrm.h>
27#include <wx/mstream.h>
28#include <wx/dynarray.h>
29
30//Commands
31#define TS_CMD_RECV_UNKNOWN 0xffffffff //!< Recv unknown command
32#define TS_CMD_SEND_LOGIN 0x0003bef4 //!< Send user, login
33#define TS_CMD_RECV_SERVER 0x0004bef4 //!< Recv server Information
34#define TS_CMD_SEND_DEFAULT 0x0005bef0 //!< Send default channel
35#define TS_CMD_RECV_CHANNEL 0x0006bef0 //!< Recv channels
36#define TS_CMD_RECV_USER 0x0007bef0 //!< Recv users
37#define TS_CMD_RECV_ACK 0x0000bef1 //!< Recv acknowledge
38#define TS_CMD_SEND_ACK 0xff00bef1 //!< pseudo command, send recv same id
39#define TS_CMD_RECV_URL 0x0008bef0 //!< Recv ISP Url
40#define TS_CMD_SEND_PING 0x0001bef4 //!< Send ping
41#define TS_CMD_RECV_PING 0x0002bef4 //!< Recv ping
42#define TS_CMD_SEND_LOGOUT 0x012cbef0 //!< Send logout user
43#define TS_CMD_RECV_LOGOUT 0x0065bef0 //!< Recv logout information
44#define TS_CMD_RECV_ADD_PLAYER 0x0064bef0 //!< Recv player login
45#define TS_CMD_RECV_PLAYER_FLAGS 0x0068bef0 //!< Recv player flags
46#define TS_CMD_RECV_ADD_CHANNEL 0x006ebef0 //!< Recv add channel
47#define TS_CMD_RECV_MOVE_PLAYER 0x0067bef0 //!< Recv move player
48#define TS_CMD_RECV_MOVE_PLAYER2 0x006dbef0 //!< Recv move player
49#define TS_CMD_RECV_DEL_CHANNEL 0x0073bef0 //!< Recv delete channel
50#define TS_CMD_RECV_SERVER_UPDATE 0x008cbef0 //!< Recv update server
51#define TS_CMD_SEND_ADD_CHANNEL 0x00c9bef0 //!< Send create channel
52#define TS_CMD_SEND_DEL_CHANNEL 0x00d1bef0 //!< Send delete channel
53#define TS_CMD_SEND_MOVE_PLAYER 0x014abef0 //!< Send move player
54#define TS_CMD_SEND_KICK_PLAYER 0x012dbef0 //!< Send kick player
55
56#define TS_CMD_SEND_SET_CHANNEL_PASSWORD 0x00cbbef0 //!< Send change channel
57#define TS_CMD_SEND_SET_CHANNEL_NAME 0x00cebef0 //!< Send change channel
58#define TS_CMD_SEND_SET_CHANNEL_TOPIC 0x00cfbef0 //!< Send change channel
59#define TS_CMD_SEND_SET_CHANNEL_DESCRIPTION 0x00d0bef0 //!< Send change channel
60#define TS_CMD_SEND_SET_CHANNEL_MAXPLAYERS 0x00d2bef0 //!< Send change channel
61#define TS_CMD_SEND_SET_CHANNEL_FLAGSCODEC 0x00cdbef0 //!< Send change channel
62#define TS_CMD_SEND_SET_CHANNEL_ORDER 0x00d4bef0 //!< Send change channel
63
64#define TS_CMD_RECV_SET_CHANNEL_NAME 0x006fbef0 //!< Recv change channel
65#define TS_CMD_RECV_SET_CHANNEL_TOPIC 0x0070bef0 //!< Recv change channel
66#define TS_CMD_RECV_SET_CHANNEL_DESCRIPTION 0x0072bef0 //!< Recv change channel
67#define TS_CMD_RECV_SET_CHANNEL_MAXPLAYERS 0x0074bef0 //!< Recv change channel
68#define TS_CMD_RECV_SET_CHANNEL_FLAGSCODEC 0x0071bef0 //!< Recv change channel
69#define TS_CMD_RECV_SET_CHANNEL_ORDER 0x0075bef0 //!< Recv change channel
70
71#define TS_CMD_RECV_CHANNEL_PASSWORD_CHANGED 0x00ccbef0 //!< Recv channel password changed
72
73//------------------------------------------------------------------------------
74//! ABC TeamSpeak command.
75/*! Abstract base class for processing commands
76 */
77class TSCommand : public wxObject
78{
79 DECLARE_CLASS(TSCommand)
80 public:
81 /*! CTor
82 */
83 TSCommand(wxUint32 const &id) : m_Id(id)
84 {
85 }
86
87 /*! DTor
88 */
89 virtual ~TSCommand()
90 {
91 }
92
93 /*! Check if this is the right class.
94 * \param id Command id.
95 * \return True if successful.
96 */
97 virtual bool IsCommand(wxUint32 const &id)
98 {
99 if(m_Id == id) return true;
100 else return false;
101 }
102
103 /*! Precess a command.
104 * \param istrm Input stream.
105 * \param ostrm Output stream.
106 * \param cmd TSCmd object.
107 * \return True if successful.
108 */
109 virtual bool ProcessCommand(wxInputStream &istrm,
110 wxOutputStream &ostrm,
111 TSCmd *cmd) = 0;
112
113 /*! Gets the LastError message, call this method
114 * to get more information for an error.
115 * \return LastError message.
116 */
117 wxString const &GetLastError() const
118 {
119 return m_LastError;
120 }
121
122 /*! Get command id.
123 * \return Command id.
124 */
125 wxUint32 GetId() const
126 {
127 return m_Id;
128 }
129
130 protected:
131 //Sets the LastError message.
132 void SetLastError(wxString const &str)
133 {
134 m_LastError = str;
135 }
136
137 const wxUint32 m_Id;
138 wxString m_LastError;
139 //class variable
140 static wxUint32 m_Cnt;
141};
142
143
144//------------------------------------------------------------------------------
145//! TSCmdSendUser
146class TSCmdSendLogin : public TSCommand
147{
148 public:
149 TSCmdSendLogin():TSCommand(TS_CMD_SEND_LOGIN){}
150 //! See baseclass TSCommand for description.
151 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
152};
153
154//------------------------------------------------------------------------------
155//! TSCmdRecvServer
156class TSCmdRecvServer : public TSCommand
157{
158 public:
159 TSCmdRecvServer():TSCommand(TS_CMD_RECV_SERVER){}
160 //! See baseclass TSCommand for description.
161 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
162};
163
164//------------------------------------------------------------------------------
165//! TSCmdSendDefault
166class TSCmdSendDefault : public TSCommand
167{
168 public:
169 TSCmdSendDefault():TSCommand(TS_CMD_SEND_DEFAULT){}
170 //! See baseclass TSCommand for description.
171 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
172};
173
174//------------------------------------------------------------------------------
175//! TSCmdRecvChannel
176class TSCmdRecvChannel : public TSCommand
177{
178 public:
179 TSCmdRecvChannel():TSCommand(TS_CMD_RECV_CHANNEL){}
180 //! See baseclass TSCommand for description.
181 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
182};
183
184//------------------------------------------------------------------------------
185//! TSCmdRecvUser
186class TSCmdRecvUser : public TSCommand
187{
188 public:
189 TSCmdRecvUser():TSCommand(TS_CMD_RECV_USER){}
190 //! See baseclass TSCommand for description.
191 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
192};
193
194//------------------------------------------------------------------------------
195//! TSCmdSendAck
196class TSCmdSendAck : public TSCommand
197{
198 public:
199 TSCmdSendAck():TSCommand(TS_CMD_SEND_ACK){}
200 //! See baseclass TSCommand for description.
201 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
202};
203
204//------------------------------------------------------------------------------
205//! TSCmdRecvAck
206class TSCmdRecvAck : public TSCommand
207{
208 public:
209 TSCmdRecvAck():TSCommand(TS_CMD_RECV_ACK){}
210 //! See baseclass TSCommand for description.
211 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
212};
213
214//------------------------------------------------------------------------------
215//! TSCmdRecvUrl
216class TSCmdRecvUrl : public TSCommand
217{
218 public:
219 TSCmdRecvUrl():TSCommand(TS_CMD_RECV_URL){}
220 //! See baseclass TSCommand for description.
221 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
222};
223
224//------------------------------------------------------------------------------
225//! TSCmdSendPing
226class TSCmdSendPing : public TSCommand
227{
228 public:
229 TSCmdSendPing():TSCommand(TS_CMD_SEND_PING){}
230 //! See baseclass TSCommand for description.
231 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
232};
233
234//------------------------------------------------------------------------------
235//! TSCmdRecvPing
236class TSCmdRecvPing : public TSCommand
237{
238 public:
239 TSCmdRecvPing():TSCommand(TS_CMD_RECV_PING){}
240 //! See baseclass TSCommand for description.
241 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
242};
243
244//------------------------------------------------------------------------------
245//! TSCmdSendLogout
246class TSCmdSendLogout : public TSCommand
247{
248 public:
249 TSCmdSendLogout():TSCommand(TS_CMD_SEND_LOGOUT){}
250 //! See baseclass TSCommand for description.
251 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
252};
253
254//------------------------------------------------------------------------------
255//! TSCmdRecvLogoutInfo
256class TSCmdRecvLogout : public TSCommand
257{
258 public:
259 TSCmdRecvLogout():TSCommand(TS_CMD_RECV_LOGOUT){}
260 //! See baseclass TSCommand for description.
261 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
262};
263
264//------------------------------------------------------------------------------
265//! TSCmdRecvAddPlayer
266class TSCmdRecvAddPlayer : public TSCommand
267{
268 public:
269 TSCmdRecvAddPlayer():TSCommand(TS_CMD_RECV_ADD_PLAYER){}
270 //! See baseclass TSCommand for description.
271 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
272};
273
274//------------------------------------------------------------------------------
275//! TSCmdRecvPlayerFlags
276class TSCmdRecvPlayerFlags : public TSCommand
277{
278 public:
279 TSCmdRecvPlayerFlags():TSCommand(TS_CMD_RECV_PLAYER_FLAGS){}
280 //! See baseclass TSCommand for description.
281 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
282};
283
284//------------------------------------------------------------------------------
285//! TSCmdRecvAddChannel
286class TSCmdRecvAddChannel : public TSCommand
287{
288 public:
289 TSCmdRecvAddChannel():TSCommand(TS_CMD_RECV_ADD_CHANNEL){}
290 //! See baseclass TSCommand for description.
291 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
292};
293
294//------------------------------------------------------------------------------
295//! TSCmdRecvMovePlayer
296class TSCmdRecvMovePlayer : public TSCommand
297{
298 public:
299 TSCmdRecvMovePlayer():TSCommand(TS_CMD_RECV_MOVE_PLAYER){}
300 //! See baseclass TSCommand for description.
301 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
302};
303
304//------------------------------------------------------------------------------
305//! TSCmdRecvMovePlayer
306class TSCmdRecvMovePlayer2 : public TSCommand
307{
308 public:
309 TSCmdRecvMovePlayer2():TSCommand(TS_CMD_RECV_MOVE_PLAYER2){}
310 //! See baseclass TSCommand for description.
311 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
312};
313
314//------------------------------------------------------------------------------
315//! TSCmdRecvDelChannel
316class TSCmdRecvDelChannel : public TSCommand
317{
318 public:
319 TSCmdRecvDelChannel():TSCommand(TS_CMD_RECV_DEL_CHANNEL){}
320 //! See baseclass TSCommand for description.
321 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
322};
323
324//------------------------------------------------------------------------------
325//! TSCmdRecvServerUpdate
326class TSCmdRecvServerUpdate : public TSCommand
327{
328 public:
329 TSCmdRecvServerUpdate():TSCommand(TS_CMD_RECV_SERVER_UPDATE){}
330 //! See baseclass TSCommand for description.
331 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
332};
333
334//------------------------------------------------------------------------------
335//! TSCmdSendAddChannel
336class TSCmdSendAddChannel : public TSCommand
337{
338 public:
339 TSCmdSendAddChannel():TSCommand(TS_CMD_SEND_ADD_CHANNEL){}
340 //! See baseclass TSCommand for description.
341 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
342};
343
344//------------------------------------------------------------------------------
345//! TSCmdSendDelChannel
346class TSCmdSendDelChannel : public TSCommand
347{
348 public:
349 TSCmdSendDelChannel():TSCommand(TS_CMD_SEND_DEL_CHANNEL){}
350 //! See baseclass TSCommand for description.
351 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
352};
353
354//------------------------------------------------------------------------------
355//! TSCmdSendMovePlayer
356class TSCmdSendMovePlayer : public TSCommand
357{
358 public:
359 TSCmdSendMovePlayer():TSCommand(TS_CMD_SEND_MOVE_PLAYER){}
360 //! See baseclass TSCommand for description.
361 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
362};
363
364//------------------------------------------------------------------------------
365//! TSCmdSendSetChannelPassword
366class TSCmdSendSetChannelPassword : public TSCommand
367{
368 public:
369 TSCmdSendSetChannelPassword():TSCommand(TS_CMD_SEND_SET_CHANNEL_PASSWORD){}
370 //! See baseclass TSCommand for description.
371 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
372};
373
374//------------------------------------------------------------------------------
375//! TSCmdSendSetChannelName
376class TSCmdSendSetChannelName : public TSCommand
377{
378 public:
379 TSCmdSendSetChannelName():TSCommand(TS_CMD_SEND_SET_CHANNEL_NAME){}
380 //! See baseclass TSCommand for description.
381 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
382};
383
384//------------------------------------------------------------------------------
385//! TSCmdSendSetChannelTopic
386class TSCmdSendSetChannelTopic : public TSCommand
387{
388 public:
389 TSCmdSendSetChannelTopic():TSCommand(TS_CMD_SEND_SET_CHANNEL_TOPIC){}
390 //! See baseclass TSCommand for description.
391 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
392};
393
394//------------------------------------------------------------------------------
395//! TSCmdSendSetChannelDescription
396class TSCmdSendSetChannelDescription : public TSCommand
397{
398 public:
399 TSCmdSendSetChannelDescription():TSCommand(TS_CMD_SEND_SET_CHANNEL_DESCRIPTION){}
400 //! See baseclass TSCommand for description.
401 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
402};
403
404//------------------------------------------------------------------------------
405//! TSCmdSendSetChannelMaxPlayers
406class TSCmdSendSetChannelMaxPlayers : public TSCommand
407{
408 public:
409 TSCmdSendSetChannelMaxPlayers():TSCommand(TS_CMD_SEND_SET_CHANNEL_MAXPLAYERS){}
410 //! See baseclass TSCommand for description.
411 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
412};
413
414//------------------------------------------------------------------------------
415//! TSCmdSendSetChannelFlagsCodec
416class TSCmdSendSetChannelFlagsCodec : public TSCommand
417{
418 public:
419 TSCmdSendSetChannelFlagsCodec():TSCommand(TS_CMD_SEND_SET_CHANNEL_FLAGSCODEC){}
420 //! See baseclass TSCommand for description.
421 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
422};
423
424//------------------------------------------------------------------------------
425//! TSCmdSendSetChannelOrder
426class TSCmdSendSetChannelOrder : public TSCommand
427{
428 public:
429 TSCmdSendSetChannelOrder():TSCommand(TS_CMD_SEND_SET_CHANNEL_ORDER){}
430 //! See baseclass TSCommand for description.
431 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
432};
433
434//------------------------------------------------------------------------------
435//! TSCmdRecvSetChannelName
436class TSCmdRecvSetChannelName : public TSCommand
437{
438 public:
439 TSCmdRecvSetChannelName():TSCommand(TS_CMD_RECV_SET_CHANNEL_NAME){}
440 //! See baseclass TSCommand for description.
441 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
442};
443
444//------------------------------------------------------------------------------
445//! TSCmdRecvSetChannelTopic
446class TSCmdRecvSetChannelTopic : public TSCommand
447{
448 public:
449 TSCmdRecvSetChannelTopic():TSCommand(TS_CMD_RECV_SET_CHANNEL_TOPIC){}
450 //! See baseclass TSCommand for description.
451 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
452};
453
454//------------------------------------------------------------------------------
455//! TSCmdRecvSetChannelDescription
456class TSCmdRecvSetChannelDescription : public TSCommand
457{
458 public:
459 TSCmdRecvSetChannelDescription():TSCommand(TS_CMD_RECV_SET_CHANNEL_DESCRIPTION){}
460 //! See baseclass TSCommand for description.
461 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
462};
463
464//------------------------------------------------------------------------------
465//! TSCmdRecvSetChannelMaxPlayers
466class TSCmdRecvSetChannelMaxPlayers : public TSCommand
467{
468 public:
469 TSCmdRecvSetChannelMaxPlayers():TSCommand(TS_CMD_RECV_SET_CHANNEL_MAXPLAYERS){}
470 //! See baseclass TSCommand for description.
471 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
472};
473
474//------------------------------------------------------------------------------
475//! TSCmdRecvSetChannelFlagsCodec
476class TSCmdRecvSetChannelFlagsCodec : public TSCommand
477{
478 public:
479 TSCmdRecvSetChannelFlagsCodec():TSCommand(TS_CMD_RECV_SET_CHANNEL_FLAGSCODEC){}
480 //! See baseclass TSCommand for description.
481 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
482};
483
484//------------------------------------------------------------------------------
485//! TSCmdRecvSetChannelOrder
486class TSCmdRecvSetChannelOrder : public TSCommand
487{
488 public:
489 TSCmdRecvSetChannelOrder():TSCommand(TS_CMD_RECV_SET_CHANNEL_ORDER){}
490 //! See baseclass TSCommand for description.
491 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
492};
493
494//------------------------------------------------------------------------------
495//! TSCmdSendKickPlayer
496class TSCmdSendKickPlayer : public TSCommand
497{
498 public:
499 TSCmdSendKickPlayer():TSCommand(TS_CMD_SEND_KICK_PLAYER){}
500 //! See baseclass TSCommand for description.
501 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
502};
503
504//------------------------------------------------------------------------------
505//! TSCmdRecvChannelPasswordChanged
506class TSCmdRecvChannelPasswordChanged : public TSCommand
507{
508 public:
509 TSCmdRecvChannelPasswordChanged():TSCommand(TS_CMD_RECV_CHANNEL_PASSWORD_CHANGED){}
510 //! See baseclass TSCommand for description.
511 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
512};
513
514//------------------------------------------------------------------------------
515//! TSCmdRecvUnknown
516class TSCmdRecvUnknown : public TSCommand
517{
518 public:
519 TSCmdRecvUnknown():TSCommand(TS_CMD_RECV_UNKNOWN){}
520 //! See baseclass TSCommand for description.
521 virtual bool ProcessCommand(wxInputStream &istrm, wxOutputStream &ostrm, TSCmd *cmd);
522};
523
524#endif