blob: 316ea2694138eeaec89c8d0b768dc460d3ad1146 [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();
george828edfb7a2005-03-03 16:36:10 +000038 void interruptFrameDelay() { is->interruptFrameDelay(); };
george82ea913c12005-02-09 16:31:48 +000039 const rdr::InStream* getInStream() { return is; }
Constantin Kaplinskyfbfbb922004-11-14 18:28:51 +000040
george82529ed572005-01-30 16:52:08 +000041 virtual void processMsg();
Constantin Kaplinskyfbfbb922004-11-14 18:28:51 +000042
43 // serverInit() is called when the ServerInit message is received. The
44 // derived class must call on to CMsgHandler::serverInit().
45 void serverInit();
46
47 enum stateEnum {
48 RFBSTATE_PROTOCOL_VERSION,
49 RFBSTATE_SECURITY,
50 RFBSTATE_INITIALISATION,
51 RFBSTATE_NORMAL,
52 RFBSTATE_INVALID
53 };
54
55 stateEnum state() { return state_; }
56
57 protected:
58 void setState(stateEnum s) { state_ = s; }
59 virtual void framebufferUpdateEnd() {};
60
61 FbsInputStream* is;
george8226af7652005-04-13 12:46:25 +000062 CMsgReaderV3* reader;
Constantin Kaplinskyfbfbb922004-11-14 18:28:51 +000063 stateEnum state_;
64
65 private:
66 void processVersionMsg();
67 void processSecurityMsg();
68 void processInitMsg();
69};