LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
VDEX/Parser.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_VDEX_PARSER_H
17#define LIEF_VDEX_PARSER_H
18
19#include <string_view>
20#include <memory>
21#include <vector>
22
24#include "LIEF/path.hpp"
25#include "LIEF/visibility.h"
26
27namespace LIEF {
28class VectorStream;
29namespace VDEX {
30class File;
31
34 public:
35 static std::unique_ptr<File> parse(std::string_view file);
36
39 template<class PathT, enable_if_path_t<PathT> = 0>
40 static std::unique_ptr<File> parse(const PathT& file) {
41 return parse(file.string());
42 }
43
44 static std::unique_ptr<File> parse(const std::vector<uint8_t>& data,
45 std::string_view name = "");
46
47 Parser& operator=(const Parser& copy) = delete;
48 Parser(const Parser& copy) = delete;
49
50 private:
51 Parser();
52 Parser(std::string_view file);
53 Parser(const std::vector<uint8_t>& data, std::string_view name);
54 ~Parser();
55
56 void init(std::string_view name, vdex_version_t version);
57
58 template<typename VDEX_T>
59 void parse_file();
60
61 template<typename VDEX_T>
62 void parse_header();
63
64 template<typename VDEX_T>
65 void parse_checksums();
66
67 template<typename VDEX_T>
68 void parse_dex_files();
69
70 template<typename VDEX_T>
71 void parse_verifier_deps();
72
73 template<typename VDEX_T>
74 void parse_quickening_info();
75
76 LIEF::VDEX::File* file_ = nullptr;
77 std::unique_ptr<VectorStream> stream_;
78};
79
80}
81}
82#endif
Main class for the VDEX module which represents a VDEX file.
Definition VDEX/File.hpp:42
static std::unique_ptr< File > parse(const std::vector< uint8_t > &data, std::string_view name="")
static std::unique_ptr< File > parse(const PathT &file)
Same as parse(std::string_view) but the file is given as a std::filesystem::path.
Definition VDEX/Parser.hpp:40
Parser & operator=(const Parser &copy)=delete
static std::unique_ptr< File > parse(std::string_view file)
Parser(const Parser &copy)=delete
Definition VectorStream.hpp:29
Definition OAT/Binary.hpp:31
vdex_version_t version(std::string_view file)
Return the VDEX version of the given file.
uint32_t vdex_version_t
Definition VDEX/type_traits.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:41
#define LIEF_API
Definition visibility.h:45