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

pub trait SectionHeader: Debug + Pod {
    type Elf: FileHeader<SectionHeader = Self, Endian = Self::Endian, Word = Self::Word>;
    type Word: Into<u64>;
    type Endian: Endian;
    fn sh_name(&self, endian: Self::Endian) -> u32;
fn sh_type(&self, endian: Self::Endian) -> u32;
fn sh_flags(&self, endian: Self::Endian) -> Self::Word;
fn sh_addr(&self, endian: Self::Endian) -> Self::Word;
fn sh_offset(&self, endian: Self::Endian) -> Self::Word;
fn sh_size(&self, endian: Self::Endian) -> Self::Word;
fn sh_link(&self, endian: Self::Endian) -> u32;
fn sh_info(&self, endian: Self::Endian) -> u32;
fn sh_addralign(&self, endian: Self::Endian) -> Self::Word;
fn sh_entsize(&self, endian: Self::Endian) -> Self::Word; fn name<'data>(
        &self,
        endian: Self::Endian,
        strings: StringTable<'data>
    ) -> Result<&'data [u8]> { ... }
fn file_range(&self, endian: Self::Endian) -> Option<(u64, u64)> { ... }
fn data<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Bytes<'data>, ()> { ... }
fn data_as_array<'data, T: Pod>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<&'data [T], ()> { ... }
fn symbols<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>,
        sections: &SectionTable<'_, Self::Elf>,
        section_index: usize
    ) -> Result<Option<SymbolTable<'data, Self::Elf>>> { ... }
fn rel<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Option<&'data [<Self::Elf as FileHeader>::Rel]>> { ... }
fn rela<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Option<&'data [<Self::Elf as FileHeader>::Rela]>> { ... }
fn relocation_symbols<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>,
        sections: &SectionTable<'data, Self::Elf>
    ) -> Result<SymbolTable<'data, Self::Elf>> { ... }
fn notes<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Option<NoteIterator<'data, Self::Elf>>> { ... }
fn group<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Option<(u32, &'data [U32Bytes<Self::Endian>])>> { ... } }

A trait for generic access to SectionHeader32 and SectionHeader64.

Associated Types

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

type Word: Into<u64>[src]

type Endian: Endian[src]

Loading content...

Required methods

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

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

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

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

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

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

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

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

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

Loading content...

Provided methods

fn name<'data>(
    &self,
    endian: Self::Endian,
    strings: StringTable<'data>
) -> Result<&'data [u8]>
[src]

Parse the section name from the string table.

fn file_range(&self, endian: Self::Endian) -> Option<(u64, u64)>[src]

Return the offset and size of the section in the file.

Returns None for sections that have no data in the file.

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

Return the section data.

Returns Ok(&[]) if the section has no data. Returns Err for invalid values.

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

Return the section data as a slice of the given type.

Allows padding at the end of the data. Returns Ok(&[]) if the section has no data. Returns Err for invalid values, including bad alignment.

fn symbols<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>,
    sections: &SectionTable<'_, Self::Elf>,
    section_index: usize
) -> Result<Option<SymbolTable<'data, Self::Elf>>>
[src]

Return the symbols in the section.

Also finds the corresponding string table in sections.

section_index must be the 0-based index of this section, and is used to find the corresponding extended section index table in sections.

Returns Ok(None) if the section does not contain symbols. Returns Err for invalid values.

fn rel<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<Option<&'data [<Self::Elf as FileHeader>::Rel]>>
[src]

Return the Elf::Rel entries in the section.

Returns Ok(None) if the section does not contain relocations. Returns Err for invalid values.

fn rela<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<Option<&'data [<Self::Elf as FileHeader>::Rela]>>
[src]

Return the Elf::Rela entries in the section.

Returns Ok(None) if the section does not contain relocations. Returns Err for invalid values.

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

Return the symbol table for a relocation section.

Returns Err for invalid values, including if the section does not contain relocations.

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

Return a note iterator for the section data.

Returns Ok(None) if the section does not contain notes. Returns Err for invalid values.

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

Return the contents of a group section.

The first value is a GRP_* value, and the remaining values are section indices.

Returns Ok(None) if the section does not define a group. Returns Err for invalid values.

Loading content...

Implementors

impl<Endian: Endian> SectionHeader for SectionHeader32<Endian>[src]

type Elf = FileHeader32<Endian>

type Word = u32

type Endian = Endian

impl<Endian: Endian> SectionHeader for SectionHeader64<Endian>[src]

type Word = u64

type Endian = Endian

type Elf = FileHeader64<Endian>

Loading content...