pub struct ExtendedHeader {
pub extended_header_size: u16,
pub metadata_header_size: u16,
pub metadata_size: u32,
pub message_id: u32,
pub additional_fields: Vec<u8>,
}
Expand description
OpenIGTLink Version 3 Extended Header structure
The Extended Header is a fixed 12-byte structure (minimum) that appears immediately after the standard 58-byte header when version >= 3.
§Structure (12 bytes minimum)
- extended_header_size (2 bytes) - Total size including this field and any additional fields
- metadata_header_size (2 bytes) - Number of metadata key-value pairs
- metadata_size (4 bytes) - Total metadata size in bytes
- message_id (4 bytes) - Unique message identifier
- additional_fields (variable) - Optional implementation-specific data
§C++ Compatibility
This structure matches the igtlMessageHeader.h ExtendedHeader format from the OpenIGTLink C++ reference implementation.
Fields§
§extended_header_size: u16
Total size of extended header in bytes (including this field) Minimum value: 12 (for standard Extended Header) Larger values indicate additional implementation-specific fields
metadata_header_size: u16
Number of metadata key-value pairs that follow the message content This is a count, not a size in bytes
metadata_size: u32
Total size of metadata section in bytes (not including this Extended Header) The metadata section appears at the end of the message body
message_id: u32
Unique message identifier for this message Can be used for:
- Request/response correlation
- Message tracking and debugging
- Transfer checkpointing and resumption
additional_fields: Vec<u8>
Additional implementation-specific fields (if extended_header_size > 12) These are optional and can contain custom protocol extensions
Implementations§
Source§impl ExtendedHeader
impl ExtendedHeader
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Extended Header with default values
§Returns
Extended Header with:
- extended_header_size = 12 (minimum)
- metadata_header_size = 0
- metadata_size = 0
- message_id = 0
- no additional fields
Sourcepub fn with_metadata(metadata_count: u16, metadata_size: u32) -> Self
pub fn with_metadata(metadata_count: u16, metadata_size: u32) -> Self
Sourcepub fn with_message_id(message_id: u32) -> Self
pub fn with_message_id(message_id: u32) -> Self
Sourcepub fn set_additional_fields(&mut self, data: Vec<u8>)
pub fn set_additional_fields(&mut self, data: Vec<u8>)
Sourcepub fn has_metadata(&self) -> bool
pub fn has_metadata(&self) -> bool
Check if this Extended Header indicates metadata is present
Sourcepub fn get_metadata_size(&self) -> usize
pub fn get_metadata_size(&self) -> usize
Get the metadata size in bytes (size of metadata data)
Sourcepub fn get_metadata_header_size(&self) -> usize
pub fn get_metadata_header_size(&self) -> usize
Get the metadata header size in bytes (size of metadata structure definitions)
Sourcepub fn get_metadata_count(&self) -> usize
👎Deprecated: Use get_metadata_header_size() instead - metadata_header_size is size in bytes, not count
pub fn get_metadata_count(&self) -> usize
Get the number of metadata entries (deprecated - metadata_header_size is not entry count)
Sourcepub fn get_message_id(&self) -> u32
pub fn get_message_id(&self) -> u32
Get the message ID
Trait Implementations§
Source§impl Clone for ExtendedHeader
impl Clone for ExtendedHeader
Source§fn clone(&self) -> ExtendedHeader
fn clone(&self) -> ExtendedHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more