23 #ifndef RDMNET_CPP_CLIENT_H_
24 #define RDMNET_CPP_CLIENT_H_
30 #include "rdm/cpp/uid.h"
42 constexpr
SourceAddr(uint16_t source_endpoint,
const rdm::Uid& rdm_source_uid, uint16_t subdevice = 0) noexcept;
61 constexpr SourceAddr::SourceAddr(uint16_t source_endpoint,
const rdm::Uid& rdm_source_uid, uint16_t subdevice) noexcept
62 : addr_{source_endpoint, rdm_source_uid.get(), subdevice}
77 uint16_t subdevice = 0);
80 const rdm::Uid& rdm_uid,
81 uint16_t subdevice = 0);
86 constexpr
DestinationAddr(
const RdmUid& rdmnet_uid, uint16_t endpoint,
const RdmUid& rdm_uid, uint16_t subdevice);
96 return DestinationAddr(rdmnet_uid.get(), E133_NULL_ENDPOINT, rdmnet_uid.get(), subdevice);
107 return DestinationAddr({manufacturer_id, device_id}, E133_NULL_ENDPOINT, {manufacturer_id, device_id}, subdevice);
122 const rdm::Uid& rdm_uid,
125 return DestinationAddr(rdmnet_uid.get(), endpoint, rdm_uid.get(), subdevice);
135 constexpr DestinationAddr::DestinationAddr(
const RdmUid& rdmnet_uid,
137 const RdmUid& rdm_uid,
139 : addr_{rdmnet_uid, endpoint, rdm_uid, subdevice}
164 constexpr rdm::Uid
broker_uid() const noexcept;
231 constexpr
etcpal::Error socket_err() const noexcept;
233 constexpr
bool will_retry() const noexcept;
235 constexpr
bool HasSocketErr() const noexcept;
236 constexpr
bool HasRdmnetReason() const noexcept;
238 const
char* EventToCString() const noexcept;
239 std::
string EventToString() const;
240 const
char* RdmnetReasonToCString() const noexcept;
241 std::
string RdmnetReasonToString() const;
265 return info_.socket_err;
272 return info_.rdmnet_reason;
286 return info_.will_retry;
349 constexpr
etcpal::Error socket_err() const noexcept;
351 constexpr
bool will_retry() const noexcept;
353 constexpr
bool HasSocketErr() const noexcept;
354 constexpr
bool HasRdmnetReason() const noexcept;
356 const
char* EventToCString() const noexcept;
357 std::
string EventToString() const;
358 const
char* RdmnetReasonToCString() const noexcept;
359 std::
string RdmnetReasonToString() const;
383 return info_.socket_err;
390 return info_.rdmnet_reason;
400 return info_.will_retry;
466 bool IsStatic()
const noexcept;
467 bool IsDefault()
const noexcept;
472 void SetIdString(
const char*
id);
482 : id_(scope_str.substr(0, E133_SCOPE_STRING_PADDED_LENGTH - 1)), static_broker_addr_(static_broker_addr)
496 return static_broker_addr_.
IsValid();
502 return id_ == E133_DEFAULT_SCOPE;
517 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:219
const char * EventToCString() const noexcept
Get the high-level reason that this connection failed as a C-style string.
Definition: client.h:302
constexpr const RdmnetClientConnectFailedInfo & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:326
constexpr bool HasRdmnetReason() const noexcept
Whether the value returned from rdmnet_reason() is valid.
Definition: client.h:296
constexpr bool will_retry() const noexcept
Whether the connection will be retried automatically.
Definition: client.h:284
std::string RdmnetReasonToString() const
Get the reason given in the RDMnet-level connection refuse message as a string.
Definition: client.h:320
const char * RdmnetReasonToCString() const noexcept
Get the reason given in the RDMnet-level connection refuse message as a C-style string.
Definition: client.h:314
constexpr rdmnet_connect_status_t rdmnet_reason() const noexcept
Get the reason given in the RDMnet-level connection refuse message.
Definition: client.h:270
ClientConnectFailedInfo(const ClientConnectFailedInfo &other)=delete
Not copyable.
constexpr rdmnet_connect_fail_event_t event() const noexcept
Get the high-level reason that this connection failed.
Definition: client.h:256
constexpr etcpal::Error socket_err() const noexcept
Get the system error code associated with the failure.
Definition: client.h:263
ClientConnectFailedInfo()=delete
Not default-constructible.
ClientConnectFailedInfo & operator=(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:308
constexpr bool HasSocketErr() const noexcept
Whether the value returned from socket_err() is valid.
Definition: client.h:290
Information about a successful connection to a broker delivered to an RDMnet callback function.
Definition: client.h:149
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:202
constexpr const RdmnetClientConnectedInfo & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:208
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:184
constexpr etcpal::Uuid broker_cid() const noexcept
Get the CID of the connected broker.
Definition: client.h:196
ClientConnectedInfo & operator=(const ClientConnectedInfo &other)=delete
Not copyable.
ClientConnectedInfo()=delete
Not default-constructible.
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:190
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:178
Information about a disconnect event from a broker delivered to an RDMnet callback function.
Definition: client.h:337
constexpr bool will_retry() const noexcept
Whether the connection will be retried automatically.
Definition: client.h:398
constexpr etcpal::Error socket_err() const noexcept
Get the system error code associated with the disconnect.
Definition: client.h:381
const char * EventToCString() const noexcept
Get the high-level reason for this disconnect as a C-style string.
Definition: client.h:416
constexpr rdmnet_disconnect_event_t event() const noexcept
Get the high-level reason for this disconnect.
Definition: client.h:374
std::string RdmnetReasonToString() const
Get the reason given in the RDMnet-level disconnect message as a string.
Definition: client.h:434
constexpr const RdmnetClientDisconnectedInfo & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:440
constexpr rdmnet_disconnect_reason_t rdmnet_reason() const noexcept
Get the reason given in the RDMnet-level disconnect message.
Definition: client.h:388
ClientDisconnectedInfo()=delete
Not default-constructible.
constexpr bool HasRdmnetReason() const noexcept
Whether the value returned from rdmnet_reason() is valid.
Definition: client.h:410
const char * RdmnetReasonToCString() const noexcept
Get the reason given in the RDMnet-level disconnect message as a C-style string.
Definition: client.h:428
std::string EventToString() const
Get the high-level reason for this disconnect as a string.
Definition: client.h:422
ClientDisconnectedInfo(const ClientDisconnectedInfo &other)=delete
Not copyable.
ClientDisconnectedInfo & operator=(const ClientDisconnectedInfo &other)=delete
Not copyable.
constexpr bool HasSocketErr() const noexcept
Whether the value returned from socket_err() is valid.
Definition: client.h:404
A destination address for an RDM command in RDMnet's RPT protocol.
Definition: client.h:70
constexpr const RdmnetDestinationAddr & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:130
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:120
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:94
An RDMnet scope configuration.
Definition: client.h:460
const etcpal::SockAddr & static_broker_addr() const noexcept
The static broker address associated with 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:494
bool IsDefault() const noexcept
Whether this scope represents the default RDMnet scope.
Definition: client.h:500
const std::string & id_string() const noexcept
The ID string of this scope.
Definition: client.h:506
void SetStaticBrokerAddr(const etcpal::SockAddr &static_broker_addr)
Set a new static broker IP address and port for this scope.
Definition: client.h:537
void SetIdString(const std::string &id)
Set a new ID string for this scope.
Definition: client.h:521
The source address for an unsolicited RDM response generated by a local component.
Definition: client.h:39
constexpr const RdmnetSourceAddr & get() const noexcept
Get a const reference to the underlying C type.
Definition: client.h:52
API definitions used by RDMnet clients (controllers and devices)
#define ETCPAL_IP_IS_INVALID(etcpal_ip_ptr)
rdmnet_disconnect_reason_t
Disconnect reason defines for the BrokerDisconnectMsg.
Definition: common.h:85
rdmnet_connect_fail_event_t
A high-level reason for RDMnet connection failure.
Definition: common.h:149
rdmnet_disconnect_event_t
A high-level reason for RDMnet connection to be disconnected after successful connection.
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:276
const char * rdmnet_disconnect_event_to_string(rdmnet_disconnect_event_t event)
Get a string description of an RDMnet disconnect event.
Definition: common.c:304
int rdmnet_client_scope_t
A handle to a scope that an RDMnet client participates in.
Definition: client.h:41
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:364
rdmnet_connect_status_t
Connect status defines for the BrokerConnectReplyMsg.
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:333
@ kRdmnetConnectFailRejected
The remote broker rejected the connection at the RDMnet protocol level.
Definition: common.h:169
@ kRdmnetConnectFailSocketFailure
The connection was unable to be started because of an error returned from the system during a lower-l...
Definition: common.h:154
@ kRdmnetConnectFailTcpLevel
The connection started but the TCP connection was never established.
Definition: common.h:159
@ kRdmnetDisconnectAbruptClose
The TCP connection was closed without an RDMnet disconnect message being sent.
Definition: common.h:176
@ kRdmnetDisconnectGracefulRemoteInitiated
The remote component sent an RDMnet disconnect message with a reason code.
Definition: common.h:185
constexpr uint16_t kNullEndpoint
Identifies the NULL_ENDPOINT, the endpoint of the RDMnet default responder.
Definition: client.h:451
rdmnet_client_scope_t ScopeHandle
A handle to a scope that an RDMnet client participates in.
Definition: client.h:447
A namespace which contains all C++ language definitions in the RDMnet library.
Definition: broker.h:45
Information provided by the library about an unsuccessful RDMnet client connection.
Definition: client.h:164
Information provided by the library about a successful RDMnet client connection.
Definition: client.h:151
const char * broker_name
The DNS name of the broker, if it was discovered using DNS-SD; otherwise an empty string.
Definition: client.h:155
EtcPalSockAddr broker_addr
The IP address and port of the remote broker to which we have connected.
Definition: client.h:153
RdmUid broker_uid
The RDM UID of the connected broker.
Definition: client.h:159
EtcPalUuid broker_cid
The CID of the connected broker.
Definition: client.h:157
Information provided by the library about an RDMnet client connection that disconnected after a succe...
Definition: client.h:196
A destination address for an RDM command in RDMnet's RPT protocol.
Definition: client.h:84
A set of configuration information for a single scope in which an RDMnet client is participating.
Definition: client.h:224
EtcPalSockAddr static_broker_addr
The broker address to which to connect, if a static broker has been configured.
Definition: client.h:235
The source address for an unsolicited RDM response generated by a local component.
Definition: client.h:66