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

Function findLastSubmessage

dds/DCPS/security/CryptoBuiltInImpl.cpp:1331–1351  ·  view source on GitHub ↗

Precondition: the bytes of 'plaintext' are a sequence of RTPS Submessages Returns the index of the final Submessage in the sequence, or 0 if this can't be determined.

Source from the content-addressed store, hash-verified

1329 // Precondition: the bytes of 'plaintext' are a sequence of RTPS Submessages
1330 // Returns the index of the final Submessage in the sequence, or 0 if this can't be determined.
1331 unsigned int findLastSubmessage(const DDS::OctetSeq& plaintext)
1332 {
1333 RTPS::MessageParser parser(plaintext);
1334 const char* const start = parser.current();
1335
1336 while (parser.remaining() >= RTPS::SMHDR_SZ) {
1337 const unsigned int sm_start = static_cast<unsigned int>(parser.current() - start);
1338
1339 if (!parser.parseSubmessageHeader()) {
1340 return 0;
1341 }
1342
1343 if (!parser.hasNextSubmessage()) {
1344 return sm_start;
1345 }
1346
1347 parser.skipToNextSubmessage();
1348 }
1349
1350 return 0;
1351 }
1352
1353 unsigned int roundUp(unsigned int length, unsigned int alignment)
1354 {

Callers 1

encode_rtps_messageMethod · 0.85

Calls 3

parseSubmessageHeaderMethod · 0.80
hasNextSubmessageMethod · 0.80
skipToNextSubmessageMethod · 0.80

Tested by

no test coverage detected