aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-10-24 08:43:34 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-19 08:31:29 +0100
commit1422e32db51ff2b1194fb24a6201c4310be5667d (patch)
tree56f9911d524eca4194573a6037303a169e61db50 /net
parentfd9400b302ef582c3ae8a8d5288338ea5f0f4c9a (diff)
net: reorganize headers
Move public headers to include/net, and leave private headers in net/. Put the virtio headers in include/net/tap.h, removing the multiple copies that existed. Leave include/net/tap.h as the interface for NICs, and net/tap_int.h as the interface for OS-specific parts of the tap backend. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/checksum.h29
-rw-r--r--net/clients.h2
-rw-r--r--net/hub.c2
-rw-r--r--net/hub.h2
-rw-r--r--net/net.c4
-rw-r--r--net/queue.c2
-rw-r--r--net/queue.h58
-rw-r--r--net/slirp.c2
-rw-r--r--net/slirp.h47
-rw-r--r--net/socket.c2
-rw-r--r--net/tap-aix.c2
-rw-r--r--net/tap-bsd.c2
-rw-r--r--net/tap-haiku.c2
-rw-r--r--net/tap-linux.c3
-rw-r--r--net/tap-linux.h20
-rw-r--r--net/tap-solaris.c2
-rw-r--r--net/tap-win32.c4
-rw-r--r--net/tap.c6
-rw-r--r--net/tap_int.h (renamed from net/tap.h)18
-rw-r--r--net/util.c2
-rw-r--r--net/vde.c2
21 files changed, 25 insertions, 188 deletions
diff --git a/net/checksum.h b/net/checksum.h
deleted file mode 100644
index 1f052986e6..0000000000
--- a/net/checksum.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * IP checksumming functions.
- * (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef QEMU_NET_CHECKSUM_H
-#define QEMU_NET_CHECKSUM_H
-
-#include <stdint.h>
-
-uint32_t net_checksum_add(int len, uint8_t *buf);
-uint16_t net_checksum_finish(uint32_t sum);
-uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
- uint8_t *addrs, uint8_t *buf);
-void net_checksum_calculate(uint8_t *data, int length);
-
-#endif /* QEMU_NET_CHECKSUM_H */
diff --git a/net/clients.h b/net/clients.h
index c58cc6087c..77932942bd 100644
--- a/net/clients.h
+++ b/net/clients.h
@@ -24,7 +24,7 @@
#ifndef QEMU_NET_CLIENTS_H
#define QEMU_NET_CLIENTS_H
-#include "net.h"
+#include "net/net.h"
#include "qapi-types.h"
int net_init_dump(const NetClientOptions *opts, const char *name,
diff --git a/net/hub.c b/net/hub.c
index be413012bb..8508ecf380 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -13,7 +13,7 @@
*/
#include "monitor.h"
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "hub.h"
#include "iov.h"
diff --git a/net/hub.h b/net/hub.h
index 4cbfdb128b..583ada89d8 100644
--- a/net/hub.h
+++ b/net/hub.h
@@ -20,8 +20,6 @@
NetClientState *net_hub_add_port(int hub_id, const char *name);
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
void net_hub_info(Monitor *mon);
-int net_hub_id_for_client(NetClientState *nc, int *id);
void net_hub_check_clients(void);
-NetClientState *net_hub_port_find(int hub_id);
#endif /* NET_HUB_H */
diff --git a/net/net.c b/net/net.c
index 7b1600f17c..a4395be140 100644
--- a/net/net.c
+++ b/net/net.c
@@ -23,10 +23,10 @@
*/
#include "config-host.h"
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "hub.h"
-#include "slirp.h"
+#include "net/slirp.h"
#include "util.h"
#include "monitor.h"
diff --git a/net/queue.c b/net/queue.c
index 254f28013a..542c549b1a 100644
--- a/net/queue.c
+++ b/net/queue.c
@@ -23,7 +23,7 @@
#include "net/queue.h"
#include "qemu-queue.h"
-#include "net.h"
+#include "net/net.h"
/* The delivery handler may only return zero if it will call
* qemu_net_queue_flush() when it determines that it is once again able
diff --git a/net/queue.h b/net/queue.h
deleted file mode 100644
index fc02b33915..0000000000
--- a/net/queue.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2003-2008 Fabrice Bellard
- * Copyright (c) 2009 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef QEMU_NET_QUEUE_H
-#define QEMU_NET_QUEUE_H
-
-#include "qemu-common.h"
-
-typedef struct NetPacket NetPacket;
-typedef struct NetQueue NetQueue;
-
-typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret);
-
-#define QEMU_NET_PACKET_FLAG_NONE 0
-#define QEMU_NET_PACKET_FLAG_RAW (1<<0)
-
-NetQueue *qemu_new_net_queue(void *opaque);
-
-void qemu_del_net_queue(NetQueue *queue);
-
-ssize_t qemu_net_queue_send(NetQueue *queue,
- NetClientState *sender,
- unsigned flags,
- const uint8_t *data,
- size_t size,
- NetPacketSent *sent_cb);
-
-ssize_t qemu_net_queue_send_iov(NetQueue *queue,
- NetClientState *sender,
- unsigned flags,
- const struct iovec *iov,
- int iovcnt,
- NetPacketSent *sent_cb);
-
-void qemu_net_queue_purge(NetQueue *queue, NetClientState *from);
-bool qemu_net_queue_flush(NetQueue *queue);
-
-#endif /* QEMU_NET_QUEUE_H */
diff --git a/net/slirp.c b/net/slirp.c
index f117412bad..5a11ac5859 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -29,7 +29,7 @@
#include <pwd.h>
#include <sys/wait.h>
#endif
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "hub.h"
#include "monitor.h"
diff --git a/net/slirp.h b/net/slirp.h
deleted file mode 100644
index 2ca09b65b7..0000000000
--- a/net/slirp.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef QEMU_NET_SLIRP_H
-#define QEMU_NET_SLIRP_H
-
-#include "qemu-common.h"
-#include "qdict.h"
-#include "qemu-option.h"
-#include "qapi-types.h"
-
-#ifdef CONFIG_SLIRP
-
-void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
-void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
-
-int net_slirp_redir(const char *redir_str);
-
-int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret);
-
-int net_slirp_smb(const char *exported_dir);
-
-void do_info_usernet(Monitor *mon);
-
-#endif
-
-#endif /* QEMU_NET_SLIRP_H */
diff --git a/net/socket.c b/net/socket.c
index cf309cd5b9..8430f1a161 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -23,7 +23,7 @@
*/
#include "config-host.h"
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "monitor.h"
#include "qemu-common.h"
diff --git a/net/tap-aix.c b/net/tap-aix.c
index f27c17729e..aff6c527e9 100644
--- a/net/tap-aix.c
+++ b/net/tap-aix.c
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include <stdio.h>
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index a3b717dd1c..a1c55ad3de 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include "qemu-common.h"
#include "sysemu.h"
#include "qemu-error.h"
diff --git a/net/tap-haiku.c b/net/tap-haiku.c
index 34739d1562..08cc034cee 100644
--- a/net/tap-haiku.c
+++ b/net/tap-haiku.c
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include <stdio.h>
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
diff --git a/net/tap-linux.c b/net/tap-linux.c
index 3eaedc40ad..3de7b3b6ce 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -23,8 +23,9 @@
* THE SOFTWARE.
*/
+#include "tap_int.h"
+#include "tap-linux.h"
#include "net/tap.h"
-#include "net/tap-linux.h"
#include <net/if.h>
#include <sys/ioctl.h>
diff --git a/net/tap-linux.h b/net/tap-linux.h
index 659e98122b..cb2a6d480a 100644
--- a/net/tap-linux.h
+++ b/net/tap-linux.h
@@ -13,8 +13,8 @@
* GNU General Public License for more details.
*/
-#ifndef QEMU_TAP_H
-#define QEMU_TAP_H
+#ifndef QEMU_TAP_LINUX_H
+#define QEMU_TAP_LINUX_H
#include <stdint.h>
#ifdef __linux__
@@ -44,20 +44,4 @@
#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
#define TUN_F_UFO 0x10 /* I can handle UFO packets */
-struct virtio_net_hdr
-{
- uint8_t flags;
- uint8_t gso_type;
- uint16_t hdr_len;
- uint16_t gso_size;
- uint16_t csum_start;
- uint16_t csum_offset;
-};
-
-struct virtio_net_hdr_mrg_rxbuf
-{
- struct virtio_net_hdr hdr;
- uint16_t num_buffers; /* Number of merged rx buffers */
-};
-
#endif /* QEMU_TAP_H */
diff --git a/net/tap-solaris.c b/net/tap-solaris.c
index 5d6ac42f24..f228fffb6d 100644
--- a/net/tap-solaris.c
+++ b/net/tap-solaris.c
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include "sysemu.h"
#include <sys/stat.h>
diff --git a/net/tap-win32.c b/net/tap-win32.c
index f9bd74109c..e37d8ee458 100644
--- a/net/tap-win32.c
+++ b/net/tap-win32.c
@@ -26,11 +26,11 @@
* distribution); if not, see <http://www.gnu.org/licenses/>.
*/
-#include "tap.h"
+#include "tap_int.h"
#include "qemu-common.h"
#include "clients.h" /* net_init_tap */
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "qemu-error.h"
#include <stdio.h>
diff --git a/net/tap.c b/net/tap.c
index 5ff78934dc..f8cabc4f86 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
-#include "tap.h"
+#include "tap_int.h"
#include "config-host.h"
@@ -33,14 +33,14 @@
#include <sys/socket.h>
#include <net/if.h>
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "monitor.h"
#include "sysemu.h"
#include "qemu-common.h"
#include "qemu-error.h"
-#include "net/tap-linux.h"
+#include "net/tap.h"
#include "hw/vhost_net.h"
diff --git a/net/tap.h b/net/tap_int.h
index d44d83ae73..1dffe12a45 100644
--- a/net/tap.h
+++ b/net/tap_int.h
@@ -23,8 +23,8 @@
* THE SOFTWARE.
*/
-#ifndef QEMU_NET_TAP_H
-#define QEMU_NET_TAP_H
+#ifndef QEMU_TAP_H
+#define QEMU_TAP_H
#include "qemu-common.h"
#include "qapi-types.h"
@@ -36,13 +36,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
-int tap_has_ufo(NetClientState *nc);
-int tap_has_vnet_hdr(NetClientState *nc);
-int tap_has_vnet_hdr_len(NetClientState *nc, int len);
-void tap_using_vnet_hdr(NetClientState *nc, int using_vnet_hdr);
-void tap_set_offload(NetClientState *nc, int csum, int tso4, int tso6, int ecn, int ufo);
-void tap_set_vnet_hdr_len(NetClientState *nc, int len);
-
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
int tap_probe_vnet_hdr(int fd);
int tap_probe_vnet_hdr_len(int fd, int len);
@@ -50,9 +43,4 @@ int tap_probe_has_ufo(int fd);
void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
void tap_fd_set_vnet_hdr_len(int fd, int len);
-int tap_get_fd(NetClientState *nc);
-
-struct vhost_net;
-struct vhost_net *tap_get_vhost_net(NetClientState *nc);
-
-#endif /* QEMU_NET_TAP_H */
+#endif /* QEMU_TAP_H */
diff --git a/net/util.c b/net/util.c
index 1e9afbc1ae..7e9507679d 100644
--- a/net/util.c
+++ b/net/util.c
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
-#include "net/util.h"
+#include "util.h"
#include <errno.h>
#include <stdlib.h>
diff --git a/net/vde.c b/net/vde.c
index cc5a07d65e..52d4f19fba 100644
--- a/net/vde.c
+++ b/net/vde.c
@@ -25,7 +25,7 @@
#include <libvdeplug.h>
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "qemu-common.h"
#include "qemu-option.h"