LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
VDEX/Parser.hpp
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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 <memory>
20#include <vector>
21#include <string>
22
23#include "LIEF/VDEX/type_traits.hpp"
24#include "LIEF/visibility.h"
25
26namespace LIEF {
27class VectorStream;
28namespace VDEX {
29class File;
30
32class LIEF_API Parser {
33 public:
34 static std::unique_ptr<File> parse(const std::string& file);
35 static std::unique_ptr<File> parse(const std::vector<uint8_t>& data,
36 const std::string& name = "");
37
38 Parser& operator=(const Parser& copy) = delete;
39 Parser(const Parser& copy) = delete;
40
41 private:
42 Parser();
43 Parser(const std::string& file);
44 Parser(const std::vector<uint8_t>& data, const std::string& name);
45 virtual ~Parser();
46
47 void init(const std::string& name, vdex_version_t version);
48
49 template<typename VDEX_T>
50 void parse_file();
51
52 template<typename VDEX_T>
53 void parse_header();
54
55 template<typename VDEX_T>
56 void parse_checksums();
57
58 template<typename VDEX_T>
59 void parse_dex_files();
60
61 template<typename VDEX_T>
62 void parse_verifier_deps();
63
64 template<typename VDEX_T>
65 void parse_quickening_info();
66
67 LIEF::VDEX::File* file_ = nullptr;
68 std::unique_ptr<VectorStream> stream_;
69};
70
71} // namespace VDEX
72} // namespace LIEF
73#endif
Main class for the VDEX module which represents a VDEX file.
Definition VDEX/File.hpp:42
Class which parse an VDEX file and transform into a VDEX::File object.
Definition VDEX/Parser.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:32