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 | |
| 29 | namespace rfb { |
| 30 | |
| 31 | class VNCServer : public UpdateTracker { |
| 32 | public: |
Pierre Ossman | 559a2e8 | 2012-01-23 15:54:11 +0000 | [diff] [blame^] | 33 | // blockUpdates()/unblockUpdates() tells the server that the pixel buffer |
| 34 | // is currently in flux and may not be accessed. The attributes of the |
| 35 | // pixel buffer may still be accessed, but not the frame buffer itself. |
| 36 | // Note that access must be unblocked the exact same number of times it |
| 37 | // was blocked. |
| 38 | virtual void blockUpdates() = 0; |
| 39 | virtual void unblockUpdates() = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 40 | |
Pierre Ossman | 04e62db | 2009-03-23 16:57:07 +0000 | [diff] [blame] | 41 | // setPixelBuffer() tells the server to use the given pixel buffer (and |
| 42 | // optionally a modified screen layout). If this differs in size from |
| 43 | // the previous pixel buffer, this may result in protocol messages being |
| 44 | // sent, or clients being disconnected. |
| 45 | virtual void setPixelBuffer(PixelBuffer* pb, const ScreenSet& layout) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 46 | virtual void setPixelBuffer(PixelBuffer* pb) = 0; |
| 47 | |
Pierre Ossman | 04e62db | 2009-03-23 16:57:07 +0000 | [diff] [blame] | 48 | // setScreenLayout() modifies the current screen layout without changing |
| 49 | // the pixelbuffer. Clients will be notified of the new layout. |
| 50 | virtual void setScreenLayout(const ScreenSet& layout) = 0; |
| 51 | |
Constantin Kaplinsky | d7c0a6d | 2007-09-03 04:23:48 +0000 | [diff] [blame] | 52 | // getPixelBuffer() returns a pointer to the PixelBuffer object. |
| 53 | virtual PixelBuffer* getPixelBuffer() const = 0; |
| 54 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 55 | // setColourMapEntries() tells the server that some entries in the colour |
| 56 | // map have changed. The server will retrieve them via the PixelBuffer's |
| 57 | // ColourMap object. This may result in protocol messages being sent. |
| 58 | // If nColours is 0, this means the rest of the colour map. |
| 59 | virtual void setColourMapEntries(int firstColour=0, int nColours=0) = 0; |
| 60 | |
| 61 | // serverCutText() tells the server that the cut text has changed. This |
| 62 | // will normally be sent to all clients. |
| 63 | virtual void serverCutText(const char* str, int len) = 0; |
| 64 | |
| 65 | // bell() tells the server that it should make all clients make a bell sound. |
| 66 | virtual void bell() = 0; |
| 67 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 68 | // - Close all currently-connected clients, by calling |
| 69 | // their close() method with the supplied reason. |
| 70 | virtual void closeClients(const char* reason) = 0; |
| 71 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 72 | // setCursor() tells the server that the cursor has changed. The |
| 73 | // cursorData argument contains width*height pixel values in the pixel |
| 74 | // buffer's format. The mask argument is a bitmask with a 1-bit meaning |
| 75 | // the corresponding pixel in cursorData is valid. The mask consists of |
| 76 | // left-to-right, top-to-bottom scanlines, where each scanline is padded to |
| 77 | // a whole number of bytes [(width+7)/8]. Within each byte the most |
| 78 | // significant bit represents the leftmost pixel, and the bytes are simply |
| 79 | // in left-to-right order. The server takes its own copy of the data in |
| 80 | // cursorData and mask. |
| 81 | virtual void setCursor(int width, int height, const Point& hotspot, |
| 82 | void* cursorData, void* mask) = 0; |
| 83 | |
| 84 | // setCursorPos() tells the server the current position of the cursor. |
| 85 | virtual void setCursorPos(const Point& p) = 0; |
| 86 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 87 | // setName() tells the server what desktop title to supply to clients |
| 88 | virtual void setName(const char* name) = 0; |
| 89 | }; |
| 90 | } |
| 91 | #endif |