Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 2 | * Copyright 2011 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 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 | #include <stdio.h> |
| 20 | #include <string.h> |
| 21 | #include <rfb/Exception.h> |
Adam Tkac | 5a0caed | 2010-04-23 13:58:10 +0000 | [diff] [blame] | 22 | #include <rfb/Security.h> |
Constantin Kaplinsky | dafbb01 | 2007-04-05 08:43:25 +0000 | [diff] [blame] | 23 | #include <rfb/msgTypes.h> |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 24 | #include <rfb/fenceTypes.h> |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 25 | #include <rfb/SMsgReader.h> |
| 26 | #include <rfb/SMsgWriter.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 27 | #include <rfb/SConnection.h> |
| 28 | #include <rfb/ServerCore.h> |
Pierre Ossman | 4870081 | 2014-09-17 17:11:56 +0200 | [diff] [blame] | 29 | #include <rfb/encodings.h> |
| 30 | #include <rfb/EncodeManager.h> |
Michal Srb | 8d1ee00 | 2014-11-10 09:15:41 +0200 | [diff] [blame] | 31 | #include <rfb/SSecurity.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 32 | |
| 33 | #include <rfb/LogWriter.h> |
| 34 | |
| 35 | using namespace rfb; |
| 36 | |
| 37 | static LogWriter vlog("SConnection"); |
| 38 | |
| 39 | // AccessRights values |
Michal Srb | b318b8f | 2014-11-24 13:18:28 +0200 | [diff] [blame] | 40 | const SConnection::AccessRights SConnection::AccessView = 0x0001; |
| 41 | const SConnection::AccessRights SConnection::AccessKeyEvents = 0x0002; |
| 42 | const SConnection::AccessRights SConnection::AccessPtrEvents = 0x0004; |
| 43 | const SConnection::AccessRights SConnection::AccessCutText = 0x0008; |
| 44 | const SConnection::AccessRights SConnection::AccessSetDesktopSize = 0x0010; |
Pierre Ossman | e7be49b | 2014-12-02 14:33:17 +0100 | [diff] [blame] | 45 | const SConnection::AccessRights SConnection::AccessNonShared = 0x0020; |
Michal Srb | b318b8f | 2014-11-24 13:18:28 +0200 | [diff] [blame] | 46 | const SConnection::AccessRights SConnection::AccessDefault = 0x03ff; |
| 47 | const SConnection::AccessRights SConnection::AccessNoQuery = 0x0400; |
| 48 | const SConnection::AccessRights SConnection::AccessFull = 0xffff; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 49 | |
| 50 | |
Pierre Ossman | 7069bdd | 2015-02-06 14:41:58 +0100 | [diff] [blame] | 51 | SConnection::SConnection() |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 52 | : readyForSetColourMapEntries(false), |
| 53 | is(0), os(0), reader_(0), writer_(0), |
Michal Srb | dccb5f7 | 2017-03-27 13:55:46 +0300 | [diff] [blame] | 54 | ssecurity(0), state_(RFBSTATE_UNINITIALISED), |
Pierre Ossman | 4870081 | 2014-09-17 17:11:56 +0200 | [diff] [blame] | 55 | preferredEncoding(encodingRaw) |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 56 | { |
| 57 | defaultMajorVersion = 3; |
| 58 | defaultMinorVersion = 8; |
| 59 | if (rfb::Server::protocol3_3) |
| 60 | defaultMinorVersion = 3; |
| 61 | |
| 62 | cp.setVersion(defaultMajorVersion, defaultMinorVersion); |
| 63 | } |
| 64 | |
| 65 | SConnection::~SConnection() |
| 66 | { |
Pierre Ossman | 82d22e6 | 2018-09-21 15:26:37 +0200 | [diff] [blame^] | 67 | if (ssecurity) |
| 68 | delete ssecurity; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 69 | delete reader_; |
| 70 | reader_ = 0; |
| 71 | delete writer_; |
| 72 | writer_ = 0; |
| 73 | } |
| 74 | |
| 75 | void SConnection::setStreams(rdr::InStream* is_, rdr::OutStream* os_) |
| 76 | { |
| 77 | is = is_; |
| 78 | os = os_; |
| 79 | } |
| 80 | |
| 81 | void SConnection::initialiseProtocol() |
| 82 | { |
| 83 | cp.writeVersion(os); |
| 84 | state_ = RFBSTATE_PROTOCOL_VERSION; |
| 85 | } |
| 86 | |
| 87 | void SConnection::processMsg() |
| 88 | { |
| 89 | switch (state_) { |
| 90 | case RFBSTATE_PROTOCOL_VERSION: processVersionMsg(); break; |
| 91 | case RFBSTATE_SECURITY_TYPE: processSecurityTypeMsg(); break; |
| 92 | case RFBSTATE_SECURITY: processSecurityMsg(); break; |
| 93 | case RFBSTATE_INITIALISATION: processInitMsg(); break; |
| 94 | case RFBSTATE_NORMAL: reader_->readMsg(); break; |
| 95 | case RFBSTATE_QUERYING: |
| 96 | throw Exception("SConnection::processMsg: bogus data from client while " |
| 97 | "querying"); |
| 98 | case RFBSTATE_UNINITIALISED: |
| 99 | throw Exception("SConnection::processMsg: not initialised yet?"); |
| 100 | default: |
| 101 | throw Exception("SConnection::processMsg: invalid state"); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | void SConnection::processVersionMsg() |
| 106 | { |
| 107 | vlog.debug("reading protocol version"); |
| 108 | bool done; |
| 109 | if (!cp.readVersion(is, &done)) { |
| 110 | state_ = RFBSTATE_INVALID; |
| 111 | throw Exception("reading version failed: not an RFB client?"); |
| 112 | } |
| 113 | if (!done) return; |
| 114 | |
| 115 | vlog.info("Client needs protocol version %d.%d", |
| 116 | cp.majorVersion, cp.minorVersion); |
| 117 | |
| 118 | if (cp.majorVersion != 3) { |
| 119 | // unknown protocol version |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 120 | throwConnFailedException("Client needs protocol version %d.%d, server has %d.%d", |
| 121 | cp.majorVersion, cp.minorVersion, |
| 122 | defaultMajorVersion, defaultMinorVersion); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | if (cp.minorVersion != 3 && cp.minorVersion != 7 && cp.minorVersion != 8) { |
| 126 | vlog.error("Client uses unofficial protocol version %d.%d", |
| 127 | cp.majorVersion,cp.minorVersion); |
| 128 | if (cp.minorVersion >= 8) |
| 129 | cp.minorVersion = 8; |
| 130 | else if (cp.minorVersion == 7) |
| 131 | cp.minorVersion = 7; |
| 132 | else |
| 133 | cp.minorVersion = 3; |
| 134 | vlog.error("Assuming compatibility with version %d.%d", |
| 135 | cp.majorVersion,cp.minorVersion); |
| 136 | } |
| 137 | |
| 138 | versionReceived(); |
| 139 | |
| 140 | std::list<rdr::U8> secTypes; |
| 141 | std::list<rdr::U8>::iterator i; |
Michal Srb | dccb5f7 | 2017-03-27 13:55:46 +0300 | [diff] [blame] | 142 | secTypes = security.GetEnabledSecTypes(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 143 | |
| 144 | if (cp.isVersion(3,3)) { |
| 145 | |
| 146 | // cope with legacy 3.3 client only if "no authentication" or "vnc |
| 147 | // authentication" is supported. |
| 148 | for (i=secTypes.begin(); i!=secTypes.end(); i++) { |
| 149 | if (*i == secTypeNone || *i == secTypeVncAuth) break; |
| 150 | } |
| 151 | if (i == secTypes.end()) { |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 152 | throwConnFailedException("No supported security type for %d.%d client", |
| 153 | cp.majorVersion, cp.minorVersion); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | os->writeU32(*i); |
| 157 | if (*i == secTypeNone) os->flush(); |
| 158 | state_ = RFBSTATE_SECURITY; |
Michal Srb | dccb5f7 | 2017-03-27 13:55:46 +0300 | [diff] [blame] | 159 | ssecurity = security.GetSSecurity(*i); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 160 | processSecurityMsg(); |
| 161 | return; |
| 162 | } |
| 163 | |
| 164 | // list supported security types for >=3.7 clients |
| 165 | |
| 166 | if (secTypes.empty()) |
| 167 | throwConnFailedException("No supported security types"); |
| 168 | |
| 169 | os->writeU8(secTypes.size()); |
| 170 | for (i=secTypes.begin(); i!=secTypes.end(); i++) |
| 171 | os->writeU8(*i); |
| 172 | os->flush(); |
| 173 | state_ = RFBSTATE_SECURITY_TYPE; |
| 174 | } |
| 175 | |
| 176 | |
| 177 | void SConnection::processSecurityTypeMsg() |
| 178 | { |
| 179 | vlog.debug("processing security type message"); |
| 180 | int secType = is->readU8(); |
| 181 | |
Constantin Kaplinsky | 5fa9d22 | 2006-09-06 10:32:06 +0000 | [diff] [blame] | 182 | processSecurityType(secType); |
| 183 | } |
| 184 | |
| 185 | void SConnection::processSecurityType(int secType) |
| 186 | { |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 187 | // Verify that the requested security type should be offered |
| 188 | std::list<rdr::U8> secTypes; |
| 189 | std::list<rdr::U8>::iterator i; |
Adam Tkac | a6578bf | 2010-04-23 14:07:41 +0000 | [diff] [blame] | 190 | |
Michal Srb | dccb5f7 | 2017-03-27 13:55:46 +0300 | [diff] [blame] | 191 | secTypes = security.GetEnabledSecTypes(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 192 | for (i=secTypes.begin(); i!=secTypes.end(); i++) |
| 193 | if (*i == secType) break; |
| 194 | if (i == secTypes.end()) |
| 195 | throw Exception("Requested security type not available"); |
| 196 | |
| 197 | vlog.info("Client requests security type %s(%d)", |
| 198 | secTypeName(secType),secType); |
| 199 | |
| 200 | try { |
| 201 | state_ = RFBSTATE_SECURITY; |
Michal Srb | dccb5f7 | 2017-03-27 13:55:46 +0300 | [diff] [blame] | 202 | ssecurity = security.GetSSecurity(secType); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 203 | } catch (rdr::Exception& e) { |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 204 | throwConnFailedException("%s", e.str()); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | processSecurityMsg(); |
| 208 | } |
| 209 | |
| 210 | void SConnection::processSecurityMsg() |
| 211 | { |
| 212 | vlog.debug("processing security message"); |
| 213 | try { |
Adam Tkac | a6578bf | 2010-04-23 14:07:41 +0000 | [diff] [blame] | 214 | bool done = ssecurity->processMsg(this); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 215 | if (done) { |
| 216 | state_ = RFBSTATE_QUERYING; |
Michal Srb | 8d1ee00 | 2014-11-10 09:15:41 +0200 | [diff] [blame] | 217 | setAccessRights(ssecurity->getAccessRights()); |
Henrik Andersson | c1cbc70 | 2016-01-27 14:00:44 +0100 | [diff] [blame] | 218 | queryConnection(ssecurity->getUserName()); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 219 | } |
| 220 | } catch (AuthFailureException& e) { |
| 221 | vlog.error("AuthFailureException: %s", e.str()); |
| 222 | os->writeU32(secResultFailed); |
| 223 | if (!cp.beforeVersion(3,8)) // 3.8 onwards have failure message |
| 224 | os->writeString(e.str()); |
| 225 | os->flush(); |
| 226 | throw; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | void SConnection::processInitMsg() |
| 231 | { |
| 232 | vlog.debug("reading client initialisation"); |
| 233 | reader_->readClientInit(); |
| 234 | } |
| 235 | |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 236 | void SConnection::throwConnFailedException(const char* format, ...) |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 237 | { |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 238 | va_list ap; |
| 239 | char str[256]; |
| 240 | |
| 241 | va_start(ap, format); |
| 242 | (void) vsnprintf(str, sizeof(str), format, ap); |
| 243 | va_end(ap); |
| 244 | |
| 245 | vlog.info("Connection failed: %s", str); |
| 246 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 247 | if (state_ == RFBSTATE_PROTOCOL_VERSION) { |
| 248 | if (cp.majorVersion == 3 && cp.minorVersion == 3) { |
| 249 | os->writeU32(0); |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 250 | os->writeString(str); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 251 | os->flush(); |
| 252 | } else { |
| 253 | os->writeU8(0); |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 254 | os->writeString(str); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 255 | os->flush(); |
| 256 | } |
| 257 | } |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 258 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 259 | state_ = RFBSTATE_INVALID; |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 260 | throw ConnFailedException(str); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | void SConnection::writeConnFailedFromScratch(const char* msg, |
| 264 | rdr::OutStream* os) |
| 265 | { |
| 266 | os->writeBytes("RFB 003.003\n", 12); |
| 267 | os->writeU32(0); |
| 268 | os->writeString(msg); |
| 269 | os->flush(); |
| 270 | } |
| 271 | |
Pierre Ossman | f38e243 | 2015-02-11 13:47:58 +0100 | [diff] [blame] | 272 | void SConnection::setEncodings(int nEncodings, const rdr::S32* encodings) |
Pierre Ossman | 4870081 | 2014-09-17 17:11:56 +0200 | [diff] [blame] | 273 | { |
| 274 | int i; |
| 275 | |
| 276 | preferredEncoding = encodingRaw; |
| 277 | for (i = 0;i < nEncodings;i++) { |
| 278 | if (EncodeManager::supported(encodings[i])) { |
| 279 | preferredEncoding = encodings[i]; |
| 280 | break; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | SMsgHandler::setEncodings(nEncodings, encodings); |
| 285 | } |
| 286 | |
Pierre Ossman | 5ae2821 | 2017-05-16 14:30:38 +0200 | [diff] [blame] | 287 | void SConnection::supportsQEMUKeyEvent() |
| 288 | { |
| 289 | writer()->writeQEMUKeyEvent(); |
| 290 | } |
| 291 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 292 | void SConnection::versionReceived() |
| 293 | { |
| 294 | } |
| 295 | |
| 296 | void SConnection::authSuccess() |
| 297 | { |
| 298 | } |
| 299 | |
| 300 | void SConnection::queryConnection(const char* userName) |
| 301 | { |
| 302 | approveConnection(true); |
| 303 | } |
| 304 | |
| 305 | void SConnection::approveConnection(bool accept, const char* reason) |
| 306 | { |
| 307 | if (state_ != RFBSTATE_QUERYING) |
| 308 | throw Exception("SConnection::approveConnection: invalid state"); |
| 309 | |
Adam Tkac | a6578bf | 2010-04-23 14:07:41 +0000 | [diff] [blame] | 310 | if (!cp.beforeVersion(3,8) || ssecurity->getType() != secTypeNone) { |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 311 | if (accept) { |
| 312 | os->writeU32(secResultOK); |
| 313 | } else { |
| 314 | os->writeU32(secResultFailed); |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 315 | if (!cp.beforeVersion(3,8)) { // 3.8 onwards have failure message |
| 316 | if (reason) |
| 317 | os->writeString(reason); |
| 318 | else |
| 319 | os->writeString("Authentication failure"); |
| 320 | } |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 321 | } |
| 322 | os->flush(); |
| 323 | } |
| 324 | |
| 325 | if (accept) { |
| 326 | state_ = RFBSTATE_INITIALISATION; |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 327 | reader_ = new SMsgReader(this, is); |
| 328 | writer_ = new SMsgWriter(&cp, os); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 329 | authSuccess(); |
| 330 | } else { |
| 331 | state_ = RFBSTATE_INVALID; |
Pierre Ossman | 1922550 | 2017-10-12 15:05:07 +0200 | [diff] [blame] | 332 | if (reason) |
| 333 | throw AuthFailureException(reason); |
| 334 | else |
| 335 | throw AuthFailureException(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 336 | } |
| 337 | } |
| 338 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 339 | void SConnection::clientInit(bool shared) |
| 340 | { |
| 341 | writer_->writeServerInit(); |
| 342 | state_ = RFBSTATE_NORMAL; |
| 343 | } |
| 344 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 345 | void SConnection::setPixelFormat(const PixelFormat& pf) |
| 346 | { |
| 347 | SMsgHandler::setPixelFormat(pf); |
| 348 | readyForSetColourMapEntries = true; |
Pierre Ossman | b6b4dc6 | 2014-01-20 15:05:21 +0100 | [diff] [blame] | 349 | if (!pf.trueColour) |
| 350 | writeFakeColourMap(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | void SConnection::framebufferUpdateRequest(const Rect& r, bool incremental) |
| 354 | { |
| 355 | if (!readyForSetColourMapEntries) { |
| 356 | readyForSetColourMapEntries = true; |
| 357 | if (!cp.pf().trueColour) { |
Pierre Ossman | b6b4dc6 | 2014-01-20 15:05:21 +0100 | [diff] [blame] | 358 | writeFakeColourMap(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 359 | } |
| 360 | } |
| 361 | } |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 362 | |
| 363 | void SConnection::fence(rdr::U32 flags, unsigned len, const char data[]) |
| 364 | { |
| 365 | if (!(flags & fenceFlagRequest)) |
| 366 | return; |
| 367 | |
| 368 | // We cannot guarantee any synchronisation at this level |
| 369 | flags = 0; |
| 370 | |
| 371 | writer()->writeFence(flags, len, data); |
| 372 | } |
Pierre Ossman | c898d9a | 2011-11-14 16:22:23 +0000 | [diff] [blame] | 373 | |
| 374 | void SConnection::enableContinuousUpdates(bool enable, |
| 375 | int x, int y, int w, int h) |
| 376 | { |
| 377 | } |
Pierre Ossman | b6b4dc6 | 2014-01-20 15:05:21 +0100 | [diff] [blame] | 378 | |
| 379 | void SConnection::writeFakeColourMap(void) |
| 380 | { |
| 381 | int i; |
| 382 | rdr::U16 red[256], green[256], blue[256]; |
| 383 | |
| 384 | for (i = 0;i < 256;i++) |
| 385 | cp.pf().rgbFromPixel(i, &red[i], &green[i], &blue[i]); |
| 386 | |
| 387 | writer()->writeSetColourMapEntries(0, 256, red, green, blue); |
| 388 | } |