Skip to content

Commit

Permalink
Properly ignore clear submessages on protected topics
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Nov 3, 2023
1 parent 1369e67 commit 3c0d443
Show file tree
Hide file tree
Showing 7 changed files with 289 additions and 74 deletions.
52 changes: 35 additions & 17 deletions include/fastdds/rtps/messages/MessageReceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ class MessageReceiver
//! Function used to process a received message
std::function<void(
const EntityId_t&,
CacheChange_t&)> process_data_message_function_;
CacheChange_t&,
bool)> process_data_message_function_;
//! Function used to process a received fragment message
std::function<void(
const EntityId_t&,
CacheChange_t&,
uint32_t,
uint32_t,
uint16_t)> process_data_fragment_message_function_;
uint16_t,
bool)> process_data_fragment_message_function_;

//!Reset the MessageReceiver to process a new message.
void reset();
Expand Down Expand Up @@ -155,8 +157,9 @@ class MessageReceiver
* -Modify the message receiver state if necessary.
* -Add information to the history.
* -Return an error if the message is malformed.
* @param[in,out] msg Pointer to the message
* @param[in] smh Pointer to the submessage header
* @param[in,out] msg Pointer to the message
* @param[in] smh Pointer to the submessage header
* @param[in] was_decoded Whether the submessage being processed came from decoding a secured submessage
* @return True if correct, false otherwise
*/

Expand All @@ -165,23 +168,29 @@ class MessageReceiver
*
* @param msg
* @param smh
* @param was_decoded
* @return
*/
bool proc_Submsg_Data(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
bool proc_Submsg_DataFrag(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
bool proc_Submsg_Heartbeat(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
bool proc_Submsg_Acknack(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
bool proc_Submsg_Gap(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
bool proc_Submsg_InfoTS(
CDRMessage_t* msg,
SubmessageHeader_t* smh);
Expand All @@ -193,29 +202,34 @@ class MessageReceiver
SubmessageHeader_t* smh);
bool proc_Submsg_NackFrag(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
bool proc_Submsg_HeartbeatFrag(
CDRMessage_t* msg,
SubmessageHeader_t* smh) const;
SubmessageHeader_t* smh,
bool was_decoded) const;
///@}


/**
* @name Variants of received data message processing functions.
*
* @param[in] reader_id The ID of the reader to which the changes is addressed
* @param[in] change The CacheChange with the received data to process
* @param[in] reader_id The ID of the reader to which the changes is addressed
* @param[in] change The CacheChange with the received data to process
* @param[in] was_decoded Whether the submessage being processed came from decoding a secured submessage
*/
///@{
#if HAVE_SECURITY
void process_data_message_with_security(
const EntityId_t& reader_id,
CacheChange_t& change);
CacheChange_t& change,
bool was_decoded);
#endif // HAVE_SECURITY

void process_data_message_without_security(
const EntityId_t& reader_id,
CacheChange_t& change);
CacheChange_t& change,
bool was_decoded);
///@}

/**
Expand All @@ -227,6 +241,8 @@ class MessageReceiver
* @param[in] sample_size The size of the message
* @param[in] fragment_starting_num The index of the first fragment in the message
* @param[in] fragments_in_submessage The number of fragments in the message
* @param[in] was_decoded Whether the submessage being processed came from decoding a secured
* submessage
*/
///@{
#if HAVE_SECURITY
Expand All @@ -235,15 +251,17 @@ class MessageReceiver
CacheChange_t& change,
uint32_t sample_size,
uint32_t fragment_starting_num,
uint16_t fragments_in_submessage);
uint16_t fragments_in_submessage,
bool was_decoded);
#endif // HAVE_SECURITY

void process_data_fragment_message_without_security(
const EntityId_t& reader_id,
CacheChange_t& change,
uint32_t sample_size,
uint32_t fragment_starting_num,
uint16_t fragments_in_submessage);
uint16_t fragments_in_submessage,
bool was_decoded);
///@}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ struct test_UDPv4TransportDescriptor : public SocketTransportDescriptor
uint8_t dropGapMessagesPercentage;
//! Filtering function for dropping gap messages
filter drop_gap_messages_filter_;
// General filtering function for all kind of sub-messages (indiscriminate)
filter sub_messages_filter_;

// General drop percentage (indiscriminate)
uint8_t percentageOfMessagesToDrop;
Expand Down
Loading

0 comments on commit 3c0d443

Please sign in to comment.