blob: 8e870cd4a2579d8914c2560407b7a4f72cc617e8 [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 */
Adam Tkac20e0d712008-11-14 14:48:21 +000018
19#include <stdio.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000020#include <rfb/PixelFormat.h>
21#include <rfb/msgTypes.h>
22#include <rfb/Exception.h>
23#include <rdr/InStream.h>
24#include <rfb/SMsgReaderV3.h>
25#include <rfb/SMsgHandler.h>
26
27using namespace rfb;
28
29SMsgReaderV3::SMsgReaderV3(SMsgHandler* handler, rdr::InStream* is)
30 : SMsgReader(handler, is)
31{
32}
33
34SMsgReaderV3::~SMsgReaderV3()
35{
36}
37
38void SMsgReaderV3::readClientInit()
39{
40 bool shared = is->readU8();
41 handler->clientInit(shared);
42}
43
44void SMsgReaderV3::readMsg()
45{
46 int msgType = is->readU8();
47 switch (msgType) {
48 case msgTypeSetPixelFormat: readSetPixelFormat(); break;
49 case msgTypeSetEncodings: readSetEncodings(); break;
50 case msgTypeFramebufferUpdateRequest: readFramebufferUpdateRequest(); break;
51 case msgTypeKeyEvent: readKeyEvent(); break;
52 case msgTypePointerEvent: readPointerEvent(); break;
53 case msgTypeClientCutText: readClientCutText(); break;
54
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000055 default:
56 fprintf(stderr, "unknown message type %d\n", msgType);
57 throw Exception("unknown message type");
58 }
59}