Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Security.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. // secTypes.h - constants for the various security types.
  20. //
  21. #ifndef __RFB_SECTYPES_H__
  22. #define __RFB_SECTYPES_H__
  23. #include <rdr/types.h>
  24. #include <rfb/Configuration.h>
  25. #include <rfb/CSecurity.h>
  26. #include <list>
  27. namespace rfb {
  28. const rdr::U8 secTypeInvalid = 0;
  29. const rdr::U8 secTypeNone = 1;
  30. const rdr::U8 secTypeVncAuth = 2;
  31. const rdr::U8 secTypeRA2 = 5;
  32. const rdr::U8 secTypeRA2ne = 6;
  33. const rdr::U8 secTypeSSPI = 7;
  34. const rdr::U8 secTypeSSPIne = 8;
  35. const rdr::U8 secTypeTight = 16;
  36. const rdr::U8 secTypeUltra = 17;
  37. const rdr::U8 secTypeTLS = 18;
  38. const rdr::U8 secTypeVeNCrypt= 19;
  39. /* VeNCrypt subtypes */
  40. const int secTypePlain = 256;
  41. const int secTypeTLSNone = 257;
  42. const int secTypeTLSVnc = 258;
  43. const int secTypeTLSPlain = 259;
  44. const int secTypeX509None = 260;
  45. const int secTypeX509Vnc = 261;
  46. const int secTypeX509Plain = 262;
  47. // result types
  48. const rdr::U32 secResultOK = 0;
  49. const rdr::U32 secResultFailed = 1;
  50. const rdr::U32 secResultTooMany = 2; // deprecated
  51. class Security {
  52. public:
  53. /*
  54. * Create Security instance.
  55. */
  56. Security();
  57. Security(StringParameter &secTypes);
  58. /*
  59. * Note about security types.
  60. *
  61. * Although RFB protocol specifies security types as U8 values,
  62. * we map VeNCrypt subtypes (U32) into the standard security types
  63. * to simplify user configuration. With this mapping user can configure
  64. * both VeNCrypt subtypes and security types with only one option.
  65. */
  66. /* Enable/Disable certain security type */
  67. void EnableSecType(rdr::U32 secType);
  68. void DisableSecType(rdr::U32 secType) { enabledSecTypes.remove(secType); }
  69. void SetSecTypes(std::list<rdr::U32> &secTypes) { enabledSecTypes = secTypes; }
  70. /* Check if certain type is supported */
  71. bool IsSupported(rdr::U32 secType);
  72. /* Get list of enabled security types without VeNCrypt subtypes */
  73. const std::list<rdr::U8> GetEnabledSecTypes(void);
  74. /* Get list of enabled VeNCrypt subtypes */
  75. const std::list<rdr::U32> GetEnabledExtSecTypes(void);
  76. /* Output char* is stored in static array */
  77. char *ToString(void);
  78. #ifdef HAVE_GNUTLS
  79. static StringParameter GnuTLSPriority;
  80. #endif
  81. private:
  82. std::list<rdr::U32> enabledSecTypes;
  83. };
  84. const char* secTypeName(rdr::U32 num);
  85. rdr::U32 secTypeNum(const char* name);
  86. std::list<rdr::U32> parseSecTypes(const char* types);
  87. }
  88. #endif