~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to net.h

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
/* VLANs support */
7
7
 
8
 
typedef ssize_t (IOReadvHandler)(void *, const struct iovec *, int);
9
 
 
10
8
typedef struct VLANClientState VLANClientState;
11
9
 
 
10
typedef int (NetCanReceive)(VLANClientState *);
 
11
typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t);
 
12
typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int);
12
13
typedef void (NetCleanup) (VLANClientState *);
13
14
typedef void (LinkStatusChanged)(VLANClientState *);
14
15
 
15
16
struct VLANClientState {
16
 
    IOReadHandler *fd_read;
17
 
    IOReadvHandler *fd_readv;
 
17
    NetReceive *receive;
 
18
    NetReceiveIOV *receive_iov;
18
19
    /* Packets may still be sent if this returns zero.  It's used to
19
20
       rate-limit the slirp code.  */
20
 
    IOCanRWHandler *fd_can_read;
 
21
    NetCanReceive *can_receive;
21
22
    NetCleanup *cleanup;
22
23
    LinkStatusChanged *link_status_changed;
23
24
    int link_down;
29
30
    char info_str[256];
30
31
};
31
32
 
 
33
typedef struct VLANPacket VLANPacket;
 
34
 
 
35
typedef void (NetPacketSent) (VLANClientState *, ssize_t);
 
36
 
 
37
struct VLANPacket {
 
38
    struct VLANPacket *next;
 
39
    VLANClientState *sender;
 
40
    int size;
 
41
    NetPacketSent *sent_cb;
 
42
    uint8_t data[0];
 
43
};
 
44
 
32
45
struct VLANState {
33
46
    int id;
34
47
    VLANClientState *first_client;
35
48
    struct VLANState *next;
36
49
    unsigned int nb_guest_devs, nb_host_devs;
 
50
    VLANPacket *send_queue;
 
51
    int delivering;
37
52
};
38
53
 
39
 
VLANState *qemu_find_vlan(int id);
 
54
VLANState *qemu_find_vlan(int id, int allocate);
40
55
VLANClientState *qemu_new_vlan_client(VLANState *vlan,
41
56
                                      const char *model,
42
57
                                      const char *name,
43
 
                                      IOReadHandler *fd_read,
44
 
                                      IOCanRWHandler *fd_can_read,
 
58
                                      NetCanReceive *can_receive,
 
59
                                      NetReceive *receive,
 
60
                                      NetReceiveIOV *receive_iov,
45
61
                                      NetCleanup *cleanup,
46
62
                                      void *opaque);
47
63
void qemu_del_vlan_client(VLANClientState *vc);
49
65
int qemu_can_send_packet(VLANClientState *vc);
50
66
ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
51
67
                          int iovcnt);
 
68
ssize_t qemu_sendv_packet_async(VLANClientState *vc, const struct iovec *iov,
 
69
                                int iovcnt, NetPacketSent *sent_cb);
52
70
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
 
71
ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf,
 
72
                               int size, NetPacketSent *sent_cb);
 
73
void qemu_purge_queued_packets(VLANClientState *vc);
 
74
void qemu_flush_queued_packets(VLANClientState *vc);
53
75
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
54
76
void qemu_check_nic_model(NICInfo *nd, const char *model);
55
77
void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
56
78
                               const char *default_model);
57
79
void qemu_handler_true(void *opaque);
58
80
 
59
 
void do_info_network(void);
60
 
int do_set_link(const char *name, const char *up_or_down);
 
81
void do_info_network(Monitor *mon);
 
82
int do_set_link(Monitor *mon, const char *name, const char *up_or_down);
 
83
 
 
84
void do_info_usernet(Monitor *mon);
61
85
 
62
86
/* NIC info */
63
87
 
64
88
#define MAX_NICS 8
 
89
enum {
 
90
        NIC_NVECTORS_UNSPECIFIED = -1
 
91
};
65
92
 
66
93
struct NICInfo {
67
94
    uint8_t macaddr[6];
68
95
    const char *model;
69
96
    const char *name;
 
97
    const char *devaddr;
 
98
    const char *id;
70
99
    VLANState *vlan;
 
100
    VLANClientState *vc;
71
101
    void *private;
72
102
    int used;
 
103
    int bootable;
 
104
    int nvectors;
73
105
};
74
106
 
75
107
extern int nb_nics;
97
129
void net_checksum_calculate(uint8_t *data, int length);
98
130
 
99
131
/* from net.c */
100
 
int net_client_init(const char *device, const char *p);
 
132
extern const char *legacy_tftp_prefix;
 
133
extern const char *legacy_bootp_filename;
 
134
 
 
135
int net_client_init(Monitor *mon, const char *device, const char *p);
101
136
void net_client_uninit(NICInfo *nd);
102
137
int net_client_parse(const char *str);
103
138
void net_slirp_smb(const char *exported_dir);
 
139
void net_slirp_hostfwd_add(Monitor *mon, const char *arg1,
 
140
                           const char *arg2, const char *arg3);
 
141
void net_slirp_hostfwd_remove(Monitor *mon, const char *arg1,
 
142
                              const char *arg2, const char *arg3);
104
143
void net_slirp_redir(const char *redir_str);
105
144
void net_cleanup(void);
106
 
int slirp_is_inited(void);
107
145
void net_client_check(void);
108
 
void net_host_device_add(const char *device, const char *opts);
109
 
void net_host_device_remove(int vlan_id, const char *device);
 
146
void net_set_boot_mask(int boot_mask);
 
147
void net_host_device_add(Monitor *mon, const char *device, const char *opts);
 
148
void net_host_device_remove(Monitor *mon, int vlan_id, const char *device);
110
149
 
111
150
#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
112
151
#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
116
155
#define SMBD_COMMAND "/usr/sbin/smbd"
117
156
#endif
118
157
 
 
158
void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr);
 
159
VLANClientState *qdev_get_vlan_client(DeviceState *dev,
 
160
                                      NetCanReceive *can_receive,
 
161
                                      NetReceive *receive,
 
162
                                      NetReceiveIOV *receive_iov,
 
163
                                      NetCleanup *cleanup,
 
164
                                      void *opaque);
 
165
 
119
166
#endif