Fast DDS  Version 3.6.1.0
Fast DDS
RTPS_messages.hpp
1 // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
19 #ifndef FASTDDS_RTPS_MESSAGES__RTPS_MESSAGES_HPP
20 #define FASTDDS_RTPS_MESSAGES__RTPS_MESSAGES_HPP
21 #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
22 
23 #include <iostream>
24 #include <bitset>
25 
26 #include <fastdds/rtps/common/Guid.hpp>
27 #include <fastdds/rtps/common/Types.hpp>
28 #include <fastdds/rtps/common/VendorId_t.hpp>
29 
30 namespace eprosima {
31 namespace fastdds {
32 namespace rtps {
33 
34 // //!@brief Enumeration of the different Submessages types
35 enum SubmessageId : uint8_t
36 {
37  PAD = 0x01,
38  ACKNACK = 0x06,
39  HEARTBEAT = 0x07,
40  GAP = 0x08,
41  INFO_TS = 0x09,
42  INFO_SRC = 0x0c,
44  INFO_DST = 0x0e,
45  INFO_REPLY = 0x0f,
46  NACK_FRAG = 0x12,
48  DATA = 0x15,
49  DATA_FRAG = 0x16
50 };
51 
54 struct Header_t
55 {
65  {
66  }
67 
69  {
70  }
71 
72 };
73 
79 inline std::ostream& operator <<(
80  std::ostream& output,
81  const Header_t& h)
82 {
83  output << "RTPS HEADER of Version: " << (int)h.version.m_major << "." << (int)h.version.m_minor;
84  output << " || VendorId: " << std::hex << (int)h.vendorId[0] << "." << (int)h.vendorId[1] << std::dec;
85  output << "GuidPrefix: " << h.guidPrefix;
86  return output;
87 }
88 
91 {
93  uint32_t submessageLength;
95  bool is_last;
96 
98  : submessageId(0)
99  , submessageLength(0)
100  , flags(0)
101  , is_last(false)
102  {
103  }
104 
105 };
106 
107 using std::cout;
108 using std::endl;
109 using std::bitset;
110 
116 inline std::ostream& operator <<(
117  std::ostream& output,
118  const SubmessageHeader_t& sh)
119 {
120  output << "Submessage Header, ID: " << std::hex << (int)sh.submessageId << std::dec;
121  output << " length: " << (int)sh.submessageLength << " flags " << (bitset<8>) sh.flags;
122  return output;
123 }
124 
125 } // namespace rtps
126 } // namespace fastdds
127 } // namespace eprosima
128 
129 
130 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
131 #endif // FASTDDS_RTPS_MESSAGES__RTPS_MESSAGES_HPP
std::array< uint8_t, 2 > VendorId_t
Structure VendorId_t, specifying the vendor Id of the implementation.
Definition: VendorId_t.hpp:32
octet SubmessageFlag
Definition: Types.hpp:84
const VendorId_t c_VendorId_eProsima
Definition: VendorId_t.hpp:35
const ProtocolVersion_t c_ProtocolVersion
Definition: Types.hpp:161
uint8_t octet
Definition: Types.hpp:83
std::ostream & operator<<(std::ostream &output, BuiltinTransports transports)
Definition: BuiltinTransports.hpp:118
SubmessageId
Definition: RTPS_messages.hpp:36
@ HEARTBEAT
Definition: RTPS_messages.hpp:39
@ INFO_REPLY
Definition: RTPS_messages.hpp:45
@ GAP
Definition: RTPS_messages.hpp:40
@ PAD
Definition: RTPS_messages.hpp:37
@ INFO_TS
Definition: RTPS_messages.hpp:41
@ INFO_SRC
Definition: RTPS_messages.hpp:42
@ NACK_FRAG
Definition: RTPS_messages.hpp:46
@ DATA_FRAG
Definition: RTPS_messages.hpp:49
@ HEARTBEAT_FRAG
Definition: RTPS_messages.hpp:47
@ ACKNACK
Definition: RTPS_messages.hpp:38
@ DATA
Definition: RTPS_messages.hpp:48
@ INFO_REPLY_IP4
Definition: RTPS_messages.hpp:43
@ INFO_DST
Definition: RTPS_messages.hpp:44
Structure GuidPrefix_t, Guid Prefix of GUID_t.
Definition: GuidPrefix_t.hpp:37
Structure Header_t, RTPS Message Header Structure.
Definition: RTPS_messages.hpp:55
~Header_t()
Definition: RTPS_messages.hpp:68
ProtocolVersion_t version
Protocol version.
Definition: RTPS_messages.hpp:57
fastdds::rtps::VendorId_t vendorId
Vendor ID.
Definition: RTPS_messages.hpp:59
Header_t()
Definition: RTPS_messages.hpp:62
GuidPrefix_t guidPrefix
GUID prefix.
Definition: RTPS_messages.hpp:61
Structure ProtocolVersion_t, contains the protocol version.
Definition: Types.hpp:102
octet m_major
Definition: Types.hpp:103
octet m_minor
Definition: Types.hpp:104
Structure SubmessageHeader_t, used to contain the header information of a submessage.
Definition: RTPS_messages.hpp:91
SubmessageFlag flags
Definition: RTPS_messages.hpp:94
uint32_t submessageLength
Definition: RTPS_messages.hpp:93
SubmessageHeader_t()
Definition: RTPS_messages.hpp:97
octet submessageId
Definition: RTPS_messages.hpp:92
bool is_last
Definition: RTPS_messages.hpp:95