// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2026 Martino Ferrari #pragma once #include "source/source_kind.hpp" #include #include #include #include namespace udpscope { /// Takes ownership. A second kind with the same id is ignored. void register_kind(std::unique_ptr kind); SourceKind* find_kind(const std::string& id); /// In registration order (the chooser's dropdown order). const std::vector& kinds(); /// Registers the built-in kinds; idempotent. No static-init self-registration, which a linker /// may drop. A later `dlopen` loader would only call `register_kind()`. void register_builtin_sources(); /// The built-in kinds, each defined in its own file (`udps_kind.cpp`, `probe_source.cpp`, `e1608/e1608_kind.cpp`, `flatudp/flatudp_kind.cpp`). std::unique_ptr make_udps_kind(); std::unique_ptr make_probe_kind(); std::unique_ptr make_e1608_kind(); std::unique_ptr make_flatudp_kind(); /// The (host, port) pair that names a source's session file. UDPS keeps its legacy /// `server`/`port`; any other kind is `"-"` (characters outside `[A-Za-z0-9._-]` /// become `_`) on port 1 -- not 0, which the session-file parser rejects and waveform mode uses. std::string session_host(const std::string& kind_id, const SourceConfig& cfg); std::uint16_t session_port(const std::string& kind_id, const SourceConfig& cfg); } // namespace udpscope