MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / parse_message

Method parse_message

tools/rtpsrelay/RelayHandler.cpp:515–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

513}
514
515bool VerticalHandler::parse_message(OpenDDS::RTPS::MessageParser& message_parser,
516 const OpenDDS::DCPS::Lockable_Message_Block_Ptr& msg,
517 OpenDDS::DCPS::GUID_t& src_guid,
518 GuidSet& to,
519 bool check_submessages,
520 const OpenDDS::DCPS::MonotonicTimePoint& now)
521{
522 ACE_UNUSED_ARG(msg);
523
524 if (!message_parser.parseHeader()) {
525 HANDLER_ERROR((LM_ERROR, "(%P|%t) ERROR: VerticalHandler::parse_message %C failed to deserialize RTPS header\n", name_.c_str()));
526 return false;
527 }
528
529 const auto& header = message_parser.header();
530 std::memcpy(src_guid.guidPrefix, header.guidPrefix, sizeof(OpenDDS::DCPS::GuidPrefix_t));
531 src_guid.entityId = OpenDDS::DCPS::ENTITYID_PARTICIPANT;
532
533 bool valid_info_dst = false;
534 bool all_valid_info_dst = true;
535
536 while (message_parser.parseSubmessageHeader()) {
537 const auto submessage_header = message_parser.submessageHeader();
538
539 // Check that every non-info submessage has a "valid" (not unknown) destination.
540 switch (submessage_header.submessageId) {
541 case OpenDDS::RTPS::INFO_DST: {
542 OpenDDS::DCPS::GUID_t dest = OpenDDS::DCPS::GUID_UNKNOWN;
543 OpenDDS::DCPS::GuidPrefix_t_forany guidPrefix(dest.guidPrefix);
544 if (!(message_parser >> guidPrefix)) {
545 HANDLER_ERROR((LM_ERROR, "(%P|%t) ERROR: VerticalHandler::parse_message %C failed to deserialize INFO_DST from %C\n", name_.c_str(), guid_to_string(src_guid).c_str()));
546 return false;
547 }
548 valid_info_dst = dest != OpenDDS::DCPS::GUID_UNKNOWN;
549 if (valid_info_dst) {
550 dest.entityId = OpenDDS::DCPS::ENTITYID_PARTICIPANT;
551 to.insert(dest);
552 }
553 break;
554 }
555 case OpenDDS::RTPS::INFO_TS:
556 case OpenDDS::RTPS::INFO_SRC:
557 case OpenDDS::RTPS::INFO_REPLY_IP4:
558 case OpenDDS::RTPS::INFO_REPLY:
559 break;
560 default:
561 all_valid_info_dst = all_valid_info_dst && valid_info_dst;
562 }
563
564 if (check_submessages) {
565 switch (submessage_header.submessageId) {
566 case OpenDDS::RTPS::SRTPS_PREFIX:
567 {
568 if (application_participant_crypto_handle_ == DDS::HANDLE_NIL) {
569 HANDLER_ERROR((LM_ERROR, "(%P|%t) ERROR: VerticalHandler::parse_message %C no crypto handle for application participant\n", name_.c_str()));
570 return false;
571 }
572

Callers

nothing calls this directly

Calls 14

guid_to_stringFunction · 0.85
parseHeaderMethod · 0.80
headerMethod · 0.80
parseSubmessageHeaderMethod · 0.80
application_domainMethod · 0.80
decode_rtps_messageMethod · 0.80
skipSubmessageContentMethod · 0.80
insertMethod · 0.45
get_crypto_handleMethod · 0.45
lengthMethod · 0.45
get_bufferMethod · 0.45

Tested by

no test coverage detected