23 #ifndef RDMNET_CPP_BROKER_H_
24 #define RDMNET_CPP_BROKER_H_
33 #include "etcpal/common.h"
38 #include "rdm/cpp/uid.h"
40 #include "rdmnet/defs.h"
60 DnsTxtRecordItem(
const char* new_key,
const uint8_t* new_value,
size_t new_value_len);
67 inline DnsTxtRecordItem::DnsTxtRecordItem(
const char* new_key,
const char* new_value)
77 inline DnsTxtRecordItem::DnsTxtRecordItem(
const char* new_key,
const uint8_t* new_value,
size_t new_value_len)
88 : key(new_key), value(new_value.begin(), new_value.end())
93 inline DnsTxtRecordItem::DnsTxtRecordItem(
const std::string& new_key,
const uint8_t* new_value,
size_t new_value_len)
102 : key(new_key), value(new_value)
246 inline Broker::Settings::Settings(
const etcpal::Uuid& cid_in,
const rdm::Uid& static_uid_in)
247 : cid(cid_in), uid(static_uid_in)
253 inline Broker::Settings::Settings(
const etcpal::Uuid& cid_in, uint16_t rdm_manu_id_in)
254 : cid(cid_in), uid(rdm::Uid::DynamicUidRequest(rdm_manu_id_in))
265 (!scope.empty() && scope.length() < (E133_SCOPE_STRING_PADDED_LENGTH - 1)) &&
266 (!dns.manufacturer.empty() && dns.manufacturer.length() < (E133_MANUFACTURER_STRING_PADDED_LENGTH - 1)) &&
267 (!dns.model.empty() && dns.model.length() < (E133_MODEL_STRING_PADDED_LENGTH - 1)) &&
268 (!dns.service_instance_name.empty() && dns.service_instance_name.length() < (E133_SERVICE_NAME_STRING_PADDED_LENGTH - 1)) &&
269 (listen_port == 0 || listen_port >= 1024) &&
270 (uid.manufacturer_id() != 0) &&
271 (uid.IsStatic() || uid.IsDynamicUidRequest())
std::string ToString() const
A callback interface for notifications from the broker.
Definition: broker.h:205
virtual void HandleScopeChanged(const std::string &new_scope)
The scope of the broker has changed via RDMnet configuration.
Definition: broker.h:214
Defines an instance of RDMnet broker functionality.
Definition: broker.h:125
const Settings & settings() const
Get the current settings the broker is using.
Definition: broker_api.cpp:100
etcpal::Error ChangeScope(const std::string &new_scope, rdmnet_disconnect_reason_t disconnect_reason)
Change the scope on which a broker operates.
Definition: broker_api.cpp:88
Broker & operator=(const Broker &other)=delete
Brokers cannot be copied.
Broker & operator=(Broker &&other)=default
Move an instance of broker functionality.
Broker(Broker &&other)=default
Move an instance of broker functionality.
Broker()
Constructs a broker instance. Broker is not running until Broker::Startup() is called.
Definition: broker_api.cpp:28
void Shutdown(rdmnet_disconnect_reason_t disconnect_reason=kRdmnetDisconnectShutdown)
Shut down all broker functionality and threads.
Definition: broker_api.cpp:66
etcpal::Error Startup(const Settings &settings, etcpal::Logger *logger=nullptr, NotifyHandler *notify=nullptr)
Start all broker functionality and threads.
Definition: broker_api.cpp:52
Broker(const Broker &other)=delete
Brokers cannot be copied.
virtual ~Broker()
Destroys a broker instance. Call Broker::Shutdown() first.
Definition: broker_api.cpp:33
Functions and definitions common to all RDMnet API modules.
rdmnet_disconnect_reason_t
Definition: common.h:85
@ kRdmnetDisconnectShutdown
Definition: common.h:87
A namespace which contains all C++ language definitions in the RDMnet library.
Definition: broker.h:45
Settings for the Broker's DNS Discovery functionality.
Definition: broker.h:130
std::string model
A string to identify the model of product in which the broker instance is included.
Definition: broker.h:141
std::vector< DnsTxtRecordItem > additional_txt_record_items
Any additional non-standard items to add to the broker's DNS TXT record.
Definition: broker.h:144
std::string service_instance_name
Your unique name for this broker DNS-SD service instance.
Definition: broker.h:136
std::string manufacturer
A string to identify the manufacturer of this broker instance.
Definition: broker.h:139
A set of limits for broker operation.
Definition: broker.h:150
unsigned int connections
The maximum number of client connections supported. 0 means infinite.
Definition: broker.h:152
unsigned int controllers
The maximum number of controllers allowed. 0 means infinite.
Definition: broker.h:154
unsigned int devices
The maximum number of devices allowed. 0 means infinite.
Definition: broker.h:158
unsigned int reject_connections
Definition: broker.h:163
unsigned int controller_messages
The maximum number of queued messages per controller. 0 means infinite.
Definition: broker.h:156
unsigned int device_messages
The maximum number of queued messages per device. 0 means infinite.
Definition: broker.h:160
A group of settings for broker operation.
Definition: broker.h:169
Limits limits
The broker's limits.
Definition: broker.h:173
uint16_t listen_port
Whether the broker should allow the scope to be changed via RDM commands.
Definition: broker.h:184
rdm::Uid uid
The broker's UID.
Definition: broker.h:171
std::string scope
The RDMnet scope on which this broker should operate.
Definition: broker.h:176
std::vector< std::string > listen_interfaces
A list of strings representing the system name of network interfaces to listen on.
Definition: broker.h:191
etcpal::Uuid cid
The broker's CID.
Definition: broker.h:170
DnsAttributes dns
The broker's DNS attributes.
Definition: broker.h:172
bool IsValid() const
Whether this structure contains valid settings for broker operation.
Definition: broker.h:260
void SetDefaultServiceInstanceName()
Generate a DNS service instance name based on the broker's current CID.
Definition: broker.h:240
A key/value pair representing a DNS TXT record item.
Definition: broker.h:54
std::string key
The key is an ASCII-only string.
Definition: broker.h:55
std::vector< uint8_t > value
The value is opaque binary data.
Definition: broker.h:56