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 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2002-2004 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. processMsg() is called first when the security type has been
  22. // decided on, and will keep being called whenever there is data to read from
  23. // the server until either it returns false, indicating authentication/security
  24. // failure, or it returns with done set to true, to indicate success.
  25. //
  26. // Note that the first time processMsg() is called, there is no guarantee that
  27. // there is any data to read from the CConnection's InStream, but subsequent
  28. // calls guarantee there is at least one byte which can be read without
  29. // blocking.
  30. //
  31. // description is a string describing the level of encryption applied to the
  32. // session, or null if no encryption will be used.
  33. #ifndef __RFB_CSECURITY_H__
  34. #define __RFB_CSECURITY_H__
  35. namespace rfb {
  36. class CConnection;
  37. class CSecurity {
  38. public:
  39. virtual ~CSecurity() {}
  40. virtual bool processMsg(CConnection* cc, bool* done)=0;
  41. virtual void destroy() { delete this; }
  42. virtual int getType() const = 0;
  43. virtual const char* description() const = 0;
  44. };
  45. }
  46. #endif