RDMnet  0.3.0
Implementation of ANSI E1.33 (RDMnet)
View other versions:
message.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_MESSAGE_H_
26 #define RDMNET_MESSAGE_H_
27 
28 #include <stdbool.h>
29 #include <stddef.h>
30 #include <stdint.h>
31 #include "etcpal/acn_rlp.h"
32 #include "etcpal/uuid.h"
33 #include "rdm/message.h"
34 #include "rdm/uid.h"
35 #include "rdmnet/common.h"
36 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
52 typedef struct RdmnetRdmCommand
53 {
57  uint16_t dest_endpoint;
59  uint32_t seq_num;
61  RdmCommandHeader rdm_header;
63  const uint8_t* data;
65  uint8_t data_len;
67 
69 #define RDMNET_COMMAND_IS_TO_DEFAULT_RESPONDER(cmd_ptr) ((cmd_ptr)->dest_endpoint == E133_NULL_ENDPOINT)
70 
72 typedef struct RdmnetSavedRdmCommand
73 {
77  uint16_t dest_endpoint;
79  uint32_t seq_num;
81  RdmCommandHeader rdm_header;
83  uint8_t data[RDM_MAX_PDL];
85  uint8_t data_len;
87 
89 typedef struct RdmnetRdmResponse
90 {
94  uint16_t source_endpoint;
96  uint32_t seq_num;
102 
104  RdmCommandHeader original_cmd_header;
106  const uint8_t* original_cmd_data;
112 
114  RdmResponseHeader rdm_header;
116  const uint8_t* rdm_data;
118  size_t rdm_data_len;
119 
129 
138 {
142  uint16_t source_endpoint;
144  uint32_t seq_num;
150 
152  RdmCommandHeader original_cmd_header;
154  uint8_t original_cmd_data[RDM_MAX_PDL];
160 
162  RdmResponseHeader rdm_header;
167  uint8_t* rdm_data;
169  size_t rdm_data_len;
171 
180 #define RDMNET_RESP_ORIGINAL_COMMAND_INCLUDED(resp) ((resp)->seq_num == 0)
181 
192 typedef struct RdmnetRptStatus
193 {
195  RdmUid source_uid;
197  uint16_t source_endpoint;
199  uint32_t seq_num;
203  const char* status_string;
205 
214 typedef struct RdmnetSavedRptStatus
215 {
217  RdmUid source_uid;
219  uint16_t source_endpoint;
221  uint32_t seq_num;
231 
234 {
238  RdmUid uid;
242 
245 {
249  size_t num_mappings;
258 
269 typedef struct RdmnetEptData
270 {
274  uint16_t manufacturer_id;
276  uint16_t protocol_id;
278  const uint8_t* data;
280  size_t data_len;
282 
290 typedef struct RdmnetSavedEptData
291 {
295  uint16_t manufacturer_id;
297  uint16_t protocol_id;
302  const uint8_t* data;
304  size_t data_len;
306 
308 typedef struct RdmnetEptStatus
309 {
315  const char* status_string;
317 
326 typedef struct RdmnetSavedEptStatus
327 {
337  const char* status_string;
339 
350 typedef enum
351 {
353  kRPTClientTypeDevice = E133_RPT_CLIENT_TYPE_DEVICE,
355  kRPTClientTypeController = E133_RPT_CLIENT_TYPE_CONTROLLER,
357  kRPTClientTypeUnknown = 0xffffffff
359 
361 typedef struct RdmnetRptClientEntry
362 {
364  RdmUid uid;
368 
370 #define EPT_PROTOCOL_STRING_PADDED_LENGTH 32
371 
378 typedef struct RdmnetEptSubProtocol
379 {
381  uint16_t manufacturer_id;
383  uint16_t protocol_id;
385  const char* protocol_string;
387 
389 typedef struct RdmnetEptClientEntry
390 {
393  size_t num_protocols;
395 
397 typedef struct RdmnetRptClientList
398 {
411 
413 typedef struct RdmnetEptClientList
414 {
427 
438 typedef struct LlrpRdmCommand
439 {
443  uint32_t seq_num;
450  RdmCommandHeader rdm_header;
452  const uint8_t* data;
454  uint8_t data_len;
456 
458 typedef struct LlrpSavedRdmCommand
459 {
463  uint32_t seq_num;
470  RdmCommandHeader rdm_header;
472  uint8_t data[RDM_MAX_PDL];
474  uint8_t data_len;
476 
478 typedef struct LlrpRdmResponse
479 {
483  uint32_t seq_num;
485  RdmResponseHeader rdm_header;
487  const uint8_t* rdm_data;
489  uint8_t rdm_data_len;
491 
493 typedef struct LlrpSavedRdmResponse
494 {
498  uint32_t seq_num;
500  RdmResponseHeader rdm_header;
502  uint8_t rdm_data[RDM_MAX_PDL];
504  uint8_t rdm_data_len;
506 
511 const char* rdmnet_rpt_client_type_to_string(rpt_client_type_t client_type);
512 
516  RdmnetSavedRdmResponse* previously_saved_response);
518 
520  RdmnetSavedRdmResponse* saved_resp_new);
522  RdmnetSavedRptStatus* saved_status_new);
523 
526 
529 
532  RdmnetSavedEptStatus* saved_status_new);
533 
536 
540  LlrpSavedRdmResponse* saved_resp_new);
541 
542 #ifdef __cplusplus
543 }
544 #endif
545 
550 #endif /* RDMNET_MESSAGE_H_ */
Functions and definitions common to all RDMnet API modules.
etcpal_error_t
struct RdmnetSavedEptData RdmnetSavedEptData
An EPT data message received over RDMnet and saved for later processing.
etcpal_error_t rdmnet_copy_saved_rdm_response(const RdmnetSavedRdmResponse *saved_resp_old, RdmnetSavedRdmResponse *saved_resp_new)
Copy the data from a saved RDM response to a different saved RDM response.
Definition: message.c:225
etcpal_error_t rdmnet_free_saved_rdm_response(RdmnetSavedRdmResponse *saved_response)
Free the memory owned by a saved RDM response.
Definition: message.c:265
etcpal_error_t rdmnet_free_saved_ept_status(RdmnetSavedEptStatus *saved_status)
Free the memory owned by a saved EPT status message.
Definition: message.c:424
struct RdmnetSavedRdmCommand RdmnetSavedRdmCommand
An RDM command received by this component and saved for a later response.
struct RdmnetEptStatus RdmnetEptStatus
An RDMnet EPT status message received by a local component.
ept_status_code_t
EPT status code definitions.
Definition: common.h:76
etcpal_error_t rdmnet_copy_saved_llrp_rdm_response(const LlrpSavedRdmResponse *saved_resp_old, LlrpSavedRdmResponse *saved_resp_new)
Copy the data from a saved LLRP RDM response to a different saved LLRP RDM response.
Definition: message.c:491
struct RdmnetSavedEptStatus RdmnetSavedEptStatus
An EPT status received over RDMnet and saved for later processing.
etcpal_error_t rdmnet_append_to_saved_rdm_response(const RdmnetRdmResponse *new_response, RdmnetSavedRdmResponse *previously_saved_response)
Append more data to a SavedRdmResponse's parameter data.
Definition: message.c:152
etcpal_error_t rdmnet_save_llrp_rdm_response(const LlrpRdmResponse *response, LlrpSavedRdmResponse *saved_response)
Save the data in a received LLRP RDM response for later use from a different context.
Definition: message.c:469
struct RdmnetDynamicUidAssignmentList RdmnetDynamicUidAssignmentList
A list of mappings from dynamic UIDs to responder IDs received from an RDMnet broker.
etcpal_error_t rdmnet_save_rdm_command(const RdmnetRdmCommand *command, RdmnetSavedRdmCommand *saved_command)
Save the data in a received RDM command for later use with API functions from a different context.
Definition: message.c:70
etcpal_error_t rdmnet_free_saved_rpt_status(RdmnetSavedRptStatus *saved_status)
Free the memory owned by a saved RPT status message.
Definition: message.c:291
struct LlrpRdmCommand LlrpRdmCommand
An RDM command received from a remote LLRP Manager.
struct RdmnetRdmCommand RdmnetRdmCommand
An RDMnet RDM command received by this component.
etcpal_error_t rdmnet_copy_saved_ept_data(const RdmnetSavedEptData *saved_data_old, RdmnetSavedEptData *saved_data_new)
Copy the data from a saved EPT data message to a different saved EPT data message.
Definition: message.c:368
struct RdmnetEptSubProtocol RdmnetEptSubProtocol
A description of an EPT sub-protocol.
struct RdmnetDynamicUidMapping RdmnetDynamicUidMapping
A mapping from a dynamic UID to a responder ID (RID).
struct RdmnetSavedRdmResponse RdmnetSavedRdmResponse
An RDM response received over RDMnet and saved for later processing.
struct LlrpRdmResponse LlrpRdmResponse
An RDM response received from a remote LLRP Target.
etcpal_error_t rdmnet_save_ept_data(const RdmnetEptData *data, RdmnetSavedEptData *saved_data)
Save the data in a received EPT data message for later use from a different context.
Definition: message.c:323
etcpal_error_t rdmnet_save_llrp_rdm_command(const LlrpRdmCommand *command, LlrpSavedRdmCommand *saved_command)
Save the data in a received LLRP RDM command for later use with API functions from a different contex...
Definition: message.c:443
struct RdmnetRdmResponse RdmnetRdmResponse
An RDMnet RDM response received by a local component.
rpt_client_type_t
An RPT client type.
Definition: message.h:351
rpt_status_code_t
RPT status code definitions.
Definition: common.h:53
etcpal_error_t rdmnet_free_saved_ept_data(RdmnetSavedEptData *saved_data)
Free the memory owned by a saved EPT data message.
Definition: message.c:407
etcpal_error_t rdmnet_save_rpt_status(const RdmnetRptStatus *status, RdmnetSavedRptStatus *saved_status)
Save the data in a received RPT status message for later use from a different context.
Definition: message.c:178
etcpal_error_t rdmnet_copy_saved_rpt_status(const RdmnetSavedRptStatus *saved_status_old, RdmnetSavedRptStatus *saved_status_new)
Copy the data from a saved RPT status message to a different saved RPT status message.
Definition: message.c:246
struct LlrpSavedRdmCommand LlrpSavedRdmCommand
An RDM command received from a remote LLRP Manager.
etcpal_error_t rdmnet_save_rdm_response(const RdmnetRdmResponse *response, RdmnetSavedRdmResponse *saved_response)
Save the data in a received RDM response for later use from a different context.
Definition: message.c:102
const char * rdmnet_rpt_client_type_to_string(rpt_client_type_t client_type)
Get a string description of an RPT client type.
Definition: message.c:50
etcpal_error_t rdmnet_copy_saved_ept_status(const RdmnetSavedEptStatus *saved_status_old, RdmnetSavedEptStatus *saved_status_new)
Copy the data from a saved EPT status message to a different saved EPT status message.
Definition: message.c:388
struct RdmnetEptData RdmnetEptData
An RDMnet EPT data message received by a local component.
struct RdmnetEptClientEntry RdmnetEptClientEntry
A descriptive structure for an EPT client.
struct RdmnetEptClientList RdmnetEptClientList
A structure that represents a list of EPT Client Entries.
struct LlrpSavedRdmResponse LlrpSavedRdmResponse
An RDM command received from a remote LLRP Manager.
etcpal_error_t rdmnet_save_ept_status(const RdmnetEptStatus *status, RdmnetSavedEptStatus *saved_status)
Save the data in a received EPT status message for later use from a different context.
Definition: message.c:348
struct RdmnetRptStatus RdmnetRptStatus
An RDMnet RPT status message received by a local component.
struct RdmnetSavedRptStatus RdmnetSavedRptStatus
An RPT status received over RDMnet and saved for later processing.
struct RdmnetRptClientList RdmnetRptClientList
A structure that represents a list of RPT Client Entries.
rdmnet_dynamic_uid_status_t
Dynamic UID Status Codes for the BrokerDynamicUidMapping struct.
Definition: common.h:134
struct RdmnetRptClientEntry RdmnetRptClientEntry
A descriptive structure for an RPT client.
@ kRPTClientTypeDevice
An RPT device receives RDM commands and sends responses.
Definition: message.h:353
@ kRPTClientTypeUnknown
A placeholder for when a type has not been determined.
Definition: message.h:357
@ kRPTClientTypeController
An RPT controller originates RDM commands and receives responses.
Definition: message.h:355
An RDM command received from a remote LLRP Manager.
Definition: message.h:439
uint32_t seq_num
The sequence number received with this command, to be echoed in the corresponding response.
Definition: message.h:443
const uint8_t * data
Pointer to buffer containing any associated RDM parameter data.
Definition: message.h:452
uint8_t data_len
The length of any associated RDM parameter data.
Definition: message.h:454
EtcPalUuid source_cid
The CID of the LLRP Manager from which this command was received.
Definition: message.h:441
RdmCommandHeader rdm_header
The header information from the encapsulated RDM command.
Definition: message.h:450
RdmnetMcastNetintId netint_id
An ID for the network interface on which this command was received.
Definition: message.h:448
An RDM response received from a remote LLRP Target.
Definition: message.h:479
const uint8_t * rdm_data
Any parameter data associated with the RDM response.
Definition: message.h:487
EtcPalUuid source_cid
The CID of the LLRP Target from which this command was received.
Definition: message.h:481
uint32_t seq_num
The sequence number of this response (to be associated with a previously-sent command).
Definition: message.h:483
RdmResponseHeader rdm_header
The header information from the encapsulated RDM response.
Definition: message.h:485
uint8_t rdm_data_len
The length of the parameter data associated with the RDM response.
Definition: message.h:489
An RDM command received from a remote LLRP Manager.
Definition: message.h:459
uint8_t data[RDM_MAX_PDL]
Pointer to buffer containing any associated RDM parameter data.
Definition: message.h:472
uint8_t data_len
The length of any associated RDM parameter data.
Definition: message.h:474
uint32_t seq_num
The sequence number received with this command, to be echoed in the corresponding response.
Definition: message.h:463
RdmCommandHeader rdm_header
The header information from the encapsulated RDM command.
Definition: message.h:470
EtcPalUuid source_cid
The CID of the LLRP Manager from which this command was received.
Definition: message.h:461
RdmnetMcastNetintId netint_id
An ID for the network interface on which this command was received.
Definition: message.h:468
An RDM command received from a remote LLRP Manager.
Definition: message.h:494
uint32_t seq_num
The sequence number of this response (to be associated with a previously-sent command).
Definition: message.h:498
uint8_t rdm_data_len
The length of the parameter data associated with the RDM response.
Definition: message.h:504
uint8_t rdm_data[RDM_MAX_PDL]
Any parameter data associated with the RDM response.
Definition: message.h:502
EtcPalUuid source_cid
The CID of the LLRP Target from which this command was received.
Definition: message.h:496
RdmResponseHeader rdm_header
The header information from the encapsulated RDM response.
Definition: message.h:500
A list of mappings from dynamic UIDs to responder IDs received from an RDMnet broker.
Definition: message.h:245
bool more_coming
This message contains a partial list.
Definition: message.h:256
size_t num_mappings
The size of the mappings array.
Definition: message.h:249
RdmnetDynamicUidMapping * mappings
An array of dynamic UID mappings.
Definition: message.h:247
A mapping from a dynamic UID to a responder ID (RID).
Definition: message.h:234
EtcPalUuid rid
The corresponding RID to which the dynamic UID is mapped.
Definition: message.h:240
RdmUid uid
The dynamic UID.
Definition: message.h:238
rdmnet_dynamic_uid_status_t status_code
The response code - indicates whether the broker was able to assign or look up dynamic UID.
Definition: message.h:236
A descriptive structure for an EPT client.
Definition: message.h:390
EtcPalUuid cid
The client's Component Identifier (CID).
Definition: message.h:391
size_t num_protocols
The size of the protocols array.
Definition: message.h:393
RdmnetEptSubProtocol * protocols
A list of EPT protocols that this client implements.
Definition: message.h:392
A structure that represents a list of EPT Client Entries.
Definition: message.h:414
RdmnetEptClientEntry * client_entries
An array of EPT Client Entries.
Definition: message.h:416
bool more_coming
This message contains a partial list.
Definition: message.h:425
size_t num_client_entries
The size of the client_entries array.
Definition: message.h:418
An RDMnet EPT data message received by a local component.
Definition: message.h:270
EtcPalUuid source_cid
The CID of the EPT client that sent this data.
Definition: message.h:272
uint16_t protocol_id
The protocol ID that identifies the EPT sub-protocol.
Definition: message.h:276
uint16_t manufacturer_id
The ESTA manufacturer ID that identifies the EPT sub-protocol.
Definition: message.h:274
const uint8_t * data
The data associated with this EPT message.
Definition: message.h:278
size_t data_len
The length of the data associated with this EPT message.
Definition: message.h:280
An RDMnet EPT status message received by a local component.
Definition: message.h:309
EtcPalUuid source_cid
The CID of the EPT client that sent this status message.
Definition: message.h:311
const char * status_string
An optional implementation-defined status string to accompany this status message.
Definition: message.h:315
ept_status_code_t status_code
A status code that indicates the specific error or status condition.
Definition: message.h:313
A description of an EPT sub-protocol.
Definition: message.h:379
uint16_t protocol_id
The identifier for this protocol.
Definition: message.h:383
const char * protocol_string
A descriptive string for the protocol.
Definition: message.h:385
uint16_t manufacturer_id
The ESTA manufacturer ID under which this protocol is namespaced.
Definition: message.h:381
A set of identifying information for a network interface, for multicast purposes.
Definition: common.h:364
An RDMnet RDM command received by this component.
Definition: message.h:53
uint8_t data_len
The length of any associated RDM parameter data.
Definition: message.h:65
uint16_t dest_endpoint
The local endpoint to which this command is addressed.
Definition: message.h:57
RdmCommandHeader rdm_header
The header information from the encapsulated RDM command.
Definition: message.h:61
uint32_t seq_num
The command's sequence number, to be echoed in its response.
Definition: message.h:59
const uint8_t * data
Pointer to buffer containing any associated RDM parameter data.
Definition: message.h:63
RdmUid rdmnet_source_uid
The UID of the component that sent this command.
Definition: message.h:55
An RDMnet RDM response received by a local component.
Definition: message.h:90
RdmCommandHeader original_cmd_header
The header of the original command associated with this response; valid if seq_num !...
Definition: message.h:104
uint8_t original_cmd_data_len
The length of the parameter data associated with the original RDM command; valid if seq_num !...
Definition: message.h:111
const uint8_t * original_cmd_data
Any parameter data associated with the original RDM command; valid if seq_num != 0.
Definition: message.h:106
size_t rdm_data_len
The length of the parameter data associated with the RDM response.
Definition: message.h:118
RdmUid rdmnet_source_uid
The UID of the RDMnet component that sent this response.
Definition: message.h:92
uint16_t source_endpoint
The endpoint from which the response was sent.
Definition: message.h:94
bool is_response_to_me
Whether the response was sent in response to a command previously sent by this controller.
Definition: message.h:101
RdmResponseHeader rdm_header
The header information from the encapsulated RDM response.
Definition: message.h:114
const uint8_t * rdm_data
Any parameter data associated with the RDM response.
Definition: message.h:116
bool more_coming
This message contains partial RDM data.
Definition: message.h:127
uint32_t seq_num
The sequence number of the response, for matching with a corresponding command.
Definition: message.h:96
A descriptive structure for an RPT client.
Definition: message.h:362
EtcPalUuid binding_cid
An optional identifier for another component that the client is associated with.
Definition: message.h:366
EtcPalUuid cid
The client's Component Identifier (CID).
Definition: message.h:363
rpt_client_type_t type
Whether the client is a controller or device.
Definition: message.h:365
RdmUid uid
The client's RDM UID.
Definition: message.h:364
A structure that represents a list of RPT Client Entries.
Definition: message.h:398
RdmnetRptClientEntry * client_entries
An array of RPT Client Entries.
Definition: message.h:400
size_t num_client_entries
The size of the client_entries array.
Definition: message.h:402
bool more_coming
This message contains a partial list.
Definition: message.h:409
An RDMnet RPT status message received by a local component.
Definition: message.h:193
RdmUid source_uid
The UID of the RDMnet component that sent this status message.
Definition: message.h:195
const char * status_string
An optional implementation-defined status string to accompany this status message.
Definition: message.h:203
uint32_t seq_num
The sequence number of the status message, for matching with a corresponding command.
Definition: message.h:199
uint16_t source_endpoint
The endpoint from which the status message was sent.
Definition: message.h:197
rpt_status_code_t status_code
A status code that indicates the specific error or status condition.
Definition: message.h:201
An EPT data message received over RDMnet and saved for later processing.
Definition: message.h:291
EtcPalUuid source_cid
The CID of the EPT client that sent this data.
Definition: message.h:293
uint16_t protocol_id
The protocol ID that identifies the EPT sub-protocol.
Definition: message.h:297
const uint8_t * data
The data associated with this EPT message.
Definition: message.h:302
uint16_t manufacturer_id
The ESTA manufacturer ID that identifies the EPT sub-protocol.
Definition: message.h:295
size_t data_len
The length of the data associated with this EPT message.
Definition: message.h:304
An EPT status received over RDMnet and saved for later processing.
Definition: message.h:327
ept_status_code_t status_code
A status code that indicates the specific error or status condition.
Definition: message.h:331
const char * status_string
An optional implementation-defined status string to accompany this status message.
Definition: message.h:337
EtcPalUuid source_cid
The CID of the EPT client that sent this status message.
Definition: message.h:329
An RDM command received by this component and saved for a later response.
Definition: message.h:73
uint16_t dest_endpoint
The local endpoint to which this command is addressed.
Definition: message.h:77
uint8_t data[RDM_MAX_PDL]
Buffer containing any associated RDM parameter data.
Definition: message.h:83
uint8_t data_len
The length of any associated RDM parameter data.
Definition: message.h:85
RdmCommandHeader rdm_header
The header information from the encapsulated RDM command.
Definition: message.h:81
uint32_t seq_num
The command's sequence number, to be echoed in its response.
Definition: message.h:79
RdmUid rdmnet_source_uid
The UID of the component that sent this command.
Definition: message.h:75
An RDM response received over RDMnet and saved for later processing.
Definition: message.h:138
uint8_t * rdm_data
Any parameter data associated with the RDM response.
Definition: message.h:167
RdmResponseHeader rdm_header
The header information from the encapsulated RDM response.
Definition: message.h:162
RdmUid rdmnet_source_uid
The UID of the RDMnet component that sent this response.
Definition: message.h:140
uint16_t source_endpoint
The endpoint from which the response was sent.
Definition: message.h:142
bool is_response_to_me
Whether the response was sent in response to a command previously sent by this controller.
Definition: message.h:149
size_t rdm_data_len
The length of the parameter data associated with the RDM response.
Definition: message.h:169
uint32_t seq_num
The sequence number of the response, for matching with a corresponding command.
Definition: message.h:144
uint8_t original_cmd_data[RDM_MAX_PDL]
Any parameter data associated with the original RDM command; valid if seq_num != 0.
Definition: message.h:154
RdmCommandHeader original_cmd_header
The header of the original command associated with this response; valid if seq_num !...
Definition: message.h:152
uint8_t original_cmd_data_len
The length of the parameter data associated with the original RDM command; valid if seq_num !...
Definition: message.h:159
An RPT status received over RDMnet and saved for later processing.
Definition: message.h:215
uint16_t source_endpoint
The endpoint from which the status message was sent.
Definition: message.h:219
uint32_t seq_num
The sequence number of the status message, for matching with a corresponding command.
Definition: message.h:221
char * status_string
An optional implementation-defined status string to accompany this status message.
Definition: message.h:229
RdmUid source_uid
The UID of the RDMnet component that sent this status message.
Definition: message.h:217
rpt_status_code_t status_code
A status code that indicates the specific error or status condition.
Definition: message.h:223