Index: qemu/Makefile.target =================================================================== RCS file: /sources/qemu/qemu/Makefile.target,v retrieving revision 1.93 diff -u -r1.93 Makefile.target --- qemu/Makefile.target 6 Feb 2006 04:11:15 -0000 1.93 +++ qemu/Makefile.target 8 Mar 2006 13:19:14 -0000 @@ -275,6 +275,9 @@ ifdef CONFIG_WIN32 VL_OBJS+=tap-win32.o endif +ifdef CONFIG_TCPCTRL +VL_OBJS+=tcpctrl.o +endif SOUND_HW = sb16.o es1370.o AUDIODRV = audio.o noaudio.o wavaudio.o Index: qemu/configure =================================================================== RCS file: /sources/qemu/qemu/configure,v retrieving revision 1.83 diff -u -r1.83 configure --- qemu/configure 2 Mar 2006 21:52:18 -0000 1.83 +++ qemu/configure 8 Mar 2006 13:19:14 -0000 @@ -74,6 +74,7 @@ mingw32="no" EXESUF="" gdbstub="yes" +tcpctrl="yes" slirp="yes" adlib="no" oss="no" @@ -208,6 +209,10 @@ ;; --disable-gcc-check) check_gcc="no" ;; + --enable-tcpctrl) tcpctrl="yes" + ;; + --disable-tcpctrl) tcpctrl="no" + ;; esac done @@ -224,6 +229,7 @@ linux="no" EXESUF=".exe" gdbstub="no" + tcpctrl="no" oss="no" if [ "$cpu" = "i386" ] ; then kqemu="yes" @@ -385,6 +391,7 @@ echo " --enable-alsa enable ALSA audio driver" echo " --enable-fmod enable FMOD audio driver" echo " --enabled-dsound enable DirectSound audio driver" +echo " --disable-tcpctrl disable TCP control connections" echo " --fmod-lib path to FMOD library" echo " --fmod-inc path to FMOD includes" echo "" @@ -451,6 +458,7 @@ echo -n " (lib='$fmod_lib' include='$fmod_inc')" fi echo "" +echo "TCP control $tcpctrl" echo "kqemu support $kqemu" if test $sdl_too_old = "yes"; then @@ -545,6 +553,10 @@ echo "CONFIG_GDBSTUB=yes" >> $config_mak echo "#define CONFIG_GDBSTUB 1" >> $config_h fi +if test "$tcpctrl" = "yes" ; then + echo "CONFIG_TCPCTRL=yes" >> $config_mak + echo "#define CONFIG_TCPCTRL 1" >> $config_h +fi if test "$gprof" = "yes" ; then echo "TARGET_GPROF=yes" >> $config_mak echo "#define HAVE_GPROF 1" >> $config_h Index: qemu/monitor.c =================================================================== RCS file: /sources/qemu/qemu/monitor.c,v retrieving revision 1.46 diff -u -r1.46 monitor.c --- qemu/monitor.c 8 Feb 2006 22:40:15 -0000 1.46 +++ qemu/monitor.c 8 Mar 2006 13:19:14 -0000 @@ -296,6 +296,9 @@ static void do_quit(void) { +#ifdef CONFIG_TCPCTRL + tcpctrl_stop(); +#endif exit(0); } @@ -2026,6 +2029,30 @@ return; } +/** + * monitor_process_command: + * @output: the console used to send the output + * @cmdline: the line of the command to process + * + * Process a command coming from a different requester than the usual console. + */ + +void monitor_process_command(CharDriverState *output, const char *cmdline) +{ + CharDriverState *old_output = monitor_hd; + + if ((output == NULL) || (cmdline == NULL)) + return; + + /* + * TODO: maybe it would be cleaner to inherit the current driver + * in the calls than relying on a global variable ? + */ + monitor_hd = output; + monitor_handle_command(cmdline); + monitor_hd = old_output; +} + static void cmd_completion(const char *name, const char *list) { const char *p, *pstart; Index: qemu/vl.c =================================================================== RCS file: /sources/qemu/qemu/vl.c,v retrieving revision 1.165 diff -u -r1.165 vl.c --- qemu/vl.c 20 Feb 2006 00:33:36 -0000 1.165 +++ qemu/vl.c 8 Mar 2006 13:19:15 -0000 @@ -4550,6 +4550,9 @@ int main(int argc, char **argv) { +#ifdef CONFIG_TCPCTRL + int use_tcpctrl = 1; +#endif #ifdef CONFIG_GDBSTUB int use_gdbstub, gdbstub_port; #endif @@ -5210,6 +5213,14 @@ gui_timer = qemu_new_timer(rt_clock, gui_update, NULL); qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock)); +#ifdef CONFIG_TCPCTRL + if (use_tcpctrl) { + if (tcpctrl_start() < 0) { + fprintf(stderr, "Could not open TCP control socket\n"); + exit(1); + } + } +#endif #ifdef CONFIG_GDBSTUB if (use_gdbstub) { if (gdbserver_start(gdbstub_port) < 0) { @@ -5232,6 +5243,11 @@ } } main_loop(); +#ifdef CONFIG_TCPCTRL + if (use_tcpctrl) { + tcpctrl_stop(); + } +#endif quit_timers(); return 0; } Index: qemu/vl.h =================================================================== RCS file: /sources/qemu/qemu/vl.h,v retrieving revision 1.105 diff -u -r1.105 vl.h --- qemu/vl.h 20 Feb 2006 00:33:36 -0000 1.105 +++ qemu/vl.h 8 Mar 2006 13:19:15 -0000 @@ -991,6 +991,14 @@ void term_print_help(void); void monitor_readline(const char *prompt, int is_password, char *buf, int buf_size); +void monitor_process_command(CharDriverState *output, const char *cmdline); + +#ifdef CONFIG_TCPCTRL +/* tcpctrl.c */ +int tcpctrl_start(void); +void tcpctrl_stop(void); + +#endif /* CONFIG_TCPCTRL */ /* readline.c */ typedef void ReadLineFunc(void *opaque, const char *str);