LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
DEX
DEX/Header.hpp
Go to the documentation of this file.
1
2
/* Copyright 2017 - 2026 R. Thomas
3
* Copyright 2017 - 2026 Quarkslab
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
#ifndef LIEF_DEX_HEADER_H
18
#define LIEF_DEX_HEADER_H
19
20
#include <array>
21
#include <utility>
22
#include <cstdint>
23
#include <ostream>
24
25
#include "
LIEF/visibility.h
"
26
#include "
LIEF/Object.hpp
"
27
28
namespace
LIEF
{
29
class
Visitor
;
30
31
namespace
DEX
{
32
class
Parser
;
33
39
class
LIEF_API
Header
:
public
Object
{
40
friend
class
Parser
;
41
42
public
:
43
using
location_t
= std::pair<uint32_t, uint32_t>;
44
45
using
magic_t
= std::array<uint8_t, 8>;
46
using
signature_t
= std::array<uint8_t, 20>;
47
48
Header
();
49
Header
(
const
Header
&);
50
Header
&
operator=
(
const
Header
&);
51
52
template
<
class
T>
53
LIEF_LOCAL
Header
(
const
T& header);
54
56
magic_t
magic
()
const
;
57
59
uint32_t
checksum
()
const
;
60
62
signature_t
signature
()
const
;
63
65
uint32_t
file_size
()
const
;
66
68
uint32_t
header_size
()
const
;
69
71
uint32_t
endian_tag
()
const
;
72
74
uint32_t
map
()
const
;
75
77
location_t
strings
()
const
;
78
location_t
link
()
const
;
79
location_t
types
()
const
;
80
location_t
prototypes
()
const
;
81
location_t
fields
()
const
;
82
location_t
methods
()
const
;
83
location_t
classes
()
const
;
84
location_t
data
()
const
;
85
86
uint32_t
nb_classes
()
const
;
87
88
uint32_t
nb_methods
()
const
;
89
90
void
accept
(
Visitor
& visitor)
const override
;
91
92
93
LIEF_API
friend
std::ostream&
operator<<
(std::ostream& os,
const
Header
& hdr);
94
95
~Header
()
override
;
96
97
private
:
98
magic_t
magic_;
99
uint32_t checksum_;
100
signature_t
signature_;
101
uint32_t file_size_;
102
103
uint32_t header_size_;
104
uint32_t endian_tag_;
105
106
uint32_t link_size_;
107
uint32_t link_off_;
108
109
uint32_t map_off_;
110
111
uint32_t string_ids_size_;
112
uint32_t string_ids_off_;
113
114
uint32_t type_ids_size_;
115
uint32_t type_ids_off_;
116
117
uint32_t proto_ids_size_;
118
uint32_t proto_ids_off_;
119
120
uint32_t field_ids_size_;
121
uint32_t field_ids_off_;
122
123
uint32_t method_ids_size_;
124
uint32_t method_ids_off_;
125
126
uint32_t class_defs_size_;
127
uint32_t class_defs_off_;
128
129
uint32_t data_size_;
130
uint32_t data_off_;
131
};
132
133
}
// Namespace DEX
134
}
// Namespace LIEF
135
136
#endif
Object.hpp
LIEF::DEX::Header::strings
location_t strings() const
Offset and size of the string pool.
LIEF::DEX::Header::types
location_t types() const
LIEF::DEX::Header::methods
location_t methods() const
LIEF::DEX::Header::data
location_t data() const
LIEF::DEX::Header::prototypes
location_t prototypes() const
LIEF::DEX::Header::Header
Header(const T &header)
LIEF::DEX::Header::operator<<
friend std::ostream & operator<<(std::ostream &os, const Header &hdr)
LIEF::DEX::Header::location_t
std::pair< uint32_t, uint32_t > location_t
Definition
DEX/Header.hpp:43
LIEF::DEX::Header::magic
magic_t magic() const
The DEX magic bytes (DEX\n followed by the DEX version).
LIEF::DEX::Header::Header
Header()
LIEF::DEX::Header::signature
signature_t signature() const
SHA-1 DEX signature (which is not really used as a signature).
LIEF::DEX::Header::~Header
~Header() override
LIEF::DEX::Header::endian_tag
uint32_t endian_tag() const
File endianess of the file.
LIEF::DEX::Header::fields
location_t fields() const
LIEF::DEX::Header::magic_t
std::array< uint8_t, 8 > magic_t
Definition
DEX/Header.hpp:45
LIEF::DEX::Header::nb_methods
uint32_t nb_methods() const
LIEF::DEX::Header::header_size
uint32_t header_size() const
Size of this header. It should be 0x70.
LIEF::DEX::Header::checksum
uint32_t checksum() const
The file checksum.
LIEF::DEX::Header::classes
location_t classes() const
LIEF::DEX::Header::operator=
Header & operator=(const Header &)
LIEF::DEX::Header::Parser
friend class Parser
Definition
DEX/Header.hpp:40
LIEF::DEX::Header::link
location_t link() const
LIEF::DEX::Header::signature_t
std::array< uint8_t, 20 > signature_t
Definition
DEX/Header.hpp:46
LIEF::DEX::Header::accept
void accept(Visitor &visitor) const override
LIEF::DEX::Header::Header
Header(const Header &)
LIEF::DEX::Header::map
uint32_t map() const
Offset from the start of the file to the map list (see: DEX::MapList).
LIEF::DEX::Header::file_size
uint32_t file_size() const
Size of the entire file (including the current the header).
LIEF::DEX::Header::nb_classes
uint32_t nb_classes() const
LIEF::DEX::Parser
Class which parses a DEX file to produce a DEX::File object.
Definition
DEX/Parser.hpp:38
LIEF::Object::Object
Object()
LIEF::Visitor
Definition
Visitor.hpp:210
LIEF::DEX
Definition
DEX/Class.hpp:30
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
LIEF_LOCAL
#define LIEF_LOCAL
Definition
visibility.h:42
Generated by
1.17.0