Move ListConnInfo to WinVNC directory
It is functionality specific to WinVNC, so move the code there
to make things more clear.
diff --git a/common/rfb/ListConnInfo.h b/common/rfb/ListConnInfo.h
deleted file mode 100644
index c49947d..0000000
--- a/common/rfb/ListConnInfo.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (C) 2002-2003 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.
- */
-
-
-#ifndef __RFB_LISTCONNINFO_INCLUDED__
-#define __RFB_LISTCONNINFO_INCLUDED__
-
-#include <list>
-
-#include <rfb/util.h>
-
-namespace rfb {
-
- struct ListConnInfo {
- ListConnInfo() : disableClients(false) {}
-
- void Clear() {
- conn.clear();
- IP_address.clear();
- time_conn.clear();
- status.clear();
- }
-
- bool Empty() { return conn.empty();}
-
- void iBegin() {
- ci = conn.begin();
- Ii = IP_address.begin();
- ti = time_conn.begin();
- si = status.begin();
- }
-
- bool iEnd() { return ci == conn.end();}
-
- void iNext() {
- ci++;
- Ii++;
- ti++;
- si++;
- }
-
- void addInfo(void* Conn, char* IP, char* Time, int Status) {
- conn.push_back(Conn);
- IP_address.push_back(strDup(IP));
- time_conn.push_back(strDup(Time));
- status.push_back(Status);
- }
-
- void iGetCharInfo(char* buf[3]) {
- buf[0] = *Ii;
- buf[1] = *ti;
- switch (*si) {
- case 0:
- buf[2] = strDup("Full control");
- break;
- case 1:
- buf[2] = strDup("View only");
- break;
- case 2:
- buf[2] = strDup("Stop updating");
- break;
- default:
- buf[2] = strDup("Unknown");
- }
- }
-
- void* iGetConn() { return *ci;}
-
- int iGetStatus() { return *si;}
-
- void iSetStatus(int istatus) { *si = istatus;}
-
- void Copy(ListConnInfo* InputList) {
- Clear();
- if (InputList->Empty()) return;
- for (InputList->iBegin(); !InputList->iEnd(); InputList->iNext()) {
- iAdd(InputList);
- }
- setDisable(InputList->getDisable());
- }
-
- void iAdd (ListConnInfo* InputList) {
- char* buf[3];
- InputList->iGetCharInfo(buf);
- addInfo(InputList->iGetConn(), buf[0], buf[1], InputList->iGetStatus());
- }
-
- void setDisable(bool disable) {disableClients = disable;}
-
- bool getDisable() {return disableClients;}
-
- void setAllStatus(int stat) {
- std::list<int>::iterator st;
- for (st = status.begin(); st != status.end(); st++)
- *st = stat;
- }
-
- private:
- std::list<void*> conn;
- std::list<char*> IP_address;
- std::list<char*> time_conn;
- std::list<int> status;
- std::list<void*>::iterator ci;
- std::list<char*>::iterator Ii;
- std::list<char*>::iterator ti;
- std::list<int>::iterator si;
- bool disableClients;
- };
-};
-#endif
-
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 50e6d88..7b261e7 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -52,7 +52,7 @@
losslessTimer(this), server(server_), updates(false),
updateRenderedCursor(false), removeRenderedCursor(false),
continuousUpdates(false), encodeManager(this), pointerEventTime(0),
- clientHasCursor(false), startTime(time(0))
+ clientHasCursor(false)
{
setStreams(&sock->inStream(), &sock->outStream());
peerEndpoint.buf = sock->getPeerEndpoint();
@@ -429,7 +429,6 @@
// - Mark the entire display as "dirty"
updates.add_changed(server->getPixelBuffer()->getRect());
- startTime = time(0);
}
void VNCSConnectionST::queryConnection(const char* userName)
@@ -1113,44 +1112,3 @@
sock->inStream().setTimeout(timeoutms);
sock->outStream().setTimeout(timeoutms);
}
-
-char* VNCSConnectionST::getStartTime()
-{
- char* result = ctime(&startTime);
- result[24] = '\0';
- return result;
-}
-
-void VNCSConnectionST::setStatus(int status)
-{
- AccessRights ar;
-
- ar = AccessDefault;
-
- switch (status) {
- case 0:
- ar |= AccessPtrEvents | AccessKeyEvents | AccessView;
- break;
- case 1:
- ar |= rfb::SConnection::AccessView;
- ar &= ~(AccessPtrEvents | AccessKeyEvents);
- break;
- case 2:
- ar &= ~(AccessPtrEvents | AccessKeyEvents | AccessView);
- break;
- }
-
- setAccessRights(ar);
-
- framebufferUpdateRequest(server->getPixelBuffer()->getRect(), false);
-}
-int VNCSConnectionST::getStatus()
-{
- if (accessCheck(AccessPtrEvents | AccessKeyEvents | AccessView))
- return 0;
- else if (accessCheck(AccessView))
- return 1;
- else
- return 2;
-}
-
diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h
index 121ebcc..4fe92b0 100644
--- a/common/rfb/VNCSConnectionST.h
+++ b/common/rfb/VNCSConnectionST.h
@@ -112,11 +112,6 @@
const char* getPeerEndpoint() const {return peerEndpoint.buf;}
- char* getStartTime();
-
- void setStatus(int status);
- int getStatus();
-
private:
// SConnection callbacks
@@ -198,7 +193,6 @@
bool clientHasCursor;
CharArray closeReason;
- time_t startTime;
};
}
#endif
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index e09e085..cf2a114 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -53,7 +53,6 @@
#include <rfb/ComparingUpdateTracker.h>
#include <rfb/KeyRemapper.h>
-#include <rfb/ListConnInfo.h>
#include <rfb/LogWriter.h>
#include <rfb/Security.h>
#include <rfb/ServerCore.h>
@@ -82,8 +81,7 @@
cursor(new Cursor(0, 0, Point(), NULL)),
renderedCursorInvalid(false),
keyRemapper(&KeyRemapper::defInstance),
- lastConnectionTime(0), disableclients(false),
- frameTimer(this)
+ lastConnectionTime(0), frameTimer(this)
{
lastUserInputTime = lastDisconnectTime = time(0);
slog.debug("creating single-threaded server %s", name.buf);
@@ -842,39 +840,6 @@
return &renderedCursor;
}
-void VNCServerST::getConnInfo(ListConnInfo * listConn)
-{
- listConn->Clear();
- listConn->setDisable(getDisable());
- if (clients.empty())
- return;
- std::list<VNCSConnectionST*>::iterator i;
- for (i = clients.begin(); i != clients.end(); i++)
- listConn->addInfo((void*)(*i), (*i)->getSock()->getPeerAddress(),
- (*i)->getStartTime(), (*i)->getStatus());
-}
-
-void VNCServerST::setConnStatus(ListConnInfo* listConn)
-{
- setDisable(listConn->getDisable());
- if (listConn->Empty() || clients.empty()) return;
- for (listConn->iBegin(); !listConn->iEnd(); listConn->iNext()) {
- VNCSConnectionST* conn = (VNCSConnectionST*)listConn->iGetConn();
- std::list<VNCSConnectionST*>::iterator i;
- for (i = clients.begin(); i != clients.end(); i++) {
- if ((*i) == conn) {
- int status = listConn->iGetStatus();
- if (status == 3) {
- (*i)->close(0);
- } else {
- (*i)->setStatus(status);
- }
- break;
- }
- }
- }
-}
-
bool VNCServerST::getComparerState()
{
if (rfb::Server::compareFB == 0)
diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h
index ed8561a..4dc384d 100644
--- a/common/rfb/VNCServerST.h
+++ b/common/rfb/VNCServerST.h
@@ -144,12 +144,6 @@
// NB: A null pointer is valid here.
void setKeyRemapper(KeyRemapper* kr) { keyRemapper = kr; }
- void getConnInfo(ListConnInfo * listConn);
- void setConnStatus(ListConnInfo* listConn);
-
- bool getDisable() { return disableclients;};
- void setDisable(bool disable) { disableclients = disable;};
-
// clientReady() is called by a VNCSConnectionST instance when the
// client has completed the handshake and is ready for normal
// communication.
@@ -214,8 +208,6 @@
time_t lastDisconnectTime;
time_t lastConnectionTime;
- bool disableclients;
-
Timer frameTimer;
};