--- /dev/null
+/* 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__
+
+namespace rfb {
+
+ struct ListConnInfo {
+ ListConnInfo() {
+ Clear();
+ };
+
+ 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(DWORD Conn, char* IP, char* Time, int Status) {
+ conn.push_front(Conn);
+ IP_address.push_front(IP);
+ time_conn.push_front(Time);
+ status.push_front(Status);
+ }
+
+ void iGetCharInfo(char* buf[3]) {
+ if (Empty())
+ return;
+ 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");
+ };
+ }
+
+ DWORD iGetConn() { return *ci;};
+
+ int iGetStatus() { return *si;};
+
+ std::list<DWORD> conn;
+ std::list<char*> IP_address;
+ std::list<char*> time_conn;
+ std::list<int> status;
+ std::list<DWORD>::iterator ci;
+ std::list<char*>::iterator Ii, ti;
+ std::list<int>::iterator si;
+
+ };
+
+}
+#endif
+
}
server->clients.push_front(this);
+ startTime = time(0);
}
void approveConnectionOrClose(bool accept, const char* reason);
+ char* getStartTime() { return ctime(&startTime); }
+
private:
// SConnection callbacks
AccessRights accessRights;
CharArray closeReason;
+ time_t startTime;
};
}
#endif
comparer->clear();
}
+
+bool VNCServerST::getConnInfo(ListConnInfo * listConn)
+{
+ listConn->Clear();
+ if (clients.empty())
+ return false;
+ std::list<VNCSConnectionST*>::iterator ci;
+ for (ci = clients.begin(); ci != clients.end(); ci++) {
+ listConn->addInfo((DWORD)(*ci), (*ci)->getSock()->getPeerAddress(),
+ (*ci)->getStartTime(), 4);
+ }
+ return true;
+}
\ No newline at end of file
#include <rfb/LogWriter.h>
#include <rfb/Blacklist.h>
#include <rfb/Cursor.h>
+#include <rfb/ListConnInfo.h>
#include <network/Socket.h>
+#include <rfb/ListConnInfo.h>
namespace rfb {
// are used, to save memory.
void setEconomicTranslate(bool et) { useEconomicTranslate = et; }
+ bool getConnInfo(ListConnInfo * listConn);
+
protected:
friend class VNCSConnectionST;
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\ListConnInfo.h\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\Logger.h\r
# End Source File\r
# Begin Source File\r
}
case IDC_KILL_ALL:
{
- m_server->disconnectClients();
+ COPYDATASTRUCT copyData;
+ copyData.dwData = 2;
+ copyData.lpData = 0;
+ copyData.cbData = 0;
+ SendMessage(m_hSTIcon, WM_COPYDATA, 0, (LPARAM)©Data);
return false;
}
case IDC_DISABLE_CLIENTS:
}
-void ControlPanel::UpdateListView()
+void ControlPanel::UpdateListView(rfb::ListConnInfo* LCInfo)
{
-
+ DeleteAllLVItem(IDC_LIST_CONNECTIONS, handle);
+ if(LCInfo->Empty()) return;
+
+ char* ItemString[3];
+ int i = 0;
+
+ for (LCInfo->iBegin(); !LCInfo->iEnd(); LCInfo->iNext()) {
+ LCInfo->iGetCharInfo(ItemString);
+ InsertLVItem(IDC_LIST_CONNECTIONS, handle, i, ItemString, 3);
+ i++;
+ }
}
BOOL ControlPanel::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
-void ControlPanel::getSelectedConn(std::list<network::Socket*>* selsockets)
+void ControlPanel::getSelConnInfo(std::list<DWORD>* conn, std::list<int>* status)
{
}
#include <list>
-
-#include <winvnc/VNCServerWin32.h>
#include <winvnc/resource.h>
#include <rfb_win32/Dialog.h>
#include <rfb_win32/ListViewControl.h>
#include <rfb_win32/Win32Util.h>
+#include <rfb/ListConnInfo.h>
namespace winvnc {
class ControlPanel : rfb::win32::Dialog, rfb::win32::ListViewControl {
public:
- ControlPanel(VNCServerWin32 * server, HWND hSTIcon) : Dialog(GetModuleHandle(0)), ListViewControl(){
- m_server = server;
+ ControlPanel(HWND hSTIcon) : Dialog(GetModuleHandle(0)), ListViewControl(){
m_hSTIcon = hSTIcon;
};
virtual bool showDialog();
virtual void initDialog();
virtual bool onCommand(int cmd);
- void UpdateListView();
+ void UpdateListView(rfb::ListConnInfo* LCInfo);
HWND GetHandle() {return handle;};
~ControlPanel();
protected:
virtual BOOL dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- void getSelectedConn(std::list<network::Socket*>* selsockets);
- VNCServerWin32 * m_server;
- std::list<network::Socket*> sockets;
+ void getSelConnInfo(std::list<DWORD>* conn, std::list<int>* status);
HWND m_hSTIcon;
+ std::list<DWORD> Conn;
};
};
SetTimer(getHandle(), 1, 3000, 0);
PostMessage(getHandle(), WM_TIMER, 1, 0);
PostMessage(getHandle(), WM_SET_TOOLTIP, 0, 0);
- CPanel = new ControlPanel(&thread.server, getHandle());
+ CPanel = new ControlPanel(getHandle());
}
virtual LRESULT processMessage(UINT msg, WPARAM wParam, LPARAM lParam) {
return 0;
}
setIcon(thread.server.isServerInUse() ? thread.activeIcon : thread.inactiveIcon);
+
+ thread.server.getClientsInfo(&LCInfo);
+ CPanel->UpdateListView(&LCInfo);
+
return 0;
case WM_SET_TOOLTIP:
LaunchProcess vncConnect;
STrayIconThread& thread;
ControlPanel * CPanel;
+ rfb::ListConnInfo LCInfo;
};
return false;
}
+bool VNCServerWin32::getClientsInfo(rfb::ListConnInfo* LCInfo) {
+ return queueCommand(GetClientsInfo, LCInfo, 0);
+}
VNCServerST::queryResult VNCServerWin32::queryConnection(network::Socket* sock,
const char* userName,
"Connection rejected by user");
queryConnectDialog = 0;
break;
+ case GetClientsInfo:
+ vncServer.getConnInfo((ListConnInfo*)commandData);
+ break;
default:
vlog.error("unknown command %d queued", command);
#include <rfb_win32/TCharArray.h>
#include <winvnc/QueryConnectDialog.h>
#include <winvnc/JavaViewer.h>
+//#include <rfb/ListConnInfo.h>
namespace winvnc {
const char* userName,
char** reason);
+ bool getClientsInfo(rfb::ListConnInfo* LCInfo);
+
// Where to read the configuration settings from
static const TCHAR* RegConfigPath;
protected:
// Perform a particular internal function in the server thread
- typedef enum {NoCommand, DisconnectClients, AddClient, QueryConnectionComplete} Command;
+ typedef enum {NoCommand, DisconnectClients, AddClient, QueryConnectionComplete, GetClientsInfo} Command;
bool queueCommand(Command cmd, const void* data, int len);
void doCommand();
Command command;