| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
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
18
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,
43 INFO_REPLY_IP4 = 0x0d,
44 INFO_DST = 0x0e,
45 INFO_REPLY = 0x0f,
46 NACK_FRAG = 0x12,
47 HEARTBEAT_FRAG = 0x13,
48 DATA = 0x15,
49 DATA_FRAG = 0x16
50};
51
54 struct Header_t
55{
57 ProtocolVersion_t version;
59 fastdds::rtps::VendorId_t vendorId;
61 GuidPrefix_t guidPrefix;
62 Header_t()
63 : version(c_ProtocolVersion)
64 , vendorId(c_VendorId_eProsima)
65 {
66 }
67
68 ~Header_t()
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
90 struct SubmessageHeader_t
91{
92 octet submessageId;
93 uint32_t submessageLength;
94 SubmessageFlag flags;
95 bool is_last;
96
97 SubmessageHeader_t()
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
eprosima::fastdds::rtps::bitset
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds::rtps::operator<<
std::ostream & operator<<(std::ostream &output, BuiltinTransports transports)
Definition BuiltinTransports.hpp:118
eprosima::fastdds::rtps::octet
unsigned char octet
Definition Types.hpp:83
eprosima::fastdds::rtps::VendorId_t
std::array< uint8_t, 2 > VendorId_t
Structure VendorId_t, specifying the vendor Id of the implementation.
Definition VendorId_t.hpp:32
eprosima::fastdds::rtps::c_VendorId_eProsima
const VendorId_t c_VendorId_eProsima
Definition VendorId_t.hpp:35
eprosima::fastdds::rtps::c_ProtocolVersion
const ProtocolVersion_t c_ProtocolVersion
Definition Types.hpp:159
eprosima::fastdds::rtps::SubmessageFlag
unsigned char SubmessageFlag
Definition Types.hpp:86
eprosima::fastdds::rtps::SubmessageId
SubmessageId
Definition RTPS_messages.hpp:36
eprosima::fastdds::rtps::HEARTBEAT
@ HEARTBEAT
Definition RTPS_messages.hpp:39
eprosima::fastdds::rtps::INFO_REPLY
@ INFO_REPLY
Definition RTPS_messages.hpp:45
eprosima::fastdds::rtps::GAP
@ GAP
Definition RTPS_messages.hpp:40
eprosima::fastdds::rtps::PAD
@ PAD
Definition RTPS_messages.hpp:37
eprosima::fastdds::rtps::INFO_TS
@ INFO_TS
Definition RTPS_messages.hpp:41
eprosima::fastdds::rtps::INFO_SRC
@ INFO_SRC
Definition RTPS_messages.hpp:42
eprosima::fastdds::rtps::NACK_FRAG
@ NACK_FRAG
Definition RTPS_messages.hpp:46
eprosima::fastdds::rtps::DATA_FRAG
@ DATA_FRAG
Definition RTPS_messages.hpp:49
eprosima::fastdds::rtps::HEARTBEAT_FRAG
@ HEARTBEAT_FRAG
Definition RTPS_messages.hpp:47
eprosima::fastdds::rtps::ACKNACK
@ ACKNACK
Definition RTPS_messages.hpp:38
eprosima::fastdds::rtps::DATA
@ DATA
Definition RTPS_messages.hpp:48
eprosima::fastdds::rtps::INFO_REPLY_IP4
@ INFO_REPLY_IP4
Definition RTPS_messages.hpp:43
eprosima::fastdds::rtps::INFO_DST
@ INFO_DST
Definition RTPS_messages.hpp:44
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::GuidPrefix_t
Structure GuidPrefix_t, Guid Prefix of GUID_t.
Definition GuidPrefix_t.hpp:37
eprosima::fastdds::rtps::Header_t
Structure Header_t, RTPS Message Header Structure.
Definition RTPS_messages.hpp:55
eprosima::fastdds::rtps::Header_t::~Header_t
~Header_t()
Definition RTPS_messages.hpp:68
eprosima::fastdds::rtps::Header_t::version
ProtocolVersion_t version
Protocol version.
Definition RTPS_messages.hpp:57
eprosima::fastdds::rtps::Header_t::vendorId
fastdds::rtps::VendorId_t vendorId
Vendor ID.
Definition RTPS_messages.hpp:59
eprosima::fastdds::rtps::Header_t::Header_t
Header_t()
Definition RTPS_messages.hpp:62
eprosima::fastdds::rtps::Header_t::guidPrefix
GuidPrefix_t guidPrefix
GUID prefix.
Definition RTPS_messages.hpp:61
eprosima::fastdds::rtps::ProtocolVersion_t
Structure ProtocolVersion_t, contains the protocol version.
Definition Types.hpp:104
eprosima::fastdds::rtps::ProtocolVersion_t::m_major
octet m_major
Definition Types.hpp:105
eprosima::fastdds::rtps::ProtocolVersion_t::m_minor
octet m_minor
Definition Types.hpp:106
eprosima::fastdds::rtps::SubmessageHeader_t
Structure SubmessageHeader_t, used to contain the header information of a submessage.
Definition RTPS_messages.hpp:91
eprosima::fastdds::rtps::SubmessageHeader_t::flags
SubmessageFlag flags
Definition RTPS_messages.hpp:94
eprosima::fastdds::rtps::SubmessageHeader_t::submessageLength
uint32_t submessageLength
Definition RTPS_messages.hpp:93
eprosima::fastdds::rtps::SubmessageHeader_t::SubmessageHeader_t
SubmessageHeader_t()
Definition RTPS_messages.hpp:97
eprosima::fastdds::rtps::SubmessageHeader_t::submessageId
octet submessageId
Definition RTPS_messages.hpp:92
eprosima::fastdds::rtps::SubmessageHeader_t::is_last
bool is_last
Definition RTPS_messages.hpp:95