RTI Connext DDS Micro  Version 2.4.10
 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_ParameterSequenceClass
270  * \brief Builtin endpoint mask parameter ID
271  *
272  * \details Indicate builtin endpoint set inline Qos,
273  * PID_BUILTIN_ENDPOINT_SET from the RTPS spec
274  */
275 #define RTPS_PID_BUILTIN_ENDPOINT_MASK (0x0058)
276 
277 /*ci \ingroup RTPS_ParameterSequenceClass
278  * \brief Endpoint GUID parameter ID
279  */
280 #define RTPS_PID_ENDPOINT_GUID (0x005A)
281 
282 /*ci \ingroup RTPS_ParameterSequenceClass
283  * \brief Entity name parameter ID
284  */
285 #define RTPS_PID_ENTITY_NAME (0x0062)
286 
287 /******************************************************************************/
288 /*ci \ingroup RTPS_ParameterSequenceClass
289  * \brief Key Hash parameter ID
290  */
291 #define RTPS_PID_KEY_HASH (0x0070)
292 
293 /*ci \brief Key Hash parameter length */
294 #define RTPS_KEY_HASH_PARAM_LENGTH (16)
295 
296 /*ci \ingroup RTPS_ParameterSequenceClass
297  * \brief Status info parameter ID
298  */
299 #define RTPS_PID_STATUS_INFO (0x0071)
300 
301 /*ci \brief Status info parameter length */
302 #define RTPS_STATUS_INFO_PARAM_LENGTH (4)
303 
304 /*ci \brief Send queue size parameter ID */
305 #define RTPS_PID_SEND_QUEUE_SIZE_DEPRECATED (0x0013)
306 
307 /******************************************************************************/
308 /*ci \ingroup RTPS_Class
309  * \brief Host ID of GUID
310  */
311 typedef RTI_UINT32 RTPS_HostId;
312 
313 /*ci \ingroup RTPS_Class
314  * \brief Unknown Host ID
315  */
316 #define RTPS_HOST_ID_UNKNOWN (0x00000000)
317 
318 /*ci \ingroup RTPS_Class
319  * \brief Application ID of GUID
320  */
321 typedef RTI_UINT32 RTPS_AppId;
322 
323 /*ci \ingroup RTPS_Class
324  * \brief Unknown Application ID
325  */
326 #define RTPS_APP_ID_UNKNOWN (0x00000000)
327 
328 /*ci \ingroup RTPS_Class
329  * \brief Instance ID of GUID
330  */
331 typedef RTI_UINT32 RTPS_InstanceId;
332 
333 /*ci \ingroup RTPS_Class
334  * \brief Unknown Instance ID
335  */
336 #define RTPS_INSTANCE_ID_UNKNOWN (0x00000000)
337 
338 /*ci \ingroup RTPS_Class
339  * \brief Object ID of GUID
340  */
341 typedef RTI_UINT32 RTPS_ObjectId;
342 
343 /*ci \ingroup RTPS_Class
344  * \brief Unknown Object ID
345  */
346 #define RTPS_OBJECT_ID_UNKNOWN (0x00000000)
347 
348 /*ci \ingroup RTPS_Class
349  * \brief Maximum Object ID
350  */
351 #define RTPS_OBJECT_ID_MAX (0xFFFFFFFF)
352 
353 /******************************************************************************/
354 /*ci \ingroup RTPS_Class
355  * \brief Prefix portion of GUID.
356  *
357  * \details Uniquely identifies the DomainParticipant to which
358  * an RTPS's DDS entity belong
359  */
360 struct RTPS_GuidPrefix
361 {
362  /*ci \brief First field of GUID Prefix.
363  * \details Historically set to host IP address
364  */
365  RTPS_HostId host_id;
366 
367  /*ci \brief Second field of GUID Prefix.
368  * \details Historically set to process ID
369  */
370  RTPS_AppId app_id ;
371 
372  /*ci \brief Third field of GUID prefix.
373  * \details Historically set to instance counter
374  */
375  RTPS_InstanceId instance_id ;
376 };
377 
378 /*ci \ingroup RTPS_Class
379  * \brief Unknonwn GUID prefix
380  */
381 #define RTPS_GUID_PREFIX_UNKNOWN { \
382  RTPS_HOST_ID_UNKNOWN, \
383  RTPS_APP_ID_UNKNOWN, \
384  RTPS_INSTANCE_ID_UNKNOWN}
385 
386 /*ci \ingroup RTPS_Class
387  * \brief Length in bytes of GUID prefix
388  */
389 #define RTPS_GUID_PREFIX_SIZE (12)
390 
391 /*ci \ingroup RTPS_Class
392  * \brief GUID
393  */
394 struct RTPS_Guid
395 {
396  /*ci \brief GUID prefix */
397  struct RTPS_GuidPrefix prefix;
398 
399  /*ci \brief Unique entity identifier */
400  RTPS_ObjectId object_id;
401 };
402 
403 /*ci \ingroup RTPS_Class
404  * \brief Unknown GUID
405  */
406 #define RTPS_GUID_UNKNOWN { \
407  RTPS_GUID_PREFIX_UNKNOWN, \
408  RTPS_OBJECT_ID_UNKNOWN}
409 
410 /******************************************************************************/
411 /*ci \brief Participant Object ID */
412 #define RTPS_OBJECT_ID_PARTICIPANT (0x000001C1)
413 
414 /*ci \brief Simple Discovery Protocol Participant Writer Object ID */
415 #define RTPS_OBJECT_ID_WRITER_SDP_PARTICIPANT (0x000100C2)
416 
417 /*ci \brief Simple Discovery Protocol Publication Writer Object ID */
418 #define RTPS_OBJECT_ID_WRITER_SDP_PUBLICATION (0x000003C2)
419 
420 /*ci \brief Simple Discovery Protocol Subscription Writer Object ID */
421 #define RTPS_OBJECT_ID_WRITER_SDP_SUBSCRIPTION (0x000004C2)
422 
423 /*ci \brief Simple Discovery Protocol Participant Reader Object ID */
424 #define RTPS_OBJECT_ID_READER_SDP_PARTICIPANT (0x000100C7)
425 
426 /*ci \brief Simple Discovery Protocol Subscription Reader Object ID */
427 #define RTPS_OBJECT_ID_READER_SDP_PUBLICATION (0x000003C7)
428 
429 /*ci \brief Simple Discovery Protocol Subscription Reader Object ID */
430 #define RTPS_OBJECT_ID_READER_SDP_SUBSCRIPTION (0x000004C7)
431 
432 /******************************************************************************/
433 /*ci \brief Key Hash max length */
434 #define RTPS_KEY_HASH_MAX_LENGTH 16
435 
436 /*ci \brief Hash of instance key */
437 struct RTPS_KeyHash
438 {
439  /*ci \brief Key hash value */
440  RTI_UINT8 value[RTPS_KEY_HASH_MAX_LENGTH];
441 
442  /*ci \brief Key hash length */
443  RTI_UINT32 length;
444 };
445 
446 /*ci \brief Nil Key Hash value */
447 #define RTPS_KEY_HASH_NIL {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
448 
449 /*ci \brief Default Key Hash Initializer */
450 #define RTPS_KEY_HASH_DEFAULT { \
451 RTPS_KEY_HASH_NIL, /* value */\
452 RTPS_KEY_HASH_MAX_LENGTH/* length */\
453 }
454 
455 /******************************************************************************/
456 /*ci \ingroup RTPS_Class
457  * \brief Returns RTI_TRUE if GUIDs are equal
458  *
459  * \param[in] a First GUID
460  * \param[in] b Second GUID
461  *
462  * \return RTI_TRUE if GUIDs are equal, RTI_FALSE otherwise
463  */
464 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
465 RTPS_Guid_equals(struct RTPS_Guid *a, struct RTPS_Guid *b);
466 
467 /*ci \ingroup RTPS_Class
468  * \brief Returns RTI_TRUE if GUID prefixes are equal
469  *
470  * \param[in] a First GUID
471  * \param[in] b Second GUID
472  *
473  * \return RTI_TRUE if prefixes of GUIDs are equal, RTI_FALSE otherwise
474  */
475 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
476 RTPS_Guid_prefix_equals(
477  struct RTPS_Guid *a,
478  struct RTPS_Guid *b);
479 
480 /*ci \ingroup RTPS_Class
481  * \brief Returns RTI_TRUE if GUID suffixes are equal
482  *
483  * \param[in] a First GUID
484  * \param[in] b Second GUID
485  *
486  * \return RTI_TRUE if suffixes of GUIDs are equal, RTI_FALSE otherwise
487  */
488 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
489 RTPS_Guid_suffix_equals(
490  struct RTPS_Guid *a,
491  struct RTPS_Guid *b);
492 
493 /******************************************************************************/
494 /*ci \brief RTPS Protocol Version type */
495 typedef RTI_UINT16 RTPS_ProtocolVersion_T;
496 
497 /*ci \brief Major version of supported RTPS protocol */
498 #define RTPS_PROTOCOL_VERSION_MAJOR (0x02)
499 
500 /*ci \brief Minor version of supported RTPS protocol */
501 #define RTPS_PROTOCOL_VERSION_MINOR (0x01)
502 
503 /*ci \brief RTPS Vendor ID type */
504 typedef RTI_UINT16 RTPS_VendorId;
505 
506 /*ci \brief Major version of vendor ID */
507 #define RTPS_VENDOR_ID_MAJOR (0x01)
508 
509 /*ci \brief Minor version of vendor ID */
510 #define RTPS_VENDOR_ID_MINOR (0x0A)
511 
512 /*ci \brief Connext DDS Vendor ID */
513 #define RTPS_VENDOR_ID_RTI_DDS (0x0101)
514 
515 /*ci \brief Connext Micro Vendor ID */
516 #define RTPS_VENDOR_ID_RTI_MICRO (0x010A)
517 
518 /*ci
519  * \brief Get major number of vendor ID
520  *
521  * \param[in] me Vendor ID
522  *
523  * \return Major number of vendor ID
524  */
525 RTPS_VendorId
526 RTPS_VendorId_get_major(RTPS_VendorId *me);
527 
528 /*ci
529  * \brief Get minor number of vendor ID
530  *
531  * \param[in] me Vendor ID
532  *
533  * \return Minor number of vendor ID
534  */
535 RTPS_VendorId
536 RTPS_VendorId_get_minor(RTPS_VendorId *me);
537 
538 /*****************************************************************************/
539 /*ci \brief RTPS Status Info type */
540 typedef RTI_UINT32 RTPS_StatusInfo;
541 
542 /*ci \brief Default empty status info */
543 #define RTPS_NO_STATUS_INFO (0x00000000)
544 
545 /*ci \brief Dispose status info bit */
546 #define RTPS_DISPOSE_STATUS_INFO (0x00000001)
547 
548 /*ci \brief Unregister status info bit */
549 #define RTPS_UNREGISTER_STATUS_INFO (0X00000002)
550 
551 /*ci \brief RTPS submessage header endian flag */
552 #define RTPS_ENDIAN_FLAG (0x01)
553 
554 /*****************************************************************************/
555 
556 /*ci \ingroup RTPS_Class
557  * \brief Denotes the built-in object types
558  *
559  * \details
560  * RTPSObject is categorized into (normal/reserved) x (user/meta) quadrant.
561  * Within each quadrant, there are several built-in (provided for at the RTPS
562  * protocol level) objects, such as application, publication/subscription,
563  * CST (keyed) writer/reader.
564  */
565 typedef enum
566 {
567  RTPS_OBJECT_NORMAL_USER_UNKNOWN = 0x00,
568  RTPS_OBJECT_NORMAL_USER_APPLICATION = 0x01,
569  /*ci \brief Use this suffix for writers of data with a key. */
570  RTPS_OBJECT_NORMAL_USER_CST_WRITER = 0x02,
571  /*ci \brief Use this suffix for writers of data with no key. */
572  RTPS_OBJECT_NORMAL_USER_PUBLICATION = 0x03,
573  /*ci \brief Use this suffix for readers of data with no key. */
574  RTPS_OBJECT_NORMAL_USER_SUBSCRIPTION = 0x04,
575  /*ci \brief Use this suffix for readers of data with a key. */
576  RTPS_OBJECT_NORMAL_USER_CST_READER = 0x07,
577  RTPS_OBJECT_NORMAL_USER_VIRTUAL_SUBSCRIPTION = 0x3C,
578  RTPS_OBJECT_NORMAL_USER_VIRTUAL_CST_READER = 0x3D,
579  RTPS_OBJECT_RESERVED_USER_UNKNOWN = 0x40,
580  RTPS_OBJECT_RESERVED_USER_APPLICATION = 0x41,
581  RTPS_OBJECT_RESERVED_USER_CST_WRITER = 0x42,
582  RTPS_OBJECT_RESERVED_USER_PUBLICATION = 0x43,
583  RTPS_OBJECT_RESERVED_USER_SUBSCRIPTION = 0x44,
584  RTPS_OBJECT_RESERVED_USER_CST_READER = 0x47,
585  RTPS_OBJECT_NORMAL_META_UNKNOWN = 0x80,
586  RTPS_OBJECT_NORMAL_META_APPLICATION = 0x81,
587  RTPS_OBJECT_NORMAL_META_CST_WRITER = 0x82,
588  RTPS_OBJECT_NORMAL_META_PUBLICATION = 0x83,
589  RTPS_OBJECT_NORMAL_META_SUBSCRIPTION = 0x84,
590  RTPS_OBJECT_NORMAL_META_CST_READER = 0x87,
591  RTPS_OBJECT_RESERVED_META_UNKNOWN = 0xc0,
592  RTPS_OBJECT_RESERVED_META_APPLICATION = 0xc1,
593  RTPS_OBJECT_RESERVED_META_CST_WRITER = 0xc2,
594  RTPS_OBJECT_RESERVED_META_PUBLICATION = 0xc3,
595  RTPS_OBJECT_RESERVED_META_SUBSCRIPTION = 0xc4,
596  RTPS_OBJECT_RESERVED_META_CST_READER = 0xc7
597 } RTPS_ObjectSuffix;
598 
599 
600 /* ===========================================================================*/
601 /* RTPS types */
602 /* ===========================================================================*/
603 /*ci \brief RTPS locator address max length */
604 #define RTPS_LOCATOR_ADDRESS_LENGTH_MAX 16
605 
606 /*ci \brief
607  * RTPS locator address offset to UDPv4 address (elements 12-15 of array)
608  */
609 #define RTPS_LOCATOR_ADDRESS_UDPV4_OFFSET 12
610 
611 /*ci \brief RTPS Locator type */
612 struct RTPS_Locator_t
613 {
614  /*ci \brief Locator kind */
615  RTI_INT32 kind;
616 
617  /*ci \brief Locator port */
618  RTI_UINT32 port;
619 
620  /*ci \brief Locator address */
621  RTI_UINT8 address[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
622 };
623 
624 /* ci \brief Default locator kind */
625 #define RTPS_LOCATOR_DEFAULT_KIND (-1)
626 
627 /*ci \brief Default locator initializer */
628 #define RTPS_LOCATOR_DEFAULT {\
629  RTPS_LOCATOR_DEFAULT_KIND, /* kind */\
630  0, /* port */\
631  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} /* address */\
632 }
633 
634 /*ci \brief RTPS Locator type */
635 #define RTPS_Locator RTPS_Locator_t
636 
637 /*ci \brief UDPv4 locator type */
638 struct RTPS_LocatorUdpv4_t
639 {
640  /*ci \brief Locator kind */
641  RTI_INT32 kind;
642 
643  /*ci \brief Locator port */
644  RTI_UINT32 port;
645 
646  /*ci \brief Locator address */
647  RTI_UINT32 address;
648 };
649 
650 /*ci \brief Default UDPv4 locator initializer */
651 #define RTPS_LOCATOR_UDPV4_DEFAULT {\
652  RTPS_LOCATOR_DEFAULT_KIND, /* kind */\
653  0, /* port */\
654  0 /* address */\
655 }
656 
657 /*ci \brief Invalid Locator */
658 extern RTPSDllVariable const struct RTPS_Locator_t RTPS_LOCATOR_INVALID;
659 
660 /*ci \brief Invalid Locator kind */
661 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_INVALID;
662 
663 /*ci \brief Invalid Locator port */
664 extern RTPSDllVariable const RTI_UINT32 RTPS_LOCATOR_PORT_INVALID;
665 
666 /*ci \brief Invalid Locator address */
667 extern RTPSDllVariable const RTI_UINT8
668  RTPS_LOCATOR_ADDRESS_INVALID[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
669 
670 /*ci \brief UDPv4 Locator kind */
671 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_UDPv4;
672 
673 /*ci \brief UDPv6 Locator kind */
674 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_UDPv6;
675 
676 /*ci \brief Reserved Locator kind */
677 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_RESERVED;
678 
679 /*ci \brief Shared Memory Locator kind */
680 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_SHMEM;
681 
682 
683 /* ===========================================================================*/
684 /* RTPS Sequence Number */
685 /* ===========================================================================*/
686 
687 
688 /*ci \ingroup RTPS_SequenceNumberClass
689  * \brief Deserialize sequence number from stream buffer
690  *
691  * \details
692  * Post-condition: sequenceNumber is packed and stream pointer is moved forward.
693  *
694  * \param[inout] src_buffer Deserialization stream buffer
695  * \param[out] instance Deserialized instance
696  * \param[in] byte_swap RTI_TRUE if byte swapping is necessary,
697  * RTI_FALSE otherwise.
698  *
699  */
700 RTPSDllExport void
701 RTPS_SequenceNumber_deserialize(char **src_buffer,
702  struct REDA_SequenceNumber *instance,
703  RTI_BOOL byte_swap);
704 
705 
706 /*ci \ingroup RTPS_SequenceNumberClass
707  * \brief Calculate the distance between two sequence numbers.
708  *
709  * \param[in] s1 First sequence number
710  * \param[in] s2 Second sequence number
711  *
712  * \return The distance, possibly saturated to RTPS_BITMAP_DISTANCE_MAX.
713  * -1 on failure.
714  */
715 MUST_CHECK_RETURN RTPSDllExport RTI_INT32
716 RTPS_SequenceNumber_get_distance(
717  const struct REDA_SequenceNumber *s1,
718  const struct REDA_SequenceNumber *s2);
719 
720 /*ci \brief Bitmap array max size
721  * \details Bitmap has maximum 256 bits, using (256/32 =) 8 ints
722  */
723 #define RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX (8)
724 
725 /*ci
726  * \brief Bitmap of sequence numbers received
727  *
728  * \details
729  * Tracks sequence numbers of samples sent or received. Used in send and
730  * window implementations.
731  */
732 struct RTPS_Bitmap
733 {
734  /*ci \brief Starting sequence number of bitmap */
735  struct REDA_SequenceNumber lead;
736 
737  /*ci \brief Number of valid bits or sequence numbers, starting from lead */
738  RTI_INT32 bit_count;
739 
740  /*ci \brief The bitmap stored as an array of integers.
741  *
742  * \details
743  * Maximum of 256 (=8*32) bits or sequence numbers.
744  * This must be unsigned in order to apply the >> operator.
745  * There are two approaches to handle bits outside bitCount:
746  * 1) They must always be zeroed.
747  * 2) They can be anything.
748  * The first approach puts the burden on otherwise simple
749  * methods such as truncate to zero out truncated bits, whereas
750  * the second approach puts the burden on methods such as shift
751  * to make sure bits beyond the bitCount are not shifted in.
752  * In our implementation, we have opted for the second approach.
753  */
754  RTI_UINT32 bits[RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX];
755 };
756 
757 /*ci \brief Maximum number of bits in bitmap */
758 #define RTPS_BITMAP_SIZE_MAX (256)
759 
760 /*ci \brief Maximum bitmap sequence number distance */
761 #define RTPS_BITMAP_DISTANCE_MAX (0x7FFFFFFF)
762 
763 /*ci \brief Reset bitmap to specified lead and bitCount
764  *
765  * \details Post condition: bitmap has its lead and bit count assigned, and
766  * all bits are reset to zero.
767  *
768  * \param[in] me Bitmap
769  * \param[in] sn New lead sequence number
770  * \param[in] bit_count New bit count. Must be <= RTPS_BITMAP_SIZE_MAX.
771  *
772  */
773 RTPSDllExport void
774 RTPS_Bitmap_reset(
775  struct RTPS_Bitmap *me,
776  const struct REDA_SequenceNumber *sn,
777  RTI_INT32 bit_count);
778 
779 /*ci \ingroup RTPS_BitmapClass
780  * \brief Set specified bit in bitmap.
781  *
782  * \details
783  * The bit corresponding to the input sequence number is set to either
784  * 0 or 1 as specified in input param.
785  *
786  * \param[in] me Bitmap
787  * \param[out] existed RTI_TRUE if bit is already set, RTI_FALSE otherwise.
788  * \param[in] num The sequence number of interest.
789  * \param[in] bit RTI_TRUE if bit is to be turned on, RTI_FALSE otherwise.
790  *
791  * \return RTI_FALSE on failure, which includes the sequence not in bitmap.
792  * RTI_TRUE on success.
793  */
794 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
795 RTPS_Bitmap_set_bit(struct RTPS_Bitmap *me,
796  RTI_BOOL *existed,
797  const struct REDA_SequenceNumber *num,
798  RTI_BOOL bit);
799 
800 /*ci \ingroup RTPS_BitmapClass
801  * \brief Get specified bit in bitmap.
802  *
803  * \details
804  * The bit corresponding to the input sequence number is set to either
805  * 0 or 1 as specified in input param.
806  *
807  * \param[in] me Bitmap
808  * \param[in] bit Pointer to the answer, whose value will be RTI_TRUE
809  if bit is on and RTI_FALSE otherwise.
810  * \param[in] num The sequence number of interest.
811  *
812  * \return RTI_FALSE on failure, which includes the sequence not in bitmap.
813  * RTI_TRUE on success.
814  */
815 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
816 RTPS_Bitmap_get_bit(
817  const struct RTPS_Bitmap *me,
818  RTI_BOOL *bit,
819  const struct REDA_SequenceNumber *num);
820 
821 /*ci
822  * \brief
823  * Get the sequence number of the first bit in bitmap that matches the input
824  * value
825  *
826  * \param[in] me Bitmap
827  * \param[out] position Sequence number of first bit matching searchBit. If
828  * no match found, position is one greater than last valid bit of bitmap.
829  * \param[in] search_bit Value of bit for which to search
830  *
831  * \return RTI_TRUE on successfully finding matching bit, RTI_FALSE on failure
832  */
833 SHOULD_CHECK_RETURN RTPSDllExport RTI_BOOL
834 RTPS_Bitmap_get_first_bit(
835  const struct RTPS_Bitmap *me,
836  struct REDA_SequenceNumber *position,
837  RTI_BOOL search_bit);
838 
839 /*ci
840  * \brief
841  * Get the sequence number of the last bit in bitmap that matches the input
842  * value
843  *
844  * \param[in] me Bitmap
845  * \param[out] position Sequence number of last bit matching searchBit. If
846  * no match found, position is zero.
847  * \param[in] search_bit Value of bit for which to search
848  *
849  * \return RTI_TRUE on successfully finding matching bit, RTI_FALSE on failure
850  */
851 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
852 RTPS_Bitmap_get_last_bit(
853  const struct RTPS_Bitmap *me,
854  struct REDA_SequenceNumber *position,
855  RTI_BOOL search_bit);
856 
857 /*ci
858  * \brief
859  * Fill a range of bits in bitmap with specified value
860  *
861  * \param[in] me Bitmap
862  * \param[in] first_seq_num First sequence number in range to fill
863  * \param[in] last_seq_num Last sequence number in range to fill
864  * \param[in] bit Value to set bits in range
865  *
866  * \return RTI_TRUE on success, RTI_FALSE on failure
867  */
868 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
869 RTPS_Bitmap_fill(
870  struct RTPS_Bitmap *me,
871  const struct REDA_SequenceNumber *first_seq_num,
872  const struct REDA_SequenceNumber *last_seq_num,
873  RTI_BOOL bit);
874 
875 
876 /*ci
877  * \brief
878  * Merge another bitmap with self bitmap
879  *
880  * \details
881  * Copies '1' bits from source bitmap whose sequence numbers overlap with self
882  * bitmap. Bitcount and lead SN of self bitmap are preserved.
883  *
884  * \param[in] me Self bitmap
885  * \param[in] source Bitmap to merge with self
886  *
887  */
888 RTPSDllExport void
889 RTPS_Bitmap_merge(
890  struct RTPS_Bitmap *me,
891  const struct RTPS_Bitmap *source);
892 
893 /*ci
894  * \brief
895  * Shift lead sequence number of bitmap to new value
896  *
897  * \details
898  * Preserves bitcount of bitmap, setting new shifted-in bits to zero.
899  *
900  * \param[in] me Self bitmap
901  * \param[in] seq_num New lead sequence number
902  *
903  * \return RTI_TRUE on success, RTI_FALSE on failure
904  */
905 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
906 RTPS_Bitmap_shift(
907  struct RTPS_Bitmap *me,
908  const struct REDA_SequenceNumber *seq_num);
909 
910 /*ci
911  * \brief
912  * Truncates bitmap to end at specified sequence number
913  *
914  * \details
915  * Updates bitcount of bitmap to reflect number of valid bits up to truncated
916  * sequence number. If truncation sequence number is greater than current last
917  * sequence number of bitmap, no truncation is done and bitcount stays the same.
918  *
919  * \param[in] me Self bitmap
920  * \param[in] seq_num Sequence number after which bitmap is truncated.
921  *
922  */
923 RTPSDllExport void
924 RTPS_Bitmap_truncate(
925  struct RTPS_Bitmap *me,
926  const struct REDA_SequenceNumber *seq_num);
927 
928 /*ci
929  * \brief
930  * Toggle bits of bitmap
931  *
932  * \details
933  * Change '1' to '0' and vice versa.
934  *
935  * \param[inout] me Self bitmap
936  *
937  */
938 RTPSDllExport void
939 RTPS_Bitmap_invert(struct RTPS_Bitmap *me);
940 
941 /*ci
942  * \brief
943  * Deserialize from buffer a bitmap
944  *
945  * \details
946  * Change '1' to '0' and vice versa.
947  *
948  * \param[in] me Self bitmap
949  * \param[in] stream_ptr Pointer to serialized buffer
950  * \param[in] max_bits_len Remaining space of submessage to deserialize
951  * the variable length bits of bitmap
952  * \param[in] need_byte_swap Flag whether byte swap is necessary for
953  * deserialization
954  *
955  * \return RTI_TRUE on success, RTI_FALSE on failure
956  *
957  */
958 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
959 RTPS_Bitmap_deserialize(
960  struct RTPS_Bitmap *me,
961  const char **stream_ptr,
962  RTI_UINT32 max_bits_len,
963  RTI_BOOL need_byte_swap);
964 
965 /******************************************************************************/
966 /*ci
967  * \brief
968  * Serialize GUID to stream buffer
969  *
970  * \param[inout] stream Serialization stream
971  * \param[in] guid GUID to serialize
972  * \param[in] param Unused
973  *
974  * \return RTI_TRUE on success, RTI_FALSE on failure
975  */
976 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
977 RTPS_Guid_serialize(
978  struct CDR_Stream_t *stream,
979  const struct RTPS_Guid *guid,
980  void * param);
981 
982 /*ci
983  * \brief
984  * Deserialize GUID from stream buffer
985  *
986  * \param[in] stream Deserialization stream
987  * \param[inout] guid Deserialized GUID
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_deserialize(
994  struct CDR_Stream_t *stream,
995  struct RTPS_Guid *guid,
996  void * param);
997 
998 /*ci
999  * \brief
1000  * Length in bytes of serialized GUID
1001  *
1002  * \param[in] size Current length of serialized buffer
1003  *
1004  * \return Number of bytes of serialized GUID
1005  */
1006 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1007 RTPS_Guid_get_max_size_serialized(RTI_UINT32 size);
1008 
1009 /* -------------------------------------------------------------------------- */
1010 /*ci
1011  * \brief
1012  * Serialize NTP time to stream buffer
1013  *
1014  * \param[inout] stream Serialization stream
1015  * \param[in] time NTP time to serialize
1016  * \param[in] param Unused
1017  *
1018  * \return RTI_TRUE on success, RTI_FALSE on failure
1019  */
1020 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1021 RTPS_serialize_ntp_time(
1022  struct CDR_Stream_t *stream,
1023  const OSAPI_NtpTime *time,
1024  void * param);
1025 
1026 /*ci
1027  * \brief
1028  * Deserialize NTP time from stream buffer
1029  *
1030  * \param[in] stream Deserialization stream
1031  * \param[inout] time Deserialized NTP time
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_deserialize_ntp_time(
1038  struct CDR_Stream_t *stream,
1039  OSAPI_NtpTime *time,
1040  void * param);
1041 
1042 /*ci
1043  * \brief
1044  * Length in bytes of serialized NTP time
1045  *
1046  * \param[in] size Current length of serialized buffer
1047  *
1048  * \return Number of bytes of serialized NTP time
1049  */
1050 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1051 RTPS_get_ntp_time_max_size_serialized(RTI_UINT32 size);
1052 
1053 /* -------------------------------------------------------------------------- */
1054 /*ci
1055  * \brief
1056  * Serialize unsigned short to stream buffer
1057  *
1058  * \param[inout] stream Serialization stream
1059  * \param[in] in Value to serialize
1060  * \param[in] param Unused
1061  *
1062  * \return RTI_TRUE on success, RTI_FALSE on failure
1063  */
1064 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1065 RTPS_serialize_2_octets(
1066  struct CDR_Stream_t *stream,
1067  const RTI_UINT16 * in,
1068  void * param);
1069 
1070 /*ci
1071  * \brief
1072  * Deserialize unsigned short from stream buffer
1073  *
1074  * \param[in] stream Deserialization stream
1075  * \param[inout] out Deserialized value
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_deserialize_2_octets(
1082  struct CDR_Stream_t *stream,
1083  RTI_UINT16 *out,
1084  void * param);
1085 
1086 /*ci
1087  * \brief
1088  * Length in bytes of serialized unsigned short
1089  *
1090  * \param[in] size Current length of serialized buffer
1091  *
1092  * \return Number of bytes of serialized unsigned short
1093  */
1094 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1095 RTPS_get_2_octets_max_size_serialized(RTI_UINT32 size);
1096 
1097 /* -------------------------------------------------------------------------- */
1098 /*ci
1099  * \brief
1100  * Serialize locator to stream buffer
1101  *
1102  * \param[inout] stream Serialization stream
1103  * \param[in] loc Locator to serialize
1104  * \param[in] param Unused
1105  *
1106  * \return RTI_TRUE on success, RTI_FALSE on failure
1107  */
1108 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1109 RTPS_serialize_ipv6_locator(
1110  struct CDR_Stream_t *stream,
1111  const struct RTPS_Locator_t *loc,
1112  void * param);
1113 
1114 /*ci
1115  * \brief
1116  * Deserialize locator from stream buffer
1117  *
1118  * \param[in] stream Deserialization stream
1119  * \param[inout] loc Deserialized locator
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_deserialize_ipv6_locator(
1126  struct CDR_Stream_t *stream,
1127  struct RTPS_Locator_t *loc,
1128  void * param);
1129 
1130 /*ci
1131  * \brief
1132  * Length in bytes of serialized locator
1133  *
1134  * \param[in] size Current length of serialized buffer
1135  *
1136  * \return Number of bytes of serialized locator
1137  */
1138 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1139 RTPS_get_ipv6_locator_max_size_serialized(RTI_UINT32 size);
1140 
1141 /* -------------------------------------------------------------------------- */
1142 /*ci \brief Deserialize epoch from stream buffer
1143  *
1144  * \param[inout] me Deserialized epoch
1145  * \param[in] stream Deserialization stream
1146  * \param[in] need_byte_swap Flags whether to byte swap byte order on
1147  * deserialization
1148  *
1149  * \return RTI_TRUE on success, RTI_FALSE on failure
1150  */
1151 RTPSDllExport void
1152 RTPS_Epoch_deserialize(REDA_Epoch_T * me,
1153  const char **stream,
1154  RTI_BOOL need_byte_swap);
1155 
1156 
1157 /*ci \brief RTPS GUID type */
1158 typedef struct NETIO_Guid RTPS_GUID;
1159 
1160 /*ci \brief RTPS GuidPrefix type */
1161 typedef struct NETIO_GuidPrefix RTPS_GuidPrefix_T;
1162 
1163 /*ci \brief RTPS Entity type */
1164 typedef struct NETIO_GuidEntity RTPS_Entity_T;
1165 
1166 /*ci \brief Default unknown GUID prefix initializer */
1167 #define RTPS_GUIDPREFIX_UNKNOWN {{0,0,0,0,0,0,0,0,0,0,0,0}}
1168 
1169 /*ci \brief Default unknown Entity ID initializer */
1170 #define RTPS_ENTITY_UNKNOWN {{0,0,0,0}}
1171 
1172 /* -------------------------------------------------------------------------- */
1173 /*ci \brief RTPS Timestamp type */
1174 struct RTPS_Time
1175 {
1176  /*ci \brief Seconds */
1177  RTI_INT32 seconds;
1178 
1179  /*ci \brief Fractional part */
1180  RTI_UINT32 fractions;
1181 };
1182 
1183 /*ci \brief RTPS Vendor ID type */
1184 struct RTPS_Vendor
1185 {
1186  /*ci \brief Vendor ID value */
1187  RTI_UINT8 value[2];
1188 };
1189 
1190 /*ci \brief RTPS Protocol Version type */
1191 struct RTPS_ProtocolVersion
1192 {
1193  /*ci \brief Major */
1194  RTI_UINT8 major;
1195 
1196  /*ci \brief Minor */
1197  RTI_UINT8 minor;
1198 };
1199 
1200 /*ci \brief RTPS message header
1201  * \details
1202  * Fields are ordered exactly as defined by RTPS specification
1203  */
1204 struct RTPS_Header
1205 {
1206  /*ci \brief 'R''T''P''S' protocol identifier */
1207  RTI_UINT32 rtps;
1208 
1209  /*ci \brief Protocol version */
1210  struct RTPS_ProtocolVersion protocol_version;
1211 
1212  /*ci \brief Vendor ID */
1213  struct RTPS_Vendor vendor_id;
1214 
1215  /*ci \brief Sender's GUID Prefix*/
1216  RTPS_GuidPrefix_T guid_prefix;
1217 };
1218 
1219 /*ci \brief RTPS message header's RTPS identifier, in host order */
1220 #ifdef RTI_ENDIAN_LITTLE
1221 #define VALID_RTPS_HEADER 0x53505452 /* RTPS backwards */
1222 #else
1223 #define VALID_RTPS_HEADER 0x52545053 /* RTPS in big endian */
1224 #endif /* RTI_ENDIAN_LITTLE */
1225 
1226 /******************************************************************************/
1227 
1228 /* RTPS Submessage IDs */
1229 /*ci \brief PAD submessage ID */
1230 #define RTPS_PAD_KIND (0x01)
1231 
1232 /*ci \brief ACKNACK submessage ID */
1233 #define RTPS_ACKNACK_KIND (0x06)
1234 
1235 /*ci \brief HEARTBEAT submessage ID */
1236 #define RTPS_HEARTBEAT_KIND (0x07)
1237 
1238 /*ci \brief GAP submessage ID */
1239 #define RTPS_GAP_KIND (0x08)
1240 
1241 /*ci \brief INFO_TS submessage ID */
1242 #define RTPS_INFO_TS_KIND (0x09)
1243 
1244 /*ci \brief INFO_SRC submessage ID */
1245 #define RTPS_INFO_SRC_KIND (0x0c)
1246 
1247 /*ci \brief INFO_REPLY_IP4 submessage ID */
1248 #define RTPS_INFO_REPLY_IP4_KIND (0x0d)
1249 
1250 /*ci \brief INFO_DST submessage ID */
1251 #define RTPS_INFO_DST_KIND (0x0e)
1252 
1253 /*ci \brief INFO_REPLY submessage ID */
1254 #define RTPS_INFO_REPLY_KIND (0x0f)
1255 
1256 /*ci \brief DATA submessage ID */
1257 #define RTPS_DATA_KIND (0x15)
1258 
1259 
1260 #define RTPS_LARGEST_SUBMSG_KIND RTPS_DATA_KIND
1261 
1262 /*ci \brief Length of RTPS submessage header */
1263 #define RTPS_SUBMESSAGE_HEADER_LENGTH 4
1264 
1265 
1266 
1267 /*ci \brief RTPS submessage header
1268  *
1269  * \details
1270  * Fields ordered exactly as defined by RTPS specification
1271  */
1272 struct RTPS_SubmsgHdr
1273 {
1274  /*ci \brief Submessage kind ID */
1275  RTI_UINT8 kind;
1276 
1277  /*ci \brief Submessage flags */
1278  RTI_UINT8 flags;
1279 
1280  /*ci \brief Submessage length */
1281  RTI_UINT16 length;
1282 };
1283 
1284 /*ci \brief Submessage little endianness flag */
1285 #define RTPS_SUBMSG_FLAG_E 0x1
1286 
1287 /******************************************************************************/
1288 /*ci \brief ACKNACK submessage, over-the-wire layout */
1289 struct RTPS_ACKNACK
1290 {
1291  /*ci \brief Submesage header */
1292  struct RTPS_SubmsgHdr hdr;
1293 
1294  /*ci \brief Source reader's entity ID */
1295  RTPS_Entity_T reader;
1296 
1297  /*ci \brief Destination writer's entity ID */
1298  RTPS_Entity_T writer;
1299 
1300  /*ci \brief Bitmap (variable length) */
1301  struct RTPS_Bitmap bitmap;
1302 
1303  /*ci \brief Epoch count */
1304  RTI_UINT32 count;
1305 };
1306 
1307 /*ci \brief ACKNACK Final flag */
1308 #define RTPS_ACKNACKFLAGS_F 0x2
1309 
1310 /******************************************************************************/
1311 /*ci \brief RTPS DATA submessage
1312  *
1313  * \details
1314  * Fixed length fields declared in type. Variable length fields (inline QoS,
1315  * DATA payload) accounted for later when setting DATA submessage.
1316  */
1317 struct RTPS_DATA
1318 {
1319  /*ci \brief Submessage header */
1320  struct RTPS_SubmsgHdr hdr;
1321 
1322  /*ci \brief Submessage flags */
1323  RTI_UINT16 flags;
1324 
1325  /*ci \brief Inline Qos offset */
1326  RTI_UINT16 qos_offset;
1327 
1328  /*ci \brief Destination reader entity ID */
1329  RTPS_Entity_T reader;
1330 
1331  /*ci \brief Source writer entity ID */
1332  RTPS_Entity_T writer;
1333 
1334  /*ci \brief Sequence number */
1335  struct REDA_SequenceNumber sn;
1336 };
1337 
1338 /*ci \brief Default empty DATA submessage flag */
1339 #define RTPS_FLAGS_NONE 0x0
1340 
1341 /*ci \brief Inline Qos Q-flag for DATA submessage */
1342 #define RTPS_DATAFLAGS_Q 0x2
1343 
1344 /*ci \brief Data D-flag for DATA submessage */
1345 #define RTPS_DATAFLAGS_D 0x4
1346 
1347 /*ci \brief Data K-flag for DATA submessage */
1348 #define RTPS_DATAFLAGS_K 0x8
1349 
1350 /*ci \brief Default Inline Qos offset */
1351 #define RTPS_DATA_INLINEQOS_OFFSET 16
1352 
1353 /******************************************************************************/
1354 /*ci \brief GAP submessage */
1355 struct RTPS_GAP
1356 {
1357  /*ci \brief Submessage header */
1358  struct RTPS_SubmsgHdr hdr;
1359 
1360  /*ci \brief Destination reader entity ID */
1361  RTPS_Entity_T reader;
1362 
1363  /*ci \brief Source writer entity ID */
1364  RTPS_Entity_T writer;
1365 
1366  /*ci \brief Sequence number of start of GAP */
1367  struct REDA_SequenceNumber sn_start;
1368 
1369  /*ci \brief Bitmap */
1370  struct RTPS_Bitmap bitmap; /* variable length */
1371 };
1372 
1373 /******************************************************************************/
1374 /*ci \brief HEARTBEAT submessage */
1375 struct RTPS_HEARTBEAT
1376 {
1377  /*ci \brief Submessage header */
1378  struct RTPS_SubmsgHdr hdr;
1379 
1380  /*ci \brief Destination reader entity ID */
1381  RTPS_Entity_T reader;
1382 
1383  /*ci \brief Source writer entity ID */
1384  RTPS_Entity_T writer;
1385 
1386  /*ci \brief First sequence number */
1387  struct REDA_SequenceNumber sn_first;
1388 
1389  /*ci \brief Last sequence number */
1390  struct REDA_SequenceNumber sn_last;
1391 
1392  /*ci \brief Epoch count */
1393  RTI_INT32 count;
1394 };
1395 
1396 /*ci \brief Final HEARTBEAT submesasge flag */
1397 #define RTPS_HBFLAGS_F 0x02
1398 
1399 /*ci \brief Liveliness HEARTBEAT submessage flag */
1400 #define RTPS_HBFLAGS_L 0x04
1401 
1402 /******************************************************************************/
1403 /*ci \brief INFO_DST submessage */
1404 struct RTPS_INFO_DST
1405 {
1406  /*ci \brief Submessage header */
1407  struct RTPS_SubmsgHdr hdr;
1408 
1409  /*ci \brief Destination GUID prefix */
1410  RTPS_GuidPrefix_T guid_prefix;
1411 };
1412 
1413 /******************************************************************************/
1414 /*ci \brief INFO_TS submessage */
1415 struct RTPS_INFO_TS
1416 {
1417  /*ci \brief Submessage header */
1418  struct RTPS_SubmsgHdr hdr;
1419 
1420  /*ci \brief Source timestamp */
1421  struct RTPS_Time timestamp;
1422 };
1423 
1424 /*ci \brief Invalid Timestamp INFO_TS flag */
1425 #define RTPS_INFO_TSFLAGS_I (0x2)
1426 
1427 /******************************************************************************/
1428 /*ci \brief RTPS headers and submessages
1429  *
1430  * \details
1431  * Used to typecast serialized/deserialized stream buffer
1432  */
1433 union RTPS_MESSAGES
1434 {
1435  /*ci \brief Submessage header */
1436  struct RTPS_SubmsgHdr submsg;
1437 
1438  /*ci \brief Message header */
1439  struct RTPS_Header header;
1440 
1441  /*ci \brief DATA submessage */
1442  struct RTPS_DATA data;
1443 
1444  /*ci \brief GAP submessage */
1445  struct RTPS_GAP gap;
1446 
1447  /*ci \brief HEARTBEAT submessage */
1448  struct RTPS_HEARTBEAT hb;
1449 
1450  /*ci \brief ACKNACK submessage */
1451  struct RTPS_ACKNACK acknack;
1452 
1453  /*ci \brief INFO_TS submessage */
1454  struct RTPS_INFO_TS info_ts;
1455 
1456  /*ci \brief INFO_DST submessage */
1457  struct RTPS_INFO_DST info_dst;
1458 };
1459 
1460 /******************************************************************************/
1461 /*ci \brief RTPS interface mode */
1462 typedef enum
1463 {
1464  /*ci \brief Default undefined mode */
1465  RTPS_INTERFACEMODE_UNDEFINED,
1466 
1467  /*ci \brief Writer mode */
1468  RTPS_INTERFACEMODE_WRITER,
1469 
1470  /*ci \brief Reader mode */
1471  RTPS_INTERFACEMODE_READER,
1472 
1473  /*ci \brief External receiver mode */
1474  RTPS_INTERFACEMODE_EXTERNAL_RECEIVER
1475 } RTPS_InterfaceMode_t;
1476 
1477 /*ci \brief RTPS interface property */
1478 struct RTPS_InterfaceProperty
1479 {
1480  /*ci \brief Base NETIO interface property */
1481  struct NETIO_InterfaceProperty _parent;
1482 
1483  /*ci \brief RTPS interface mode */
1484  RTPS_InterfaceMode_t mode;
1485 
1486  /*ci \brief RTPS interface GUID address */
1487  struct NETIO_Address intf_address;
1488 
1489  /*ci \brief Maximum number of peers */
1490  RTI_INT32 max_peer_count;
1491 
1492  /*ci \brief RTI_TRUE for reliable writer or reader */
1493  RTI_BOOL reliable;
1494 
1495  /*ci \brief RTI_TRUE for anonymous writer or reader */
1496  RTI_BOOL anonymous;
1497 
1498  /*ci \brief HEARTBEAT period for reliable writer */
1499  struct OSAPI_NtpTime hb_period;
1500 
1501  /*ci \brief Piggyback HEARTBEAT rate for reliable writer
1502  *
1503  * \details
1504  * A HEARTBEAT submessage is appended to every Nth new DATA submessage
1505  * sent, where N is sample_per_hb.
1506  */
1507  RTI_SIZE_T samples_per_hb;
1508 
1509  /*ci \brief Maximum window size for writer or reader */
1510  RTI_UINT32 max_window_size;
1511 
1512  /*ci \brief Maximum HEARTBEAT retries for reliable writer
1513  *
1514  * \details
1515  * A peer reader must respond to a reliable writer's HEARTBEATs to be
1516  * considered active. If N periodic HEARTBEATs have been sent without
1517  * reciving an ACKNACK, where N is maxhb_retries, the peer reader is
1518  * then considered inactive and will stay inactive until an ACKNACK is
1519  * received.
1520  */
1521  RTI_INT32 max_hb_retries;
1522 
1523  /*ci \brief Maximum number of samples of upstream interface */
1524  RTI_INT32 max_samples;
1525 #if OSAPI_ENABLE_TRACE
1526  const char *session_name;
1527 #endif
1528 };
1529 
1530 #if OSAPI_ENABLE_TRACE
1531 #define RTPS_SESSION_NAME_INIT ,NULL
1532 #else
1533 #define RTPS_SESSION_NAME_INIT
1534 #endif
1535 
1536 /*ci \brief Unlimited max HEARTBEAT retries */
1537 #define RTPS_RETRIES_UNLIMITED (-1)
1538 
1539 /*ci \brief Maximum receive window size */
1540 #define RTPS_RECEIVE_WINDOW_MAX_SIZE (256)
1541 
1542 /*ci \brief Default RTPS interface property initializer */
1543 #define RTPS_InterfaceProperty_INITIALIZER \
1544 {\
1545  NETIO_InterfaceProperty_INITIALIZER,\
1546  RTPS_INTERFACEMODE_UNDEFINED,\
1547  NETIO_Address_INITIALIZER, \
1548  4, /* max_peer_count */ \
1549  RTI_FALSE, /* reliable */ \
1550  RTI_FALSE, /* anonymous */ \
1551  {3,0}, /* hb_period */ \
1552  8, /* samples_per_hb */ \
1553  256, /* window_size */ \
1554  RTPS_RETRIES_UNLIMITED, /* max_hb_retries */\
1555  256 /* max_samples */ \
1556  RTPS_SESSION_NAME_INIT \
1557 }
1558 
1559 /*ci \brief Property for an RTPS route */
1560 struct RTPS_RouteProperty
1561 {
1562  /*ci \brief Base NETIO route property */
1563  struct NETIORouteProperty _parent;
1564 
1565  /*ci \brief Reliable flag of peer reachable over route */
1566  RTI_BOOL reliable;
1567 
1568  /*ci \brief First sequence number of upstream interface creating the
1569  * route
1570  */
1571  struct REDA_SequenceNumber first_sn;
1572 
1573  /*ci \brief Last sequence number of upstream interface creating the
1574  * route
1575  */
1576  struct REDA_SequenceNumber last_sn;
1577 
1578  /*ci \brief Last acknowledged sequence number of upstream interface
1579  * creating the route
1580  */
1581  struct REDA_SequenceNumber last_acked_sn;
1582 };
1583 
1584 /*ci \brief Default RTPS route property initializer */
1585 #define RTPSRouteProperty_INITIALIZER \
1586 {\
1587  NETIORouteProperty_INITIALIZER, \
1588  RTI_FALSE, /* reliable */ \
1589  REDA_SEQUENCE_NUMBER_ZERO,\
1590  REDA_SEQUENCE_NUMBER_ZERO, \
1591  REDA_SEQUENCE_NUMBER_ZERO \
1592 }
1593 
1594 /*ci \brief Get RTPS inteface factory
1595  * \return Pointer to RTPS interface factory
1596  */
1597 MUST_CHECK_RETURN RTPSDllExport struct RT_ComponentFactoryI*
1598 RTPS_InterfaceFactory_get_interface(void);
1599 
1600 #ifdef __cplusplus
1601 } /* extern "C" */
1602 #endif
1603 
1604 #include "rtps/rtps_rtps_impl.h"
1605 
1606 #endif /* rtps_rtps_h */

RTI Connext DDS Micro Version 2.4.10 Copyright © Fri Jun 30 2017 Real-Time Innovations, Inc