44 #ifndef reda_sequenceNumber_h
45 #include "reda/reda_sequenceNumber.h"
50 #ifndef osapi_system_h
57 #include "cdr/cdr_stream.h"
59 #ifndef netio_common_h
62 #ifndef netio_common_h
65 #ifndef netio_address_h
66 #include "netio/netio_address.h"
69 #include "netio/netio_route.h"
71 #ifndef netio_interface_h
81 #define RTPS_CPP_SUPPORT_METHODS_BASIC(T) \
87 T& operator=(const T& from);\
88 bool operator==(const T& other);\
89 bool operator!=(const T& other);
91 #define RTPS_CPP_SUPPORT_METHODS_BASIC(T)
95 #define RTPS_PATHNAME_LEN_MAX (255)
101 typedef RTI_UINT16 RTPS_ParameterId;
108 #define RTPS_PID_INCOMPATIBLE_MASK (0x4000)
113 #define RTPS_PID_PAD (0x0000)
118 #define RTPS_PID_SENTINEL (0x0001)
126 #define RTPS_PID_TOPIC_NAME (0x0005)
135 #define RTPS_PID_TYPE_NAME (0x0007)
144 #define RTPS_PID_DURABILITY (0x001d)
153 #define RTPS_PID_DESTINATION_ORDER (0x0025)
161 #define RTPS_PID_DEADLINE (0x0023)
170 #define RTPS_PID_LIVELINESS (0x001b)
179 #define RTPS_PID_RELIABILITY (0x001a)
187 #define RTPS_PID_OWNERSHIP (0x001f)
195 #define RTPS_PID_OWNERSHIP_STRENGTH (0x0006)
203 #define RTPS_PID_PROTOCOL_VERSION (0x0015)
211 #define RTPS_PID_VENDOR_ID (0x0016)
215 #define RTPS_PID_USERDATA_IPADDRESS_COUNT_MAX (4)
222 #define RTPS_PID_UNICAST_LOCATOR6 (0x002f)
229 #define RTPS_PID_MULTICAST_LOCATOR6 (0x0030)
236 #define RTPS_PID_DEFAULT_UNICAST_LOCATOR6 (0x0031)
243 #define RTPS_PID_METATRAFFIC_UNICAST_LOCATOR6 (0x0032)
250 #define RTPS_PID_METATRAFFIC_MULTICAST_LOCATOR6 (0x0033)
255 #define RTPS_PID_LEASE_DURATION (0x0002)
262 #define RTPS_PID_PROPERTY_LIST (0x0059)
267 #define RTPS_PID_PARTICIPANT_GUID (0x0050)
275 #define RTPS_PID_BUILTIN_ENDPOINT_MASK (0x0058)
280 #define RTPS_PID_ENDPOINT_GUID (0x005A)
285 #define RTPS_PID_ENTITY_NAME (0x0062)
291 #define RTPS_PID_KEY_HASH (0x0070)
294 #define RTPS_KEY_HASH_PARAM_LENGTH (16)
299 #define RTPS_PID_STATUS_INFO (0x0071)
302 #define RTPS_STATUS_INFO_PARAM_LENGTH (4)
305 #define RTPS_PID_SEND_QUEUE_SIZE_DEPRECATED (0x0013)
311 typedef RTI_UINT32 RTPS_HostId;
316 #define RTPS_HOST_ID_UNKNOWN (0x00000000)
321 typedef RTI_UINT32 RTPS_AppId;
326 #define RTPS_APP_ID_UNKNOWN (0x00000000)
331 typedef RTI_UINT32 RTPS_InstanceId;
336 #define RTPS_INSTANCE_ID_UNKNOWN (0x00000000)
341 typedef RTI_UINT32 RTPS_ObjectId;
346 #define RTPS_OBJECT_ID_UNKNOWN (0x00000000)
351 #define RTPS_OBJECT_ID_MAX (0xFFFFFFFF)
360 struct RTPS_GuidPrefix
375 RTPS_InstanceId instance_id ;
381 #define RTPS_GUID_PREFIX_UNKNOWN { \
382 RTPS_HOST_ID_UNKNOWN, \
383 RTPS_APP_ID_UNKNOWN, \
384 RTPS_INSTANCE_ID_UNKNOWN}
389 #define RTPS_GUID_PREFIX_SIZE (12)
397 struct RTPS_GuidPrefix prefix;
400 RTPS_ObjectId object_id;
406 #define RTPS_GUID_UNKNOWN { \
407 RTPS_GUID_PREFIX_UNKNOWN, \
408 RTPS_OBJECT_ID_UNKNOWN}
412 #define RTPS_OBJECT_ID_PARTICIPANT (0x000001C1)
415 #define RTPS_OBJECT_ID_WRITER_SDP_PARTICIPANT (0x000100C2)
418 #define RTPS_OBJECT_ID_WRITER_SDP_PUBLICATION (0x000003C2)
421 #define RTPS_OBJECT_ID_WRITER_SDP_SUBSCRIPTION (0x000004C2)
424 #define RTPS_OBJECT_ID_READER_SDP_PARTICIPANT (0x000100C7)
427 #define RTPS_OBJECT_ID_READER_SDP_PUBLICATION (0x000003C7)
430 #define RTPS_OBJECT_ID_READER_SDP_SUBSCRIPTION (0x000004C7)
434 #define RTPS_KEY_HASH_MAX_LENGTH 16
440 RTI_UINT8 value[RTPS_KEY_HASH_MAX_LENGTH];
447 #define RTPS_KEY_HASH_NIL {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
450 #define RTPS_KEY_HASH_DEFAULT { \
452 RTPS_KEY_HASH_MAX_LENGTH\
464 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
465 RTPS_Guid_equals(
struct RTPS_Guid *a,
struct RTPS_Guid *b);
475 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
476 RTPS_Guid_prefix_equals(
478 struct RTPS_Guid *b);
488 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
489 RTPS_Guid_suffix_equals(
491 struct RTPS_Guid *b);
495 typedef RTI_UINT16 RTPS_ProtocolVersion_T;
498 #define RTPS_PROTOCOL_VERSION_MAJOR (0x02)
501 #define RTPS_PROTOCOL_VERSION_MINOR (0x01)
504 typedef RTI_UINT16 RTPS_VendorId;
507 #define RTPS_VENDOR_ID_MAJOR (0x01)
510 #define RTPS_VENDOR_ID_MINOR (0x0A)
513 #define RTPS_VENDOR_ID_RTI_DDS (0x0101)
516 #define RTPS_VENDOR_ID_RTI_MICRO (0x010A)
526 RTPS_VendorId_get_major(RTPS_VendorId *me);
536 RTPS_VendorId_get_minor(RTPS_VendorId *me);
540 typedef RTI_UINT32 RTPS_StatusInfo;
543 #define RTPS_NO_STATUS_INFO (0x00000000)
546 #define RTPS_DISPOSE_STATUS_INFO (0x00000001)
549 #define RTPS_UNREGISTER_STATUS_INFO (0X00000002)
552 #define RTPS_ENDIAN_FLAG (0x01)
567 RTPS_OBJECT_NORMAL_USER_UNKNOWN = 0x00,
568 RTPS_OBJECT_NORMAL_USER_APPLICATION = 0x01,
570 RTPS_OBJECT_NORMAL_USER_CST_WRITER = 0x02,
572 RTPS_OBJECT_NORMAL_USER_PUBLICATION = 0x03,
574 RTPS_OBJECT_NORMAL_USER_SUBSCRIPTION = 0x04,
576 RTPS_OBJECT_NORMAL_USER_CST_READER = 0x07,
577 RTPS_OBJECT_NORMAL_USER_VIRTUAL_SUBSCRIPTION = 0x3C,
578 RTPS_OBJECT_NORMAL_USER_VIRTUAL_CST_READER = 0x3D,
579 RTPS_OBJECT_RESERVED_USER_UNKNOWN = 0x40,
580 RTPS_OBJECT_RESERVED_USER_APPLICATION = 0x41,
581 RTPS_OBJECT_RESERVED_USER_CST_WRITER = 0x42,
582 RTPS_OBJECT_RESERVED_USER_PUBLICATION = 0x43,
583 RTPS_OBJECT_RESERVED_USER_SUBSCRIPTION = 0x44,
584 RTPS_OBJECT_RESERVED_USER_CST_READER = 0x47,
585 RTPS_OBJECT_NORMAL_META_UNKNOWN = 0x80,
586 RTPS_OBJECT_NORMAL_META_APPLICATION = 0x81,
587 RTPS_OBJECT_NORMAL_META_CST_WRITER = 0x82,
588 RTPS_OBJECT_NORMAL_META_PUBLICATION = 0x83,
589 RTPS_OBJECT_NORMAL_META_SUBSCRIPTION = 0x84,
590 RTPS_OBJECT_NORMAL_META_CST_READER = 0x87,
591 RTPS_OBJECT_RESERVED_META_UNKNOWN = 0xc0,
592 RTPS_OBJECT_RESERVED_META_APPLICATION = 0xc1,
593 RTPS_OBJECT_RESERVED_META_CST_WRITER = 0xc2,
594 RTPS_OBJECT_RESERVED_META_PUBLICATION = 0xc3,
595 RTPS_OBJECT_RESERVED_META_SUBSCRIPTION = 0xc4,
596 RTPS_OBJECT_RESERVED_META_CST_READER = 0xc7
604 #define RTPS_LOCATOR_ADDRESS_LENGTH_MAX 16
609 #define RTPS_LOCATOR_ADDRESS_UDPV4_OFFSET 12
612 struct RTPS_Locator_t
621 RTI_UINT8 address[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
625 #define RTPS_LOCATOR_DEFAULT_KIND (-1)
628 #define RTPS_LOCATOR_DEFAULT {\
629 RTPS_LOCATOR_DEFAULT_KIND, \
631 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} \
635 #define RTPS_Locator RTPS_Locator_t
638 struct RTPS_LocatorUdpv4_t
651 #define RTPS_LOCATOR_UDPV4_DEFAULT {\
652 RTPS_LOCATOR_DEFAULT_KIND, \
658 extern RTPSDllVariable
const struct RTPS_Locator_t RTPS_LOCATOR_INVALID;
661 extern RTPSDllVariable
const RTI_INT32 RTPS_LOCATOR_KIND_INVALID;
664 extern RTPSDllVariable
const RTI_UINT32 RTPS_LOCATOR_PORT_INVALID;
667 extern RTPSDllVariable
const RTI_UINT8
668 RTPS_LOCATOR_ADDRESS_INVALID[RTPS_LOCATOR_ADDRESS_LENGTH_MAX];
671 extern RTPSDllVariable
const RTI_INT32 RTPS_LOCATOR_KIND_UDPv4;
674 extern RTPSDllVariable
const RTI_INT32 RTPS_LOCATOR_KIND_UDPv6;
677 extern RTPSDllVariable
const RTI_INT32 RTPS_LOCATOR_KIND_RESERVED;
680 extern RTPSDllVariable
const RTI_INT32 RTPS_LOCATOR_KIND_SHMEM;
701 RTPS_SequenceNumber_deserialize(
char **src_buffer,
702 struct REDA_SequenceNumber *instance,
715 MUST_CHECK_RETURN RTPSDllExport RTI_INT32
716 RTPS_SequenceNumber_get_distance(
717 const struct REDA_SequenceNumber *s1,
718 const struct REDA_SequenceNumber *s2);
723 #define RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX (8)
735 struct REDA_SequenceNumber lead;
754 RTI_UINT32 bits[RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX];
758 #define RTPS_BITMAP_SIZE_MAX (256)
761 #define RTPS_BITMAP_DISTANCE_MAX (0x7FFFFFFF)
775 struct RTPS_Bitmap *me,
776 const struct REDA_SequenceNumber *sn,
777 RTI_INT32 bit_count);
794 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
795 RTPS_Bitmap_set_bit(
struct RTPS_Bitmap *me,
797 const struct REDA_SequenceNumber *num,
815 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
817 const struct RTPS_Bitmap *me,
819 const struct REDA_SequenceNumber *num);
833 SHOULD_CHECK_RETURN RTPSDllExport RTI_BOOL
834 RTPS_Bitmap_get_first_bit(
835 const struct RTPS_Bitmap *me,
836 struct REDA_SequenceNumber *position,
837 RTI_BOOL search_bit);
851 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
852 RTPS_Bitmap_get_last_bit(
853 const struct RTPS_Bitmap *me,
854 struct REDA_SequenceNumber *position,
855 RTI_BOOL search_bit);
868 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
870 struct RTPS_Bitmap *me,
871 const struct REDA_SequenceNumber *first_seq_num,
872 const struct REDA_SequenceNumber *last_seq_num,
890 struct RTPS_Bitmap *me,
891 const struct RTPS_Bitmap *source);
905 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
907 struct RTPS_Bitmap *me,
908 const struct REDA_SequenceNumber *seq_num);
924 RTPS_Bitmap_truncate(
925 struct RTPS_Bitmap *me,
926 const struct REDA_SequenceNumber *seq_num);
939 RTPS_Bitmap_invert(
struct RTPS_Bitmap *me);
958 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
959 RTPS_Bitmap_deserialize(
960 struct RTPS_Bitmap *me,
961 const char **stream_ptr,
962 RTI_UINT32 max_bits_len,
963 RTI_BOOL need_byte_swap);
976 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
978 struct CDR_Stream_t *stream,
979 const struct RTPS_Guid *guid,
992 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
993 RTPS_Guid_deserialize(
994 struct CDR_Stream_t *stream,
995 struct RTPS_Guid *guid,
1006 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1007 RTPS_Guid_get_max_size_serialized(RTI_UINT32 size);
1020 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1021 RTPS_serialize_ntp_time(
1022 struct CDR_Stream_t *stream,
1036 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1037 RTPS_deserialize_ntp_time(
1038 struct CDR_Stream_t *stream,
1050 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1051 RTPS_get_ntp_time_max_size_serialized(RTI_UINT32 size);
1064 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1065 RTPS_serialize_2_octets(
1066 struct CDR_Stream_t *stream,
1067 const RTI_UINT16 * in,
1080 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1081 RTPS_deserialize_2_octets(
1082 struct CDR_Stream_t *stream,
1094 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1095 RTPS_get_2_octets_max_size_serialized(RTI_UINT32 size);
1108 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1109 RTPS_serialize_ipv6_locator(
1110 struct CDR_Stream_t *stream,
1111 const struct RTPS_Locator_t *loc,
1124 MUST_CHECK_RETURN RTPSDllExport RTI_BOOL
1125 RTPS_deserialize_ipv6_locator(
1126 struct CDR_Stream_t *stream,
1127 struct RTPS_Locator_t *loc,
1138 MUST_CHECK_RETURN RTPSDllExport RTI_UINT32
1139 RTPS_get_ipv6_locator_max_size_serialized(RTI_UINT32 size);
1152 RTPS_Epoch_deserialize(REDA_Epoch_T * me,
1153 const char **stream,
1154 RTI_BOOL need_byte_swap);
1158 typedef struct NETIO_Guid RTPS_GUID;
1161 typedef struct NETIO_GuidPrefix RTPS_GuidPrefix_T;
1164 typedef struct NETIO_GuidEntity RTPS_Entity_T;
1167 #define RTPS_GUIDPREFIX_UNKNOWN {{0,0,0,0,0,0,0,0,0,0,0,0}}
1170 #define RTPS_ENTITY_UNKNOWN {{0,0,0,0}}
1180 RTI_UINT32 fractions;
1191 struct RTPS_ProtocolVersion
1210 struct RTPS_ProtocolVersion protocol_version;
1213 struct RTPS_Vendor vendor_id;
1216 RTPS_GuidPrefix_T guid_prefix;
1220 #ifdef RTI_ENDIAN_LITTLE
1221 #define VALID_RTPS_HEADER 0x53505452
1223 #define VALID_RTPS_HEADER 0x52545053
1230 #define RTPS_PAD_KIND (0x01)
1233 #define RTPS_ACKNACK_KIND (0x06)
1236 #define RTPS_HEARTBEAT_KIND (0x07)
1239 #define RTPS_GAP_KIND (0x08)
1242 #define RTPS_INFO_TS_KIND (0x09)
1245 #define RTPS_INFO_SRC_KIND (0x0c)
1248 #define RTPS_INFO_REPLY_IP4_KIND (0x0d)
1251 #define RTPS_INFO_DST_KIND (0x0e)
1254 #define RTPS_INFO_REPLY_KIND (0x0f)
1257 #define RTPS_DATA_KIND (0x15)
1260 #define RTPS_LARGEST_SUBMSG_KIND RTPS_DATA_KIND
1263 #define RTPS_SUBMESSAGE_HEADER_LENGTH 4
1272 struct RTPS_SubmsgHdr
1285 #define RTPS_SUBMSG_FLAG_E 0x1
1292 struct RTPS_SubmsgHdr hdr;
1295 RTPS_Entity_T reader;
1298 RTPS_Entity_T writer;
1301 struct RTPS_Bitmap bitmap;
1308 #define RTPS_ACKNACKFLAGS_F 0x2
1320 struct RTPS_SubmsgHdr hdr;
1326 RTI_UINT16 qos_offset;
1329 RTPS_Entity_T reader;
1332 RTPS_Entity_T writer;
1335 struct REDA_SequenceNumber sn;
1339 #define RTPS_FLAGS_NONE 0x0
1342 #define RTPS_DATAFLAGS_Q 0x2
1345 #define RTPS_DATAFLAGS_D 0x4
1348 #define RTPS_DATAFLAGS_K 0x8
1351 #define RTPS_DATA_INLINEQOS_OFFSET 16
1358 struct RTPS_SubmsgHdr hdr;
1361 RTPS_Entity_T reader;
1364 RTPS_Entity_T writer;
1367 struct REDA_SequenceNumber sn_start;
1370 struct RTPS_Bitmap bitmap;
1375 struct RTPS_HEARTBEAT
1378 struct RTPS_SubmsgHdr hdr;
1381 RTPS_Entity_T reader;
1384 RTPS_Entity_T writer;
1387 struct REDA_SequenceNumber sn_first;
1390 struct REDA_SequenceNumber sn_last;
1397 #define RTPS_HBFLAGS_F 0x02
1400 #define RTPS_HBFLAGS_L 0x04
1404 struct RTPS_INFO_DST
1407 struct RTPS_SubmsgHdr hdr;
1410 RTPS_GuidPrefix_T guid_prefix;
1418 struct RTPS_SubmsgHdr hdr;
1421 struct RTPS_Time timestamp;
1425 #define RTPS_INFO_TSFLAGS_I (0x2)
1436 struct RTPS_SubmsgHdr submsg;
1439 struct RTPS_Header header;
1442 struct RTPS_DATA data;
1445 struct RTPS_GAP gap;
1448 struct RTPS_HEARTBEAT hb;
1451 struct RTPS_ACKNACK acknack;
1454 struct RTPS_INFO_TS info_ts;
1457 struct RTPS_INFO_DST info_dst;
1465 RTPS_INTERFACEMODE_UNDEFINED,
1468 RTPS_INTERFACEMODE_WRITER,
1471 RTPS_INTERFACEMODE_READER,
1474 RTPS_INTERFACEMODE_EXTERNAL_RECEIVER
1475 } RTPS_InterfaceMode_t;
1478 struct RTPS_InterfaceProperty
1481 struct NETIO_InterfaceProperty _parent;
1484 RTPS_InterfaceMode_t mode;
1487 struct NETIO_Address intf_address;
1490 RTI_INT32 max_peer_count;
1507 RTI_SIZE_T samples_per_hb;
1510 RTI_UINT32 max_window_size;
1521 RTI_INT32 max_hb_retries;
1524 RTI_INT32 max_samples;
1525 #if OSAPI_ENABLE_TRACE
1526 const char *session_name;
1530 #if OSAPI_ENABLE_TRACE
1531 #define RTPS_SESSION_NAME_INIT ,NULL
1533 #define RTPS_SESSION_NAME_INIT
1537 #define RTPS_RETRIES_UNLIMITED (-1)
1540 #define RTPS_RECEIVE_WINDOW_MAX_SIZE (256)
1543 #define RTPS_InterfaceProperty_INITIALIZER \
1545 NETIO_InterfaceProperty_INITIALIZER,\
1546 RTPS_INTERFACEMODE_UNDEFINED,\
1547 NETIO_Address_INITIALIZER, \
1554 RTPS_RETRIES_UNLIMITED, \
1556 RTPS_SESSION_NAME_INIT \
1560 struct RTPS_RouteProperty
1563 struct NETIORouteProperty _parent;
1571 struct REDA_SequenceNumber first_sn;
1576 struct REDA_SequenceNumber last_sn;
1581 struct REDA_SequenceNumber last_acked_sn;
1585 #define RTPSRouteProperty_INITIALIZER \
1587 NETIORouteProperty_INITIALIZER, \
1589 REDA_SEQUENCE_NUMBER_ZERO,\
1590 REDA_SEQUENCE_NUMBER_ZERO, \
1591 REDA_SEQUENCE_NUMBER_ZERO \
1597 MUST_CHECK_RETURN RTPSDllExport
struct RT_ComponentFactoryI*
1598 RTPS_InterfaceFactory_get_interface(
void);