Skip to main content

DbHeader

Struct DbHeader 

Source
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: u32

db_header_size from the outermost 6-byte file header.

§ods: Ods

ODS version (DBINFO offset 0).

§database_id: Timedate

Database identifier (DBINFO offset 4). 8-byte TIMEDATE used as an opaque identifier.

§app_version: u16

Application-defined version (DBINFO offset 12). Free-form u16 for the form designer’s use.

§non_data_rrv_bucket_position: u32

File 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: u16

Number of available non-data RRVs (DBINFO offset 22).

§activity_log_offset: u32

Activity log offset (DBINFO offset 24).

§bucket_modification: Timedate

Most recent bucket modification time (DBINFO offset 28).

§database_class: u16

Database class (DBINFO offset 36). 2-byte identifier of what kind of database this is (mailbox / template / design / etc).

§database_flags: u16

Database flags word (DBINFO offset 38). Use flags constants to interpret; only flags::DBFLAG_TEMPLATE is verified.

§bucket_descriptor_block_size: u32

Bucket Descriptor Block size (DBINFO offset 40).

§bucket_descriptor_block_position: u32

Bucket 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: u16

Bucket Descriptor Table size (DBINFO offset 48).

§bdt_position: u32

Bucket Descriptor Table position (DBINFO offset 50).

§bdt_bitmaps: u16

Bucket Descriptor Table bitmaps (DBINFO offset 54).

§data_rrv_bucket_position: u32

File 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: u32

First data RRV identifier (DBINFO offset 60).

§available_data_rrv_identifier: u32

(next) available data RRV identifier (DBINFO offset 64).

§number_of_available_data_rrvs: u16

Number of available data RRVs (DBINFO offset 68).

§rrv_bucket_size: u16

Size of each RRV bucket in bytes (DBINFO offset 70).

§summary_bucket_size: u16

Size of each summary bucket in bytes (DBINFO offset 72).

§bitmap_size: u16

Bitmap allocation map size (DBINFO offset 74).

§allocation_granularity: u16

Allocation granularity (DBINFO offset 76).

§extention_granularity: u32

Extention granularity (DBINFO offset 78). (Spelling matches the libnsfdb header which inherited the typo from the Notes C API.)

§file_size_pages: u32

File 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

Source

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.

Source

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.

Source

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.

Source

pub fn file_size_from_header_bytes(&self) -> u64

Convenience: file-size estimate from the header’s 256-byte-increment field. Multiply by 256.

Trait Implementations§

Source§

impl Clone for DbHeader

Source§

fn clone(&self) -> DbHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DbHeader

Source§

impl Debug for DbHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DbHeader

Source§

impl PartialEq for DbHeader

Source§

fn eq(&self, other: &DbHeader) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DbHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.