membership_probe.h 1.1 KB

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include <cstdint>
  3. namespace sunrise::client::hooks::membership_probe {
  4. /**
  5. * Attaches the read-only probe on the client's activity msg 12 handler.
  6. * It answers one question: does a membership body we push on a public-target link reach the
  7. * client at all, and what identity does that link's ActivityClient hold. Nothing is changed --
  8. * the detour logs and calls through.
  9. * @return True when the probe is attached, or was already.
  10. */
  11. [[nodiscard]] bool install() noexcept;
  12. /**
  13. * Samples every ActivityClient the probe has seen recently.
  14. * The container bind happens on a later tick than the message, so the message handler is too
  15. * early to see its effect. Sampling stops a bounded time after the last message on a client, so
  16. * a torn-down activity is not read through a stale pointer.
  17. * @param now Monotonic tick count in milliseconds.
  18. */
  19. void service(std::uint64_t now) noexcept;
  20. /** Detaches the probe so a later unload cannot leave a detour into unmapped code. */
  21. [[nodiscard]] bool uninstall() noexcept;
  22. } // namespace sunrise::client::hooks::membership_probe