UIClient.hpp

1. Overview

Desktop UI protocol client interface. Declares daemon-to-UI alerts, synchronous rule questions, heartbeat messages, connection serialization and incoming notification callbacks.

The original source path is:

include/bsc/ui/UIClient.hpp

2. Role in the Daemon

This file participates in the privileged BastionGuard Secure Connection daemon. It uses the shared bsc models and follows the daemon-wide fallback strategy: optional high-fidelity backends are used when available, while portable polling or stub behavior preserves service startup.


3. Namespaces

  • bsc::ui

4. Dependencies and Included Interfaces

  • bsc/model/Connection.hpp
  • bsc/rule/Rule.hpp
  • bsc/stats/Statistics.hpp
  • cstdint
  • functional
  • memory
  • optional
  • string
  • vector

5. Declared Types

  • struct NotificationEvent
  • class UIClient
  • class Impl

6. State and Data Members

The interface declares the following relevant state members:

  • std::string type
  • std::string data
  • std::vector<bsc::rule::Rule> rules
  • const std::string& rule_name = {})
  • class Impl
  • std::unique_ptr<Impl> impl_

7. API and Functions

The file declares or implements the following callable entry points:

  • public: explicit UIClient(std::string socket_uri)
  • void start()
  • void stop()
  • bool is_connected() const noexcept
  • std::optional<bsc::rule::Rule> ask_rule(const bsc::model::Connection& conn)
  • bool ping(const bsc::stats::Statistics& stats)
  • bool post_alert(const std::string& text)
  • void set_notification_handler(std::function<void(const NotificationEvent&)> cb)
  • explicit UIClient(std::string socket_uri)
  • UIClient(const UIClient&) = delete

8. Constants and Compile-Time Controls

  • std::string& action, const std::string& rule_name = {})

9. External Resources and Protocol Values

Relevant paths, endpoints, command names or policy values referenced by this file include:

  • bsc/model/Connection.hpp
  • bsc/rule/Rule.hpp
  • bsc/stats/Statistics.hpp

10. Security Considerations

  • The component processes privileged operating-system or network data and should run with only the capabilities required by its backend.

11. Implementation Considerations

  • Shared state is protected by mutexes; callers should avoid holding external locks while invoking callbacks.

12. Licensing and Attribution

  • Copyright (C) 2025–2026 Calogero Scarnà
  • GPL-3.0

13. Source Metrics

MetricValue
File size1603 bytes
Lines61
Detected API entries10
Detected types3