root / net.h @ 1ae26a18
History | View | Annotate | Download (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 | 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 | 1ae26a18 | balrog | /* BT HCI info */
|
52 | 1ae26a18 | balrog | |
53 | 1ae26a18 | balrog | struct HCIInfo {
|
54 | 1ae26a18 | balrog | int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr); |
55 | 1ae26a18 | balrog | void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len); |
56 | 1ae26a18 | balrog | void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len); |
57 | 1ae26a18 | balrog | void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len); |
58 | 1ae26a18 | balrog | void *opaque;
|
59 | 1ae26a18 | balrog | void (*evt_recv)(void *opaque, const uint8_t *data, int len); |
60 | 1ae26a18 | balrog | void (*acl_recv)(void *opaque, const uint8_t *data, int len); |
61 | 1ae26a18 | balrog | }; |
62 | 1ae26a18 | balrog | |
63 | 1ae26a18 | balrog | struct HCIInfo *qemu_next_hci(void); |
64 | 1ae26a18 | balrog | |
65 | 48c64363 | aliguori | /* checksumming functions (net-checksum.c) */
|
66 | 48c64363 | aliguori | uint32_t net_checksum_add(int len, uint8_t *buf);
|
67 | 48c64363 | aliguori | uint16_t net_checksum_finish(uint32_t sum); |
68 | 48c64363 | aliguori | uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto, |
69 | 48c64363 | aliguori | uint8_t *addrs, uint8_t *buf); |
70 | 48c64363 | aliguori | void net_checksum_calculate(uint8_t *data, int length); |
71 | 48c64363 | aliguori | |
72 | 87ecb68b | pbrook | #endif |