RtpsTransportHeader.inl

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "dds/DCPS/RTPS/MessageTypes.h"
00009 
00010 namespace OpenDDS {
00011 namespace DCPS {
00012 
00013 ACE_INLINE size_t
00014 RtpsTransportHeader::max_marshaled_size()
00015 {
00016   return RTPS::RTPSHDR_SZ;
00017 }
00018 
00019 ACE_INLINE
00020 RtpsTransportHeader::RtpsTransportHeader()
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 }
00031 
00032 ACE_INLINE
00033 RtpsTransportHeader::RtpsTransportHeader(ACE_Message_Block& mb)
00034   : length_(0)
00035   , valid_(false)
00036 {
00037   init(mb);
00038 }
00039 
00040 ACE_INLINE RtpsTransportHeader&
00041 RtpsTransportHeader::operator=(ACE_Message_Block& mb)
00042 {
00043   // length_ is not updated in a call to operator=()
00044   init(mb);
00045   return *this;
00046 }
00047 
00048 ACE_INLINE void
00049 RtpsTransportHeader::incomplete(ACE_Message_Block& mb)
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 }
00060 
00061 ACE_INLINE bool
00062 RtpsTransportHeader::valid() const
00063 {
00064   return valid_;
00065 }
00066 
00067 ACE_INLINE bool
00068 RtpsTransportHeader::last_fragment()
00069 {
00070   return false;
00071 }
00072 
00073 ACE_INLINE void
00074 RtpsTransportHeader::last_fragment(bool /*frag*/)
00075 {
00076 }
00077 
00078 }
00079 }

Generated on Fri Feb 12 20:05:26 2016 for OpenDDS by  doxygen 1.4.7