static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,

                                                 char *buffer,

                                                 Error **errp)

{

    QIOChannelWebsockHTTPHeader hdrs[32];

    size_t nhdrs = G_N_ELEMENTS(hdrs);

    const char *protocols = NULL, *version = NULL, *key = NULL,

        *host = NULL, *connection = NULL, *upgrade = NULL;



    nhdrs = qio_channel_websock_extract_headers(buffer, hdrs, nhdrs, errp);

    if (!nhdrs) {

        return -1;

    }



    protocols = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);

    if (!protocols) {

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

        return -1;

    }



    version = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);

    if (!version) {

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

        return -1;

    }



    key = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_KEY);

    if (!key) {

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

        return -1;

    }



    host = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_HOST);

    if (!host) {

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

        return -1;

    }



    connection = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_CONNECTION);

    if (!connection) {

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

        return -1;

    }



    upgrade = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_UPGRADE);

    if (!upgrade) {

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

        return -1;

    }



    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);

        return -1;

    }



    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);

        return -1;

    }



    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);

        return -1;

    }



    if (!g_strrstr(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE)) {

        error_setg(errp, "No connection upgrade requested '%s'", connection);

        return -1;

    }



    if (!g_str_equal(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET)) {

        error_setg(errp, "Incorrect upgrade method '%s'", upgrade);

        return -1;

    }



    return qio_channel_websock_handshake_send_response(ioc, key, errp);

}

static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,

                                                 char *buffer,

                                                 Error **errp)

{

    QIOChannelWebsockHTTPHeader hdrs[32];

    size_t nhdrs = G_N_ELEMENTS(hdrs);

    const char *protocols = NULL, *version = NULL, *key = NULL,

        *host = NULL, *connection = NULL, *upgrade = NULL;



    nhdrs = qio_channel_websock_extract_headers(buffer, hdrs, nhdrs, errp);

    if (!nhdrs) {

        return -1;

    }



    protocols = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);

    if (!protocols) {

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

        return -1;

    }



    version = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);

    if (!version) {

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

        return -1;

    }



    key = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_KEY);

    if (!key) {

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

        return -1;

    }



    host = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_HOST);

    if (!host) {

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

        return -1;

    }



    connection = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_CONNECTION);

    if (!connection) {

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

        return -1;

    }



    upgrade = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_UPGRADE);

    if (!upgrade) {

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

        return -1;

    }



    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);

        return -1;

    }



    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);

        return -1;

    }



    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);

        return -1;

    }



    if (!g_strrstr(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE)) {

        error_setg(errp, "No connection upgrade requested '%s'", connection);

        return -1;

    }



    if (!g_str_equal(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET)) {

        error_setg(errp, "Incorrect upgrade method '%s'", upgrade);

        return -1;

    }



    return qio_channel_websock_handshake_send_response(ioc, key, errp);

}

        return -1; static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,                                                  char *buffer,                                                  Error **errp)     nhdrs = qio_channel_websock_extract_headers(buffer, hdrs, nhdrs, errp);         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;         return -1;     return qio_channel_websock_handshake_send_response(ioc, key, errp);         return -1;
static int FUNC_0(QIOChannelWebsock *VAR_0,

                                                 char *VAR_1,

                                                 Error **VAR_2)

{

    QIOChannelWebsockHTTPHeader hdrs[32];

    size_t nhdrs = G_N_ELEMENTS(hdrs);

    const char *VAR_3 = NULL, *VAR_4 = NULL, *VAR_5 = NULL,

        *VAR_6 = NULL, *VAR_7 = NULL, *VAR_8 = NULL;



    nhdrs = qio_channel_websock_extract_headers(VAR_1, hdrs, nhdrs, VAR_2);

    if (!nhdrs) {

        return -1;

    }



    VAR_3 = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);

    if (!VAR_3) {

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

        return -1;

    }



    VAR_4 = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);

    if (!VAR_4) {

        error_setg(VAR_2, "Missing websocket VAR_4 header data");

        return -1;

    }



    VAR_5 = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_KEY);

    if (!VAR_5) {

        error_setg(VAR_2, "Missing websocket VAR_5 header data");

        return -1;

    }



    VAR_6 = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_HOST);

    if (!VAR_6) {

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

        return -1;

    }



    VAR_7 = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_CONNECTION);

    if (!VAR_7) {

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

        return -1;

    }



    VAR_8 = qio_channel_websock_find_header(

        hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_UPGRADE);

    if (!VAR_8) {

        error_setg(VAR_2, "Missing websocket VAR_8 header data");

        return -1;

    }



    if (!g_strrstr(VAR_3, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {

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

                   QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, VAR_3);

        return -1;

    }



    if (!g_str_equal(VAR_4, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {

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

                   QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, VAR_4);

        return -1;

    }



    if (strlen(VAR_5) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) {

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

                   strlen(VAR_5), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN);

        return -1;

    }



    if (!g_strrstr(VAR_7, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE)) {

        error_setg(VAR_2, "No VAR_7 VAR_8 requested '%s'", VAR_7);

        return -1;

    }



    if (!g_str_equal(VAR_8, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET)) {

        error_setg(VAR_2, "Incorrect VAR_8 method '%s'", VAR_8);

        return -1;

    }



    return qio_channel_websock_handshake_send_response(VAR_0, VAR_5, VAR_2);

}

static int FUNC_0(QIOChannelWebsock *VAR_0,
char *VAR_1,
Error **VAR_2)
{ QIOChannelWebsockHTTPHeader hdrs[32]; size_t nhdrs = G_N_ELEMENTS(hdrs); const char *VAR_3 = NULL, *VAR_4 = NULL, *VAR_5 = NULL,
*VAR_6 = NULL, *VAR_7 = NULL, *VAR_8 = NULL; nhdrs = qio_channel_websock_extract_headers(VAR_1, hdrs, nhdrs, VAR_2); if (!nhdrs) { return -1; } VAR_3 = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); if (!VAR_3) { error_setg(VAR_2, "Missing websocket protocol header data"); return -1; } VAR_4 = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); if (!VAR_4) { error_setg(VAR_2, "Missing websocket VAR_4 header data"); return -1; } VAR_5 = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_KEY); if (!VAR_5) { error_setg(VAR_2, "Missing websocket VAR_5 header data"); return -1; } VAR_6 = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_HOST); if (!VAR_6) { error_setg(VAR_2, "Missing websocket VAR_6 header data"); return -1; } VAR_7 = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_CONNECTION); if (!VAR_7) { error_setg(VAR_2, "Missing websocket VAR_7 header data"); return -1; } VAR_8 = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_UPGRADE); if (!VAR_8) { error_setg(VAR_2, "Missing websocket VAR_8 header data"); return -1; } if (!g_strrstr(VAR_3, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { error_setg(VAR_2, "No '%s' protocol is supported by client '%s'",
QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, VAR_3); return -1; } if (!g_str_equal(VAR_4, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { error_setg(VAR_2, "Version '%s' is not supported by client '%s'",
QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, VAR_4); return -1; } if (strlen(VAR_5) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) { error_setg(VAR_2, "Key length '%zu' was not as expected '%d'",
strlen(VAR_5), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN); return -1; } if (!g_strrstr(VAR_7, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE)) { error_setg(VAR_2, "No VAR_7 VAR_8 requested '%s'", VAR_7); return -1; } if (!g_str_equal(VAR_8, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET)) { error_setg(VAR_2, "Incorrect VAR_8 method '%s'", VAR_8); return -1; } return qio_channel_websock_handshake_send_response(VAR_0, VAR_5, VAR_2); }