blob: e9b020bb1bb614f8aa21d69765438fdd2f64270f [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 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 handler->clientInit(shared);
40}
41
42void SMsgReaderV3::readMsg()
43{
44 int msgType = is->readU8();
45 switch (msgType) {
46 case msgTypeSetPixelFormat: readSetPixelFormat(); break;
47 case msgTypeSetEncodings: readSetEncodings(); break;
48 case msgTypeFramebufferUpdateRequest: readFramebufferUpdateRequest(); break;
49 case msgTypeKeyEvent: readKeyEvent(); break;
50 case msgTypePointerEvent: readPointerEvent(); break;
51 case msgTypeClientCutText: readClientCutText(); break;
52
53 case msgTypeFileListRequest:
54 case msgTypeFileDownloadRequest:
55 case msgTypeFileUploadRequest:
56 case msgTypeFileUploadData:
57 case msgTypeFileDownloadCancel:
58 case msgTypeFileUploadFailed:
59 case msgTypeFileCreateDirRequest:
60 case msgTypeFileDirSizeRequest:
61 case msgTypeFileRenameRequest:
62 case msgTypeFileDeleteRequest: handler->processFTMsg(msgType); break;
63
Constantin Kaplinskydafbb012007-04-05 08:43:25 +000064 case msgTypeEnableContinuousUpdates: readEnableContinuousUpdates(); break;
65
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000066 default:
67 fprintf(stderr, "unknown message type %d\n", msgType);
68 throw Exception("unknown message type");
69 }
70}