diff options
Diffstat (limited to 'common/rfb')
-rw-r--r-- | common/rfb/CMakeLists.txt | 2 | ||||
-rw-r--r-- | common/rfb/ClientParams.cxx (renamed from common/rfb/ConnParams.cxx) | 26 | ||||
-rw-r--r-- | common/rfb/ClientParams.h (renamed from common/rfb/ConnParams.h) | 14 | ||||
-rw-r--r-- | common/rfb/EncodeManager.cxx | 36 | ||||
-rw-r--r-- | common/rfb/HextileEncoder.cxx | 2 | ||||
-rw-r--r-- | common/rfb/JpegCompressor.cxx | 2 | ||||
-rw-r--r-- | common/rfb/RREEncoder.cxx | 2 | ||||
-rw-r--r-- | common/rfb/SConnection.cxx | 44 | ||||
-rw-r--r-- | common/rfb/SMsgHandler.cxx | 22 | ||||
-rw-r--r-- | common/rfb/SMsgHandler.h | 4 | ||||
-rw-r--r-- | common/rfb/SMsgWriter.cxx | 80 | ||||
-rw-r--r-- | common/rfb/SMsgWriter.h | 6 | ||||
-rw-r--r-- | common/rfb/TightEncoder.cxx | 3 | ||||
-rw-r--r-- | common/rfb/TightJPEGEncoder.cxx | 8 | ||||
-rw-r--r-- | common/rfb/VNCSConnectionST.cxx | 72 | ||||
-rw-r--r-- | common/rfb/ZRLEEncoder.cxx | 3 |
16 files changed, 161 insertions, 165 deletions
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 6b8be3bd..8e532a28 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -11,9 +11,9 @@ set(RFB_SOURCES CSecurityStack.cxx CSecurityVeNCrypt.cxx CSecurityVncAuth.cxx + ClientParams.cxx ComparingUpdateTracker.cxx Configuration.cxx - ConnParams.cxx CopyRectDecoder.cxx Cursor.cxx DecodeManager.cxx diff --git a/common/rfb/ConnParams.cxx b/common/rfb/ClientParams.cxx index 1fdf8f38..6209f4d5 100644 --- a/common/rfb/ConnParams.cxx +++ b/common/rfb/ClientParams.cxx @@ -1,6 +1,6 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright (C) 2011 D. R. Commander. All Rights Reserved. - * Copyright 2014 Pierre Ossman for Cendio AB + * Copyright 2014-2018 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,16 +17,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ -#include <stdio.h> #include <rfb/Exception.h> #include <rfb/encodings.h> #include <rfb/ledStates.h> -#include <rfb/ConnParams.h> -#include <rfb/util.h> +#include <rfb/ClientParams.h> using namespace rfb; -ConnParams::ConnParams() +ClientParams::ClientParams() : majorVersion(0), minorVersion(0), useCopyRect(false), supportsLocalCursor(false), supportsLocalXCursor(false), @@ -45,20 +43,20 @@ ConnParams::ConnParams() cursor_ = new Cursor(0, 0, Point(), NULL); } -ConnParams::~ConnParams() +ClientParams::~ClientParams() { delete [] name_; delete cursor_; } -void ConnParams::setDimensions(int width, int height) +void ClientParams::setDimensions(int width, int height) { ScreenSet layout; layout.add_screen(rfb::Screen(0, 0, 0, width, height, 0)); setDimensions(width, height, layout); } -void ConnParams::setDimensions(int width, int height, const ScreenSet& layout) +void ClientParams::setDimensions(int width, int height, const ScreenSet& layout) { if (!layout.validate(width, height)) throw Exception("Attempted to configure an invalid screen layout"); @@ -68,7 +66,7 @@ void ConnParams::setDimensions(int width, int height, const ScreenSet& layout) screenLayout_ = layout; } -void ConnParams::setPF(const PixelFormat& pf) +void ClientParams::setPF(const PixelFormat& pf) { pf_ = pf; @@ -76,24 +74,24 @@ void ConnParams::setPF(const PixelFormat& pf) throw Exception("setPF: not 8, 16 or 32 bpp?"); } -void ConnParams::setName(const char* name) +void ClientParams::setName(const char* name) { delete [] name_; name_ = strDup(name); } -void ConnParams::setCursor(const Cursor& other) +void ClientParams::setCursor(const Cursor& other) { delete cursor_; cursor_ = new Cursor(other); } -bool ConnParams::supportsEncoding(rdr::S32 encoding) const +bool ClientParams::supportsEncoding(rdr::S32 encoding) const { return encodings_.count(encoding) != 0; } -void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings) +void ClientParams::setEncodings(int nEncodings, const rdr::S32* encodings) { useCopyRect = false; supportsLocalCursor = false; @@ -186,7 +184,7 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings) } } -void ConnParams::setLEDState(unsigned int state) +void ClientParams::setLEDState(unsigned int state) { ledState_ = state; } diff --git a/common/rfb/ConnParams.h b/common/rfb/ClientParams.h index 1640efcc..6b368957 100644 --- a/common/rfb/ConnParams.h +++ b/common/rfb/ClientParams.h @@ -1,5 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright 2014 Pierre Ossman for Cendio AB + * Copyright 2014-2018 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,11 +17,11 @@ * USA. */ // -// ConnParams - structure containing the connection parameters. +// ClientParams - structure describing the current state of the remote client // -#ifndef __RFB_CONNPARAMS_H__ -#define __RFB_CONNPARAMS_H__ +#ifndef __RFB_CLIENTPARAMS_H__ +#define __RFB_CLIENTPARAMS_H__ #include <set> @@ -40,10 +40,10 @@ namespace rfb { const int subsample8X = 4; const int subsample16X = 5; - class ConnParams { + class ClientParams { public: - ConnParams(); - ~ConnParams(); + ClientParams(); + ~ClientParams(); int majorVersion; int minorVersion; diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 02128f7f..7589cb6a 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -334,7 +334,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, changed.assign_subtract(renderedCursor->getEffectiveRect()); } - if (conn->cp.supportsLastRect) + if (conn->client.supportsLastRect) nRects = 0xFFFF; else { nRects = copied.numRects(); @@ -350,7 +350,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, * We start by searching for solid rects, which are then removed * from the changed region. */ - if (conn->cp.supportsLastRect) + if (conn->client.supportsLastRect) writeSolidRects(&changed, pb); writeRects(changed, pb); @@ -373,7 +373,7 @@ void EncodeManager::prepareEncoders(bool allowLossy) solid = bitmap = bitmapRLE = encoderRaw; indexed = indexedRLE = fullColour = encoderRaw; - allowJPEG = conn->cp.pf().bpp >= 16; + allowJPEG = conn->client.pf().bpp >= 16; if (!allowLossy) { if (encoders[encoderTightJPEG]->losslessQuality == -1) allowJPEG = false; @@ -447,7 +447,7 @@ void EncodeManager::prepareEncoders(bool allowLossy) } // JPEG is the only encoder that can reduce things to grayscale - if ((conn->cp.subsampling == subsampleGray) && + if ((conn->client.subsampling == subsampleGray) && encoders[encoderTightJPEG]->isSupported() && allowLossy) { solid = bitmap = bitmapRLE = encoderTightJPEG; indexed = indexedRLE = fullColour = encoderTightJPEG; @@ -465,14 +465,14 @@ void EncodeManager::prepareEncoders(bool allowLossy) encoder = encoders[*iter]; - encoder->setCompressLevel(conn->cp.compressLevel); + encoder->setCompressLevel(conn->client.compressLevel); if (allowLossy) { - encoder->setQualityLevel(conn->cp.qualityLevel); - encoder->setFineQualityLevel(conn->cp.fineQualityLevel, - conn->cp.subsampling); + encoder->setQualityLevel(conn->client.qualityLevel); + encoder->setFineQualityLevel(conn->client.fineQualityLevel, + conn->client.subsampling); } else { - int level = __rfbmax(conn->cp.qualityLevel, + int level = __rfbmax(conn->client.qualityLevel, encoder->losslessQuality); encoder->setQualityLevel(level); encoder->setFineQualityLevel(-1, subsampleUndefined); @@ -575,7 +575,7 @@ Encoder *EncodeManager::startRect(const Rect& rect, int type) stats[klass][activeType].rects++; stats[klass][activeType].pixels += rect.area(); - equiv = 12 + rect.area() * (conn->cp.pf().bpp/8); + equiv = 12 + rect.area() * (conn->client.pf().bpp/8); stats[klass][activeType].equivalent += equiv; encoder = encoders[klass]; @@ -623,7 +623,7 @@ void EncodeManager::writeCopyRects(const Region& copied, const Point& delta) copyStats.rects++; copyStats.pixels += rect->area(); - equiv = 12 + rect->area() * (conn->cp.pf().bpp/8); + equiv = 12 + rect->area() * (conn->client.pf().bpp/8); copyStats.equivalent += equiv; conn->writer()->writeCopyRect(*rect, rect->tl.x - delta.x, @@ -710,11 +710,11 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed, rdr::U32 _buffer2; rdr::U8* converted = (rdr::U8*)&_buffer2; - conn->cp.pf().bufferFromBuffer(converted, pb->getPF(), + conn->client.pf().bufferFromBuffer(converted, pb->getPF(), colourValue, 1); encoder->writeSolidRect(erp.width(), erp.height(), - conn->cp.pf(), converted); + conn->client.pf(), converted); } endRect(); @@ -808,10 +808,10 @@ void EncodeManager::writeSubRect(const Rect& rect, const PixelBuffer *pb) // compression setting means spending less effort in building // a palette. It might be that they figured the increase in // zlib setting compensated for the loss. - if (conn->cp.compressLevel == -1) + if (conn->client.compressLevel == -1) divisor = 2 * 8; else - divisor = conn->cp.compressLevel * 8; + divisor = conn->client.compressLevel * 8; if (divisor < 4) divisor = 4; @@ -819,7 +819,7 @@ void EncodeManager::writeSubRect(const Rect& rect, const PixelBuffer *pb) // Special exception inherited from the Tight encoder if (activeEncoders[encoderFullColour] == encoderTightJPEG) { - if ((conn->cp.compressLevel != -1) && (conn->cp.compressLevel < 2)) + if ((conn->client.compressLevel != -1) && (conn->client.compressLevel < 2)) maxColours = 24; else maxColours = 96; @@ -992,8 +992,8 @@ PixelBuffer* EncodeManager::preparePixelBuffer(const Rect& rect, int stride; // Do wo need to convert the data? - if (convert && !conn->cp.pf().equal(pb->getPF())) { - convertedPixelBuffer.setPF(conn->cp.pf()); + if (convert && !conn->client.pf().equal(pb->getPF())) { + convertedPixelBuffer.setPF(conn->client.pf()); convertedPixelBuffer.setSize(rect.width(), rect.height()); buffer = pb->getBuffer(rect, &stride); diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx index 47e52510..1e20eb92 100644 --- a/common/rfb/HextileEncoder.cxx +++ b/common/rfb/HextileEncoder.cxx @@ -55,7 +55,7 @@ HextileEncoder::~HextileEncoder() bool HextileEncoder::isSupported() { - return conn->cp.supportsEncoding(encodingHextile); + return conn->client.supportsEncoding(encodingHextile); } void HextileEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx index 27cb9de3..23b8f8cf 100644 --- a/common/rfb/JpegCompressor.cxx +++ b/common/rfb/JpegCompressor.cxx @@ -22,7 +22,7 @@ #include <rdr/Exception.h> #include <rfb/Rect.h> #include <rfb/PixelFormat.h> -#include <rfb/ConnParams.h> +#include <rfb/ClientParams.h> #include <stdio.h> extern "C" { diff --git a/common/rfb/RREEncoder.cxx b/common/rfb/RREEncoder.cxx index 7287e7eb..83585490 100644 --- a/common/rfb/RREEncoder.cxx +++ b/common/rfb/RREEncoder.cxx @@ -47,7 +47,7 @@ RREEncoder::~RREEncoder() bool RREEncoder::isSupported() { - return conn->cp.supportsEncoding(encodingRRE); + return conn->client.supportsEncoding(encodingRRE); } void RREEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index 846e97e4..52a1113d 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -59,7 +59,7 @@ SConnection::SConnection() if (rfb::Server::protocol3_3) defaultMinorVersion = 3; - cp.setVersion(defaultMajorVersion, defaultMinorVersion); + client.setVersion(defaultMajorVersion, defaultMinorVersion); } SConnection::~SConnection() @@ -127,29 +127,29 @@ void SConnection::processVersionMsg() throw Exception("reading version failed: not an RFB client?"); } - cp.setVersion(majorVersion, minorVersion); + client.setVersion(majorVersion, minorVersion); vlog.info("Client needs protocol version %d.%d", - cp.majorVersion, cp.minorVersion); + client.majorVersion, client.minorVersion); - if (cp.majorVersion != 3) { + if (client.majorVersion != 3) { // unknown protocol version throwConnFailedException("Client needs protocol version %d.%d, server has %d.%d", - cp.majorVersion, cp.minorVersion, + client.majorVersion, client.minorVersion, defaultMajorVersion, defaultMinorVersion); } - if (cp.minorVersion != 3 && cp.minorVersion != 7 && cp.minorVersion != 8) { + if (client.minorVersion != 3 && client.minorVersion != 7 && client.minorVersion != 8) { vlog.error("Client uses unofficial protocol version %d.%d", - cp.majorVersion,cp.minorVersion); - if (cp.minorVersion >= 8) - cp.minorVersion = 8; - else if (cp.minorVersion == 7) - cp.minorVersion = 7; + client.majorVersion,client.minorVersion); + if (client.minorVersion >= 8) + client.minorVersion = 8; + else if (client.minorVersion == 7) + client.minorVersion = 7; else - cp.minorVersion = 3; + client.minorVersion = 3; vlog.error("Assuming compatibility with version %d.%d", - cp.majorVersion,cp.minorVersion); + client.majorVersion,client.minorVersion); } versionReceived(); @@ -158,7 +158,7 @@ void SConnection::processVersionMsg() std::list<rdr::U8>::iterator i; secTypes = security.GetEnabledSecTypes(); - if (cp.isVersion(3,3)) { + if (client.isVersion(3,3)) { // cope with legacy 3.3 client only if "no authentication" or "vnc // authentication" is supported. @@ -167,7 +167,7 @@ void SConnection::processVersionMsg() } if (i == secTypes.end()) { throwConnFailedException("No supported security type for %d.%d client", - cp.majorVersion, cp.minorVersion); + client.majorVersion, client.minorVersion); } os->writeU32(*i); @@ -237,7 +237,7 @@ void SConnection::processSecurityMsg() } catch (AuthFailureException& e) { vlog.error("AuthFailureException: %s", e.str()); os->writeU32(secResultFailed); - if (!cp.beforeVersion(3,8)) // 3.8 onwards have failure message + if (!client.beforeVersion(3,8)) // 3.8 onwards have failure message os->writeString(e.str()); os->flush(); throw; @@ -262,7 +262,7 @@ void SConnection::throwConnFailedException(const char* format, ...) vlog.info("Connection failed: %s", str); if (state_ == RFBSTATE_PROTOCOL_VERSION) { - if (cp.majorVersion == 3 && cp.minorVersion == 3) { + if (client.majorVersion == 3 && client.minorVersion == 3) { os->writeU32(0); os->writeString(str); os->flush(); @@ -324,12 +324,12 @@ void SConnection::approveConnection(bool accept, const char* reason) if (state_ != RFBSTATE_QUERYING) throw Exception("SConnection::approveConnection: invalid state"); - if (!cp.beforeVersion(3,8) || ssecurity->getType() != secTypeNone) { + if (!client.beforeVersion(3,8) || ssecurity->getType() != secTypeNone) { if (accept) { os->writeU32(secResultOK); } else { os->writeU32(secResultFailed); - if (!cp.beforeVersion(3,8)) { // 3.8 onwards have failure message + if (!client.beforeVersion(3,8)) { // 3.8 onwards have failure message if (reason) os->writeString(reason); else @@ -342,7 +342,7 @@ void SConnection::approveConnection(bool accept, const char* reason) if (accept) { state_ = RFBSTATE_INITIALISATION; reader_ = new SMsgReader(this, is); - writer_ = new SMsgWriter(&cp, os); + writer_ = new SMsgWriter(&client, os); authSuccess(); } else { state_ = RFBSTATE_INVALID; @@ -371,7 +371,7 @@ void SConnection::framebufferUpdateRequest(const Rect& r, bool incremental) { if (!readyForSetColourMapEntries) { readyForSetColourMapEntries = true; - if (!cp.pf().trueColour) { + if (!client.pf().trueColour) { writeFakeColourMap(); } } @@ -399,7 +399,7 @@ void SConnection::writeFakeColourMap(void) rdr::U16 red[256], green[256], blue[256]; for (i = 0;i < 256;i++) - cp.pf().rgbFromPixel(i, &red[i], &green[i], &blue[i]); + client.pf().rgbFromPixel(i, &red[i], &green[i], &blue[i]); writer()->writeSetColourMapEntries(0, 256, red, green, blue); } diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx index 137734b3..f0e277ce 100644 --- a/common/rfb/SMsgHandler.cxx +++ b/common/rfb/SMsgHandler.cxx @@ -36,7 +36,7 @@ void SMsgHandler::clientInit(bool shared) void SMsgHandler::setPixelFormat(const PixelFormat& pf) { - cp.setPF(pf); + client.setPF(pf); } void SMsgHandler::setEncodings(int nEncodings, const rdr::S32* encodings) @@ -44,22 +44,22 @@ void SMsgHandler::setEncodings(int nEncodings, const rdr::S32* encodings) bool firstFence, firstContinuousUpdates, firstLEDState, firstQEMUKeyEvent; - firstFence = !cp.supportsFence; - firstContinuousUpdates = !cp.supportsContinuousUpdates; - firstLEDState = !cp.supportsLEDState; - firstQEMUKeyEvent = !cp.supportsQEMUKeyEvent; + firstFence = !client.supportsFence; + firstContinuousUpdates = !client.supportsContinuousUpdates; + firstLEDState = !client.supportsLEDState; + firstQEMUKeyEvent = !client.supportsQEMUKeyEvent; - cp.setEncodings(nEncodings, encodings); + client.setEncodings(nEncodings, encodings); supportsLocalCursor(); - if (cp.supportsFence && firstFence) + if (client.supportsFence && firstFence) supportsFence(); - if (cp.supportsContinuousUpdates && firstContinuousUpdates) + if (client.supportsContinuousUpdates && firstContinuousUpdates) supportsContinuousUpdates(); - if (cp.supportsLEDState && firstLEDState) + if (client.supportsLEDState && firstLEDState) supportsLEDState(); - if (cp.supportsQEMUKeyEvent && firstQEMUKeyEvent) + if (client.supportsQEMUKeyEvent && firstQEMUKeyEvent) supportsQEMUKeyEvent(); } @@ -86,6 +86,6 @@ void SMsgHandler::supportsQEMUKeyEvent() void SMsgHandler::setDesktopSize(int fb_width, int fb_height, const ScreenSet& layout) { - cp.setDimensions(fb_width, fb_height, layout); + client.setDimensions(fb_width, fb_height, layout); } diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h index 749f0560..d6548013 100644 --- a/common/rfb/SMsgHandler.h +++ b/common/rfb/SMsgHandler.h @@ -25,7 +25,7 @@ #include <rdr/types.h> #include <rfb/PixelFormat.h> -#include <rfb/ConnParams.h> +#include <rfb/ClientParams.h> #include <rfb/InputHandler.h> #include <rfb/ScreenSet.h> @@ -85,7 +85,7 @@ namespace rfb { // handler will send a pseudo-rect back, signalling server support. virtual void supportsQEMUKeyEvent(); - ConnParams cp; + ClientParams client; }; } #endif diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx index 96df6533..bcc848fc 100644 --- a/common/rfb/SMsgWriter.cxx +++ b/common/rfb/SMsgWriter.cxx @@ -22,7 +22,7 @@ #include <rfb/msgTypes.h> #include <rfb/fenceTypes.h> #include <rfb/Exception.h> -#include <rfb/ConnParams.h> +#include <rfb/ClientParams.h> #include <rfb/UpdateTracker.h> #include <rfb/Encoder.h> #include <rfb/SMsgWriter.h> @@ -33,8 +33,8 @@ using namespace rfb; static LogWriter vlog("SMsgWriter"); -SMsgWriter::SMsgWriter(ConnParams* cp_, rdr::OutStream* os_) - : cp(cp_), os(os_), +SMsgWriter::SMsgWriter(ClientParams* client_, rdr::OutStream* os_) + : client(client_), os(os_), nRectsInUpdate(0), nRectsInHeader(0), needSetDesktopSize(false), needExtendedDesktopSize(false), needSetDesktopName(false), needSetCursor(false), @@ -49,10 +49,10 @@ SMsgWriter::~SMsgWriter() void SMsgWriter::writeServerInit() { - os->writeU16(cp->width()); - os->writeU16(cp->height()); - cp->pf().write(os); - os->writeString(cp->name()); + os->writeU16(client->width()); + os->writeU16(client->height()); + client->pf().write(os); + os->writeString(client->name()); endMsg(); } @@ -90,7 +90,7 @@ void SMsgWriter::writeServerCutText(const char* str, int len) void SMsgWriter::writeFence(rdr::U32 flags, unsigned len, const char data[]) { - if (!cp->supportsFence) + if (!client->supportsFence) throw Exception("Client does not support fences"); if (len > 64) throw Exception("Too large fence payload"); @@ -112,7 +112,7 @@ void SMsgWriter::writeFence(rdr::U32 flags, unsigned len, const char data[]) void SMsgWriter::writeEndOfContinuousUpdates() { - if (!cp->supportsContinuousUpdates) + if (!client->supportsContinuousUpdates) throw Exception("Client does not support continuous updates"); startMsg(msgTypeEndOfContinuousUpdates); @@ -120,7 +120,7 @@ void SMsgWriter::writeEndOfContinuousUpdates() } bool SMsgWriter::writeSetDesktopSize() { - if (!cp->supportsDesktopResize) + if (!client->supportsDesktopResize) return false; needSetDesktopSize = true; @@ -129,7 +129,7 @@ bool SMsgWriter::writeSetDesktopSize() { } bool SMsgWriter::writeExtendedDesktopSize() { - if (!cp->supportsExtendedDesktopSize) + if (!client->supportsExtendedDesktopSize) return false; needExtendedDesktopSize = true; @@ -142,7 +142,7 @@ bool SMsgWriter::writeExtendedDesktopSize(rdr::U16 reason, rdr::U16 result, const ScreenSet& layout) { ExtendedDesktopSizeMsg msg; - if (!cp->supportsExtendedDesktopSize) + if (!client->supportsExtendedDesktopSize) return false; msg.reason = reason; @@ -157,7 +157,7 @@ bool SMsgWriter::writeExtendedDesktopSize(rdr::U16 reason, rdr::U16 result, } bool SMsgWriter::writeSetDesktopName() { - if (!cp->supportsDesktopRename) + if (!client->supportsDesktopRename) return false; needSetDesktopName = true; @@ -167,7 +167,7 @@ bool SMsgWriter::writeSetDesktopName() { bool SMsgWriter::writeSetCursor() { - if (!cp->supportsLocalCursor) + if (!client->supportsLocalCursor) return false; needSetCursor = true; @@ -177,7 +177,7 @@ bool SMsgWriter::writeSetCursor() bool SMsgWriter::writeSetXCursor() { - if (!cp->supportsLocalXCursor) + if (!client->supportsLocalXCursor) return false; needSetXCursor = true; @@ -187,7 +187,7 @@ bool SMsgWriter::writeSetXCursor() bool SMsgWriter::writeSetCursorWithAlpha() { - if (!cp->supportsLocalCursorWithAlpha) + if (!client->supportsLocalCursorWithAlpha) return false; needSetCursorWithAlpha = true; @@ -197,9 +197,9 @@ bool SMsgWriter::writeSetCursorWithAlpha() bool SMsgWriter::writeLEDState() { - if (!cp->supportsLEDState) + if (!client->supportsLEDState) return false; - if (cp->ledState() == ledUnknown) + if (client->ledState() == ledUnknown) return false; needLEDState = true; @@ -209,7 +209,7 @@ bool SMsgWriter::writeLEDState() bool SMsgWriter::writeQEMUKeyEvent() { - if (!cp->supportsQEMUKeyEvent) + if (!client->supportsQEMUKeyEvent) return false; needQEMUKeyEvent = true; @@ -348,9 +348,9 @@ void SMsgWriter::endMsg() void SMsgWriter::writePseudoRects() { if (needSetCursor) { - const Cursor& cursor = cp->cursor(); + const Cursor& cursor = client->cursor(); - rdr::U8Array data(cursor.width()*cursor.height() * (cp->pf().bpp/8)); + rdr::U8Array data(cursor.width()*cursor.height() * (client->pf().bpp/8)); rdr::U8Array mask(cursor.getMask()); const rdr::U8* in; @@ -359,9 +359,9 @@ void SMsgWriter::writePseudoRects() in = cursor.getBuffer(); out = data.buf; for (int i = 0;i < cursor.width()*cursor.height();i++) { - cp->pf().bufferFromRGB(out, in, 1); + client->pf().bufferFromRGB(out, in, 1); in += 4; - out += cp->pf().bpp/8; + out += client->pf().bpp/8; } writeSetCursorRect(cursor.width(), cursor.height(), @@ -371,7 +371,7 @@ void SMsgWriter::writePseudoRects() } if (needSetXCursor) { - const Cursor& cursor = cp->cursor(); + const Cursor& cursor = client->cursor(); rdr::U8Array bitmap(cursor.getBitmap()); rdr::U8Array mask(cursor.getMask()); @@ -382,7 +382,7 @@ void SMsgWriter::writePseudoRects() } if (needSetCursorWithAlpha) { - const Cursor& cursor = cp->cursor(); + const Cursor& cursor = client->cursor(); writeSetCursorWithAlphaRect(cursor.width(), cursor.height(), cursor.hotspot().x, cursor.hotspot().y, @@ -391,12 +391,12 @@ void SMsgWriter::writePseudoRects() } if (needSetDesktopName) { - writeSetDesktopNameRect(cp->name()); + writeSetDesktopNameRect(client->name()); needSetDesktopName = false; } if (needLEDState) { - writeLEDStateRect(cp->ledState()); + writeLEDStateRect(client->ledState()); needLEDState = false; } @@ -422,22 +422,22 @@ void SMsgWriter::writeNoDataRects() // Send this before SetDesktopSize to make life easier on the clients if (needExtendedDesktopSize) { - writeExtendedDesktopSizeRect(0, 0, cp->width(), cp->height(), - cp->screenLayout()); + writeExtendedDesktopSizeRect(0, 0, client->width(), client->height(), + client->screenLayout()); needExtendedDesktopSize = false; } // Some clients assume this is the last rectangle so don't send anything // more after this if (needSetDesktopSize) { - writeSetDesktopSizeRect(cp->width(), cp->height()); + writeSetDesktopSizeRect(client->width(), client->height()); needSetDesktopSize = false; } } void SMsgWriter::writeSetDesktopSizeRect(int width, int height) { - if (!cp->supportsDesktopResize) + if (!client->supportsDesktopResize) throw Exception("Client does not support desktop resize"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeSetDesktopSizeRect: nRects out of sync"); @@ -457,7 +457,7 @@ void SMsgWriter::writeExtendedDesktopSizeRect(rdr::U16 reason, { ScreenSet::const_iterator si; - if (!cp->supportsExtendedDesktopSize) + if (!client->supportsExtendedDesktopSize) throw Exception("Client does not support extended desktop resize"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeExtendedDesktopSizeRect: nRects out of sync"); @@ -483,7 +483,7 @@ void SMsgWriter::writeExtendedDesktopSizeRect(rdr::U16 reason, void SMsgWriter::writeSetDesktopNameRect(const char *name) { - if (!cp->supportsDesktopRename) + if (!client->supportsDesktopRename) throw Exception("Client does not support desktop rename"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeSetDesktopNameRect: nRects out of sync"); @@ -500,7 +500,7 @@ void SMsgWriter::writeSetCursorRect(int width, int height, int hotspotX, int hotspotY, const void* data, const void* mask) { - if (!cp->supportsLocalCursor) + if (!client->supportsLocalCursor) throw Exception("Client does not support local cursors"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeSetCursorRect: nRects out of sync"); @@ -510,7 +510,7 @@ void SMsgWriter::writeSetCursorRect(int width, int height, os->writeU16(width); os->writeU16(height); os->writeU32(pseudoEncodingCursor); - os->writeBytes(data, width * height * (cp->pf().bpp/8)); + os->writeBytes(data, width * height * (client->pf().bpp/8)); os->writeBytes(mask, (width+7)/8 * height); } @@ -518,7 +518,7 @@ void SMsgWriter::writeSetXCursorRect(int width, int height, int hotspotX, int hotspotY, const void* data, const void* mask) { - if (!cp->supportsLocalXCursor) + if (!client->supportsLocalXCursor) throw Exception("Client does not support local cursors"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeSetXCursorRect: nRects out of sync"); @@ -544,7 +544,7 @@ void SMsgWriter::writeSetCursorWithAlphaRect(int width, int height, int hotspotX, int hotspotY, const rdr::U8* data) { - if (!cp->supportsLocalCursorWithAlpha) + if (!client->supportsLocalCursorWithAlpha) throw Exception("Client does not support local cursors"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeSetCursorWithAlphaRect: nRects out of sync"); @@ -570,9 +570,9 @@ void SMsgWriter::writeSetCursorWithAlphaRect(int width, int height, void SMsgWriter::writeLEDStateRect(rdr::U8 state) { - if (!cp->supportsLEDState) + if (!client->supportsLEDState) throw Exception("Client does not support LED state updates"); - if (cp->ledState() == ledUnknown) + if (client->ledState() == ledUnknown) throw Exception("Server does not support LED state updates"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeLEDStateRect: nRects out of sync"); @@ -587,7 +587,7 @@ void SMsgWriter::writeLEDStateRect(rdr::U8 state) void SMsgWriter::writeQEMUKeyEventRect() { - if (!cp->supportsQEMUKeyEvent) + if (!client->supportsQEMUKeyEvent) throw Exception("Client does not support QEMU extended key events"); if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) throw Exception("SMsgWriter::writeQEMUKeyEventRect: nRects out of sync"); diff --git a/common/rfb/SMsgWriter.h b/common/rfb/SMsgWriter.h index e9859416..2db147bd 100644 --- a/common/rfb/SMsgWriter.h +++ b/common/rfb/SMsgWriter.h @@ -31,12 +31,12 @@ namespace rdr { class OutStream; } namespace rfb { - class ConnParams; + class ClientParams; struct ScreenSet; class SMsgWriter { public: - SMsgWriter(ConnParams* cp, rdr::OutStream* os); + SMsgWriter(ClientParams* client, rdr::OutStream* os); virtual ~SMsgWriter(); // writeServerInit() must only be called at the appropriate time in the @@ -140,7 +140,7 @@ namespace rfb { void writeLEDStateRect(rdr::U8 state); void writeQEMUKeyEventRect(); - ConnParams* cp; + ClientParams* client; rdr::OutStream* os; int nRectsInUpdate; diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx index 0d428f16..1b0792c4 100644 --- a/common/rfb/TightEncoder.cxx +++ b/common/rfb/TightEncoder.cxx @@ -23,7 +23,6 @@ #include <rfb/PixelBuffer.h> #include <rfb/Palette.h> #include <rfb/encodings.h> -#include <rfb/ConnParams.h> #include <rfb/SConnection.h> #include <rfb/TightEncoder.h> #include <rfb/TightConstants.h> @@ -68,7 +67,7 @@ TightEncoder::~TightEncoder() bool TightEncoder::isSupported() { - return conn->cp.supportsEncoding(encodingTight); + return conn->client.supportsEncoding(encodingTight); } void TightEncoder::setCompressLevel(int level) diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx index 38cb4eb7..75575389 100644 --- a/common/rfb/TightJPEGEncoder.cxx +++ b/common/rfb/TightJPEGEncoder.cxx @@ -76,15 +76,15 @@ TightJPEGEncoder::~TightJPEGEncoder() bool TightJPEGEncoder::isSupported() { - if (!conn->cp.supportsEncoding(encodingTight)) + if (!conn->client.supportsEncoding(encodingTight)) return false; // Any one of these indicates support for JPEG - if (conn->cp.qualityLevel != -1) + if (conn->client.qualityLevel != -1) return true; - if (conn->cp.fineQualityLevel != -1) + if (conn->client.fineQualityLevel != -1) return true; - if (conn->cp.subsampling != -1) + if (conn->client.subsampling != -1) return true; // Tight support, but not JPEG diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 4dd00354..f01b248c 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -192,9 +192,9 @@ void VNCSConnectionST::pixelBufferChange() { try { if (!authenticated()) return; - if (cp.width() && cp.height() && - (server->pb->width() != cp.width() || - server->pb->height() != cp.height())) + if (client.width() && client.height() && + (server->pb->width() != client.width() || + server->pb->height() != client.height())) { // We need to clip the next update to the new size, but also add any // extra bits if it's bigger. If we wanted to do this exactly, something @@ -204,17 +204,17 @@ void VNCSConnectionST::pixelBufferChange() //updates.intersect(server->pb->getRect()); // - //if (server->pb->width() > cp.width()) - // updates.add_changed(Rect(cp.width(), 0, server->pb->width(), + //if (server->pb->width() > client.width()) + // updates.add_changed(Rect(client.width(), 0, server->pb->width(), // server->pb->height())); - //if (server->pb->height() > cp.height()) - // updates.add_changed(Rect(0, cp.height(), client.width(), + //if (server->pb->height() > client.height()) + // updates.add_changed(Rect(0, client.height(), client.width(), // server->pb->height())); damagedCursorRegion.assign_intersect(server->pb->getRect()); - cp.setDimensions(server->pb->width(), server->pb->height(), - server->screenLayout); + client.setDimensions(server->pb->width(), server->pb->height(), + server->screenLayout); if (state() == RFBSTATE_NORMAL) { // We should only send EDS to client asking for both if (!writer()->writeExtendedDesktopSize()) { @@ -347,7 +347,7 @@ bool VNCSConnectionST::getComparerState() // We interpret a low compression level as an indication that the client // wants to prioritise CPU usage over bandwidth, and hence disable the // comparing update tracker. - return (cp.compressLevel == -1) || (cp.compressLevel > 1); + return (client.compressLevel == -1) || (client.compressLevel > 1); } @@ -385,8 +385,8 @@ bool VNCSConnectionST::needRenderedCursor() if (state() != RFBSTATE_NORMAL) return false; - if (!cp.supportsLocalCursorWithAlpha && - !cp.supportsLocalCursor && !cp.supportsLocalXCursor) + if (!client.supportsLocalCursorWithAlpha && + !client.supportsLocalCursor && !client.supportsLocalXCursor) return true; if (!server->cursorPos.equals(pointerEventPos) && (time(0) - pointerEventTime) > 0) @@ -417,15 +417,15 @@ void VNCSConnectionST::authSuccess() server->startDesktop(); // - Set the connection parameters appropriately - cp.setDimensions(server->pb->width(), server->pb->height(), - server->screenLayout); - cp.setName(server->getName()); - cp.setLEDState(server->ledState); + client.setDimensions(server->pb->width(), server->pb->height(), + server->screenLayout); + client.setName(server->getName()); + client.setLEDState(server->ledState); // - Set the default pixel format - cp.setPF(server->pb->getPF()); + client.setPF(server->pb->getPF()); char buffer[256]; - cp.pf().print(buffer, 256); + client.pf().print(buffer, 256); vlog.info("Server default pixel format %s", buffer); // - Mark the entire display as "dirty" @@ -572,7 +572,7 @@ void VNCSConnectionST::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) { // Lock key heuristics // (only for clients that do not support the LED state extension) - if (!cp.supportsLEDState) { + if (!client.supportsLEDState) { // Always ignore ScrollLock as we don't have a heuristic // for that if (keysym == XK_Scroll_Lock) { @@ -677,11 +677,11 @@ void VNCSConnectionST::framebufferUpdateRequest(const Rect& r,bool incremental) SConnection::framebufferUpdateRequest(r, incremental); // Check that the client isn't sending crappy requests - if (!r.enclosed_by(Rect(0, 0, cp.width(), cp.height()))) { + if (!r.enclosed_by(Rect(0, 0, client.width(), client.height()))) { vlog.error("FramebufferUpdateRequest %dx%d at %d,%d exceeds framebuffer %dx%d", r.width(), r.height(), r.tl.x, r.tl.y, - cp.width(), cp.height()); - safeRect = r.intersect(Rect(0, 0, cp.width(), cp.height())); + client.width(), client.height()); + safeRect = r.intersect(Rect(0, 0, client.width(), client.height())); } else { safeRect = r; } @@ -787,7 +787,7 @@ void VNCSConnectionST::enableContinuousUpdates(bool enable, { Rect rect; - if (!cp.supportsFence || !cp.supportsContinuousUpdates) + if (!client.supportsFence || !client.supportsContinuousUpdates) throw Exception("Client tried to enable continuous updates when not allowed"); continuousUpdates = enable; @@ -803,7 +803,7 @@ void VNCSConnectionST::enableContinuousUpdates(bool enable, } // supportsLocalCursor() is called whenever the status of -// cp.supportsLocalCursor has changed. If the client does now support local +// client.supportsLocalCursor has changed. If the client does now support local // cursor, we make sure that the old server-side rendered cursor is cleaned up // and the cursor is sent to the client. @@ -825,7 +825,7 @@ void VNCSConnectionST::supportsContinuousUpdates() { // We refuse to use continuous updates if we cannot monitor the buffer // usage using fences. - if (!cp.supportsFence) + if (!client.supportsFence) return; writer()->writeEndOfContinuousUpdates(); @@ -868,7 +868,7 @@ void VNCSConnectionST::writeRTTPing() { char type; - if (!cp.supportsFence) + if (!client.supportsFence) return; congestion.updatePosition(sock->outStream().length()); @@ -895,7 +895,7 @@ bool VNCSConnectionST::isCongested() if (sock->outStream().bufferUsage() > 0) return true; - if (!cp.supportsFence) + if (!client.supportsFence) return false; congestion.updatePosition(sock->outStream().length()); @@ -972,7 +972,7 @@ void VNCSConnectionST::writeDataUpdate() bool needNewUpdateInfo; const RenderedCursor *cursor; - updates.enable_copyrect(cp.useCopyRect); + updates.enable_copyrect(client.useCopyRect); // See what the client has requested (if anything) if (continuousUpdates) @@ -1124,15 +1124,15 @@ void VNCSConnectionST::screenLayoutChange(rdr::U16 reason) if (!authenticated()) return; - cp.setDimensions(cp.width(), cp.height(), - server->screenLayout); + client.setDimensions(client.width(), client.height(), + server->screenLayout); if (state() != RFBSTATE_NORMAL) return; writer()->writeExtendedDesktopSize(reason, 0, - cp.width(), cp.height(), - cp.screenLayout()); + client.width(), client.height(), + client.screenLayout()); } @@ -1147,10 +1147,10 @@ void VNCSConnectionST::setCursor() // We need to blank out the client's cursor or there will be two if (needRenderedCursor()) { - cp.setCursor(emptyCursor); + client.setCursor(emptyCursor); clientHasCursor = false; } else { - cp.setCursor(*server->cursor); + client.setCursor(*server->cursor); clientHasCursor = true; } @@ -1166,7 +1166,7 @@ void VNCSConnectionST::setCursor() void VNCSConnectionST::setDesktopName(const char *name) { - cp.setName(name); + client.setName(name); if (state() != RFBSTATE_NORMAL) return; @@ -1182,7 +1182,7 @@ void VNCSConnectionST::setLEDState(unsigned int ledstate) if (state() != RFBSTATE_NORMAL) return; - cp.setLEDState(ledstate); + client.setLEDState(ledstate); writer()->writeLEDState(); } diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index 8917d8ff..92fd13d1 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -19,7 +19,6 @@ #include <rdr/OutStream.h> #include <rfb/Exception.h> #include <rfb/encodings.h> -#include <rfb/ConnParams.h> #include <rfb/Palette.h> #include <rfb/SConnection.h> #include <rfb/ZRLEEncoder.h> @@ -43,7 +42,7 @@ ZRLEEncoder::~ZRLEEncoder() bool ZRLEEncoder::isSupported() { - return conn->cp.supportsEncoding(encodingZRLE); + return conn->client.supportsEncoding(encodingZRLE); } void ZRLEEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) |