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.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <rfb/UserMsgBox.h>
  40. namespace rfb {
  41. class CConnection;
  42. class CSecurity {
  43. public:
  44. CSecurity(CConnection* cc_) : cc(cc_) {}
  45. virtual ~CSecurity() {}
  46. virtual bool processMsg() = 0;
  47. virtual int getType() 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. static UserMsgBox *msg;
  55. protected:
  56. CConnection* cc;
  57. };
  58. }
  59. #endif