diff options
author | Pierre Ossman <ossman@cendio.se> | 2018-10-05 17:11:25 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2018-10-10 13:07:19 +0200 |
commit | eef6c9ad834974c7f1f124a6a9984f01c9d0690e (patch) | |
tree | 558e4e694a4cedc4d42badd43dd3d8a8fc8ccd95 /win | |
parent | e6aab2465493d6088c5218d888d9b77d069e514c (diff) | |
download | tigervnc-eef6c9ad834974c7f1f124a6a9984f01c9d0690e.tar.gz tigervnc-eef6c9ad834974c7f1f124a6a9984f01c9d0690e.zip |
Remove QueryConnectionHandler
Make things simpler by making this a part of the SDesktop interface
that always needs to be implemented.
Diffstat (limited to 'win')
-rw-r--r-- | win/rfb_win32/SDisplay.cxx | 18 | ||||
-rw-r--r-- | win/rfb_win32/SDisplay.h | 18 | ||||
-rw-r--r-- | win/winvnc/VNCServerWin32.cxx | 4 | ||||
-rw-r--r-- | win/winvnc/VNCServerWin32.h | 4 |
4 files changed, 38 insertions, 6 deletions
diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx index 9b2cbb02..afb72ad7 100644 --- a/win/rfb_win32/SDisplay.cxx +++ b/win/rfb_win32/SDisplay.cxx @@ -20,6 +20,8 @@ // // The SDisplay class encapsulates a particular system display. +#include <assert.h> + #include <rfb_win32/SDisplay.h> #include <rfb_win32/Service.h> #include <rfb_win32/TsSessions.h> @@ -66,7 +68,7 @@ SDisplay::SDisplay() : server(0), pb(0), device(0), core(0), ptr(0), kbd(0), clipboard(0), inputs(0), monitor(0), cleanDesktop(0), cursor(0), - statusLocation(0), ledState(0) + statusLocation(0), queryConnectionHandler(0), ledState(0) { updateEvent.h = CreateEvent(0, TRUE, FALSE, 0); } @@ -139,6 +141,20 @@ void SDisplay::stop() } +void SDisplay::queryConnection(network::Socket* sock, + const char* userName) +{ + assert(server != NULL); + + if (queryConnectionHandler) { + queryConnectionHandler->queryConnection(sock, userName); + return; + } + + server->approveConnection(sock, true); +} + + void SDisplay::startCore() { // Currently, we just check whether we're in the console session, and diff --git a/win/rfb_win32/SDisplay.h b/win/rfb_win32/SDisplay.h index c1d5c1e2..76ddf50b 100644 --- a/win/rfb_win32/SDisplay.h +++ b/win/rfb_win32/SDisplay.h @@ -52,6 +52,13 @@ namespace rfb { virtual const char* methodName() const = 0; }; + class QueryConnectionHandler { + public: + virtual ~QueryConnectionHandler() {} + virtual void queryConnection(network::Socket* sock, + const char* userName) = 0; + }; + class SDisplay : public SDesktop, WMMonitor::Notifier, Clipboard::Notifier, @@ -65,6 +72,8 @@ namespace rfb { virtual void start(VNCServer* vs); virtual void stop(); + virtual void queryConnection(network::Socket* sock, + const char* userName); virtual void pointerEvent(const Point& pos, int buttonmask); virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); virtual void clientCutText(const char* str, int len); @@ -86,6 +95,12 @@ namespace rfb { void setStatusLocation(bool* status) {statusLocation = status;} + // -=- Set handler for incoming connections + + void setQueryConnectionHandler(QueryConnectionHandler* qch) { + queryConnectionHandler = qch; + } + static IntParameter updateMethod; static BoolParameter disableLocalInputs; static StringParameter disconnectAction; @@ -150,6 +165,9 @@ namespace rfb { // -=- Where to write the active/inactive indicator to bool* statusLocation; + // -=- Whom to query incoming connections + QueryConnectionHandler* queryConnectionHandler; + unsigned ledState; }; diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index 93bf5c0a..771ef78a 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -71,9 +71,7 @@ VNCServerWin32::VNCServerWin32() // Initialise the desktop desktop.setStatusLocation(&isDesktopStarted); - - // Initialise the VNC server - vncServer.setQueryConnectionHandler(this); + desktop.setQueryConnectionHandler(this); // Register the desktop's event to be handled sockMgr.addEvent(desktop.getUpdateEvent(), &desktop); diff --git a/win/winvnc/VNCServerWin32.h b/win/winvnc/VNCServerWin32.h index 58c3f6c6..bd0cbbbf 100644 --- a/win/winvnc/VNCServerWin32.h +++ b/win/winvnc/VNCServerWin32.h @@ -39,7 +39,7 @@ namespace winvnc { class STrayIconThread; - class VNCServerWin32 : rfb::VNCServerST::QueryConnectionHandler, + class VNCServerWin32 : rfb::win32::QueryConnectionHandler, rfb::win32::SocketManager::AddressChangeNotifier, rfb::win32::RegConfig::Callback, rfb::win32::EventHandler { @@ -78,7 +78,7 @@ namespace winvnc { bool setClientsStatus(rfb::ListConnInfo* LCInfo); protected: - // VNCServerST::QueryConnectionHandler interface + // QueryConnectionHandler interface // Callback used to prompt user to accept or reject a connection. // CALLBACK IN VNCServerST "HOST" THREAD virtual void queryConnection(network::Socket* sock, |