blob: 3fedc50815b4a15beafbce83cb74d13308577678 [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// 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
23// processMsg() is called first when the security type has been decided on, and
24// will keep being called whenever there is data to read from the server. It
25// should return false when it needs more data, or true when the security
26// handshaking is over and we are now waiting for the SecurityResult message
27// from the server. In the event of failure a suitable exception should be
28// thrown.
29//
30// Note that the first time processMsg() is called, there is no guarantee that
31// there is any data to read from the CConnection's InStream, but subsequent
32// calls guarantee there is at least one byte which can be read without
33// blocking.
34//
35// description is a string describing the level of encryption applied to the
36// session, or null if no encryption will be used.
37
38#ifndef __RFB_CSECURITY_H__
39#define __RFB_CSECURITY_H__
40
Adam Tkacb10489b2010-04-23 14:16:04 +000041#include <rfb/UserPasswdGetter.h>
42
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000043namespace rfb {
44 class CConnection;
45 class CSecurity {
46 public:
47 virtual ~CSecurity() {}
48 virtual bool processMsg(CConnection* cc)=0;
49 virtual void destroy() { delete this; }
50 virtual int getType() const = 0;
51 virtual const char* description() const = 0;
Pierre Ossmandaf3d882017-09-01 11:14:35 +020052 virtual bool isSecure() const { return false; }
Adam Tkacb10489b2010-04-23 14:16:04 +000053
54 /*
55 * Use variable directly instead of dumb get/set methods.
56 * It MUST be set by viewer.
57 */
58 static UserPasswdGetter *upg;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000059 };
60}
61#endif