Continued ripping up the source.
[aesalon.git] / monitor / src / elf / Header.h
blob704f52fb4c70de7cbd72a500c95805bf84a49fc1
1 #ifndef AESALON_MONITOR_ELF_HEADER_H
2 #define AESALON_MONITOR_ELF_HEADER_H
4 #include <linux/elf.h>
6 #include "Types.h"
8 namespace Aesalon {
9 namespace Monitor {
10 namespace ELF {
12 class Header {
13 public:
14 enum endian_mode_e {
15 ENDIAN_LITTLE,
16 ENDIAN_BIG
18 private:
19 #if AESALON_PLATFORM == AESALON_PLATFORM_x86_64
20 typedef Elf64_Ehdr header_t;
21 #elif AESALON_PLATFORM == AESALON_PLATFORM_x86
22 typedef Elf32_Ehdr header_t;
23 #endif
24 header_t data;
26 endian_mode_e endian_mode;
27 public:
28 Header(int file_fd);
29 virtual ~Header() {}
31 Word get_section_header_offset() const { return data.e_shoff; }
32 std::size_t get_num_sections() const { return data.e_shnum; }
34 std::size_t get_string_table_index() const { return data.e_shstrndx; }
36 endian_mode_e get_endian_mode() const { return endian_mode; }
39 } // namespace ELF
40 } // namespace Monitor
41 } // namespace Aesalon
43 #endif