LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
SegmentSplitInfo.hpp
Go to the documentation of this file.
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_MACHO_SEGMENT_SPLIT_INFO_H
17#define LIEF_MACHO_SEGMENT_SPLIT_INFO_H
18#include <ostream>
19
20#include "LIEF/visibility.h"
21#include "LIEF/span.hpp"
22
24
25namespace LIEF {
26namespace MachO {
27class BinaryParser;
28class LinkEdit;
29
30namespace details {
31struct linkedit_data_command;
32}
33
36 friend class BinaryParser;
37 friend class LinkEdit;
38 public:
39 SegmentSplitInfo() = default;
40 SegmentSplitInfo(const details::linkedit_data_command& cmd);
41
43 SegmentSplitInfo(const SegmentSplitInfo& copy) = default;
44
45 std::unique_ptr<LoadCommand> clone() const override {
46 return std::unique_ptr<SegmentSplitInfo>(new SegmentSplitInfo(*this));
47 }
48
49 uint32_t data_offset() const {
50 return data_offset_;
51 }
52 uint32_t data_size() const {
53 return data_size_;
54 }
55
56 void data_offset(uint32_t offset) {
57 data_offset_ = offset;
58 }
59 void data_size(uint32_t size) {
60 data_size_ = size;
61 }
62
64 return content_;
65 }
66
68 return content_;
69 }
70
71 ~SegmentSplitInfo() override = default;
72
73 void accept(Visitor& visitor) const override;
74
75 std::ostream& print(std::ostream& os) const override;
76
77 static bool classof(const LoadCommand* cmd) {
78 return cmd->command() == LoadCommand::TYPE::SEGMENT_SPLIT_INFO;
79 }
80
81 private:
82 uint32_t data_offset_ = 0;
83 uint32_t data_size_ = 0;
84 span<uint8_t> content_;
85
86};
87
88}
89}
90#endif
Class used to parse a single binary (i.e. non-FAT)
Definition BinaryParser.hpp:74
Definition LinkEdit.hpp:42
Based class for the Mach-O load commands.
Definition LoadCommand.hpp:36
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:122
Class that represents the LoadCommand::TYPE::SEGMENT_SPLIT_INFO command.
Definition SegmentSplitInfo.hpp:35
std::ostream & print(std::ostream &os) const override
uint32_t data_offset() const
Definition SegmentSplitInfo.hpp:49
SegmentSplitInfo & operator=(const SegmentSplitInfo &copy)=default
SegmentSplitInfo(const SegmentSplitInfo &copy)=default
uint32_t data_size() const
Definition SegmentSplitInfo.hpp:52
void data_size(uint32_t size)
Definition SegmentSplitInfo.hpp:59
span< uint8_t > content()
Definition SegmentSplitInfo.hpp:63
void data_offset(uint32_t offset)
Definition SegmentSplitInfo.hpp:56
static bool classof(const LoadCommand *cmd)
Definition SegmentSplitInfo.hpp:77
span< const uint8_t > content() const
Definition SegmentSplitInfo.hpp:67
void accept(Visitor &visitor) const override
std::unique_ptr< LoadCommand > clone() const override
Definition SegmentSplitInfo.hpp:45
~SegmentSplitInfo() override=default
SegmentSplitInfo(const details::linkedit_data_command &cmd)
Definition Visitor.hpp:224
LIEF namespace.
Definition Abstract/Binary.hpp:32
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:41