Coverage Report

Created: 2022-08-24 06:19

/src/Fast-DDS/include/fastdds/rtps/messages/RTPS_messages.h
Line
Count
Source (jump to first uncovered line)
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
15
/**
16
 * @file RTPS_messages.h
17
 */
18
19
#ifndef _FASTDDS_RTPS_RTPS_MESSAGES_H_
20
#define _FASTDDS_RTPS_RTPS_MESSAGES_H_
21
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
22
23
#include <fastdds/rtps/common/Types.h>
24
#include <fastdds/rtps/common/Guid.h>
25
26
#include <iostream>
27
 #include <bitset>
28
namespace eprosima{
29
namespace fastrtps{
30
namespace rtps{
31
32
// //!@brief Enumeration of the different Submessages types
33
enum SubmessageId : uint8_t
34
{
35
    PAD             = 0x01,
36
    ACKNACK         = 0x06,
37
    HEARTBEAT       = 0x07,
38
    GAP             = 0x08,
39
    INFO_TS         = 0x09,
40
    INFO_SRC        = 0x0c,
41
    INFO_REPLY_IP4  = 0x0d,
42
    INFO_DST        = 0x0e,
43
    INFO_REPLY      = 0x0f,
44
    NACK_FRAG       = 0x12,
45
    HEARTBEAT_FRAG  = 0x13,
46
    DATA            = 0x15,
47
    DATA_FRAG       = 0x16
48
};
49
50
//!@brief Structure Header_t, RTPS Message Header Structure.
51
//!@ingroup COMMON_MODULE
52
 struct Header_t{
53
     //!Protocol version
54
     ProtocolVersion_t version;
55
     //!Vendor ID
56
     VendorId_t vendorId;
57
     //!GUID prefix
58
     GuidPrefix_t guidPrefix;
59
     Header_t():
60
         version(c_ProtocolVersion)
61
         , vendorId(c_VendorId_eProsima)
62
0
     {
63
0
     }
64
0
     ~Header_t(){
65
0
     }
66
 };
67
68
 /**
69
  * @param output
70
  * @param h
71
  * @return
72
  */
73
0
 inline std::ostream& operator<<(std::ostream& output,const Header_t& h){
74
0
     output << "RTPS HEADER of Version: " << (int)h.version.m_major << "." << (int)h.version.m_minor;
75
0
     output << "  || VendorId: " <<std::hex<< (int)h.vendorId[0] << "." <<(int)h.vendorId[1] << std::dec;
76
0
     output << "GuidPrefix: " << h.guidPrefix;
77
0
     return output;
78
0
 }
79
80
 //!@brief Structure SubmessageHeader_t, used to contain the header information of a submessage.
81
 struct SubmessageHeader_t
82
 {
83
     octet submessageId;
84
     uint32_t submessageLength;
85
     SubmessageFlag flags;
86
     bool is_last;
87
88
     SubmessageHeader_t()
89
         : submessageId(0)
90
         , submessageLength(0)
91
         , flags(0)
92
         , is_last(false)
93
1.87k
     {}
94
 };
95
96
 using std::cout;
97
 using std::endl;
98
 using std::bitset;
99
100
 /**
101
  * @param output
102
  * @param sh
103
  * @return
104
  */
105
0
 inline std::ostream& operator<<(std::ostream& output,const SubmessageHeader_t& sh){
106
0
     output << "Submessage Header, ID: " <<std::hex<< (int)sh.submessageId << std::dec;
107
0
     output << " length: " << (int)sh.submessageLength << " flags " << (bitset<8>) sh.flags;
108
0
     return output;
109
0
 }
110
}
111
}
112
}
113
114
115
#endif
116
#endif /* _FASTDDS_RTPS_MESSAGES_H_ */