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.1KB

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