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 | // |
| 19 | // VNCServer - abstract interface implemented by the RFB library. The back-end |
| 20 | // code calls the relevant methods as appropriate. |
| 21 | |
| 22 | #ifndef __RFB_VNCSERVER_H__ |
| 23 | #define __RFB_VNCSERVER_H__ |
| 24 | |
| 25 | #include <rfb/UpdateTracker.h> |
| 26 | #include <rfb/SSecurity.h> |
Pierre Ossman | 04e62db | 2009-03-23 16:57:07 +0000 | [diff] [blame] | 27 | #include <rfb/ScreenSet.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 28 | |
Pierre Ossman | eef6c9a | 2018-10-05 17:11:25 +0200 | [diff] [blame^] | 29 | namespace network { class Socket; } |
| 30 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 31 | namespace rfb { |
| 32 | |
| 33 | class VNCServer : public UpdateTracker { |
| 34 | public: |
Pierre Ossman | 559a2e8 | 2012-01-23 15:54:11 +0000 | [diff] [blame] | 35 | // blockUpdates()/unblockUpdates() tells the server that the pixel buffer |
| 36 | // is currently in flux and may not be accessed. The attributes of the |
| 37 | // pixel buffer may still be accessed, but not the frame buffer itself. |
| 38 | // Note that access must be unblocked the exact same number of times it |
| 39 | // was blocked. |
| 40 | virtual void blockUpdates() = 0; |
| 41 | virtual void unblockUpdates() = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 42 | |
Pierre Ossman | 04e62db | 2009-03-23 16:57:07 +0000 | [diff] [blame] | 43 | // setPixelBuffer() tells the server to use the given pixel buffer (and |
| 44 | // optionally a modified screen layout). If this differs in size from |
| 45 | // the previous pixel buffer, this may result in protocol messages being |
| 46 | // sent, or clients being disconnected. |
| 47 | virtual void setPixelBuffer(PixelBuffer* pb, const ScreenSet& layout) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 48 | virtual void setPixelBuffer(PixelBuffer* pb) = 0; |
| 49 | |
Pierre Ossman | 04e62db | 2009-03-23 16:57:07 +0000 | [diff] [blame] | 50 | // setScreenLayout() modifies the current screen layout without changing |
| 51 | // the pixelbuffer. Clients will be notified of the new layout. |
| 52 | virtual void setScreenLayout(const ScreenSet& layout) = 0; |
| 53 | |
Constantin Kaplinsky | d7c0a6d | 2007-09-03 04:23:48 +0000 | [diff] [blame] | 54 | // getPixelBuffer() returns a pointer to the PixelBuffer object. |
| 55 | virtual PixelBuffer* getPixelBuffer() const = 0; |
| 56 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 57 | // serverCutText() tells the server that the cut text has changed. This |
| 58 | // will normally be sent to all clients. |
| 59 | virtual void serverCutText(const char* str, int len) = 0; |
| 60 | |
| 61 | // bell() tells the server that it should make all clients make a bell sound. |
| 62 | virtual void bell() = 0; |
| 63 | |
Pierre Ossman | eef6c9a | 2018-10-05 17:11:25 +0200 | [diff] [blame^] | 64 | // approveConnection() is called some time after |
| 65 | // SDesktop::queryConnection() has been called, to accept or reject |
| 66 | // the connection. The accept argument should be true for |
| 67 | // acceptance, or false for rejection, in which case a string |
| 68 | // reason may also be given. |
| 69 | virtual void approveConnection(network::Socket* sock, bool accept, |
| 70 | const char* reason = NULL) = 0; |
| 71 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 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 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 76 | // setCursor() tells the server that the cursor has changed. The |
Pierre Ossman | 6a1a0d0 | 2017-02-19 15:48:17 +0100 | [diff] [blame] | 77 | // cursorData argument contains width*height rgba quadruplets with |
| 78 | // non-premultiplied alpha. |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 79 | virtual void setCursor(int width, int height, const Point& hotspot, |
Pierre Ossman | 6a1a0d0 | 2017-02-19 15:48:17 +0100 | [diff] [blame] | 80 | const rdr::U8* cursorData) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 81 | |
| 82 | // setCursorPos() tells the server the current position of the cursor. |
| 83 | virtual void setCursorPos(const Point& p) = 0; |
| 84 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 85 | // setName() tells the server what desktop title to supply to clients |
| 86 | virtual void setName(const char* name) = 0; |
Pierre Ossman | bb305ca | 2016-12-11 12:41:26 +0100 | [diff] [blame] | 87 | |
| 88 | // setLEDState() tells the server what the current lock keys LED |
| 89 | // state is |
| 90 | virtual void setLEDState(unsigned int state) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 91 | }; |
| 92 | } |
| 93 | #endif |