diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/rfb_win32/SocketManager.cxx | 12 | ||||
-rw-r--r-- | win/rfb_win32/SocketManager.h | 32 | ||||
-rw-r--r-- | win/winvnc/ManagedListener.cxx | 2 | ||||
-rw-r--r-- | win/winvnc/ManagedListener.h | 6 | ||||
-rw-r--r-- | win/winvnc/VNCServerWin32.cxx | 30 |
5 files changed, 46 insertions, 36 deletions
diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx index c2fba0fb..015ba549 100644 --- a/win/rfb_win32/SocketManager.cxx +++ b/win/rfb_win32/SocketManager.cxx @@ -24,8 +24,12 @@ #include <winsock2.h> #include <list> + +#include <network/Socket.h> + #include <rfb/LogWriter.h> #include <rfb/Timer.h> +#include <rfb/VNCServer.h> #include <rfb/util.h> #include <rfb_win32/SocketManager.h> @@ -55,7 +59,7 @@ static void requestAddressChangeEvents(network::SocketListener* sock_) { void SocketManager::addListener(network::SocketListener* sock_, - network::SocketServer* srvr, + VNCServer* srvr, AddressChangeNotifier* acn) { WSAEVENT event = WSACreateEvent(); long flags = FD_ACCEPT | FD_CLOSE; @@ -103,7 +107,7 @@ void SocketManager::remListener(network::SocketListener* sock) { } -void SocketManager::addSocket(network::Socket* sock_, network::SocketServer* srvr, bool outgoing) { +void SocketManager::addSocket(network::Socket* sock_, VNCServer* srvr, bool outgoing) { WSAEVENT event = WSACreateEvent(); if (!event || !addEvent(event, this) || (WSAEventSelect(sock_->getFd(), event, FD_READ | FD_CLOSE) == SOCKET_ERROR)) { @@ -135,7 +139,7 @@ void SocketManager::remSocket(network::Socket* sock_) { throw rdr::Exception("Socket not registered"); } -bool SocketManager::getDisable(network::SocketServer* srvr) +bool SocketManager::getDisable(VNCServer* srvr) { std::map<HANDLE,ListenInfo>::iterator i; for (i=listeners.begin(); i!=listeners.end(); i++) { @@ -146,7 +150,7 @@ bool SocketManager::getDisable(network::SocketServer* srvr) throw rdr::Exception("Listener not registered"); } -void SocketManager::setDisable(network::SocketServer* srvr, bool disable) +void SocketManager::setDisable(VNCServer* srvr, bool disable) { bool found = false; std::map<HANDLE,ListenInfo>::iterator i; diff --git a/win/rfb_win32/SocketManager.h b/win/rfb_win32/SocketManager.h index e5ca02e6..809c470e 100644 --- a/win/rfb_win32/SocketManager.h +++ b/win/rfb_win32/SocketManager.h @@ -19,22 +19,28 @@ // -=- SocketManager.h // Socket manager class for Win32. -// Passed a network::SocketListener and a network::SocketServer when +// Passed a network::SocketListener and a rfb::VNCServer when // constructed. Uses WSAAsyncSelect to get notifications of network // connection attempts. When an incoming connection is received, -// the manager will call network::SocketServer::addClient(). If +// the manager will call rfb::VNCServer::addClient(). If // addClient returns true then the manager registers interest in // network events on that socket, and calls -// network::SocketServer::processSocketEvent(). +// rfb::VNCServer::processSocketEvent(). #ifndef __RFB_WIN32_SOCKET_MGR_H__ #define __RFB_WIN32_SOCKET_MGR_H__ #include <map> -#include <network/Socket.h> #include <rfb_win32/EventManager.h> +namespace network { + class SocketListener; + class Socket; +} + namespace rfb { + class VNCServer; + namespace win32 { class SocketManager : public EventManager, EventHandler { @@ -52,21 +58,21 @@ namespace rfb { }; // Add a listening socket. Incoming connections will be added to the supplied - // SocketServer. + // VNCServer. void addListener(network::SocketListener* sock_, - network::SocketServer* srvr, + VNCServer* srvr, AddressChangeNotifier* acn = 0); // Remove and delete a listening socket. void remListener(network::SocketListener* sock); // Add an already-connected socket. Socket events will cause the supplied - // SocketServer to be called. The socket must ALREADY BE REGISTERED with - // the SocketServer. - void addSocket(network::Socket* sock_, network::SocketServer* srvr, bool outgoing=true); + // VNCServer to be called. The socket must ALREADY BE REGISTERED with + // the VNCServer. + void addSocket(network::Socket* sock_, VNCServer* srvr, bool outgoing=true); - bool getDisable(network::SocketServer* srvr); - void setDisable(network::SocketServer* srvr, bool disable); + bool getDisable(VNCServer* srvr); + void setDisable(VNCServer* srvr, bool disable); protected: virtual int checkTimeouts(); @@ -75,11 +81,11 @@ namespace rfb { struct ConnInfo { network::Socket* sock; - network::SocketServer* server; + VNCServer* server; }; struct ListenInfo { network::SocketListener* sock; - network::SocketServer* server; + VNCServer* server; AddressChangeNotifier* notifier; bool disable; }; diff --git a/win/winvnc/ManagedListener.cxx b/win/winvnc/ManagedListener.cxx index a93ca298..1a278678 100644 --- a/win/winvnc/ManagedListener.cxx +++ b/win/winvnc/ManagedListener.cxx @@ -45,7 +45,7 @@ ManagedListener::~ManagedListener() { } -void ManagedListener::setServer(network::SocketServer* svr) { +void ManagedListener::setServer(rfb::VNCServer* svr) { if (svr == server) return; vlog.info("set server to %p", svr); diff --git a/win/winvnc/ManagedListener.h b/win/winvnc/ManagedListener.h index 39223c79..20503c33 100644 --- a/win/winvnc/ManagedListener.h +++ b/win/winvnc/ManagedListener.h @@ -27,7 +27,7 @@ namespace winvnc { // -=- ManagedListener // Wrapper class which simplifies the management of a listening socket - // on a specified port, attached to a SocketManager and SocketServer. + // on a specified port, attached to a SocketManager and VNCServer. // Reopens sockets & reconfigures filters & callbacks as appropriate. // Handles addition/removal of Listeners from SocketManager internally. @@ -36,7 +36,7 @@ namespace winvnc { ManagedListener(rfb::win32::SocketManager* mgr); ~ManagedListener(); - void setServer(network::SocketServer* svr); + void setServer(rfb::VNCServer* svr); void setPort(int port, bool localOnly=false); void setFilter(const char* filter); void setAddressChangeNotifier(rfb::win32::SocketManager::AddressChangeNotifier* acn); @@ -49,7 +49,7 @@ namespace winvnc { network::TcpFilter* filter; rfb::win32::SocketManager* manager; rfb::win32::SocketManager::AddressChangeNotifier* addrChangeNotifier; - network::SocketServer* server; + rfb::VNCServer* server; int port; bool localOnly; }; diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index a243d95e..38b2ef16 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -363,11 +363,11 @@ void VNCServerWin32::getConnInfo(ListConnInfo * listConn) if (!conn->authenticated()) status = 3; - else if (conn->accessCheck(rfb::SConnection::AccessPtrEvents | - rfb::SConnection::AccessKeyEvents | - rfb::SConnection::AccessView)) + else if (conn->accessCheck(rfb::AccessPtrEvents | + rfb::AccessKeyEvents | + rfb::AccessView)) status = 0; - else if (conn->accessCheck(rfb::SConnection::AccessView)) + else if (conn->accessCheck(rfb::AccessView)) status = 1; else status = 2; @@ -398,25 +398,25 @@ void VNCServerWin32::setConnStatus(ListConnInfo* listConn) if (status == 3) { conn->close(0); } else { - rfb::SConnection::AccessRights ar; + rfb::AccessRights ar; - ar = rfb::SConnection::AccessDefault; + ar = rfb::AccessDefault; switch (status) { case 0: - ar |= rfb::SConnection::AccessPtrEvents | - rfb::SConnection::AccessKeyEvents | - rfb::SConnection::AccessView; + ar |= rfb::AccessPtrEvents | + rfb::AccessKeyEvents | + rfb::AccessView; break; case 1: - ar |= rfb::SConnection::AccessView; - ar &= ~(rfb::SConnection::AccessPtrEvents | - rfb::SConnection::AccessKeyEvents); + ar |= rfb::AccessView; + ar &= ~(rfb::AccessPtrEvents | + rfb::AccessKeyEvents); break; case 2: - ar &= ~(rfb::SConnection::AccessPtrEvents | - rfb::SConnection::AccessKeyEvents | - rfb::SConnection::AccessView); + ar &= ~(rfb::AccessPtrEvents | + rfb::AccessKeyEvents | + rfb::AccessView); break; } conn->setAccessRights(ar); |