Add an info vnc monitor command
PATCH 1/1 Add an info vnc monitor command
The following patch adds an info vnc monitor command. When writing a front-end, it's useful to be able to determine 1) if a client is current connected to the VNC server and 2) what the VNC server is actually listening on.
Regards,
Anthony Liguori
monitor.c +2 -0
@@ -1297,6 +1297,8 @@ static term_cmd_t info_cmds[] = { "", "show the currently saved VM snapshots" }, {"mice" ,"" , do_info_mice, "", "show which guest mouse is receiving events" }, + { "vnc", "", do_info_vnc, + "", "show the vnc server status"}, { NULL, NULL, }, };
vl.h +1 -0
@@ -897,6 +897,7 @@ void cocoa_display_init(DisplayState *ds/* vnc.c */ void vnc_display_init (DisplayState *ds,const char *display); +void do_info_vnc (void );/* ide.c */ #define MAX_DISKS 4
vnc.c +22 -0
@@ -73,6 +73,8 @@ struct VncStateint last_x;int last_y; +const char *display; +Buffer output;Buffer input;kbd_layout_t *kbd_layout;
@@ -89,6 +91,24 @@ struct VncState/* input */ uint8_t modifiers_state[256 ]; }; + +static VncState *vnc_state;/* needed for info vnc */ + +void do_info_vnc (void ) +{ +if (vnc_state ==NULL ) +term_printf ("VNC server disabled\n" ); +else { +term_printf ("VNC server active on: " ); +term_print_filename (vnc_state->display); +term_printf ("\n" ); + +if (vnc_state->csock ==-1 ) +term_printf ("No client connected\n" ); +else +term_printf ("Client connected\n" ); + } +}/* TODO 1) Get the queue working for IO.
@@ -1150,6 +1170,8 @@ void vnc_display_init(DisplayState *ds,exit (1 ); ds->opaque = vs; + vnc_state = vs; + vs->display = arg; vs->lsock =-1 ; vs->csock =-1 ;