20#ifndef SACN_CPP_SOURCE_DETECTOR_H_
21#define SACN_CPP_SOURCE_DETECTOR_H_
177 const std::string& name,
178 const std::vector<uint16_t>& sourced_universes) = 0;
243 std::vector<SacnMcastInterface>& netints);
262 const uint16_t* sourced_universes,
263 size_t num_sourced_universes,
266 if (context && cid && name)
268 std::vector<uint16_t> sourced_vec;
269 if (sourced_universes && (num_sourced_universes > 0))
270 sourced_vec.assign(sourced_universes, sourced_universes + num_sourced_universes);
280 if (context && cid && name)
282 static_cast<SourceDetector::NotifyHandler*
>(context)->HandleSourceExpired(handle, *cid, name);
286extern "C" inline void SourceDetectorCbMemoryLimitExceeded(
void* context)
290 static_cast<SourceDetector::NotifyHandler*
>(context)->HandleMemoryLimitExceeded();
320 McastMode mcast_mode = McastMode::kEnabledOnAllInterfaces)
325 if (mcast_mode == McastMode::kDisabledOnAllInterfaces)
378 McastMode mcast_mode = McastMode::kEnabledOnAllInterfaces)
383 if (mcast_mode == McastMode::kDisabledOnAllInterfaces)
409 std::vector<SacnMcastInterface>& netints)
417 netint_config.
netints = netints.data();
463 if (mcast_mode == McastMode::kDisabledOnAllInterfaces)
495 if (sys_netints.empty())
501 netint_config.
netints = sys_netints.data();
515 size_t size_guess = 4u;
516 std::vector<EtcPalMcastNetintId> netints(size_guess);
519 while (num_netints > netints.size())
521 size_guess = num_netints + 4u;
522 netints.resize(size_guess);
526 netints.resize(num_netints);
535 internal::SourceDetectorCbSourceUpdated,
536 internal::SourceDetectorCbSourceExpired,
537 internal::SourceDetectorCbMemoryLimitExceeded,
540 settings.source_count_max,
541 settings.universes_per_source_max,
542 settings.ip_supported
A base class for a class that receives common notification callbacks from sACN.
Definition common.h:73
A base class for a class that receives notification callbacks from a sACN Source Detector.
Definition source_detector.h:129
NotifyHandler & operator=(const NotifyHandler &other)=default
Defaulted copy assignment operator.
virtual void HandleMemoryLimitExceeded()
Notify that the module has run out of memory to track universes or sources.
Definition source_detector.h:206
NotifyHandler(const NotifyHandler &other)=default
Defaulted copy constructor.
virtual void HandleSourceUpdated(RemoteSourceHandle handle, const etcpal::Uuid &cid, const std::string &name, const std::vector< uint16_t > &sourced_universes)=0
Notify that a source is new or has changed.
NotifyHandler(NotifyHandler &&other)=default
Defaulted move constructor.
virtual void HandleSourceExpired(RemoteSourceHandle handle, const etcpal::Uuid &cid, const std::string &name)=0
Notify that a source is no longer transmitting Universe Discovery messages.
NotifyHandler & operator=(NotifyHandler &&other)=default
Defaulted move assignment operator.
An instance of sACN Source Detector functionality.
Definition source_detector.h:122
static void Shutdown()
Destroy the sACN Source Detector.
Definition source_detector.h:430
static std::vector< EtcPalMcastNetintId > GetNetworkInterfaces()
Obtain the source detector's network interfaces.
Definition source_detector.h:512
static etcpal::Error ResetNetworking(McastMode mcast_mode)
Resets the underlying network sockets and packet receipt state for the sACN Source Detector.
Definition source_detector.h:460
static etcpal::Error Startup(NotifyHandler ¬ify_handler, McastMode mcast_mode)
Start the sACN Source Detector with default settings.
Definition source_detector.h:319
C++ wrapper for the sACN init/deinit functions.
sacn_ip_support_t
This enum defines how the API module will use IPv4 and IPv6 networking.
Definition common.h:75
uint16_t sacn_remote_source_t
A source discovered on an sACN network that has a CID - used by Receiver and Merge Receiver.
Definition common.h:47
#define SACN_NETINT_CONFIG_DEFAULT_INIT
Initializes the members of a SacnNetintConfig to defaults.
Definition common.h:187
@ kSacnIpV4AndIpV6
Use both IPv4 and IPv6.
Definition common.h:81
void sacn_source_detector_destroy()
Destroy the sACN Source Detector.
Definition source_detector.c:129
etcpal_error_t sacn_source_detector_reset_networking(const SacnNetintConfig *sys_netint_config)
Updates the source detector system network interfaces.
Definition source_detector.c:178
etcpal_error_t sacn_source_detector_create(const SacnSourceDetectorConfig *config, const SacnNetintConfig *netint_config)
Create the sACN Source Detector.
Definition source_detector.c:85
size_t sacn_source_detector_get_network_interfaces(EtcPalMcastNetintId *netints, size_t netints_size)
Obtain the source detector's network interfaces.
Definition source_detector.c:225
@ kSacnSourceDetectorInfinite
Constant for "infinite" when listening for sources or universes on a source.
Definition source_detector.h:148
A namespace which contains all C++ language definitions in the sACN library.
Definition common.h:50
sacn_remote_source_t RemoteSourceHandle
A source discovered on an sACN network that has a CID - used by Receiver and Merge Receiver.
Definition common.h:59
McastMode
Determines whether multicast traffic is allowed through all interfaces or none.
Definition common.h:53
sACN Source Detector API definitions
Network interface configuration information to give the sACN library.
Definition common.h:114
SacnMcastInterface * netints
An array of network interface IDs to which to restrict multicast traffic.
Definition common.h:117
size_t num_netints
Size of netints array.
Definition common.h:119
bool no_netints
If this is true, no network interfaces will be used for multicast.
Definition common.h:122
A set of configuration information for the sACN Source Detector.
Definition source_detector.h:218
A set of configuration settings that a source detector needs to initialize.
Definition source_detector.h:214
int source_count_max
The maximum number of sources the detector will record.
Definition source_detector.h:222
Settings()=default
Create default data structure.
sacn_ip_support_t ip_supported
What IP networking the source detector will support.
Definition source_detector.h:230
int universes_per_source_max
The maximum number of universes the detector will record for a source.
Definition source_detector.h:227