You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMsgReader.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2009-2019 Pierre Ossman for Cendio AB
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. //
  20. // CMsgReader - class for reading RFB messages on the server side
  21. // (i.e. messages from client to server).
  22. //
  23. #ifndef __RFB_CMSGREADER_H__
  24. #define __RFB_CMSGREADER_H__
  25. #include <rdr/types.h>
  26. #include <rfb/Rect.h>
  27. #include <rfb/encodings.h>
  28. namespace rdr { class InStream; }
  29. namespace rfb {
  30. class CMsgHandler;
  31. struct Rect;
  32. class CMsgReader {
  33. public:
  34. CMsgReader(CMsgHandler* handler, rdr::InStream* is);
  35. virtual ~CMsgReader();
  36. bool readServerInit();
  37. // readMsg() reads a message, calling the handler as appropriate.
  38. bool readMsg();
  39. rdr::InStream* getInStream() { return is; }
  40. int imageBufIdealSize;
  41. protected:
  42. bool readSetColourMapEntries();
  43. bool readBell();
  44. bool readServerCutText();
  45. bool readExtendedClipboard(rdr::S32 len);
  46. bool readFence();
  47. bool readEndOfContinuousUpdates();
  48. bool readFramebufferUpdate();
  49. bool readRect(const Rect& r, int encoding);
  50. bool readSetXCursor(int width, int height, const Point& hotspot);
  51. bool readSetCursor(int width, int height, const Point& hotspot);
  52. bool readSetCursorWithAlpha(int width, int height, const Point& hotspot);
  53. bool readSetVMwareCursor(int width, int height, const Point& hotspot);
  54. bool readSetDesktopName(int x, int y, int w, int h);
  55. bool readExtendedDesktopSize(int x, int y, int w, int h);
  56. bool readLEDState();
  57. bool readVMwareLEDState();
  58. private:
  59. CMsgHandler* handler;
  60. rdr::InStream* is;
  61. enum stateEnum {
  62. MSGSTATE_IDLE,
  63. MSGSTATE_MESSAGE,
  64. MSGSTATE_RECT_HEADER,
  65. MSGSTATE_RECT_DATA,
  66. };
  67. stateEnum state;
  68. rdr::U8 currentMsgType;
  69. int nUpdateRectsLeft;
  70. Rect dataRect;
  71. int rectEncoding;
  72. int cursorEncoding;
  73. static const int maxCursorSize = 256;
  74. };
  75. }
  76. #endif