omg-elements 0.2.3

Core message data structures generated from OMG IDL.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
/*
 *
 *
 * Distributed under the Apache License.
 * See: https://github.com/frehberg/rtps-gen/blob/master/LICENSE
 */

#ifndef RTPS_RTPSCORE_IDL
#define RTPS_RTPSCORE_IDL

#include "dds/DdsDcpsInfoUtils.idl"

#ifdef DDS_SECURITY
#include "dds/DdsSecurityParams.idl"
#endif

module DDS {
    module RTPS {

        typedef octet OctetArray2[2];
        typedef octet OctetArray4[4];

        /* A list of filters that were applied to the sample.
        See section 9.6.3.1 for the signature-generation algorithm. */
        typedef long FilterSignature_t[4];

        /* For each filter signature, the results indicate whether the
        sample passed the filter. */
        typedef sequence<long> FilterResult_t;

        typedef sequence<FilterSignature_t> FilterSignatureSeq;

        struct ContentFilterInfo_t {
            FilterResult_t filterResult;
            FilterSignatureSeq filterSignatures;
        };

        // TODO: PENDING IDL V4 INHERITANCE
        // Remove these typedefs and force dependencies to use the
        // DDS::Property_t version directly. These were move moved
        // into DdsDcpsCore.idl because:
        //  - PropertyQosPolicy depends on the security version of Property_t
        //  - Security's DomainParticipantQos depends on PropertyQosPolicy
        //  - Security's DomainParticipantQos inherits from the core DDS DomainParticipantQos
        //  - IDL v4 inheritance isn't supported yet (so we combined the two)
        typedef DDS::Property_t Property_t;
        typedef DDS::PropertySeq PropertySeq;

        struct EntityName_t {
            string name;
        };

        /* Type used to encapsulate a count that is incremented monotonically, used
        to identify message duplicates. */
        struct Count_t {
            long value;
        };

        /* Type used to hold sequence numbers. */
        struct SequenceNumber_t {
            long high;
            unsigned long low;
        };
        // see SEQUENCENUMBER_UNKNOWN constant in BaseMessageTypes.h

        typedef sequence<long, 8> LongSeq8;

        /* SequenceNumberSet SubmessageElements are used as parts of several
        messages to provide binary information about individual sequence numbers
        within a range. */
        struct SequenceNumberSet {
            SequenceNumber_t bitmapBase;
            unsigned long numBits;
            LongSeq8 bitmap;
        };

        /* LocatorList is used to specify a list of locators. */
        typedef sequence<DDS::DCPS::Locator_t, 8> LocatorList;

        // OMG Specification formal/2010-11-01 DDS-RTPS v2.1
        // Section 9.3: "Mapping of the RTPS Types"

        /* Type used to hold a timestamp. */
        struct Time_t { // IETF RFC 1305: time = seconds + fraction / 2^32
            long seconds;
            unsigned long fraction;
        };

        // see TIME_* constants in BaseMessageTypes.h
        typedef Time_t Timestamp_t;

        /* Duration_t isn't defined in the PSM. It is used to hold time-differences.
        Should have at least nano-second resolution.  Table 9.13's row for
        PID_PARTICIPANT_LEASE_DURATION indicates this a 2-item struct or array,
        just like Time_t (which does have the needed resolution).  So we'll use
        Time_t for the Duration_t datatype. */
        typedef Time_t Duration_t;

        const long LOCATOR_KIND_INVALID = -1;
        const long LOCATOR_KIND_RESERVED = 0;
        const long LOCATOR_KIND_UDPv4 = 1;
        const long LOCATOR_KIND_UDPv6 = 2;
        const unsigned long LOCATOR_PORT_INVALID = 0;
        // see LOCATOR_* constants in BaseMessageTypes.h

        /* Specialization of Locator_t used to hold UDP IPv4 locators using a more
        compact representation. */
        struct LocatorUDPv4_t {
            unsigned long address;
            unsigned long _port;
        };
        // see LOCATORUDPv4_INVALID constant in BaseMessageTypes.h

        /* Enumeration used to distinguish whether a Topic has defined some fields
        within to be used as the 'key' that identifies data-instances within the
        Topic. */
        struct TopicKind_t {
            long value;
        };

        // Constants for the TopicKind_t::value field
        const short NO_KEY = 1;
        const short WITH_KEY = 2;

        /* Enumeration used to indicate the level of the reliability used for
        communications. */
        struct ReliabilityKind_t {
            long value;
        };

        // Constants for the ReliabilityKind_t::value field
        const short BEST_EFFORT = 1;
        const short RELIABLE = 3;

        struct KeyHash_t {
            DCPS::OctetArray16 value;
        };

        struct StatusInfo_t {
            OctetArray4 value;
        };

        /* Identifies the version of the RTPS protocol. */
        struct ProtocolVersion_t {
            octet major;
            octet minor;
        };
        // see PROTOCOLVERSION* constants in BaseMessageTypes.h

        /* Type used to represent the vendor of the service
        implementing the RTPS protocol. */
        struct VendorId_t {
            OctetArray2 vendorId;
        };
        // see VENDORID_* constants in BaseMessageTypes.h

        typedef unsigned long BuiltinEndpointSet_t;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER =
        1 << 0;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR =
        1 << 1;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER =
        1 << 2;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR =
        1 << 3;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER =
        1 << 4;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR =
        1 << 5;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_ANNOUNCER =
        1 << 6;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_DETECTOR =
        1 << 7;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_ANNOUNCER =
        1 << 8;
        const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_DETECTOR =
        1 << 9;
        const BuiltinEndpointSet_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER =
        1 << 10;
        const BuiltinEndpointSet_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER =
        1 << 11;

        union Parameter;

        /* contains a list of Parameters, terminated with a sentinel */
        typedef sequence<Parameter> ParameterList;

        struct OriginalWriterInfo_t {
            DCPS::GUID_t originalWriterGUID;
            SequenceNumber_t originalWriterSN;
            ParameterList originalWriterQos;
        };

        typedef unsigned short ParameterId_t;

        // see Table 9.12 "ParameterId Values" and 9.14 "Inline QoS Parameters"
        //   (the following constants are in the same order as Table 9.12)
        const ParameterId_t PID_PAD = 0x0000;
        const ParameterId_t PID_SENTINEL = 0x0001;
        const ParameterId_t PID_USER_DATA = 0x002c;
        const ParameterId_t PID_TOPIC_NAME = 0x0005;
        const ParameterId_t PID_TYPE_NAME = 0x0007;
        const ParameterId_t PID_GROUP_DATA = 0x002d;
        const ParameterId_t PID_TOPIC_DATA = 0x002e;
        const ParameterId_t PID_DURABILITY = 0x001d;
        const ParameterId_t PID_DURABILITY_SERVICE = 0x001e;
        const ParameterId_t PID_DEADLINE = 0x0023;
        const ParameterId_t PID_LATENCY_BUDGET = 0x0027;
        const ParameterId_t PID_LIVELINESS = 0x001b;
        const ParameterId_t PID_RELIABILITY = 0x001a;
        const ParameterId_t PID_LIFESPAN = 0x002b;
        const ParameterId_t PID_DESTINATION_ORDER = 0x0025;
        const ParameterId_t PID_HISTORY = 0x0040;
        const ParameterId_t PID_RESOURCE_LIMITS = 0x0041;
        const ParameterId_t PID_OWNERSHIP = 0x001f;
        const ParameterId_t PID_OWNERSHIP_STRENGTH = 0x0006;
        const ParameterId_t PID_PRESENTATION = 0x0021;
        const ParameterId_t PID_PARTITION = 0x0029;
        const ParameterId_t PID_TIME_BASED_FILTER = 0x0004;
        const ParameterId_t PID_TRANSPORT_PRIORITY = 0x0049;
        const ParameterId_t PID_PROTOCOL_VERSION = 0x0015;
        const ParameterId_t PID_VENDORID = 0x0016;
        const ParameterId_t PID_UNICAST_LOCATOR = 0x002f;
        const ParameterId_t PID_MULTICAST_LOCATOR = 0x0030;
        const ParameterId_t PID_MULTICAST_IPADDRESS = 0x0011;
        const ParameterId_t PID_DEFAULT_UNICAST_LOCATOR = 0x0031;
        const ParameterId_t PID_DEFAULT_MULTICAST_LOCATOR = 0x0048;
        const ParameterId_t PID_METATRAFFIC_UNICAST_LOCATOR = 0x0032;
        const ParameterId_t PID_METATRAFFIC_MULTICAST_LOCATOR = 0x0033;
        const ParameterId_t PID_DEFAULT_UNICAST_IPADDRESS = 0x000c;
        const ParameterId_t PID_DEFAULT_UNICAST_PORT = 0x000e;
        const ParameterId_t PID_METATRAFFIC_UNICAST_IPADDRESS = 0x0045;
        const ParameterId_t PID_METATRAFFIC_UNICAST_PORT = 0x000d;
        const ParameterId_t PID_METATRAFFIC_MULTICAST_IPADDRESS = 0x000b;
        const ParameterId_t PID_METATRAFFIC_MULTICAST_PORT = 0x0046;
        const ParameterId_t PID_EXPECTS_INLINE_QOS = 0x0043;
        const ParameterId_t PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT = 0x0034;
        const ParameterId_t PID_PARTICIPANT_BUILTIN_ENDPOINTS = 0x0044;
        const ParameterId_t PID_PARTICIPANT_LEASE_DURATION = 0x0002;
        const ParameterId_t PID_CONTENT_FILTER_PROPERTY = 0x0035;
        const ParameterId_t PID_PARTICIPANT_GUID = 0x0050;
        const ParameterId_t PID_PARTICIPANT_ENTITYID = 0x0051;
        const ParameterId_t PID_GROUP_GUID = 0x0052;
        const ParameterId_t PID_GROUP_ENTITYID = 0x0053;
        const ParameterId_t PID_BUILTIN_ENDPOINT_SET = 0x0058;
        const ParameterId_t PID_PROPERTY_LIST = 0x0059;
        const ParameterId_t PID_TYPE_MAX_SIZE_SERIALIZED = 0x0060;
        const ParameterId_t PID_ENTITY_NAME = 0x0062;
        const ParameterId_t PID_KEY_HASH = 0x0070;
        const ParameterId_t PID_STATUS_INFO = 0x0071;
        //   (the following constant is not in the spec but is needed for SEDP)
        const ParameterId_t PID_ENDPOINT_GUID = 0x005a;
        //   (the following constants are in the same order as Table 9.14)
        const ParameterId_t PID_CONTENT_FILTER_INFO = 0x0055;
        const ParameterId_t PID_COHERENT_SET = 0x0056;
        // PID_DIRECTED_WRITE is not supported
        //    const ParameterId_t PID_DIRECTED_WRITE = 0x0057;
        const ParameterId_t PID_ORIGINAL_WRITER_INFO = 0x0061;

        // ParameterId Bitmask values (Table 9.11)
        const ParameterId_t PIDMASK_VENDOR_SPECIFIC = 0x8000;
        const ParameterId_t PIDMASK_INCOMPATIBLE = 0x4000;

        // Vendor-specific parameters
        // PID_DDS_BASE won't be used as an actual PID, it's just the starting
        // point for ones we assign.  This is deliberately a larger number so as
        // not to overlap ones that other vendors are using and are in the Wireshark
        // dissector (they could overlap, but it would confuse Wireshark).
        const ParameterId_t PID_DDS_BASE = PIDMASK_VENDOR_SPECIFIC + 0x3000;
        const ParameterId_t PID_DDS_LOCATOR           = PID_DDS_BASE + 1;
        const ParameterId_t PID_DDS_ASSOCIATED_WRITER = PID_DDS_BASE + 2;

        /* Always used inside a ParameterList */
        union Parameter switch (ParameterId_t) {
        case PID_TOPIC_NAME:
        case PID_TYPE_NAME:
            DDS::DCPS::String256 string_data;

        // DDS Quality-of-Service (QoS) structs
        case PID_USER_DATA:
            DDS::UserDataQosPolicy user_data;
        case PID_GROUP_DATA:
            DDS::GroupDataQosPolicy group_data;
        case PID_TOPIC_DATA:
            DDS::TopicDataQosPolicy topic_data;
        case PID_DURABILITY:
            DDS::DurabilityQosPolicy durability;
        case PID_DURABILITY_SERVICE:
            DDS::DurabilityServiceQosPolicy durability_service;
        case PID_DEADLINE:
            DDS::DeadlineQosPolicy deadline;
        case PID_LATENCY_BUDGET:
            DDS::LatencyBudgetQosPolicy latency_budget;
        case PID_LIVELINESS:
            DDS::LivelinessQosPolicy liveliness;
        case PID_RELIABILITY:
            DDS::ReliabilityQosPolicy reliability;
        case PID_LIFESPAN:
            DDS::LifespanQosPolicy lifespan;
        case PID_DESTINATION_ORDER:
            DDS::DestinationOrderQosPolicy destination_order;
        case PID_HISTORY:
            DDS::HistoryQosPolicy history;
        case PID_RESOURCE_LIMITS:
            DDS::ResourceLimitsQosPolicy resource_limits;
        case PID_OWNERSHIP:
            DDS::OwnershipQosPolicy ownership;
        case PID_OWNERSHIP_STRENGTH:
            DDS::OwnershipStrengthQosPolicy ownership_strength;
        case PID_PRESENTATION:
            DDS::PresentationQosPolicy presentation;
        case PID_PARTITION:
            DDS::PartitionQosPolicy partition;
        case PID_TIME_BASED_FILTER:
            DDS::TimeBasedFilterQosPolicy time_based_filter;
        case PID_TRANSPORT_PRIORITY:
            DDS::TransportPriorityQosPolicy transport_priority;

        // RTPS-defined data types
        case PID_PROTOCOL_VERSION:
            ProtocolVersion_t version;

        case PID_VENDORID:
            VendorId_t vendor;

        case PID_UNICAST_LOCATOR:
        case PID_MULTICAST_LOCATOR:
        case PID_DEFAULT_UNICAST_LOCATOR:
        case PID_DEFAULT_MULTICAST_LOCATOR:
        case PID_METATRAFFIC_UNICAST_LOCATOR:
        case PID_METATRAFFIC_MULTICAST_LOCATOR:
            DCPS::Locator_t locator;

        case PID_MULTICAST_IPADDRESS:
        case PID_DEFAULT_UNICAST_IPADDRESS:
        case PID_METATRAFFIC_UNICAST_IPADDRESS:
        case PID_METATRAFFIC_MULTICAST_IPADDRESS:
            unsigned long ipv4_address;
            //NOTE: the spec uses "IPv4Address_t" which is not defined anywhere.
            //      We have chosen unsigned long to match the type of
            //      the address field in the LocatorUDPv4_t struct.

        case PID_DEFAULT_UNICAST_PORT:
        case PID_METATRAFFIC_UNICAST_PORT:
        case PID_METATRAFFIC_MULTICAST_PORT:
            unsigned long udpv4_port;
            //NOTE: the spec uses "Port_t" which is not defined anywhere.
            //      We have chosen unsigned long to match the type of
            //      the port field in the LocatorUDPv4_t struct.

        case PID_EXPECTS_INLINE_QOS:
            boolean expects_inline_qos;

        case PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT:
            Count_t count;

        case PID_PARTICIPANT_BUILTIN_ENDPOINTS:
            unsigned long participant_builtin_endpoints;

        case PID_PARTICIPANT_LEASE_DURATION:
            Duration_t duration;

        case PID_CONTENT_FILTER_PROPERTY:
            DCPS::ContentFilterProperty_t content_filter_property;

        case PID_PARTICIPANT_GUID:
        case PID_ENDPOINT_GUID:
        case PID_GROUP_GUID:
        case PID_DDS_ASSOCIATED_WRITER:
            DCPS::GUID_t guid;

        case PID_PARTICIPANT_ENTITYID:
        case PID_GROUP_ENTITYID:
            DCPS::EntityId_t entity_id;

        case PID_BUILTIN_ENDPOINT_SET:
            BuiltinEndpointSet_t builtin_endpoints;

        case PID_PROPERTY_LIST:
            // IDL compiler adds support for reading the RTPS version of this
            // PID (which has one sequence in it), or the Security version which
            // contains the optional second sequence for binary properties.
            DDS::PropertyQosPolicy property;

        case PID_TYPE_MAX_SIZE_SERIALIZED:
            long type_max_size_serialized;

        case PID_ENTITY_NAME:
            EntityName_t entity_name;

        case PID_KEY_HASH:
            KeyHash_t key_hash;

        case PID_STATUS_INFO:
            StatusInfo_t status_info;

        case PID_CONTENT_FILTER_INFO:
            ContentFilterInfo_t content_filter_info;

        case PID_COHERENT_SET:
            SequenceNumber_t coherent_set;

        case PID_ORIGINAL_WRITER_INFO:
            OriginalWriterInfo_t original_writer_info;

        case PID_DDS_LOCATOR:
            DCPS::TransportLocator opendds_locator;

    #ifdef DDS_SECURITY
        case DDS::Security::PID_IDENTITY_TOKEN:
            DDS::Security::IdentityToken identity_token;

        case DDS::Security::PID_PERMISSIONS_TOKEN:
            DDS::Security::PermissionsToken permissions_token;

        case DDS::Security::PID_DATA_TAGS:
            DDS::Security::DataTags data_tags;

        case DDS::Security::PID_ENDPOINT_SECURITY_INFO:
            DDS::Security::EndpointSecurityInfo endpoint_security_info;

        case DDS::Security::PID_PARTICIPANT_SECURITY_INFO:
            DDS::Security::ParticipantSecurityInfo participant_security_info;

        case DDS::Security::PID_IDENTITY_STATUS_TOKEN:
            DDS::Security::IdentityStatusToken identity_status_token;
    #endif

        default:
            DDS::OctetSeq unknown_data;
        };

        const octet FLAG_E = 1; // All Submessages: little Endian
        const octet FLAG_Q = 2; // Data, DataFrag: inline Qos present
        const octet FLAG_F = 2; // AckNack, Heartbeat: Final
        const octet FLAG_I = 2; // InfoTimestamp: Invalidate
        const octet FLAG_M = 2; // InfoReplyIp4: Multicast present
        const octet FLAG_D = 4; // Data: sample Data present
        const octet FLAG_L = 4; // Heartbeat: Liveliness
        const octet FLAG_K_IN_FRAG = 4; // DataFrag: Key present
        const octet FLAG_K_IN_DATA = 8; // Data: Key present

        /* all Submessages are composed of a leading SubmessageHeader */
        struct SubmessageHeader {
            octet submessageId;
            octet flags;           // E = flags & 1 (EndiannessFlag)
            unsigned short submessageLength; /* octetsToNextHeader */
        };
        // Valid constants for the submessageId field are the enumerators
        // of the SubmessageKind enum in MessageTypes.h.
        // The least-significant bit of "flags" is E, the endianness flag:
        // pseudoenum E { BIG_ENDIAN = 0, LITTLE_ENDIAN = 1};

        /* Type used to hold fragment numbers. */
        struct FragmentNumber_t {
            unsigned long value;
        };

        /* FragmentNumberSet SubmessageElements are used to provide binary
        information about individual fragment numbers within a range. */
        struct FragmentNumberSet {
            FragmentNumber_t bitmapBase;
            unsigned long numBits;
            LongSeq8 bitmap;
        };

        /* Provides information on the state of a Reader to a Writer. AckNack
        messages are sent by a Reader to one or more Writers. */
        struct AckNackSubmessage {
            SubmessageHeader smHeader;
                // F = smHeader.flags & 2 (FinalFlag)
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumberSet readerSNState;
            Count_t count;
        };

        /* Sent from an RTPS Writer to an RTPS Reader. Indicates to the RTPS
        Reader that a range of sequence numbers is no longer relevant. */
        struct GapSubmessage {
            SubmessageHeader smHeader;
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumber_t gapStart;
            SequenceNumberSet gapList;
        };

        /* Sent from an RTPS Reader to an RTPS Writer. It contains explicit
        information on where to send a reply to the Submessages that follow it
        within the same message. */
        struct InfoReplySubmessage {
            SubmessageHeader smHeader;
                // M = smHeader.flags & 2 (MulticastFlag)
            LocatorList unicastLocatorList;
            LocatorList multicastLocatorList; // if M
        };

        /* The NackFrag Submessage is used to communicate the state of a Reader to a
        Writer. */
        struct NackFragSubmessage {
            SubmessageHeader smHeader;
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumber_t writerSN;
            FragmentNumberSet fragmentNumberState;
            Count_t count;
        };

        struct ParticipantProxy_t {
            ProtocolVersion_t protocolVersion;
            DCPS::GuidPrefix_t guidPrefix;  // optional in SPDPdiscoveredParticipantData
            VendorId_t vendorId;
            boolean expectsInlineQos;
            BuiltinEndpointSet_t availableBuiltinEndpoints;
            DCPS::LocatorSeq metatrafficUnicastLocatorList;
            DCPS::LocatorSeq metatrafficMulticastLocatorList;
            DCPS::LocatorSeq defaultMulticastLocatorList;
            DCPS::LocatorSeq defaultUnicastLocatorList;
            Count_t manualLivelinessCount;
        };

        // top-level data type for SPDP
        struct SPDPdiscoveredParticipantData {
            DDS::ParticipantBuiltinTopicData ddsParticipantData;
            ParticipantProxy_t participantProxy;
            Duration_t leaseDuration;
        };

        /* Type used to hold data exchanged between Participants.
        This is used for the BuiltinParticipantMessage{Writer,Reader}
        to implement the Writer Liveliness Protocol (8.4.13). */
        struct ParticipantMessageData {
            DCPS::GUID_t participantGuid;
            DDS::OctetSeq data;
        };
        // See PARTICIPANT_MESSAGE_DATA_KIND_* constants for the 'kind'
        // field of ParticipantMessageData, in MessageTypes.h.

        // OMG Specification formal/2010-11-01 DDS-RTPS v2.1
        // Section 9.4: "Mapping of the RTPS Messages"


        // ======== 9.4.2 SubmessageElements ========
        // Many SubmessageElements are already defined in RtpsBaseMessageTypes.idl.
        // The others follow directly here.
        // Note that we are not doing "typedef Foo_t Foo;" -- no need for it.

        // ======== 9.4.4 Header ========

        /* All messages should include a leading RTPS Header. */
        struct Header {
            OctetArray4 prefix;
            ProtocolVersion_t version;
            VendorId_t vendorId;
            DCPS::GuidPrefix_t guidPrefix;
        };


        // ======== 9.4.5 Submessages ========

        /* Sent from an RTPS Writer to an RTPS Reader. Notifies the RTPS Reader of a
        change to a data-object belonging to the RTPS Writer */
        struct DataSubmessage {
            SubmessageHeader smHeader;
                // Q = smHeader.flags & 2 (InlineQosFlag)
                // D = smHeader.flags & 4 (DataFlag)
                // K = smHeader.flags & 8 (KeyFlag)
            unsigned short extraFlags;
            unsigned short octetsToInlineQos; // used by serializer
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumber_t writerSN;
            ParameterList inlineQos; // if Q
            // SerializedPayload payload; // if D|K
            //   These Submessages correspond to the DDS::DCPS::DataSampleHeader,
            //   so they do not contain any payload data.
        };

        /* Sent from an RTPS Writer to an RTPS Reader. Extends the Data Submessage
        by enabling the serializedData to be fragmented and sent as multiple
        DataFrag Submessages. */
        struct DataFragSubmessage {
            SubmessageHeader smHeader;
                // Q = smHeader.flags & 2 (InlineQosFlag)
                // K = smHeader.flags & 4 (KeyFlag)
            unsigned short extraFlags;
            unsigned short octetsToInlineQos; // used by serializer
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumber_t writerSN;
            FragmentNumber_t fragmentStartingNum;
            unsigned short fragmentsInSubmessage;
            unsigned short fragmentSize;
            unsigned long sampleSize;
            ParameterList inlineQos; // if Q
            // SerializedPayload payload;  // unconditional
            //   These Submessages correspond to the DDS::DCPS::DataSampleHeader,
            //   so they do not contain any payload data.
        };

        /* Sent from an RTPS Writer to an RTPS Reader to communicate the sequence
        numbers of changes that the Writer has available. */
        struct HeartBeatSubmessage {
            SubmessageHeader smHeader;
                // F = smHeader.flags & 2 (FinalFlag)
                // L = smHeader.flags & 4 (LivelinessFlag)
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumber_t firstSN;
            SequenceNumber_t lastSN;
            Count_t count;
        };

        /* Sent from an RTPS Writer to an RTPS Reader to communicate which fragments
        the Writer has available. */
        struct HeartBeatFragSubmessage {
            SubmessageHeader smHeader;
            DCPS::EntityId_t readerId;
            DCPS::EntityId_t writerId;
            SequenceNumber_t writerSN;
            FragmentNumber_t lastFragmentNum;
            Count_t count;
        };

        /* Sent from an RTPS Writer to an RTPS Reader to modify the GuidPrefix used
        to interpret the Reader entityIds appearing in the Submessages that follow it. */
        struct InfoDestinationSubmessage {
            SubmessageHeader smHeader;
            DCPS::GuidPrefix_t guidPrefix;
        };

        /* This message modifies the logical source of the Submessages that follow. */
        struct InfoSourceSubmessage {
            SubmessageHeader smHeader;
            long unused;
            ProtocolVersion_t version;
            VendorId_t vendorId;
            DCPS::GuidPrefix_t guidPrefix;
        };

        /* This Submessage is used to send a timestamp which applies to the Submessages
        that follow within the same message. */
        struct InfoTimestampSubmessage {
            SubmessageHeader smHeader;
                // I = smHeader.flags & 2 (InvalidateFlag)
            Timestamp_t timestamp; // if !I (watch the negation)
        };

        /* The purpose of the Pad Submessage is to allow the introduction of any padding
        necessary to meet any desired memory-alignment requirements. Its body is
        empty */
        struct PadSubmessage {
            SubmessageHeader smHeader;
        };

        /* InfoReplyIp4 is provided for efficiency reasons and can be used instead
        of the InfoReply Submessage to provide a more compact representation. */
        struct InfoReplyIp4Submessage {
            SubmessageHeader smHeader;
                // M = smHeader.flags & 2 (MulticastFlag)
            LocatorUDPv4_t unicastLocator;
            LocatorUDPv4_t multicastLocator; // if M
        };

        // Security Submessages (0x30-0x3f) don't have a defined structure since
        // each plugin can impose its own definitions of CryptoContent/Header/Footer
        struct SecuritySubmessage {
            SubmessageHeader smHeader;
            DDS::OctetSeq content;
        };

        enum SubmessageKind {
            SUBMESSAGE_NONE,
            PAD,            /* = 0x01, Pad */
            RESERVED_2,
            RESERVED_3,
            RESERVED_4,
            RESERVED_5,
            ACKNACK,        /* = 0x06, AckNack */
            HEARTBEAT,      /* = 0x07, Heartbeat */
            GAP,            /* = 0x08, Gap */
            INFO_TS,        /* = 0x09, InfoTimestamp */
            RESERVED_10,
            RESERVED_11,
            INFO_SRC,       /* = 0x0c, InfoSource */
            INFO_REPLY_IP4, /* = 0x0d, InfoReplyIp4 */
            INFO_DST,       /* = 0x0e, InfoDestination */
            INFO_REPLY,     /* = 0x0f, InfoReply */
            RESERVED_16,
            RESERVED_17,
            NACK_FRAG,      /* = 0x12, NackFrag */
            HEARTBEAT_FRAG, /* = 0x13, HeartbeatFrag */
            RESERVED_20,
            DATA,           /* = 0x15, Data */
            DATA_FRAG,      /* = 0x16, DataFrag */
            RESERVED_23,
            RESERVED_24,
            RESERVED_25,
            RESERVED_26,
            RESERVED_27,
            RESERVED_28,
            RESERVED_29,
            RESERVED_30,
            RESERVED_31,
            RESERVED_32,
            RESERVED_33,
            RESERVED_34,
            RESERVED_35,
            RESERVED_36,
            RESERVED_37,
            RESERVED_38,
            RESERVED_39,
            RESERVED_40,
            RESERVED_41,
            RESERVED_42,
            RESERVED_43,
            RESERVED_44,
            RESERVED_45,
            RESERVED_46,
            RESERVED_47,
            SEC_BODY,  // SubmessageKinds 0x30-3f reserved for security
            SEC_PREFIX,
            SEC_POSTFIX,
            SRTPS_PREFIX,
            SRTPS_POSTFIX,
            RESERVED_53_SECURITY
        };

        union Submessage switch (SubmessageKind) {
        case PAD:
            PadSubmessage pad_sm;

        case ACKNACK:
            AckNackSubmessage acknack_sm;

        case HEARTBEAT:
            HeartBeatSubmessage heartbeat_sm;

        case GAP:
            GapSubmessage gap_sm;

        case INFO_TS:
            InfoTimestampSubmessage info_ts_sm;

        case INFO_SRC:
            InfoSourceSubmessage info_src_sm;

        case INFO_REPLY_IP4:
            InfoReplyIp4Submessage info_reply_ipv4_sm;

        case INFO_DST:
            InfoDestinationSubmessage info_dst_sm;

        case INFO_REPLY:
            InfoReplySubmessage info_reply_sm;

        case NACK_FRAG:
            NackFragSubmessage nack_frag_sm;

        case HEARTBEAT_FRAG:
            HeartBeatFragSubmessage hb_frag_sm;

        case DATA:
            DataSubmessage data_sm;

        case DATA_FRAG:
            DataFragSubmessage data_frag_sm;

        case SEC_BODY:
        case SEC_PREFIX:
        case SEC_POSTFIX:
        case SRTPS_PREFIX:
        case SRTPS_POSTFIX:
            SecuritySubmessage security_sm;

        default:
            SubmessageHeader unknown_sm;
        };

        typedef sequence<Submessage> SubmessageSeq;

        // Section 9.6: "Mapping of the RTPS Protocol"
        // ======== 9.6.2 Data for Built-in Endpoints ========

        /* The following structs are used for the serializedData of
         * the SPDP/SEDP discovery protocol writers & readers.
         * They are serialized as a ParameterList, not CDR (see section 9.6.2.2).
         * Each of the fields should have a PID_* in Tables 9.12 and 9.13.
         */

        // top-level data type for SEDPbuiltinTopics
        struct DiscoveredTopicData {
            DDS::TopicBuiltinTopicData ddsTopicData;
        };
    };
};

#endif /* RTPS_RTPSCORE_IDL */