RTI Connext DDS Micro  Version 2.4.8
 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 
616 /* ci \brief Default locator kind */
617 #define RTPS_LOCATOR_DEFAULT_KIND (-1)
618 
619 /*ci \brief Default locator initializer */
620 #define RTPS_LOCATOR_DEFAULT {\
621  RTPS_LOCATOR_DEFAULT_KIND, /* kind */\
622  0, /* port */\
623  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} /* address */\
624 }
625 
626 /*ci \brief RTPS Locator type */
627 #define RTPS_Locator RTPS_Locator_t
628 
629 /*ci \brief UDPv4 locator type */
630 struct RTPS_LocatorUdpv4_t
631 {
632  /*ci \brief Locator kind */
633  RTI_INT32 kind;
634 
635  /*ci \brief Locator port */
636  RTI_UINT32 port;
637 
638  /*ci \brief Locator address */
639  RTI_UINT32 address;
640 };
641 
642 /*ci \brief Default UDPv4 locator initializer */
643 #define RTPS_LOCATOR_UDPV4_DEFAULT {\
644  RTPS_LOCATOR_DEFAULT_KIND, /* kind */\
645  0, /* port */\
646  0 /* address */\
647 }
648 
649 /*ci \brief Invalid Locator */
650 extern RTPSDllVariable const struct RTPS_Locator_t RTPS_LOCATOR_INVALID;
651 
652 /*ci \brief Invalid Locator kind */
653 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_INVALID;
654 
655 /*ci \brief Invalid Locator port */
656 extern RTPSDllVariable const RTI_UINT32 RTPS_LOCATOR_PORT_INVALID;
657 
658 /*ci \brief Invalid Locator address */
659 extern RTPSDllVariable const RTI_UINT8
660  RTPS_LOCATOR_ADDRESS_INVALID[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
661 
662 /*ci \brief UDPv4 Locator kind */
663 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_UDPv4;
664 
665 /*ci \brief UDPv6 Locator kind */
666 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_UDPv6;
667 
668 /*ci \brief Reserved Locator kind */
669 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_RESERVED;
670 
671 /*ci \brief Shared Memory Locator kind */
672 extern RTPSDllVariable const RTI_INT32 RTPS_LOCATOR_KIND_SHMEM;
673 
674 
675 /* ===========================================================================*/
676 /* RTPS Sequence Number */
677 /* ===========================================================================*/
678 
679 
680 /*ci \ingroup RTPS_SequenceNumberClass
681  * \brief Deserialize sequence number from stream buffer
682  *
683  * \details
684  * Post-condition: sequenceNumber is packed and stream pointer is moved forward.
685  *
686  * \param[inout] src_buffer Deserialization stream buffer
687  * \param[out] instance Deserialized instance
688  * \param[in] byte_swap RTI_TRUE if byte swapping is necessary,
689  * RTI_FALSE otherwise.
690  *
691  */
692 RTPSDllExport void
693 RTPS_SequenceNumber_deserialize(char **src_buffer,
694  struct REDA_SequenceNumber *instance,
695  RTI_BOOL byte_swap);
696 
697 
698 /*ci \ingroup RTPS_SequenceNumberClass
699  * \brief Calculate the distance between two sequence numbers.
700  *
701  * \param[in] s1 First sequence number
702  * \param[in] s2 Second sequence number
703  *
704  * \return The distance, possibly saturated to RTPS_BITMAP_DISTANCE_MAX.
705  * -1 on failure.
706  */
707 MUST_CHECK_RETURN RTPSDllExport RTI_INT32
708 RTPS_SequenceNumber_get_distance(
709  const struct REDA_SequenceNumber *s1,
710  const struct REDA_SequenceNumber *s2);
711 
712 /*ci \brief Bitmap array max size
713  * \details Bitmap has maximum 256 bits, using (256/32 =) 8 ints
714  */
715 #define RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX (8)
716 
717 /*ci
718  * \brief Bitmap of sequence numbers received
719  *
720  * \details
721  * Tracks sequence numbers of samples sent or received. Used in send and
722  * window implementations.
723  */
724 struct RTPS_Bitmap
725 {
726  /*ci \brief Starting sequence number of bitmap */
727  struct REDA_SequenceNumber lead;
728 
729  /*ci \brief Number of valid bits or sequence numbers, starting from lead */
730  RTI_INT32 bit_count;
731 
732  /*ci \brief The bitmap stored as an array of integers.
733  *
734  * \details
735  * Maximum of 256 (=8*32) bits or sequence numbers.
736  * This must be unsigned in order to apply the >> operator.
737  * There are two approaches to handle bits outside bitCount:
738  * 1) They must always be zeroed.
739  * 2) They can be anything.
740  * The first approach puts the burden on otherwise simple
741  * methods such as truncate to zero out truncated bits, whereas
742  * the second approach puts the burden on methods such as shift
743  * to make sure bits beyond the bitCount are not shifted in.
744  * In our implementation, we have opted for the second approach.
745  */
746  RTI_UINT32 bits[RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX];
747 };
748 
749 /*ci \brief Maximum number of bits in bitmap */
750 #define RTPS_BITMAP_SIZE_MAX (256)
751 
752 /*ci \brief Maximum bitmap sequence number distance */
753 #define RTPS_BITMAP_DISTANCE_MAX (0x7FFFFFFF)
754 
755 /*ci \brief Reset bitmap to specified lead and bitCount
756  *
757  * \details Post condition: bitmap has its lead and bit count assigned, and
758  * all bits are reset to zero.
759  *
760  * \param[in] me Bitmap
761  * \param[in] sn New lead sequence number
762  * \param[in] bit_count New bit count. Must be <= RTPS_BITMAP_SIZE_MAX.
763  *
764  */
765 RTPSDllExport void
766 RTPS_Bitmap_reset(
767  struct RTPS_Bitmap *me,
768  const struct REDA_SequenceNumber *sn,
769  RTI_INT32 bit_count);
770 
771 /*ci \ingroup RTPS_BitmapClass
772  * \brief Set specified bit in bitmap.
773  *
774  * \details
775  * The bit corresponding to the input sequence number is set to either
776  * 0 or 1 as specified in input param.
777  *
778  * \param[in] me Bitmap
779  * \param[out] existed RTI_TRUE if bit is already set, RTI_FALSE otherwise.
780  * \param[in] num The sequence number of interest.
781  * \param[in] bit RTI_TRUE if bit is to be turned on, RTI_FALSE otherwise.
782  *
783  * \return RTI_FALSE on failure, which includes the sequence not in bitmap.
784  * RTI_TRUE on success.
785  */
786 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
787 RTPS_Bitmap_set_bit(struct RTPS_Bitmap *me,
788  RTI_BOOL *existed,
789  const struct REDA_SequenceNumber *num,
790  RTI_BOOL bit);
791 
792 /*ci \ingroup RTPS_BitmapClass
793  * \brief Get specified bit in bitmap.
794  *
795  * \details
796  * The bit corresponding to the input sequence number is set to either
797  * 0 or 1 as specified in input param.
798  *
799  * \param[in] me Bitmap
800  * \param[in] bit Pointer to the answer, whose value will be RTI_TRUE
801  if bit is on and RTI_FALSE otherwise.
802  * \param[in] num The sequence number of interest.
803  *
804  * \return RTI_FALSE on failure, which includes the sequence not in bitmap.
805  * RTI_TRUE on success.
806  */
807 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
808 RTPS_Bitmap_get_bit(
809  const struct RTPS_Bitmap *me,
810  RTI_BOOL *bit,
811  const struct REDA_SequenceNumber *num);
812 
813 /*ci
814  * \brief
815  * Get the sequence number of the first bit in bitmap that matches the input
816  * value
817  *
818  * \param[in] me Bitmap
819  * \param[out] position Sequence number of first bit matching searchBit. If
820  * no match found, position is one greater than last valid bit of bitmap.
821  * \param[in] search_bit Value of bit for which to search
822  *
823  * \return RTI_TRUE on successfully finding matching bit, RTI_FALSE on failure
824  */
825 SHOULD_CHECK_RETURN RTPSDllExport RTI_BOOL
826 RTPS_Bitmap_get_first_bit(
827  const struct RTPS_Bitmap *me,
828  struct REDA_SequenceNumber *position,
829  RTI_BOOL search_bit);
830 
831 /*ci
832  * \brief
833  * Get the sequence number of the last bit in bitmap that matches the input
834  * value
835  *
836  * \param[in] me Bitmap
837  * \param[out] position Sequence number of last bit matching searchBit. If
838  * no match found, position is zero.
839  * \param[in] search_bit Value of bit for which to search
840  *
841  * \return RTI_TRUE on successfully finding matching bit, RTI_FALSE on failure
842  */
843 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
844 RTPS_Bitmap_get_last_bit(
845  const struct RTPS_Bitmap *me,
846  struct REDA_SequenceNumber *position,
847  RTI_BOOL search_bit);
848 
849 /*ci
850  * \brief
851  * Fill a range of bits in bitmap with specified value
852  *
853  * \param[in] me Bitmap
854  * \param[in] first_seq_num First sequence number in range to fill
855  * \param[in] last_seq_num Last sequence number in range to fill
856  * \param[in] bit Value to set bits in range
857  *
858  * \return RTI_TRUE on success, RTI_FALSE on failure
859  */
860 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
861 RTPS_Bitmap_fill(
862  struct RTPS_Bitmap *me,
863  const struct REDA_SequenceNumber *first_seq_num,
864  const struct REDA_SequenceNumber *last_seq_num,
865  RTI_BOOL bit);
866 
867 
868 /*ci
869  * \brief
870  * Merge another bitmap with self bitmap
871  *
872  * \details
873  * Copies '1' bits from source bitmap whose sequence numbers overlap with self
874  * bitmap. Bitcount and lead SN of self bitmap are preserved.
875  *
876  * \param[in] me Self bitmap
877  * \param[in] source Bitmap to merge with self
878  *
879  */
880 RTPSDllExport void
881 RTPS_Bitmap_merge(
882  struct RTPS_Bitmap *me,
883  const struct RTPS_Bitmap *source);
884 
885 /*ci
886  * \brief
887  * Shift lead sequence number of bitmap to new value
888  *
889  * \details
890  * Preserves bitcount of bitmap, setting new shifted-in bits to zero.
891  *
892  * \param[in] me Self bitmap
893  * \param[in] seq_num New lead sequence number
894  *
895  * \return RTI_TRUE on success, RTI_FALSE on failure
896  */
897 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
898 RTPS_Bitmap_shift(
899  struct RTPS_Bitmap *me,
900  const struct REDA_SequenceNumber *seq_num);
901 
902 /*ci
903  * \brief
904  * Truncates bitmap to end at specified sequence number
905  *
906  * \details
907  * Updates bitcount of bitmap to reflect number of valid bits up to truncated
908  * sequence number. If truncation sequence number is greater than current last
909  * sequence number of bitmap, no truncation is done and bitcount stays the same.
910  *
911  * \param[in] me Self bitmap
912  * \param[in] seq_num Sequence number after which bitmap is truncated.
913  *
914  */
915 RTPSDllExport void
916 RTPS_Bitmap_truncate(
917  struct RTPS_Bitmap *me,
918  const struct REDA_SequenceNumber *seq_num);
919 
920 /*ci
921  * \brief
922  * Toggle bits of bitmap
923  *
924  * \details
925  * Change '1' to '0' and vice versa.
926  *
927  * \param[inout] me Self bitmap
928  *
929  */
930 RTPSDllExport void
931 RTPS_Bitmap_invert(struct RTPS_Bitmap *me);
932 
933 /*ci
934  * \brief
935  * Deserialize from buffer a bitmap
936  *
937  * \details
938  * Change '1' to '0' and vice versa.
939  *
940  * \param[in] me Self bitmap
941  * \param[in] stream_ptr Pointer to serialized buffer
942  * \param[in] max_bits_len Remaining space of submessage to deserialize
943  * the variable length bits of bitmap
944  * \param[in] need_byte_swap Flag whether byte swap is necessary for
945  * deserialization
946  *
947  * \return RTI_TRUE on success, RTI_FALSE on failure
948  *
949  */
950 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
951 RTPS_Bitmap_deserialize(
952  struct RTPS_Bitmap *me,
953  const char **stream_ptr,
954  RTI_UINT32 max_bits_len,
955  RTI_BOOL need_byte_swap);
956 
957 /******************************************************************************/
958 /*ci
959  * \brief
960  * Serialize GUID to stream buffer
961  *
962  * \param[inout] stream Serialization stream
963  * \param[in] guid GUID to serialize
964  * \param[in] param Unused
965  *
966  * \return RTI_TRUE on success, RTI_FALSE on failure
967  */
968 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
969 RTPS_Guid_serialize(
970  struct CDR_Stream_t *stream,
971  const struct RTPS_Guid *guid,
972  void * param);
973 
974 /*ci
975  * \brief
976  * Deserialize GUID from stream buffer
977  *
978  * \param[in] stream Deserialization stream
979  * \param[inout] guid Deserialized GUID
980  * \param[in] param Unused
981  *
982  * \return RTI_TRUE on success, RTI_FALSE on failure
983  */
984 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
985 RTPS_Guid_deserialize(
986  struct CDR_Stream_t *stream,
987  struct RTPS_Guid *guid,
988  void * param);
989 
990 /*ci
991  * \brief
992  * Length in bytes of serialized GUID
993  *
994  * \param[in] size Current length of serialized buffer
995  *
996  * \return Number of bytes of serialized GUID
997  */
998 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
999 RTPS_Guid_get_max_size_serialized(RTI_UINT32 size);
1000 
1001 /* -------------------------------------------------------------------------- */
1002 /*ci
1003  * \brief
1004  * Serialize NTP time to stream buffer
1005  *
1006  * \param[inout] stream Serialization stream
1007  * \param[in] time NTP time to serialize
1008  * \param[in] param Unused
1009  *
1010  * \return RTI_TRUE on success, RTI_FALSE on failure
1011  */
1012 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1013 RTPS_serialize_ntp_time(
1014  struct CDR_Stream_t *stream,
1015  const OSAPI_NtpTime *time,
1016  void * param);
1017 
1018 /*ci
1019  * \brief
1020  * Deserialize NTP time from stream buffer
1021  *
1022  * \param[in] stream Deserialization stream
1023  * \param[inout] time Deserialized NTP time
1024  * \param[in] param Unused
1025  *
1026  * \return RTI_TRUE on success, RTI_FALSE on failure
1027  */
1028 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1029 RTPS_deserialize_ntp_time(
1030  struct CDR_Stream_t *stream,
1031  OSAPI_NtpTime *time,
1032  void * param);
1033 
1034 /*ci
1035  * \brief
1036  * Length in bytes of serialized NTP time
1037  *
1038  * \param[in] size Current length of serialized buffer
1039  *
1040  * \return Number of bytes of serialized NTP time
1041  */
1042 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1043 RTPS_get_ntp_time_max_size_serialized(RTI_UINT32 size);
1044 
1045 /* -------------------------------------------------------------------------- */
1046 /*ci
1047  * \brief
1048  * Serialize unsigned short to stream buffer
1049  *
1050  * \param[inout] stream Serialization stream
1051  * \param[in] in Value to serialize
1052  * \param[in] param Unused
1053  *
1054  * \return RTI_TRUE on success, RTI_FALSE on failure
1055  */
1056 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1057 RTPS_serialize_2_octets(
1058  struct CDR_Stream_t *stream,
1059  const RTI_UINT16 * in,
1060  void * param);
1061 
1062 /*ci
1063  * \brief
1064  * Deserialize unsigned short from stream buffer
1065  *
1066  * \param[in] stream Deserialization stream
1067  * \param[inout] out Deserialized value
1068  * \param[in] param Unused
1069  *
1070  * \return RTI_TRUE on success, RTI_FALSE on failure
1071  */
1072 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1073 RTPS_deserialize_2_octets(
1074  struct CDR_Stream_t *stream,
1075  RTI_UINT16 *out,
1076  void * param);
1077 
1078 /*ci
1079  * \brief
1080  * Length in bytes of serialized unsigned short
1081  *
1082  * \param[in] size Current length of serialized buffer
1083  *
1084  * \return Number of bytes of serialized unsigned short
1085  */
1086 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1087 RTPS_get_2_octets_max_size_serialized(RTI_UINT32 size);
1088 
1089 /* -------------------------------------------------------------------------- */
1090 /*ci
1091  * \brief
1092  * Serialize locator to stream buffer
1093  *
1094  * \param[inout] stream Serialization stream
1095  * \param[in] loc Locator to serialize
1096  * \param[in] param Unused
1097  *
1098  * \return RTI_TRUE on success, RTI_FALSE on failure
1099  */
1100 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1101 RTPS_serialize_ipv6_locator(
1102  struct CDR_Stream_t *stream,
1103  const struct RTPS_Locator_t *loc,
1104  void * param);
1105 
1106 /*ci
1107  * \brief
1108  * Deserialize locator from stream buffer
1109  *
1110  * \param[in] stream Deserialization stream
1111  * \param[inout] loc Deserialized locator
1112  * \param[in] param Unused
1113  *
1114  * \return RTI_TRUE on success, RTI_FALSE on failure
1115  */
1116 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1117 RTPS_deserialize_ipv6_locator(
1118  struct CDR_Stream_t *stream,
1119  struct RTPS_Locator_t *loc,
1120  void * param);
1121 
1122 /*ci
1123  * \brief
1124  * Length in bytes of serialized locator
1125  *
1126  * \param[in] size Current length of serialized buffer
1127  *
1128  * \return Number of bytes of serialized locator
1129  */
1130 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1131 RTPS_get_ipv6_locator_max_size_serialized(RTI_UINT32 size);
1132 
1133 /* -------------------------------------------------------------------------- */
1134 /*ci \brief Deserialize epoch from stream buffer
1135  *
1136  * \param[inout] me Deserialized epoch
1137  * \param[in] stream Deserialization stream
1138  * \param[in] need_byte_swap Flags whether to byte swap byte order on
1139  * deserialization
1140  *
1141  * \return RTI_TRUE on success, RTI_FALSE on failure
1142  */
1143 RTPSDllExport void
1144 RTPS_Epoch_deserialize(REDA_Epoch_T * me,
1145  const char **stream,
1146  RTI_BOOL need_byte_swap);
1147 
1148 
1149 /*ci \brief RTPS GUID type */
1150 typedef struct NETIO_Guid RTPS_GUID;
1151 
1152 /*ci \brief RTPS GuidPrefix type */
1153 typedef struct NETIO_GuidPrefix RTPS_GuidPrefix_T;
1154 
1155 /*ci \brief RTPS Entity type */
1156 typedef struct NETIO_GuidEntity RTPS_Entity_T;
1157 
1158 /*ci \brief Default unknown GUID prefix initializer */
1159 #define RTPS_GUIDPREFIX_UNKNOWN {{0,0,0,0,0,0,0,0,0,0,0,0}}
1160 
1161 /*ci \brief Default unknown Entity ID initializer */
1162 #define RTPS_ENTITY_UNKNOWN {{0,0,0,0}}
1163 
1164 /* -------------------------------------------------------------------------- */
1165 /*ci \brief RTPS Timestamp type */
1166 struct RTPS_Time
1167 {
1168  /*ci \brief Seconds */
1169  RTI_INT32 seconds;
1170 
1171  /*ci \brief Fractional part */
1172  RTI_UINT32 fractions;
1173 };
1174 
1175 /*ci \brief RTPS Vendor ID type */
1176 struct RTPS_Vendor
1177 {
1178  /*ci \brief Vendor ID value */
1179  RTI_UINT8 value[2];
1180 };
1181 
1182 /*ci \brief RTPS Protocol Version type */
1183 struct RTPS_ProtocolVersion
1184 {
1185  /*ci \brief Major */
1186  RTI_UINT8 major;
1187 
1188  /*ci \brief Minor */
1189  RTI_UINT8 minor;
1190 };
1191 
1192 /*ci \brief RTPS message header
1193  * \details
1194  * Fields are ordered exactly as defined by RTPS specification
1195  */
1196 struct RTPS_Header
1197 {
1198  /*ci \brief 'R''T''P''S' protocol identifier */
1199  RTI_UINT32 rtps;
1200 
1201  /*ci \brief Protocol version */
1202  struct RTPS_ProtocolVersion protocol_version;
1203 
1204  /*ci \brief Vendor ID */
1205  struct RTPS_Vendor vendor_id;
1206 
1207  /*ci \brief Sender's GUID Prefix*/
1208  RTPS_GuidPrefix_T guid_prefix;
1209 };
1210 
1211 /*ci \brief RTPS message header's RTPS identifier, in host order */
1212 #ifdef RTI_ENDIAN_LITTLE
1213 #define VALID_RTPS_HEADER 0x53505452 /* RTPS backwards */
1214 #else
1215 #define VALID_RTPS_HEADER 0x52545053 /* RTPS in big endian */
1216 #endif /* RTI_ENDIAN_LITTLE */
1217 
1218 /******************************************************************************/
1219 
1220 /* RTPS Submessage IDs */
1221 /*ci \brief PAD submessage ID */
1222 #define RTPS_PAD_KIND (0x01)
1223 
1224 /*ci \brief ACKNACK submessage ID */
1225 #define RTPS_ACKNACK_KIND (0x06)
1226 
1227 /*ci \brief HEARTBEAT submessage ID */
1228 #define RTPS_HEARTBEAT_KIND (0x07)
1229 
1230 /*ci \brief GAP submessage ID */
1231 #define RTPS_GAP_KIND (0x08)
1232 
1233 /*ci \brief INFO_TS submessage ID */
1234 #define RTPS_INFO_TS_KIND (0x09)
1235 
1236 /*ci \brief INFO_SRC submessage ID */
1237 #define RTPS_INFO_SRC_KIND (0x0c)
1238 
1239 /*ci \brief INFO_REPLY_IP4 submessage ID */
1240 #define RTPS_INFO_REPLY_IP4_KIND (0x0d)
1241 
1242 /*ci \brief INFO_DST submessage ID */
1243 #define RTPS_INFO_DST_KIND (0x0e)
1244 
1245 /*ci \brief INFO_REPLY submessage ID */
1246 #define RTPS_INFO_REPLY_KIND (0x0f)
1247 
1248 /*ci \brief DATA submessage ID */
1249 #define RTPS_DATA_KIND (0x15)
1250 
1251 
1252 #define RTPS_LARGEST_SUBMSG_KIND RTPS_DATA_KIND
1253 
1254 /*ci \brief Length of RTPS submessage header */
1255 #define RTPS_SUBMESSAGE_HEADER_LENGTH 4
1256 
1257 
1258 
1259 /*ci \brief RTPS submessage header
1260  *
1261  * \details
1262  * Fields ordered exactly as defined by RTPS specification
1263  */
1264 struct RTPS_SubmsgHdr
1265 {
1266  /*ci \brief Submessage kind ID */
1267  RTI_UINT8 kind;
1268 
1269  /*ci \brief Submessage flags */
1270  RTI_UINT8 flags;
1271 
1272  /*ci \brief Submessage length */
1273  RTI_UINT16 length;
1274 };
1275 
1276 /*ci \brief Submessage little endianness flag */
1277 #define RTPS_SUBMSG_FLAG_E 0x1
1278 
1279 /******************************************************************************/
1280 /*ci \brief ACKNACK submessage, over-the-wire layout */
1281 struct RTPS_ACKNACK
1282 {
1283  /*ci \brief Submesage header */
1284  struct RTPS_SubmsgHdr hdr;
1285 
1286  /*ci \brief Source reader's entity ID */
1287  RTPS_Entity_T reader;
1288 
1289  /*ci \brief Destination writer's entity ID */
1290  RTPS_Entity_T writer;
1291 
1292  /*ci \brief Bitmap (variable length) */
1293  struct RTPS_Bitmap bitmap;
1294 
1295  /*ci \brief Epoch count */
1296  RTI_UINT32 count;
1297 };
1298 
1299 /*ci \brief ACKNACK Final flag */
1300 #define RTPS_ACKNACKFLAGS_F 0x2
1301 
1302 /******************************************************************************/
1303 /*ci \brief RTPS DATA submessage
1304  *
1305  * \details
1306  * Fixed length fields declared in type. Variable length fields (inline QoS,
1307  * DATA payload) accounted for later when setting DATA submessage.
1308  */
1309 struct RTPS_DATA
1310 {
1311  /*ci \brief Submessage header */
1312  struct RTPS_SubmsgHdr hdr;
1313 
1314  /*ci \brief Submessage flags */
1315  RTI_UINT16 flags;
1316 
1317  /*ci \brief Inline Qos offset */
1318  RTI_UINT16 qos_offset;
1319 
1320  /*ci \brief Destination reader entity ID */
1321  RTPS_Entity_T reader;
1322 
1323  /*ci \brief Source writer entity ID */
1324  RTPS_Entity_T writer;
1325 
1326  /*ci \brief Sequence number */
1327  struct REDA_SequenceNumber sn;
1328 };
1329 
1330 /*ci \brief Default empty DATA submessage flag */
1331 #define RTPS_FLAGS_NONE 0x0
1332 
1333 /*ci \brief Inline Qos Q-flag for DATA submessage */
1334 #define RTPS_DATAFLAGS_Q 0x2
1335 
1336 /*ci \brief Data D-flag for DATA submessage */
1337 #define RTPS_DATAFLAGS_D 0x4
1338 
1339 /*ci \brief Data K-flag for DATA submessage */
1340 #define RTPS_DATAFLAGS_K 0x8
1341 
1342 /*ci \brief Default Inline Qos offset */
1343 #define RTPS_DATA_INLINEQOS_OFFSET 16
1344 
1345 /******************************************************************************/
1346 /*ci \brief GAP submessage */
1347 struct RTPS_GAP
1348 {
1349  /*ci \brief Submessage header */
1350  struct RTPS_SubmsgHdr hdr;
1351 
1352  /*ci \brief Destination reader entity ID */
1353  RTPS_Entity_T reader;
1354 
1355  /*ci \brief Source writer entity ID */
1356  RTPS_Entity_T writer;
1357 
1358  /*ci \brief Sequence number of start of GAP */
1359  struct REDA_SequenceNumber sn_start;
1360 
1361  /*ci \brief Bitmap */
1362  struct RTPS_Bitmap bitmap; /* variable length */
1363 };
1364 
1365 /******************************************************************************/
1366 /*ci \brief HEARTBEAT submessage */
1367 struct RTPS_HEARTBEAT
1368 {
1369  /*ci \brief Submessage header */
1370  struct RTPS_SubmsgHdr hdr;
1371 
1372  /*ci \brief Destination reader entity ID */
1373  RTPS_Entity_T reader;
1374 
1375  /*ci \brief Source writer entity ID */
1376  RTPS_Entity_T writer;
1377 
1378  /*ci \brief First sequence number */
1379  struct REDA_SequenceNumber sn_first;
1380 
1381  /*ci \brief Last sequence number */
1382  struct REDA_SequenceNumber sn_last;
1383 
1384  /*ci \brief Epoch count */
1385  RTI_INT32 count;
1386 };
1387 
1388 /*ci \brief Final HEARTBEAT submesasge flag */
1389 #define RTPS_HBFLAGS_F 0x02
1390 
1391 /*ci \brief Liveliness HEARTBEAT submessage flag */
1392 #define RTPS_HBFLAGS_L 0x04
1393 
1394 /******************************************************************************/
1395 /*ci \brief INFO_DST submessage */
1396 struct RTPS_INFO_DST
1397 {
1398  /*ci \brief Submessage header */
1399  struct RTPS_SubmsgHdr hdr;
1400 
1401  /*ci \brief Destination GUID prefix */
1402  RTPS_GuidPrefix_T guid_prefix;
1403 };
1404 
1405 /******************************************************************************/
1406 /*ci \brief INFO_TS submessage */
1407 struct RTPS_INFO_TS
1408 {
1409  /*ci \brief Submessage header */
1410  struct RTPS_SubmsgHdr hdr;
1411 
1412  /*ci \brief Source timestamp */
1413  struct RTPS_Time timestamp;
1414 };
1415 
1416 /*ci \brief Invalid Timestamp INFO_TS flag */
1417 #define RTPS_INFO_TSFLAGS_I (0x2)
1418 
1419 /******************************************************************************/
1420 /*ci \brief RTPS headers and submessages
1421  *
1422  * \details
1423  * Used to typecast serialized/deserialized stream buffer
1424  */
1425 union RTPS_MESSAGES
1426 {
1427  /*ci \brief Submessage header */
1428  struct RTPS_SubmsgHdr submsg;
1429 
1430  /*ci \brief Message header */
1431  struct RTPS_Header header;
1432 
1433  /*ci \brief DATA submessage */
1434  struct RTPS_DATA data;
1435 
1436  /*ci \brief GAP submessage */
1437  struct RTPS_GAP gap;
1438 
1439  /*ci \brief HEARTBEAT submessage */
1440  struct RTPS_HEARTBEAT hb;
1441 
1442  /*ci \brief ACKNACK submessage */
1443  struct RTPS_ACKNACK acknack;
1444 
1445  /*ci \brief INFO_TS submessage */
1446  struct RTPS_INFO_TS info_ts;
1447 
1448  /*ci \brief INFO_DST submessage */
1449  struct RTPS_INFO_DST info_dst;
1450 };
1451 
1452 /******************************************************************************/
1453 /*ci \brief RTPS interface mode */
1454 typedef enum
1455 {
1456  /*ci \brief Default undefined mode */
1457  RTPS_INTERFACEMODE_UNDEFINED,
1458 
1459  /*ci \brief Writer mode */
1460  RTPS_INTERFACEMODE_WRITER,
1461 
1462  /*ci \brief Reader mode */
1463  RTPS_INTERFACEMODE_READER,
1464 
1465  /*ci \brief External receiver mode */
1466  RTPS_INTERFACEMODE_EXTERNAL_RECEIVER
1467 } RTPS_InterfaceMode_t;
1468 
1469 /*ci \brief RTPS interface property */
1470 struct RTPS_InterfaceProperty
1471 {
1472  /*ci \brief Base NETIO interface property */
1473  struct NETIO_InterfaceProperty _parent;
1474 
1475  /*ci \brief RTPS interface mode */
1476  RTPS_InterfaceMode_t mode;
1477 
1478  /*ci \brief RTPS interface GUID address */
1479  struct NETIO_Address intf_address;
1480 
1481  /*ci \brief Maximum number of peers */
1482  RTI_INT32 max_peer_count;
1483 
1484  /*ci \brief RTI_TRUE for reliable writer or reader */
1485  RTI_BOOL reliable;
1486 
1487  /*ci \brief RTI_TRUE for anonymous writer or reader */
1488  RTI_BOOL anonymous;
1489 
1490  /*ci \brief HEARTBEAT period for reliable writer */
1491  struct OSAPI_NtpTime hb_period;
1492 
1493  /*ci \brief Piggyback HEARTBEAT rate for reliable writer
1494  *
1495  * \details
1496  * A HEARTBEAT submessage is appended to every Nth new DATA submessage
1497  * sent, where N is sample_per_hb.
1498  */
1499  RTI_SIZE_T samples_per_hb;
1500 
1501  /*ci \brief Maximum window size for writer or reader */
1502  RTI_UINT32 max_window_size;
1503 
1504  /*ci \brief Maximum HEARTBEAT retries for reliable writer
1505  *
1506  * \details
1507  * A peer reader must respond to a reliable writer's HEARTBEATs to be
1508  * considered active. If N periodic HEARTBEATs have been sent without
1509  * reciving an ACKNACK, where N is maxhb_retries, the peer reader is
1510  * then considered inactive and will stay inactive until an ACKNACK is
1511  * received.
1512  */
1513  RTI_INT32 max_hb_retries;
1514 
1515  /*ci \brief Maximum number of samples of upstream interface */
1516  RTI_INT32 max_samples;
1517 #if OSAPI_ENABLE_TRACE
1518  const char *session_name;
1519 #endif
1520 };
1521 
1522 #if OSAPI_ENABLE_TRACE
1523 #define RTPS_SESSION_NAME_INIT ,NULL
1524 #else
1525 #define RTPS_SESSION_NAME_INIT
1526 #endif
1527 
1528 /*ci \brief Unlimited max HEARTBEAT retries */
1529 #define RTPS_RETRIES_UNLIMITED (-1)
1530 
1531 /*ci \brief Maximum receive window size */
1532 #define RTPS_RECEIVE_WINDOW_MAX_SIZE (256)
1533 
1534 /*ci \brief Default RTPS interface property initializer */
1535 #define RTPS_InterfaceProperty_INITIALIZER \
1536 {\
1537  NETIO_InterfaceProperty_INITIALIZER,\
1538  RTPS_INTERFACEMODE_UNDEFINED,\
1539  NETIO_Address_INITIALIZER, \
1540  4, /* max_peer_count */ \
1541  RTI_FALSE, /* reliable */ \
1542  RTI_FALSE, /* anonymous */ \
1543  {3,0}, /* hb_period */ \
1544  8, /* samples_per_hb */ \
1545  256, /* window_size */ \
1546  RTPS_RETRIES_UNLIMITED, /* max_hb_retries */\
1547  256 /* max_samples */ \
1548  RTPS_SESSION_NAME_INIT \
1549 }
1550 
1551 /*ci \brief Property for an RTPS route */
1552 struct RTPS_RouteProperty
1553 {
1554  /*ci \brief Base NETIO route property */
1555  struct NETIORouteProperty _parent;
1556 
1557  /*ci \brief Reliable flag of peer reachable over route */
1558  RTI_BOOL reliable;
1559 
1560  /*ci \brief First sequence number of upstream interface creating the
1561  * route
1562  */
1563  struct REDA_SequenceNumber first_sn;
1564 
1565  /*ci \brief Last sequence number of upstream interface creating the
1566  * route
1567  */
1568  struct REDA_SequenceNumber last_sn;
1569 
1570  /*ci \brief Last acknowledged sequence number of upstream interface
1571  * creating the route
1572  */
1573  struct REDA_SequenceNumber last_acked_sn;
1574 };
1575 
1576 /*ci \brief Default RTPS route property initializer */
1577 #define RTPSRouteProperty_INITIALIZER \
1578 {\
1579  NETIORouteProperty_INITIALIZER, \
1580  RTI_FALSE, /* reliable */ \
1581  REDA_SEQUENCE_NUMBER_ZERO,\
1582  REDA_SEQUENCE_NUMBER_ZERO, \
1583  REDA_SEQUENCE_NUMBER_ZERO \
1584 }
1585 
1586 /*ci \brief Get RTPS inteface factory
1587  * \return Pointer to RTPS interface factory
1588  */
1589 MUST_CHECK_RETURN RTPSDllExport struct RT_ComponentFactoryI*
1590 RTPS_InterfaceFactory_get_interface(void);
1591 
1592 #ifdef __cplusplus
1593 } /* extern "C" */
1594 #endif
1595 
1596 #include "rtps/rtps_rtps_impl.h"
1597 
1598 #endif /* rtps_rtps_h */

RTI Connext DDS Micro Version 2.4.8 Copyright © Tue Apr 12 2016 Real-Time Innovations, Inc