vncClient.h
Upload User: sbftbdw
Upload Date: 2007-01-03
Package Size: 379k
Code Size: 5k
Category:

Remote Control

Development Platform:

Visual C++

  1. //  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
  2. //
  3. //  This file is part of the VNC system.
  4. //
  5. //  The VNC system is free software; you can redistribute it and/or modify
  6. //  it under the terms of the GNU General Public License as published by
  7. //  the Free Software Foundation; either version 2 of the License, or
  8. //  (at your option) any later version.
  9. //
  10. //  This program is distributed in the hope that it will be useful,
  11. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. //  GNU General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU General Public License
  16. //  along with this program; if not, write to the Free Software
  17. //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  18. //  USA.
  19. //
  20. // If the source code for the VNC system is not available from the place 
  21. // whence you received this file, check http://www.orl.co.uk/vnc or contact
  22. // the authors on vnc@orl.co.uk for information on obtaining it.
  23. // vncClient.h
  24. // vncClient class handles the following functions:
  25. // - Recieves requests from the connected client and
  26. //   handles them
  27. // - Handles incoming updates properly, using a vncBuffer
  28. //   object to keep track of screen changes
  29. // It uses a vncBuffer and is passed the vncDesktop and
  30. // vncServer to communicate with.
  31. class vncClient;
  32. typedef SHORT vncClientId;
  33. #if (!defined(_WINVNC_VNCCLIENT))
  34. #define _WINVNC_VNCCLIENT
  35. #include <list>
  36. typedef std::list<vncClientId> vncClientList;
  37. // Includes
  38. #include "stdhdrs.h"
  39. #include "VSocket.h"
  40. #include <omnithread.h>
  41. // Custom
  42. #include "rectlist.h"
  43. #include "vncDesktop.h"
  44. #include "vncRegion.h"
  45. #include "vncBuffer.h"
  46. #include "vncKeymap.h"
  47. // The vncClient class itself
  48. class vncClient
  49. {
  50. public:
  51. // Constructor/destructor
  52. vncClient();
  53. ~vncClient();
  54. // Allow the client thread to see inside the client object
  55. friend class vncClientThread;
  56. // Init
  57. virtual BOOL Init(vncServer *server,
  58. VSocket *socket,
  59. BOOL auth,
  60. vncClientId newid);
  61. // Kill
  62. // The server uses this to close the client socket, causing the
  63. // client thread to fail, which in turn deletes the client object
  64. virtual void Kill();
  65. // Client manipulation functions for use by the server
  66. virtual void SetBuffer(vncBuffer *buffer);
  67. // Update handling functions
  68. virtual void TriggerUpdate();
  69. virtual void UpdateMouse();
  70. virtual void UpdateRect(RECT &rect);
  71. virtual void UpdateRegion(vncRegion &region);
  72. virtual void CopyRect(RECT &dest, POINT &source);
  73. virtual void UpdateClipText(LPSTR text);
  74. virtual void UpdatePalette();
  75. // Functions for setting & getting the client settings
  76. virtual void SetTeleport(BOOL teleport) {m_teleport = teleport;};
  77. virtual void EnableKeyboard(BOOL enable) {m_keyboardenabled = enable;};
  78. virtual void EnablePointer(BOOL enable) {m_pointerenabled = enable;};
  79. virtual void SetCapability(int capability) {m_capability = capability;};
  80. virtual BOOL IsTeleport() {return m_teleport;};
  81. virtual BOOL IsKeyboardEnabled() {return m_keyboardenabled;};
  82. virtual BOOL IsPointerEnabled() {return m_pointerenabled;};
  83. virtual int GetCapability() {return m_capability;};
  84. virtual char *GetClientName();
  85. virtual vncClientId GetClientId() {return m_id;};
  86. // Update routines
  87. protected:
  88. BOOL SendUpdate();
  89. BOOL SendRFBMsg(CARD8 type, BYTE *buffer, int buflen);
  90. void CheckRects(vncRegion &rgn, rectlist &rects);
  91. void ClearRects(vncRegion &rgn, rectlist &rects);
  92. void GrabRegion(vncRegion &rgn);
  93. BOOL SendRectangles(rectlist &rects);
  94. BOOL SendRectangle(RECT &rect);
  95. BOOL SendCopyRect(RECT &dest, POINT &source);
  96. BOOL SendPalette();
  97. void PollWindow(HWND hwnd);
  98. // Internal stuffs
  99. protected:
  100. // Per-client settings
  101. BOOL m_teleport;
  102. BOOL m_keyboardenabled;
  103. BOOL m_pointerenabled;
  104. int m_capability;
  105. BOOL m_copyrect_use;
  106. vncClientId m_id;
  107. // The screen buffer
  108. vncBuffer *m_buffer;
  109. // The server
  110. vncServer *m_server;
  111. // The socket
  112. VSocket *m_socket;
  113. // The client thread
  114. omni_thread *m_thread;
  115. // User input information
  116. RECT m_oldmousepos;
  117. BOOL m_mousemoved;
  118. rfbPointerEventMsg m_ptrevent;
  119. vncKeymap m_keymap;
  120. // Region structures used when preparing updates
  121. // - region of rects which may have changed since last update
  122. // - region for which incremental data is requested
  123. // - region for which full data is requested
  124. vncRegion m_changed_rgn;
  125. vncRegion m_incr_rgn;
  126. vncRegion m_full_rgn;
  127. omni_mutex m_regionLock;
  128. BOOL m_copyrect_set;
  129. RECT m_copyrect_rect;
  130. POINT m_copyrect_src;
  131. BOOL m_updatewanted;
  132. RECT m_fullscreen;
  133. // When the local display is palettized, it sometimes changes...
  134. BOOL m_palettechanged;
  135. // Information used in polling mode!
  136. RECT m_qtrscreen;
  137. UINT m_pollingcycle;
  138. BOOL m_remoteevent;
  139. };
  140. #endif