KasmVNC/common/rfb/ServerCore.cxx

230 lines
7.7 KiB
C++
Raw Normal View History

2020-09-20 14:16:44 +02:00
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
*
* 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.
*/
// -=- ServerCore.cxx
// This header will define the Server interface, from which ServerMT and
// ServerST will be derived.
#include <string.h>
#include <rfb/util.h>
#include <rfb/ServerCore.h>
rfb::IntParameter rfb::Server::idleTimeout
("IdleTimeout",
"The number of seconds after which an idle VNC connection will be dropped "
"(zero means no timeout)",
0, 0);
rfb::IntParameter rfb::Server::maxDisconnectionTime
("MaxDisconnectionTime",
"Terminate when no client has been connected for s seconds",
0, 0);
rfb::IntParameter rfb::Server::maxConnectionTime
("MaxConnectionTime",
"Terminate when a client has been connected for s seconds",
0, 0);
rfb::IntParameter rfb::Server::maxIdleTime
("MaxIdleTime",
"Terminate after s seconds of user inactivity",
0, 0);
rfb::IntParameter rfb::Server::clientWaitTimeMillis
("ClientWaitTimeMillis",
"The number of milliseconds to wait for a client which is no longer "
"responding",
20000, 0);
rfb::IntParameter rfb::Server::compareFB
("CompareFB",
"Perform pixel comparison on framebuffer to reduce unnecessary updates "
"(0: never, 1: always, 2: auto)",
2);
rfb::IntParameter rfb::Server::frameRate
("FrameRate",
"The maximum number of updates per second sent to each client",
60);
rfb::BoolParameter rfb::Server::protocol3_3
("Protocol3.3",
"Always use protocol version 3.3 for backwards compatibility with "
"badly-behaved clients",
false);
rfb::BoolParameter rfb::Server::alwaysShared
("AlwaysShared",
"Always treat incoming connections as shared, regardless of the client-"
"specified setting",
false);
rfb::BoolParameter rfb::Server::neverShared
("NeverShared",
"Never treat incoming connections as shared, regardless of the client-"
"specified setting",
false);
rfb::BoolParameter rfb::Server::disconnectClients
("DisconnectClients",
"Disconnect existing clients if an incoming connection is non-shared. "
"If combined with NeverShared then new connections will be refused "
"while there is a client active",
true);
rfb::BoolParameter rfb::Server::acceptKeyEvents
("AcceptKeyEvents",
"Accept key press and release events from clients.",
true);
rfb::BoolParameter rfb::Server::acceptPointerEvents
("AcceptPointerEvents",
"Accept pointer press and release events from clients.",
true);
rfb::BoolParameter rfb::Server::acceptCutText
("AcceptCutText",
"Accept clipboard updates from clients.",
true);
rfb::BoolParameter rfb::Server::sendCutText
("SendCutText",
"Send clipboard changes to clients.",
true);
rfb::BoolParameter rfb::Server::acceptSetDesktopSize
("AcceptSetDesktopSize",
"Accept set desktop size events from clients.",
true);
rfb::BoolParameter rfb::Server::queryConnect
("QueryConnect",
"Prompt the local user to accept or reject incoming connections.",
false);
rfb::BoolParameter rfb::Server::detectScrolling
("DetectScrolling",
"Try to detect scrolled sections in a changed area.",
false);
rfb::BoolParameter rfb::Server::detectHorizontal
("DetectHorizontal",
"With -DetectScrolling enabled, try to detect horizontal scrolls too, not just vertical.",
false);
rfb::BoolParameter rfb::Server::ignoreClientSettingsKasm
("IgnoreClientSettingsKasm",
"Ignore the additional client settings exposed in Kasm.",
false);
rfb::BoolParameter rfb::Server::selfBench
("SelfBench",
"Run self-benchmarks and exit.",
false);
2020-09-20 14:16:44 +02:00
rfb::IntParameter rfb::Server::dynamicQualityMin
("DynamicQualityMin",
"The minimum dynamic JPEG quality, 0 = low, 9 = high",
7, 0, 9);
rfb::IntParameter rfb::Server::dynamicQualityMax
("DynamicQualityMax",
"The maximum dynamic JPEG quality, 0 = low, 9 = high",
8, 0, 9);
rfb::IntParameter rfb::Server::treatLossless
("TreatLossless",
"Treat lossy quality levels above and including this as lossless, 0-9. 10 = off",
10, 0, 10);
rfb::IntParameter rfb::Server::scrollDetectLimit
("ScrollDetectLimit",
"At least this % of the screen must change for scroll detection to happen, default 25.",
25, 0, 100);
rfb::IntParameter rfb::Server::rectThreads
("RectThreads",
"Use this many threads to compress rects in parallel. Default 0 (auto), 1 = off",
0, 0, 64);
rfb::IntParameter rfb::Server::jpegVideoQuality
("JpegVideoQuality",
"The JPEG quality to use when in video mode",
-1, -1, 9);
rfb::IntParameter rfb::Server::webpVideoQuality
("WebpVideoQuality",
"The WEBP quality to use when in video mode",
-1, -1, 9);
rfb::IntParameter rfb::Server::DLP_ClipSendMax
("DLP_ClipSendMax",
"Limit clipboard bytes to send to clients in one transaction",
0, 0, INT_MAX);
2020-09-20 14:16:44 +02:00
rfb::IntParameter rfb::Server::DLP_ClipAcceptMax
("DLP_ClipAcceptMax",
"Limit clipboard bytes to receive from clients in one transaction",
0, 0, INT_MAX);
2020-09-20 14:16:44 +02:00
rfb::IntParameter rfb::Server::DLP_ClipDelay
("DLP_ClipDelay",
"This many milliseconds must pass between clipboard actions",
0, 0, INT_MAX);
2020-09-20 14:16:44 +02:00
rfb::IntParameter rfb::Server::DLP_KeyRateLimit
("DLP_KeyRateLimit",
"Reject keyboard presses over this many per second",
0, 0, INT_MAX);
rfb::StringParameter rfb::Server::DLP_ClipLog
("DLP_Log",
"Log clipboard/kbd actions. Accepts off, info or verbose",
"off");
2021-03-15 12:48:56 +01:00
rfb::StringParameter rfb::Server::DLP_Region
("DLP_Region",
"Black out anything outside this region",
"");
rfb::StringParameter rfb::Server::DLP_Clip_Types
("DLP_ClipTypes",
"Allowed binary clipboard mimetypes",
"text/html,image/png");
2020-09-20 14:16:44 +02:00
2021-03-22 11:36:39 +01:00
rfb::BoolParameter rfb::Server::DLP_RegionAllowClick
("DLP_RegionAllowClick",
"Allow clicks inside the blacked-out region",
false);
rfb::BoolParameter rfb::Server::DLP_RegionAllowRelease
("DLP_RegionAllowRelease",
"Allow click releases inside the blacked-out region",
true);
2020-09-20 14:16:44 +02:00
rfb::StringParameter rfb::Server::maxVideoResolution
("MaxVideoResolution",
"When in video mode, downscale the screen to max this size.",
"1920x1080");
rfb::IntParameter rfb::Server::videoTime
("VideoTime",
"High rate of change must happen for this many seconds to switch to video mode. "
"Default 5, set 0 to always enable",
5, 0, 2000);
rfb::IntParameter rfb::Server::videoOutTime
("VideoOutTime",
"The rate of change must be below the VideoArea threshold for this many seconds "
"to switch out of video mode.",
3, 1, 100);
rfb::IntParameter rfb::Server::videoArea
("VideoArea",
"High rate of change must happen for this % of the screen to switch to video mode.",
45, 1, 100);
rfb::IntParameter rfb::Server::videoScaling
("VideoScaling",
"Scaling method to use when in downscaled video mode. 0 = nearest, 1 = bilinear, 2 = prog bilinear",
2, 0, 2);
rfb::BoolParameter rfb::Server::printVideoArea
("PrintVideoArea",
"Print the detected video area % value.",
false);
rfb::StringParameter rfb::Server::kasmPasswordFile
("KasmPasswordFile",
"Password file for BasicAuth, created with the kasmvncpasswd utility.",
"~/.kasmpasswd");
2020-09-20 14:16:44 +02:00
static void bandwidthPreset() {
rfb::Server::dynamicQualityMin.setParam(2);
rfb::Server::dynamicQualityMax.setParam(9);
rfb::Server::treatLossless.setParam(8);
}
rfb::PresetParameter rfb::Server::preferBandwidth
("PreferBandwidth",
"Set various options for lower bandwidth use. The default is off, aka to prefer quality.",
false, bandwidthPreset);