void cocoa_display_init(DisplayState *ds, int full_screen);
/* vnc.c */
-void vnc_display_init(DisplayState *ds);
-void vnc_display_open(DisplayState *ds, const char *display, Error **errp);
-void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth);
-char *vnc_display_local_addr(DisplayState *ds);
+void vnc_display_init(const char *id);
+void vnc_display_open(const char *id, const char *display, Error **errp);
+void vnc_display_add_client(const char *id, int csock, bool skipauth);
+char *vnc_display_local_addr(const char *id);
#ifdef CONFIG_VNC
-int vnc_display_password(DisplayState *ds, const char *password);
-int vnc_display_pw_expire(DisplayState *ds, time_t expires);
+int vnc_display_password(const char *id, const char *password);
+int vnc_display_pw_expire(const char *id, time_t expires);
#else
-static inline int vnc_display_password(DisplayState *ds, const char *password)
+static inline int vnc_display_password(const char *id, const char *password)
{
return -ENODEV;
}
-static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires)
+static inline int vnc_display_pw_expire(const char *id, time_t expires)
{
return -ENODEV;
};
.dpy_cursor_define = vnc_dpy_cursor_define,
};
-void vnc_display_init(DisplayState *ds)
+void vnc_display_init(const char *id)
{
VncDisplay *vs = g_malloc0(sizeof(*vs));
+ vs->id = strdup(id);
QTAILQ_INSERT_TAIL(&vnc_displays, vs, next);
vs->lsock = -1;
}
-static void vnc_display_close(DisplayState *ds)
+static void vnc_display_close(VncDisplay *vs)
{
- VncDisplay *vs = vnc_display_find(NULL);
-
if (!vs)
return;
g_free(vs->display);
#endif
}
-int vnc_display_password(DisplayState *ds, const char *password)
+int vnc_display_password(const char *id, const char *password)
{
- VncDisplay *vs = vnc_display_find(NULL);
+ VncDisplay *vs = vnc_display_find(id);
if (!vs) {
return -EINVAL;
return 0;
}
-int vnc_display_pw_expire(DisplayState *ds, time_t expires)
+int vnc_display_pw_expire(const char *id, time_t expires)
{
- VncDisplay *vs = vnc_display_find(NULL);
+ VncDisplay *vs = vnc_display_find(id);
if (!vs) {
return -EINVAL;
return 0;
}
-char *vnc_display_local_addr(DisplayState *ds)
+char *vnc_display_local_addr(const char *id)
{
- VncDisplay *vs = vnc_display_find(NULL);
+ VncDisplay *vs = vnc_display_find(id);
return vnc_socket_local_addr("%s:%s", vs->lsock);
}
-void vnc_display_open(DisplayState *ds, const char *display, Error **errp)
+void vnc_display_open(const char *id, const char *display, Error **errp)
{
- VncDisplay *vs = vnc_display_find(NULL);
+ VncDisplay *vs = vnc_display_find(id);
const char *options;
int password = 0;
int reverse = 0;
error_setg(errp, "VNC display not active");
return;
}
- vnc_display_close(ds);
+ vnc_display_close(vs);
if (strcmp(display, "none") == 0)
return;
#endif /* CONFIG_VNC_WS */
}
-void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth)
+void vnc_display_add_client(const char *id, int csock, bool skipauth)
{
- VncDisplay *vs = vnc_display_find(NULL);
+ VncDisplay *vs = vnc_display_find(id);
if (!vs) {
return;
/* init remote displays */
if (vnc_display) {
Error *local_err = NULL;
- vnc_display_init(ds);
- vnc_display_open(ds, vnc_display, &local_err);
+ const char *id = "default";
+ vnc_display_init(id);
+ vnc_display_open(id, vnc_display, &local_err);
if (local_err != NULL) {
error_report("Failed to start VNC server on `%s': %s",
vnc_display, error_get_pretty(local_err));
}
if (show_vnc_port) {
- printf("VNC server running on `%s'\n", vnc_display_local_addr(ds));
+ printf("VNC server running on `%s'\n", vnc_display_local_addr(id));
}
}
#endif