OpenDDS  Snapshot(2023/04/28-20:55)
RtpsTransportHeader.inl
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
9 
11 
12 namespace OpenDDS {
13 namespace DCPS {
14 
15 ACE_INLINE size_t
17 {
18  return RTPS::RTPSHDR_SZ;
19 }
20 
23  : length_(0)
24  , valid_(false)
25 {
26  for (int i = 0; i < 4; ++i) header_.prefix[i] = 0;
27  header_.version.major = 0;
28  header_.version.minor = 0;
29  header_.vendorId.vendorId[0] = 0;
30  header_.vendorId.vendorId[1] = 0;
31  for (int i = 0; i < 12; ++i) header_.guidPrefix[i] = 0;
32 }
33 
36  : length_(0)
37  , valid_(false)
38 {
39  init(mb);
40 }
41 
44 {
45  // length_ is not updated in a call to operator=()
46  init(mb);
47  return *this;
48 }
49 
50 ACE_INLINE void
52 {
53  // If we get a datagram with an incomplete header, we need to skip
54  // and consume the received bytes so the transport framework doesn't
55  // try to give us these bytes again on the next call to handle_input().
56  ACE_Message_Block* cur = &mb;
57  for (size_t len = mb.total_length(); cur && len; cur = cur->cont()) {
58  len -= cur->length();
59  cur->rd_ptr(cur->length());
60  }
61 }
62 
63 ACE_INLINE bool
65 {
66  return valid_;
67 }
68 
69 ACE_INLINE bool
71 {
72  return false;
73 }
74 
75 ACE_INLINE void
77 {
78 }
79 
80 }
81 }
82 
RtpsTransportHeader & operator=(ACE_Message_Block &mb)
const ACE_CDR::UShort RTPSHDR_SZ
Definition: MessageTypes.h:105
size_t length(void) const
Adapt the TransportReceiveStrategy for RTPS&#39;s "transport" (message) Header.
char * rd_ptr(void) const
ProtocolVersion_t version
Definition: RtpsCore.idl:656
DCPS::GuidPrefix_t guidPrefix
Definition: RtpsCore.idl:658
ACE_Message_Block * cont(void) const
size_t total_length(void) const
OctetArray4 prefix
Definition: RtpsCore.idl:655
void incomplete(ACE_Message_Block &mb)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
void init(ACE_Message_Block &mb)
#define ACE_INLINE
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28