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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00011 00012 namespace OpenDDS { 00013 namespace DCPS { 00014 00015 ACE_INLINE size_t 00016 RtpsTransportHeader::max_marshaled_size() 00017 { 00018 return RTPS::RTPSHDR_SZ; 00019 } 00020 00021 ACE_INLINE 00022 RtpsTransportHeader::RtpsTransportHeader() 00023 : length_(0) 00024 , valid_(false) 00025 { 00026 for (int i = 0; i < 4; ++i) header_.prefix[i] = 0; 00027 header_.version.major = 0; 00028 header_.version.minor = 0; 00029 header_.vendorId.vendorId[0] = 0; 00030 header_.vendorId.vendorId[1] = 0; 00031 for (int i = 0; i < 12; ++i) header_.guidPrefix[i] = 0; 00032 } 00033 00034 ACE_INLINE 00035 RtpsTransportHeader::RtpsTransportHeader(ACE_Message_Block& mb) 00036 : length_(0) 00037 , valid_(false) 00038 { 00039 init(mb); 00040 } 00041 00042 ACE_INLINE RtpsTransportHeader& 00043 RtpsTransportHeader::operator=(ACE_Message_Block& mb) 00044 { 00045 // length_ is not updated in a call to operator=() 00046 init(mb); 00047 return *this; 00048 } 00049 00050 ACE_INLINE void 00051 RtpsTransportHeader::incomplete(ACE_Message_Block& mb) 00052 { 00053 // If we get a datagram with an incomplete header, we need to skip 00054 // and consume the received bytes so the transport framework doesn't 00055 // try to give us these bytes again on the next call to handle_input(). 00056 ACE_Message_Block* cur = &mb; 00057 for (size_t len = mb.total_length(); cur && len; cur = cur->cont()) { 00058 len -= cur->length(); 00059 cur->rd_ptr(cur->length()); 00060 } 00061 } 00062 00063 ACE_INLINE bool 00064 RtpsTransportHeader::valid() const 00065 { 00066 return valid_; 00067 } 00068 00069 ACE_INLINE bool 00070 RtpsTransportHeader::last_fragment() 00071 { 00072 return false; 00073 } 00074 00075 ACE_INLINE void 00076 RtpsTransportHeader::last_fragment(bool /*frag*/) 00077 { 00078 } 00079 00080 } 00081 } 00082 00083 OPENDDS_END_VERSIONED_NAMESPACE_DECL