23 #ifndef RDMNET_CPP_CLIENT_H_
24 #define RDMNET_CPP_CLIENT_H_
31 #include "rdm/cpp/uid.h"
51 constexpr
SourceAddr(uint16_t source_endpoint,
const rdm::Uid& rdm_source_uid, uint16_t subdevice = 0) noexcept;
70 constexpr SourceAddr::SourceAddr(uint16_t source_endpoint,
const rdm::Uid& rdm_source_uid, uint16_t subdevice) noexcept
71 : addr_{source_endpoint, rdm_source_uid.get(), subdevice}
86 uint16_t subdevice = 0);
89 const rdm::Uid& rdm_uid,
90 uint16_t subdevice = 0);
95 constexpr
DestinationAddr(
const RdmUid& rdmnet_uid, uint16_t endpoint,
const RdmUid& rdm_uid, uint16_t subdevice);
105 return DestinationAddr(rdmnet_uid.get(), E133_NULL_ENDPOINT, rdmnet_uid.get(), subdevice);
116 return DestinationAddr({manufacturer_id, device_id}, E133_NULL_ENDPOINT, {manufacturer_id, device_id}, subdevice);
131 const rdm::Uid& rdm_uid,
134 return DestinationAddr(rdmnet_uid.get(), endpoint, rdm_uid.get(), subdevice);
144 constexpr DestinationAddr::DestinationAddr(
const RdmUid& rdmnet_uid,
146 const RdmUid& rdm_uid,
148 : addr_{rdmnet_uid, endpoint, rdm_uid, subdevice}
173 constexpr rdm::Uid
broker_uid() const noexcept;
240 constexpr
etcpal::Error socket_err() const noexcept;
242 constexpr
bool will_retry() const noexcept;
244 constexpr
bool HasSocketErr() const noexcept;
245 constexpr
bool HasRdmnetReason() const noexcept;
247 const
char* EventToCString() const noexcept;
248 std::
string EventToString() const;
249 const
char* RdmnetReasonToCString() const noexcept;
250 std::
string RdmnetReasonToString() const;
274 return info_.socket_err;
281 return info_.rdmnet_reason;
295 return info_.will_retry;
358 constexpr
etcpal::Error socket_err() const noexcept;
360 constexpr
bool will_retry() const noexcept;
362 constexpr
bool HasSocketErr() const noexcept;
363 constexpr
bool HasRdmnetReason() const noexcept;
365 const
char* EventToCString() const noexcept;
366 std::
string EventToString() const;
367 const
char* RdmnetReasonToCString() const noexcept;
368 std::
string RdmnetReasonToString() const;
392 return info_.socket_err;
399 return info_.rdmnet_reason;
409 return info_.will_retry;
475 bool IsStatic()
const noexcept;
476 bool IsDefault()
const noexcept;
481 void SetIdString(
const char*
id);
491 : id_(scope_str.substr(0, E133_SCOPE_STRING_PADDED_LENGTH - 1)), static_broker_addr_(static_broker_addr)
505 return static_broker_addr_.
IsValid();
511 return id_ == E133_DEFAULT_SCOPE;
526 return static_broker_addr_;
constexpr bool IsValid() const noexcept
Information about a failed connection to a broker delivered to an RDMnet callback function.
Definition: client.h:228
const char * EventToCString() const noexcept
Get the high-level reason that this connection failed as a C-style string.
Definition: client.h:311
const char * RdmnetReasonToCString() const noexcept
Get the reason given in the RDMnet-level connection refuse message as a C-style string.
Definition: client.h:323
constexpr rdmnet_connect_status_t rdmnet_reason() const noexcept
Get the reason given in the RDMnet-level connection refuse message.
Definition: client.h:279
constexpr bool will_retry() const noexcept
Whether the connection will be retried automatically.
Definition: client.h:293
constexpr bool HasSocketErr() const noexcept
Whether the value returned from socket_err() is valid.
Definition: client.h:299
ClientConnectFailedInfo(const ClientConnectFailedInfo &other)=delete
Not copyable.
std::string EventToString() const
Get the high-level reason that this connection failed as a string.
Definition: client.h:317
constexpr etcpal::Error socket_err() const noexcept
Get the system error code associated with the failure.
Definition: client.h:272
std::string RdmnetReasonToString() const
Get the reason given in the RDMnet-level connection refuse message as a string.
Definition: client.h:329
constexpr bool HasRdmnetReason() const noexcept
Whether the value returned from rdmnet_reason() is valid.
Definition: client.h:305
ClientConnectFailedInfo & operator=(const ClientConnectFailedInfo &other)=delete
Not copyable.
ClientConnectFailedInfo()=delete
Not default-constructible.
constexpr rdmnet_connect_fail_event_t event() const noexcept
Get the high-level reason that this connection failed.
Definition: client.h:265
constexpr const RdmnetClientConnectFailedInfo & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:335
Information about a successful connection to a broker delivered to an RDMnet callback function.
Definition: client.h:158
std::string broker_name() const
Get the DNS name of the broker (if it was discovered via DNS-SD; otherwise this will be an empty stri...
Definition: client.h:193
ClientConnectedInfo(const ClientConnectedInfo &other)=delete
Not copyable.
constexpr rdm::Uid broker_uid() const noexcept
Get the RDM UID of the connected broker.
Definition: client.h:211
constexpr etcpal::Uuid broker_cid() const noexcept
Get the CID of the connected broker.
Definition: client.h:205
constexpr const char * broker_name_c_str() const noexcept
Get the DNS name of the broker (if it was discovered via DNS-SD; otherwise this will be an empty stri...
Definition: client.h:199
ClientConnectedInfo & operator=(const ClientConnectedInfo &other)=delete
Not copyable.
ClientConnectedInfo()=delete
Not default-constructible.
constexpr const RdmnetClientConnectedInfo & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:217
constexpr etcpal::SockAddr broker_addr() const noexcept
Get the IP address and port of the remote broker to which we have connected.
Definition: client.h:187
Information about a disconnect event from a broker delivered to an RDMnet callback function.
Definition: client.h:346
ClientDisconnectedInfo & operator=(const ClientDisconnectedInfo &other)=delete
Not copyable.
const char * EventToCString() const noexcept
Get the high-level reason for this disconnect as a C-style string.
Definition: client.h:425
constexpr rdmnet_disconnect_event_t event() const noexcept
Get the high-level reason for this disconnect.
Definition: client.h:383
const char * RdmnetReasonToCString() const noexcept
Get the reason given in the RDMnet-level disconnect message as a C-style string.
Definition: client.h:437
constexpr bool will_retry() const noexcept
Whether the connection will be retried automatically.
Definition: client.h:407
ClientDisconnectedInfo()=delete
Not default-constructible.
constexpr bool HasSocketErr() const noexcept
Whether the value returned from socket_err() is valid.
Definition: client.h:413
constexpr rdmnet_disconnect_reason_t rdmnet_reason() const noexcept
Get the reason given in the RDMnet-level disconnect message.
Definition: client.h:397
std::string EventToString() const
Get the high-level reason for this disconnect as a string.
Definition: client.h:431
constexpr etcpal::Error socket_err() const noexcept
Get the system error code associated with the disconnect.
Definition: client.h:390
std::string RdmnetReasonToString() const
Get the reason given in the RDMnet-level disconnect message as a string.
Definition: client.h:443
constexpr bool HasRdmnetReason() const noexcept
Whether the value returned from rdmnet_reason() is valid.
Definition: client.h:419
ClientDisconnectedInfo(const ClientDisconnectedInfo &other)=delete
Not copyable.
constexpr const RdmnetClientDisconnectedInfo & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:449
A destination address for an RDM command in RDMnet's RPT protocol.
Definition: client.h:79
static constexpr DestinationAddr ToDefaultResponder(const rdm::Uid &rdmnet_uid, uint16_t subdevice=0)
Get a DestinationAddr representing a message addressed to a component's default responder.
Definition: client.h:103
static constexpr DestinationAddr ToSubResponder(const rdm::Uid &rdmnet_uid, uint16_t endpoint, const rdm::Uid &rdm_uid, uint16_t subdevice=0)
Get a DestinationAddr representing a message addressed to a sub-responder on a component.
Definition: client.h:129
constexpr const RdmnetDestinationAddr & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:139
An RDMnet scope configuration.
Definition: client.h:469
const etcpal::SockAddr & static_broker_addr() const noexcept
The static broker address associated with this scope.
Definition: client.h:524
bool IsDefault() const noexcept
Whether this scope represents the default RDMnet scope.
Definition: client.h:509
void SetIdString(const std::string &id)
Set a new ID string for this scope.
Definition: client.h:530
const std::string & id_string() const noexcept
The ID string of this scope.
Definition: client.h:515
bool IsStatic() const noexcept
Whether this scope has been configured with a static IP address and port for a broker.
Definition: client.h:503
void SetStaticBrokerAddr(const etcpal::SockAddr &static_broker_addr)
Set a new static broker IP address and port for this scope.
Definition: client.h:546
The source address for an unsolicited RDM response generated by a local component.
Definition: client.h:48
constexpr const RdmnetSourceAddr & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:61
API definitions used by RDMnet clients (controllers and devices)
#define ETCPAL_IP_IS_INVALID(etcpal_ip_ptr)
rdmnet_disconnect_reason_t
Definition: common.h:85
rdmnet_connect_fail_event_t
Definition: common.h:149
rdmnet_disconnect_event_t
Definition: common.h:174
const char * rdmnet_connect_fail_event_to_string(rdmnet_connect_fail_event_t event)
Get a string description of an RDMnet connection failure event.
Definition: common.c:350
const char * rdmnet_disconnect_event_to_string(rdmnet_disconnect_event_t event)
Get a string description of an RDMnet disconnect event.
Definition: common.c:378
const char * rdmnet_disconnect_reason_to_string(rdmnet_disconnect_reason_t code)
Get a string description of an RDMnet disconnect reason code.
Definition: common.c:438
rdmnet_connect_status_t
Definition: common.h:117
const char * rdmnet_connect_status_to_string(rdmnet_connect_status_t code)
Get a string description of an RDMnet connect status code.
Definition: common.c:407
@ kRdmnetConnectFailRejected
Definition: common.h:169
@ kRdmnetConnectFailSocketFailure
Definition: common.h:154
@ kRdmnetConnectFailTcpLevel
Definition: common.h:159
@ kRdmnetDisconnectAbruptClose
Definition: common.h:176
@ kRdmnetDisconnectGracefulRemoteInitiated
Definition: common.h:185
constexpr uint16_t kNullEndpoint
Identifies the NULL_ENDPOINT, the endpoint of the RDMnet default responder.
Definition: client.h:460
A namespace which contains all C++ language definitions in the RDMnet library.
Definition: broker.h:45
EtcPalSockAddr broker_addr
Definition: client.h:153
EtcPalUuid broker_cid
Definition: client.h:157
const char * broker_name
Definition: client.h:155
RdmUid broker_uid
Definition: client.h:159
A destination address for an RDM command in RDMnet's RPT protocol.
Definition: client.h:84
EtcPalSockAddr static_broker_addr
Definition: client.h:235
The source address for an unsolicited RDM response generated by a local component.
Definition: client.h:66