Trait object::read::elf::FileHeader[][src]

pub trait FileHeader: Debug + Pod {
    type Word: Into<u64>;
    type Sword: Into<i64>;
    type Endian: Endian;
    type ProgramHeader: ProgramHeader<Elf = Self, Endian = Self::Endian, Word = Self::Word>;
    type SectionHeader: SectionHeader<Elf = Self, Endian = Self::Endian, Word = Self::Word>;
    type CompressionHeader: CompressionHeader<Endian = Self::Endian, Word = Self::Word>;
    type NoteHeader: NoteHeader<Endian = Self::Endian>;
    type Dyn: Dyn<Endian = Self::Endian, Word = Self::Word>;
    type Sym: Sym<Endian = Self::Endian, Word = Self::Word>;
    type Rel: Rel<Endian = Self::Endian, Word = Self::Word>;
    type Rela: Rela<Endian = Self::Endian, Word = Self::Word> + From<Self::Rel>;
    fn is_type_64(&self) -> bool;
fn e_ident(&self) -> &Ident;
fn e_type(&self, endian: Self::Endian) -> u16;
fn e_machine(&self, endian: Self::Endian) -> u16;
fn e_version(&self, endian: Self::Endian) -> u32;
fn e_entry(&self, endian: Self::Endian) -> Self::Word;
fn e_phoff(&self, endian: Self::Endian) -> Self::Word;
fn e_shoff(&self, endian: Self::Endian) -> Self::Word;
fn e_flags(&self, endian: Self::Endian) -> u32;
fn e_ehsize(&self, endian: Self::Endian) -> u16;
fn e_phentsize(&self, endian: Self::Endian) -> u16;
fn e_phnum(&self, endian: Self::Endian) -> u16;
fn e_shentsize(&self, endian: Self::Endian) -> u16;
fn e_shnum(&self, endian: Self::Endian) -> u16;
fn e_shstrndx(&self, endian: Self::Endian) -> u16; fn parse<'data>(data: Bytes<'data>) -> Result<&'data Self> { ... }
fn is_supported(&self) -> bool { ... }
fn is_class_32(&self) -> bool { ... }
fn is_class_64(&self) -> bool { ... }
fn is_little_endian(&self) -> bool { ... }
fn is_big_endian(&self) -> bool { ... }
fn endian(&self) -> Result<Self::Endian> { ... }
fn section_0<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Option<&'data Self::SectionHeader>> { ... }
fn phnum<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<usize> { ... }
fn shnum<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<usize> { ... }
fn shstrndx<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<u32> { ... }
fn program_headers<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<&'data [Self::ProgramHeader]> { ... }
fn section_headers<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<&'data [Self::SectionHeader]> { ... }
fn section_strings<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>,
        sections: &[Self::SectionHeader]
    ) -> Result<StringTable<'data>> { ... }
fn sections<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<SectionTable<'data, Self>> { ... } }

A trait for generic access to FileHeader32 and FileHeader64.

Associated Types

type Word: Into<u64>[src]

type Sword: Into<i64>[src]

type Endian: Endian[src]

type ProgramHeader: ProgramHeader<Elf = Self, Endian = Self::Endian, Word = Self::Word>[src]

type SectionHeader: SectionHeader<Elf = Self, Endian = Self::Endian, Word = Self::Word>[src]

type CompressionHeader: CompressionHeader<Endian = Self::Endian, Word = Self::Word>[src]

type NoteHeader: NoteHeader<Endian = Self::Endian>[src]

type Dyn: Dyn<Endian = Self::Endian, Word = Self::Word>[src]

type Sym: Sym<Endian = Self::Endian, Word = Self::Word>[src]

type Rel: Rel<Endian = Self::Endian, Word = Self::Word>[src]

type Rela: Rela<Endian = Self::Endian, Word = Self::Word> + From<Self::Rel>[src]

Loading content...

Required methods

fn is_type_64(&self) -> bool[src]

Return true if this type is a 64-bit header.

This is a property of the type, not a value in the header data.

fn e_ident(&self) -> &Ident[src]

fn e_type(&self, endian: Self::Endian) -> u16[src]

fn e_machine(&self, endian: Self::Endian) -> u16[src]

fn e_version(&self, endian: Self::Endian) -> u32[src]

fn e_entry(&self, endian: Self::Endian) -> Self::Word[src]

fn e_phoff(&self, endian: Self::Endian) -> Self::Word[src]

fn e_shoff(&self, endian: Self::Endian) -> Self::Word[src]

fn e_flags(&self, endian: Self::Endian) -> u32[src]

fn e_ehsize(&self, endian: Self::Endian) -> u16[src]

fn e_phentsize(&self, endian: Self::Endian) -> u16[src]

fn e_phnum(&self, endian: Self::Endian) -> u16[src]

fn e_shentsize(&self, endian: Self::Endian) -> u16[src]

fn e_shnum(&self, endian: Self::Endian) -> u16[src]

fn e_shstrndx(&self, endian: Self::Endian) -> u16[src]

Loading content...

Provided methods

fn parse<'data>(data: Bytes<'data>) -> Result<&'data Self>[src]

Read the file header.

Also checks that the ident field in the file header is a supported format.

fn is_supported(&self) -> bool[src]

Check that the ident field in the file header is a supported format.

This checks the magic number, version, class, and endianness.

fn is_class_32(&self) -> bool[src]

fn is_class_64(&self) -> bool[src]

fn is_little_endian(&self) -> bool[src]

fn is_big_endian(&self) -> bool[src]

fn endian(&self) -> Result<Self::Endian>[src]

fn section_0<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<Option<&'data Self::SectionHeader>>
[src]

Return the first section header, if present.

Section 0 is a special case because getting the section headers normally requires shnum, but shnum may be in the first section header.

fn phnum<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<usize>
[src]

Return the e_phnum field of the header. Handles extended values.

Returns Err for invalid values.

fn shnum<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<usize>
[src]

Return the e_shnum field of the header. Handles extended values.

Returns Err for invalid values.

fn shstrndx<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<u32>
[src]

Return the e_shstrndx field of the header. Handles extended values.

Returns Err for invalid values (including if the index is 0).

fn program_headers<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<&'data [Self::ProgramHeader]>
[src]

Return the slice of program headers.

Returns Ok(&[]) if there are no program headers. Returns Err for invalid values.

fn section_headers<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<&'data [Self::SectionHeader]>
[src]

Return the slice of section headers.

Returns Ok(&[]) if there are no section headers. Returns Err for invalid values.

fn section_strings<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>,
    sections: &[Self::SectionHeader]
) -> Result<StringTable<'data>>
[src]

Return the string table for the section headers.

fn sections<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<SectionTable<'data, Self>>
[src]

Return the section table.

Loading content...

Implementors

impl<Endian: Endian> FileHeader for FileHeader32<Endian>[src]

type Word = u32

type Sword = i32

type Endian = Endian

type ProgramHeader = ProgramHeader32<Endian>

type SectionHeader = SectionHeader32<Endian>

type CompressionHeader = CompressionHeader32<Endian>

type NoteHeader = NoteHeader32<Endian>

type Dyn = Dyn32<Endian>

type Sym = Sym32<Endian>

type Rel = Rel32<Endian>

type Rela = Rela32<Endian>

impl<Endian: Endian> FileHeader for FileHeader64<Endian>[src]

type Word = u64

type Sword = i64

type Endian = Endian

type ProgramHeader = ProgramHeader64<Endian>

type SectionHeader = SectionHeader64<Endian>

type CompressionHeader = CompressionHeader64<Endian>

type NoteHeader = NoteHeader32<Endian>

type Dyn = Dyn64<Endian>

type Sym = Sym64<Endian>

type Rel = Rel64<Endian>

type Rela = Rela64<Endian>

Loading content...