00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_TRANSPORTHEADER_H
00009 #define OPENDDS_DCPS_TRANSPORTHEADER_H
00010
00011 #include "ace/Basic_Types.h"
00012 #include "ace/CDR_Base.h"
00013
00014 #include "dds/DCPS/Definitions.h"
00015
00016 namespace OpenDDS {
00017 namespace DCPS {
00018
00019
00020
00021 static const ACE_UINT32 TRANSPORT_HDR_SERIALIZED_SZ(28);
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 struct OpenDDS_Dcps_Export TransportHeader {
00034 static const ACE_CDR::Octet DCPS_PROTOCOL[6];
00035
00036
00037 TransportHeader();
00038
00039
00040 explicit TransportHeader(ACE_Message_Block& buffer);
00041
00042
00043 TransportHeader& operator=(ACE_Message_Block& buffer);
00044
00045 void incomplete(ACE_Message_Block&) {}
00046
00047
00048 bool swap_bytes() const;
00049
00050
00051 bool valid() const;
00052
00053
00054 ACE_CDR::Octet protocol_[6];
00055
00056
00057 bool byte_order_;
00058 bool first_fragment_;
00059 bool last_fragment_;
00060
00061
00062
00063 enum { BYTE_ORDER_FLAG, FIRST_FRAGMENT_FLAG, LAST_FRAGMENT_FLAG };
00064
00065
00066 ACE_CDR::Octet reserved_;
00067
00068
00069
00070 ACE_UINT32 length_;
00071
00072
00073
00074
00075 SequenceNumber sequence_;
00076
00077
00078
00079 ACE_INT64 source_;
00080
00081
00082 static size_t max_marshaled_size();
00083
00084
00085 void init(ACE_Message_Block* buffer);
00086
00087 bool first_fragment() { return this->first_fragment_; }
00088 bool last_fragment() { return this->last_fragment_; }
00089 void last_fragment(bool frag) { this->last_fragment_ = frag; }
00090 const SequenceNumber& sequence() { return this->sequence_; }
00091
00092 static ACE_UINT32 get_length(const char* marshaled_transport_header);
00093
00094 private:
00095 struct no_init_t {};
00096 static const no_init_t no_init;
00097 explicit TransportHeader(const no_init_t&);
00098 };
00099
00100 OpenDDS_Dcps_Export
00101 bool operator<<(ACE_Message_Block&, const TransportHeader& value);
00102
00103 }
00104 }
00105
00106
00107 #if defined(__ACE_INLINE__)
00108 #include "TransportHeader.inl"
00109 #endif
00110
00111 #endif