static VncClientInfo *qmp_query_vnc_client(const VncState *client)

{

    struct sockaddr_storage sa;

    socklen_t salen = sizeof(sa);

    char host[NI_MAXHOST];

    char serv[NI_MAXSERV];

    VncClientInfo *info;



    if (getpeername(client->csock, (struct sockaddr *)&sa, &salen) < 0) {

        return NULL;

    }



    if (getnameinfo((struct sockaddr *)&sa, salen,

                    host, sizeof(host),

                    serv, sizeof(serv),

                    NI_NUMERICHOST | NI_NUMERICSERV) < 0) {

        return NULL;

    }



    info = g_malloc0(sizeof(*info));

    info->base = g_malloc0(sizeof(*info->base));

    info->base->host = g_strdup(host);

    info->base->service = g_strdup(serv);

    info->base->family = inet_netfamily(sa.ss_family);

    info->base->websocket = client->websocket;



    if (client->tls) {

        info->x509_dname = qcrypto_tls_session_get_peer_name(client->tls);

        info->has_x509_dname = info->x509_dname != NULL;

    }

#ifdef CONFIG_VNC_SASL

    if (client->sasl.conn && client->sasl.username) {

        info->has_sasl_username = true;

        info->sasl_username = g_strdup(client->sasl.username);

    }

#endif



    return info;

}

static VncClientInfo *qmp_query_vnc_client(const VncState *client)

{

    struct sockaddr_storage sa;

    socklen_t salen = sizeof(sa);

    char host[NI_MAXHOST];

    char serv[NI_MAXSERV];

    VncClientInfo *info;



    if (getpeername(client->csock, (struct sockaddr *)&sa, &salen) < 0) {

        return NULL;

    }



    if (getnameinfo((struct sockaddr *)&sa, salen,

                    host, sizeof(host),

                    serv, sizeof(serv),

                    NI_NUMERICHOST | NI_NUMERICSERV) < 0) {

        return NULL;

    }



    info = g_malloc0(sizeof(*info));

    info->base = g_malloc0(sizeof(*info->base));

    info->base->host = g_strdup(host);

    info->base->service = g_strdup(serv);

    info->base->family = inet_netfamily(sa.ss_family);

    info->base->websocket = client->websocket;



    if (client->tls) {

        info->x509_dname = qcrypto_tls_session_get_peer_name(client->tls);

        info->has_x509_dname = info->x509_dname != NULL;

    }

#ifdef CONFIG_VNC_SASL

    if (client->sasl.conn && client->sasl.username) {

        info->has_sasl_username = true;

        info->sasl_username = g_strdup(client->sasl.username);

    }

#endif



    return info;

}

static VncClientInfo *FUNC_0(const VncState *client)

{

    struct sockaddr_storage VAR_0;

    socklen_t salen = sizeof(VAR_0);

    char VAR_1[NI_MAXHOST];

    char VAR_2[NI_MAXSERV];

    VncClientInfo *info;



    if (getpeername(client->csock, (struct sockaddr *)&VAR_0, &salen) < 0) {

        return NULL;

    }



    if (getnameinfo((struct sockaddr *)&VAR_0, salen,

                    VAR_1, sizeof(VAR_1),

                    VAR_2, sizeof(VAR_2),

                    NI_NUMERICHOST | NI_NUMERICSERV) < 0) {

        return NULL;

    }



    info = g_malloc0(sizeof(*info));

    info->base = g_malloc0(sizeof(*info->base));

    info->base->VAR_1 = g_strdup(VAR_1);

    info->base->service = g_strdup(VAR_2);

    info->base->family = inet_netfamily(VAR_0.ss_family);

    info->base->websocket = client->websocket;



    if (client->tls) {

        info->x509_dname = qcrypto_tls_session_get_peer_name(client->tls);

        info->has_x509_dname = info->x509_dname != NULL;

    }

#ifdef CONFIG_VNC_SASL

    if (client->sasl.conn && client->sasl.username) {

        info->has_sasl_username = true;

        info->sasl_username = g_strdup(client->sasl.username);

    }

#endif



    return info;

}

static VncClientInfo *FUNC_0(const VncState *client)
{ struct sockaddr_storage VAR_0; socklen_t salen = sizeof(VAR_0); char VAR_1[NI_MAXHOST]; char VAR_2[NI_MAXSERV]; VncClientInfo *info; if (getpeername(client->csock, (struct sockaddr *)&VAR_0, &salen) < 0) { return NULL; } if (getnameinfo((struct sockaddr *)&VAR_0, salen,
VAR_1, sizeof(VAR_1),
VAR_2, sizeof(VAR_2),
NI_NUMERICHOST | NI_NUMERICSERV) < 0) { return NULL; } info = g_malloc0(sizeof(*info)); info->base = g_malloc0(sizeof(*info->base)); info->base->VAR_1 = g_strdup(VAR_1); info->base->service = g_strdup(VAR_2); info->base->family = inet_netfamily(VAR_0.ss_family); info->base->websocket = client->websocket; if (client->tls) { info->x509_dname = qcrypto_tls_session_get_peer_name(client->tls); info->has_x509_dname = info->x509_dname != NULL; } #ifdef CONFIG_VNC_SASL
if (client->sasl.conn && client->sasl.username) { info->has_sasl_username = true; info->sasl_username = g_strdup(client->sasl.username); } #endif
return info; }