lwpa  0.1.0
LightWeight Platform Abstraction (lwpa)
View other versions:
estardmnet.h
1 /******************************************************************************
2 ************************* IMPORTANT NOTE -- READ ME!!! ************************
3 *******************************************************************************
4 * THIS SOFTWARE IMPLEMENTS A **DRAFT** STANDARD, BSR E1.33 REV. 63. UNDER NO
5 * CIRCUMSTANCES SHOULD THIS SOFTWARE BE USED FOR ANY PRODUCT AVAILABLE FOR
6 * GENERAL SALE TO THE PUBLIC. DUE TO THE INEVITABLE CHANGE OF DRAFT PROTOCOL
7 * VALUES AND BEHAVIORAL REQUIREMENTS, PRODUCTS USING THIS SOFTWARE WILL **NOT**
8 * BE INTEROPERABLE WITH PRODUCTS IMPLEMENTING THE FINAL RATIFIED STANDARD.
9 *******************************************************************************
10 * Copyright 2018 ETC Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *******************************************************************************
24 * This file is a part of RDMnet. For more information, go to:
25 * https://github.com/ETCLabs/RDMnet
26 ******************************************************************************/
27 
28 /******************************************************************************
29  * Entertainment Services Technology Association (ESTA)
30  * BSR E1.33 (RDMnet) Message Transport and Device Management of ANSI E1.20
31  * (RDM) over IP Networks
32  ******************************************************************************
33  * Appendix A Defines for all RDMnet Protocols.
34  * This header is meant as a companion to the RDM.h that is available on
35  * http://www.rdmprotocol.org.
36  *****************************************************************************/
37 
38 /* clang-format off */
39 
40 /* Protocol version. */
41 #define E133_VERSION 1
42 
43 #define E133_MDNS_IPV4_MULTICAST_ADDRESS "224.0.0.251"
44 #define E133_MDNS_IPV6_MULTICAST_ADDRESS "ff02::fb"
45 #define E133_MDNS_PORT 5353
46 #define E133_DEFAULT_SCOPE "default"
47 #define E133_DEFAULT_DOMAIN "local."
48 
49 /* TODO: THIS IS A DRAFT type. The SRV_TYPE includes the service protocol and
50  * has the prepended '_' in all fields */
51 #define E133_DNSSD_SRV_TYPE "_draft-e133._tcp."
52 #define E133_DNSSD_TXTVERS 1
53 #define E133_DNSSD_E133VERS 1
54 
55 #define E133_TCP_HEARTBEAT_INTERVAL_SEC 15 /* seconds */
56 #define E133_HEARTBEAT_TIMEOUT_SEC 45 /* seconds */
57 #define E133_CONTROLLER_BACKOFF_SEC 6 /* seconds */
58 
59 #define E133_NULL_ENDPOINT 0x0000u
60 #define E133_BROADCAST_ENDPOINT 0xFFFFu
61 
62 /* Not in tables, but defined elsewhere in the standard */
63 #define E133_SCOPE_STRING_PADDED_LENGTH 64 /* Section 6.2.1, 6.3.1.2 */
64 #define E133_DOMAIN_STRING_PADDED_LENGTH 231 /* Section 6.3.1.2 */
65 #define E133_SERVICE_NAME_STRING_PADDED_LENGTH 64 /* RFC676 4.1.1 */
66 #define E133_MODEL_STRING_PADDED_LENGTH 250 /* Section 7.2.1 */
67 #define E133_MANUFACTURER_STRING_PADDED_LENGTH 250 /* Section 7.2.1 */
68 
69 #define LLRP_FILTERVAL_CLIENT_CONN_INACTIVE 0x01u
70 #define LLRP_FILTERVAL_BROKERS_ONLY 0x02u
71 
72 /******************************************************************************
73  * Table A-1: Broadcast UID Defines
74  *****************************************************************************/
75 #define E133_RPT_ALL_CONTROLLERS 0xFFFCFFFFFFFF
76 #define E133_RPT_ALL_DEVICES 0xFFFDFFFFFFFF
77 /* #define E133_RPT_ALL_MID_DEVICES 0xFFFDmmmmFFFF (Specific
78  * Manufacturer ID 0xmmmm) */
79 
80 /******************************************************************************
81  * Table A-2: LLRP Constants
82  *****************************************************************************/
83 #define LLRP_MULTICAST_IPV4_ADDRESS_REQUEST "239.255.250.133"
84 #define LLRP_MULTICAST_IPV4_ADDRESS_RESPONSE "239.255.250.134"
85 #define LLRP_MULTICAST_IPV6_ADDRESS_REQUEST "ff18::85:0:0:85"
86 #define LLRP_MULTICAST_IPV6_ADDRESS_RESPONSE "ff18::85:0:0:86"
87 #define LLRP_PORT 5569
88 #define LLRP_TIMEOUT_MS 2000 /* milliseconds */
89 #define LLRP_TARGET_TIMEOUT_MS 500 /* milliseconds */
90 #define LLRP_MAX_BACKOFF_MS 1500 /* milliseconds */
91 #define LLRP_KNOWN_UID_SIZE 200
92 #define LLRP_BROADCAST_CID "FBAD822C-BD0C-4D4C-BDC8-7EABEBC85AFF"
93 
94 /******************************************************************************
95  * Table A-4: Vector Defines for LLRP PDU
96  *****************************************************************************/
97 #define VECTOR_LLRP_PROBE_REQUEST 0x00000001 /* Section 5.4.2.1 */
98 #define VECTOR_LLRP_PROBE_REPLY 0x00000002 /* Section 5.4.2.2 */
99 #define VECTOR_LLRP_RDM_CMD 0x00000003 /* Section 5.4.2.3 */
100 
101 /******************************************************************************
102  * Table A-5: Vector Defines for Broker PDU
103  *****************************************************************************/
104 #define VECTOR_BROKER_FETCH_CLIENT_LIST 0x0001 /* Section 6.3.1.7 */
105 #define VECTOR_BROKER_CONNECTED_CLIENT_LIST 0x0002 /* Section 6.3.1.8 */
106 #define VECTOR_BROKER_CLIENT_ADD 0x0003 /* Section 6.3.1.9 */
107 #define VECTOR_BROKER_CLIENT_REMOVE 0x0004 /* Section 6.3.1.10 */
108 #define VECTOR_BROKER_CLIENT_ENTRY_CHANGE 0x0005 /* Section 6.3.1.11 */
109 #define VECTOR_BROKER_CONNECT 0x0006 /* Section 6.3.1.2 */
110 #define VECTOR_BROKER_CONNECT_REPLY 0x0007 /* Section 6.3.1.3 */
111 #define VECTOR_BROKER_CLIENT_ENTRY_UPDATE 0x0008 /* Section 6.3.1.4 */
112 #define VECTOR_BROKER_REDIRECT_V4 0x0009 /* Section 6.3.1.5 */
113 #define VECTOR_BROKER_REDIRECT_V6 0x000A /* Section 6.3.1.6 */
114 #define VECTOR_BROKER_DISCONNECT 0x000B /* Section 6.3.1.12 */
115 #define VECTOR_BROKER_NULL 0x000C /* Section 6.3.1.13 */
116 
117 /******************************************************************************
118  * Table A-6: Vector Defines for RPT PDU
119  *****************************************************************************/
120 #define VECTOR_RPT_REQUEST 0x00000001 /* Section 7.5.2 */
121 #define VECTOR_RPT_STATUS 0x00000002 /* Section 7.5.3 */
122 #define VECTOR_RPT_NOTIFICATION 0x00000003 /* Section 7.5.4 */
123 
124 /******************************************************************************
125  * Table A-7: Vector Defines for Request PDU
126  *****************************************************************************/
127 #define VECTOR_REQUEST_RDM_CMD 0x01 /* Section 7.5.2 */
128 
129 /******************************************************************************
130  * Table A-8: Vector Defines for RPT Status PDU
131  *****************************************************************************/
132 #define VECTOR_RPT_STATUS_UNKNOWN_RPT_UID 0x0001 /* Section 7.5.3.2 */
133 #define VECTOR_RPT_STATUS_RDM_TIMEOUT 0x0002 /* Section 7.5.3.3 */
134 #define VECTOR_RPT_STATUS_RDM_INVALID_RESPONSE 0x0003 /* Section 7.5.3.4 */
135 #define VECTOR_RPT_STATUS_UNKNOWN_RDM_UID 0x0004 /* Section 7.5.3.5 */
136 #define VECTOR_RPT_STATUS_UNKNOWN_ENDPOINT 0x0005 /* Section 7.5.3.6 */
137 #define VECTOR_RPT_STATUS_BROADCAST_COMPLETE 0x0006 /* Section 7.5.3.7 */
138 #define VECTOR_RPT_STATUS_UNKNOWN_VECTOR 0x0007 /* Section 7.5.3.8 */
139 #define VECTOR_RPT_STATUS_INVALID_MESSAGE 0x0008 /* Section 7.5.3.9 */
140 #define VECTOR_RPT_STATUS_INVALID_COMMAND_CLASS 0x0009 /* Section 7.5.3.10 */
141 
142 /******************************************************************************
143  * Table A-9: Vector Defines for Notification PDU
144  *****************************************************************************/
145 #define VECTOR_NOTIFICATION_RDM_CMD 0x01 /* Section 7.5.4 */
146 
147 /******************************************************************************
148  * Table A-10: Vector Defines for RDM Command PDU
149  *****************************************************************************/
150 #define VECTOR_RDM_CMD_RDM_DATA 0xCC /* Section 7.5.5 */
151 
152 /******************************************************************************
153  * Table A-11: Vector Defines for EPT PDU
154  *****************************************************************************/
155 #define VECTOR_EPT_DATA 0x00000001 /* Section 8.3.3 */
156 #define VECTOR_EPT_STATUS 0x00000002 /* Section 8.3.4 */
157 
158 /******************************************************************************
159  * Table A-12: Vector Defines for EPT Status PDU
160  *****************************************************************************/
161 #define VECTOR_EPT_STATUS_UNKNOWN_CID 0x0001 /* Section 8.3.4.2 */
162 #define VECTOR_EPT_STATUS_UNKNOWN_VECTOR 0x0002 /* Section 8.3.4.3 */
163 
164 /******************************************************************************
165  * Table A-13: RDM Parameter ID Defines
166  *****************************************************************************/
167 /* Category - E1.33 Management */
168 #define E133_COMPONENT_SCOPE 0x7FEF
169 #define E133_BROKER_STATIC_CONFIG_IPV4 0x7FD2
170 #define E133_BROKER_STATIC_CONFIG_IPV6 0x7FD5
171 #define E133_SEARCH_DOMAIN 0x7FE0
172 #define E133_TCP_COMMS_STATUS 0x7FED
173 #define E133_DUPLICATE_UID_DETECTED 0x7FEE
174 
175 /******************************************************************************
176  * Table A-14: Additional Response NACK Reason Codes
177  *****************************************************************************/
178 #define E133_NR_ACTION_NOT_SUPPORTED 0x0010
179 #define E133_NR_UNKNOWN_SCOPE 0x0012
180 
181 /******************************************************************************
182  * Table A-15: Connection Status Codes for Broker Connect
183  *****************************************************************************/
184 #define E133_CONNECT_OK 0x0000 /* Section 9.1.5 */
185 #define E133_CONNECT_SCOPE_MISMATCH 0x0002 /* Section 9.1.5 */
186 #define E133_CONNECT_CAPACITY_EXCEEDED 0x0003 /* Section 9.1.5 */
187 #define E133_CONNECT_DUPLICATE_UID 0x0004 /* Section 9.1.5 */
188 #define E133_CONNECT_INVALID_CLIENT_ENTRY 0x0005 /* Section 9.1.5 */
189 
190 /******************************************************************************
191  * Table A-16: Client Protocol Codes
192  *****************************************************************************/
193 #define E133_CLIENT_PROTOCOL_RPT 0x00000005u /* Section 6.3.2 */
194 #define E133_CLIENT_PROTOCOL_EPT 0x0000000Bu /* Section 6.3.2 */
195 
196 /******************************************************************************
197  * Table A-17: RPT Client Type Codes
198  *****************************************************************************/
199 #define E133_RPT_CLIENT_TYPE_DEVICE 0x0000 /* Section 6.3.2.2 */
200 #define E133_RPT_CLIENT_TYPE_CONTROLLER 0x0001 /* Section 6.3.2.2 */
201 
202 /******************************************************************************
203  * Table A-18: LLRP Component Type Codes
204  *****************************************************************************/
205 #define LLRP_COMPONENT_TYPE_RPT_DEVICE 0x00
206 #define LLRP_COMPONENT_TYPE_RPT_CONTROLLER 0x01
207 #define LLRP_COMPONENT_TYPE_BROKER 0x02
208 #define LLRP_COMPONENT_TYPE_UNKNOWN 0x03
209 
210 /******************************************************************************
211  * Table A-19: RPT Client Disconnect Reason Codes
212  *****************************************************************************/
213 #define E133_DISCONNECT_SHUTDOWN 0x0000
214 #define E133_DISCONNECT_CAPACITY_EXHAUSTED 0x0001
215 #define E133_DISCONNECT_INCORRECT_CLIENT_TYPE 0x0002
216 #define E133_DISCONNECT_HARDWARE_FAULT 0x0003
217 #define E133_DISCONNECT_SOFTWARE_FAULT 0x0004
218 #define E133_DISCONNECT_SOFTWARE_RESET 0x0005
219 #define E133_DISCONNECT_INCORRECT_SCOPE 0x0006
220 #define E133_DISCONNECT_LLRP_RECONFIGURE 0x0007
221 #define E133_DISCONNECT_USER_RECONFIGURE 0x0008