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

RTI Connext Micro Version 2.4.4.0 Copyright © Thu Apr 30 2015 Real-Time Innovations, Inc