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.
| 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 | { |
no test coverage detected