aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-17 15:43:37 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-07 15:49:08 +0200
commit07abf6d43ad8845868674c76bdd498b1a868df64 (patch)
tree46bda10914033744e0b0e44ccc2d3a670c8bc887 /net
parent8e207c327cf89aca02ea4c7e3109d285df048d55 (diff)
downloadqemu-07abf6d43ad8845868674c76bdd498b1a868df64.zip
qemu-07abf6d43ad8845868674c76bdd498b1a868df64.tar.gz
qemu-07abf6d43ad8845868674c76bdd498b1a868df64.tar.bz2
slirp: add callbacks for timer
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'net')
-rw-r--r--net/slirp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/slirp.c b/net/slirp.c
index 0b15f42..c24a779 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -168,10 +168,31 @@ static int64_t net_slirp_clock_get_ns(void)
return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
}
+static void *net_slirp_timer_new(SlirpTimerCb cb, void *opaque)
+{
+ return timer_new_full(NULL, QEMU_CLOCK_VIRTUAL,
+ SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL,
+ cb, opaque);
+}
+
+static void net_slirp_timer_free(void *timer)
+{
+ timer_del(timer);
+ timer_free(timer);
+}
+
+static void net_slirp_timer_mod(void *timer, int64_t expire_timer)
+{
+ timer_mod(timer, expire_timer);
+}
+
static const SlirpCb slirp_cb = {
.output = net_slirp_output,
.guest_error = net_slirp_guest_error,
.clock_get_ns = net_slirp_clock_get_ns,
+ .timer_new = net_slirp_timer_new,
+ .timer_free = net_slirp_timer_free,
+ .timer_mod = net_slirp_timer_mod,
};
static int net_slirp_init(NetClientState *peer, const char *model,