static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,

                                                 const char *line,

                                                 size_t size,

                                                 Error **errp)

{

    int ret = -1;

    char *protocols = qio_channel_websock_handshake_entry(

        line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);

    char *version = qio_channel_websock_handshake_entry(

        line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);

    char *key = qio_channel_websock_handshake_entry(

        line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY);



    if (!protocols) {

        error_setg(errp, "Missing websocket protocol header data");

        goto cleanup;

    }



    if (!version) {

        error_setg(errp, "Missing websocket version header data");

        goto cleanup;

    }



    if (!key) {

        error_setg(errp, "Missing websocket key header data");

        goto cleanup;

    }



    if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {

        error_setg(errp, "No '%s' protocol is supported by client '%s'",

                   QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols);

        goto cleanup;

    }



    if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {

        error_setg(errp, "Version '%s' is not supported by client '%s'",

                   QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, version);

        goto cleanup;

    }



    if (strlen(key) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) {

        error_setg(errp, "Key length '%zu' was not as expected '%d'",

                   strlen(key), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN);

        goto cleanup;

    }



    ret = qio_channel_websock_handshake_send_response(ioc, key, errp);



 cleanup:

    g_free(protocols);

    g_free(version);

    g_free(key);

    return ret;

}

static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,

                                                 const char *line,

                                                 size_t size,

                                                 Error **errp)

{

    int ret = -1;

    char *protocols = qio_channel_websock_handshake_entry(

        line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);

    char *version = qio_channel_websock_handshake_entry(

        line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);

    char *key = qio_channel_websock_handshake_entry(

        line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY);



    if (!protocols) {

        error_setg(errp, "Missing websocket protocol header data");

        goto cleanup;

    }



    if (!version) {

        error_setg(errp, "Missing websocket version header data");

        goto cleanup;

    }



    if (!key) {

        error_setg(errp, "Missing websocket key header data");

        goto cleanup;

    }



    if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {

        error_setg(errp, "No '%s' protocol is supported by client '%s'",

                   QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols);

        goto cleanup;

    }



    if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {

        error_setg(errp, "Version '%s' is not supported by client '%s'",

                   QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, version);

        goto cleanup;

    }



    if (strlen(key) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) {

        error_setg(errp, "Key length '%zu' was not as expected '%d'",

                   strlen(key), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN);

        goto cleanup;

    }



    ret = qio_channel_websock_handshake_send_response(ioc, key, errp);



 cleanup:

    g_free(protocols);

    g_free(version);

    g_free(key);

    return ret;

}

    return ret;                                                  const char *line,                                                  size_t size,     int ret = -1;     char *protocols = qio_channel_websock_handshake_entry(         line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);     char *version = qio_channel_websock_handshake_entry(         line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);     char *key = qio_channel_websock_handshake_entry(         line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY);         goto cleanup;         goto cleanup;         goto cleanup;         goto cleanup;         goto cleanup;         goto cleanup;     ret = qio_channel_websock_handshake_send_response(ioc, key, errp);  cleanup:     g_free(protocols);     g_free(version);     g_free(key);     return ret;
static int FUNC_0(QIOChannelWebsock *VAR_0,

                                                 const char *VAR_1,

                                                 size_t VAR_2,

                                                 Error **VAR_3)

{

    int VAR_4 = -1;

    char *VAR_5 = qio_channel_websock_handshake_entry(

        VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);

    char *VAR_6 = qio_channel_websock_handshake_entry(

        VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);

    char *VAR_7 = qio_channel_websock_handshake_entry(

        VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_KEY);



    if (!VAR_5) {

        error_setg(VAR_3, "Missing websocket protocol header data");

        goto cleanup;

    }



    if (!VAR_6) {

        error_setg(VAR_3, "Missing websocket VAR_6 header data");

        goto cleanup;

    }



    if (!VAR_7) {

        error_setg(VAR_3, "Missing websocket VAR_7 header data");

        goto cleanup;

    }



    if (!g_strrstr(VAR_5, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {

        error_setg(VAR_3, "No '%s' protocol is supported by client '%s'",

                   QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, VAR_5);

        goto cleanup;

    }



    if (!g_str_equal(VAR_6, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {

        error_setg(VAR_3, "Version '%s' is not supported by client '%s'",

                   QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, VAR_6);

        goto cleanup;

    }



    if (strlen(VAR_7) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) {

        error_setg(VAR_3, "Key length '%zu' was not as expected '%d'",

                   strlen(VAR_7), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN);

        goto cleanup;

    }



    VAR_4 = qio_channel_websock_handshake_send_response(VAR_0, VAR_7, VAR_3);



 cleanup:

    g_free(VAR_5);

    g_free(VAR_6);

    g_free(VAR_7);

    return VAR_4;

}

static int FUNC_0(QIOChannelWebsock *VAR_0,
const char *VAR_1,
size_t VAR_2,
Error **VAR_3)
{ int VAR_4 = -1; char *VAR_5 = qio_channel_websock_handshake_entry(
VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); char *VAR_6 = qio_channel_websock_handshake_entry(
VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); char *VAR_7 = qio_channel_websock_handshake_entry(
VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_KEY); if (!VAR_5) { error_setg(VAR_3, "Missing websocket protocol header data"); goto cleanup; } if (!VAR_6) { error_setg(VAR_3, "Missing websocket VAR_6 header data"); goto cleanup; } if (!VAR_7) { error_setg(VAR_3, "Missing websocket VAR_7 header data"); goto cleanup; } if (!g_strrstr(VAR_5, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { error_setg(VAR_3, "No '%s' protocol is supported by client '%s'",
QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, VAR_5); goto cleanup; } if (!g_str_equal(VAR_6, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { error_setg(VAR_3, "Version '%s' is not supported by client '%s'",
QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, VAR_6); goto cleanup; } if (strlen(VAR_7) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) { error_setg(VAR_3, "Key length '%zu' was not as expected '%d'",
strlen(VAR_7), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN); goto cleanup; } VAR_4 = qio_channel_websock_handshake_send_response(VAR_0, VAR_7, VAR_3); cleanup:
g_free(VAR_5); g_free(VAR_6); g_free(VAR_7); return VAR_4; }