Revision 376253ec net.c

b/net.c
23 23
 */
24 24
#include "qemu-common.h"
25 25
#include "net.h"
26
#include "console.h"
26
#include "monitor.h"
27 27
#include "sysemu.h"
28 28
#include "qemu-timer.h"
29 29
#include "qemu-char.h"
......
665 665
}
666 666

  
667 667
#endif /* !defined(_WIN32) */
668
void do_info_slirp(void)
668
void do_info_slirp(Monitor *mon)
669 669
{
670 670
    slirp_stats();
671 671
}
......
1804 1804
    return 0;
1805 1805
}
1806 1806

  
1807
void net_host_device_add(const char *device, const char *opts)
1807
void net_host_device_add(Monitor *mon, const char *device, const char *opts)
1808 1808
{
1809 1809
    if (!net_host_check_device(device)) {
1810
        term_printf("invalid host network device %s\n", device);
1810
        monitor_printf(mon, "invalid host network device %s\n", device);
1811 1811
        return;
1812 1812
    }
1813 1813
    net_client_init(device, opts);
1814 1814
}
1815 1815

  
1816
void net_host_device_remove(int vlan_id, const char *device)
1816
void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)
1817 1817
{
1818 1818
    VLANState *vlan;
1819 1819
    VLANClientState *vc;
1820 1820

  
1821 1821
    if (!net_host_check_device(device)) {
1822
        term_printf("invalid host network device %s\n", device);
1822
        monitor_printf(mon, "invalid host network device %s\n", device);
1823 1823
        return;
1824 1824
    }
1825 1825

  
1826 1826
    vlan = qemu_find_vlan(vlan_id);
1827 1827
    if (!vlan) {
1828
        term_printf("can't find vlan %d\n", vlan_id);
1828
        monitor_printf(mon, "can't find vlan %d\n", vlan_id);
1829 1829
        return;
1830 1830
    }
1831 1831

  
......
1834 1834
            break;
1835 1835

  
1836 1836
    if (!vc) {
1837
        term_printf("can't find device %s\n", device);
1837
        monitor_printf(mon, "can't find device %s\n", device);
1838 1838
        return;
1839 1839
    }
1840 1840
    qemu_del_vlan_client(vc);
......
1860 1860
    return net_client_init(device, p);
1861 1861
}
1862 1862

  
1863
void do_info_network(void)
1863
void do_info_network(Monitor *mon)
1864 1864
{
1865 1865
    VLANState *vlan;
1866 1866
    VLANClientState *vc;
1867 1867

  
1868 1868
    for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
1869
        term_printf("VLAN %d devices:\n", vlan->id);
1869
        monitor_printf(mon, "VLAN %d devices:\n", vlan->id);
1870 1870
        for(vc = vlan->first_client; vc != NULL; vc = vc->next)
1871
            term_printf("  %s: %s\n", vc->name, vc->info_str);
1871
            monitor_printf(mon, "  %s: %s\n", vc->name, vc->info_str);
1872 1872
    }
1873 1873
}
1874 1874

  
1875
int do_set_link(const char *name, const char *up_or_down)
1875
int do_set_link(Monitor *mon, const char *name, const char *up_or_down)
1876 1876
{
1877 1877
    VLANState *vlan;
1878 1878
    VLANClientState *vc = NULL;
......
1884 1884
done:
1885 1885

  
1886 1886
    if (!vc) {
1887
        term_printf("could not find network device '%s'", name);
1887
        monitor_printf(mon, "could not find network device '%s'", name);
1888 1888
        return 0;
1889 1889
    }
1890 1890

  
......
1893 1893
    else if (strcmp(up_or_down, "down") == 0)
1894 1894
        vc->link_down = 1;
1895 1895
    else
1896
        term_printf("invalid link status '%s'; only 'up' or 'down' valid\n",
1897
                    up_or_down);
1896
        monitor_printf(mon, "invalid link status '%s'; only 'up' or 'down' "
1897
                       "valid\n", up_or_down);
1898 1898

  
1899 1899
    if (vc->link_status_changed)
1900 1900
        vc->link_status_changed(vc);

Also available in: Unified diff