16 #ifndef OPENDDS_SAFETY_PROFILE 20 #include <dds/DdsDcpsGuidTypeSupportImpl.h> 24 #if !defined (__ACE_INLINE__) 31 const Encoding::Kind encoding_kind = Encoding::KIND_UNALIGNED_CDR;
33 bool mb_copy(
char& dest,
const ACE_Message_Block& mb,
size_t offset,
const Encoding&)
35 dest = mb.
rd_ptr()[offset];
42 if (mb.
length() >=
sizeof(T)) {
48 ser.buffer_read(reinterpret_cast<char*>(&dest),
sizeof(T), ser.swap_bytes());
49 return ser.good_bit();
57 if (temp->total_length() <
sizeof(T)) {
61 ser.
buffer_read(reinterpret_cast<char*>(&dest),
sizeof(T), ser.swap_bytes());
62 return ser.good_bit();
69 bool mb_peek(T& dest,
const ACE_Message_Block& mb,
size_t offset,
const Encoding& encoding)
72 const size_t len = iter->length();
74 return mb_copy(dest, *iter, offset, encoding);
91 size_t size,
bool use_data_alloc)
93 enum {
DATA, DB, MB, N_ALLOC };
101 static_cast<ACE_Message_Block*>(
107 use_data_alloc ? allocators[DATA] : 0,
121 use_data_alloc ? allocators[DATA] : 0,
135 COHERENT_LENGTH = 16,
144 unsigned char msg_id;
164 if (!(flags & LIFESPAN_MASK)) expected -= LIFESPAN_LENGTH;
165 if (!(flags & COHERENT_MASK)) expected -= COHERENT_LENGTH;
167 if (flags & CONTENT_FILT_MASK) {
169 encoding.
endianness(static_cast<Endianness>(flags & BYTE_ORDER_MASK));
170 if (!mb_peek(seqLen, mb, expected, encoding)) {
176 return len < expected;
262 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 302 writer << ACE_OutputCDR::from_octet(flags);
316 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 365 size_t frag_remain = size;
366 for (; frag_remain > frag->
length(); frag = frag->
cont()) {
367 frag_remain -= frag->
length();
370 if (frag_remain == frag->
length()) {
376 tail->
rd_ptr(frag_remain);
388 const size_t length =
dup->total_length();
390 const size_t hdr_len = length -
dup->total_length();
396 for (; payload->
length() == 0; payload = payload->
cont()) {
402 if (size < hdr_len) {
407 const size_t avail = size - head->
length() - 4 ;
410 entries.length(n_entries);
412 for (
CORBA::ULong i(0), x(hdr.content_filter_entries_.length());
413 i < n_entries; ++i) {
414 entries[i] = hdr.content_filter_entries_[--x];
415 hdr.content_filter_entries_.length(x);
420 hdr.more_fragments_ =
false;
421 hdr.content_filter_ = (hdr.content_filter_entries_.length() > 0);
422 hdr.message_length_ =
static_cast<ACE_UINT32
>(payload->
total_length());
425 if (hdr.content_filter_) {
432 split_payload(*payload, size - hdr_len, payload_head, payload_tail);
440 if (hdr.content_filter_) {
444 hdr.more_fragments_ =
false;
445 hdr.content_filter_ =
false;
446 hdr.message_length_ =
static_cast<ACE_UINT32
>(payload_tail->
total_length());
478 return "SAMPLE_DATA";
480 return "DATAWRITER_LIVELINESS";
482 return "INSTANCE_REGISTRATION";
484 return "UNREGISTER_INSTANCE";
486 return "DISPOSE_INSTANCE";
488 return "GRACEFUL_DISCONNECT";
490 return "REQUEST_ACK";
494 return "END_COHERENT_CHANGES";
496 return "TRANSPORT_CONTROL";
498 return "DISPOSE_UNREGISTER_INSTANCE";
500 return "END_HISTORIC_SAMPLES";
503 ACE_TEXT(
"%d is either invalid or not recognized.\n"),
505 return "Invalid MessageId";
513 return "SUBMESSAGE_NONE";
515 return "MULTICAST_SYN";
517 return "MULTICAST_SYNACK";
519 return "MULTICAST_NAK";
521 return "MULTICAST_NAKACK";
524 ACE_TEXT(
"%d is either invalid or not recognized.\n"),
526 return "Invalid SubMessageId";
549 ret +=
"Byte order: ";
550 ret += (value.
byte_order_ == 1 ?
"Little" :
"Big");
559 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 568 ret +=
"Sequence: 0x";
572 ret +=
"Timestamp: ";
587 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 595 ret +=
", Content-Filter Entries (";
607 #ifndef OPENDDS_SAFETY_PROFILE 630 <<
" (0x" << std::hex << std::setw(2) << std::setfill(
'0')
635 <<
" (0x" << std::hex << std::setw(2) << std::setfill(
'0')
641 str <<
"Byte order: " << (value.
byte_order_ == 1 ?
"Little" :
"Big")
650 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 659 str <<
"Sequence: 0x" << std::hex << std::setw(4) << std::setfill(
'0')
671 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 673 str <<
", Publisher: " << GuidConverter(value.
publisher_id_);
679 str <<
", Content-Filter Entries (" << len <<
"): [";
689 #endif //OPENDDS_SAFETY_PROFILE
DataSampleHeader header_
The demarshalled sample header.
const LogLevel::Value value
static void add_cfentries(const GUIDSeq *guids, ACE_Message_Block *mb)
static const ACE_Time_Value max_time
char message_id_
The enum MessageId.
size_t length(void) const
ACE_Lock * locking_strategy(void)
bool key_fields_only_
Only the key fields of the data sample are present in the payload.
#define OpenDDS_Dcps_Export
String to_dds_string(unsigned short to_convert)
ACE_UINT32 source_timestamp_nanosec_
const size_t guid_cdr_size
Endianness endianness() const
static bool test_flag(DataSampleHeaderFlag flag, const ACE_Message_Block *buffer)
static ACE_Message_Block * alloc_msgblock(const ACE_Message_Block &mb, size_t size, bool use_data_alloc)
static void split(const ACE_Message_Block &orig, size_t size, Message_Block_Ptr &head, Message_Block_Ptr &tail)
#define ACE_CDR_BYTE_ORDER
void access_allocators(ACE_Allocator *&allocator_strategy, ACE_Allocator *&data_block_allocator, ACE_Allocator *&message_block_allocator)
void serialized_size(const Encoding &encoding, size_t &size, const SequenceNumber &)
char * rd_ptr(void) const
Conversion processing and value testing utilities for RTPS GUID_t types.
MessageId
One byte message id (<256)
#define ACE_NEW_MALLOC_RETURN(POINTER, ALLOCATOR, CONSTRUCTOR, RET_VAL)
Class to serialize and deserialize data for DDS.
ACE_CDR::Boolean operator<<(Serializer &serializer, CoherentChangeControl &value)
Marshal/Insertion into a buffer.
static size_t get_max_serialized_size()
Similar to IDL compiler generated methods.
Holds a data sample received by the transport.
void init(ACE_Message_Block *buffer)
Implement load from buffer.
virtual ACE_Message_Block * release(void)
ACE_Data_Block * data_block(void) const
ACE_Message_Block * cont(void) const
virtual ACE_Message_Block * duplicate(void) const
size_t serialized_size_
Keep track of the amount of data read from a buffer.
GUIDSeq content_filter_entries_
size_t total_length(void) const
char * wr_ptr(void) const
ACE_UINT32 message_length_
bool more_fragments_
The current "Data Sample" needs reassembly before further processing.
static void split_payload(const ACE_Message_Block &orig, size_t size, Message_Block_Ptr &head, Message_Block_Ptr &tail)
const size_t int32_cdr_size
static bool join(const DataSampleHeader &first, const DataSampleHeader &second, DataSampleHeader &result)
char submessage_id_
Implementation-specific sub-message Ids.
ACE_INT32 source_timestamp_sec_
void swap_bytes(bool do_swap)
sequence< GUID_t > GUIDSeq
bool into_received_data_sample(ReceivedDataSample &rds)
static const ACE_Time_Value zero
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
ACE_INT32 lifespan_duration_sec_
const char * to_string(MessageId value)
ACE_UINT32 lifespan_duration_nanosec_
static bool partial(const ACE_Message_Block &mb)
Does the data in this mb constitute a partial Sample Header?
ACE_HANDLE dup(ACE_HANDLE handle)
void buffer_read(char *dest, size_t size, bool swap)
Read from the chain into a destination buffer.
#define ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY
const DCPS::Encoding encoding(DCPS::Encoding::KIND_UNALIGNED_CDR, DCPS::ENDIAN_BIG)
const size_t byte_cdr_size
The Internal API and Implementation of OpenDDS.
static ACE_UINT8 mask_flag(DataSampleHeaderFlag flag)