rustdds/structure/
parameter_id.rs

1use speedy::{Readable, Writable};
2use serde::{Deserialize, Serialize};
3
4#[derive(
5  Debug, PartialEq, Eq, Ord, PartialOrd, Readable, Writable, Copy, Clone, Serialize, Deserialize,
6)]
7pub struct ParameterId {
8  value: u16,
9}
10
11impl ParameterId {
12  pub const PID_PAD: Self = Self { value: 0x0000 };
13  pub const PID_SENTINEL: Self = Self { value: 0x0001 };
14  pub const PID_USER_DATA: Self = Self { value: 0x002c };
15  pub const PID_TOPIC_NAME: Self = Self { value: 0x0005 };
16  pub const PID_TYPE_NAME: Self = Self { value: 0x0007 };
17  pub const PID_GROUP_DATA: Self = Self { value: 0x002d };
18  pub const PID_TOPIC_DATA: Self = Self { value: 0x002e };
19  pub const PID_DURABILITY: Self = Self { value: 0x001d };
20  pub const PID_DURABILITY_SERVICE: Self = Self { value: 0x001e };
21  pub const PID_DEADLINE: Self = Self { value: 0x0023 };
22  pub const PID_LATENCY_BUDGET: Self = Self { value: 0x0027 };
23  pub const PID_LIVELINESS: Self = Self { value: 0x001b };
24  pub const PID_RELIABILITY: Self = Self { value: 0x001a };
25  pub const PID_LIFESPAN: Self = Self { value: 0x002b };
26  pub const PID_DESTINATION_ORDER: Self = Self { value: 0x0025 };
27  pub const PID_HISTORY: Self = Self { value: 0x0040 };
28  pub const PID_RESOURCE_LIMITS: Self = Self { value: 0x0041 };
29  pub const PID_OWNERSHIP: Self = Self { value: 0x001f };
30  pub const PID_OWNERSHIP_STRENGTH: Self = Self { value: 0x0006 };
31  pub const PID_PRESENTATION: Self = Self { value: 0x0021 };
32  pub const PID_PARTITION: Self = Self { value: 0x0029 };
33  pub const PID_TIME_BASED_FILTER: Self = Self { value: 0x0004 };
34  pub const PID_TRANSPORT_PRIO: Self = Self { value: 0x0049 };
35  pub const PID_PROTOCOL_VERSION: Self = Self { value: 0x0015 };
36  pub const PID_VENDOR_ID: Self = Self { value: 0x0016 };
37  pub const PID_UNICAST_LOCATOR: Self = Self { value: 0x002f };
38  pub const PID_MULTICAST_LOCATOR: Self = Self { value: 0x0030 };
39  pub const PID_MULTICAST_IPADDRESS: Self = Self { value: 0x0011 };
40  pub const PID_DEFAULT_UNICAST_LOCATOR: Self = Self { value: 0x0031 };
41  pub const PID_DEFAULT_MULTICAST_LOCATOR: Self = Self { value: 0x0048 };
42  pub const PID_METATRAFFIC_UNICAST_LOCATOR: Self = Self { value: 0x0032 };
43  pub const PID_METATRAFFIC_MULTICAST_LOCATOR: Self = Self { value: 0x0033 };
44  pub const PID_DEFAULT_UNICAST_IPADDRESS: Self = Self { value: 0x000c };
45  pub const PID_DEFAULT_UNICAST_PORT: Self = Self { value: 0x000e };
46  pub const PID_METATRAFFIC_UNICAST_IPADDRESS: Self = Self { value: 0x0045 };
47  pub const PID_METATRAFFIC_UNICAST_PORT: Self = Self { value: 0x000d };
48  pub const PID_METATRAFFIC_MULTICAST_IPADDRESS: Self = Self { value: 0x000b };
49  pub const PID_METATRAFFIC_MULTICAST_PORT: Self = Self { value: 0x0046 };
50  pub const PID_EXPECTS_INLINE_QOS: Self = Self { value: 0x0043 };
51  pub const PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT: Self = Self { value: 0x0034 };
52  pub const PID_PARTICIPANT_BUILTIN_ENDPOINTS: Self = Self { value: 0x0044 };
53  pub const PID_PARTICIPANT_LEASE_DURATION: Self = Self { value: 0x0002 };
54  pub const PID_CONTENT_FILTER_PROPERTY: Self = Self { value: 0x0035 };
55  pub const PID_PARTICIPANT_GUID: Self = Self { value: 0x0050 };
56  pub const PID_GROUP_GUID: Self = Self { value: 0x0052 };
57  pub const PID_GROUP_ENTITYID: Self = Self { value: 0x0053 };
58  pub const PID_BUILTIN_ENDPOINT_SET: Self = Self { value: 0x0058 };
59  pub const PID_ENDPOINT_GUID: Self = Self { value: 0x005a };
60  pub const PID_BUILTIN_ENDPOINT_QOS: Self = Self { value: 0x0077 };
61  pub const PID_PROPERTY_LIST: Self = Self { value: 0x0059 };
62  pub const PID_TYPE_MAX_SIZE_SERIALIZED: Self = Self { value: 0x0060 };
63  pub const PID_ENTITY_NAME: Self = Self { value: 0x0062 };
64  pub const PID_KEY_HASH: Self = Self { value: 0x0070 };
65  pub const PID_STATUS_INFO: Self = Self { value: 0x0071 };
66
67  // From Specification "Remote Procedure Calls over DDS v1.0"
68  // Section 7.6.2.1.1 Extended PublicationBuiltin TopicData and
69  // 7.6.2.1.2 Extended SubscriptionBuiltinTopicData
70  pub const PID_SERVICE_INSTANCE_NAME: Self = Self { value: 0x0080 };
71  pub const PID_RELATED_ENTITY_GUID: Self = Self { value: 0x0081 };
72  pub const PID_TOPIC_ALIASES: Self = Self { value: 0x0082 };
73  // Section "7.8.2 Request and Reply Correlation in the Enhanced Service
74  // Profile": ...a new parameter id PID_RELATED_SAMPLE_IDENTITY with value
75  // 0x0083
76  //
77  // But then again, the actual PID on the wire seems to be 0x800f, at least in
78  // eProsima FastRTPS and RTI Connext. eProsima sources even have the value
79  // 0x0083 commented out.
80  // Wireshark calls this "PID_RELATED_ORIGINAL_WRITER_INFO".
81  //
82  // Update 2024-11-18:
83  //
84  // eProsima seems to have made a bug fix in Mar 27, 2023:
85  // https://github.com/eProsima/Fast-DDS/commit/359eeaadd0ff0216aa1968a8ea34b5092c4f346e
86  // They changed PID_RELATED_SAMPLE_IDENTITY from 0x800f to 0x0083.
87  //
88  // PID 0x800f is still supported in FastDDS, and it is called
89  // PID_CUSTOM_RELATED_SAMPLE_IDENTITY, which naming we will copy, so that
90  // future debugging is less confusing. Now FastDDS sends both of these PIDs in
91  // Inline QoS, if it needs to send related_sample_identity. This seems like
92  // a good idea for backward compatibility.
93  //
94  // The receive behaviour of FastDDS is somewhat unclear. They recognize both
95  // versions on receive, but receiveing related_sample_identity does not work
96  // correctly with PID=0x800f in ROS 2 Jazzy.
97  pub const PID_RELATED_SAMPLE_IDENTITY: Self = Self { value: 0x0083 };
98  pub const PID_RELATED_SAMPLE_IDENTITY_CUSTOM: Self = Self { value: 0x800f };
99
100  // DDS Security spec v1.1:
101
102  // Section 7.4.1.4 Extension to RTPS Standard DCPSParticipants Builtin Topic
103  // Table 10
104  pub const PID_IDENTITY_TOKEN: Self = Self { value: 0x1001 };
105  pub const PID_PERMISSIONS_TOKEN: Self = Self { value: 0x1002 };
106
107  // Section 7.4.1.7 New DCPSPublicationsSecure Builtin Topic
108  // Table 14 & 15
109  pub const PID_DATA_TAGS: Self = Self { value: 0x1003 };
110  // Section 7.4.1.5
111  // "Extension to RTPS Standard DCPSPublications and DCPSSubscriptions Builtin
112  // Topics" Table 12
113  pub const PID_ENDPOINT_SECURITY_INFO: Self = Self { value: 0x1004 };
114
115  // Table 10:
116  pub const PID_PARTICIPANT_SECURITY_INFO: Self = Self { value: 0x1005 };
117
118  // Section 7.4.1.6 "New DCPSParticipantSecure Builtin Topic"
119  // Table 13
120  pub const PID_IDENTITY_STATUS_TOKEN: Self = Self { value: 0x1006 };
121}
122
123#[cfg(test)]
124mod tests {
125  use super::*;
126
127  serialization_test!( type = ParameterId,
128  {
129      pid_pad,
130      ParameterId::PID_PAD,
131      le = [0x00, 0x00],
132      be = [0x00, 0x00]
133  },
134  {
135      pid_sentinel,
136      ParameterId::PID_SENTINEL,
137      le = [0x01, 0x00],
138      be = [0x00, 0x01]
139  },
140  {
141      pid_user_data,
142      ParameterId::PID_USER_DATA,
143      le = [0x2c, 0x00],
144      be = [0x00, 0x2c]
145  },
146  {
147      pid_topic_name,
148      ParameterId::PID_TOPIC_NAME,
149      le = [0x05, 0x00],
150      be = [0x00, 0x05]
151  },
152  {
153      pid_type_name,
154      ParameterId::PID_TYPE_NAME,
155      le = [0x07, 0x00],
156      be = [0x00, 0x07]
157  },
158  {
159      pid_group_data,
160      ParameterId::PID_GROUP_DATA,
161      le = [0x2d, 0x00],
162      be = [0x00, 0x2d]
163  },
164  {
165      pid_topic_data,
166      ParameterId::PID_TOPIC_DATA,
167      le = [0x2e, 0x00],
168      be = [0x00, 0x2e]
169  },
170  {
171      pid_durability,
172      ParameterId::PID_DURABILITY,
173      le = [0x1d, 0x00],
174      be = [0x00, 0x1d]
175  },
176  {
177      pid_durability_service,
178      ParameterId::PID_DURABILITY_SERVICE,
179      le = [0x1e, 0x00],
180      be = [0x00, 0x1e]
181  },
182  {
183      pid_deadline,
184      ParameterId::PID_DEADLINE,
185      le = [0x23, 0x00],
186      be = [0x00, 0x23]
187  },
188  {
189      pid_latency_budget,
190      ParameterId::PID_LATENCY_BUDGET,
191      le = [0x27, 0x00],
192      be = [0x00, 0x27]
193  },
194  {
195      pid_liveliness,
196      ParameterId::PID_LIVELINESS,
197      le = [0x1b, 0x00],
198      be = [0x00, 0x1b]
199  },
200  {
201      pid_reliability,
202      ParameterId::PID_RELIABILITY,
203      le = [0x1a, 0x00],
204      be = [0x00, 0x1a]
205  },
206  {
207      pid_lifespan,
208      ParameterId::PID_LIFESPAN,
209      le = [0x2b, 0x00],
210      be = [0x00, 0x2b]
211  },
212  {
213      pid_destination_order,
214      ParameterId::PID_DESTINATION_ORDER,
215      le = [0x25, 0x00],
216      be = [0x00, 0x25]
217  },
218  {
219      pid_history,
220      ParameterId::PID_HISTORY,
221      le = [0x40, 0x00],
222      be = [0x00, 0x40]
223  },
224  {
225      pid_resource_limits,
226      ParameterId::PID_RESOURCE_LIMITS,
227      le = [0x41, 0x00],
228      be = [0x00, 0x41]
229  },
230  {
231      pid_ownership,
232      ParameterId::PID_OWNERSHIP,
233      le = [0x1f, 0x00],
234      be = [0x00, 0x1f]
235  },
236  {
237      pid_ownership_strength,
238      ParameterId::PID_OWNERSHIP_STRENGTH,
239      le = [0x06, 0x00],
240      be = [0x00, 0x06]
241  },
242  {
243      pid_presentation,
244      ParameterId::PID_PRESENTATION,
245      le = [0x21, 0x00],
246      be = [0x00, 0x21]
247  },
248  {
249      pid_partition,
250      ParameterId::PID_PARTITION,
251      le = [0x29, 0x00],
252      be = [0x00, 0x29]
253  },
254  {
255      pid_time_based_filter,
256      ParameterId::PID_TIME_BASED_FILTER,
257      le = [0x04, 0x00],
258      be = [0x00, 0x04]
259  },
260  {
261      pid_transport_prio,
262      ParameterId::PID_TRANSPORT_PRIO,
263      le = [0x49, 0x00],
264      be = [0x00, 0x49]
265  },
266  {
267      pid_protocol_version,
268      ParameterId::PID_PROTOCOL_VERSION,
269      le = [0x15, 0x00],
270      be = [0x00, 0x15]
271  },
272  {
273      pid_vendor_id,
274      ParameterId::PID_VENDOR_ID,
275      le = [0x16, 0x00],
276      be = [0x00, 0x16]
277  },
278  {
279      pid_unicast_locator,
280      ParameterId::PID_UNICAST_LOCATOR,
281      le = [0x2f, 0x00],
282      be = [0x00, 0x2f]
283  },
284  {
285      pid_multicast_locator,
286      ParameterId::PID_MULTICAST_LOCATOR,
287      le = [0x30, 0x00],
288      be = [0x00, 0x30]
289  },
290  {
291      pid_multicast_ipaddress,
292      ParameterId::PID_MULTICAST_IPADDRESS,
293      le = [0x11, 0x00],
294      be = [0x00, 0x11]
295  },
296  {
297      pid_default_unicast_locator,
298      ParameterId::PID_DEFAULT_UNICAST_LOCATOR,
299      le = [0x31, 0x00],
300      be = [0x00, 0x31]
301  },
302  {
303      pid_default_multicast_locator,
304      ParameterId::PID_DEFAULT_MULTICAST_LOCATOR,
305      le = [0x48, 0x00],
306      be = [0x00, 0x48]
307  },
308  {
309      pid_metatraffic_unicast_locator,
310      ParameterId::PID_METATRAFFIC_UNICAST_LOCATOR,
311      le = [0x32, 0x00],
312      be = [0x00, 0x32]
313  },
314  {
315      pid_metatraffic_multicast_locator,
316      ParameterId::PID_METATRAFFIC_MULTICAST_LOCATOR,
317      le = [0x33, 0x00],
318      be = [0x00, 0x33]
319  },
320  {
321      pid_default_unicast_ipaddress,
322      ParameterId::PID_DEFAULT_UNICAST_IPADDRESS,
323      le = [0x0c, 0x00],
324      be = [0x00, 0x0c]
325  },
326  {
327      pid_default_unicast_port,
328      ParameterId::PID_DEFAULT_UNICAST_PORT,
329      le = [0x0e, 0x00],
330      be = [0x00, 0x0e]
331  },
332  {
333      pid_metatraffic_unicast_ipaddress,
334      ParameterId::PID_METATRAFFIC_UNICAST_IPADDRESS,
335      le = [0x45, 0x00],
336      be = [0x00, 0x45]
337  },
338  {
339      pid_metatraffic_unicast_port,
340      ParameterId::PID_METATRAFFIC_UNICAST_PORT,
341      le = [0x0d, 0x00],
342      be = [0x00, 0x0d]
343  },
344  {
345      pid_metatraffic_multicast_ipaddress,
346      ParameterId::PID_METATRAFFIC_MULTICAST_IPADDRESS,
347      le = [0x0b, 0x00],
348      be = [0x00, 0x0b]
349  },
350  {
351      pid_metatraffic_multicast_port,
352      ParameterId::PID_METATRAFFIC_MULTICAST_PORT,
353      le = [0x46, 0x00],
354      be = [0x00, 0x46]
355  },
356  {
357      pid_expects_inline_qos,
358      ParameterId::PID_EXPECTS_INLINE_QOS,
359      le = [0x43, 0x00],
360      be = [0x00, 0x43]
361  },
362  {
363      pid_participant_manual_liveliness_count,
364      ParameterId::PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT,
365      le = [0x34, 0x00],
366      be = [0x00, 0x34]
367  },
368  {
369      pid_participant_builtin_endpoints,
370      ParameterId::PID_PARTICIPANT_BUILTIN_ENDPOINTS,
371      le = [0x44, 0x00],
372      be = [0x00, 0x44]
373  },
374  {
375      pid_participant_lease_duration,
376      ParameterId::PID_PARTICIPANT_LEASE_DURATION,
377      le = [0x02, 0x00],
378      be = [0x00, 0x02]
379  },
380  {
381      pid_content_filter_property,
382      ParameterId::PID_CONTENT_FILTER_PROPERTY,
383      le = [0x35, 0x00],
384      be = [0x00, 0x35]
385  },
386  {
387      pid_participant_guid,
388      ParameterId::PID_PARTICIPANT_GUID,
389      le = [0x50, 0x00],
390      be = [0x00, 0x50]
391  },
392  {
393      pid_group_guid,
394      ParameterId::PID_GROUP_GUID,
395      le = [0x52, 0x00],
396      be = [0x00, 0x52]
397  },
398  {
399      pid_group_entityid,
400      ParameterId::PID_GROUP_ENTITYID,
401      le = [0x53, 0x00],
402      be = [0x00, 0x53]
403  },
404  {
405      pid_builtin_endpoint_set,
406      ParameterId::PID_BUILTIN_ENDPOINT_SET,
407      le = [0x58, 0x00],
408      be = [0x00, 0x58]
409  },
410  {
411      pid_property_list,
412      ParameterId::PID_PROPERTY_LIST,
413      le = [0x59, 0x00],
414      be = [0x00, 0x59]
415  },
416  {
417      pid_type_max_size_serialized,
418      ParameterId::PID_TYPE_MAX_SIZE_SERIALIZED,
419      le = [0x60, 0x00],
420      be = [0x00, 0x60]
421  },
422  {
423      pid_entity_name,
424      ParameterId::PID_ENTITY_NAME,
425      le = [0x62, 0x00],
426      be = [0x00, 0x62]
427  },
428  {
429      pid_key_hash,
430      ParameterId::PID_KEY_HASH,
431      le = [0x70, 0x00],
432      be = [0x00, 0x70]
433  },
434  {
435      pid_status_info,
436      ParameterId::PID_STATUS_INFO,
437      le = [0x71, 0x00],
438      be = [0x00, 0x71]
439  });
440}