LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
SegmentSplitInfo.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_MACHO_SEGMENT_SPLIT_INFO_H
17#define LIEF_MACHO_SEGMENT_SPLIT_INFO_H
18#include <memory>
19#include <ostream>
20
22#include "LIEF/span.hpp"
23#include "LIEF/visibility.h"
24
26
27
28namespace LIEF::MachO {
29class BinaryParser;
30class LinkEdit;
31
32namespace details {
33struct linkedit_data_command;
34}
35
38 friend class BinaryParser;
39 friend class LinkEdit;
40
41 public:
42 SegmentSplitInfo() = default;
43 SegmentSplitInfo(const details::linkedit_data_command& cmd);
44
46 SegmentSplitInfo(const SegmentSplitInfo& copy) = default;
47
48 std::unique_ptr<LoadCommand> clone() const override {
49 return std::make_unique<SegmentSplitInfo>(*this);
50 }
51
52 uint32_t data_offset() const {
53 return data_offset_;
54 }
55
56 uint32_t data_size() const {
57 return data_size_;
58 }
59
60 void data_offset(uint32_t offset) {
61 data_offset_ = offset;
62 }
63
64 void data_size(uint32_t size) {
65 data_size_ = size;
66 }
67
69 return content_;
70 }
71
73 return content_;
74 }
75
76 ~SegmentSplitInfo() override = default;
77
78 void accept(Visitor& visitor) const override;
79
80 std::ostream& print(std::ostream& os) const override;
81
82 static bool classof(const LoadCommand* cmd) {
84 }
85
86 private:
87 uint32_t data_offset_ = 0;
88 uint32_t data_size_ = 0;
89 span<uint8_t> content_;
90};
91
92}
93
94#endif
Class used to parse a single binary (i.e. non-FAT).
Definition BinaryParser.hpp:81
Definition LinkEdit.hpp:47
uint32_t size() const
Size of the command (should be greater than sizeof(load_command)).
Definition LoadCommand.hpp:137
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:132
@ SEGMENT_SPLIT_INFO
Definition LoadCommand.hpp:78
std::ostream & print(std::ostream &os) const override
uint32_t data_offset() const
Definition SegmentSplitInfo.hpp:52
friend class BinaryParser
Definition SegmentSplitInfo.hpp:38
SegmentSplitInfo & operator=(const SegmentSplitInfo &copy)=default
SegmentSplitInfo(const SegmentSplitInfo &copy)=default
uint32_t data_size() const
Definition SegmentSplitInfo.hpp:56
void data_size(uint32_t size)
Definition SegmentSplitInfo.hpp:64
span< uint8_t > content()
Definition SegmentSplitInfo.hpp:68
void data_offset(uint32_t offset)
Definition SegmentSplitInfo.hpp:60
static bool classof(const LoadCommand *cmd)
Definition SegmentSplitInfo.hpp:82
friend class LinkEdit
Definition SegmentSplitInfo.hpp:39
span< const uint8_t > content() const
Definition SegmentSplitInfo.hpp:72
void accept(Visitor &visitor) const override
std::unique_ptr< LoadCommand > clone() const override
Definition SegmentSplitInfo.hpp:48
~SegmentSplitInfo() override=default
SegmentSplitInfo(const details::linkedit_data_command &cmd)
Definition Visitor.hpp:212
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition endianness_support.hpp:59
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:45