Statistics
| Branch: | Revision:

root / net / tap.h @ a9899996

History | View | Annotate | Download (2.3 kB)

1 a8ed73f7 Mark McLoughlin
/*
2 a8ed73f7 Mark McLoughlin
 * QEMU System Emulator
3 a8ed73f7 Mark McLoughlin
 *
4 a8ed73f7 Mark McLoughlin
 * Copyright (c) 2003-2008 Fabrice Bellard
5 a8ed73f7 Mark McLoughlin
 * Copyright (c) 2009 Red Hat, Inc.
6 a8ed73f7 Mark McLoughlin
 *
7 a8ed73f7 Mark McLoughlin
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 a8ed73f7 Mark McLoughlin
 * of this software and associated documentation files (the "Software"), to deal
9 a8ed73f7 Mark McLoughlin
 * in the Software without restriction, including without limitation the rights
10 a8ed73f7 Mark McLoughlin
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 a8ed73f7 Mark McLoughlin
 * copies of the Software, and to permit persons to whom the Software is
12 a8ed73f7 Mark McLoughlin
 * furnished to do so, subject to the following conditions:
13 a8ed73f7 Mark McLoughlin
 *
14 a8ed73f7 Mark McLoughlin
 * The above copyright notice and this permission notice shall be included in
15 a8ed73f7 Mark McLoughlin
 * all copies or substantial portions of the Software.
16 a8ed73f7 Mark McLoughlin
 *
17 a8ed73f7 Mark McLoughlin
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 a8ed73f7 Mark McLoughlin
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 a8ed73f7 Mark McLoughlin
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 a8ed73f7 Mark McLoughlin
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 a8ed73f7 Mark McLoughlin
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 a8ed73f7 Mark McLoughlin
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 a8ed73f7 Mark McLoughlin
 * THE SOFTWARE.
24 a8ed73f7 Mark McLoughlin
 */
25 a8ed73f7 Mark McLoughlin
26 a8ed73f7 Mark McLoughlin
#ifndef QEMU_NET_TAP_H
27 a8ed73f7 Mark McLoughlin
#define QEMU_NET_TAP_H
28 a8ed73f7 Mark McLoughlin
29 a8ed73f7 Mark McLoughlin
#include "qemu-common.h"
30 a8ed73f7 Mark McLoughlin
#include "qemu-option.h"
31 a8ed73f7 Mark McLoughlin
32 a8ed73f7 Mark McLoughlin
#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
33 a8ed73f7 Mark McLoughlin
#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
34 a8ed73f7 Mark McLoughlin
35 a8ed73f7 Mark McLoughlin
int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan);
36 a8ed73f7 Mark McLoughlin
37 e7e92325 Mark McLoughlin
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required);
38 e7e92325 Mark McLoughlin
39 966ea5ec Mark McLoughlin
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
40 966ea5ec Mark McLoughlin
41 a8ed73f7 Mark McLoughlin
int tap_has_ufo(VLANClientState *vc);
42 a8ed73f7 Mark McLoughlin
int tap_has_vnet_hdr(VLANClientState *vc);
43 445d892f Michael S. Tsirkin
int tap_has_vnet_hdr_len(VLANClientState *vc, int len);
44 a8ed73f7 Mark McLoughlin
void tap_using_vnet_hdr(VLANClientState *vc, int using_vnet_hdr);
45 a8ed73f7 Mark McLoughlin
void tap_set_offload(VLANClientState *vc, int csum, int tso4, int tso6, int ecn, int ufo);
46 445d892f Michael S. Tsirkin
void tap_set_vnet_hdr_len(VLANClientState *vc, int len);
47 a8ed73f7 Mark McLoughlin
48 15ac913b Mark McLoughlin
int tap_set_sndbuf(int fd, QemuOpts *opts);
49 dc69004c Mark McLoughlin
int tap_probe_vnet_hdr(int fd);
50 445d892f Michael S. Tsirkin
int tap_probe_vnet_hdr_len(int fd, int len);
51 9c282718 Mark McLoughlin
int tap_probe_has_ufo(int fd);
52 1faac1f7 Mark McLoughlin
void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
53 445d892f Michael S. Tsirkin
void tap_fd_set_vnet_hdr_len(int fd, int len);
54 15ac913b Mark McLoughlin
55 95d528a2 Michael S. Tsirkin
int tap_get_fd(VLANClientState *vc);
56 95d528a2 Michael S. Tsirkin
57 b202554c Michael S. Tsirkin
struct vhost_net;
58 b202554c Michael S. Tsirkin
struct vhost_net *tap_get_vhost_net(VLANClientState *vc);
59 b202554c Michael S. Tsirkin
60 a8ed73f7 Mark McLoughlin
#endif /* QEMU_NET_TAP_H */