diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-11-14 16:36:07 +0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-01-14 00:40:54 +0100 |
commit | d846b927a613afbee7bd30756d1c8384085cfc64 (patch) | |
tree | c49b20e0f89bebf3097526e3ef76d120194f6d9c /slirp/slirp.c | |
parent | cf2b315265d416cdef1c06120957dc48c098d550 (diff) |
slirp: use a callback structure to interface with qemu
This will bring slirp a bit forward to the state of an independent
project.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/slirp.c')
-rw-r--r-- | slirp/slirp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c index 1627436e7d..bab49e83e3 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -288,14 +288,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, const char *vdomainname, - slirp_output output, + const SlirpCb *callbacks, void *opaque) { Slirp *slirp = g_malloc0(sizeof(Slirp)); slirp_init_once(); - slirp->output = output; + slirp->cb = callbacks; slirp->grand = g_rand_new(); slirp->restricted = restricted; @@ -843,7 +843,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) rah->ar_sip = ah->ar_tip; memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); rah->ar_tip = ah->ar_sip; - slirp->output(slirp->opaque, arp_reply, sizeof(arp_reply)); + slirp->cb->output(slirp->opaque, arp_reply, sizeof(arp_reply)); } break; case ARPOP_REPLY: @@ -943,7 +943,7 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, /* target IP */ rah->ar_tip = iph->ip_dst.s_addr; slirp->client_ipaddr = iph->ip_dst; - slirp->output(slirp->opaque, arp_req, sizeof(arp_req)); + slirp->cb->output(slirp->opaque, arp_req, sizeof(arp_req)); ifm->resolution_requested = true; /* Expire request and drop outgoing packet after 1 second */ @@ -1029,7 +1029,7 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); - slirp->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); + slirp->cb->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; } |