]> source.dussan.org Git - tigervnc.git/commitdiff
Rename ConnParams to ClientParams
authorPierre Ossman <ossman@cendio.se>
Mon, 18 Jun 2018 13:59:00 +0000 (15:59 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 1 Nov 2018 15:11:42 +0000 (16:11 +0100)
Now that we've split out server state to ServerParams, ConnParams
only contains state for a client. Rename the class and variables
to reflect this.

19 files changed:
common/rfb/CMakeLists.txt
common/rfb/ClientParams.cxx [new file with mode: 0644]
common/rfb/ClientParams.h [new file with mode: 0644]
common/rfb/ConnParams.cxx [deleted file]
common/rfb/ConnParams.h [deleted file]
common/rfb/EncodeManager.cxx
common/rfb/HextileEncoder.cxx
common/rfb/JpegCompressor.cxx
common/rfb/RREEncoder.cxx
common/rfb/SConnection.cxx
common/rfb/SMsgHandler.cxx
common/rfb/SMsgHandler.h
common/rfb/SMsgWriter.cxx
common/rfb/SMsgWriter.h
common/rfb/TightEncoder.cxx
common/rfb/TightJPEGEncoder.cxx
common/rfb/VNCSConnectionST.cxx
common/rfb/ZRLEEncoder.cxx
tests/encperf.cxx

index 6b8be3bd05eba6764888819189bb2d88e7ed61a5..8e532a28c8bcf9dae177773b3313442e90319994 100644 (file)
@@ -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/ClientParams.cxx b/common/rfb/ClientParams.cxx
new file mode 100644 (file)
index 0000000..6209f4d
--- /dev/null
@@ -0,0 +1,190 @@
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright (C) 2011 D. R. Commander.  All Rights Reserved.
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+#include <rfb/Exception.h>
+#include <rfb/encodings.h>
+#include <rfb/ledStates.h>
+#include <rfb/ClientParams.h>
+
+using namespace rfb;
+
+ClientParams::ClientParams()
+  : majorVersion(0), minorVersion(0),
+    useCopyRect(false),
+    supportsLocalCursor(false), supportsLocalXCursor(false),
+    supportsLocalCursorWithAlpha(false),
+    supportsDesktopResize(false), supportsExtendedDesktopSize(false),
+    supportsDesktopRename(false), supportsLastRect(false),
+    supportsLEDState(false), supportsQEMUKeyEvent(false),
+    supportsSetDesktopSize(false), supportsFence(false),
+    supportsContinuousUpdates(false),
+    compressLevel(2), qualityLevel(-1), fineQualityLevel(-1),
+    subsampling(subsampleUndefined),
+    width_(0), height_(0), name_(0),
+    ledState_(ledUnknown)
+{
+  setName("");
+  cursor_ = new Cursor(0, 0, Point(), NULL);
+}
+
+ClientParams::~ClientParams()
+{
+  delete [] name_;
+  delete cursor_;
+}
+
+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 ClientParams::setDimensions(int width, int height, const ScreenSet& layout)
+{
+  if (!layout.validate(width, height))
+    throw Exception("Attempted to configure an invalid screen layout");
+
+  width_ = width;
+  height_ = height;
+  screenLayout_ = layout;
+}
+
+void ClientParams::setPF(const PixelFormat& pf)
+{
+  pf_ = pf;
+
+  if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 32)
+    throw Exception("setPF: not 8, 16 or 32 bpp?");
+}
+
+void ClientParams::setName(const char* name)
+{
+  delete [] name_;
+  name_ = strDup(name);
+}
+
+void ClientParams::setCursor(const Cursor& other)
+{
+  delete cursor_;
+  cursor_ = new Cursor(other);
+}
+
+bool ClientParams::supportsEncoding(rdr::S32 encoding) const
+{
+  return encodings_.count(encoding) != 0;
+}
+
+void ClientParams::setEncodings(int nEncodings, const rdr::S32* encodings)
+{
+  useCopyRect = false;
+  supportsLocalCursor = false;
+  supportsLocalCursorWithAlpha = false;
+  supportsDesktopResize = false;
+  supportsExtendedDesktopSize = false;
+  supportsLocalXCursor = false;
+  supportsLastRect = false;
+  supportsQEMUKeyEvent = false;
+  compressLevel = -1;
+  qualityLevel = -1;
+  fineQualityLevel = -1;
+  subsampling = subsampleUndefined;
+
+  encodings_.clear();
+  encodings_.insert(encodingRaw);
+
+  for (int i = nEncodings-1; i >= 0; i--) {
+    switch (encodings[i]) {
+    case encodingCopyRect:
+      useCopyRect = true;
+      break;
+    case pseudoEncodingCursor:
+      supportsLocalCursor = true;
+      break;
+    case pseudoEncodingXCursor:
+      supportsLocalXCursor = true;
+      break;
+    case pseudoEncodingCursorWithAlpha:
+      supportsLocalCursorWithAlpha = true;
+      break;
+    case pseudoEncodingDesktopSize:
+      supportsDesktopResize = true;
+      break;
+    case pseudoEncodingExtendedDesktopSize:
+      supportsExtendedDesktopSize = true;
+      break;
+    case pseudoEncodingDesktopName:
+      supportsDesktopRename = true;
+      break;
+    case pseudoEncodingLastRect:
+      supportsLastRect = true;
+      break;
+    case pseudoEncodingLEDState:
+      supportsLEDState = true;
+      break;
+    case pseudoEncodingQEMUKeyEvent:
+      supportsQEMUKeyEvent = true;
+      break;
+    case pseudoEncodingFence:
+      supportsFence = true;
+      break;
+    case pseudoEncodingContinuousUpdates:
+      supportsContinuousUpdates = true;
+      break;
+    case pseudoEncodingSubsamp1X:
+      subsampling = subsampleNone;
+      break;
+    case pseudoEncodingSubsampGray:
+      subsampling = subsampleGray;
+      break;
+    case pseudoEncodingSubsamp2X:
+      subsampling = subsample2X;
+      break;
+    case pseudoEncodingSubsamp4X:
+      subsampling = subsample4X;
+      break;
+    case pseudoEncodingSubsamp8X:
+      subsampling = subsample8X;
+      break;
+    case pseudoEncodingSubsamp16X:
+      subsampling = subsample16X;
+      break;
+    }
+
+    if (encodings[i] >= pseudoEncodingCompressLevel0 &&
+        encodings[i] <= pseudoEncodingCompressLevel9)
+      compressLevel = encodings[i] - pseudoEncodingCompressLevel0;
+
+    if (encodings[i] >= pseudoEncodingQualityLevel0 &&
+        encodings[i] <= pseudoEncodingQualityLevel9)
+      qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
+
+    if (encodings[i] >= pseudoEncodingFineQualityLevel0 &&
+        encodings[i] <= pseudoEncodingFineQualityLevel100)
+      fineQualityLevel = encodings[i] - pseudoEncodingFineQualityLevel0;
+
+    if (encodings[i] > 0)
+      encodings_.insert(encodings[i]);
+  }
+}
+
+void ClientParams::setLEDState(unsigned int state)
+{
+  ledState_ = state;
+}
diff --git a/common/rfb/ClientParams.h b/common/rfb/ClientParams.h
new file mode 100644 (file)
index 0000000..6b36895
--- /dev/null
@@ -0,0 +1,121 @@
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+//
+// ClientParams - structure describing the current state of the remote client
+//
+
+#ifndef __RFB_CLIENTPARAMS_H__
+#define __RFB_CLIENTPARAMS_H__
+
+#include <set>
+
+#include <rdr/types.h>
+#include <rfb/Cursor.h>
+#include <rfb/PixelFormat.h>
+#include <rfb/ScreenSet.h>
+
+namespace rfb {
+
+  const int subsampleUndefined = -1;
+  const int subsampleNone = 0;
+  const int subsampleGray = 1;
+  const int subsample2X = 2;
+  const int subsample4X = 3;
+  const int subsample8X = 4;
+  const int subsample16X = 5;
+
+  class ClientParams {
+  public:
+    ClientParams();
+    ~ClientParams();
+
+    int majorVersion;
+    int minorVersion;
+
+    void setVersion(int major, int minor) {
+      majorVersion = major; minorVersion = minor;
+    }
+    bool isVersion(int major, int minor) const {
+      return majorVersion == major && minorVersion == minor;
+    }
+    bool beforeVersion(int major, int minor) const {
+      return (majorVersion < major ||
+              (majorVersion == major && minorVersion < minor));
+    }
+    bool afterVersion(int major, int minor) const {
+      return !beforeVersion(major,minor+1);
+    }
+
+    const int width() const { return width_; }
+    const int height() const { return height_; }
+    const ScreenSet& screenLayout() const { return screenLayout_; }
+    void setDimensions(int width, int height);
+    void setDimensions(int width, int height, const ScreenSet& layout);
+
+    const PixelFormat& pf() const { return pf_; }
+    void setPF(const PixelFormat& pf);
+
+    const char* name() const { return name_; }
+    void setName(const char* name);
+
+    const Cursor& cursor() const { return *cursor_; }
+    void setCursor(const Cursor& cursor);
+
+    bool supportsEncoding(rdr::S32 encoding) const;
+
+    void setEncodings(int nEncodings, const rdr::S32* encodings);
+
+    unsigned int ledState() { return ledState_; }
+    void setLEDState(unsigned int state);
+
+    bool useCopyRect;
+
+    bool supportsLocalCursor;
+    bool supportsLocalXCursor;
+    bool supportsLocalCursorWithAlpha;
+    bool supportsDesktopResize;
+    bool supportsExtendedDesktopSize;
+    bool supportsDesktopRename;
+    bool supportsLastRect;
+    bool supportsLEDState;
+    bool supportsQEMUKeyEvent;
+
+    bool supportsSetDesktopSize;
+    bool supportsFence;
+    bool supportsContinuousUpdates;
+
+    int compressLevel;
+    int qualityLevel;
+    int fineQualityLevel;
+    int subsampling;
+
+  private:
+
+    int width_;
+    int height_;
+    ScreenSet screenLayout_;
+
+    PixelFormat pf_;
+    char* name_;
+    Cursor* cursor_;
+    std::set<rdr::S32> encodings_;
+    unsigned int ledState_;
+  };
+}
+#endif
diff --git a/common/rfb/ConnParams.cxx b/common/rfb/ConnParams.cxx
deleted file mode 100644 (file)
index 1fdf8f3..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/* 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
- * 
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * 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>
-
-using namespace rfb;
-
-ConnParams::ConnParams()
-  : majorVersion(0), minorVersion(0),
-    useCopyRect(false),
-    supportsLocalCursor(false), supportsLocalXCursor(false),
-    supportsLocalCursorWithAlpha(false),
-    supportsDesktopResize(false), supportsExtendedDesktopSize(false),
-    supportsDesktopRename(false), supportsLastRect(false),
-    supportsLEDState(false), supportsQEMUKeyEvent(false),
-    supportsSetDesktopSize(false), supportsFence(false),
-    supportsContinuousUpdates(false),
-    compressLevel(2), qualityLevel(-1), fineQualityLevel(-1),
-    subsampling(subsampleUndefined),
-    width_(0), height_(0), name_(0),
-    ledState_(ledUnknown)
-{
-  setName("");
-  cursor_ = new Cursor(0, 0, Point(), NULL);
-}
-
-ConnParams::~ConnParams()
-{
-  delete [] name_;
-  delete cursor_;
-}
-
-void ConnParams::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)
-{
-  if (!layout.validate(width, height))
-    throw Exception("Attempted to configure an invalid screen layout");
-
-  width_ = width;
-  height_ = height;
-  screenLayout_ = layout;
-}
-
-void ConnParams::setPF(const PixelFormat& pf)
-{
-  pf_ = pf;
-
-  if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 32)
-    throw Exception("setPF: not 8, 16 or 32 bpp?");
-}
-
-void ConnParams::setName(const char* name)
-{
-  delete [] name_;
-  name_ = strDup(name);
-}
-
-void ConnParams::setCursor(const Cursor& other)
-{
-  delete cursor_;
-  cursor_ = new Cursor(other);
-}
-
-bool ConnParams::supportsEncoding(rdr::S32 encoding) const
-{
-  return encodings_.count(encoding) != 0;
-}
-
-void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings)
-{
-  useCopyRect = false;
-  supportsLocalCursor = false;
-  supportsLocalCursorWithAlpha = false;
-  supportsDesktopResize = false;
-  supportsExtendedDesktopSize = false;
-  supportsLocalXCursor = false;
-  supportsLastRect = false;
-  supportsQEMUKeyEvent = false;
-  compressLevel = -1;
-  qualityLevel = -1;
-  fineQualityLevel = -1;
-  subsampling = subsampleUndefined;
-
-  encodings_.clear();
-  encodings_.insert(encodingRaw);
-
-  for (int i = nEncodings-1; i >= 0; i--) {
-    switch (encodings[i]) {
-    case encodingCopyRect:
-      useCopyRect = true;
-      break;
-    case pseudoEncodingCursor:
-      supportsLocalCursor = true;
-      break;
-    case pseudoEncodingXCursor:
-      supportsLocalXCursor = true;
-      break;
-    case pseudoEncodingCursorWithAlpha:
-      supportsLocalCursorWithAlpha = true;
-      break;
-    case pseudoEncodingDesktopSize:
-      supportsDesktopResize = true;
-      break;
-    case pseudoEncodingExtendedDesktopSize:
-      supportsExtendedDesktopSize = true;
-      break;
-    case pseudoEncodingDesktopName:
-      supportsDesktopRename = true;
-      break;
-    case pseudoEncodingLastRect:
-      supportsLastRect = true;
-      break;
-    case pseudoEncodingLEDState:
-      supportsLEDState = true;
-      break;
-    case pseudoEncodingQEMUKeyEvent:
-      supportsQEMUKeyEvent = true;
-      break;
-    case pseudoEncodingFence:
-      supportsFence = true;
-      break;
-    case pseudoEncodingContinuousUpdates:
-      supportsContinuousUpdates = true;
-      break;
-    case pseudoEncodingSubsamp1X:
-      subsampling = subsampleNone;
-      break;
-    case pseudoEncodingSubsampGray:
-      subsampling = subsampleGray;
-      break;
-    case pseudoEncodingSubsamp2X:
-      subsampling = subsample2X;
-      break;
-    case pseudoEncodingSubsamp4X:
-      subsampling = subsample4X;
-      break;
-    case pseudoEncodingSubsamp8X:
-      subsampling = subsample8X;
-      break;
-    case pseudoEncodingSubsamp16X:
-      subsampling = subsample16X;
-      break;
-    }
-
-    if (encodings[i] >= pseudoEncodingCompressLevel0 &&
-        encodings[i] <= pseudoEncodingCompressLevel9)
-      compressLevel = encodings[i] - pseudoEncodingCompressLevel0;
-
-    if (encodings[i] >= pseudoEncodingQualityLevel0 &&
-        encodings[i] <= pseudoEncodingQualityLevel9)
-      qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
-
-    if (encodings[i] >= pseudoEncodingFineQualityLevel0 &&
-        encodings[i] <= pseudoEncodingFineQualityLevel100)
-      fineQualityLevel = encodings[i] - pseudoEncodingFineQualityLevel0;
-
-    if (encodings[i] > 0)
-      encodings_.insert(encodings[i]);
-  }
-}
-
-void ConnParams::setLEDState(unsigned int state)
-{
-  ledState_ = state;
-}
diff --git a/common/rfb/ConnParams.h b/common/rfb/ConnParams.h
deleted file mode 100644 (file)
index 1640efc..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
- * Copyright 2014 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-//
-// ConnParams - structure containing the connection parameters.
-//
-
-#ifndef __RFB_CONNPARAMS_H__
-#define __RFB_CONNPARAMS_H__
-
-#include <set>
-
-#include <rdr/types.h>
-#include <rfb/Cursor.h>
-#include <rfb/PixelFormat.h>
-#include <rfb/ScreenSet.h>
-
-namespace rfb {
-
-  const int subsampleUndefined = -1;
-  const int subsampleNone = 0;
-  const int subsampleGray = 1;
-  const int subsample2X = 2;
-  const int subsample4X = 3;
-  const int subsample8X = 4;
-  const int subsample16X = 5;
-
-  class ConnParams {
-  public:
-    ConnParams();
-    ~ConnParams();
-
-    int majorVersion;
-    int minorVersion;
-
-    void setVersion(int major, int minor) {
-      majorVersion = major; minorVersion = minor;
-    }
-    bool isVersion(int major, int minor) const {
-      return majorVersion == major && minorVersion == minor;
-    }
-    bool beforeVersion(int major, int minor) const {
-      return (majorVersion < major ||
-              (majorVersion == major && minorVersion < minor));
-    }
-    bool afterVersion(int major, int minor) const {
-      return !beforeVersion(major,minor+1);
-    }
-
-    const int width() const { return width_; }
-    const int height() const { return height_; }
-    const ScreenSet& screenLayout() const { return screenLayout_; }
-    void setDimensions(int width, int height);
-    void setDimensions(int width, int height, const ScreenSet& layout);
-
-    const PixelFormat& pf() const { return pf_; }
-    void setPF(const PixelFormat& pf);
-
-    const char* name() const { return name_; }
-    void setName(const char* name);
-
-    const Cursor& cursor() const { return *cursor_; }
-    void setCursor(const Cursor& cursor);
-
-    bool supportsEncoding(rdr::S32 encoding) const;
-
-    void setEncodings(int nEncodings, const rdr::S32* encodings);
-
-    unsigned int ledState() { return ledState_; }
-    void setLEDState(unsigned int state);
-
-    bool useCopyRect;
-
-    bool supportsLocalCursor;
-    bool supportsLocalXCursor;
-    bool supportsLocalCursorWithAlpha;
-    bool supportsDesktopResize;
-    bool supportsExtendedDesktopSize;
-    bool supportsDesktopRename;
-    bool supportsLastRect;
-    bool supportsLEDState;
-    bool supportsQEMUKeyEvent;
-
-    bool supportsSetDesktopSize;
-    bool supportsFence;
-    bool supportsContinuousUpdates;
-
-    int compressLevel;
-    int qualityLevel;
-    int fineQualityLevel;
-    int subsampling;
-
-  private:
-
-    int width_;
-    int height_;
-    ScreenSet screenLayout_;
-
-    PixelFormat pf_;
-    char* name_;
-    Cursor* cursor_;
-    std::set<rdr::S32> encodings_;
-    unsigned int ledState_;
-  };
-}
-#endif
index 02128f7f4ac9124bddac58b537ea4c94242cc158..7589cb6a8495a8da448a4ce2cac81861c1696ec5 100644 (file)
@@ -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);
index 47e5251032d314d37338944b3e3ded21e7431243..1e20eb92f637fe27fbd30a5f1f4392aad9f02ff6 100644 (file)
@@ -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)
index 27cb9de31f3477899243ad48191292d081524286..23b8f8cf14ab2cfcf95820de299f94956d867cf6 100644 (file)
@@ -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" {
index 7287e7eb5b4cdc93447910077343167e444db2d5..83585490b8929ba487197e293370cfdcacf64945 100644 (file)
@@ -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)
index 846e97e496ca27f9e5c5195b369846235b38d149..52a1113d7dc2aadad279a638c40e75b4561a2288 100644 (file)
@@ -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);
 }
index 137734b3d75715cb4ce38936e894ff4b27d5345d..f0e277ce666493145a026be79aaf95b07ae29dd6 100644 (file)
@@ -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);
 }
 
index 749f05603df8802e78b895e36de884fd47f12a6d..d654801317be0bc3f7494d9d19fca3efc4b7bc92 100644 (file)
@@ -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
index 96df6533e82361b0f3f89bef30931ad13eada85b..bcc848fcaff5a7fd8e5d27befd65e85c238e8603 100644 (file)
@@ -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");
index e985941603f3b4a3bc27faa51b23fefe9a4dad87..2db147bdcfaef3890c77151d45bd67870eaa7f32 100644 (file)
@@ -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;
index 0d428f16f37405e4f92b50acfe13145ba054382e..1b0792c4dba5d454716481e99777ee70543c35a3 100644 (file)
@@ -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)
index 38cb4eb72dd3128cce7aec47fb8394f870791ef3..755753898f0ae5443a1f7b0dbc53add69bd11352 100644 (file)
@@ -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
index 4dd00354bb84ca795d45a066c7322f1fcf189997..f01b248c45b555614737bc71a86341e68b902d45 100644 (file)
@@ -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();
 }
index 8917d8ffe7df2b89c672c654202a992490ab1ff0..92fd13d1cebc75c7a9ebe263258f08891c12b740 100644 (file)
@@ -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)
index 1703efd114792e2a3a4a25ab6763fd15671b659e..f8b2555f85ae7b6098d7e62e08385547d13d7a81 100644 (file)
@@ -180,7 +180,7 @@ CConn::CConn(const char *filename)
   setDesktopSize(width, height);
 
   sc = new SConn();
-  sc->cp.setPF((bool)translate ? fbPF : pf);
+  sc->client.setPF((bool)translate ? fbPF : pf);
   sc->setEncodings(sizeof(encodings) / sizeof(*encodings), encodings);
 }
 
@@ -290,7 +290,7 @@ SConn::SConn()
   out = new DummyOutStream;
   setStreams(NULL, out);
 
-  setWriter(new rfb::SMsgWriter(&cp, out));
+  setWriter(new rfb::SMsgWriter(&client, out));
 
   manager = new Manager(this);
 }