File discovery_config.hpp
File List > astutedds > rtps > discovery_config.hpp
Go to the documentation of this file
//
// Copyright (c) 2026, Astute Systems PTY LTD
//
// This file is part of the Astute DDS developed by Astute Systems.
//
// See the commercial LICENSE file in the project root for full license details.
//
// @file discovery_config.hpp
// @brief JSON-based discovery bootstrap config (interfaces and peer list)
//
// Provides a lightweight JSON schema inspired by CycloneDDS and RTI
// initial-peers style configuration. This is a vendor configuration surface,
// mapped internally to standard RTPS SPDP/SEDP wire behavior.
//
#ifndef ASTUTEDDS_RTPS_DISCOVERY_CONFIG_HPP
#define ASTUTEDDS_RTPS_DISCOVERY_CONFIG_HPP
#include <array>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
namespace astutedds::rtps
{
struct DiscoveryPeerConfig
{
std::array<uint8_t, 4> address{0, 0, 0, 0};
std::string host;
uint16_t port{0};
int participant_id{-1};
};
struct DiscoveryInterfaceConfig
{
// Glob patterns over interface names, e.g. ["eth*", "en*"]
std::vector<std::string> allow;
std::vector<std::string> deny;
// Optional exact IPv4 addresses to keep, e.g. ["192.168.1.10"]
std::vector<std::array<uint8_t, 4>> addresses;
};
struct DiscoveryConfig
{
bool allow_multicast{true};
bool include_loopback{false};
bool strict_validation{false};
DiscoveryInterfaceConfig interfaces;
std::vector<DiscoveryPeerConfig> peers;
};
class DiscoveryConfigLoader
{
public:
DiscoveryConfigLoader() = default;
bool load_file(const std::string& path);
bool load_string(const std::string& json_text);
const DiscoveryConfig& config() const { return config_; }
DiscoveryConfig config_for_domain(uint32_t domain_id) const;
bool has_domain_profile(uint32_t domain_id) const;
const std::string& last_error() const { return last_error_; }
private:
DiscoveryConfig config_;
std::map<uint32_t, DiscoveryConfig> domain_profiles_;
std::string last_error_;
};
} // namespace astutedds::rtps
#endif // ASTUTEDDS_RTPS_DISCOVERY_CONFIG_HPP