blob: ca88738cb9f04958cc93dddc8ca8c1b34b861981 [file] [log] [blame]
Constantin Kaplinskyfbfbb922004-11-14 18:28:51 +00001/* Copyright (C) 2004 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19// -=- RfbProto.h
20
21#include <rfb/CMsgReaderV3.h>
22#include <rfb/CMsgHandler.h>
23#include <rfb/CSecurity.h>
24#include <rfb/secTypes.h>
25
26#include <rfbplayer/FbsInputStream.h>
27
28using namespace rfb;
29
30class RfbProto : public CMsgHandler {
31 public:
32
33 RfbProto(char *fileName);
34 ~RfbProto();
35
36 void newSession(char *filename);
37 void initialiseProtocol();
george82ea913c12005-02-09 16:31:48 +000038 const rdr::InStream* getInStream() { return is; }
Constantin Kaplinskyfbfbb922004-11-14 18:28:51 +000039
george82529ed572005-01-30 16:52:08 +000040 virtual void processMsg();
Constantin Kaplinskyfbfbb922004-11-14 18:28:51 +000041
42 // serverInit() is called when the ServerInit message is received. The
43 // derived class must call on to CMsgHandler::serverInit().
44 void serverInit();
45
46 enum stateEnum {
47 RFBSTATE_PROTOCOL_VERSION,
48 RFBSTATE_SECURITY,
49 RFBSTATE_INITIALISATION,
50 RFBSTATE_NORMAL,
51 RFBSTATE_INVALID
52 };
53
54 stateEnum state() { return state_; }
55
56 protected:
57 void setState(stateEnum s) { state_ = s; }
58 virtual void framebufferUpdateEnd() {};
59
60 FbsInputStream* is;
61 CMsgReader* reader;
62 stateEnum state_;
63
64 private:
65 void processVersionMsg();
66 void processSecurityMsg();
67 void processInitMsg();
68};