blob: 0ce1bcab46dac084f98277d460978066bf37535d [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001/* Copyright (C) 2002-2003 RealVNC Ltd. 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#include <rfb/PixelFormat.h>
19#include <rfb/msgTypes.h>
20#include <rfb/Exception.h>
21#include <rdr/InStream.h>
22#include <rfb/SMsgReaderV3.h>
23#include <rfb/SMsgHandler.h>
24
25using namespace rfb;
26
27SMsgReaderV3::SMsgReaderV3(SMsgHandler* handler, rdr::InStream* is)
28 : SMsgReader(handler, is)
29{
30}
31
32SMsgReaderV3::~SMsgReaderV3()
33{
34}
35
36void SMsgReaderV3::readClientInit()
37{
38 bool shared = is->readU8();
39 endMsg();
40 handler->clientInit(shared);
41}
42
43void SMsgReaderV3::readMsg()
44{
45 int msgType = is->readU8();
46 switch (msgType) {
47 case msgTypeSetPixelFormat: readSetPixelFormat(); break;
48 case msgTypeSetEncodings: readSetEncodings(); break;
49 case msgTypeFramebufferUpdateRequest: readFramebufferUpdateRequest(); break;
50 case msgTypeKeyEvent: readKeyEvent(); break;
51 case msgTypePointerEvent: readPointerEvent(); break;
52 case msgTypeClientCutText: readClientCutText(); break;
Dennis Syrovatskyea354642005-12-18 13:10:26 +000053
54 case msgTypeFileListRequest:
55 case msgTypeFileDownloadRequest:
56 case msgTypeFileUploadRequest:
57 case msgTypeFileUploadData:
58 case msgTypeFileDownloadCancel:
59 case msgTypeFileUploadFailed:
60 case msgTypeFileCreateDirRequest:
61 case msgTypeFileDirSizeRequest:
62 case msgTypeFileRenameRequest:
63 case msgTypeFileDeleteRequest: handler->processFTMsg(msgType); break;
64
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000065 default:
66 fprintf(stderr, "unknown message type %d\n", msgType);
67 throw Exception("unknown message type");
68 }
69}