RDMnet  0.3.0
Implementation of ANSI E1.33 (RDMnet)
View other versions:
defs.h
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 
20 #ifndef RDMNET_DEFS_H_
21 #define RDMNET_DEFS_H_
22 
23 /******************************************************************************
24  * Entertainment Services Technology Association (ESTA)
25  * ANSI E1.33 (RDMnet) Message Transport and Device Management of ANSI E1.20
26  * (RDM) over IP Networks
27  ******************************************************************************
28  * Appendix A Defines for all RDMnet Protocols.
29  * This header is meant as a companion to the RDM.h that is available on
30  * http://www.rdmprotocol.org.
31  *****************************************************************************/
32 
33 /* clang-format off */
34 
35 /* Protocol version. */
36 #define E133_VERSION 1
37 
38 #define E133_MDNS_IPV4_MULTICAST_ADDRESS "224.0.0.251"
39 #define E133_MDNS_IPV6_MULTICAST_ADDRESS "ff02::fb"
40 #define E133_MDNS_PORT 5353
41 #define E133_DEFAULT_SCOPE "default"
42 #define E133_DEFAULT_DOMAIN "local."
43 
44 /* The SRV_TYPE includes the service protocol and has the prepended '_' in all fields */
45 #define E133_DNSSD_SRV_TYPE "_rdmnet._tcp."
46 #define E133_DNSSD_SRV_TYPE_PADDED_LENGTH (sizeof(E133_DNSSD_SRV_TYPE))
47 #define E133_DNSSD_TXTVERS 1
48 #define E133_DNSSD_E133VERS 1
49 
50 #define E133_TCP_HEARTBEAT_INTERVAL_SEC 15 /* seconds */
51 #define E133_HEARTBEAT_TIMEOUT_SEC 45 /* seconds */
52 #define E133_CONTROLLER_BACKOFF_SEC 6 /* seconds */
53 
54 #define E133_NULL_ENDPOINT 0x0000u
55 #define E133_BROADCAST_ENDPOINT 0xFFFFu
56 
57 /* Not in tables, but defined elsewhere in the standard */
58 #define E133_SCOPE_STRING_PADDED_LENGTH 63u /* Section 6.2.1, 6.3.1.2 */
59 #define E133_DOMAIN_STRING_PADDED_LENGTH 231u /* Section 6.3.1.2 */
60 #define E133_SERVICE_NAME_STRING_PADDED_LENGTH 64u /* RFC676 4.1.1 */
61 #define E133_MODEL_STRING_PADDED_LENGTH 250u /* Section 7.2.1 */
62 #define E133_MANUFACTURER_STRING_PADDED_LENGTH 250u /* Section 7.2.1 */
63 
64 #define LLRP_FILTERVAL_CLIENT_CONN_INACTIVE 0x0001u
65 #define LLRP_FILTERVAL_BROKERS_ONLY 0x0002u
66 
67 /******************************************************************************
68  * Table A-1: Broadcast UID Defines
69  *****************************************************************************/
70 #define E133_RPT_ALL_CONTROLLERS 0xFFFCFFFFFFFF
71 #define E133_RPT_ALL_DEVICES 0xFFFDFFFFFFFF
72 /* #define E133_RPT_ALL_MID_DEVICES 0xFFFDmmmmFFFF (Specific Manufacturer ID 0xmmmm) */
73 
74 /******************************************************************************
75  * Table A-2: LLRP Constants
76  *****************************************************************************/
77 #define LLRP_MULTICAST_IPV4_ADDRESS_REQUEST "239.255.250.133"
78 #define LLRP_MULTICAST_IPV4_ADDRESS_RESPONSE "239.255.250.134"
79 #define LLRP_MULTICAST_IPV6_ADDRESS_REQUEST "ff18::85:0:0:85"
80 #define LLRP_MULTICAST_IPV6_ADDRESS_RESPONSE "ff18::85:0:0:86"
81 #define LLRP_PORT 5569
82 #define LLRP_TIMEOUT_MS 2000 /* milliseconds */
83 #define LLRP_TARGET_TIMEOUT_MS 500 /* milliseconds */
84 #define LLRP_MAX_BACKOFF_MS 1500 /* milliseconds */
85 #define LLRP_KNOWN_UID_SIZE 200
86 #define LLRP_BROADCAST_CID "fbad822c-bd0c-4d4c-bdc8-7eabebc85aff"
87 
88 /******************************************************************************
89  * Table A-4: Vector Defines for LLRP PDU
90  *****************************************************************************/
91 #define VECTOR_LLRP_PROBE_REQUEST 0x00000001 /* Section 5.4.2.1 */
92 #define VECTOR_LLRP_PROBE_REPLY 0x00000002 /* Section 5.4.2.2 */
93 #define VECTOR_LLRP_RDM_CMD 0x00000003 /* Section 5.4.2.3 */
94 
95 /******************************************************************************
96  * Table A-5: Vector Defines for LLRP Probe Request PDU
97  *****************************************************************************/
98 #define VECTOR_PROBE_REQUEST_DATA 0x01
99 
100 /******************************************************************************
101  * Table A-6: Vector Defines for LLRP Probe Reply PDU
102  *****************************************************************************/
103 #define VECTOR_PROBE_REPLY_DATA 0x01
104 
105 /******************************************************************************
106  * Table A-7: Vector Defines for Broker PDU
107  *****************************************************************************/
108 #define VECTOR_BROKER_CONNECT 0x0001 /* Section 6.3.1.2 */
109 #define VECTOR_BROKER_CONNECT_REPLY 0x0002 /* Section 6.3.1.3 */
110 #define VECTOR_BROKER_CLIENT_ENTRY_UPDATE 0x0003 /* Section 6.3.1.4 */
111 #define VECTOR_BROKER_REDIRECT_V4 0x0004 /* Section 6.3.1.5 */
112 #define VECTOR_BROKER_REDIRECT_V6 0x0005 /* Section 6.3.1.6 */
113 #define VECTOR_BROKER_FETCH_CLIENT_LIST 0x0006 /* Section 6.3.1.7 */
114 #define VECTOR_BROKER_CONNECTED_CLIENT_LIST 0x0007 /* Section 6.3.1.8 */
115 #define VECTOR_BROKER_CLIENT_ADD 0x0008 /* Section 6.3.1.9 */
116 #define VECTOR_BROKER_CLIENT_REMOVE 0x0009 /* Section 6.3.1.10 */
117 #define VECTOR_BROKER_CLIENT_ENTRY_CHANGE 0x000A /* Section 6.3.1.11 */
118 #define VECTOR_BROKER_REQUEST_DYNAMIC_UIDS 0x000B /* Section 6.3.1.12 */
119 #define VECTOR_BROKER_ASSIGNED_DYNAMIC_UIDS 0x000C /* Section 6.3.1.13 */
120 #define VECTOR_BROKER_FETCH_DYNAMIC_UID_LIST 0x000D /* Section 6.3.1.14 */
121 #define VECTOR_BROKER_DISCONNECT 0x000E /* Section 6.3.1.15 */
122 #define VECTOR_BROKER_NULL 0x000F /* Section 6.3.1.16 */
123 
124 /******************************************************************************
125  * Table A-8: Vector Defines for RPT PDU
126  *****************************************************************************/
127 #define VECTOR_RPT_REQUEST 0x00000001 /* Section 7.5.2 */
128 #define VECTOR_RPT_STATUS 0x00000002 /* Section 7.5.3 */
129 #define VECTOR_RPT_NOTIFICATION 0x00000003 /* Section 7.5.4 */
130 
131 /******************************************************************************
132  * Table A-9: Vector Defines for Request PDU
133  *****************************************************************************/
134 #define VECTOR_REQUEST_RDM_CMD 0x01 /* Section 7.5.2 */
135 
136 /******************************************************************************
137  * Table A-10: Vector Defines for RPT Status PDU
138  *****************************************************************************/
139 #define VECTOR_RPT_STATUS_UNKNOWN_RPT_UID 0x0001 /* Section 7.5.3.2 */
140 #define VECTOR_RPT_STATUS_RDM_TIMEOUT 0x0002 /* Section 7.5.3.3 */
141 #define VECTOR_RPT_STATUS_RDM_INVALID_RESPONSE 0x0003 /* Section 7.5.3.4 */
142 #define VECTOR_RPT_STATUS_UNKNOWN_RDM_UID 0x0004 /* Section 7.5.3.5 */
143 #define VECTOR_RPT_STATUS_UNKNOWN_ENDPOINT 0x0005 /* Section 7.5.3.6 */
144 #define VECTOR_RPT_STATUS_BROADCAST_COMPLETE 0x0006 /* Section 7.5.3.7 */
145 #define VECTOR_RPT_STATUS_UNKNOWN_VECTOR 0x0007 /* Section 7.5.3.8 */
146 #define VECTOR_RPT_STATUS_INVALID_MESSAGE 0x0008 /* Section 7.5.3.9 */
147 #define VECTOR_RPT_STATUS_INVALID_COMMAND_CLASS 0x0009 /* Section 7.5.3.10 */
148 
149 /******************************************************************************
150  * Table A-11: Vector Defines for Notification PDU
151  *****************************************************************************/
152 #define VECTOR_NOTIFICATION_RDM_CMD 0x01 /* Section 7.5.4 */
153 
154 /******************************************************************************
155  * Table A-12: Vector Defines for RDM Command PDU
156  *****************************************************************************/
157 #define VECTOR_RDM_CMD_RDM_DATA 0xCC /* Section 7.5.5 */
158 
159 /******************************************************************************
160  * Table A-13: Vector Defines for EPT PDU
161  *****************************************************************************/
162 #define VECTOR_EPT_DATA 0x00000001 /* Section 8.3.3 */
163 #define VECTOR_EPT_STATUS 0x00000002 /* Section 8.3.4 */
164 
165 /******************************************************************************
166  * Table A-14: Vector Defines for EPT Status PDU
167  *****************************************************************************/
168 #define VECTOR_EPT_STATUS_UNKNOWN_CID 0x0001 /* Section 8.3.4.2 */
169 #define VECTOR_EPT_STATUS_UNKNOWN_VECTOR 0x0002 /* Section 8.3.4.3 */
170 
171 /******************************************************************************
172  * Table A-15: RDM Parameter ID Defines
173  *****************************************************************************/
174 /* Category - E1.33 Management */
175 #define E133_COMPONENT_SCOPE 0x0800
176 #define E133_SEARCH_DOMAIN 0x0801
177 #define E133_TCP_COMMS_STATUS 0x0802
178 #define E133_BROKER_STATUS 0x0803
179 
180 /*
181  * E1.33's additional NACK reason codes are defined in rdm/defs.h:
182  * https://github.com/ETCLabs/RDM
183  */
184 
185 /******************************************************************************
186  * Table A-17: Static Config Type Definitions for COMPONENT_SCOPE Parameter
187  * Message
188  *****************************************************************************/
189 #define E133_NO_STATIC_CONFIG 0x00
190 #define E133_STATIC_CONFIG_IPV4 0x01
191 #define E133_STATIC_CONFIG_IPV6 0x02
192 
193 /******************************************************************************
194  * Table A-18: Broker State Definitions for BROKER_STATUS Parameter Message
195  *****************************************************************************/
196 #define E133_BROKER_DISABLED 0x00
197 #define E133_BROKER_ACTIVE 0x01
198 #define E133_BROKER_STANDBY 0x02
199 
200 /******************************************************************************
201  * Table A-19: Connection Status Codes for Broker Connect
202  *****************************************************************************/
203 #define E133_CONNECT_OK 0x0000 /* Section 9.1.5 */
204 #define E133_CONNECT_SCOPE_MISMATCH 0x0001 /* Section 9.1.5 */
205 #define E133_CONNECT_CAPACITY_EXCEEDED 0x0002 /* Section 9.1.5 */
206 #define E133_CONNECT_DUPLICATE_UID 0x0003 /* Section 9.1.5 */
207 #define E133_CONNECT_INVALID_CLIENT_ENTRY 0x0004 /* Section 9.1.5 */
208 #define E133_CONNECT_INVALID_UID 0x0005 /* Section 9.1.5 */
209 
210 /******************************************************************************
211  * Table A-20: Status Codes for Dynamic UID Mapping
212  *****************************************************************************/
213 #define E133_DYNAMIC_UID_STATUS_OK 0x0000
214 #define E133_DYNAMIC_UID_STATUS_INVALID_REQUEST 0x0001
215 #define E133_DYNAMIC_UID_STATUS_UID_NOT_FOUND 0x0002
216 #define E133_DYNAMIC_UID_STATUS_DUPLICATE_RID 0x0003
217 #define E133_DYNAMIC_UID_STATUS_CAPACITY_EXHAUSTED 0x0004
218 
219 /******************************************************************************
220  * Table A-21: Client Protocol Codes
221  *****************************************************************************/
222 #define E133_CLIENT_PROTOCOL_RPT 0x00000005u /* Section 6.3.2 */
223 #define E133_CLIENT_PROTOCOL_EPT 0x0000000Bu /* Section 6.3.2 */
224 
225 /******************************************************************************
226  * Table A-22: RPT Client Type Codes
227  *****************************************************************************/
228 #define E133_RPT_CLIENT_TYPE_DEVICE 0x0000 /* Section 6.3.2.2 */
229 #define E133_RPT_CLIENT_TYPE_CONTROLLER 0x0001 /* Section 6.3.2.2 */
230 
231 /******************************************************************************
232  * Table A-23: LLRP Component Type Codes
233  *****************************************************************************/
234 #define LLRP_COMPONENT_TYPE_RPT_DEVICE 0x00
235 #define LLRP_COMPONENT_TYPE_RPT_CONTROLLER 0x01
236 #define LLRP_COMPONENT_TYPE_BROKER 0x02
237 #define LLRP_COMPONENT_TYPE_NONRDMNET 0xFF
238 
239 /******************************************************************************
240  * Table A-24: RPT Client Disconnect Reason Codes
241  *****************************************************************************/
242 #define E133_DISCONNECT_SHUTDOWN 0x0000
243 #define E133_DISCONNECT_CAPACITY_EXHAUSTED 0x0001
244 #define E133_DISCONNECT_HARDWARE_FAULT 0x0002
245 #define E133_DISCONNECT_SOFTWARE_FAULT 0x0003
246 #define E133_DISCONNECT_SOFTWARE_RESET 0x0004
247 #define E133_DISCONNECT_INCORRECT_SCOPE 0x0005
248 #define E133_DISCONNECT_RPT_RECONFIGURE 0x0006
249 #define E133_DISCONNECT_LLRP_RECONFIGURE 0x0007
250 #define E133_DISCONNECT_USER_RECONFIGURE 0x0008
251 
252 #endif /* RDMNET_DEFS_H_ */