announce.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Self-announce facility
  3. * (c) 2017-2019 Red Hat, Inc.
  4. *
  5. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  6. * See the COPYING file in the top-level directory.
  7. */
  8. #ifndef QEMU_NET_ANNOUNCE_H
  9. #define QEMU_NET_ANNOUNCE_H
  10. #include "qapi/qapi-types-net.h"
  11. #include "qemu/timer.h"
  12. typedef struct AnnounceTimer {
  13. QEMUTimer *tm;
  14. AnnounceParameters params;
  15. QEMUClockType type;
  16. int round;
  17. } AnnounceTimer;
  18. /* Returns: update the timer to the next time point */
  19. int64_t qemu_announce_timer_step(AnnounceTimer *timer);
  20. /*
  21. * Delete the underlying timer and other data
  22. * If 'free_named' true and the timer is a named timer, then remove
  23. * it from the list of named timers and free the AnnounceTimer itself.
  24. */
  25. void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named);
  26. /*
  27. * Under BQL/main thread
  28. * Reset the timer to the given parameters/type/notifier.
  29. */
  30. void qemu_announce_timer_reset(AnnounceTimer *timer,
  31. AnnounceParameters *params,
  32. QEMUClockType type,
  33. QEMUTimerCB *cb,
  34. void *opaque);
  35. void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params);
  36. #endif