RTI Connext DDS Micro  Version 2.4.11
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rtps_rtps.h
Go to the documentation of this file.
1 /*
2  * FILE: RTPSInterface.h
3  *
4  * Copyright 2008-2015 Real-Time Innovations, Inc.
5  *
6  * No duplications, whole or partial, manual or electronic, may be made
7  * without express written permission. Any such copies, or
8  * revisions thereof, must display this notice unaltered.
9  * This code contains trade secrets of Real-Time Innovations, Inc.
10  *
11  * Modification History
12  * --------------------
13  * 04nov2015,tk MICRO-1505 Reduce memory footprint
14  * 16jul2015,eh MICRO-1439/PR#15427 Fix RTPS_LOCATOR_DEFAULT
15  * 23feb2015,eh MICRO-1081: fix function/var names to conform to coding std
16  * 23feb2015,eh MICRO-1075: remove and replace macros
17  * 13oct2014,eh MICRO-925: remove unused RTPS_DATAFLAGS_K
18  * 09may2014,eh MICRO-261 (Verocel PR#1421): remove RTPS_SubmessageId_toString
19  * for Cert
20  * 07jan2014,eh MICRO-733: update to Connext Micro vendor ID
21  * 15may2013,eh MICRO-394: constant inline qos lengths, from CR-138
22  * 18may2011,eh Created, based on Waveworks tree.
23  */
24 
25 
26 /*e \file
27  * \brief RTPS interface functions and types
28  *
29  * \details
30  * RTPS protocol defined types, implemented in C.
31  *
32  *
33  */
34 #ifndef rtps_rtps_h
35 #define rtps_rtps_h
36 
37 
38 #ifndef osapi_types_h
39 #include "osapi/osapi_types.h"
40 #endif
41 #ifndef reda_epoch_h
42 #include "reda/reda_epoch.h"
43 #endif
44 #ifndef reda_sequenceNumber_h
45 #include "reda/reda_sequenceNumber.h"
46 #endif
47 #ifndef osapi_time_h
48 #include "osapi/osapi_time.h"
49 #endif
50 #ifndef osapi_system_h
51 #include "osapi/osapi_system.h"
52 #endif
53 #ifndef rtps_dll_h
54 #include "rtps/rtps_dll.h"
55 #endif
56 #ifndef cdr_stream_h
57 #include "cdr/cdr_stream.h"
58 #endif
59 #ifndef netio_common_h
60 #include "netio/netio_common.h"
61 #endif
62 #ifndef netio_common_h
63 #include "netio/netio_common.h"
64 #endif
65 #ifndef netio_address_h
66 #include "netio/netio_address.h"
67 #endif
68 #ifndef netio_route_h
69 #include "netio/netio_route.h"
70 #endif
71 #ifndef netio_interface_h
72 #include "netio/netio_interface.h"
73 #endif
74 
75 #ifdef __cplusplus
76 extern "C"
77 {
78 #endif
79 
80 #ifdef RTI_CPP
81 #define RTPS_CPP_SUPPORT_METHODS_BASIC(T) \
82  public:\
83  T();\
84  ~T();\
85  private: \
86  T(const T& from);\
87  T& operator=(const T& from);\
88  bool operator==(const T& other);\
89  bool operator!=(const T& other);
90 #else /* ifdef RTI_CPP */
91 #define RTPS_CPP_SUPPORT_METHODS_BASIC(T)
92 #endif /* ifdef RTI_CPP */
93 
94 /*ci \brief Maximum length of an RTPS serializable path name string */
95 #define RTPS_PATHNAME_LEN_MAX (255)
96 
97 
98 /*ci \ingroup RTPS_PidModule
99  * \brief RTPS parameter ID, used to describe RTPS objects.
100  */
101 typedef RTI_UINT16 RTPS_ParameterId;
102 
103 /*ci \ingroup RTPS_PidModule
104  * \brief Mask for ParameterId bit indicating subspace where
105  * unrecognized PIDs are either ignored or treated as
106  * incompatible QoS.
107 */
108 #define RTPS_PID_INCOMPATIBLE_MASK (0x4000)
109 
110 /*ci \ingroup RTPS_PidModule
111  * \brief Pad for parameter values in case they don't end on a 4-byte boundary
112  */
113 #define RTPS_PID_PAD (0x0000)
114 
115 /*ci \ingroup RTPS_PidModule
116  * \brief Indicate end of parameter sequence.
117  */
118 #define RTPS_PID_SENTINEL (0x0001)
119 
120 /*ci \ingroup RTPS_PidModule
121  * \brief Topic name parameter ID
122  *
123  * \details
124  * Used for field Publication::topic: PathName, Subscription::topic : PathName
125  */
126 #define RTPS_PID_TOPIC_NAME (0x0005)
127 
128 /*ci \ingroup RTPS_PidModule
129  * \brief Type name parameter ID
130  *
131  * \details
132  * Used for field Publication::typeName : TypeName,
133  * Subscription::typeName : TypeName
134  */
135 #define RTPS_PID_TYPE_NAME (0x0007)
136 
137 /*ci \ingroup RTPS_PidModule
138  * \brief Durability Qos parameter ID
139  *
140  * \details Used for field
141  * Publication::durabilityQosPolicy : DurabilityQosPolicy, and
142  * Subscription::durabilityQosPolicy : DurabilityQosPolicy
143  */
144 #define RTPS_PID_DURABILITY (0x001d)
145 
146 /*ci \ingroup RTPS_PidModule
147  * \brief DestinationOrder Qos parameter ID
148  *
149  * \details Used for field
150  * Publication::DestinationOrderQosPolicy : DurabilityQosPolicy, and
151  * Subscription::DestinationOrderQosPolicy : DestinationOrderQosPolicy
152  */
153 #define RTPS_PID_DESTINATION_ORDER (0x0025)
154 
155 /*ci \ingroup RTPS_PidModule
156  * \brief Deadline Qos parameter ID
157  *
158  * \details
159  * Used for field Subscription::deadlineQosPolicy : DeadlineQosPolicy
160  */
161 #define RTPS_PID_DEADLINE (0x0023)
162 
163 /*ci \ingroup RTPS_PidModule
164  * \brief Liveliness Qos parameter ID
165  *
166  * \details
167  * Used for field Publication::livelinessQosPolicy : LivelinessQosPolicy, and
168  * Subscription::livelinessQosPolicy : LivelinessQosPolicy
169  */
170 #define RTPS_PID_LIVELINESS (0x001b)
171 
172 /*ci \ingroup RTPS_PidModule
173  * \brief Reliability Qos parameter ID
174  *
175  * \details
176  * Used for field Publication::reliabilityOffered : RTI_UINT32, and
177  * Subscription::reliabilityRequested : RTI_UINT32
178  */
179 #define RTPS_PID_RELIABILITY (0x001a)
180 
181 /*ci \ingroup RTPS_PidModule
182  * \brief Ownership Qos parameter ID
183  *
184  * \details
185  * Used for field Subscription::ownershipQosPolicy : OwnershipQosPolicy
186  */
187 #define RTPS_PID_OWNERSHIP (0x001f)
188 
189 /*ci \ingroup RTPS_PidModule
190  * \brief Ownership Strength Qos parameter ID
191  *
192  * \details
193  * Used for field Publication::strength : long
194  */
195 #define RTPS_PID_OWNERSHIP_STRENGTH (0x0006)
196 
197 /*ci \ingroup RTPS_PidModule
198  * \brief Protocol Version paramater ID
199  *
200  * \details
201  * Used for field Application::protocolVersion : ProtocolVersion
202  */
203 #define RTPS_PID_PROTOCOL_VERSION (0x0015)
204 
205 /*ci \ingroup RTPS_PidModule
206  * \brief Vendor ID parameterID
207  *
208  * \details
209  * Used for field Application::vendorId : VendorId
210  */
211 #define RTPS_PID_VENDOR_ID (0x0016)
212 
213 
214 /*ci \brief Maximum number of addresses per type, per entity */
215 #define RTPS_PID_USERDATA_IPADDRESS_COUNT_MAX (4)
216 
217 /*ci \ingroup RTPS_PidModule
218  * \brief Unicast locator parameter ID
219  *
220  * \details Array of max size RTPS_PID_USERDATA_UNICAST_IPADDRESS_COUNT_MAX
221  */
222 #define RTPS_PID_UNICAST_LOCATOR6 (0x002f)
223 
224 /*ci \ingroup RTPS_PidModule
225  * \brief Multicast locator parameter ID
226  *
227  * \details Array of max size RTPS_PID_USERDATA_UNICAST_IPADDRESS_COUNT_MAX
228  */
229 #define RTPS_PID_MULTICAST_LOCATOR6 (0x0030)
230 
231 /*ci \ingroup RTPS_PidModule
232  * \brief Default unicast locator parameter ID
233  *
234  * \details Array of max size RTPS_PID_USERDATA_UNICAST_IPADDRESS_COUNT_MAX
235  */
236 #define RTPS_PID_DEFAULT_UNICAST_LOCATOR6 (0x0031)
237 
238 /*ci \ingroup RTPS_PidModule
239  * \brief Discovery (meta-traffic) unicast locator parameter ID
240  *
241  * \details Array of max size RTPS_PID_USERDATA_UNICAST_IPADDRESS_COUNT_MAX
242  */
243 #define RTPS_PID_METATRAFFIC_UNICAST_LOCATOR6 (0x0032)
244 
245 /*ci \ingroup RTPS_PidModule
246  * \brief Discovery (meta-traffic) multicast locator parameter ID
247  *
248  * \details Array of max size RTPS_PID_USERDATA_UNICAST_IPADDRESS_COUNT_MAX
249  */
250 #define RTPS_PID_METATRAFFIC_MULTICAST_LOCATOR6 (0x0033)
251 
252 /*ci \ingroup RTPS_PidModule
253  * \brief Liveliness lease duration parameter ID
254  */
255 #define RTPS_PID_LEASE_DURATION (0x0002)
256 
257 /*ci \ingroup RTPS_PidModule
258  * \brief Property Qos parameter ID
259  *
260  * \details Used for field Participant::propertyList
261  */
262 #define RTPS_PID_PROPERTY_LIST (0x0059)
263 
264 /*ci \ingroup RTPS_PidModule
265  * \brief Participant GUID parameter ID
266  */
267 #define RTPS_PID_PARTICIPANT_GUID (0x0050)
268 
269 /*ci \ingroup RTPS_PidModule
270  * \brief Presentation Qos parameter ID
271  */
272 #define RTPS_PID_PRESENTATION (0x0021)
273 
274 /*ci \ingroup RTPS_ParameterSequenceClass
275  * \brief Builtin endpoint mask parameter ID
276  *
277  * \details Indicate builtin endpoint set inline Qos,
278  * PID_BUILTIN_ENDPOINT_SET from the RTPS spec
279  */
280 #define RTPS_PID_BUILTIN_ENDPOINT_MASK (0x0058)
281 
282 /*ci \ingroup RTPS_ParameterSequenceClass
283  * \brief Endpoint GUID parameter ID
284  */
285 #define RTPS_PID_ENDPOINT_GUID (0x005A)
286 
287 /*ci \ingroup RTPS_ParameterSequenceClass
288  * \brief Entity name parameter ID
289  */
290 #define RTPS_PID_ENTITY_NAME (0x0062)
291 
292 /******************************************************************************/
293 /*ci \ingroup RTPS_ParameterSequenceClass
294  * \brief Key Hash parameter ID
295  */
296 #define RTPS_PID_KEY_HASH (0x0070)
297 
298 /*ci \brief Key Hash parameter length */
299 #define RTPS_KEY_HASH_PARAM_LENGTH (16)
300 
301 /*ci \ingroup RTPS_ParameterSequenceClass
302  * \brief Status info parameter ID
303  */
304 #define RTPS_PID_STATUS_INFO (0x0071)
305 
306 /*ci \brief Status info parameter length */
307 #define RTPS_STATUS_INFO_PARAM_LENGTH (4)
308 
309 /*ci \brief Send queue size parameter ID */
310 #define RTPS_PID_SEND_QUEUE_SIZE_DEPRECATED (0x0013)
311 
312 /******************************************************************************/
313 /*ci \ingroup RTPS_Class
314  * \brief Host ID of GUID
315  */
316 typedef RTI_UINT32 RTPS_HostId;
317 
318 /*ci \ingroup RTPS_Class
319  * \brief Unknown Host ID
320  */
321 #define RTPS_HOST_ID_UNKNOWN (0x00000000)
322 
323 /*ci \ingroup RTPS_Class
324  * \brief Application ID of GUID
325  */
326 typedef RTI_UINT32 RTPS_AppId;
327 
328 /*ci \ingroup RTPS_Class
329  * \brief Unknown Application ID
330  */
331 #define RTPS_APP_ID_UNKNOWN (0x00000000)
332 
333 /*ci \ingroup RTPS_Class
334  * \brief Instance ID of GUID
335  */
336 typedef RTI_UINT32 RTPS_InstanceId;
337 
338 /*ci \ingroup RTPS_Class
339  * \brief Unknown Instance ID
340  */
341 #define RTPS_INSTANCE_ID_UNKNOWN (0x00000000)
342 
343 /*ci \ingroup RTPS_Class
344  * \brief Object ID of GUID
345  */
346 typedef RTI_UINT32 RTPS_ObjectId;
347 
348 /*ci \ingroup RTPS_Class
349  * \brief Unknown Object ID
350  */
351 #define RTPS_OBJECT_ID_UNKNOWN (0x00000000)
352 
353 /*ci \ingroup RTPS_Class
354  * \brief Maximum Object ID
355  */
356 #define RTPS_OBJECT_ID_MAX (0xFFFFFFFF)
357 
358 /******************************************************************************/
359 /*ci \ingroup RTPS_Class
360  * \brief Prefix portion of GUID.
361  *
362  * \details Uniquely identifies the DomainParticipant to which
363  * an RTPS's DDS entity belong
364  */
365 struct RTPS_GuidPrefix
366 {
367  /*ci \brief First field of GUID Prefix.
368  * \details Historically set to host IP address
369  */
370  RTPS_HostId host_id;
371 
372  /*ci \brief Second field of GUID Prefix.
373  * \details Historically set to process ID
374  */
375  RTPS_AppId app_id ;
376 
377  /*ci \brief Third field of GUID prefix.
378  * \details Historically set to instance counter
379  */
380  RTPS_InstanceId instance_id ;
381 };
382 
383 /*ci \ingroup RTPS_Class
384  * \brief Unknonwn GUID prefix
385  */
386 #define RTPS_GUID_PREFIX_UNKNOWN { \
387  RTPS_HOST_ID_UNKNOWN, \
388  RTPS_APP_ID_UNKNOWN, \
389  RTPS_INSTANCE_ID_UNKNOWN}
390 
391 /*ci \ingroup RTPS_Class
392  * \brief Length in bytes of GUID prefix
393  */
394 #define RTPS_GUID_PREFIX_SIZE (12)
395 
396 /*ci \ingroup RTPS_Class
397  * \brief GUID
398  */
399 struct RTPS_Guid
400 {
401  /*ci \brief GUID prefix */
402  struct RTPS_GuidPrefix prefix;
403 
404  /*ci \brief Unique entity identifier */
405  RTPS_ObjectId object_id;
406 };
407 
408 /*ci \ingroup RTPS_Class
409  * \brief Unknown GUID
410  */
411 #define RTPS_GUID_UNKNOWN { \
412  RTPS_GUID_PREFIX_UNKNOWN, \
413  RTPS_OBJECT_ID_UNKNOWN}
414 
415 /******************************************************************************/
416 /*ci \brief Participant Object ID */
417 #define RTPS_OBJECT_ID_PARTICIPANT (0x000001C1)
418 
419 /*ci \brief Simple Discovery Protocol Participant Writer Object ID */
420 #define RTPS_OBJECT_ID_WRITER_SDP_PARTICIPANT (0x000100C2)
421 
422 /*ci \brief Simple Discovery Protocol Publication Writer Object ID */
423 #define RTPS_OBJECT_ID_WRITER_SDP_PUBLICATION (0x000003C2)
424 
425 /*ci \brief Simple Discovery Protocol Subscription Writer Object ID */
426 #define RTPS_OBJECT_ID_WRITER_SDP_SUBSCRIPTION (0x000004C2)
427 
428 /*ci \brief Simple Discovery Protocol Participant Reader Object ID */
429 #define RTPS_OBJECT_ID_READER_SDP_PARTICIPANT (0x000100C7)
430 
431 /*ci \brief Simple Discovery Protocol Subscription Reader Object ID */
432 #define RTPS_OBJECT_ID_READER_SDP_PUBLICATION (0x000003C7)
433 
434 /*ci \brief Simple Discovery Protocol Subscription Reader Object ID */
435 #define RTPS_OBJECT_ID_READER_SDP_SUBSCRIPTION (0x000004C7)
436 
437 /******************************************************************************/
438 /*ci \brief Key Hash max length */
439 #define RTPS_KEY_HASH_MAX_LENGTH 16
440 
441 /*ci \brief Hash of instance key */
442 struct RTPS_KeyHash
443 {
444  /*ci \brief Key hash value */
445  RTI_UINT8 value[RTPS_KEY_HASH_MAX_LENGTH];
446 
447  /*ci \brief Key hash length */
448  RTI_UINT32 length;
449 };
450 
451 /*ci \brief Nil Key Hash value */
452 #define RTPS_KEY_HASH_NIL {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
453 
454 /*ci \brief Default Key Hash Initializer */
455 #define RTPS_KEY_HASH_DEFAULT { \
456 RTPS_KEY_HASH_NIL, /* value */\
457 RTPS_KEY_HASH_MAX_LENGTH/* length */\
458 }
459 
460 /******************************************************************************/
461 /*ci \ingroup RTPS_Class
462  * \brief Returns RTI_TRUE if GUIDs are equal
463  *
464  * \param[in] a First GUID
465  * \param[in] b Second GUID
466  *
467  * \return RTI_TRUE if GUIDs are equal, RTI_FALSE otherwise
468  */
469 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
470 RTPS_Guid_equals(struct RTPS_Guid *a, struct RTPS_Guid *b);
471 
472 /*ci \ingroup RTPS_Class
473  * \brief Returns RTI_TRUE if GUID prefixes are equal
474  *
475  * \param[in] a First GUID
476  * \param[in] b Second GUID
477  *
478  * \return RTI_TRUE if prefixes of GUIDs are equal, RTI_FALSE otherwise
479  */
480 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
481 RTPS_Guid_prefix_equals(
482  struct RTPS_Guid *a,
483  struct RTPS_Guid *b);
484 
485 /*ci \ingroup RTPS_Class
486  * \brief Returns RTI_TRUE if GUID suffixes are equal
487  *
488  * \param[in] a First GUID
489  * \param[in] b Second GUID
490  *
491  * \return RTI_TRUE if suffixes of GUIDs are equal, RTI_FALSE otherwise
492  */
493 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
494 RTPS_Guid_suffix_equals(
495  struct RTPS_Guid *a,
496  struct RTPS_Guid *b);
497 
498 /******************************************************************************/
499 /*ci \brief RTPS Protocol Version type */
500 typedef RTI_UINT16 RTPS_ProtocolVersion_T;
501 
502 /*ci \brief Major version of supported RTPS protocol */
503 #define RTPS_PROTOCOL_VERSION_MAJOR (0x02)
504 
505 /*ci \brief Minor version of supported RTPS protocol */
506 #define RTPS_PROTOCOL_VERSION_MINOR (0x01)
507 
508 /*ci \brief RTPS Vendor ID type */
509 typedef RTI_UINT16 RTPS_VendorId;
510 
511 /*ci \brief Major version of vendor ID */
512 #define RTPS_VENDOR_ID_MAJOR (0x01)
513 
514 /*ci \brief Minor version of vendor ID */
515 #define RTPS_VENDOR_ID_MINOR (0x0A)
516 
517 /*ci \brief Connext DDS Vendor ID */
518 #define RTPS_VENDOR_ID_RTI_DDS (0x0101)
519 
520 /*ci \brief Connext Micro Vendor ID */
521 #define RTPS_VENDOR_ID_RTI_MICRO (0x010A)
522 
523 /*ci
524  * \brief Get major number of vendor ID
525  *
526  * \param[in] me Vendor ID
527  *
528  * \return Major number of vendor ID
529  */
530 RTPS_VendorId
531 RTPS_VendorId_get_major(RTPS_VendorId *me);
532 
533 /*ci
534  * \brief Get minor number of vendor ID
535  *
536  * \param[in] me Vendor ID
537  *
538  * \return Minor number of vendor ID
539  */
540 RTPS_VendorId
541 RTPS_VendorId_get_minor(RTPS_VendorId *me);
542 
543 /*****************************************************************************/
544 /*ci \brief RTPS Status Info type */
545 typedef RTI_UINT32 RTPS_StatusInfo;
546 
547 /*ci \brief Default empty status info */
548 #define RTPS_NO_STATUS_INFO (0x00000000)
549 
550 /*ci \brief Dispose status info bit */
551 #define RTPS_DISPOSE_STATUS_INFO (0x00000001)
552 
553 /*ci \brief Unregister status info bit */
554 #define RTPS_UNREGISTER_STATUS_INFO (0X00000002)
555 
556 /*ci \brief RTPS submessage header endian flag */
557 #define RTPS_ENDIAN_FLAG (0x01)
558 
559 /*****************************************************************************/
560 
561 /*ci \ingroup RTPS_Class
562  * \brief Denotes the built-in object types
563  *
564  * \details
565  * RTPSObject is categorized into (normal/reserved) x (user/meta) quadrant.
566  * Within each quadrant, there are several built-in (provided for at the RTPS
567  * protocol level) objects, such as application, publication/subscription,
568  * CST (keyed) writer/reader.
569  */
570 typedef enum
571 {
572  RTPS_OBJECT_NORMAL_USER_UNKNOWN = 0x00,
573  RTPS_OBJECT_NORMAL_USER_APPLICATION = 0x01,
574  /*ci \brief Use this suffix for writers of data with a key. */
575  RTPS_OBJECT_NORMAL_USER_CST_WRITER = 0x02,
576  /*ci \brief Use this suffix for writers of data with no key. */
577  RTPS_OBJECT_NORMAL_USER_PUBLICATION = 0x03,
578  /*ci \brief Use this suffix for readers of data with no key. */
579  RTPS_OBJECT_NORMAL_USER_SUBSCRIPTION = 0x04,
580  /*ci \brief Use this suffix for readers of data with a key. */
581  RTPS_OBJECT_NORMAL_USER_CST_READER = 0x07,
582  RTPS_OBJECT_NORMAL_USER_VIRTUAL_SUBSCRIPTION = 0x3C,
583  RTPS_OBJECT_NORMAL_USER_VIRTUAL_CST_READER = 0x3D,
584  RTPS_OBJECT_RESERVED_USER_UNKNOWN = 0x40,
585  RTPS_OBJECT_RESERVED_USER_APPLICATION = 0x41,
586  RTPS_OBJECT_RESERVED_USER_CST_WRITER = 0x42,
587  RTPS_OBJECT_RESERVED_USER_PUBLICATION = 0x43,
588  RTPS_OBJECT_RESERVED_USER_SUBSCRIPTION = 0x44,
589  RTPS_OBJECT_RESERVED_USER_CST_READER = 0x47,
590  RTPS_OBJECT_NORMAL_META_UNKNOWN = 0x80,
591  RTPS_OBJECT_NORMAL_META_APPLICATION = 0x81,
592  RTPS_OBJECT_NORMAL_META_CST_WRITER = 0x82,
593  RTPS_OBJECT_NORMAL_META_PUBLICATION = 0x83,
594  RTPS_OBJECT_NORMAL_META_SUBSCRIPTION = 0x84,
595  RTPS_OBJECT_NORMAL_META_CST_READER = 0x87,
596  RTPS_OBJECT_RESERVED_META_UNKNOWN = 0xc0,
597  RTPS_OBJECT_RESERVED_META_APPLICATION = 0xc1,
598  RTPS_OBJECT_RESERVED_META_CST_WRITER = 0xc2,
599  RTPS_OBJECT_RESERVED_META_PUBLICATION = 0xc3,
600  RTPS_OBJECT_RESERVED_META_SUBSCRIPTION = 0xc4,
601  RTPS_OBJECT_RESERVED_META_CST_READER = 0xc7
602 } RTPS_ObjectSuffix;
603 
604 
605 /* ===========================================================================*/
606 /* RTPS types */
607 /* ===========================================================================*/
608 /*ci \brief RTPS locator address max length */
609 #define RTPS_LOCATOR_ADDRESS_LENGTH_MAX 16
610 
611 /*ci \brief
612  * RTPS locator address offset to UDPv4 address (elements 12-15 of array)
613  */
614 #define RTPS_LOCATOR_ADDRESS_UDPV4_OFFSET 12
615 
616 /*ci \brief RTPS Locator type */
617 struct RTPS_Locator_t
618 {
619  /*ci \brief Locator kind */
620  RTI_INT32 kind;
621 
622  /*ci \brief Locator port */
623  RTI_UINT32 port;
624 
625  /*ci \brief Locator address */
626  RTI_UINT8 address[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
627 };
628 
629 /* ci \brief Default locator kind */
630 #define RTPS_LOCATOR_DEFAULT_KIND (-1)
631 
632 /*ci \brief Default locator initializer */
633 #define RTPS_LOCATOR_DEFAULT {\
634  RTPS_LOCATOR_DEFAULT_KIND, /* kind */\
635  0, /* port */\
636  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} /* address */\
637 }
638 
639 /*ci \brief RTPS Locator type */
640 #define RTPS_Locator RTPS_Locator_t
641 
642 /*ci \brief UDPv4 locator type */
643 struct RTPS_LocatorUdpv4_t
644 {
645  /*ci \brief Locator kind */
646  RTI_INT32 kind;
647 
648  /*ci \brief Locator port */
649  RTI_UINT32 port;
650 
651  /*ci \brief Locator address */
652  RTI_UINT32 address;
653 };
654 
655 /*ci \brief Default UDPv4 locator initializer */
656 #define RTPS_LOCATOR_UDPV4_DEFAULT {\
657  RTPS_LOCATOR_DEFAULT_KIND, /* kind */\
658  0, /* port */\
659  0 /* address */\
660 }
661 
662 /*ci \brief Invalid Locator */
663 extern RTPSDllVariable const struct RTPS_Locator_t RTPS_LOCATOR_INVALID;
664 
665 /*ci \brief Invalid Locator kind */
666 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_INVALID;
667 
668 /*ci \brief Invalid Locator port */
669 extern RTPSDllVariable const RTI_UINT32 RTPS_LOCATOR_PORT_INVALID;
670 
671 /*ci \brief Invalid Locator address */
672 extern RTPSDllVariable const RTI_UINT8
673  RTPS_LOCATOR_ADDRESS_INVALID[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
674 
675 /*ci \brief UDPv4 Locator kind */
676 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_UDPv4;
677 
678 /*ci \brief UDPv6 Locator kind */
679 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_UDPv6;
680 
681 /*ci \brief Reserved Locator kind */
682 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_RESERVED;
683 
684 /*ci \brief Shared Memory Locator kind */
685 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_SHMEM;
686 
687 
688 /* ===========================================================================*/
689 /* RTPS Sequence Number */
690 /* ===========================================================================*/
691 
692 
693 /*ci \ingroup RTPS_SequenceNumberClass
694  * \brief Deserialize sequence number from stream buffer
695  *
696  * \details
697  * Post-condition: sequenceNumber is packed and stream pointer is moved forward.
698  *
699  * \param[inout] src_buffer Deserialization stream buffer
700  * \param[out] instance Deserialized instance
701  * \param[in] byte_swap RTI_TRUE if byte swapping is necessary,
702  * RTI_FALSE otherwise.
703  *
704  */
705 RTPSDllExport void
706 RTPS_SequenceNumber_deserialize(char **src_buffer,
707  struct REDA_SequenceNumber *instance,
708  RTI_BOOL byte_swap);
709 
710 
711 /*ci \ingroup RTPS_SequenceNumberClass
712  * \brief Calculate the distance between two sequence numbers.
713  *
714  * \param[in] s1 First sequence number
715  * \param[in] s2 Second sequence number
716  *
717  * \return The distance, possibly saturated to RTPS_BITMAP_DISTANCE_MAX.
718  * -1 on failure.
719  */
720 MUST_CHECK_RETURN RTPSDllExport RTI_INT32
721 RTPS_SequenceNumber_get_distance(
722  const struct REDA_SequenceNumber *s1,
723  const struct REDA_SequenceNumber *s2);
724 
725 /*ci \brief Bitmap array max size
726  * \details Bitmap has maximum 256 bits, using (256/32 =) 8 ints
727  */
728 #define RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX (8)
729 
730 /*ci
731  * \brief Bitmap of sequence numbers received
732  *
733  * \details
734  * Tracks sequence numbers of samples sent or received. Used in send and
735  * window implementations.
736  */
737 struct RTPS_Bitmap
738 {
739  /*ci \brief Starting sequence number of bitmap */
740  struct REDA_SequenceNumber lead;
741 
742  /*ci \brief Number of valid bits or sequence numbers, starting from lead */
743  RTI_INT32 bit_count;
744 
745  /*ci \brief The bitmap stored as an array of integers.
746  *
747  * \details
748  * Maximum of 256 (=8*32) bits or sequence numbers.
749  * This must be unsigned in order to apply the >> operator.
750  * There are two approaches to handle bits outside bitCount:
751  * 1) They must always be zeroed.
752  * 2) They can be anything.
753  * The first approach puts the burden on otherwise simple
754  * methods such as truncate to zero out truncated bits, whereas
755  * the second approach puts the burden on methods such as shift
756  * to make sure bits beyond the bitCount are not shifted in.
757  * In our implementation, we have opted for the second approach.
758  */
759  RTI_UINT32 bits[RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX];
760 };
761 
762 /*ci \brief Maximum number of bits in bitmap */
763 #define RTPS_BITMAP_SIZE_MAX (256)
764 
765 /*ci \brief Maximum bitmap sequence number distance */
766 #define RTPS_BITMAP_DISTANCE_MAX (0x7FFFFFFF)
767 
768 /*ci \brief Reset bitmap to specified lead and bitCount
769  *
770  * \details Post condition: bitmap has its lead and bit count assigned, and
771  * all bits are reset to zero.
772  *
773  * \param[in] me Bitmap
774  * \param[in] sn New lead sequence number
775  * \param[in] bit_count New bit count. Must be <= RTPS_BITMAP_SIZE_MAX.
776  *
777  */
778 RTPSDllExport void
779 RTPS_Bitmap_reset(
780  struct RTPS_Bitmap *me,
781  const struct REDA_SequenceNumber *sn,
782  RTI_INT32 bit_count);
783 
784 /*ci \ingroup RTPS_BitmapClass
785  * \brief Set specified bit in bitmap.
786  *
787  * \details
788  * The bit corresponding to the input sequence number is set to either
789  * 0 or 1 as specified in input param.
790  *
791  * \param[in] me Bitmap
792  * \param[out] existed RTI_TRUE if bit is already set, RTI_FALSE otherwise.
793  * \param[in] num The sequence number of interest.
794  * \param[in] bit RTI_TRUE if bit is to be turned on, RTI_FALSE otherwise.
795  *
796  * \return RTI_FALSE on failure, which includes the sequence not in bitmap.
797  * RTI_TRUE on success.
798  */
799 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
800 RTPS_Bitmap_set_bit(struct RTPS_Bitmap *me,
801  RTI_BOOL *existed,
802  const struct REDA_SequenceNumber *num,
803  RTI_BOOL bit);
804 
805 /*ci \ingroup RTPS_BitmapClass
806  * \brief Get specified bit in bitmap.
807  *
808  * \details
809  * The bit corresponding to the input sequence number is set to either
810  * 0 or 1 as specified in input param.
811  *
812  * \param[in] me Bitmap
813  * \param[in] bit Pointer to the answer, whose value will be RTI_TRUE
814  if bit is on and RTI_FALSE otherwise.
815  * \param[in] num The sequence number of interest.
816  *
817  * \return RTI_FALSE on failure, which includes the sequence not in bitmap.
818  * RTI_TRUE on success.
819  */
820 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
821 RTPS_Bitmap_get_bit(
822  const struct RTPS_Bitmap *me,
823  RTI_BOOL *bit,
824  const struct REDA_SequenceNumber *num);
825 
826 /*ci
827  * \brief
828  * Get the sequence number of the first bit in bitmap that matches the input
829  * value
830  *
831  * \param[in] me Bitmap
832  * \param[out] position Sequence number of first bit matching searchBit. If
833  * no match found, position is one greater than last valid bit of bitmap.
834  * \param[in] search_bit Value of bit for which to search
835  *
836  * \return RTI_TRUE on successfully finding matching bit, RTI_FALSE on failure
837  */
838 SHOULD_CHECK_RETURN RTPSDllExport RTI_BOOL
839 RTPS_Bitmap_get_first_bit(
840  const struct RTPS_Bitmap *me,
841  struct REDA_SequenceNumber *position,
842  RTI_BOOL search_bit);
843 
844 /*ci
845  * \brief
846  * Get the sequence number of the last bit in bitmap that matches the input
847  * value
848  *
849  * \param[in] me Bitmap
850  * \param[out] position Sequence number of last bit matching searchBit. If
851  * no match found, position is zero.
852  * \param[in] search_bit Value of bit for which to search
853  *
854  * \return RTI_TRUE on successfully finding matching bit, RTI_FALSE on failure
855  */
856 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
857 RTPS_Bitmap_get_last_bit(
858  const struct RTPS_Bitmap *me,
859  struct REDA_SequenceNumber *position,
860  RTI_BOOL search_bit);
861 
862 /*ci
863  * \brief
864  * Fill a range of bits in bitmap with specified value
865  *
866  * \param[in] me Bitmap
867  * \param[in] first_seq_num First sequence number in range to fill
868  * \param[in] last_seq_num Last sequence number in range to fill
869  * \param[in] bit Value to set bits in range
870  *
871  * \return RTI_TRUE on success, RTI_FALSE on failure
872  */
873 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
874 RTPS_Bitmap_fill(
875  struct RTPS_Bitmap *me,
876  const struct REDA_SequenceNumber *first_seq_num,
877  const struct REDA_SequenceNumber *last_seq_num,
878  RTI_BOOL bit);
879 
880 
881 /*ci
882  * \brief
883  * Merge another bitmap with self bitmap
884  *
885  * \details
886  * Copies '1' bits from source bitmap whose sequence numbers overlap with self
887  * bitmap. Bitcount and lead SN of self bitmap are preserved.
888  *
889  * \param[in] me Self bitmap
890  * \param[in] source Bitmap to merge with self
891  *
892  */
893 RTPSDllExport void
894 RTPS_Bitmap_merge(
895  struct RTPS_Bitmap *me,
896  const struct RTPS_Bitmap *source);
897 
898 /*ci
899  * \brief
900  * Shift lead sequence number of bitmap to new value
901  *
902  * \details
903  * Preserves bitcount of bitmap, setting new shifted-in bits to zero.
904  *
905  * \param[in] me Self bitmap
906  * \param[in] seq_num New lead sequence number
907  *
908  * \return RTI_TRUE on success, RTI_FALSE on failure
909  */
910 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
911 RTPS_Bitmap_shift(struct RTPS_Bitmap *me,
912  const struct REDA_SequenceNumber *seq_num);
913 
914 /*ci
915  * \brief Return the number of unreserved samples in the receive window.
916  *
917  * \param[in] me The bitmap to shift
918  * \param[in] seq_num New lead sequence number
919  *
920  * \return The number of unreserved samples
921  */
922 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
923 RTPS_Bitmap_get_unreserved_count(struct RTPS_Bitmap *me,
924  const struct REDA_SequenceNumber *seq_num);
925 
926 /*ci
927  * \brief
928  * Truncates bitmap to end at specified sequence number
929  *
930  * \details
931  * Updates bitcount of bitmap to reflect number of valid bits up to truncated
932  * sequence number. If truncation sequence number is greater than current last
933  * sequence number of bitmap, no truncation is done and bitcount stays the same.
934  *
935  * \param[in] me Self bitmap
936  * \param[in] seq_num Sequence number after which bitmap is truncated.
937  *
938  */
939 RTPSDllExport void
940 RTPS_Bitmap_truncate(
941  struct RTPS_Bitmap *me,
942  const struct REDA_SequenceNumber *seq_num);
943 
944 /*ci
945  * \brief
946  * Toggle bits of bitmap
947  *
948  * \details
949  * Change '1' to '0' and vice versa.
950  *
951  * \param[inout] me Self bitmap
952  *
953  */
954 RTPSDllExport void
955 RTPS_Bitmap_invert(struct RTPS_Bitmap *me);
956 
957 /*ci
958  * \brief
959  * Deserialize from buffer a bitmap
960  *
961  * \details
962  * Change '1' to '0' and vice versa.
963  *
964  * \param[in] me Self bitmap
965  * \param[in] stream_ptr Pointer to serialized buffer
966  * \param[in] max_bits_len Remaining space of submessage to deserialize
967  * the variable length bits of bitmap
968  * \param[in] need_byte_swap Flag whether byte swap is necessary for
969  * deserialization
970  *
971  * \return RTI_TRUE on success, RTI_FALSE on failure
972  *
973  */
974 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
975 RTPS_Bitmap_deserialize(
976  struct RTPS_Bitmap *me,
977  const char **stream_ptr,
978  RTI_UINT32 max_bits_len,
979  RTI_BOOL need_byte_swap);
980 
981 /******************************************************************************/
982 /*ci
983  * \brief
984  * Serialize GUID to stream buffer
985  *
986  * \param[inout] stream Serialization stream
987  * \param[in] guid GUID to serialize
988  * \param[in] param Unused
989  *
990  * \return RTI_TRUE on success, RTI_FALSE on failure
991  */
992 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
993 RTPS_Guid_serialize(
994  struct CDR_Stream_t *stream,
995  const struct RTPS_Guid *guid,
996  void * param);
997 
998 /*ci
999  * \brief
1000  * Deserialize GUID from stream buffer
1001  *
1002  * \param[in] stream Deserialization stream
1003  * \param[inout] guid Deserialized GUID
1004  * \param[in] param Unused
1005  *
1006  * \return RTI_TRUE on success, RTI_FALSE on failure
1007  */
1008 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1009 RTPS_Guid_deserialize(
1010  struct CDR_Stream_t *stream,
1011  struct RTPS_Guid *guid,
1012  void * param);
1013 
1014 /*ci
1015  * \brief
1016  * Length in bytes of serialized GUID
1017  *
1018  * \param[in] size Current length of serialized buffer
1019  *
1020  * \return Number of bytes of serialized GUID
1021  */
1022 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1023 RTPS_Guid_get_max_size_serialized(RTI_UINT32 size);
1024 
1025 /* -------------------------------------------------------------------------- */
1026 /*ci
1027  * \brief
1028  * Serialize NTP time to stream buffer
1029  *
1030  * \param[inout] stream Serialization stream
1031  * \param[in] time NTP time to serialize
1032  * \param[in] param Unused
1033  *
1034  * \return RTI_TRUE on success, RTI_FALSE on failure
1035  */
1036 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1037 RTPS_serialize_ntp_time(
1038  struct CDR_Stream_t *stream,
1039  const OSAPI_NtpTime *time,
1040  void * param);
1041 
1042 /*ci
1043  * \brief
1044  * Deserialize NTP time from stream buffer
1045  *
1046  * \param[in] stream Deserialization stream
1047  * \param[inout] time Deserialized NTP time
1048  * \param[in] param Unused
1049  *
1050  * \return RTI_TRUE on success, RTI_FALSE on failure
1051  */
1052 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1053 RTPS_deserialize_ntp_time(
1054  struct CDR_Stream_t *stream,
1055  OSAPI_NtpTime *time,
1056  void * param);
1057 
1058 /*ci
1059  * \brief
1060  * Length in bytes of serialized NTP time
1061  *
1062  * \param[in] size Current length of serialized buffer
1063  *
1064  * \return Number of bytes of serialized NTP time
1065  */
1066 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1067 RTPS_get_ntp_time_max_size_serialized(RTI_UINT32 size);
1068 
1069 /* -------------------------------------------------------------------------- */
1070 /*ci
1071  * \brief
1072  * Serialize unsigned short to stream buffer
1073  *
1074  * \param[inout] stream Serialization stream
1075  * \param[in] in Value to serialize
1076  * \param[in] param Unused
1077  *
1078  * \return RTI_TRUE on success, RTI_FALSE on failure
1079  */
1080 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1081 RTPS_serialize_2_octets(
1082  struct CDR_Stream_t *stream,
1083  const RTI_UINT16 * in,
1084  void * param);
1085 
1086 /*ci
1087  * \brief
1088  * Deserialize unsigned short from stream buffer
1089  *
1090  * \param[in] stream Deserialization stream
1091  * \param[inout] out Deserialized value
1092  * \param[in] param Unused
1093  *
1094  * \return RTI_TRUE on success, RTI_FALSE on failure
1095  */
1096 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1097 RTPS_deserialize_2_octets(
1098  struct CDR_Stream_t *stream,
1099  RTI_UINT16 *out,
1100  void * param);
1101 
1102 /*ci
1103  * \brief
1104  * Length in bytes of serialized unsigned short
1105  *
1106  * \param[in] size Current length of serialized buffer
1107  *
1108  * \return Number of bytes of serialized unsigned short
1109  */
1110 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1111 RTPS_get_2_octets_max_size_serialized(RTI_UINT32 size);
1112 
1113 /* -------------------------------------------------------------------------- */
1114 /*ci
1115  * \brief
1116  * Serialize locator to stream buffer
1117  *
1118  * \param[inout] stream Serialization stream
1119  * \param[in] loc Locator to serialize
1120  * \param[in] param Unused
1121  *
1122  * \return RTI_TRUE on success, RTI_FALSE on failure
1123  */
1124 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1125 RTPS_serialize_ipv6_locator(
1126  struct CDR_Stream_t *stream,
1127  const struct RTPS_Locator_t *loc,
1128  void * param);
1129 
1130 /*ci
1131  * \brief
1132  * Deserialize locator from stream buffer
1133  *
1134  * \param[in] stream Deserialization stream
1135  * \param[inout] loc Deserialized locator
1136  * \param[in] param Unused
1137  *
1138  * \return RTI_TRUE on success, RTI_FALSE on failure
1139  */
1140 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1141 RTPS_deserialize_ipv6_locator(
1142  struct CDR_Stream_t *stream,
1143  struct RTPS_Locator_t *loc,
1144  void * param);
1145 
1146 /*ci
1147  * \brief
1148  * Length in bytes of serialized locator
1149  *
1150  * \param[in] size Current length of serialized buffer
1151  *
1152  * \return Number of bytes of serialized locator
1153  */
1154 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1155 RTPS_get_ipv6_locator_max_size_serialized(RTI_UINT32 size);
1156 
1157 /* -------------------------------------------------------------------------- */
1158 /*ci \brief Deserialize epoch from stream buffer
1159  *
1160  * \param[inout] me Deserialized epoch
1161  * \param[in] stream Deserialization stream
1162  * \param[in] need_byte_swap Flags whether to byte swap byte order on
1163  * deserialization
1164  *
1165  * \return RTI_TRUE on success, RTI_FALSE on failure
1166  */
1167 RTPSDllExport void
1168 RTPS_Epoch_deserialize(REDA_Epoch_T * me,
1169  const char **stream,
1170  RTI_BOOL need_byte_swap);
1171 
1172 
1173 /*ci \brief RTPS GUID type */
1174 typedef struct NETIO_Guid RTPS_GUID;
1175 
1176 /*ci \brief RTPS GuidPrefix type */
1177 typedef struct NETIO_GuidPrefix RTPS_GuidPrefix_T;
1178 
1179 /*ci \brief RTPS Entity type */
1180 typedef struct NETIO_GuidEntity RTPS_Entity_T;
1181 
1182 /*ci \brief Default unknown GUID prefix initializer */
1183 #define RTPS_GUIDPREFIX_UNKNOWN {{0,0,0,0,0,0,0,0,0,0,0,0}}
1184 
1185 /*ci \brief Default unknown Entity ID initializer */
1186 #define RTPS_ENTITY_UNKNOWN {{0,0,0,0}}
1187 
1188 /* -------------------------------------------------------------------------- */
1189 /*ci \brief RTPS Timestamp type */
1190 struct RTPS_Time
1191 {
1192  /*ci \brief Seconds */
1193  RTI_INT32 seconds;
1194 
1195  /*ci \brief Fractional part */
1196  RTI_UINT32 fractions;
1197 };
1198 
1199 /*ci \brief RTPS Vendor ID type */
1200 struct RTPS_Vendor
1201 {
1202  /*ci \brief Vendor ID value */
1203  RTI_UINT8 value[2];
1204 };
1205 
1206 /*ci \brief RTPS Protocol Version type */
1207 struct RTPS_ProtocolVersion
1208 {
1209  /*ci \brief Major */
1210  RTI_UINT8 major;
1211 
1212  /*ci \brief Minor */
1213  RTI_UINT8 minor;
1214 };
1215 
1216 /*ci \brief RTPS message header
1217  * \details
1218  * Fields are ordered exactly as defined by RTPS specification
1219  */
1220 struct RTPS_Header
1221 {
1222  /*ci \brief 'R''T''P''S' protocol identifier */
1223  RTI_UINT32 rtps;
1224 
1225  /*ci \brief Protocol version */
1226  struct RTPS_ProtocolVersion protocol_version;
1227 
1228  /*ci \brief Vendor ID */
1229  struct RTPS_Vendor vendor_id;
1230 
1231  /*ci \brief Sender's GUID Prefix*/
1232  RTPS_GuidPrefix_T guid_prefix;
1233 };
1234 
1235 /*ci \brief RTPS message header's RTPS identifier, in host order */
1236 #ifdef RTI_ENDIAN_LITTLE
1237 #define VALID_RTPS_HEADER 0x53505452 /* RTPS backwards */
1238 #else
1239 #define VALID_RTPS_HEADER 0x52545053 /* RTPS in big endian */
1240 #endif /* RTI_ENDIAN_LITTLE */
1241 
1242 /******************************************************************************/
1243 
1244 /* RTPS Submessage IDs */
1245 /*ci \brief PAD submessage ID */
1246 #define RTPS_PAD_KIND (0x01)
1247 
1248 /*ci \brief ACKNACK submessage ID */
1249 #define RTPS_ACKNACK_KIND (0x06)
1250 
1251 /*ci \brief HEARTBEAT submessage ID */
1252 #define RTPS_HEARTBEAT_KIND (0x07)
1253 
1254 /*ci \brief GAP submessage ID */
1255 #define RTPS_GAP_KIND (0x08)
1256 
1257 /*ci \brief INFO_TS submessage ID */
1258 #define RTPS_INFO_TS_KIND (0x09)
1259 
1260 /*ci \brief INFO_SRC submessage ID */
1261 #define RTPS_INFO_SRC_KIND (0x0c)
1262 
1263 /*ci \brief INFO_REPLY_IP4 submessage ID */
1264 #define RTPS_INFO_REPLY_IP4_KIND (0x0d)
1265 
1266 /*ci \brief INFO_DST submessage ID */
1267 #define RTPS_INFO_DST_KIND (0x0e)
1268 
1269 /*ci \brief INFO_REPLY submessage ID */
1270 #define RTPS_INFO_REPLY_KIND (0x0f)
1271 
1272 /*ci \brief DATA submessage ID */
1273 #define RTPS_DATA_KIND (0x15)
1274 
1275 /*ci \brief BATCH DATA submessage ID */
1276 #define RTPS_DATA_BATCH_KIND (0x18)
1277 
1278 /*ci \brief BATCH HEARTBEAT submessage ID */
1279 #define RTPS_HEARTBEAT_BATCH_KIND (0x19)
1280 
1281 /*ci \brief Length of RTPS submessage header */
1282 #define RTPS_SUBMESSAGE_HEADER_LENGTH 4
1283 
1284 
1285 /*ci \brief RTPS submessage header
1286  *
1287  * \details
1288  * Fields ordered exactly as defined by RTPS specification
1289  */
1290 struct RTPS_SubmsgHdr
1291 {
1292  /*ci \brief Submessage kind ID */
1293  RTI_UINT8 kind;
1294 
1295  /*ci \brief Submessage flags */
1296  RTI_UINT8 flags;
1297 
1298  /*ci \brief Submessage length */
1299  RTI_UINT16 length;
1300 };
1301 
1302 /*ci \brief Submessage little endianness flag */
1303 #define RTPS_SUBMSG_FLAG_E 0x1
1304 
1305 /******************************************************************************/
1306 /*ci \brief ACKNACK submessage, over-the-wire layout */
1307 struct RTPS_ACKNACK
1308 {
1309  /*ci \brief Submesage header */
1310  struct RTPS_SubmsgHdr hdr;
1311 
1312  /*ci \brief Source reader's entity ID */
1313  RTPS_Entity_T reader;
1314 
1315  /*ci \brief Destination writer's entity ID */
1316  RTPS_Entity_T writer;
1317 
1318  /*ci \brief Bitmap (variable length) */
1319  struct RTPS_Bitmap bitmap;
1320 
1321  /*ci \brief Epoch count */
1322  RTI_UINT32 count;
1323 };
1324 
1325 /*ci \brief ACKNACK Final flag */
1326 #define RTPS_ACKNACKFLAGS_F 0x2
1327 
1328 /******************************************************************************/
1329 /*ci \brief RTPS DATA submessage
1330  *
1331  * \details
1332  * Fixed length fields declared in type. Variable length fields (inline QoS,
1333  * DATA payload) accounted for later when setting DATA submessage.
1334  */
1335 struct RTPS_DATA
1336 {
1337  /*ci \brief Submessage header */
1338  struct RTPS_SubmsgHdr hdr;
1339 
1340  /*ci \brief Submessage flags */
1341  RTI_UINT16 flags;
1342 
1343  /*ci \brief Inline Qos offset */
1344  RTI_UINT16 qos_offset;
1345 
1346  /*ci \brief Destination reader entity ID */
1347  RTPS_Entity_T reader;
1348 
1349  /*ci \brief Source writer entity ID */
1350  RTPS_Entity_T writer;
1351 
1352  /*ci \brief Sequence number */
1353  struct REDA_SequenceNumber sn;
1354 };
1355 
1356 /*ci \brief Default empty DATA submessage flag */
1357 #define RTPS_FLAGS_NONE 0x0
1358 
1359 /*ci \brief Inline Qos Q-flag for DATA submessage */
1360 #define RTPS_DATAFLAGS_Q 0x2
1361 
1362 /*ci \brief Data D-flag for DATA submessage */
1363 #define RTPS_DATAFLAGS_D 0x4
1364 
1365 /*ci \brief Data K-flag for DATA submessage */
1366 #define RTPS_DATAFLAGS_K 0x8
1367 
1368 /*ci \brief Default Inline Qos offset */
1369 #define RTPS_DATA_INLINEQOS_OFFSET 16
1370 
1371 /******************************************************************************/
1372 /*ci \brief RTPS DATA_BATCH submessage
1373  *
1374  * \details
1375  * Fixed length fields declared in type. Variable length fields (inline QoS,
1376  * DATA payload) accounted for later when setting DATA_BATCH submessage.
1377  */
1378 struct RTPS_DATA_BATCH
1379 {
1380  /*ci \brief Submessage header */
1381  struct RTPS_SubmsgHdr hdr;
1382 
1383  /*ci \brief Submessage flags */
1384  RTI_UINT16 flags;
1385 
1386  /*ci \brief Inline Qos offset */
1387  RTI_UINT16 qos_offset;
1388 
1389  /*ci \brief Destination reader entity ID */
1390  RTPS_Entity_T reader;
1391 
1392  /*ci \brief Source writer entity ID */
1393  RTPS_Entity_T writer;
1394 
1395  /*ci \brief Batch sequence number */
1396  struct REDA_SequenceNumber batch_sn;
1397 
1398  /*ci \brief First sample sequence number */
1399  struct REDA_SequenceNumber first_sample_sn;
1400 
1401  /*ci \brief Offset to last sample sn */
1402  RTI_UINT32 offset_last_sn;
1403 
1404  /*ci \brief Batch sample count */
1405  RTI_UINT32 batch_sample_count;
1406 
1407  /*ci \brief Octets to SL Encapsulation Id */
1408  RTI_UINT32 encapsulation_offset;
1409 };
1410 
1411 /*ci \brief Timestamp T-flag for DATA_BATCH submessage */
1412 #define RTPS_DATABATCHFLAGS_T 0x1
1413 
1414 /*ci \brief Inline Qos Q-flag for DATA_BATCH submessage */
1415 #define RTPS_DATABATCHFLAGS_Q 0x2
1416 
1417 /*ci \brief OffsetSN O-flag for DATA_BATCH submessage */
1418 #define RTPS_DATABATCHFLAGS_O 0x4
1419 
1420 /*ci \brief Data D-flag for DATA_BATCH submessage */
1421 #define RTPS_DATABATCHFLAGS_D 0x8
1422 
1423 /*ci \brief Invalid I-flag for DATA_BATCH submessage */
1424 #define RTPS_DATABATCHFLAGS_I 0x10
1425 
1426 /*ci \brief Seralized Key K-flag for DATA_BATCH submessage */
1427 #define RTPS_DATABATCHFLAGS_K 0x20
1428 
1429 /******************************************************************************/
1430 /*ci \brief GAP submessage */
1431 struct RTPS_GAP
1432 {
1433  /*ci \brief Submessage header */
1434  struct RTPS_SubmsgHdr hdr;
1435 
1436  /*ci \brief Destination reader entity ID */
1437  RTPS_Entity_T reader;
1438 
1439  /*ci \brief Source writer entity ID */
1440  RTPS_Entity_T writer;
1441 
1442  /*ci \brief Sequence number of start of GAP */
1443  struct REDA_SequenceNumber sn_start;
1444 
1445  /*ci \brief Bitmap */
1446  struct RTPS_Bitmap bitmap; /* variable length */
1447 };
1448 
1449 /******************************************************************************/
1450 /*ci \brief HEARTBEAT submessage */
1451 struct RTPS_HEARTBEAT
1452 {
1453  /*ci \brief Submessage header */
1454  struct RTPS_SubmsgHdr hdr;
1455 
1456  /*ci \brief Destination reader entity ID */
1457  RTPS_Entity_T reader;
1458 
1459  /*ci \brief Source writer entity ID */
1460  RTPS_Entity_T writer;
1461 
1462  /*ci \brief First sequence number */
1463  struct REDA_SequenceNumber sn_first;
1464 
1465  /*ci \brief Last sequence number */
1466  struct REDA_SequenceNumber sn_last;
1467 
1468  /*ci \brief Epoch count */
1469  RTI_INT32 count;
1470 };
1471 
1472 /******************************************************************************/
1473 /*ci \brief HEARTBEAT_BATCH submessage */
1474 struct RTPS_HEARTBEAT_BATCH
1475 {
1476  /*ci \brief Submessage header */
1477  struct RTPS_SubmsgHdr hdr;
1478 
1479  /*ci \brief Destination reader entity ID */
1480  RTPS_Entity_T reader;
1481 
1482  /*ci \brief Source writer entity ID */
1483  RTPS_Entity_T writer;
1484 
1485  /*ci \brief First batch sequence number */
1486  struct REDA_SequenceNumber sn_batch_first;
1487 
1488  /*ci \brief Last batch sequence number */
1489  struct REDA_SequenceNumber sn_batch_last;
1490 
1491  /*ci \brief First sequence number */
1492  struct REDA_SequenceNumber sn_first;
1493 
1494  /*ci \brief Last sequence number */
1495  struct REDA_SequenceNumber sn_last;
1496 
1497  /*ci \brief Epoch count */
1498  RTI_INT32 count;
1499 };
1500 
1501 /*ci \brief Final HEARTBEAT submesasge flag */
1502 #define RTPS_HBFLAGS_F 0x02
1503 
1504 /*ci \brief Liveliness HEARTBEAT submessage flag */
1505 #define RTPS_HBFLAGS_L 0x04
1506 
1507 /******************************************************************************/
1508 /*ci \brief INFO_DST submessage */
1509 struct RTPS_INFO_DST
1510 {
1511  /*ci \brief Submessage header */
1512  struct RTPS_SubmsgHdr hdr;
1513 
1514  /*ci \brief Destination GUID prefix */
1515  RTPS_GuidPrefix_T guid_prefix;
1516 };
1517 
1518 /******************************************************************************/
1519 /*ci \brief INFO_TS submessage */
1520 struct RTPS_INFO_TS
1521 {
1522  /*ci \brief Submessage header */
1523  struct RTPS_SubmsgHdr hdr;
1524 
1525  /*ci \brief Source timestamp */
1526  struct RTPS_Time timestamp;
1527 };
1528 
1529 /*ci \brief Invalid Timestamp INFO_TS flag */
1530 #define RTPS_INFO_TSFLAGS_I (0x2)
1531 
1532 /******************************************************************************/
1533 /*ci \brief RTPS headers and submessages
1534  *
1535  * \details
1536  * Used to typecast serialized/deserialized stream buffer
1537  */
1538 union RTPS_MESSAGES
1539 {
1540  /*ci \brief Submessage header */
1541  struct RTPS_SubmsgHdr submsg;
1542 
1543  /*ci \brief Message header */
1544  struct RTPS_Header header;
1545 
1546  /*ci \brief DATA submessage */
1547  struct RTPS_DATA data;
1548 
1549  /*ci \brief DATA_BATCH submessage */
1550  struct RTPS_DATA_BATCH data_batch;
1551 
1552  /*ci \brief GAP submessage */
1553  struct RTPS_GAP gap;
1554 
1555  /*ci \brief HEARTBEAT submessage */
1556  struct RTPS_HEARTBEAT hb;
1557 
1558  /*ci \brief HEARTBEAT_BATCH submessage */
1559  struct RTPS_HEARTBEAT_BATCH hb_batch;
1560 
1561  /*ci \brief ACKNACK submessage */
1562  struct RTPS_ACKNACK acknack;
1563 
1564  /*ci \brief INFO_TS submessage */
1565  struct RTPS_INFO_TS info_ts;
1566 
1567  /*ci \brief INFO_DST submessage */
1568  struct RTPS_INFO_DST info_dst;
1569 };
1570 
1571 /******************************************************************************/
1572 /*ci \brief RTPS interface mode */
1573 typedef enum
1574 {
1575  /*ci \brief Default undefined mode */
1576  RTPS_INTERFACEMODE_UNDEFINED,
1577 
1578  /*ci \brief Writer mode */
1579  RTPS_INTERFACEMODE_WRITER,
1580 
1581  /*ci \brief Reader mode */
1582  RTPS_INTERFACEMODE_READER,
1583 
1584  /*ci \brief External receiver mode */
1585  RTPS_INTERFACEMODE_EXTERNAL_RECEIVER
1586 } RTPS_InterfaceMode_t;
1587 
1588 /*ci \brief RTPS interface property */
1589 struct RTPS_InterfaceProperty
1590 {
1591  /*ci \brief Base NETIO interface property */
1592  struct NETIO_InterfaceProperty _parent;
1593 
1594  /*ci \brief RTPS interface mode */
1595  RTPS_InterfaceMode_t mode;
1596 
1597  /*ci \brief RTPS interface GUID address */
1598  struct NETIO_Address intf_address;
1599 
1600  /*ci \brief Maximum number of peers */
1601  RTI_INT32 max_peer_count;
1602 
1603  /*ci \brief RTI_TRUE for reliable writer or reader */
1604  RTI_BOOL reliable;
1605 
1606  /*ci \brief RTI_TRUE for anonymous writer or reader */
1607  RTI_BOOL anonymous;
1608 
1609  /*ci \brief HEARTBEAT period for reliable writer */
1610  struct OSAPI_NtpTime hb_period;
1611 
1612  /*ci \brief Piggyback HEARTBEAT rate for reliable writer
1613  *
1614  * \details
1615  * A HEARTBEAT submessage is appended to every Nth new DATA submessage
1616  * sent, where N is sample_per_hb.
1617  */
1618  RTI_SIZE_T samples_per_hb;
1619 
1620  /*ci \brief Maximum window size for writer or reader */
1621  RTI_UINT32 max_window_size;
1622 
1623  /*ci \brief Maximum HEARTBEAT retries for reliable writer
1624  *
1625  * \details
1626  * A peer reader must respond to a reliable writer's HEARTBEATs to be
1627  * considered active. If N periodic HEARTBEATs have been sent without
1628  * reciving an ACKNACK, where N is maxhb_retries, the peer reader is
1629  * then considered inactive and will stay inactive until an ACKNACK is
1630  * received.
1631  */
1632  RTI_INT32 max_hb_retries;
1633 
1634  /*ci \brief Maximum number of samples of upstream interface */
1635  RTI_INT32 max_samples;
1636 #if OSAPI_ENABLE_TRACE
1637  const char *session_name;
1638 #endif
1639 };
1640 
1641 #if OSAPI_ENABLE_TRACE
1642 #define RTPS_SESSION_NAME_INIT ,NULL
1643 #else
1644 #define RTPS_SESSION_NAME_INIT
1645 #endif
1646 
1647 /*ci \brief Unlimited max HEARTBEAT retries */
1648 #define RTPS_RETRIES_UNLIMITED (-1)
1649 
1650 /*ci \brief Maximum receive window size */
1651 #define RTPS_RECEIVE_WINDOW_MAX_SIZE (256)
1652 
1653 /*ci \brief Default RTPS interface property initializer */
1654 #define RTPS_InterfaceProperty_INITIALIZER \
1655 {\
1656  NETIO_InterfaceProperty_INITIALIZER,\
1657  RTPS_INTERFACEMODE_UNDEFINED,\
1658  NETIO_Address_INITIALIZER, \
1659  4, /* max_peer_count */ \
1660  RTI_FALSE, /* reliable */ \
1661  RTI_FALSE, /* anonymous */ \
1662  {3,0}, /* hb_period */ \
1663  8, /* samples_per_hb */ \
1664  256, /* window_size */ \
1665  RTPS_RETRIES_UNLIMITED, /* max_hb_retries */\
1666  256 /* max_samples */ \
1667  RTPS_SESSION_NAME_INIT \
1668 }
1669 
1670 /*ci \brief Property for an RTPS route */
1671 struct RTPS_RouteProperty
1672 {
1673  /*ci \brief Base NETIO route property */
1674  struct NETIORouteProperty _parent;
1675 
1676  /*ci \brief Reliable flag of peer reachable over route */
1677  RTI_BOOL reliable;
1678 
1679  /*ci \brief First sequence number of upstream interface creating the
1680  * route
1681  */
1682  struct REDA_SequenceNumber first_sn;
1683 
1684  /*ci \brief Last sequence number of upstream interface creating the
1685  * route
1686  */
1687  struct REDA_SequenceNumber last_sn;
1688 
1689  /*ci \brief Last acknowledged sequence number of upstream interface
1690  * creating the route
1691  */
1692  struct REDA_SequenceNumber last_acked_sn;
1693 };
1694 
1695 /*ci \brief Default RTPS route property initializer */
1696 #define RTPSRouteProperty_INITIALIZER \
1697 {\
1698  NETIORouteProperty_INITIALIZER, \
1699  RTI_FALSE, /* reliable */ \
1700  REDA_SEQUENCE_NUMBER_ZERO,\
1701  REDA_SEQUENCE_NUMBER_ZERO, \
1702  REDA_SEQUENCE_NUMBER_ZERO \
1703 }
1704 
1705 /*ci \brief Get RTPS inteface factory
1706  * \return Pointer to RTPS interface factory
1707  */
1708 MUST_CHECK_RETURN RTPSDllExport struct RT_ComponentFactoryI*
1709 RTPS_InterfaceFactory_get_interface(void);
1710 
1711 #ifdef __cplusplus
1712 } /* extern "C" */
1713 #endif
1714 
1715 #include "rtps/rtps_rtps_impl.h"
1716 
1717 #endif /* rtps_rtps_h */

RTI Connext DDS Micro Version 2.4.11 Copyright © Mon Jul 23 2018 Real-Time Innovations, Inc