LIEF: Library to Instrument Executable Formats Version 1.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 <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
39 public:
40 SegmentSplitInfo() = default;
41 SegmentSplitInfo(const details::linkedit_data_command& cmd);
42
44 SegmentSplitInfo(const SegmentSplitInfo& copy) = default;
45
46 std::unique_ptr<LoadCommand> clone() const override {
47 return std::unique_ptr<SegmentSplitInfo>(new SegmentSplitInfo(*this));
48 }
49
50 uint32_t data_offset() const {
51 return data_offset_;
52 }
53 uint32_t data_size() const {
54 return data_size_;
55 }
56
57 void data_offset(uint32_t offset) {
58 data_offset_ = offset;
59 }
60 void data_size(uint32_t size) {
61 data_size_ = size;
62 }
63
65 return content_;
66 }
67
69 return content_;
70 }
71
72 ~SegmentSplitInfo() override = default;
73
74 void accept(Visitor& visitor) const override;
75
76 std::ostream& print(std::ostream& os) const override;
77
78 static bool classof(const LoadCommand* cmd) {
80 }
81
82 private:
83 uint32_t data_offset_ = 0;
84 uint32_t data_size_ = 0;
85 span<uint8_t> content_;
86};
87
88}
89}
90#endif
Class used to parse a single binary (i.e. non-FAT).
Definition BinaryParser.hpp:78
Definition LinkEdit.hpp:45
uint32_t size() const
Size of the command (should be greather than sizeof(load_command)).
Definition LoadCommand.hpp:133
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:128
@ SEGMENT_SPLIT_INFO
Definition LoadCommand.hpp:76
std::ostream & print(std::ostream &os) const override
uint32_t data_offset() const
Definition SegmentSplitInfo.hpp:50
friend class BinaryParser
Definition SegmentSplitInfo.hpp:36
SegmentSplitInfo & operator=(const SegmentSplitInfo &copy)=default
SegmentSplitInfo(const SegmentSplitInfo &copy)=default
uint32_t data_size() const
Definition SegmentSplitInfo.hpp:53
void data_size(uint32_t size)
Definition SegmentSplitInfo.hpp:60
span< uint8_t > content()
Definition SegmentSplitInfo.hpp:64
void data_offset(uint32_t offset)
Definition SegmentSplitInfo.hpp:57
static bool classof(const LoadCommand *cmd)
Definition SegmentSplitInfo.hpp:78
friend class LinkEdit
Definition SegmentSplitInfo.hpp:37
span< const uint8_t > content() const
Definition SegmentSplitInfo.hpp:68
void accept(Visitor &visitor) const override
std::unique_ptr< LoadCommand > clone() const override
Definition SegmentSplitInfo.hpp:46
~SegmentSplitInfo() override=default
SegmentSplitInfo(const details::linkedit_data_command &cmd)
Definition Visitor.hpp:212
Definition endianness_support.hpp:60
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
LIEF namespace.
Definition Abstract/Binary.hpp:40
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:43