Constantin Kaplinsky | fbfbb92 | 2004-11-14 18:28:51 +0000 | [diff] [blame] | 1 | /* 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 | |
| 28 | using namespace rfb; |
| 29 | |
| 30 | class RfbProto : public CMsgHandler { |
| 31 | public: |
| 32 | |
| 33 | RfbProto(char *fileName); |
| 34 | ~RfbProto(); |
| 35 | |
| 36 | void newSession(char *filename); |
| 37 | void initialiseProtocol(); |
george82 | 8edfb7a | 2005-03-03 16:36:10 +0000 | [diff] [blame] | 38 | void interruptFrameDelay() { is->interruptFrameDelay(); }; |
george82 | ea913c1 | 2005-02-09 16:31:48 +0000 | [diff] [blame] | 39 | const rdr::InStream* getInStream() { return is; } |
Constantin Kaplinsky | fbfbb92 | 2004-11-14 18:28:51 +0000 | [diff] [blame] | 40 | |
george82 | 529ed57 | 2005-01-30 16:52:08 +0000 | [diff] [blame] | 41 | virtual void processMsg(); |
Constantin Kaplinsky | fbfbb92 | 2004-11-14 18:28:51 +0000 | [diff] [blame] | 42 | |
| 43 | // serverInit() is called when the ServerInit message is received. The |
| 44 | // derived class must call on to CMsgHandler::serverInit(). |
| 45 | void serverInit(); |
| 46 | |
| 47 | enum stateEnum { |
| 48 | RFBSTATE_PROTOCOL_VERSION, |
| 49 | RFBSTATE_SECURITY, |
| 50 | RFBSTATE_INITIALISATION, |
| 51 | RFBSTATE_NORMAL, |
| 52 | RFBSTATE_INVALID |
| 53 | }; |
| 54 | |
| 55 | stateEnum state() { return state_; } |
| 56 | |
| 57 | protected: |
| 58 | void setState(stateEnum s) { state_ = s; } |
| 59 | virtual void framebufferUpdateEnd() {}; |
| 60 | |
| 61 | FbsInputStream* is; |
george82 | 26af765 | 2005-04-13 12:46:25 +0000 | [diff] [blame] | 62 | CMsgReaderV3* reader; |
Constantin Kaplinsky | fbfbb92 | 2004-11-14 18:28:51 +0000 | [diff] [blame] | 63 | stateEnum state_; |
| 64 | |
| 65 | private: |
| 66 | void processVersionMsg(); |
| 67 | void processSecurityMsg(); |
| 68 | void processInitMsg(); |
| 69 | }; |