You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CSecurity.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. //
  19. // CSecurity - class on the client side for handling security handshaking. A
  20. // derived class for a particular security type overrides the processMsg()
  21. // method.
  22. // processMsg() is called first when the security type has been decided on, and
  23. // will keep being called whenever there is data to read from the server. It
  24. // should return false when it needs more data, or true when the security
  25. // handshaking is over and we are now waiting for the SecurityResult message
  26. // from the server. In the event of failure a suitable exception should be
  27. // thrown.
  28. //
  29. // Note that the first time processMsg() is called, there is no guarantee that
  30. // there is any data to read from the CConnection's InStream, but subsequent
  31. // calls guarantee there is at least one byte which can be read without
  32. // blocking.
  33. //
  34. // description is a string describing the level of encryption applied to the
  35. // session, or null if no encryption will be used.
  36. #ifndef __RFB_CSECURITY_H__
  37. #define __RFB_CSECURITY_H__
  38. #include <rfb/UserPasswdGetter.h>
  39. namespace rfb {
  40. class CConnection;
  41. class CSecurity {
  42. public:
  43. virtual ~CSecurity() {}
  44. virtual bool processMsg(CConnection* cc)=0;
  45. virtual void destroy() { delete this; }
  46. virtual int getType() const = 0;
  47. virtual const char* description() const = 0;
  48. virtual bool isSecure() const { return false; }
  49. /*
  50. * Use variable directly instead of dumb get/set methods.
  51. * It MUST be set by viewer.
  52. */
  53. static UserPasswdGetter *upg;
  54. };
  55. }
  56. #endif