RAII service publisher. More...
#include <service_discovery.hpp>
Public Member Functions | |
| ServicePublisher (std::string_view name, std::string_view type, uint16_t port, NetworkServiceDiscovery::TxtRecords txt_records={}) | |
| ~ServicePublisher () | |
| ServicePublisher (const ServicePublisher &)=delete | |
| ServicePublisher & | operator= (const ServicePublisher &)=delete |
| bool | is_published () const noexcept |
| NetworkServiceDiscovery & | nsd () noexcept |
| Access the underlying NSD object — for tests that want to install a fake backend instead of the platform default. | |
Static Public Member Functions | |
| static std::unique_ptr< ServicePublisher > | with_backend (std::unique_ptr< NetworkServiceDiscovery::Backend > backend, std::string_view name, std::string_view type, uint16_t port, NetworkServiceDiscovery::TxtRecords txt_records={}) |
| Construct a publisher that uses a caller-supplied backend instead of the platform default. | |
RAII service publisher.
Builds an internal NetworkServiceDiscovery configured with the platform's default backend, then registers the requested service. Destructor unregisters and releases the backend.
is_published() returns true when the underlying backend accepted the registration. On platforms with no backend it returns false and callers can decide whether to surface the failure or proceed without service publication.
| pulp::events::ServicePublisher::ServicePublisher | ( | std::string_view | name, |
| std::string_view | type, | ||
| uint16_t | port, | ||
| NetworkServiceDiscovery::TxtRecords | txt_records = {} ) |
| pulp::events::ServicePublisher::~ServicePublisher | ( | ) |
|
delete |
|
inlinenoexcept |
|
inlinenoexcept |
Access the underlying NSD object — for tests that want to install a fake backend instead of the platform default.
|
delete |
|
static |
Construct a publisher that uses a caller-supplied backend instead of the platform default.
Primarily for tests.