char *socket_address_to_string(struct SocketAddress *addr, Error **errp)

{

    char *buf;

    InetSocketAddress *inet;

    char host_port[INET6_ADDRSTRLEN + 5 + 4];



    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

        inet = addr->u.inet.data;

        if (strchr(inet->host, ':') == NULL) {

            snprintf(host_port, sizeof(host_port), "%s:%s", inet->host,

                    inet->port);

            buf = g_strdup(host_port);

        } else {

            snprintf(host_port, sizeof(host_port), "[%s]:%s", inet->host,

                    inet->port);

            buf = g_strdup(host_port);

        }

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

        buf = g_strdup(addr->u.q_unix.data->path);

        break;



    case SOCKET_ADDRESS_KIND_FD:

        buf = g_strdup(addr->u.fd.data->str);

        break;



    case SOCKET_ADDRESS_KIND_VSOCK:

        buf = g_strdup_printf("%s:%s",

                              addr->u.vsock.data->cid,

                              addr->u.vsock.data->port);

        break;



    default:

        error_setg(errp, "socket family %d unsupported",

                   addr->type);

        return NULL;

    }

    return buf;

}

char *socket_address_to_string(struct SocketAddress *addr, Error **errp)

{

    char *buf;

    InetSocketAddress *inet;

    char host_port[INET6_ADDRSTRLEN + 5 + 4];



    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

        inet = addr->u.inet.data;

        if (strchr(inet->host, ':') == NULL) {

            snprintf(host_port, sizeof(host_port), "%s:%s", inet->host,

                    inet->port);

            buf = g_strdup(host_port);

        } else {

            snprintf(host_port, sizeof(host_port), "[%s]:%s", inet->host,

                    inet->port);

            buf = g_strdup(host_port);

        }

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

        buf = g_strdup(addr->u.q_unix.data->path);

        break;



    case SOCKET_ADDRESS_KIND_FD:

        buf = g_strdup(addr->u.fd.data->str);

        break;



    case SOCKET_ADDRESS_KIND_VSOCK:

        buf = g_strdup_printf("%s:%s",

                              addr->u.vsock.data->cid,

                              addr->u.vsock.data->port);

        break;



    default:

        error_setg(errp, "socket family %d unsupported",

                   addr->type);

        return NULL;

    }

    return buf;

}

    char host_port[INET6_ADDRSTRLEN + 5 + 4];             snprintf(host_port, sizeof(host_port), "%s:%s", inet->host,                     inet->port);             buf = g_strdup(host_port);             snprintf(host_port, sizeof(host_port), "[%s]:%s", inet->host,                     inet->port);             buf = g_strdup(host_port);
char *FUNC_0(struct SocketAddress *VAR_0, Error **VAR_1)

{

    char *VAR_2;

    InetSocketAddress *inet;

    char VAR_3[INET6_ADDRSTRLEN + 5 + 4];



    switch (VAR_0->type) {

    case SOCKET_ADDRESS_KIND_INET:

        inet = VAR_0->u.inet.data;

        if (strchr(inet->host, ':') == NULL) {

            snprintf(VAR_3, sizeof(VAR_3), "%s:%s", inet->host,

                    inet->port);

            VAR_2 = g_strdup(VAR_3);

        } else {

            snprintf(VAR_3, sizeof(VAR_3), "[%s]:%s", inet->host,

                    inet->port);

            VAR_2 = g_strdup(VAR_3);

        }

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

        VAR_2 = g_strdup(VAR_0->u.q_unix.data->path);

        break;



    case SOCKET_ADDRESS_KIND_FD:

        VAR_2 = g_strdup(VAR_0->u.fd.data->str);

        break;



    case SOCKET_ADDRESS_KIND_VSOCK:

        VAR_2 = g_strdup_printf("%s:%s",

                              VAR_0->u.vsock.data->cid,

                              VAR_0->u.vsock.data->port);

        break;



    default:

        error_setg(VAR_1, "socket family %d unsupported",

                   VAR_0->type);

        return NULL;

    }

    return VAR_2;

}

char *FUNC_0(struct SocketAddress *VAR_0, Error **VAR_1)
{ char *VAR_2; InetSocketAddress *inet; char VAR_3[INET6_ADDRSTRLEN + 5 + 4]; switch (VAR_0->type) { case SOCKET_ADDRESS_KIND_INET:
inet = VAR_0->u.inet.data; if (strchr(inet->host, ':') == NULL) { snprintf(VAR_3, sizeof(VAR_3), "%s:%s", inet->host,
inet->port); VAR_2 = g_strdup(VAR_3); } else { snprintf(VAR_3, sizeof(VAR_3), "[%s]:%s", inet->host,
inet->port); VAR_2 = g_strdup(VAR_3); } break; case SOCKET_ADDRESS_KIND_UNIX:
VAR_2 = g_strdup(VAR_0->u.q_unix.data->path); break; case SOCKET_ADDRESS_KIND_FD:
VAR_2 = g_strdup(VAR_0->u.fd.data->str); break; case SOCKET_ADDRESS_KIND_VSOCK:
VAR_2 = g_strdup_printf("%s:%s",
VAR_0->u.vsock.data->cid,
VAR_0->u.vsock.data->port); break; default:
error_setg(VAR_1, "socket family %d unsupported",
VAR_0->type); return NULL; } return VAR_2; }