slirp: replace remaining qemu headers dependency

Except for the migration code which is gated by WITH_QEMU, only
include our own headers, so libslirp can be built standalone.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Marc-André Lureau 2019-01-17 15:43:52 +04:00 committed by Samuel Thibault
parent 4ffa6325d1
commit a9d8b3ec43
28 changed files with 28 additions and 33 deletions

View File

@ -22,9 +22,10 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include <string.h>
void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]) void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN])
{ {
const uint32_t broadcast_addr = const uint32_t broadcast_addr =

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#if defined(_WIN32) #if defined(_WIN32)

View File

@ -30,7 +30,6 @@
* in_cksum.c,v 1.2 1994/08/02 07:48:16 davidg Exp * in_cksum.c,v 1.2 1994/08/02 07:48:16 davidg Exp
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
/* /*

View File

@ -20,7 +20,6 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>. * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "dhcpv6.h" #include "dhcpv6.h"

View File

@ -22,7 +22,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
static const uint8_t RFC3397_OPT_DOMAIN_SEARCH = 119; static const uint8_t RFC3397_OPT_DOMAIN_SEARCH = 119;

View File

@ -5,7 +5,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
static void static void

View File

@ -7,6 +7,7 @@
#define SLIRP_IP6_H #define SLIRP_IP6_H
#include <glib.h> #include <glib.h>
#include <string.h>
#define ALLNODES_MULTICAST { .s6_addr = \ #define ALLNODES_MULTICAST { .s6_addr = \
{ 0xff, 0x02, 0x00, 0x00,\ { 0xff, 0x02, 0x00, 0x00,\

View File

@ -3,7 +3,6 @@
* Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ip6_icmp.h" #include "ip6_icmp.h"

View File

@ -3,7 +3,6 @@
* Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ip6_icmp.h" #include "ip6_icmp.h"

View File

@ -3,8 +3,6 @@
* Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
*/ */
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "slirp.h" #include "slirp.h"
/* Number of packets queued before we start sending /* Number of packets queued before we start sending

View File

@ -30,7 +30,6 @@
* ip_icmp.c,v 1.7 1995/05/30 08:09:42 rgrimes Exp * ip_icmp.c,v 1.7 1995/05/30 08:09:42 rgrimes Exp
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ip_icmp.h" #include "ip_icmp.h"

View File

@ -38,7 +38,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ip_icmp.h" #include "ip_icmp.h"

View File

@ -38,7 +38,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
/* Number of packets queued before we start sending /* Number of packets queued before we start sending

View File

@ -15,7 +15,6 @@
* the flags * the flags
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#define MBUF_THRESH 30 #define MBUF_THRESH 30

View File

@ -5,9 +5,7 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "libslirp.h"
inline void inline void
insque(void *a, void *b) insque(void *a, void *b)

View File

@ -6,7 +6,6 @@
* This code is licensed under the GPL version 2 or later. See the * This code is licensed under the GPL version 2 or later. See the
* COPYING file in the top-level directory. * COPYING file in the top-level directory.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ncsi-pkt.h" #include "ncsi-pkt.h"

View File

@ -3,8 +3,6 @@
* Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
*/ */
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "slirp.h" #include "slirp.h"
void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr,

View File

@ -5,7 +5,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
static void sbappendsb(struct sbuf *sb, struct mbuf *m); static void sbappendsb(struct sbuf *sb, struct mbuf *m);

View File

@ -21,8 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "slirp.h" #include "slirp.h"
#ifdef WITH_QEMU #ifdef WITH_QEMU

View File

@ -5,8 +5,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "slirp.h" #include "slirp.h"
#include "ip_icmp.h" #include "ip_icmp.h"
#ifdef __sun__ #ifdef __sun__

View File

@ -38,7 +38,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ip_icmp.h" #include "ip_icmp.h"

View File

@ -38,7 +38,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
static const u_char tcp_outflags[TCP_NSTATES] = { static const u_char tcp_outflags[TCP_NSTATES] = {

View File

@ -38,7 +38,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
/* patchable/settable parameters for tcp */ /* patchable/settable parameters for tcp */

View File

@ -30,7 +30,6 @@
* tcp_timer.c,v 1.2 1994/08/02 07:49:10 davidg Exp * tcp_timer.c,v 1.2 1994/08/02 07:49:10 davidg Exp
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
static struct tcpcb *tcp_timers(register struct tcpcb *tp, int timer); static struct tcpcb *tcp_timers(register struct tcpcb *tp, int timer);

View File

@ -22,9 +22,11 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "qemu-common.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static inline int tftp_session_in_use(struct tftp_session *spt) static inline int tftp_session_in_use(struct tftp_session *spt)
{ {

View File

@ -38,7 +38,6 @@
* terms and conditions of the copyright. * terms and conditions of the copyright.
*/ */
#include "qemu/osdep.h"
#include "slirp.h" #include "slirp.h"
#include "ip_icmp.h" #include "ip_icmp.h"

View File

@ -3,8 +3,6 @@
* Guillaume Subiron * Guillaume Subiron
*/ */
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "slirp.h" #include "slirp.h"
#include "udp.h" #include "udp.h"
#include "dhcpv6.h" #include "dhcpv6.h"

View File

@ -48,6 +48,27 @@
# define SLIRP_PACKED __attribute__((packed)) # define SLIRP_PACKED __attribute__((packed))
#endif #endif
#ifndef DIV_ROUND_UP
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#endif
#ifndef container_of
#define container_of(ptr, type, member) __extension__ ({ \
void *__mptr = (void *)(ptr); \
((type *)(__mptr - offsetof(type, member))); })
#endif
#if defined(_WIN32) /* CONFIG_IOVEC */
# if !defined(IOV_MAX) /* XXX: to avoid duplicate with QEMU osdep.h */
struct iovec {
void *iov_base;
size_t iov_len;
};
# endif
#else
#include <sys/uio.h>
#endif
#define SCALE_MS 1000000 #define SCALE_MS 1000000
#define ETH_ALEN 6 #define ETH_ALEN 6