Skip to content

Helper crate for RustDDS, computes CDR-serialized data sizes

Notifications You must be signed in to change notification settings

jhelovuo/cdr-encoding-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This crate specifies the CdrEncodingSize trait. It is a helper to the RustDDS library.

The trait is in a separate crate, because it has a derive-macro.

The RTPS specification version 2.5 Section "9.6.4.8 KeyHash (PID_KEY_HASH)" defines an algorithm for computing a 16-byte hash of a DDS Key of a data sample.

The algorithm summary:

  • Define a "holder" type corresponding to the data sample type.
  • The holder type consists of all the fields that form the Key of the data sample type.
  • The holder type is serialized according to PLAIN_CDR2 Big Endian.
  • If the holder type has maximum serialized size of at most 16 bytes, the serialized representation is the key hash, padded with zero bytes to 16 bytes.
  • If the holder type has maximum serialized size of more then 16 bytes, key hash is the MD5 hash of the serialized representation.
  • This always results in a key hash of exactly 16 bytes.

This trait is a means of deciding if the 16-byte limit is exceede, i.e. if MD5 shold be used or not.

About

Helper crate for RustDDS, computes CDR-serialized data sizes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages