blob: 7ad3177729c8c81d86e1c678948196732bc29c36 [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();
38
39 void processMsg();
40
41 // serverInit() is called when the ServerInit message is received. The
42 // derived class must call on to CMsgHandler::serverInit().
43 void serverInit();
44
45 enum stateEnum {
46 RFBSTATE_PROTOCOL_VERSION,
47 RFBSTATE_SECURITY,
48 RFBSTATE_INITIALISATION,
49 RFBSTATE_NORMAL,
50 RFBSTATE_INVALID
51 };
52
53 stateEnum state() { return state_; }
54
55 protected:
56 void setState(stateEnum s) { state_ = s; }
57 virtual void framebufferUpdateEnd() {};
58
59 FbsInputStream* is;
60 CMsgReader* reader;
61 stateEnum state_;
62
63 private:
64 void processVersionMsg();
65 void processSecurityMsg();
66 void processInitMsg();
67};