RDMnet  HEAD (unstable)
Implementation of ANSI E1.33 (RDMnet)
View other versions:
client.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 ETC Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************
16  * This file is a part of RDMnet. For more information, go to:
17  * https://github.com/ETCLabs/RDMnet
18  *****************************************************************************/
19 
25 #ifndef RDMNET_CLIENT_H_
26 #define RDMNET_CLIENT_H_
27 
28 #include <stdbool.h>
29 #include <stdint.h>
30 #include "etcpal/inet.h"
31 #include "etcpal/uuid.h"
32 #include "rdm/uid.h"
33 #include "rdmnet/common.h"
34 
43 #define RDMNET_CLIENT_SCOPE_INVALID -1
44 
49 typedef enum
50 {
52  kRdmnetClientListAppend = VECTOR_BROKER_CLIENT_ADD,
54  kRdmnetClientListRemove = VECTOR_BROKER_CLIENT_REMOVE,
56  kRdmnetClientListUpdate = VECTOR_BROKER_CLIENT_ENTRY_CHANGE,
58  kRdmnetClientListReplace = VECTOR_BROKER_CONNECTED_CLIENT_LIST
60 
65 typedef struct RdmnetSourceAddr
66 {
68  uint16_t source_endpoint;
72  uint16_t subdevice;
74 
83 typedef struct RdmnetDestinationAddr
84 {
86  RdmUid rdmnet_uid;
91  uint16_t endpoint;
96  RdmUid rdm_uid;
98  uint16_t subdevice;
100 
106 #define RDMNET_ADDR_TO_DEFAULT_RESPONDER(manu_id, dev_id) \
107  { \
108  {(manu_id), (dev_id)}, E133_NULL_ENDPOINT, {(manu_id), (dev_id)}, 0 \
109  }
110 
117 #define RDMNET_ADDR_TO_DEFAULT_RESPONDER_SUBDEV(manu_id, dev_id, subdevice) \
118  { \
119  {(manu_id), (dev_id)}, E133_NULL_ENDPOINT, {(manu_id), (dev_id)}, (subdevice) \
120  }
121 
130 #define RDMNET_ADDR_TO_SUB_RESPONDER(rdmnet_manu, rdmnet_dev, endpoint, rdm_manu, rdm_dev) \
131  { \
132  {(rdmnet_manu), (rdmnet_dev)}, (endpoint), {(rdm_manu), (rdm_dev)}, 0 \
133  }
134 
144 #define RDMNET_ADDR_TO_SUB_RESPONDER_SUBDEV(rdmnet_manu, rdmnet_dev, endpoint, rdm_manu, rdm_dev, subdevice) \
145  { \
146  {(rdmnet_manu), (rdmnet_dev)}, (endpoint), {(rdm_manu), (rdm_dev)}, (subdevice) \
147  }
148 
151 {
155  const char* broker_name;
159  RdmUid broker_uid;
161 
164 {
190 
196 {
218 
223 typedef struct RdmnetScopeConfig
224 {
229  const char* scope;
237 
247 #define RDMNET_SCOPE_CONFIG_DEFAULT_INIT \
248  { \
249  E133_DEFAULT_SCOPE, { 0, ETCPAL_IP_INVALID_INIT } \
250  }
251 
262 #define RDMNET_CLIENT_SET_SCOPE(configptr, scope_str) \
263  if (configptr) \
264  { \
265  (configptr)->scope = scope_str; \
266  ETCPAL_IP_SET_INVALID(&(configptr)->static_broker_addr.ip); \
267  }
268 
277 #define RDMNET_CLIENT_SET_DEFAULT_SCOPE(configptr) \
278  if (configptr) \
279  { \
280  (configptr)->scope = E133_DEFAULT_SCOPE; \
281  ETCPAL_IP_SET_INVALID(&(configptr)->static_broker_addr.ip); \
282  }
283 
295 #define RDMNET_CLIENT_SET_STATIC_SCOPE(configptr, scope_str, broker_addr) \
296  if (configptr) \
297  { \
298  (configptr)->scope = (scope_str); \
299  (configptr)->static_broker_addr = (broker_addr); \
300  }
301 
312 #define RDMNET_CLIENT_SET_STATIC_DEFAULT_SCOPE(configptr, broker_addr) \
313  if (configptr) \
314  { \
315  (configptr)->scope = E133_DEFAULT_SCOPE; \
316  (configptr)->static_broker_addr = (broker_addr); \
317  }
318 
323 #endif /* RDMNET_CLIENT_H_ */
Functions and definitions common to all RDMnet API modules.
etcpal_error_t
struct RdmnetClientConnectFailedInfo RdmnetClientConnectFailedInfo
struct RdmnetScopeConfig RdmnetScopeConfig
rdmnet_disconnect_reason_t
Definition: common.h:85
client_list_action_t
Definition: client.h:50
rdmnet_connect_fail_event_t
Definition: common.h:149
struct RdmnetClientConnectedInfo RdmnetClientConnectedInfo
rdmnet_disconnect_event_t
Definition: common.h:174
int rdmnet_client_scope_t
Definition: client.h:41
struct RdmnetDestinationAddr RdmnetDestinationAddr
A destination address for an RDM command in RDMnet's RPT protocol.
struct RdmnetClientDisconnectedInfo RdmnetClientDisconnectedInfo
struct RdmnetSourceAddr RdmnetSourceAddr
The source address for an unsolicited RDM response generated by a local component.
rdmnet_connect_status_t
Definition: common.h:117
@ kRdmnetClientListAppend
Definition: client.h:52
@ kRdmnetClientListRemove
Definition: client.h:54
@ kRdmnetClientListUpdate
Definition: client.h:56
@ kRdmnetClientListReplace
Definition: client.h:58
Definition: client.h:164
rdmnet_connect_status_t rdmnet_reason
The reason given in the RDMnet-level connection refuse message.
Definition: client.h:176
etcpal_error_t socket_err
The system error code associated with the failure.
Definition: client.h:171
bool will_retry
Whether the connection will be retried automatically.
Definition: client.h:188
rdmnet_connect_fail_event_t event
Definition: client.h:166
Definition: client.h:151
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
Definition: client.h:196
rdmnet_disconnect_event_t event
Definition: client.h:198
etcpal_error_t socket_err
The system error code associated with the disconnect.
Definition: client.h:203
rdmnet_disconnect_reason_t rdmnet_reason
The reason given in the RDMnet-level disconnect message.
Definition: client.h:208
bool will_retry
Whether the connection will be retried automatically.
Definition: client.h:216
A destination address for an RDM command in RDMnet's RPT protocol.
Definition: client.h:84
uint16_t subdevice
Definition: client.h:98
uint16_t endpoint
Definition: client.h:91
RdmUid rdm_uid
Definition: client.h:96
RdmUid rdmnet_uid
Definition: client.h:86
Definition: client.h:224
EtcPalSockAddr static_broker_addr
Definition: client.h:235
const char * scope
Definition: client.h:229
The source address for an unsolicited RDM response generated by a local component.
Definition: client.h:66
uint16_t subdevice
Definition: client.h:72
uint16_t source_endpoint
Definition: client.h:68
RdmUid rdm_source_uid
Definition: client.h:70