LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
UUIDCommand.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_MACHO_UUID_COMMAND_H
17#define LIEF_MACHO_UUID_COMMAND_H
18#include <ostream>
19#include <array>
20
21#include "LIEF/visibility.h"
22
23#include "LIEF/MachO/LoadCommand.hpp"
24
25namespace LIEF {
26namespace MachO {
27
28namespace details {
29struct uuid_command;
30}
31
32using uuid_t = std::array<uint8_t, 16>;
33
35class LIEF_API UUIDCommand : public LoadCommand {
36 public:
37 UUIDCommand() = default;
38 UUIDCommand(const details::uuid_command& cmd);
39
40 UUIDCommand& operator=(const UUIDCommand& copy) = default;
41 UUIDCommand(const UUIDCommand& copy) = default;
42
43 std::unique_ptr<LoadCommand> clone() const override {
44 return std::unique_ptr<UUIDCommand>(new UUIDCommand(*this));
45 }
46
47 ~UUIDCommand() override = default;
48
50 const uuid_t& uuid() const {
51 return uuid_;
52 }
53 void uuid(const uuid_t& uuid) {
54 uuid_ = uuid;
55 }
56
57 void accept(Visitor& visitor) const override;
58
59 std::ostream& print(std::ostream& os) const override;
60
61 static bool classof(const LoadCommand* cmd) {
62 return cmd->command() == LoadCommand::TYPE::UUID;
63 }
64
65 private:
66 uuid_t uuid_ = {0};
67};
68
69}
70}
71#endif
Based class for the Mach-O load commands.
Definition LoadCommand.hpp:36
Class that represents the UUID command.
Definition UUIDCommand.hpp:35
const uuid_t & uuid() const
The UUID as a 16-bytes array.
Definition UUIDCommand.hpp:50
Definition Visitor.hpp:219
LIEF namespace.
Definition Abstract/Binary.hpp:32