]> git.proxmox.com Git - mirror_qemu.git/blame - net.h
gdbstub: Return appropriate watch message to gdb (Jan Kiszka)
[mirror_qemu.git] / net.h
CommitLineData
87ecb68b
PB
1#ifndef QEMU_NET_H
2#define QEMU_NET_H
3
4/* VLANs support */
5
6typedef struct VLANClientState VLANClientState;
7
8struct VLANClientState {
9 IOReadHandler *fd_read;
10 /* Packets may still be sent if this returns zero. It's used to
11 rate-limit the slirp code. */
12 IOCanRWHandler *fd_can_read;
13 void *opaque;
14 struct VLANClientState *next;
15 struct VLANState *vlan;
16 char info_str[256];
17};
18
19struct VLANState {
20 int id;
21 VLANClientState *first_client;
22 struct VLANState *next;
23 unsigned int nb_guest_devs, nb_host_devs;
24};
25
26VLANState *qemu_find_vlan(int id);
27VLANClientState *qemu_new_vlan_client(VLANState *vlan,
28 IOReadHandler *fd_read,
29 IOCanRWHandler *fd_can_read,
30 void *opaque);
dcf414d6 31void qemu_del_vlan_client(VLANClientState *vc);
87ecb68b
PB
32int qemu_can_send_packet(VLANClientState *vc);
33void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
34void qemu_handler_true(void *opaque);
35
36void do_info_network(void);
37
38/* NIC info */
39
40#define MAX_NICS 8
41
42struct NICInfo {
43 uint8_t macaddr[6];
44 const char *model;
45 VLANState *vlan;
46};
47
48extern int nb_nics;
49extern NICInfo nd_table[MAX_NICS];
50
1ae26a18
AZ
51/* BT HCI info */
52
53struct HCIInfo {
54 int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr);
55 void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len);
56 void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len);
57 void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len);
58 void *opaque;
59 void (*evt_recv)(void *opaque, const uint8_t *data, int len);
60 void (*acl_recv)(void *opaque, const uint8_t *data, int len);
61};
62
63struct HCIInfo *qemu_next_hci(void);
64
48c64363
AL
65/* checksumming functions (net-checksum.c) */
66uint32_t net_checksum_add(int len, uint8_t *buf);
67uint16_t net_checksum_finish(uint32_t sum);
68uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
69 uint8_t *addrs, uint8_t *buf);
70void net_checksum_calculate(uint8_t *data, int length);
71
63a01ef8
AL
72/* from net.c */
73int net_client_init(const char *device, const char *p);
74int net_client_parse(const char *str);
75void net_slirp_smb(const char *exported_dir);
76void net_slirp_redir(const char *redir_str);
77void net_cleanup(void);
78int slirp_is_inited(void);
79void net_client_check(void);
80
87ecb68b 81#endif