Statistics
| Branch: | Revision:

root / net.h @ 8c5e95d8

History | View | Annotate | Download (1.2 kB)

1 87ecb68b pbrook
#ifndef QEMU_NET_H
2 87ecb68b pbrook
#define QEMU_NET_H
3 87ecb68b pbrook
4 87ecb68b pbrook
/* VLANs support */
5 87ecb68b pbrook
6 87ecb68b pbrook
typedef struct VLANClientState VLANClientState;
7 87ecb68b pbrook
8 87ecb68b pbrook
struct VLANClientState {
9 87ecb68b pbrook
    IOReadHandler *fd_read;
10 87ecb68b pbrook
    /* Packets may still be sent if this returns zero.  It's used to
11 87ecb68b pbrook
       rate-limit the slirp code.  */
12 87ecb68b pbrook
    IOCanRWHandler *fd_can_read;
13 87ecb68b pbrook
    void *opaque;
14 87ecb68b pbrook
    struct VLANClientState *next;
15 87ecb68b pbrook
    struct VLANState *vlan;
16 87ecb68b pbrook
    char info_str[256];
17 87ecb68b pbrook
};
18 87ecb68b pbrook
19 87ecb68b pbrook
struct VLANState {
20 87ecb68b pbrook
    int id;
21 87ecb68b pbrook
    VLANClientState *first_client;
22 87ecb68b pbrook
    struct VLANState *next;
23 87ecb68b pbrook
    unsigned int nb_guest_devs, nb_host_devs;
24 87ecb68b pbrook
};
25 87ecb68b pbrook
26 87ecb68b pbrook
VLANState *qemu_find_vlan(int id);
27 87ecb68b pbrook
VLANClientState *qemu_new_vlan_client(VLANState *vlan,
28 87ecb68b pbrook
                                      IOReadHandler *fd_read,
29 87ecb68b pbrook
                                      IOCanRWHandler *fd_can_read,
30 87ecb68b pbrook
                                      void *opaque);
31 87ecb68b pbrook
int qemu_can_send_packet(VLANClientState *vc);
32 87ecb68b pbrook
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
33 87ecb68b pbrook
void qemu_handler_true(void *opaque);
34 87ecb68b pbrook
35 87ecb68b pbrook
void do_info_network(void);
36 87ecb68b pbrook
37 87ecb68b pbrook
/* NIC info */
38 87ecb68b pbrook
39 87ecb68b pbrook
#define MAX_NICS 8
40 87ecb68b pbrook
41 87ecb68b pbrook
struct NICInfo {
42 87ecb68b pbrook
    uint8_t macaddr[6];
43 87ecb68b pbrook
    const char *model;
44 87ecb68b pbrook
    VLANState *vlan;
45 87ecb68b pbrook
};
46 87ecb68b pbrook
47 87ecb68b pbrook
extern int nb_nics;
48 87ecb68b pbrook
extern NICInfo nd_table[MAX_NICS];
49 87ecb68b pbrook
50 87ecb68b pbrook
#endif