blob: 3231f1f58f183f99f79321cd4295ab83d507cff1 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* 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
22#ifndef __RFB_SECTYPES_H__
23#define __RFB_SECTYPES_H__
24
Adam Tkac94d88c12010-04-23 13:59:52 +000025#include <rdr/types.h>
Adam Tkac1d15e2d2010-04-23 14:06:38 +000026#include <rfb/Configuration.h>
Adam Tkacc210e8a2010-04-23 14:09:16 +000027#include <rfb/CSecurity.h>
Adam Tkac1d15e2d2010-04-23 14:06:38 +000028#include <rfb/SSecurity.h>
Adam Tkacc210e8a2010-04-23 14:09:16 +000029#include <rfb/UserPasswdGetter.h>
Adam Tkac1d15e2d2010-04-23 14:06:38 +000030
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000031#include <list>
32
33namespace rfb {
Adam Tkac94d88c12010-04-23 13:59:52 +000034 const rdr::U8 secTypeInvalid = 0;
35 const rdr::U8 secTypeNone = 1;
36 const rdr::U8 secTypeVncAuth = 2;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000037
Adam Tkac94d88c12010-04-23 13:59:52 +000038 const rdr::U8 secTypeRA2 = 5;
39 const rdr::U8 secTypeRA2ne = 6;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000040
Adam Tkac94d88c12010-04-23 13:59:52 +000041 const rdr::U8 secTypeSSPI = 7;
Adam Tkac1d15e2d2010-04-23 14:06:38 +000042 const rdr::U8 secTypeSSPIne = 8;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000043
Adam Tkac94d88c12010-04-23 13:59:52 +000044 const rdr::U8 secTypeTight = 16;
45 const rdr::U8 secTypeUltra = 17;
46 const rdr::U8 secTypeTLS = 18;
Adam Tkacdfe19cf2010-04-23 14:14:11 +000047 const rdr::U8 secTypeVeNCrypt= 19;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000048
49 // result types
50
Adam Tkac94d88c12010-04-23 13:59:52 +000051 const rdr::U32 secResultOK = 0;
52 const rdr::U32 secResultFailed = 1;
53 const rdr::U32 secResultTooMany = 2; // deprecated
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000054
Adam Tkac1d15e2d2010-04-23 14:06:38 +000055 class Security {
56 public:
Adam Tkacc210e8a2010-04-23 14:09:16 +000057 /*
58 * Create Security instance.
59 */
Adam Tkac1d15e2d2010-04-23 14:06:38 +000060 Security(void);
61
62 /* Enable/Disable certain security type */
63 void EnableSecType(rdr::U8 secType);
64 void DisableSecType(rdr::U8 secType) { enabledSecTypes.remove(secType); }
65
66 /* Check if certain type is supported */
67 bool IsSupported(rdr::U8 secType);
68
69 /* Get list of enabled security types */
70 const std::list<rdr::U8>& GetEnabledSecTypes(void)
71 { return enabledSecTypes; }
72
73 /* Create server side SSecurity class instance */
74 SSecurity* GetSSecurity(rdr::U8 secType);
75
Adam Tkacc210e8a2010-04-23 14:09:16 +000076 /* Create client side CSecurity class instance */
77 CSecurity* GetCSecurity(rdr::U8 secType);
78
Adam Tkac1d15e2d2010-04-23 14:06:38 +000079 static StringParameter secTypes;
Adam Tkacc210e8a2010-04-23 14:09:16 +000080
81 /*
82 * Use variable directly instead of dumb get/set methods. It is used
83 * only in viewer-side code and MUST be set by viewer.
84 */
85 UserPasswdGetter *upg;
Adam Tkac1d15e2d2010-04-23 14:06:38 +000086 private:
87 std::list<rdr::U8> enabledSecTypes;
88 };
89
Adam Tkac94d88c12010-04-23 13:59:52 +000090 const char* secTypeName(rdr::U8 num);
91 rdr::U8 secTypeNum(const char* name);
Adam Tkac94d88c12010-04-23 13:59:52 +000092 std::list<rdr::U8> parseSecTypes(const char* types);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000093}
94
95#endif