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> |
| 27 | |
| 28 | namespace rfb { |
| 29 | |
| 30 | class VNCServer : public UpdateTracker { |
| 31 | public: |
| 32 | |
| 33 | // setPixelBuffer() tells the server to use the given pixel buffer. If |
| 34 | // this differs in size from the previous pixel buffer, this may result in |
| 35 | // protocol messages being sent, or clients being disconnected. |
| 36 | virtual void setPixelBuffer(PixelBuffer* pb) = 0; |
| 37 | |
Constantin Kaplinsky | d7c0a6d | 2007-09-03 04:23:48 +0000 | [diff] [blame^] | 38 | // getPixelBuffer() returns a pointer to the PixelBuffer object. |
| 39 | virtual PixelBuffer* getPixelBuffer() const = 0; |
| 40 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 41 | // setColourMapEntries() tells the server that some entries in the colour |
| 42 | // map have changed. The server will retrieve them via the PixelBuffer's |
| 43 | // ColourMap object. This may result in protocol messages being sent. |
| 44 | // If nColours is 0, this means the rest of the colour map. |
| 45 | virtual void setColourMapEntries(int firstColour=0, int nColours=0) = 0; |
| 46 | |
| 47 | // serverCutText() tells the server that the cut text has changed. This |
| 48 | // will normally be sent to all clients. |
| 49 | virtual void serverCutText(const char* str, int len) = 0; |
| 50 | |
| 51 | // bell() tells the server that it should make all clients make a bell sound. |
| 52 | virtual void bell() = 0; |
| 53 | |
| 54 | // clientsReadyForUpdate() returns true if there is at least one client |
| 55 | // waiting for an update, false if no clients are ready. |
| 56 | virtual bool clientsReadyForUpdate() = 0; |
| 57 | |
| 58 | // - Close all currently-connected clients, by calling |
| 59 | // their close() method with the supplied reason. |
| 60 | virtual void closeClients(const char* reason) = 0; |
| 61 | |
| 62 | // tryUpdate() causes the server to attempt to send updates to any waiting |
| 63 | // clients. |
| 64 | virtual void tryUpdate() = 0; |
| 65 | |
| 66 | // setCursor() tells the server that the cursor has changed. The |
| 67 | // cursorData argument contains width*height pixel values in the pixel |
| 68 | // buffer's format. The mask argument is a bitmask with a 1-bit meaning |
| 69 | // the corresponding pixel in cursorData is valid. The mask consists of |
| 70 | // left-to-right, top-to-bottom scanlines, where each scanline is padded to |
| 71 | // a whole number of bytes [(width+7)/8]. Within each byte the most |
| 72 | // significant bit represents the leftmost pixel, and the bytes are simply |
| 73 | // in left-to-right order. The server takes its own copy of the data in |
| 74 | // cursorData and mask. |
| 75 | virtual void setCursor(int width, int height, const Point& hotspot, |
| 76 | void* cursorData, void* mask) = 0; |
| 77 | |
| 78 | // setCursorPos() tells the server the current position of the cursor. |
| 79 | virtual void setCursorPos(const Point& p) = 0; |
| 80 | |
| 81 | // setSSecurityFactory() tells the server which factory to use when |
| 82 | // attempting to authenticate connections. |
| 83 | virtual void setSSecurityFactory(SSecurityFactory* f) = 0; |
| 84 | |
| 85 | // setName() tells the server what desktop title to supply to clients |
| 86 | virtual void setName(const char* name) = 0; |
| 87 | }; |
| 88 | } |
| 89 | #endif |