OpenDDS::DCPS::RtpsTransportHeader Struct Reference

Adapt the TransportReceiveStrategy for RTPS's "transport" (message) Header. More...

#include <RtpsTransportHeader.h>

Collaboration diagram for OpenDDS::DCPS::RtpsTransportHeader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RtpsTransportHeader ()
 RtpsTransportHeader (ACE_Message_Block &mb)
RtpsTransportHeaderoperator= (ACE_Message_Block &mb)
bool valid () const
bool last_fragment ()
void last_fragment (bool frag)
const SequenceNumbersequence ()
void init (ACE_Message_Block &mb)
void incomplete (ACE_Message_Block &mb)

Static Public Member Functions

static size_t max_marshaled_size ()

Public Attributes

size_t length_
OpenDDS::RTPS::Header header_
bool valid_

Detailed Description

Adapt the TransportReceiveStrategy for RTPS's "transport" (message) Header.

Definition at line 22 of file RtpsTransportHeader.h.


Constructor & Destructor Documentation

ACE_INLINE OpenDDS::DCPS::RtpsTransportHeader::RtpsTransportHeader (  ) 

Definition at line 20 of file RtpsTransportHeader.inl.

References OpenDDS::RTPS::Header::guidPrefix, header_, OpenDDS::RTPS::Header::prefix, OpenDDS::RTPS::Header::vendorId, and OpenDDS::RTPS::Header::version.

00021   : length_(0)
00022   , valid_(false)
00023 {
00024   for (int i = 0; i < 4; ++i) header_.prefix[i] = 0;
00025   header_.version.major = 0;
00026   header_.version.minor = 0;
00027   header_.vendorId.vendorId[0] = 0;
00028   header_.vendorId.vendorId[1] = 0;
00029   for (int i = 0; i < 12; ++i) header_.guidPrefix[i] = 0;
00030 }

ACE_INLINE OpenDDS::DCPS::RtpsTransportHeader::RtpsTransportHeader ( ACE_Message_Block &  mb  )  [explicit]

Definition at line 33 of file RtpsTransportHeader.inl.

References init().

00034   : length_(0)
00035   , valid_(false)
00036 {
00037   init(mb);
00038 }


Member Function Documentation

ACE_INLINE void OpenDDS::DCPS::RtpsTransportHeader::incomplete ( ACE_Message_Block &  mb  ) 

Definition at line 49 of file RtpsTransportHeader.inl.

00050 {
00051   // If we get a datagram with an incomplete header, we need to skip
00052   // and consume the received bytes so the transport framework doesn't
00053   // try to give us these bytes again on the next call to handle_input().
00054   ACE_Message_Block* cur = &mb;
00055   for (size_t len = mb.total_length(); cur && len; cur = cur->cont()) {
00056     len -= cur->length();
00057     cur->rd_ptr(cur->length());
00058   }
00059 }

void OpenDDS::DCPS::RtpsTransportHeader::init ( ACE_Message_Block &  mb  ) 

Definition at line 27 of file RtpsTransportHeader.cpp.

References OpenDDS::DCPS::Serializer::ALIGN_CDR, header_, length_, max_marshaled_size(), OpenDDS::RTPS::Header::prefix, PROTOCOL_RTPS, OpenDDS::RTPS::PROTOCOLVERSION, valid_, and OpenDDS::RTPS::Header::version.

Referenced by operator=(), and RtpsTransportHeader().

00028 {
00029   // Byte order doesn't matter for RTPS::Header, since it's
00030   // exclusively structs/arrays of octet.
00031   Serializer ser(&mb, false, Serializer::ALIGN_CDR);
00032   valid_ = (ser >> header_);
00033 
00034   if (valid_) {
00035 
00036     // length_ started as the total number of bytes in the datagram's payload.
00037     // When we return to the TransportReceiveStrategy it must be the number
00038     // of bytes remaining after processing this RTPS::Header.
00039     length_ -= max_marshaled_size();
00040 
00041     // RTPS spec v2.1 section 8.3.6.3
00042     valid_ = std::equal(header_.prefix, header_.prefix + sizeof(header_.prefix),
00043                         PROTOCOL_RTPS);
00044     valid_ &= (header_.version.major == OpenDDS::RTPS::PROTOCOLVERSION.major);
00045   }
00046 }

ACE_INLINE void OpenDDS::DCPS::RtpsTransportHeader::last_fragment ( bool  frag  ) 

Definition at line 74 of file RtpsTransportHeader.inl.

00075 {
00076 }

ACE_INLINE bool OpenDDS::DCPS::RtpsTransportHeader::last_fragment (  ) 

Definition at line 68 of file RtpsTransportHeader.inl.

00069 {
00070   return false;
00071 }

ACE_INLINE size_t OpenDDS::DCPS::RtpsTransportHeader::max_marshaled_size (  )  [static]

Definition at line 14 of file RtpsTransportHeader.inl.

References OpenDDS::RTPS::RTPSHDR_SZ.

Referenced by init().

00015 {
00016   return RTPS::RTPSHDR_SZ;
00017 }

ACE_INLINE RtpsTransportHeader & OpenDDS::DCPS::RtpsTransportHeader::operator= ( ACE_Message_Block &  mb  ) 

Definition at line 41 of file RtpsTransportHeader.inl.

References init().

00042 {
00043   // length_ is not updated in a call to operator=()
00044   init(mb);
00045   return *this;
00046 }

const SequenceNumber & OpenDDS::DCPS::RtpsTransportHeader::sequence (  ) 

Definition at line 49 of file RtpsTransportHeader.cpp.

References dummy.

00050 {
00051   return dummy;
00052 }

ACE_INLINE bool OpenDDS::DCPS::RtpsTransportHeader::valid (  )  const

Definition at line 62 of file RtpsTransportHeader.inl.

References valid_.

00063 {
00064   return valid_;
00065 }


Member Data Documentation

OpenDDS::RTPS::Header OpenDDS::DCPS::RtpsTransportHeader::header_

Definition at line 40 of file RtpsTransportHeader.h.

Referenced by init(), and RtpsTransportHeader().

size_t OpenDDS::DCPS::RtpsTransportHeader::length_

Definition at line 39 of file RtpsTransportHeader.h.

Referenced by init().

bool OpenDDS::DCPS::RtpsTransportHeader::valid_

Definition at line 41 of file RtpsTransportHeader.h.

Referenced by init(), and valid().


The documentation for this struct was generated from the following files:
Generated on Fri Feb 12 20:06:35 2016 for OpenDDS by  doxygen 1.4.7