Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integrity check metrics: MD5 checksum and packet length #59

Merged
merged 4 commits into from
Nov 15, 2022

Conversation

maxsharabayko
Copy link
Owner

@maxsharabayko maxsharabayko commented Nov 11, 2022

The metrics payload adds two more fields: MD5 checksum and packet length.
Those fields can be used by the receiver to validate that the payload was not altered and that the length of the payload is correct.

The updated format of a generated packet:

///     0         1         2         3         4         5         6
///     0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
///    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
///  0 |                      Packet Sequence Number                   |
///    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
///  8 |                      System Clock Timestamp                   |
///    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// 16 |                     Monotonic Clock Timestamp                 |
///    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// 32 |                              Length                           |
///    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// 40 |                           MD5 Checksum                        |
///    |                                                               |
///    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// 56 |                         Remaining payload                     |
///
///    |<-------------------------- 64 bits -------------------------->|

Note

Packet length might be redundant given the checksum is there. But it might be also useful when only a couple of bytes in a packet are corrupted.

@maxsharabayko maxsharabayko merged commit b3a9101 into master Nov 15, 2022
@maxsharabayko maxsharabayko deleted the develop/new-metrics branch November 15, 2022 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant