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

RTI Connext DDS Micro Version 2.4.6 Copyright © Mon Jan 25 2016 Real-Time Innovations, Inc