root / net.h @ ed23fbd9
History | View | Annotate | Download (1.5 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 | dcf414d6 | balrog | void qemu_del_vlan_client(VLANClientState *vc);
|
32 | 87ecb68b | pbrook | int qemu_can_send_packet(VLANClientState *vc);
|
33 | 87ecb68b | pbrook | void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size); |
34 | 87ecb68b | pbrook | void qemu_handler_true(void *opaque); |
35 | 87ecb68b | pbrook | |
36 | 87ecb68b | pbrook | void do_info_network(void); |
37 | 87ecb68b | pbrook | |
38 | 87ecb68b | pbrook | /* NIC info */
|
39 | 87ecb68b | pbrook | |
40 | 87ecb68b | pbrook | #define MAX_NICS 8 |
41 | 87ecb68b | pbrook | |
42 | 87ecb68b | pbrook | struct NICInfo {
|
43 | 87ecb68b | pbrook | uint8_t macaddr[6];
|
44 | 87ecb68b | pbrook | const char *model; |
45 | 87ecb68b | pbrook | VLANState *vlan; |
46 | 87ecb68b | pbrook | }; |
47 | 87ecb68b | pbrook | |
48 | 87ecb68b | pbrook | extern int nb_nics; |
49 | 87ecb68b | pbrook | extern NICInfo nd_table[MAX_NICS];
|
50 | 87ecb68b | pbrook | |
51 | 48c64363 | aliguori | /* checksumming functions (net-checksum.c) */
|
52 | 48c64363 | aliguori | uint32_t net_checksum_add(int len, uint8_t *buf);
|
53 | 48c64363 | aliguori | uint16_t net_checksum_finish(uint32_t sum); |
54 | 48c64363 | aliguori | uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto, |
55 | 48c64363 | aliguori | uint8_t *addrs, uint8_t *buf); |
56 | 48c64363 | aliguori | void net_checksum_calculate(uint8_t *data, int length); |
57 | 48c64363 | aliguori | |
58 | 87ecb68b | pbrook | #endif |