Back to index

enigmail  1.4.3
Public Member Functions | Static Public Member Functions
Elf_Phdr Class Reference

#include <elfxx.h>

Inheritance diagram for Elf_Phdr:
Inheritance graph
[legend]
Collaboration diagram for Elf_Phdr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Elf_Phdr ()
 Elf_Phdr (std::ifstream &file, char ei_class, char ei_data)
bool contains (ElfSection *section)
void serialize (std::ofstream &file, char ei_class, char ei_data)

Static Public Member Functions

static unsigned int size (char ei_class)

Detailed Description

Definition at line 483 of file elfxx.h.


Constructor & Destructor Documentation

Elf_Phdr::Elf_Phdr ( ) [inline]

Definition at line 485 of file elfxx.h.

{};
Elf_Phdr::Elf_Phdr ( std::ifstream &  file,
char  ei_class,
char  ei_data 
) [inline]

Definition at line 486 of file elfxx.h.

    : serializable<Elf_Phdr_Traits>(file, ei_class, ei_data) {};

Member Function Documentation

bool Elf_Phdr::contains ( ElfSection section) [inline]

Definition at line 488 of file elfxx.h.

    {
        unsigned int size = section->getSize();
        unsigned int addr = section->getAddr();
        // This may be biased, but should work in most cases
        if ((section->getFlags() & SHF_ALLOC) == 0)
            return false;
        // Special case for PT_DYNAMIC. Eventually, this should
        // be better handled than special cases
        if ((p_type == PT_DYNAMIC) && (section->getType() != SHT_DYNAMIC))
            return false;
        // Special case for PT_TLS.
        if ((p_type == PT_TLS) && !(section->getFlags() & SHF_TLS))
            return false;
        return (addr >= p_vaddr) &&
               (addr + size <= p_vaddr + p_memsz);

    }

Here is the call graph for this function:

Here is the caller graph for this function:

void serializable< Elf_Phdr_Traits >::serialize ( std::ofstream &  file,
char  ei_class,
char  ei_data 
) [inline, inherited]

Definition at line 251 of file elfxx.h.

    {
        if (ei_class == ELFCLASS32) {
            typename T::Type32 e;
            if (ei_data == ELFDATA2LSB) {
                T::template swap<little_endian>(*this, e);
                file.write((char *)&e, sizeof(e));
                return;
            } else if (ei_data == ELFDATA2MSB) {
                T::template swap<big_endian>(*this, e);
                file.write((char *)&e, sizeof(e));
                return;
            }
        } else if (ei_class == ELFCLASS64) {
            typename T::Type64 e;
            if (ei_data == ELFDATA2LSB) {
                T::template swap<little_endian>(*this, e);
                file.write((char *)&e, sizeof(e));
                return;
            } else if (ei_data == ELFDATA2MSB) {
                T::template swap<big_endian>(*this, e);
                file.write((char *)&e, sizeof(e));
                return;
            }
        }
        throw std::runtime_error("Unsupported ELF class or data encoding");
    }
static unsigned int serializable< Elf_Phdr_Traits >::size ( char  ei_class) [inline, static, inherited]

Definition at line 279 of file elfxx.h.

    {
        if (ei_class == ELFCLASS32)
            return sizeof(typename T::Type32);
        else if (ei_class == ELFCLASS64)
            return sizeof(typename T::Type64);
        return 0;
    }

Here is the caller graph for this function:


The documentation for this class was generated from the following file: