pub struct DbHeader {Show 26 fields
pub db_header_size: u32,
pub ods: Ods,
pub database_id: Timedate,
pub app_version: u16,
pub non_data_rrv_bucket_position: u32,
pub available_non_data_rrv_identifier: u32,
pub number_of_available_non_data_rrvs: u16,
pub activity_log_offset: u32,
pub bucket_modification: Timedate,
pub database_class: u16,
pub database_flags: u16,
pub bucket_descriptor_block_size: u32,
pub bucket_descriptor_block_position: u32,
pub bdt_size: u16,
pub bdt_position: u32,
pub bdt_bitmaps: u16,
pub data_rrv_bucket_position: u32,
pub first_data_rrv_identifier: u32,
pub available_data_rrv_identifier: u32,
pub number_of_available_data_rrvs: u16,
pub rrv_bucket_size: u16,
pub summary_bucket_size: u16,
pub bitmap_size: u16,
pub allocation_granularity: u16,
pub extention_granularity: u32,
pub file_size_pages: u32,
}Expand description
Parsed database header. Self-contained snapshot of DBINFO - the reader does not retain a reference into the file bytes.
Fields§
§db_header_size: u32db_header_size from the outermost 6-byte file header.
ods: OdsODS version (DBINFO offset 0).
database_id: TimedateDatabase identifier (DBINFO offset 4). 8-byte TIMEDATE used as an opaque identifier.
app_version: u16Application-defined version (DBINFO offset 12). Free-form u16 for the form designer’s use.
non_data_rrv_bucket_position: u32File offset of the bucket holding non-data RRVs (DBINFO offset 14). Design notes, ACL notes, replication info, etc.
available_non_data_rrv_identifier: u32(next) available non-data RRV identifier (DBINFO offset 18).
number_of_available_non_data_rrvs: u16Number of available non-data RRVs (DBINFO offset 22).
activity_log_offset: u32Activity log offset (DBINFO offset 24).
bucket_modification: TimedateMost recent bucket modification time (DBINFO offset 28).
database_class: u16Database class (DBINFO offset 36). 2-byte identifier of what kind of database this is (mailbox / template / design / etc).
database_flags: u16Database flags word (DBINFO offset 38). Use flags
constants to interpret; only flags::DBFLAG_TEMPLATE is
verified.
bucket_descriptor_block_size: u32Bucket Descriptor Block size (DBINFO offset 40).
bucket_descriptor_block_position: u32Bucket Descriptor Block position (DBINFO offset 44). Can be
zero on freshly-instantiated templates; use
Self::data_rrv_bucket_position for “where notes live”
rather than this.
bdt_size: u16Bucket Descriptor Table size (DBINFO offset 48).
bdt_position: u32Bucket Descriptor Table position (DBINFO offset 50).
bdt_bitmaps: u16Bucket Descriptor Table bitmaps (DBINFO offset 54).
data_rrv_bucket_position: u32File offset of the bucket holding data RRVs (DBINFO offset 56). THIS is the entry point for note enumeration. Non-zero on any database that contains notes.
first_data_rrv_identifier: u32First data RRV identifier (DBINFO offset 60).
available_data_rrv_identifier: u32(next) available data RRV identifier (DBINFO offset 64).
number_of_available_data_rrvs: u16Number of available data RRVs (DBINFO offset 68).
rrv_bucket_size: u16Size of each RRV bucket in bytes (DBINFO offset 70).
summary_bucket_size: u16Size of each summary bucket in bytes (DBINFO offset 72).
bitmap_size: u16Bitmap allocation map size (DBINFO offset 74).
allocation_granularity: u16Allocation granularity (DBINFO offset 76).
extention_granularity: u32Extention granularity (DBINFO offset 78). (Spelling matches the libnsfdb header which inherited the typo from the Notes C API.)
file_size_pages: u32File size in 256-byte units (DBINFO offset 82). Multiply by 256 to get the bytes the database knows about; may diverge from the OS-reported file size if the file was truncated since the header was last rewritten.
Implementations§
Source§impl DbHeader
impl DbHeader
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, NsfError>
pub fn parse(bytes: &[u8]) -> Result<Self, NsfError>
Parse the file header + DBINFO core from a byte slice containing at least the first 6 + 128 = 134 bytes of the file.
Sourcepub fn is_template(&self) -> bool
pub fn is_template(&self) -> bool
True if the database is flagged as a template (.ntf semantics). Verified empirically against the corpus: set on every .ntf, clear on every .nsf.
Sourcepub fn is_database_encrypted(&self) -> Option<bool>
pub fn is_database_encrypted(&self) -> Option<bool>
Encryption detection: NOT IMPLEMENTED in v0.1.
The libnsfdb spec leaves the encryption-flag bit position as
TODO. The widely-cited 0x0040 value does NOT match the corpus
(every sample has that bit set; none are encrypted). The
authoritative bit lives in HCL’s dbopts.h which we have not
yet imported.
Returns None until detection is reliable. The viewer surfaces
this as “encryption detection deferred” rather than reporting
false negatives.
Sourcepub fn file_size_from_header_bytes(&self) -> u64
pub fn file_size_from_header_bytes(&self) -> u64
Convenience: file-size estimate from the header’s 256-byte-increment field. Multiply by 256.