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.

VNCServer.h 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. // VNCServer - abstract interface implemented by the RFB library. The back-end
  21. // code calls the relevant methods as appropriate.
  22. #ifndef __RFB_VNCSERVER_H__
  23. #define __RFB_VNCSERVER_H__
  24. #include <network/Socket.h>
  25. #include <rfb/UpdateTracker.h>
  26. #include <rfb/SSecurity.h>
  27. #include <rfb/ScreenSet.h>
  28. namespace rfb {
  29. class VNCServer : public UpdateTracker,
  30. public network::SocketServer {
  31. public:
  32. // blockUpdates()/unblockUpdates() tells the server that the pixel buffer
  33. // is currently in flux and may not be accessed. The attributes of the
  34. // pixel buffer may still be accessed, but not the frame buffer itself.
  35. // Note that access must be unblocked the exact same number of times it
  36. // was blocked.
  37. virtual void blockUpdates() = 0;
  38. virtual void unblockUpdates() = 0;
  39. // setPixelBuffer() tells the server to use the given pixel buffer (and
  40. // optionally a modified screen layout). If this differs in size from
  41. // the previous pixel buffer, this may result in protocol messages being
  42. // sent, or clients being disconnected.
  43. virtual void setPixelBuffer(PixelBuffer* pb, const ScreenSet& layout) = 0;
  44. virtual void setPixelBuffer(PixelBuffer* pb) = 0;
  45. // setScreenLayout() modifies the current screen layout without changing
  46. // the pixelbuffer. Clients will be notified of the new layout.
  47. virtual void setScreenLayout(const ScreenSet& layout) = 0;
  48. // getPixelBuffer() returns a pointer to the PixelBuffer object.
  49. virtual const PixelBuffer* getPixelBuffer() const = 0;
  50. // requestClipboard() will result in a request to a client to
  51. // transfer its clipboard data. A call to
  52. // SDesktop::handleClipboardData() will be made once the data is
  53. // available.
  54. virtual void requestClipboard() = 0;
  55. // announceClipboard() informs all clients of changes to the
  56. // clipboard on the server. A client may later request the
  57. // clipboard data via SDesktop::handleClipboardRequest().
  58. virtual void announceClipboard(bool available) = 0;
  59. // sendClipboardData() transfers the clipboard data to a client
  60. // and should be called whenever a client has requested the
  61. // clipboard via SDesktop::handleClipboardRequest().
  62. virtual void sendClipboardData(const char* data) = 0;
  63. // bell() tells the server that it should make all clients make a bell sound.
  64. virtual void bell() = 0;
  65. // approveConnection() is called some time after
  66. // SDesktop::queryConnection() has been called, to accept or reject
  67. // the connection. The accept argument should be true for
  68. // acceptance, or false for rejection, in which case a string
  69. // reason may also be given.
  70. virtual void approveConnection(network::Socket* sock, bool accept,
  71. const char* reason = NULL) = 0;
  72. // - Close all currently-connected clients, by calling
  73. // their close() method with the supplied reason.
  74. virtual void closeClients(const char* reason) = 0;
  75. // getConnection() gets the SConnection for a particular Socket. If
  76. // the Socket is not recognised then null is returned.
  77. virtual SConnection* getConnection(network::Socket* sock) = 0;
  78. // setCursor() tells the server that the cursor has changed. The
  79. // cursorData argument contains width*height rgba quadruplets with
  80. // non-premultiplied alpha.
  81. virtual void setCursor(int width, int height, const Point& hotspot,
  82. const rdr::U8* cursorData) = 0;
  83. // setCursorPos() tells the server the current position of the cursor.
  84. virtual void setCursorPos(const Point& p) = 0;
  85. // setName() tells the server what desktop title to supply to clients
  86. virtual void setName(const char* name) = 0;
  87. // setLEDState() tells the server what the current lock keys LED
  88. // state is
  89. virtual void setLEDState(unsigned int state) = 0;
  90. };
  91. }
  92. #endif