diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-11-10 17:45:36 +0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-01-14 00:40:54 +0100 |
commit | 62c1d2c4833f53897098f945f504f5ec3022d35b (patch) | |
tree | 69006dccce299b57a6df93c06362fa86fbc245d2 /slirp/libslirp.h | |
parent | 27df21ca3886fff4dd3d70e515517667963a52f1 (diff) |
slirp: associate slirp_output callback with the Slirp context
Let's make the slirp interface a bit more library-like.
Associate the slirp_output() with a Slirp context.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/libslirp.h')
-rw-r--r-- | slirp/libslirp.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 42e42e9a2a..52dbb9feb5 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -5,6 +5,8 @@ typedef struct Slirp Slirp; +typedef void (*slirp_output)(void *opaque, const uint8_t *pkt, int pkt_len); + int get_dns_addr(struct in_addr *pdns_addr); int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id); @@ -17,7 +19,9 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, - const char *vdomainname, void *opaque); + const char *vdomainname, + slirp_output output, + void *opaque); void slirp_cleanup(Slirp *slirp); void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); @@ -26,9 +30,6 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error); void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); -/* you must provide the following functions: */ -void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len); - int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, int host_port, struct in_addr guest_addr, int guest_port); |