vnc-ws.c (fde069f751a9aa7e597c9d297a9995eca418a403) | vnc-ws.c (4769a881cbe1130e7ba4650471ef37e2cf998a9c) |
---|---|
1/* 2 * QEMU VNC display driver: Websockets support 3 * 4 * Copyright (C) 2010 Joel Martin 5 * Copyright (C) 2012 Tim Hardeck 6 * 7 * This is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 10 unchanged lines hidden (view full) --- 19 */ 20 21#include "vnc.h" 22#include "qemu/main-loop.h" 23 24#ifdef CONFIG_VNC_TLS 25#include "qemu/sockets.h" 26 | 1/* 2 * QEMU VNC display driver: Websockets support 3 * 4 * Copyright (C) 2010 Joel Martin 5 * Copyright (C) 2012 Tim Hardeck 6 * 7 * This is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 10 unchanged lines hidden (view full) --- 19 */ 20 21#include "vnc.h" 22#include "qemu/main-loop.h" 23 24#ifdef CONFIG_VNC_TLS 25#include "qemu/sockets.h" 26 |
27static int vncws_start_tls_handshake(struct VncState *vs) | 27static int vncws_start_tls_handshake(VncState *vs) |
28{ 29 int ret = gnutls_handshake(vs->tls.session); 30 31 if (ret < 0) { 32 if (!gnutls_error_is_fatal(ret)) { 33 VNC_DEBUG("Handshake interrupted (blocking)\n"); 34 if (!gnutls_record_get_direction(vs->tls.session)) { 35 qemu_set_fd_handler(vs->csock, vncws_tls_handshake_io, --- 22 unchanged lines hidden (view full) --- 58 VNC_DEBUG("Handshake done, switching to TLS data mode\n"); 59 qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs); 60 61 return 0; 62} 63 64void vncws_tls_handshake_io(void *opaque) 65{ | 28{ 29 int ret = gnutls_handshake(vs->tls.session); 30 31 if (ret < 0) { 32 if (!gnutls_error_is_fatal(ret)) { 33 VNC_DEBUG("Handshake interrupted (blocking)\n"); 34 if (!gnutls_record_get_direction(vs->tls.session)) { 35 qemu_set_fd_handler(vs->csock, vncws_tls_handshake_io, --- 22 unchanged lines hidden (view full) --- 58 VNC_DEBUG("Handshake done, switching to TLS data mode\n"); 59 qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs); 60 61 return 0; 62} 63 64void vncws_tls_handshake_io(void *opaque) 65{ |
66 struct VncState *vs = (struct VncState *)opaque; | 66 VncState *vs = (VncState *)opaque; |
67 68 if (!vs->tls.session) { 69 VNC_DEBUG("TLS Websocket setup\n"); 70 if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { 71 return; 72 } 73 } 74 VNC_DEBUG("Handshake IO continue\n"); --- 309 unchanged lines hidden --- | 67 68 if (!vs->tls.session) { 69 VNC_DEBUG("TLS Websocket setup\n"); 70 if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { 71 return; 72 } 73 } 74 VNC_DEBUG("Handshake IO continue\n"); --- 309 unchanged lines hidden --- |