void vncws_tls_handshake_peek(void *opaque)

{

    VncState *vs = opaque;

    long ret;



    if (!vs->ws_tls.session) {

        char peek[4];

        ret = qemu_recv(vs->csock, peek, sizeof(peek), MSG_PEEK);

        if (ret && (strncmp(peek, "\x16", 1) == 0

                    || strncmp(peek, "\x80", 1) == 0)) {

            VNC_DEBUG("TLS Websocket connection recognized");

            vnc_tls_client_setup(vs, 1);

            vncws_start_tls_handshake(vs);

        } else {

            vncws_handshake_read(vs);

        }

    } else {

        qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs);

    }

}

void vncws_tls_handshake_peek(void *opaque)

{

    VncState *vs = opaque;

    long ret;



    if (!vs->ws_tls.session) {

        char peek[4];

        ret = qemu_recv(vs->csock, peek, sizeof(peek), MSG_PEEK);

        if (ret && (strncmp(peek, "\x16", 1) == 0

                    || strncmp(peek, "\x80", 1) == 0)) {

            VNC_DEBUG("TLS Websocket connection recognized");

            vnc_tls_client_setup(vs, 1);

            vncws_start_tls_handshake(vs);

        } else {

            vncws_handshake_read(vs);

        }

    } else {

        qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs);

    }

}

void FUNC_0(void *VAR_0)

{

    VncState *vs = VAR_0;

    long VAR_1;



    if (!vs->ws_tls.session) {

        char VAR_2[4];

        VAR_1 = qemu_recv(vs->csock, VAR_2, sizeof(VAR_2), MSG_PEEK);

        if (VAR_1 && (strncmp(VAR_2, "\x16", 1) == 0

                    || strncmp(VAR_2, "\x80", 1) == 0)) {

            VNC_DEBUG("TLS Websocket connection recognized");

            vnc_tls_client_setup(vs, 1);

            vncws_start_tls_handshake(vs);

        } else {

            vncws_handshake_read(vs);

        }

    } else {

        qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs);

    }

}

void FUNC_0(void *VAR_0)
{ VncState *vs = VAR_0; long VAR_1; if (!vs->ws_tls.session) { char VAR_2[4]; VAR_1 = qemu_recv(vs->csock, VAR_2, sizeof(VAR_2), MSG_PEEK); if (VAR_1 && (strncmp(VAR_2, "\x16", 1) == 0
|| strncmp(VAR_2, "\x80", 1) == 0)) { VNC_DEBUG("TLS Websocket connection recognized"); vnc_tls_client_setup(vs, 1); vncws_start_tls_handshake(vs); } else { vncws_handshake_read(vs); } } else { qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs); } }