Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* 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 | |
| 25 | using namespace rfb; |
| 26 | |
| 27 | SMsgReaderV3::SMsgReaderV3(SMsgHandler* handler, rdr::InStream* is) |
| 28 | : SMsgReader(handler, is) |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | SMsgReaderV3::~SMsgReaderV3() |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | void SMsgReaderV3::readClientInit() |
| 37 | { |
| 38 | bool shared = is->readU8(); |
| 39 | handler->clientInit(shared); |
| 40 | } |
| 41 | |
| 42 | void 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 Kaplinsky | 8232831 | 2008-04-24 08:44:24 +0000 | [diff] [blame] | 64 | case msgTypeVideoRectangleSelection: readVideoRectangleSelection(); break; |
Constantin Kaplinsky | dafbb01 | 2007-04-05 08:43:25 +0000 | [diff] [blame] | 65 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 66 | default: |
| 67 | fprintf(stderr, "unknown message type %d\n", msgType); |
| 68 | throw Exception("unknown message type"); |
| 69 | } |
| 70 | } |