summaryrefslogtreecommitdiffstats
path: root/rfb/rfbclient.h
diff options
context:
space:
mode:
Diffstat (limited to 'rfb/rfbclient.h')
-rw-r--r--rfb/rfbclient.h69
1 files changed, 68 insertions, 1 deletions
diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h
index 17ddba6..2eea004 100644
--- a/rfb/rfbclient.h
+++ b/rfb/rfbclient.h
@@ -7,6 +7,7 @@
*/
/*
+ * Copyright (C) 2017 D. R. Commander. All Rights Reserved.
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
@@ -35,14 +36,27 @@
#define WIN32_LEAN_AND_MEAN /* Prevent loading any Winsock 1.x headers from windows.h */
#endif
+#if defined(ANDROID) || defined(LIBVNCSERVER_HAVE_ANDROID)
+#include <arpa/inet.h>
+#include <sys/select.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if LIBVNCSERVER_HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
+#if LIBVNCSERVER_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <rfb/rfbproto.h>
#include <rfb/keysym.h>
+#ifdef LIBVNCSERVER_HAVE_SASL
+#include <sasl/sasl.h>
+#endif /* LIBVNCSERVER_HAVE_SASL */
+
#define rfbClientSwap16IfLE(s) \
(*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
@@ -127,6 +141,7 @@ typedef union _rfbCredential
char *x509CACrlFile;
char *x509ClientCertFile;
char *x509ClientKeyFile;
+ uint8_t x509CrlVerifyMode; /* Only required for OpenSSL - see meanings below */
} x509Credential;
/** Plain (VeNCrypt), MSLogon (UltraVNC) */
struct
@@ -139,6 +154,13 @@ typedef union _rfbCredential
#define rfbCredentialTypeX509 1
#define rfbCredentialTypeUser 2
+/* When using OpenSSL, CRLs can be included in both the x509CACrlFile and appended
+ to the x509CACertFile as is common with OpenSSL. When rfbX509CrlVerifyAll is
+ specified the CRL list must include CRLs for all certificates in the chain */
+#define rfbX509CrlVerifyNone 0 /* No CRL checking is performed */
+#define rfbX509CrlVerifyClient 1 /* Only the leaf server certificate is checked */
+#define rfbX509CrlVerifyAll 2 /* All certificates in the server chain are checked */
+
struct _rfbClient;
/**
@@ -184,9 +206,17 @@ typedef void (*BellProc)(struct _rfbClient* client);
*/
typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel);
typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y);
+typedef void (*GotFillRectProc)(struct _rfbClient* client, int x, int y, int w, int h, uint32_t colour);
+typedef void (*GotBitmapProc)(struct _rfbClient* client, const uint8_t* buffer, int x, int y, int w, int h);
+typedef rfbBool (*GotJpegProc)(struct _rfbClient* client, const uint8_t* buffer, int length, int x, int y, int w, int h);
typedef rfbBool (*LockWriteToTLSProc)(struct _rfbClient* client);
typedef rfbBool (*UnlockWriteToTLSProc)(struct _rfbClient* client);
+#ifdef LIBVNCSERVER_HAVE_SASL
+typedef char* (*GetUserProc)(struct _rfbClient* client);
+typedef char* (*GetSASLMechanismProc)(struct _rfbClient* client, char* mechlist);
+#endif /* LIBVNCSERVER_HAVE_SASL */
+
typedef struct _rfbClient {
uint8_t* frameBuffer;
int width, height;
@@ -268,7 +298,7 @@ typedef struct _rfbClient {
uint8_t tightPrevRow[2048*3*sizeof(uint16_t)];
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
- /** JPEG decoder state. */
+ /** JPEG decoder state (obsolete-- do not use). */
rfbBool jpegError;
struct jpeg_source_mgr* jpegSrcManager;
@@ -371,6 +401,40 @@ typedef struct _rfbClient {
LockWriteToTLSProc LockWriteToTLS;
UnlockWriteToTLSProc UnlockWriteToTLS;
+ /** Hooks for custom rendering
+ *
+ * VNC rendering boils down to 3 activities:
+ * - GotCopyRect: copy an area of the framebuffer
+ * - GotFillRect: fill an area of the framebuffer with a solid color
+ * - GotBitmap: copy the bitmap in the buffer into the framebuffer
+ * The client application should either set all three of these or none!
+ */
+ GotFillRectProc GotFillRect;
+ GotBitmapProc GotBitmap;
+ /** Hook for custom JPEG decoding and rendering */
+ GotJpegProc GotJpeg;
+
+#ifdef LIBVNCSERVER_HAVE_SASL
+ sasl_conn_t *saslconn;
+ const char *saslDecoded;
+ unsigned int saslDecodedLength;
+ unsigned int saslDecodedOffset;
+ sasl_secret_t *saslSecret;
+
+ /* Callback to allow the client to choose a preferred mechanism. The string returned will
+ be freed once no longer required. */
+ GetSASLMechanismProc GetSASLMechanism;
+ GetUserProc GetUser;
+
+#endif /* LIBVNCSERVER_HAVE_SASL */
+
+#ifdef LIBVNCSERVER_HAVE_LIBZ
+#ifdef LIBVNCSERVER_HAVE_LIBJPEG
+ /** JPEG decoder state. */
+ void *tjhnd;
+
+#endif
+#endif
} rfbClient;
/* cursor.c */
@@ -560,6 +624,9 @@ typedef struct _rfbClientProtocolExtension {
rfbBool (*handleMessage)(rfbClient* cl,
rfbServerToClientMsg* message);
struct _rfbClientProtocolExtension* next;
+ uint32_t const* securityTypes;
+ /** returns TRUE if it handled the authentication */
+ rfbBool (*handleAuthentication)(rfbClient* cl, uint32_t authScheme);
} rfbClientProtocolExtension;
void rfbClientRegisterExtension(rfbClientProtocolExtension* e);